{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.WorkSpacesWeb.Types.UserAccessLoggingSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.WorkSpacesWeb.Types.UserAccessLoggingSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | A user access logging settings resource that can be associated with a
-- web portal.
--
-- /See:/ 'newUserAccessLoggingSettings' smart constructor.
data UserAccessLoggingSettings = UserAccessLoggingSettings'
  { -- | A list of web portal ARNs that this user access logging settings is
    -- associated with.
    UserAccessLoggingSettings -> Maybe [Text]
associatedPortalArns :: Prelude.Maybe [Prelude.Text],
    -- | The ARN of the Kinesis stream.
    UserAccessLoggingSettings -> Maybe Text
kinesisStreamArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the user access logging settings.
    UserAccessLoggingSettings -> Text
userAccessLoggingSettingsArn :: Prelude.Text
  }
  deriving (UserAccessLoggingSettings -> UserAccessLoggingSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserAccessLoggingSettings -> UserAccessLoggingSettings -> Bool
$c/= :: UserAccessLoggingSettings -> UserAccessLoggingSettings -> Bool
== :: UserAccessLoggingSettings -> UserAccessLoggingSettings -> Bool
$c== :: UserAccessLoggingSettings -> UserAccessLoggingSettings -> Bool
Prelude.Eq, ReadPrec [UserAccessLoggingSettings]
ReadPrec UserAccessLoggingSettings
Int -> ReadS UserAccessLoggingSettings
ReadS [UserAccessLoggingSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserAccessLoggingSettings]
$creadListPrec :: ReadPrec [UserAccessLoggingSettings]
readPrec :: ReadPrec UserAccessLoggingSettings
$creadPrec :: ReadPrec UserAccessLoggingSettings
readList :: ReadS [UserAccessLoggingSettings]
$creadList :: ReadS [UserAccessLoggingSettings]
readsPrec :: Int -> ReadS UserAccessLoggingSettings
$creadsPrec :: Int -> ReadS UserAccessLoggingSettings
Prelude.Read, Int -> UserAccessLoggingSettings -> ShowS
[UserAccessLoggingSettings] -> ShowS
UserAccessLoggingSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserAccessLoggingSettings] -> ShowS
$cshowList :: [UserAccessLoggingSettings] -> ShowS
show :: UserAccessLoggingSettings -> String
$cshow :: UserAccessLoggingSettings -> String
showsPrec :: Int -> UserAccessLoggingSettings -> ShowS
$cshowsPrec :: Int -> UserAccessLoggingSettings -> ShowS
Prelude.Show, forall x.
Rep UserAccessLoggingSettings x -> UserAccessLoggingSettings
forall x.
UserAccessLoggingSettings -> Rep UserAccessLoggingSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UserAccessLoggingSettings x -> UserAccessLoggingSettings
$cfrom :: forall x.
UserAccessLoggingSettings -> Rep UserAccessLoggingSettings x
Prelude.Generic)

-- |
-- Create a value of 'UserAccessLoggingSettings' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'associatedPortalArns', 'userAccessLoggingSettings_associatedPortalArns' - A list of web portal ARNs that this user access logging settings is
-- associated with.
--
-- 'kinesisStreamArn', 'userAccessLoggingSettings_kinesisStreamArn' - The ARN of the Kinesis stream.
--
-- 'userAccessLoggingSettingsArn', 'userAccessLoggingSettings_userAccessLoggingSettingsArn' - The ARN of the user access logging settings.
newUserAccessLoggingSettings ::
  -- | 'userAccessLoggingSettingsArn'
  Prelude.Text ->
  UserAccessLoggingSettings
newUserAccessLoggingSettings :: Text -> UserAccessLoggingSettings
newUserAccessLoggingSettings
  Text
pUserAccessLoggingSettingsArn_ =
    UserAccessLoggingSettings'
      { $sel:associatedPortalArns:UserAccessLoggingSettings' :: Maybe [Text]
associatedPortalArns =
          forall a. Maybe a
Prelude.Nothing,
        $sel:kinesisStreamArn:UserAccessLoggingSettings' :: Maybe Text
kinesisStreamArn = forall a. Maybe a
Prelude.Nothing,
        $sel:userAccessLoggingSettingsArn:UserAccessLoggingSettings' :: Text
userAccessLoggingSettingsArn =
          Text
pUserAccessLoggingSettingsArn_
      }

-- | A list of web portal ARNs that this user access logging settings is
-- associated with.
userAccessLoggingSettings_associatedPortalArns :: Lens.Lens' UserAccessLoggingSettings (Prelude.Maybe [Prelude.Text])
userAccessLoggingSettings_associatedPortalArns :: Lens' UserAccessLoggingSettings (Maybe [Text])
userAccessLoggingSettings_associatedPortalArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserAccessLoggingSettings' {Maybe [Text]
associatedPortalArns :: Maybe [Text]
$sel:associatedPortalArns:UserAccessLoggingSettings' :: UserAccessLoggingSettings -> Maybe [Text]
associatedPortalArns} -> Maybe [Text]
associatedPortalArns) (\s :: UserAccessLoggingSettings
s@UserAccessLoggingSettings' {} Maybe [Text]
a -> UserAccessLoggingSettings
s {$sel:associatedPortalArns:UserAccessLoggingSettings' :: Maybe [Text]
associatedPortalArns = Maybe [Text]
a} :: UserAccessLoggingSettings) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN of the Kinesis stream.
userAccessLoggingSettings_kinesisStreamArn :: Lens.Lens' UserAccessLoggingSettings (Prelude.Maybe Prelude.Text)
userAccessLoggingSettings_kinesisStreamArn :: Lens' UserAccessLoggingSettings (Maybe Text)
userAccessLoggingSettings_kinesisStreamArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserAccessLoggingSettings' {Maybe Text
kinesisStreamArn :: Maybe Text
$sel:kinesisStreamArn:UserAccessLoggingSettings' :: UserAccessLoggingSettings -> Maybe Text
kinesisStreamArn} -> Maybe Text
kinesisStreamArn) (\s :: UserAccessLoggingSettings
s@UserAccessLoggingSettings' {} Maybe Text
a -> UserAccessLoggingSettings
s {$sel:kinesisStreamArn:UserAccessLoggingSettings' :: Maybe Text
kinesisStreamArn = Maybe Text
a} :: UserAccessLoggingSettings)

-- | The ARN of the user access logging settings.
userAccessLoggingSettings_userAccessLoggingSettingsArn :: Lens.Lens' UserAccessLoggingSettings Prelude.Text
userAccessLoggingSettings_userAccessLoggingSettingsArn :: Lens' UserAccessLoggingSettings Text
userAccessLoggingSettings_userAccessLoggingSettingsArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserAccessLoggingSettings' {Text
userAccessLoggingSettingsArn :: Text
$sel:userAccessLoggingSettingsArn:UserAccessLoggingSettings' :: UserAccessLoggingSettings -> Text
userAccessLoggingSettingsArn} -> Text
userAccessLoggingSettingsArn) (\s :: UserAccessLoggingSettings
s@UserAccessLoggingSettings' {} Text
a -> UserAccessLoggingSettings
s {$sel:userAccessLoggingSettingsArn:UserAccessLoggingSettings' :: Text
userAccessLoggingSettingsArn = Text
a} :: UserAccessLoggingSettings)

instance Data.FromJSON UserAccessLoggingSettings where
  parseJSON :: Value -> Parser UserAccessLoggingSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UserAccessLoggingSettings"
      ( \Object
x ->
          Maybe [Text] -> Maybe Text -> Text -> UserAccessLoggingSettings
UserAccessLoggingSettings'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"associatedPortalArns"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"kinesisStreamArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"userAccessLoggingSettingsArn")
      )

instance Prelude.Hashable UserAccessLoggingSettings where
  hashWithSalt :: Int -> UserAccessLoggingSettings -> Int
hashWithSalt Int
_salt UserAccessLoggingSettings' {Maybe [Text]
Maybe Text
Text
userAccessLoggingSettingsArn :: Text
kinesisStreamArn :: Maybe Text
associatedPortalArns :: Maybe [Text]
$sel:userAccessLoggingSettingsArn:UserAccessLoggingSettings' :: UserAccessLoggingSettings -> Text
$sel:kinesisStreamArn:UserAccessLoggingSettings' :: UserAccessLoggingSettings -> Maybe Text
$sel:associatedPortalArns:UserAccessLoggingSettings' :: UserAccessLoggingSettings -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
associatedPortalArns
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kinesisStreamArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
userAccessLoggingSettingsArn

instance Prelude.NFData UserAccessLoggingSettings where
  rnf :: UserAccessLoggingSettings -> ()
rnf UserAccessLoggingSettings' {Maybe [Text]
Maybe Text
Text
userAccessLoggingSettingsArn :: Text
kinesisStreamArn :: Maybe Text
associatedPortalArns :: Maybe [Text]
$sel:userAccessLoggingSettingsArn:UserAccessLoggingSettings' :: UserAccessLoggingSettings -> Text
$sel:kinesisStreamArn:UserAccessLoggingSettings' :: UserAccessLoggingSettings -> Maybe Text
$sel:associatedPortalArns:UserAccessLoggingSettings' :: UserAccessLoggingSettings -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
associatedPortalArns
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kinesisStreamArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
userAccessLoggingSettingsArn