{-# 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.SecurityHub.Types.AwsIamAccessKeyDetails
-- 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.SecurityHub.Types.AwsIamAccessKeyDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsIamAccessKeySessionContext
import Amazonka.SecurityHub.Types.AwsIamAccessKeyStatus

-- | IAM access key details related to a finding.
--
-- /See:/ 'newAwsIamAccessKeyDetails' smart constructor.
data AwsIamAccessKeyDetails = AwsIamAccessKeyDetails'
  { -- | The status of the IAM access key related to a finding.
    AwsIamAccessKeyDetails -> Maybe AwsIamAccessKeyStatus
status :: Prelude.Maybe AwsIamAccessKeyStatus,
    -- | The ID of the principal associated with an access key.
    AwsIamAccessKeyDetails -> Maybe Text
principalId :: Prelude.Maybe Prelude.Text,
    -- | The type of principal associated with an access key.
    AwsIamAccessKeyDetails -> Maybe Text
principalType :: Prelude.Maybe Prelude.Text,
    -- | The name of the principal.
    AwsIamAccessKeyDetails -> Maybe Text
principalName :: Prelude.Maybe Prelude.Text,
    -- | Indicates when the IAM access key was created.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsIamAccessKeyDetails -> Maybe Text
createdAt :: Prelude.Maybe Prelude.Text,
    -- | The user associated with the IAM access key related to a finding.
    --
    -- The @UserName@ parameter has been replaced with the @PrincipalName@
    -- parameter because access keys can also be assigned to principals that
    -- are not IAM users.
    AwsIamAccessKeyDetails -> Maybe Text
userName :: Prelude.Maybe Prelude.Text,
    -- | Information about the session that the key was used for.
    AwsIamAccessKeyDetails -> Maybe AwsIamAccessKeySessionContext
sessionContext :: Prelude.Maybe AwsIamAccessKeySessionContext,
    -- | The Amazon Web Services account ID of the account for the key.
    AwsIamAccessKeyDetails -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the access key.
    AwsIamAccessKeyDetails -> Maybe Text
accessKeyId :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsIamAccessKeyDetails -> AwsIamAccessKeyDetails -> Bool
(AwsIamAccessKeyDetails -> AwsIamAccessKeyDetails -> Bool)
-> (AwsIamAccessKeyDetails -> AwsIamAccessKeyDetails -> Bool)
-> Eq AwsIamAccessKeyDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsIamAccessKeyDetails -> AwsIamAccessKeyDetails -> Bool
$c/= :: AwsIamAccessKeyDetails -> AwsIamAccessKeyDetails -> Bool
== :: AwsIamAccessKeyDetails -> AwsIamAccessKeyDetails -> Bool
$c== :: AwsIamAccessKeyDetails -> AwsIamAccessKeyDetails -> Bool
Prelude.Eq, ReadPrec [AwsIamAccessKeyDetails]
ReadPrec AwsIamAccessKeyDetails
Int -> ReadS AwsIamAccessKeyDetails
ReadS [AwsIamAccessKeyDetails]
(Int -> ReadS AwsIamAccessKeyDetails)
-> ReadS [AwsIamAccessKeyDetails]
-> ReadPrec AwsIamAccessKeyDetails
-> ReadPrec [AwsIamAccessKeyDetails]
-> Read AwsIamAccessKeyDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsIamAccessKeyDetails]
$creadListPrec :: ReadPrec [AwsIamAccessKeyDetails]
readPrec :: ReadPrec AwsIamAccessKeyDetails
$creadPrec :: ReadPrec AwsIamAccessKeyDetails
readList :: ReadS [AwsIamAccessKeyDetails]
$creadList :: ReadS [AwsIamAccessKeyDetails]
readsPrec :: Int -> ReadS AwsIamAccessKeyDetails
$creadsPrec :: Int -> ReadS AwsIamAccessKeyDetails
Prelude.Read, Int -> AwsIamAccessKeyDetails -> ShowS
[AwsIamAccessKeyDetails] -> ShowS
AwsIamAccessKeyDetails -> String
(Int -> AwsIamAccessKeyDetails -> ShowS)
-> (AwsIamAccessKeyDetails -> String)
-> ([AwsIamAccessKeyDetails] -> ShowS)
-> Show AwsIamAccessKeyDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsIamAccessKeyDetails] -> ShowS
$cshowList :: [AwsIamAccessKeyDetails] -> ShowS
show :: AwsIamAccessKeyDetails -> String
$cshow :: AwsIamAccessKeyDetails -> String
showsPrec :: Int -> AwsIamAccessKeyDetails -> ShowS
$cshowsPrec :: Int -> AwsIamAccessKeyDetails -> ShowS
Prelude.Show, (forall x. AwsIamAccessKeyDetails -> Rep AwsIamAccessKeyDetails x)
-> (forall x.
    Rep AwsIamAccessKeyDetails x -> AwsIamAccessKeyDetails)
-> Generic AwsIamAccessKeyDetails
forall x. Rep AwsIamAccessKeyDetails x -> AwsIamAccessKeyDetails
forall x. AwsIamAccessKeyDetails -> Rep AwsIamAccessKeyDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsIamAccessKeyDetails x -> AwsIamAccessKeyDetails
$cfrom :: forall x. AwsIamAccessKeyDetails -> Rep AwsIamAccessKeyDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsIamAccessKeyDetails' 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:
--
-- 'status', 'awsIamAccessKeyDetails_status' - The status of the IAM access key related to a finding.
--
-- 'principalId', 'awsIamAccessKeyDetails_principalId' - The ID of the principal associated with an access key.
--
-- 'principalType', 'awsIamAccessKeyDetails_principalType' - The type of principal associated with an access key.
--
-- 'principalName', 'awsIamAccessKeyDetails_principalName' - The name of the principal.
--
-- 'createdAt', 'awsIamAccessKeyDetails_createdAt' - Indicates when the IAM access key was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'userName', 'awsIamAccessKeyDetails_userName' - The user associated with the IAM access key related to a finding.
--
-- The @UserName@ parameter has been replaced with the @PrincipalName@
-- parameter because access keys can also be assigned to principals that
-- are not IAM users.
--
-- 'sessionContext', 'awsIamAccessKeyDetails_sessionContext' - Information about the session that the key was used for.
--
-- 'accountId', 'awsIamAccessKeyDetails_accountId' - The Amazon Web Services account ID of the account for the key.
--
-- 'accessKeyId', 'awsIamAccessKeyDetails_accessKeyId' - The identifier of the access key.
newAwsIamAccessKeyDetails ::
  AwsIamAccessKeyDetails
newAwsIamAccessKeyDetails :: AwsIamAccessKeyDetails
newAwsIamAccessKeyDetails =
  AwsIamAccessKeyDetails' :: Maybe AwsIamAccessKeyStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe AwsIamAccessKeySessionContext
-> Maybe Text
-> Maybe Text
-> AwsIamAccessKeyDetails
AwsIamAccessKeyDetails'
    { $sel:status:AwsIamAccessKeyDetails' :: Maybe AwsIamAccessKeyStatus
status = Maybe AwsIamAccessKeyStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:principalId:AwsIamAccessKeyDetails' :: Maybe Text
principalId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:principalType:AwsIamAccessKeyDetails' :: Maybe Text
principalType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:principalName:AwsIamAccessKeyDetails' :: Maybe Text
principalName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:AwsIamAccessKeyDetails' :: Maybe Text
createdAt = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userName:AwsIamAccessKeyDetails' :: Maybe Text
userName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sessionContext:AwsIamAccessKeyDetails' :: Maybe AwsIamAccessKeySessionContext
sessionContext = Maybe AwsIamAccessKeySessionContext
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:AwsIamAccessKeyDetails' :: Maybe Text
accountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accessKeyId:AwsIamAccessKeyDetails' :: Maybe Text
accessKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the IAM access key related to a finding.
awsIamAccessKeyDetails_status :: Lens.Lens' AwsIamAccessKeyDetails (Prelude.Maybe AwsIamAccessKeyStatus)
awsIamAccessKeyDetails_status :: (Maybe AwsIamAccessKeyStatus -> f (Maybe AwsIamAccessKeyStatus))
-> AwsIamAccessKeyDetails -> f AwsIamAccessKeyDetails
awsIamAccessKeyDetails_status = (AwsIamAccessKeyDetails -> Maybe AwsIamAccessKeyStatus)
-> (AwsIamAccessKeyDetails
    -> Maybe AwsIamAccessKeyStatus -> AwsIamAccessKeyDetails)
-> Lens
     AwsIamAccessKeyDetails
     AwsIamAccessKeyDetails
     (Maybe AwsIamAccessKeyStatus)
     (Maybe AwsIamAccessKeyStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamAccessKeyDetails' {Maybe AwsIamAccessKeyStatus
status :: Maybe AwsIamAccessKeyStatus
$sel:status:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe AwsIamAccessKeyStatus
status} -> Maybe AwsIamAccessKeyStatus
status) (\s :: AwsIamAccessKeyDetails
s@AwsIamAccessKeyDetails' {} Maybe AwsIamAccessKeyStatus
a -> AwsIamAccessKeyDetails
s {$sel:status:AwsIamAccessKeyDetails' :: Maybe AwsIamAccessKeyStatus
status = Maybe AwsIamAccessKeyStatus
a} :: AwsIamAccessKeyDetails)

-- | The ID of the principal associated with an access key.
awsIamAccessKeyDetails_principalId :: Lens.Lens' AwsIamAccessKeyDetails (Prelude.Maybe Prelude.Text)
awsIamAccessKeyDetails_principalId :: (Maybe Text -> f (Maybe Text))
-> AwsIamAccessKeyDetails -> f AwsIamAccessKeyDetails
awsIamAccessKeyDetails_principalId = (AwsIamAccessKeyDetails -> Maybe Text)
-> (AwsIamAccessKeyDetails -> Maybe Text -> AwsIamAccessKeyDetails)
-> Lens
     AwsIamAccessKeyDetails
     AwsIamAccessKeyDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamAccessKeyDetails' {Maybe Text
principalId :: Maybe Text
$sel:principalId:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
principalId} -> Maybe Text
principalId) (\s :: AwsIamAccessKeyDetails
s@AwsIamAccessKeyDetails' {} Maybe Text
a -> AwsIamAccessKeyDetails
s {$sel:principalId:AwsIamAccessKeyDetails' :: Maybe Text
principalId = Maybe Text
a} :: AwsIamAccessKeyDetails)

-- | The type of principal associated with an access key.
awsIamAccessKeyDetails_principalType :: Lens.Lens' AwsIamAccessKeyDetails (Prelude.Maybe Prelude.Text)
awsIamAccessKeyDetails_principalType :: (Maybe Text -> f (Maybe Text))
-> AwsIamAccessKeyDetails -> f AwsIamAccessKeyDetails
awsIamAccessKeyDetails_principalType = (AwsIamAccessKeyDetails -> Maybe Text)
-> (AwsIamAccessKeyDetails -> Maybe Text -> AwsIamAccessKeyDetails)
-> Lens
     AwsIamAccessKeyDetails
     AwsIamAccessKeyDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamAccessKeyDetails' {Maybe Text
principalType :: Maybe Text
$sel:principalType:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
principalType} -> Maybe Text
principalType) (\s :: AwsIamAccessKeyDetails
s@AwsIamAccessKeyDetails' {} Maybe Text
a -> AwsIamAccessKeyDetails
s {$sel:principalType:AwsIamAccessKeyDetails' :: Maybe Text
principalType = Maybe Text
a} :: AwsIamAccessKeyDetails)

-- | The name of the principal.
awsIamAccessKeyDetails_principalName :: Lens.Lens' AwsIamAccessKeyDetails (Prelude.Maybe Prelude.Text)
awsIamAccessKeyDetails_principalName :: (Maybe Text -> f (Maybe Text))
-> AwsIamAccessKeyDetails -> f AwsIamAccessKeyDetails
awsIamAccessKeyDetails_principalName = (AwsIamAccessKeyDetails -> Maybe Text)
-> (AwsIamAccessKeyDetails -> Maybe Text -> AwsIamAccessKeyDetails)
-> Lens
     AwsIamAccessKeyDetails
     AwsIamAccessKeyDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamAccessKeyDetails' {Maybe Text
principalName :: Maybe Text
$sel:principalName:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
principalName} -> Maybe Text
principalName) (\s :: AwsIamAccessKeyDetails
s@AwsIamAccessKeyDetails' {} Maybe Text
a -> AwsIamAccessKeyDetails
s {$sel:principalName:AwsIamAccessKeyDetails' :: Maybe Text
principalName = Maybe Text
a} :: AwsIamAccessKeyDetails)

-- | Indicates when the IAM access key was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsIamAccessKeyDetails_createdAt :: Lens.Lens' AwsIamAccessKeyDetails (Prelude.Maybe Prelude.Text)
awsIamAccessKeyDetails_createdAt :: (Maybe Text -> f (Maybe Text))
-> AwsIamAccessKeyDetails -> f AwsIamAccessKeyDetails
awsIamAccessKeyDetails_createdAt = (AwsIamAccessKeyDetails -> Maybe Text)
-> (AwsIamAccessKeyDetails -> Maybe Text -> AwsIamAccessKeyDetails)
-> Lens
     AwsIamAccessKeyDetails
     AwsIamAccessKeyDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamAccessKeyDetails' {Maybe Text
createdAt :: Maybe Text
$sel:createdAt:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
createdAt} -> Maybe Text
createdAt) (\s :: AwsIamAccessKeyDetails
s@AwsIamAccessKeyDetails' {} Maybe Text
a -> AwsIamAccessKeyDetails
s {$sel:createdAt:AwsIamAccessKeyDetails' :: Maybe Text
createdAt = Maybe Text
a} :: AwsIamAccessKeyDetails)

-- | The user associated with the IAM access key related to a finding.
--
-- The @UserName@ parameter has been replaced with the @PrincipalName@
-- parameter because access keys can also be assigned to principals that
-- are not IAM users.
awsIamAccessKeyDetails_userName :: Lens.Lens' AwsIamAccessKeyDetails (Prelude.Maybe Prelude.Text)
awsIamAccessKeyDetails_userName :: (Maybe Text -> f (Maybe Text))
-> AwsIamAccessKeyDetails -> f AwsIamAccessKeyDetails
awsIamAccessKeyDetails_userName = (AwsIamAccessKeyDetails -> Maybe Text)
-> (AwsIamAccessKeyDetails -> Maybe Text -> AwsIamAccessKeyDetails)
-> Lens
     AwsIamAccessKeyDetails
     AwsIamAccessKeyDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamAccessKeyDetails' {Maybe Text
userName :: Maybe Text
$sel:userName:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
userName} -> Maybe Text
userName) (\s :: AwsIamAccessKeyDetails
s@AwsIamAccessKeyDetails' {} Maybe Text
a -> AwsIamAccessKeyDetails
s {$sel:userName:AwsIamAccessKeyDetails' :: Maybe Text
userName = Maybe Text
a} :: AwsIamAccessKeyDetails)

-- | Information about the session that the key was used for.
awsIamAccessKeyDetails_sessionContext :: Lens.Lens' AwsIamAccessKeyDetails (Prelude.Maybe AwsIamAccessKeySessionContext)
awsIamAccessKeyDetails_sessionContext :: (Maybe AwsIamAccessKeySessionContext
 -> f (Maybe AwsIamAccessKeySessionContext))
-> AwsIamAccessKeyDetails -> f AwsIamAccessKeyDetails
awsIamAccessKeyDetails_sessionContext = (AwsIamAccessKeyDetails -> Maybe AwsIamAccessKeySessionContext)
-> (AwsIamAccessKeyDetails
    -> Maybe AwsIamAccessKeySessionContext -> AwsIamAccessKeyDetails)
-> Lens
     AwsIamAccessKeyDetails
     AwsIamAccessKeyDetails
     (Maybe AwsIamAccessKeySessionContext)
     (Maybe AwsIamAccessKeySessionContext)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamAccessKeyDetails' {Maybe AwsIamAccessKeySessionContext
sessionContext :: Maybe AwsIamAccessKeySessionContext
$sel:sessionContext:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe AwsIamAccessKeySessionContext
sessionContext} -> Maybe AwsIamAccessKeySessionContext
sessionContext) (\s :: AwsIamAccessKeyDetails
s@AwsIamAccessKeyDetails' {} Maybe AwsIamAccessKeySessionContext
a -> AwsIamAccessKeyDetails
s {$sel:sessionContext:AwsIamAccessKeyDetails' :: Maybe AwsIamAccessKeySessionContext
sessionContext = Maybe AwsIamAccessKeySessionContext
a} :: AwsIamAccessKeyDetails)

-- | The Amazon Web Services account ID of the account for the key.
awsIamAccessKeyDetails_accountId :: Lens.Lens' AwsIamAccessKeyDetails (Prelude.Maybe Prelude.Text)
awsIamAccessKeyDetails_accountId :: (Maybe Text -> f (Maybe Text))
-> AwsIamAccessKeyDetails -> f AwsIamAccessKeyDetails
awsIamAccessKeyDetails_accountId = (AwsIamAccessKeyDetails -> Maybe Text)
-> (AwsIamAccessKeyDetails -> Maybe Text -> AwsIamAccessKeyDetails)
-> Lens
     AwsIamAccessKeyDetails
     AwsIamAccessKeyDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamAccessKeyDetails' {Maybe Text
accountId :: Maybe Text
$sel:accountId:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: AwsIamAccessKeyDetails
s@AwsIamAccessKeyDetails' {} Maybe Text
a -> AwsIamAccessKeyDetails
s {$sel:accountId:AwsIamAccessKeyDetails' :: Maybe Text
accountId = Maybe Text
a} :: AwsIamAccessKeyDetails)

-- | The identifier of the access key.
awsIamAccessKeyDetails_accessKeyId :: Lens.Lens' AwsIamAccessKeyDetails (Prelude.Maybe Prelude.Text)
awsIamAccessKeyDetails_accessKeyId :: (Maybe Text -> f (Maybe Text))
-> AwsIamAccessKeyDetails -> f AwsIamAccessKeyDetails
awsIamAccessKeyDetails_accessKeyId = (AwsIamAccessKeyDetails -> Maybe Text)
-> (AwsIamAccessKeyDetails -> Maybe Text -> AwsIamAccessKeyDetails)
-> Lens
     AwsIamAccessKeyDetails
     AwsIamAccessKeyDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamAccessKeyDetails' {Maybe Text
accessKeyId :: Maybe Text
$sel:accessKeyId:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
accessKeyId} -> Maybe Text
accessKeyId) (\s :: AwsIamAccessKeyDetails
s@AwsIamAccessKeyDetails' {} Maybe Text
a -> AwsIamAccessKeyDetails
s {$sel:accessKeyId:AwsIamAccessKeyDetails' :: Maybe Text
accessKeyId = Maybe Text
a} :: AwsIamAccessKeyDetails)

instance Core.FromJSON AwsIamAccessKeyDetails where
  parseJSON :: Value -> Parser AwsIamAccessKeyDetails
parseJSON =
    String
-> (Object -> Parser AwsIamAccessKeyDetails)
-> Value
-> Parser AwsIamAccessKeyDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsIamAccessKeyDetails"
      ( \Object
x ->
          Maybe AwsIamAccessKeyStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe AwsIamAccessKeySessionContext
-> Maybe Text
-> Maybe Text
-> AwsIamAccessKeyDetails
AwsIamAccessKeyDetails'
            (Maybe AwsIamAccessKeyStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe AwsIamAccessKeySessionContext
 -> Maybe Text
 -> Maybe Text
 -> AwsIamAccessKeyDetails)
-> Parser (Maybe AwsIamAccessKeyStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe AwsIamAccessKeySessionContext
      -> Maybe Text
      -> Maybe Text
      -> AwsIamAccessKeyDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AwsIamAccessKeyStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe AwsIamAccessKeySessionContext
   -> Maybe Text
   -> Maybe Text
   -> AwsIamAccessKeyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe AwsIamAccessKeySessionContext
      -> Maybe Text
      -> Maybe Text
      -> AwsIamAccessKeyDetails)
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
"PrincipalId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe AwsIamAccessKeySessionContext
   -> Maybe Text
   -> Maybe Text
   -> AwsIamAccessKeyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe AwsIamAccessKeySessionContext
      -> Maybe Text
      -> Maybe Text
      -> AwsIamAccessKeyDetails)
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
"PrincipalType")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe AwsIamAccessKeySessionContext
   -> Maybe Text
   -> Maybe Text
   -> AwsIamAccessKeyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe AwsIamAccessKeySessionContext
      -> Maybe Text
      -> Maybe Text
      -> AwsIamAccessKeyDetails)
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
"PrincipalName")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe AwsIamAccessKeySessionContext
   -> Maybe Text
   -> Maybe Text
   -> AwsIamAccessKeyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe AwsIamAccessKeySessionContext
      -> Maybe Text
      -> Maybe Text
      -> AwsIamAccessKeyDetails)
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
"CreatedAt")
            Parser
  (Maybe Text
   -> Maybe AwsIamAccessKeySessionContext
   -> Maybe Text
   -> Maybe Text
   -> AwsIamAccessKeyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe AwsIamAccessKeySessionContext
      -> Maybe Text -> Maybe Text -> AwsIamAccessKeyDetails)
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
"UserName")
            Parser
  (Maybe AwsIamAccessKeySessionContext
   -> Maybe Text -> Maybe Text -> AwsIamAccessKeyDetails)
-> Parser (Maybe AwsIamAccessKeySessionContext)
-> Parser (Maybe Text -> Maybe Text -> AwsIamAccessKeyDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AwsIamAccessKeySessionContext)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SessionContext")
            Parser (Maybe Text -> Maybe Text -> AwsIamAccessKeyDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsIamAccessKeyDetails)
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
"AccountId")
            Parser (Maybe Text -> AwsIamAccessKeyDetails)
-> Parser (Maybe Text) -> Parser AwsIamAccessKeyDetails
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
"AccessKeyId")
      )

instance Prelude.Hashable AwsIamAccessKeyDetails

instance Prelude.NFData AwsIamAccessKeyDetails

instance Core.ToJSON AwsIamAccessKeyDetails where
  toJSON :: AwsIamAccessKeyDetails -> Value
toJSON AwsIamAccessKeyDetails' {Maybe Text
Maybe AwsIamAccessKeySessionContext
Maybe AwsIamAccessKeyStatus
accessKeyId :: Maybe Text
accountId :: Maybe Text
sessionContext :: Maybe AwsIamAccessKeySessionContext
userName :: Maybe Text
createdAt :: Maybe Text
principalName :: Maybe Text
principalType :: Maybe Text
principalId :: Maybe Text
status :: Maybe AwsIamAccessKeyStatus
$sel:accessKeyId:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
$sel:accountId:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
$sel:sessionContext:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe AwsIamAccessKeySessionContext
$sel:userName:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
$sel:createdAt:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
$sel:principalName:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
$sel:principalType:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
$sel:principalId:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe Text
$sel:status:AwsIamAccessKeyDetails' :: AwsIamAccessKeyDetails -> Maybe AwsIamAccessKeyStatus
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" Text -> AwsIamAccessKeyStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (AwsIamAccessKeyStatus -> Pair)
-> Maybe AwsIamAccessKeyStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsIamAccessKeyStatus
status,
            (Text
"PrincipalId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
principalId,
            (Text
"PrincipalType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
principalType,
            (Text
"PrincipalName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
principalName,
            (Text
"CreatedAt" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
createdAt,
            (Text
"UserName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
userName,
            (Text
"SessionContext" Text -> AwsIamAccessKeySessionContext -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AwsIamAccessKeySessionContext -> Pair)
-> Maybe AwsIamAccessKeySessionContext -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AwsIamAccessKeySessionContext
sessionContext,
            (Text
"AccountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
accountId,
            (Text
"AccessKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
accessKeyId
          ]
      )