{-# 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.ControlMetadata
-- 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.ControlMetadata where

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

-- | The metadata associated with the specified standard or custom control.
--
-- /See:/ 'newControlMetadata' smart constructor.
data ControlMetadata = ControlMetadata'
  { -- | Specifies when the control was most recently updated.
    ControlMetadata -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the specified control.
    ControlMetadata -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | Specifies when the control was created.
    ControlMetadata -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The data source that determines from where Audit Manager collects
    -- evidence for the control.
    ControlMetadata -> Maybe Text
controlSources :: Prelude.Maybe Prelude.Text,
    -- | The name of the specified control.
    ControlMetadata -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the specified control.
    ControlMetadata -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (ControlMetadata -> ControlMetadata -> Bool
(ControlMetadata -> ControlMetadata -> Bool)
-> (ControlMetadata -> ControlMetadata -> Bool)
-> Eq ControlMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ControlMetadata -> ControlMetadata -> Bool
$c/= :: ControlMetadata -> ControlMetadata -> Bool
== :: ControlMetadata -> ControlMetadata -> Bool
$c== :: ControlMetadata -> ControlMetadata -> Bool
Prelude.Eq, ReadPrec [ControlMetadata]
ReadPrec ControlMetadata
Int -> ReadS ControlMetadata
ReadS [ControlMetadata]
(Int -> ReadS ControlMetadata)
-> ReadS [ControlMetadata]
-> ReadPrec ControlMetadata
-> ReadPrec [ControlMetadata]
-> Read ControlMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ControlMetadata]
$creadListPrec :: ReadPrec [ControlMetadata]
readPrec :: ReadPrec ControlMetadata
$creadPrec :: ReadPrec ControlMetadata
readList :: ReadS [ControlMetadata]
$creadList :: ReadS [ControlMetadata]
readsPrec :: Int -> ReadS ControlMetadata
$creadsPrec :: Int -> ReadS ControlMetadata
Prelude.Read, Int -> ControlMetadata -> ShowS
[ControlMetadata] -> ShowS
ControlMetadata -> String
(Int -> ControlMetadata -> ShowS)
-> (ControlMetadata -> String)
-> ([ControlMetadata] -> ShowS)
-> Show ControlMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ControlMetadata] -> ShowS
$cshowList :: [ControlMetadata] -> ShowS
show :: ControlMetadata -> String
$cshow :: ControlMetadata -> String
showsPrec :: Int -> ControlMetadata -> ShowS
$cshowsPrec :: Int -> ControlMetadata -> ShowS
Prelude.Show, (forall x. ControlMetadata -> Rep ControlMetadata x)
-> (forall x. Rep ControlMetadata x -> ControlMetadata)
-> Generic ControlMetadata
forall x. Rep ControlMetadata x -> ControlMetadata
forall x. ControlMetadata -> Rep ControlMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ControlMetadata x -> ControlMetadata
$cfrom :: forall x. ControlMetadata -> Rep ControlMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ControlMetadata' 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:
--
-- 'lastUpdatedAt', 'controlMetadata_lastUpdatedAt' - Specifies when the control was most recently updated.
--
-- 'arn', 'controlMetadata_arn' - The Amazon Resource Name (ARN) of the specified control.
--
-- 'createdAt', 'controlMetadata_createdAt' - Specifies when the control was created.
--
-- 'controlSources', 'controlMetadata_controlSources' - The data source that determines from where Audit Manager collects
-- evidence for the control.
--
-- 'name', 'controlMetadata_name' - The name of the specified control.
--
-- 'id', 'controlMetadata_id' - The unique identifier for the specified control.
newControlMetadata ::
  ControlMetadata
newControlMetadata :: ControlMetadata
newControlMetadata =
  ControlMetadata' :: Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ControlMetadata
ControlMetadata'
    { $sel:lastUpdatedAt:ControlMetadata' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ControlMetadata' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:ControlMetadata' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:controlSources:ControlMetadata' :: Maybe Text
controlSources = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ControlMetadata' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ControlMetadata' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies when the control was most recently updated.
controlMetadata_lastUpdatedAt :: Lens.Lens' ControlMetadata (Prelude.Maybe Prelude.UTCTime)
controlMetadata_lastUpdatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ControlMetadata -> f ControlMetadata
controlMetadata_lastUpdatedAt = (ControlMetadata -> Maybe POSIX)
-> (ControlMetadata -> Maybe POSIX -> ControlMetadata)
-> Lens ControlMetadata ControlMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlMetadata' {Maybe POSIX
lastUpdatedAt :: Maybe POSIX
$sel:lastUpdatedAt:ControlMetadata' :: ControlMetadata -> Maybe POSIX
lastUpdatedAt} -> Maybe POSIX
lastUpdatedAt) (\s :: ControlMetadata
s@ControlMetadata' {} Maybe POSIX
a -> ControlMetadata
s {$sel:lastUpdatedAt:ControlMetadata' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
a} :: ControlMetadata) ((Maybe POSIX -> f (Maybe POSIX))
 -> ControlMetadata -> f ControlMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ControlMetadata
-> f ControlMetadata
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 Amazon Resource Name (ARN) of the specified control.
controlMetadata_arn :: Lens.Lens' ControlMetadata (Prelude.Maybe Prelude.Text)
controlMetadata_arn :: (Maybe Text -> f (Maybe Text))
-> ControlMetadata -> f ControlMetadata
controlMetadata_arn = (ControlMetadata -> Maybe Text)
-> (ControlMetadata -> Maybe Text -> ControlMetadata)
-> Lens ControlMetadata ControlMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlMetadata' {Maybe Text
arn :: Maybe Text
$sel:arn:ControlMetadata' :: ControlMetadata -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ControlMetadata
s@ControlMetadata' {} Maybe Text
a -> ControlMetadata
s {$sel:arn:ControlMetadata' :: Maybe Text
arn = Maybe Text
a} :: ControlMetadata)

-- | Specifies when the control was created.
controlMetadata_createdAt :: Lens.Lens' ControlMetadata (Prelude.Maybe Prelude.UTCTime)
controlMetadata_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ControlMetadata -> f ControlMetadata
controlMetadata_createdAt = (ControlMetadata -> Maybe POSIX)
-> (ControlMetadata -> Maybe POSIX -> ControlMetadata)
-> Lens ControlMetadata ControlMetadata (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlMetadata' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:ControlMetadata' :: ControlMetadata -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: ControlMetadata
s@ControlMetadata' {} Maybe POSIX
a -> ControlMetadata
s {$sel:createdAt:ControlMetadata' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: ControlMetadata) ((Maybe POSIX -> f (Maybe POSIX))
 -> ControlMetadata -> f ControlMetadata)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ControlMetadata
-> f ControlMetadata
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 data source that determines from where Audit Manager collects
-- evidence for the control.
controlMetadata_controlSources :: Lens.Lens' ControlMetadata (Prelude.Maybe Prelude.Text)
controlMetadata_controlSources :: (Maybe Text -> f (Maybe Text))
-> ControlMetadata -> f ControlMetadata
controlMetadata_controlSources = (ControlMetadata -> Maybe Text)
-> (ControlMetadata -> Maybe Text -> ControlMetadata)
-> Lens ControlMetadata ControlMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlMetadata' {Maybe Text
controlSources :: Maybe Text
$sel:controlSources:ControlMetadata' :: ControlMetadata -> Maybe Text
controlSources} -> Maybe Text
controlSources) (\s :: ControlMetadata
s@ControlMetadata' {} Maybe Text
a -> ControlMetadata
s {$sel:controlSources:ControlMetadata' :: Maybe Text
controlSources = Maybe Text
a} :: ControlMetadata)

-- | The name of the specified control.
controlMetadata_name :: Lens.Lens' ControlMetadata (Prelude.Maybe Prelude.Text)
controlMetadata_name :: (Maybe Text -> f (Maybe Text))
-> ControlMetadata -> f ControlMetadata
controlMetadata_name = (ControlMetadata -> Maybe Text)
-> (ControlMetadata -> Maybe Text -> ControlMetadata)
-> Lens ControlMetadata ControlMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ControlMetadata' {Maybe Text
name :: Maybe Text
$sel:name:ControlMetadata' :: ControlMetadata -> Maybe Text
name} -> Maybe Text
name) (\s :: ControlMetadata
s@ControlMetadata' {} Maybe Text
a -> ControlMetadata
s {$sel:name:ControlMetadata' :: Maybe Text
name = Maybe Text
a} :: ControlMetadata)

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

instance Core.FromJSON ControlMetadata where
  parseJSON :: Value -> Parser ControlMetadata
parseJSON =
    String
-> (Object -> Parser ControlMetadata)
-> Value
-> Parser ControlMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ControlMetadata"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ControlMetadata
ControlMetadata'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ControlMetadata)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ControlMetadata)
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
"lastUpdatedAt")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ControlMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> Maybe Text -> ControlMetadata)
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
"arn")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> Maybe Text -> ControlMetadata)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ControlMetadata)
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
"createdAt")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> ControlMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ControlMetadata)
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
"controlSources")
            Parser (Maybe Text -> Maybe Text -> ControlMetadata)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ControlMetadata)
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
"name")
            Parser (Maybe Text -> ControlMetadata)
-> Parser (Maybe Text) -> Parser ControlMetadata
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")
      )

instance Prelude.Hashable ControlMetadata

instance Prelude.NFData ControlMetadata