{-# 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.IoT.Types.RoleAliasDescription
-- 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.IoT.Types.RoleAliasDescription 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

-- | Role alias description.
--
-- /See:/ 'newRoleAliasDescription' smart constructor.
data RoleAliasDescription = RoleAliasDescription'
  { -- | The UNIX timestamp of when the role alias was created.
    RoleAliasDescription -> Maybe POSIX
creationDate :: Prelude.Maybe Data.POSIX,
    -- | The number of seconds for which the credential is valid.
    RoleAliasDescription -> Maybe Natural
credentialDurationSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The UNIX timestamp of when the role alias was last modified.
    RoleAliasDescription -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Data.POSIX,
    -- | The role alias owner.
    RoleAliasDescription -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | The role alias.
    RoleAliasDescription -> Maybe Text
roleAlias :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the role alias.
    RoleAliasDescription -> Maybe Text
roleAliasArn :: Prelude.Maybe Prelude.Text,
    -- | The role ARN.
    RoleAliasDescription -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (RoleAliasDescription -> RoleAliasDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RoleAliasDescription -> RoleAliasDescription -> Bool
$c/= :: RoleAliasDescription -> RoleAliasDescription -> Bool
== :: RoleAliasDescription -> RoleAliasDescription -> Bool
$c== :: RoleAliasDescription -> RoleAliasDescription -> Bool
Prelude.Eq, ReadPrec [RoleAliasDescription]
ReadPrec RoleAliasDescription
Int -> ReadS RoleAliasDescription
ReadS [RoleAliasDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RoleAliasDescription]
$creadListPrec :: ReadPrec [RoleAliasDescription]
readPrec :: ReadPrec RoleAliasDescription
$creadPrec :: ReadPrec RoleAliasDescription
readList :: ReadS [RoleAliasDescription]
$creadList :: ReadS [RoleAliasDescription]
readsPrec :: Int -> ReadS RoleAliasDescription
$creadsPrec :: Int -> ReadS RoleAliasDescription
Prelude.Read, Int -> RoleAliasDescription -> ShowS
[RoleAliasDescription] -> ShowS
RoleAliasDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RoleAliasDescription] -> ShowS
$cshowList :: [RoleAliasDescription] -> ShowS
show :: RoleAliasDescription -> String
$cshow :: RoleAliasDescription -> String
showsPrec :: Int -> RoleAliasDescription -> ShowS
$cshowsPrec :: Int -> RoleAliasDescription -> ShowS
Prelude.Show, forall x. Rep RoleAliasDescription x -> RoleAliasDescription
forall x. RoleAliasDescription -> Rep RoleAliasDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RoleAliasDescription x -> RoleAliasDescription
$cfrom :: forall x. RoleAliasDescription -> Rep RoleAliasDescription x
Prelude.Generic)

-- |
-- Create a value of 'RoleAliasDescription' 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:
--
-- 'creationDate', 'roleAliasDescription_creationDate' - The UNIX timestamp of when the role alias was created.
--
-- 'credentialDurationSeconds', 'roleAliasDescription_credentialDurationSeconds' - The number of seconds for which the credential is valid.
--
-- 'lastModifiedDate', 'roleAliasDescription_lastModifiedDate' - The UNIX timestamp of when the role alias was last modified.
--
-- 'owner', 'roleAliasDescription_owner' - The role alias owner.
--
-- 'roleAlias', 'roleAliasDescription_roleAlias' - The role alias.
--
-- 'roleAliasArn', 'roleAliasDescription_roleAliasArn' - The ARN of the role alias.
--
-- 'roleArn', 'roleAliasDescription_roleArn' - The role ARN.
newRoleAliasDescription ::
  RoleAliasDescription
newRoleAliasDescription :: RoleAliasDescription
newRoleAliasDescription =
  RoleAliasDescription'
    { $sel:creationDate:RoleAliasDescription' :: Maybe POSIX
creationDate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:credentialDurationSeconds:RoleAliasDescription' :: Maybe Natural
credentialDurationSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedDate:RoleAliasDescription' :: Maybe POSIX
lastModifiedDate = forall a. Maybe a
Prelude.Nothing,
      $sel:owner:RoleAliasDescription' :: Maybe Text
owner = forall a. Maybe a
Prelude.Nothing,
      $sel:roleAlias:RoleAliasDescription' :: Maybe Text
roleAlias = forall a. Maybe a
Prelude.Nothing,
      $sel:roleAliasArn:RoleAliasDescription' :: Maybe Text
roleAliasArn = forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:RoleAliasDescription' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The UNIX timestamp of when the role alias was created.
roleAliasDescription_creationDate :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.UTCTime)
roleAliasDescription_creationDate :: Lens' RoleAliasDescription (Maybe UTCTime)
roleAliasDescription_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleAliasDescription' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:RoleAliasDescription' :: RoleAliasDescription -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: RoleAliasDescription
s@RoleAliasDescription' {} Maybe POSIX
a -> RoleAliasDescription
s {$sel:creationDate:RoleAliasDescription' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: RoleAliasDescription) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The number of seconds for which the credential is valid.
roleAliasDescription_credentialDurationSeconds :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.Natural)
roleAliasDescription_credentialDurationSeconds :: Lens' RoleAliasDescription (Maybe Natural)
roleAliasDescription_credentialDurationSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleAliasDescription' {Maybe Natural
credentialDurationSeconds :: Maybe Natural
$sel:credentialDurationSeconds:RoleAliasDescription' :: RoleAliasDescription -> Maybe Natural
credentialDurationSeconds} -> Maybe Natural
credentialDurationSeconds) (\s :: RoleAliasDescription
s@RoleAliasDescription' {} Maybe Natural
a -> RoleAliasDescription
s {$sel:credentialDurationSeconds:RoleAliasDescription' :: Maybe Natural
credentialDurationSeconds = Maybe Natural
a} :: RoleAliasDescription)

-- | The UNIX timestamp of when the role alias was last modified.
roleAliasDescription_lastModifiedDate :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.UTCTime)
roleAliasDescription_lastModifiedDate :: Lens' RoleAliasDescription (Maybe UTCTime)
roleAliasDescription_lastModifiedDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleAliasDescription' {Maybe POSIX
lastModifiedDate :: Maybe POSIX
$sel:lastModifiedDate:RoleAliasDescription' :: RoleAliasDescription -> Maybe POSIX
lastModifiedDate} -> Maybe POSIX
lastModifiedDate) (\s :: RoleAliasDescription
s@RoleAliasDescription' {} Maybe POSIX
a -> RoleAliasDescription
s {$sel:lastModifiedDate:RoleAliasDescription' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
a} :: RoleAliasDescription) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The role alias owner.
roleAliasDescription_owner :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.Text)
roleAliasDescription_owner :: Lens' RoleAliasDescription (Maybe Text)
roleAliasDescription_owner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleAliasDescription' {Maybe Text
owner :: Maybe Text
$sel:owner:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
owner} -> Maybe Text
owner) (\s :: RoleAliasDescription
s@RoleAliasDescription' {} Maybe Text
a -> RoleAliasDescription
s {$sel:owner:RoleAliasDescription' :: Maybe Text
owner = Maybe Text
a} :: RoleAliasDescription)

-- | The role alias.
roleAliasDescription_roleAlias :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.Text)
roleAliasDescription_roleAlias :: Lens' RoleAliasDescription (Maybe Text)
roleAliasDescription_roleAlias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleAliasDescription' {Maybe Text
roleAlias :: Maybe Text
$sel:roleAlias:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
roleAlias} -> Maybe Text
roleAlias) (\s :: RoleAliasDescription
s@RoleAliasDescription' {} Maybe Text
a -> RoleAliasDescription
s {$sel:roleAlias:RoleAliasDescription' :: Maybe Text
roleAlias = Maybe Text
a} :: RoleAliasDescription)

-- | The ARN of the role alias.
roleAliasDescription_roleAliasArn :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.Text)
roleAliasDescription_roleAliasArn :: Lens' RoleAliasDescription (Maybe Text)
roleAliasDescription_roleAliasArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleAliasDescription' {Maybe Text
roleAliasArn :: Maybe Text
$sel:roleAliasArn:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
roleAliasArn} -> Maybe Text
roleAliasArn) (\s :: RoleAliasDescription
s@RoleAliasDescription' {} Maybe Text
a -> RoleAliasDescription
s {$sel:roleAliasArn:RoleAliasDescription' :: Maybe Text
roleAliasArn = Maybe Text
a} :: RoleAliasDescription)

-- | The role ARN.
roleAliasDescription_roleArn :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.Text)
roleAliasDescription_roleArn :: Lens' RoleAliasDescription (Maybe Text)
roleAliasDescription_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleAliasDescription' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: RoleAliasDescription
s@RoleAliasDescription' {} Maybe Text
a -> RoleAliasDescription
s {$sel:roleArn:RoleAliasDescription' :: Maybe Text
roleArn = Maybe Text
a} :: RoleAliasDescription)

instance Data.FromJSON RoleAliasDescription where
  parseJSON :: Value -> Parser RoleAliasDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RoleAliasDescription"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Natural
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> RoleAliasDescription
RoleAliasDescription'
            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
"creationDate")
            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
"credentialDurationSeconds")
            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
"lastModifiedDate")
            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
"owner")
            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
"roleAlias")
            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
"roleAliasArn")
            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
"roleArn")
      )

instance Prelude.Hashable RoleAliasDescription where
  hashWithSalt :: Int -> RoleAliasDescription -> Int
hashWithSalt Int
_salt RoleAliasDescription' {Maybe Natural
Maybe Text
Maybe POSIX
roleArn :: Maybe Text
roleAliasArn :: Maybe Text
roleAlias :: Maybe Text
owner :: Maybe Text
lastModifiedDate :: Maybe POSIX
credentialDurationSeconds :: Maybe Natural
creationDate :: Maybe POSIX
$sel:roleArn:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
$sel:roleAliasArn:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
$sel:roleAlias:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
$sel:owner:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
$sel:lastModifiedDate:RoleAliasDescription' :: RoleAliasDescription -> Maybe POSIX
$sel:credentialDurationSeconds:RoleAliasDescription' :: RoleAliasDescription -> Maybe Natural
$sel:creationDate:RoleAliasDescription' :: RoleAliasDescription -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
credentialDurationSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastModifiedDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
owner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleAlias
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleAliasArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn

instance Prelude.NFData RoleAliasDescription where
  rnf :: RoleAliasDescription -> ()
rnf RoleAliasDescription' {Maybe Natural
Maybe Text
Maybe POSIX
roleArn :: Maybe Text
roleAliasArn :: Maybe Text
roleAlias :: Maybe Text
owner :: Maybe Text
lastModifiedDate :: Maybe POSIX
credentialDurationSeconds :: Maybe Natural
creationDate :: Maybe POSIX
$sel:roleArn:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
$sel:roleAliasArn:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
$sel:roleAlias:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
$sel:owner:RoleAliasDescription' :: RoleAliasDescription -> Maybe Text
$sel:lastModifiedDate:RoleAliasDescription' :: RoleAliasDescription -> Maybe POSIX
$sel:credentialDurationSeconds:RoleAliasDescription' :: RoleAliasDescription -> Maybe Natural
$sel:creationDate:RoleAliasDescription' :: RoleAliasDescription -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
credentialDurationSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastModifiedDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
owner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleAlias
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleAliasArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn