{-# 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.AuditManager.Types.DelegationMetadata
-- 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.AuditManager.Types.DelegationMetadata where

import Amazonka.AuditManager.Types.DelegationStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The metadata associated with the specified delegation.
--
-- /See:/ 'newDelegationMetadata' smart constructor.
data DelegationMetadata = DelegationMetadata'
  { -- | Specifies when the delegation was created.
    DelegationMetadata -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The current status of the delgation.
    DelegationMetadata -> Maybe DelegationStatus
status :: Prelude.Maybe DelegationStatus,
    -- | Specifies the name of the control set delegated for review.
    DelegationMetadata -> Maybe Text
controlSetName :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the delegation.
    DelegationMetadata -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the specified assessment.
    DelegationMetadata -> Maybe Text
assessmentId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role.
    DelegationMetadata -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the associated assessment.
    DelegationMetadata -> Maybe Text
assessmentName :: Prelude.Maybe Prelude.Text
  }
  deriving (DelegationMetadata -> DelegationMetadata -> Bool
(DelegationMetadata -> DelegationMetadata -> Bool)
-> (DelegationMetadata -> DelegationMetadata -> Bool)
-> Eq DelegationMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DelegationMetadata -> DelegationMetadata -> Bool
$c/= :: DelegationMetadata -> DelegationMetadata -> Bool
== :: DelegationMetadata -> DelegationMetadata -> Bool
$c== :: DelegationMetadata -> DelegationMetadata -> Bool
Prelude.Eq, ReadPrec [DelegationMetadata]
ReadPrec DelegationMetadata
Int -> ReadS DelegationMetadata
ReadS [DelegationMetadata]
(Int -> ReadS DelegationMetadata)
-> ReadS [DelegationMetadata]
-> ReadPrec DelegationMetadata
-> ReadPrec [DelegationMetadata]
-> Read DelegationMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DelegationMetadata]
$creadListPrec :: ReadPrec [DelegationMetadata]
readPrec :: ReadPrec DelegationMetadata
$creadPrec :: ReadPrec DelegationMetadata
readList :: ReadS [DelegationMetadata]
$creadList :: ReadS [DelegationMetadata]
readsPrec :: Int -> ReadS DelegationMetadata
$creadsPrec :: Int -> ReadS DelegationMetadata
Prelude.Read, Int -> DelegationMetadata -> ShowS
[DelegationMetadata] -> ShowS
DelegationMetadata -> String
(Int -> DelegationMetadata -> ShowS)
-> (DelegationMetadata -> String)
-> ([DelegationMetadata] -> ShowS)
-> Show DelegationMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DelegationMetadata] -> ShowS
$cshowList :: [DelegationMetadata] -> ShowS
show :: DelegationMetadata -> String
$cshow :: DelegationMetadata -> String
showsPrec :: Int -> DelegationMetadata -> ShowS
$cshowsPrec :: Int -> DelegationMetadata -> ShowS
Prelude.Show, (forall x. DelegationMetadata -> Rep DelegationMetadata x)
-> (forall x. Rep DelegationMetadata x -> DelegationMetadata)
-> Generic DelegationMetadata
forall x. Rep DelegationMetadata x -> DelegationMetadata
forall x. DelegationMetadata -> Rep DelegationMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DelegationMetadata x -> DelegationMetadata
$cfrom :: forall x. DelegationMetadata -> Rep DelegationMetadata x
Prelude.Generic)

-- |
-- Create a value of 'DelegationMetadata' 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:
--
-- 'creationTime', 'delegationMetadata_creationTime' - Specifies when the delegation was created.
--
-- 'status', 'delegationMetadata_status' - The current status of the delgation.
--
-- 'controlSetName', 'delegationMetadata_controlSetName' - Specifies the name of the control set delegated for review.
--
-- 'id', 'delegationMetadata_id' - The unique identifier for the delegation.
--
-- 'assessmentId', 'delegationMetadata_assessmentId' - The unique identifier for the specified assessment.
--
-- 'roleArn', 'delegationMetadata_roleArn' - The Amazon Resource Name (ARN) of the IAM role.
--
-- 'assessmentName', 'delegationMetadata_assessmentName' - The name of the associated assessment.
newDelegationMetadata ::
  DelegationMetadata
newDelegationMetadata :: DelegationMetadata
newDelegationMetadata =
  DelegationMetadata' :: Maybe POSIX
-> Maybe DelegationStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> DelegationMetadata
DelegationMetadata'
    { $sel:creationTime:DelegationMetadata' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DelegationMetadata' :: Maybe DelegationStatus
status = Maybe DelegationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:controlSetName:DelegationMetadata' :: Maybe Text
controlSetName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:DelegationMetadata' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:assessmentId:DelegationMetadata' :: Maybe Text
assessmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:DelegationMetadata' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:assessmentName:DelegationMetadata' :: Maybe Text
assessmentName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies when the delegation was created.
delegationMetadata_creationTime :: Lens.Lens' DelegationMetadata (Prelude.Maybe Prelude.UTCTime)
delegationMetadata_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DelegationMetadata -> f DelegationMetadata
delegationMetadata_creationTime = (DelegationMetadata -> Maybe POSIX)
-> (DelegationMetadata -> Maybe POSIX -> DelegationMetadata)
-> Lens
     DelegationMetadata DelegationMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DelegationMetadata' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:DelegationMetadata' :: DelegationMetadata -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: DelegationMetadata
s@DelegationMetadata' {} Maybe POSIX
a -> DelegationMetadata
s {$sel:creationTime:DelegationMetadata' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: DelegationMetadata) ((Maybe POSIX -> f (Maybe POSIX))
 -> DelegationMetadata -> f DelegationMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DelegationMetadata
-> f DelegationMetadata
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 current status of the delgation.
delegationMetadata_status :: Lens.Lens' DelegationMetadata (Prelude.Maybe DelegationStatus)
delegationMetadata_status :: (Maybe DelegationStatus -> f (Maybe DelegationStatus))
-> DelegationMetadata -> f DelegationMetadata
delegationMetadata_status = (DelegationMetadata -> Maybe DelegationStatus)
-> (DelegationMetadata
    -> Maybe DelegationStatus -> DelegationMetadata)
-> Lens
     DelegationMetadata
     DelegationMetadata
     (Maybe DelegationStatus)
     (Maybe DelegationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DelegationMetadata' {Maybe DelegationStatus
status :: Maybe DelegationStatus
$sel:status:DelegationMetadata' :: DelegationMetadata -> Maybe DelegationStatus
status} -> Maybe DelegationStatus
status) (\s :: DelegationMetadata
s@DelegationMetadata' {} Maybe DelegationStatus
a -> DelegationMetadata
s {$sel:status:DelegationMetadata' :: Maybe DelegationStatus
status = Maybe DelegationStatus
a} :: DelegationMetadata)

-- | Specifies the name of the control set delegated for review.
delegationMetadata_controlSetName :: Lens.Lens' DelegationMetadata (Prelude.Maybe Prelude.Text)
delegationMetadata_controlSetName :: (Maybe Text -> f (Maybe Text))
-> DelegationMetadata -> f DelegationMetadata
delegationMetadata_controlSetName = (DelegationMetadata -> Maybe Text)
-> (DelegationMetadata -> Maybe Text -> DelegationMetadata)
-> Lens
     DelegationMetadata DelegationMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DelegationMetadata' {Maybe Text
controlSetName :: Maybe Text
$sel:controlSetName:DelegationMetadata' :: DelegationMetadata -> Maybe Text
controlSetName} -> Maybe Text
controlSetName) (\s :: DelegationMetadata
s@DelegationMetadata' {} Maybe Text
a -> DelegationMetadata
s {$sel:controlSetName:DelegationMetadata' :: Maybe Text
controlSetName = Maybe Text
a} :: DelegationMetadata)

-- | The unique identifier for the delegation.
delegationMetadata_id :: Lens.Lens' DelegationMetadata (Prelude.Maybe Prelude.Text)
delegationMetadata_id :: (Maybe Text -> f (Maybe Text))
-> DelegationMetadata -> f DelegationMetadata
delegationMetadata_id = (DelegationMetadata -> Maybe Text)
-> (DelegationMetadata -> Maybe Text -> DelegationMetadata)
-> Lens
     DelegationMetadata DelegationMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DelegationMetadata' {Maybe Text
id :: Maybe Text
$sel:id:DelegationMetadata' :: DelegationMetadata -> Maybe Text
id} -> Maybe Text
id) (\s :: DelegationMetadata
s@DelegationMetadata' {} Maybe Text
a -> DelegationMetadata
s {$sel:id:DelegationMetadata' :: Maybe Text
id = Maybe Text
a} :: DelegationMetadata)

-- | The unique identifier for the specified assessment.
delegationMetadata_assessmentId :: Lens.Lens' DelegationMetadata (Prelude.Maybe Prelude.Text)
delegationMetadata_assessmentId :: (Maybe Text -> f (Maybe Text))
-> DelegationMetadata -> f DelegationMetadata
delegationMetadata_assessmentId = (DelegationMetadata -> Maybe Text)
-> (DelegationMetadata -> Maybe Text -> DelegationMetadata)
-> Lens
     DelegationMetadata DelegationMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DelegationMetadata' {Maybe Text
assessmentId :: Maybe Text
$sel:assessmentId:DelegationMetadata' :: DelegationMetadata -> Maybe Text
assessmentId} -> Maybe Text
assessmentId) (\s :: DelegationMetadata
s@DelegationMetadata' {} Maybe Text
a -> DelegationMetadata
s {$sel:assessmentId:DelegationMetadata' :: Maybe Text
assessmentId = Maybe Text
a} :: DelegationMetadata)

-- | The Amazon Resource Name (ARN) of the IAM role.
delegationMetadata_roleArn :: Lens.Lens' DelegationMetadata (Prelude.Maybe Prelude.Text)
delegationMetadata_roleArn :: (Maybe Text -> f (Maybe Text))
-> DelegationMetadata -> f DelegationMetadata
delegationMetadata_roleArn = (DelegationMetadata -> Maybe Text)
-> (DelegationMetadata -> Maybe Text -> DelegationMetadata)
-> Lens
     DelegationMetadata DelegationMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DelegationMetadata' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:DelegationMetadata' :: DelegationMetadata -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: DelegationMetadata
s@DelegationMetadata' {} Maybe Text
a -> DelegationMetadata
s {$sel:roleArn:DelegationMetadata' :: Maybe Text
roleArn = Maybe Text
a} :: DelegationMetadata)

-- | The name of the associated assessment.
delegationMetadata_assessmentName :: Lens.Lens' DelegationMetadata (Prelude.Maybe Prelude.Text)
delegationMetadata_assessmentName :: (Maybe Text -> f (Maybe Text))
-> DelegationMetadata -> f DelegationMetadata
delegationMetadata_assessmentName = (DelegationMetadata -> Maybe Text)
-> (DelegationMetadata -> Maybe Text -> DelegationMetadata)
-> Lens
     DelegationMetadata DelegationMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DelegationMetadata' {Maybe Text
assessmentName :: Maybe Text
$sel:assessmentName:DelegationMetadata' :: DelegationMetadata -> Maybe Text
assessmentName} -> Maybe Text
assessmentName) (\s :: DelegationMetadata
s@DelegationMetadata' {} Maybe Text
a -> DelegationMetadata
s {$sel:assessmentName:DelegationMetadata' :: Maybe Text
assessmentName = Maybe Text
a} :: DelegationMetadata)

instance Core.FromJSON DelegationMetadata where
  parseJSON :: Value -> Parser DelegationMetadata
parseJSON =
    String
-> (Object -> Parser DelegationMetadata)
-> Value
-> Parser DelegationMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DelegationMetadata"
      ( \Object
x ->
          Maybe POSIX
-> Maybe DelegationStatus
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> DelegationMetadata
DelegationMetadata'
            (Maybe POSIX
 -> Maybe DelegationStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> DelegationMetadata)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe DelegationStatus
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> DelegationMetadata)
forall (f :: * -> *) a b. Functor 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
"creationTime")
            Parser
  (Maybe DelegationStatus
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> DelegationMetadata)
-> Parser (Maybe DelegationStatus)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> DelegationMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DelegationStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> DelegationMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> DelegationMetadata)
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
"controlSetName")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> DelegationMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> DelegationMetadata)
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
"id")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> DelegationMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> DelegationMetadata)
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
"assessmentId")
            Parser (Maybe Text -> Maybe Text -> DelegationMetadata)
-> Parser (Maybe Text) -> Parser (Maybe Text -> DelegationMetadata)
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")
            Parser (Maybe Text -> DelegationMetadata)
-> Parser (Maybe Text) -> Parser DelegationMetadata
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
"assessmentName")
      )

instance Prelude.Hashable DelegationMetadata

instance Prelude.NFData DelegationMetadata