{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.RoleAliasDescription where

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

-- | Role alias description.
--
-- /See:/ 'newRoleAliasDescription' smart constructor.
data RoleAliasDescription = RoleAliasDescription'
  { -- | The ARN of the role alias.
    RoleAliasDescription -> Maybe Text
roleAliasArn :: Prelude.Maybe Prelude.Text,
    -- | The UNIX timestamp of when the role alias was last modified.
    RoleAliasDescription -> Maybe POSIX
lastModifiedDate :: Prelude.Maybe Core.POSIX,
    -- | The role alias.
    RoleAliasDescription -> Maybe Text
roleAlias :: Prelude.Maybe Prelude.Text,
    -- | The role alias owner.
    RoleAliasDescription -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | The UNIX timestamp of when the role alias was created.
    RoleAliasDescription -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The number of seconds for which the credential is valid.
    RoleAliasDescription -> Maybe Natural
credentialDurationSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The role ARN.
    RoleAliasDescription -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (RoleAliasDescription -> RoleAliasDescription -> Bool
(RoleAliasDescription -> RoleAliasDescription -> Bool)
-> (RoleAliasDescription -> RoleAliasDescription -> Bool)
-> Eq RoleAliasDescription
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]
(Int -> ReadS RoleAliasDescription)
-> ReadS [RoleAliasDescription]
-> ReadPrec RoleAliasDescription
-> ReadPrec [RoleAliasDescription]
-> Read 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
(Int -> RoleAliasDescription -> ShowS)
-> (RoleAliasDescription -> String)
-> ([RoleAliasDescription] -> ShowS)
-> Show RoleAliasDescription
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. RoleAliasDescription -> Rep RoleAliasDescription x)
-> (forall x. Rep RoleAliasDescription x -> RoleAliasDescription)
-> Generic RoleAliasDescription
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:
--
-- 'roleAliasArn', 'roleAliasDescription_roleAliasArn' - The ARN of the role alias.
--
-- 'lastModifiedDate', 'roleAliasDescription_lastModifiedDate' - The UNIX timestamp of when the role alias was last modified.
--
-- 'roleAlias', 'roleAliasDescription_roleAlias' - The role alias.
--
-- 'owner', 'roleAliasDescription_owner' - The role alias owner.
--
-- '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.
--
-- 'roleArn', 'roleAliasDescription_roleArn' - The role ARN.
newRoleAliasDescription ::
  RoleAliasDescription
newRoleAliasDescription :: RoleAliasDescription
newRoleAliasDescription =
  RoleAliasDescription' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Natural
-> Maybe Text
-> RoleAliasDescription
RoleAliasDescription'
    { $sel:roleAliasArn:RoleAliasDescription' :: Maybe Text
roleAliasArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedDate:RoleAliasDescription' :: Maybe POSIX
lastModifiedDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:roleAlias:RoleAliasDescription' :: Maybe Text
roleAlias = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:owner:RoleAliasDescription' :: Maybe Text
owner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:RoleAliasDescription' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:credentialDurationSeconds:RoleAliasDescription' :: Maybe Natural
credentialDurationSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:RoleAliasDescription' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the role alias.
roleAliasDescription_roleAliasArn :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.Text)
roleAliasDescription_roleAliasArn :: (Maybe Text -> f (Maybe Text))
-> RoleAliasDescription -> f RoleAliasDescription
roleAliasDescription_roleAliasArn = (RoleAliasDescription -> Maybe Text)
-> (RoleAliasDescription -> Maybe Text -> RoleAliasDescription)
-> Lens
     RoleAliasDescription RoleAliasDescription (Maybe Text) (Maybe Text)
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 UNIX timestamp of when the role alias was last modified.
roleAliasDescription_lastModifiedDate :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.UTCTime)
roleAliasDescription_lastModifiedDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RoleAliasDescription -> f RoleAliasDescription
roleAliasDescription_lastModifiedDate = (RoleAliasDescription -> Maybe POSIX)
-> (RoleAliasDescription -> Maybe POSIX -> RoleAliasDescription)
-> Lens
     RoleAliasDescription
     RoleAliasDescription
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> RoleAliasDescription -> f RoleAliasDescription)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RoleAliasDescription
-> f RoleAliasDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The role alias.
roleAliasDescription_roleAlias :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.Text)
roleAliasDescription_roleAlias :: (Maybe Text -> f (Maybe Text))
-> RoleAliasDescription -> f RoleAliasDescription
roleAliasDescription_roleAlias = (RoleAliasDescription -> Maybe Text)
-> (RoleAliasDescription -> Maybe Text -> RoleAliasDescription)
-> Lens
     RoleAliasDescription RoleAliasDescription (Maybe Text) (Maybe Text)
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 role alias owner.
roleAliasDescription_owner :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.Text)
roleAliasDescription_owner :: (Maybe Text -> f (Maybe Text))
-> RoleAliasDescription -> f RoleAliasDescription
roleAliasDescription_owner = (RoleAliasDescription -> Maybe Text)
-> (RoleAliasDescription -> Maybe Text -> RoleAliasDescription)
-> Lens
     RoleAliasDescription RoleAliasDescription (Maybe Text) (Maybe Text)
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 UNIX timestamp of when the role alias was created.
roleAliasDescription_creationDate :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.UTCTime)
roleAliasDescription_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> RoleAliasDescription -> f RoleAliasDescription
roleAliasDescription_creationDate = (RoleAliasDescription -> Maybe POSIX)
-> (RoleAliasDescription -> Maybe POSIX -> RoleAliasDescription)
-> Lens
     RoleAliasDescription
     RoleAliasDescription
     (Maybe POSIX)
     (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> RoleAliasDescription -> f RoleAliasDescription)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> RoleAliasDescription
-> f RoleAliasDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The number of seconds for which the credential is valid.
roleAliasDescription_credentialDurationSeconds :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.Natural)
roleAliasDescription_credentialDurationSeconds :: (Maybe Natural -> f (Maybe Natural))
-> RoleAliasDescription -> f RoleAliasDescription
roleAliasDescription_credentialDurationSeconds = (RoleAliasDescription -> Maybe Natural)
-> (RoleAliasDescription -> Maybe Natural -> RoleAliasDescription)
-> Lens
     RoleAliasDescription
     RoleAliasDescription
     (Maybe Natural)
     (Maybe Natural)
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 role ARN.
roleAliasDescription_roleArn :: Lens.Lens' RoleAliasDescription (Prelude.Maybe Prelude.Text)
roleAliasDescription_roleArn :: (Maybe Text -> f (Maybe Text))
-> RoleAliasDescription -> f RoleAliasDescription
roleAliasDescription_roleArn = (RoleAliasDescription -> Maybe Text)
-> (RoleAliasDescription -> Maybe Text -> RoleAliasDescription)
-> Lens
     RoleAliasDescription RoleAliasDescription (Maybe Text) (Maybe Text)
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 Core.FromJSON RoleAliasDescription where
  parseJSON :: Value -> Parser RoleAliasDescription
parseJSON =
    String
-> (Object -> Parser RoleAliasDescription)
-> Value
-> Parser RoleAliasDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RoleAliasDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Natural
-> Maybe Text
-> RoleAliasDescription
RoleAliasDescription'
            (Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Natural
 -> Maybe Text
 -> RoleAliasDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Natural
      -> Maybe Text
      -> RoleAliasDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"roleAliasArn")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Natural
   -> Maybe Text
   -> RoleAliasDescription)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe POSIX
      -> Maybe Natural
      -> Maybe Text
      -> RoleAliasDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastModifiedDate")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe POSIX
   -> Maybe Natural
   -> Maybe Text
   -> RoleAliasDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Natural
      -> Maybe Text
      -> RoleAliasDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"roleAlias")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Natural
   -> Maybe Text
   -> RoleAliasDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Natural -> Maybe Text -> RoleAliasDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"owner")
            Parser
  (Maybe POSIX
   -> Maybe Natural -> Maybe Text -> RoleAliasDescription)
-> Parser (Maybe POSIX)
-> Parser (Maybe Natural -> Maybe Text -> RoleAliasDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"creationDate")
            Parser (Maybe Natural -> Maybe Text -> RoleAliasDescription)
-> Parser (Maybe Natural)
-> Parser (Maybe Text -> RoleAliasDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"credentialDurationSeconds")
            Parser (Maybe Text -> RoleAliasDescription)
-> Parser (Maybe Text) -> Parser RoleAliasDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"roleArn")
      )

instance Prelude.Hashable RoleAliasDescription

instance Prelude.NFData RoleAliasDescription