{-# 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.Config.Types.OrganizationConformancePack
-- 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.Config.Types.OrganizationConformancePack where

import Amazonka.Config.Types.ConformancePackInputParameter
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

-- | An organization conformance pack that has information about conformance
-- packs that Config creates in member accounts.
--
-- /See:/ 'newOrganizationConformancePack' smart constructor.
data OrganizationConformancePack = OrganizationConformancePack'
  { -- | A list of @ConformancePackInputParameter@ objects.
    OrganizationConformancePack
-> Maybe [ConformancePackInputParameter]
conformancePackInputParameters :: Prelude.Maybe [ConformancePackInputParameter],
    -- | The name of the Amazon S3 bucket where Config stores conformance pack
    -- templates.
    --
    -- This field is optional.
    OrganizationConformancePack -> Maybe Text
deliveryS3Bucket :: Prelude.Maybe Prelude.Text,
    -- | Any folder structure you want to add to an Amazon S3 bucket.
    --
    -- This field is optional.
    OrganizationConformancePack -> Maybe Text
deliveryS3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | A comma-separated list of accounts excluded from organization
    -- conformance pack.
    OrganizationConformancePack -> Maybe [Text]
excludedAccounts :: Prelude.Maybe [Prelude.Text],
    -- | The name you assign to an organization conformance pack.
    OrganizationConformancePack -> Text
organizationConformancePackName :: Prelude.Text,
    -- | Amazon Resource Name (ARN) of organization conformance pack.
    OrganizationConformancePack -> Text
organizationConformancePackArn :: Prelude.Text,
    -- | Last time when organization conformation pack was updated.
    OrganizationConformancePack -> POSIX
lastUpdateTime :: Data.POSIX
  }
  deriving (OrganizationConformancePack -> OrganizationConformancePack -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrganizationConformancePack -> OrganizationConformancePack -> Bool
$c/= :: OrganizationConformancePack -> OrganizationConformancePack -> Bool
== :: OrganizationConformancePack -> OrganizationConformancePack -> Bool
$c== :: OrganizationConformancePack -> OrganizationConformancePack -> Bool
Prelude.Eq, ReadPrec [OrganizationConformancePack]
ReadPrec OrganizationConformancePack
Int -> ReadS OrganizationConformancePack
ReadS [OrganizationConformancePack]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrganizationConformancePack]
$creadListPrec :: ReadPrec [OrganizationConformancePack]
readPrec :: ReadPrec OrganizationConformancePack
$creadPrec :: ReadPrec OrganizationConformancePack
readList :: ReadS [OrganizationConformancePack]
$creadList :: ReadS [OrganizationConformancePack]
readsPrec :: Int -> ReadS OrganizationConformancePack
$creadsPrec :: Int -> ReadS OrganizationConformancePack
Prelude.Read, Int -> OrganizationConformancePack -> ShowS
[OrganizationConformancePack] -> ShowS
OrganizationConformancePack -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrganizationConformancePack] -> ShowS
$cshowList :: [OrganizationConformancePack] -> ShowS
show :: OrganizationConformancePack -> String
$cshow :: OrganizationConformancePack -> String
showsPrec :: Int -> OrganizationConformancePack -> ShowS
$cshowsPrec :: Int -> OrganizationConformancePack -> ShowS
Prelude.Show, forall x.
Rep OrganizationConformancePack x -> OrganizationConformancePack
forall x.
OrganizationConformancePack -> Rep OrganizationConformancePack x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OrganizationConformancePack x -> OrganizationConformancePack
$cfrom :: forall x.
OrganizationConformancePack -> Rep OrganizationConformancePack x
Prelude.Generic)

-- |
-- Create a value of 'OrganizationConformancePack' 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:
--
-- 'conformancePackInputParameters', 'organizationConformancePack_conformancePackInputParameters' - A list of @ConformancePackInputParameter@ objects.
--
-- 'deliveryS3Bucket', 'organizationConformancePack_deliveryS3Bucket' - The name of the Amazon S3 bucket where Config stores conformance pack
-- templates.
--
-- This field is optional.
--
-- 'deliveryS3KeyPrefix', 'organizationConformancePack_deliveryS3KeyPrefix' - Any folder structure you want to add to an Amazon S3 bucket.
--
-- This field is optional.
--
-- 'excludedAccounts', 'organizationConformancePack_excludedAccounts' - A comma-separated list of accounts excluded from organization
-- conformance pack.
--
-- 'organizationConformancePackName', 'organizationConformancePack_organizationConformancePackName' - The name you assign to an organization conformance pack.
--
-- 'organizationConformancePackArn', 'organizationConformancePack_organizationConformancePackArn' - Amazon Resource Name (ARN) of organization conformance pack.
--
-- 'lastUpdateTime', 'organizationConformancePack_lastUpdateTime' - Last time when organization conformation pack was updated.
newOrganizationConformancePack ::
  -- | 'organizationConformancePackName'
  Prelude.Text ->
  -- | 'organizationConformancePackArn'
  Prelude.Text ->
  -- | 'lastUpdateTime'
  Prelude.UTCTime ->
  OrganizationConformancePack
newOrganizationConformancePack :: Text -> Text -> UTCTime -> OrganizationConformancePack
newOrganizationConformancePack
  Text
pOrganizationConformancePackName_
  Text
pOrganizationConformancePackArn_
  UTCTime
pLastUpdateTime_ =
    OrganizationConformancePack'
      { $sel:conformancePackInputParameters:OrganizationConformancePack' :: Maybe [ConformancePackInputParameter]
conformancePackInputParameters =
          forall a. Maybe a
Prelude.Nothing,
        $sel:deliveryS3Bucket:OrganizationConformancePack' :: Maybe Text
deliveryS3Bucket = forall a. Maybe a
Prelude.Nothing,
        $sel:deliveryS3KeyPrefix:OrganizationConformancePack' :: Maybe Text
deliveryS3KeyPrefix = forall a. Maybe a
Prelude.Nothing,
        $sel:excludedAccounts:OrganizationConformancePack' :: Maybe [Text]
excludedAccounts = forall a. Maybe a
Prelude.Nothing,
        $sel:organizationConformancePackName:OrganizationConformancePack' :: Text
organizationConformancePackName =
          Text
pOrganizationConformancePackName_,
        $sel:organizationConformancePackArn:OrganizationConformancePack' :: Text
organizationConformancePackArn =
          Text
pOrganizationConformancePackArn_,
        $sel:lastUpdateTime:OrganizationConformancePack' :: POSIX
lastUpdateTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdateTime_
      }

-- | A list of @ConformancePackInputParameter@ objects.
organizationConformancePack_conformancePackInputParameters :: Lens.Lens' OrganizationConformancePack (Prelude.Maybe [ConformancePackInputParameter])
organizationConformancePack_conformancePackInputParameters :: Lens'
  OrganizationConformancePack (Maybe [ConformancePackInputParameter])
organizationConformancePack_conformancePackInputParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePack' {Maybe [ConformancePackInputParameter]
conformancePackInputParameters :: Maybe [ConformancePackInputParameter]
$sel:conformancePackInputParameters:OrganizationConformancePack' :: OrganizationConformancePack
-> Maybe [ConformancePackInputParameter]
conformancePackInputParameters} -> Maybe [ConformancePackInputParameter]
conformancePackInputParameters) (\s :: OrganizationConformancePack
s@OrganizationConformancePack' {} Maybe [ConformancePackInputParameter]
a -> OrganizationConformancePack
s {$sel:conformancePackInputParameters:OrganizationConformancePack' :: Maybe [ConformancePackInputParameter]
conformancePackInputParameters = Maybe [ConformancePackInputParameter]
a} :: OrganizationConformancePack) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the Amazon S3 bucket where Config stores conformance pack
-- templates.
--
-- This field is optional.
organizationConformancePack_deliveryS3Bucket :: Lens.Lens' OrganizationConformancePack (Prelude.Maybe Prelude.Text)
organizationConformancePack_deliveryS3Bucket :: Lens' OrganizationConformancePack (Maybe Text)
organizationConformancePack_deliveryS3Bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePack' {Maybe Text
deliveryS3Bucket :: Maybe Text
$sel:deliveryS3Bucket:OrganizationConformancePack' :: OrganizationConformancePack -> Maybe Text
deliveryS3Bucket} -> Maybe Text
deliveryS3Bucket) (\s :: OrganizationConformancePack
s@OrganizationConformancePack' {} Maybe Text
a -> OrganizationConformancePack
s {$sel:deliveryS3Bucket:OrganizationConformancePack' :: Maybe Text
deliveryS3Bucket = Maybe Text
a} :: OrganizationConformancePack)

-- | Any folder structure you want to add to an Amazon S3 bucket.
--
-- This field is optional.
organizationConformancePack_deliveryS3KeyPrefix :: Lens.Lens' OrganizationConformancePack (Prelude.Maybe Prelude.Text)
organizationConformancePack_deliveryS3KeyPrefix :: Lens' OrganizationConformancePack (Maybe Text)
organizationConformancePack_deliveryS3KeyPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePack' {Maybe Text
deliveryS3KeyPrefix :: Maybe Text
$sel:deliveryS3KeyPrefix:OrganizationConformancePack' :: OrganizationConformancePack -> Maybe Text
deliveryS3KeyPrefix} -> Maybe Text
deliveryS3KeyPrefix) (\s :: OrganizationConformancePack
s@OrganizationConformancePack' {} Maybe Text
a -> OrganizationConformancePack
s {$sel:deliveryS3KeyPrefix:OrganizationConformancePack' :: Maybe Text
deliveryS3KeyPrefix = Maybe Text
a} :: OrganizationConformancePack)

-- | A comma-separated list of accounts excluded from organization
-- conformance pack.
organizationConformancePack_excludedAccounts :: Lens.Lens' OrganizationConformancePack (Prelude.Maybe [Prelude.Text])
organizationConformancePack_excludedAccounts :: Lens' OrganizationConformancePack (Maybe [Text])
organizationConformancePack_excludedAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePack' {Maybe [Text]
excludedAccounts :: Maybe [Text]
$sel:excludedAccounts:OrganizationConformancePack' :: OrganizationConformancePack -> Maybe [Text]
excludedAccounts} -> Maybe [Text]
excludedAccounts) (\s :: OrganizationConformancePack
s@OrganizationConformancePack' {} Maybe [Text]
a -> OrganizationConformancePack
s {$sel:excludedAccounts:OrganizationConformancePack' :: Maybe [Text]
excludedAccounts = Maybe [Text]
a} :: OrganizationConformancePack) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name you assign to an organization conformance pack.
organizationConformancePack_organizationConformancePackName :: Lens.Lens' OrganizationConformancePack Prelude.Text
organizationConformancePack_organizationConformancePackName :: Lens' OrganizationConformancePack Text
organizationConformancePack_organizationConformancePackName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePack' {Text
organizationConformancePackName :: Text
$sel:organizationConformancePackName:OrganizationConformancePack' :: OrganizationConformancePack -> Text
organizationConformancePackName} -> Text
organizationConformancePackName) (\s :: OrganizationConformancePack
s@OrganizationConformancePack' {} Text
a -> OrganizationConformancePack
s {$sel:organizationConformancePackName:OrganizationConformancePack' :: Text
organizationConformancePackName = Text
a} :: OrganizationConformancePack)

-- | Amazon Resource Name (ARN) of organization conformance pack.
organizationConformancePack_organizationConformancePackArn :: Lens.Lens' OrganizationConformancePack Prelude.Text
organizationConformancePack_organizationConformancePackArn :: Lens' OrganizationConformancePack Text
organizationConformancePack_organizationConformancePackArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePack' {Text
organizationConformancePackArn :: Text
$sel:organizationConformancePackArn:OrganizationConformancePack' :: OrganizationConformancePack -> Text
organizationConformancePackArn} -> Text
organizationConformancePackArn) (\s :: OrganizationConformancePack
s@OrganizationConformancePack' {} Text
a -> OrganizationConformancePack
s {$sel:organizationConformancePackArn:OrganizationConformancePack' :: Text
organizationConformancePackArn = Text
a} :: OrganizationConformancePack)

-- | Last time when organization conformation pack was updated.
organizationConformancePack_lastUpdateTime :: Lens.Lens' OrganizationConformancePack Prelude.UTCTime
organizationConformancePack_lastUpdateTime :: Lens' OrganizationConformancePack UTCTime
organizationConformancePack_lastUpdateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationConformancePack' {POSIX
lastUpdateTime :: POSIX
$sel:lastUpdateTime:OrganizationConformancePack' :: OrganizationConformancePack -> POSIX
lastUpdateTime} -> POSIX
lastUpdateTime) (\s :: OrganizationConformancePack
s@OrganizationConformancePack' {} POSIX
a -> OrganizationConformancePack
s {$sel:lastUpdateTime:OrganizationConformancePack' :: POSIX
lastUpdateTime = POSIX
a} :: OrganizationConformancePack) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON OrganizationConformancePack where
  parseJSON :: Value -> Parser OrganizationConformancePack
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OrganizationConformancePack"
      ( \Object
x ->
          Maybe [ConformancePackInputParameter]
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Text
-> Text
-> POSIX
-> OrganizationConformancePack
OrganizationConformancePack'
            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
"ConformancePackInputParameters"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"DeliveryS3Bucket")
            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
"DeliveryS3KeyPrefix")
            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
"ExcludedAccounts"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"OrganizationConformancePackName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"OrganizationConformancePackArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"LastUpdateTime")
      )

instance Prelude.Hashable OrganizationConformancePack where
  hashWithSalt :: Int -> OrganizationConformancePack -> Int
hashWithSalt Int
_salt OrganizationConformancePack' {Maybe [Text]
Maybe [ConformancePackInputParameter]
Maybe Text
Text
POSIX
lastUpdateTime :: POSIX
organizationConformancePackArn :: Text
organizationConformancePackName :: Text
excludedAccounts :: Maybe [Text]
deliveryS3KeyPrefix :: Maybe Text
deliveryS3Bucket :: Maybe Text
conformancePackInputParameters :: Maybe [ConformancePackInputParameter]
$sel:lastUpdateTime:OrganizationConformancePack' :: OrganizationConformancePack -> POSIX
$sel:organizationConformancePackArn:OrganizationConformancePack' :: OrganizationConformancePack -> Text
$sel:organizationConformancePackName:OrganizationConformancePack' :: OrganizationConformancePack -> Text
$sel:excludedAccounts:OrganizationConformancePack' :: OrganizationConformancePack -> Maybe [Text]
$sel:deliveryS3KeyPrefix:OrganizationConformancePack' :: OrganizationConformancePack -> Maybe Text
$sel:deliveryS3Bucket:OrganizationConformancePack' :: OrganizationConformancePack -> Maybe Text
$sel:conformancePackInputParameters:OrganizationConformancePack' :: OrganizationConformancePack
-> Maybe [ConformancePackInputParameter]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ConformancePackInputParameter]
conformancePackInputParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deliveryS3Bucket
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deliveryS3KeyPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
excludedAccounts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
organizationConformancePackName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
organizationConformancePackArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
lastUpdateTime

instance Prelude.NFData OrganizationConformancePack where
  rnf :: OrganizationConformancePack -> ()
rnf OrganizationConformancePack' {Maybe [Text]
Maybe [ConformancePackInputParameter]
Maybe Text
Text
POSIX
lastUpdateTime :: POSIX
organizationConformancePackArn :: Text
organizationConformancePackName :: Text
excludedAccounts :: Maybe [Text]
deliveryS3KeyPrefix :: Maybe Text
deliveryS3Bucket :: Maybe Text
conformancePackInputParameters :: Maybe [ConformancePackInputParameter]
$sel:lastUpdateTime:OrganizationConformancePack' :: OrganizationConformancePack -> POSIX
$sel:organizationConformancePackArn:OrganizationConformancePack' :: OrganizationConformancePack -> Text
$sel:organizationConformancePackName:OrganizationConformancePack' :: OrganizationConformancePack -> Text
$sel:excludedAccounts:OrganizationConformancePack' :: OrganizationConformancePack -> Maybe [Text]
$sel:deliveryS3KeyPrefix:OrganizationConformancePack' :: OrganizationConformancePack -> Maybe Text
$sel:deliveryS3Bucket:OrganizationConformancePack' :: OrganizationConformancePack -> Maybe Text
$sel:conformancePackInputParameters:OrganizationConformancePack' :: OrganizationConformancePack
-> Maybe [ConformancePackInputParameter]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ConformancePackInputParameter]
conformancePackInputParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deliveryS3Bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deliveryS3KeyPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
excludedAccounts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
organizationConformancePackName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
organizationConformancePackArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
lastUpdateTime