{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.PutOrganizationConformancePack
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deploys conformance packs across member accounts in an Amazon Web
-- Services Organization. For information on how many organization
-- conformance packs and how many Config rules you can have per account,
-- see
-- <https://docs.aws.amazon.com/config/latest/developerguide/configlimits.html Service Limits>
-- in the Config Developer Guide.
--
-- Only a management account and a delegated administrator can call this
-- API. When calling this API with a delegated administrator, you must
-- ensure Organizations @ListDelegatedAdministrator@ permissions are added.
-- An organization can have up to 3 delegated administrators.
--
-- This API enables organization service access for
-- @config-multiaccountsetup.amazonaws.com@ through the
-- @EnableAWSServiceAccess@ action and creates a service-linked role
-- @AWSServiceRoleForConfigMultiAccountSetup@ in the management or
-- delegated administrator account of your organization. The service-linked
-- role is created only when the role does not exist in the caller account.
-- To use this API with delegated administrator, register a delegated
-- administrator by calling Amazon Web Services Organization
-- @register-delegate-admin@ for @config-multiaccountsetup.amazonaws.com@.
--
-- Prerequisite: Ensure you call @EnableAllFeatures@ API to enable all
-- features in an organization.
--
-- You must specify either the @TemplateS3Uri@ or the @TemplateBody@
-- parameter, but not both. If you provide both Config uses the
-- @TemplateS3Uri@ parameter and ignores the @TemplateBody@ parameter.
--
-- Config sets the state of a conformance pack to CREATE_IN_PROGRESS and
-- UPDATE_IN_PROGRESS until the conformance pack is created or updated. You
-- cannot update a conformance pack while it is in this state.
module Amazonka.Config.PutOrganizationConformancePack
  ( -- * Creating a Request
    PutOrganizationConformancePack (..),
    newPutOrganizationConformancePack,

    -- * Request Lenses
    putOrganizationConformancePack_conformancePackInputParameters,
    putOrganizationConformancePack_deliveryS3Bucket,
    putOrganizationConformancePack_deliveryS3KeyPrefix,
    putOrganizationConformancePack_excludedAccounts,
    putOrganizationConformancePack_templateBody,
    putOrganizationConformancePack_templateS3Uri,
    putOrganizationConformancePack_organizationConformancePackName,

    -- * Destructuring the Response
    PutOrganizationConformancePackResponse (..),
    newPutOrganizationConformancePackResponse,

    -- * Response Lenses
    putOrganizationConformancePackResponse_organizationConformancePackArn,
    putOrganizationConformancePackResponse_httpStatus,
  )
where

import Amazonka.Config.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newPutOrganizationConformancePack' smart constructor.
data PutOrganizationConformancePack = PutOrganizationConformancePack'
  { -- | A list of @ConformancePackInputParameter@ objects.
    PutOrganizationConformancePack
-> Maybe [ConformancePackInputParameter]
conformancePackInputParameters :: Prelude.Maybe [ConformancePackInputParameter],
    -- | The name of the Amazon S3 bucket where Config stores conformance pack
    -- templates.
    --
    -- This field is optional. If used, it must be prefixed with
    -- @awsconfigconforms@.
    PutOrganizationConformancePack -> Maybe Text
deliveryS3Bucket :: Prelude.Maybe Prelude.Text,
    -- | The prefix for the Amazon S3 bucket.
    --
    -- This field is optional.
    PutOrganizationConformancePack -> Maybe Text
deliveryS3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | A list of Amazon Web Services accounts to be excluded from an
    -- organization conformance pack while deploying a conformance pack.
    PutOrganizationConformancePack -> Maybe [Text]
excludedAccounts :: Prelude.Maybe [Prelude.Text],
    -- | A string containing full conformance pack template body. Structure
    -- containing the template body with a minimum length of 1 byte and a
    -- maximum length of 51,200 bytes.
    PutOrganizationConformancePack -> Maybe Text
templateBody :: Prelude.Maybe Prelude.Text,
    -- | Location of file containing the template body. The uri must point to the
    -- conformance pack template (max size: 300 KB).
    --
    -- You must have access to read Amazon S3 bucket.
    PutOrganizationConformancePack -> Maybe Text
templateS3Uri :: Prelude.Maybe Prelude.Text,
    -- | Name of the organization conformance pack you want to create.
    PutOrganizationConformancePack -> Text
organizationConformancePackName :: Prelude.Text
  }
  deriving (PutOrganizationConformancePack
-> PutOrganizationConformancePack -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutOrganizationConformancePack
-> PutOrganizationConformancePack -> Bool
$c/= :: PutOrganizationConformancePack
-> PutOrganizationConformancePack -> Bool
== :: PutOrganizationConformancePack
-> PutOrganizationConformancePack -> Bool
$c== :: PutOrganizationConformancePack
-> PutOrganizationConformancePack -> Bool
Prelude.Eq, ReadPrec [PutOrganizationConformancePack]
ReadPrec PutOrganizationConformancePack
Int -> ReadS PutOrganizationConformancePack
ReadS [PutOrganizationConformancePack]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutOrganizationConformancePack]
$creadListPrec :: ReadPrec [PutOrganizationConformancePack]
readPrec :: ReadPrec PutOrganizationConformancePack
$creadPrec :: ReadPrec PutOrganizationConformancePack
readList :: ReadS [PutOrganizationConformancePack]
$creadList :: ReadS [PutOrganizationConformancePack]
readsPrec :: Int -> ReadS PutOrganizationConformancePack
$creadsPrec :: Int -> ReadS PutOrganizationConformancePack
Prelude.Read, Int -> PutOrganizationConformancePack -> ShowS
[PutOrganizationConformancePack] -> ShowS
PutOrganizationConformancePack -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutOrganizationConformancePack] -> ShowS
$cshowList :: [PutOrganizationConformancePack] -> ShowS
show :: PutOrganizationConformancePack -> String
$cshow :: PutOrganizationConformancePack -> String
showsPrec :: Int -> PutOrganizationConformancePack -> ShowS
$cshowsPrec :: Int -> PutOrganizationConformancePack -> ShowS
Prelude.Show, forall x.
Rep PutOrganizationConformancePack x
-> PutOrganizationConformancePack
forall x.
PutOrganizationConformancePack
-> Rep PutOrganizationConformancePack x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutOrganizationConformancePack x
-> PutOrganizationConformancePack
$cfrom :: forall x.
PutOrganizationConformancePack
-> Rep PutOrganizationConformancePack x
Prelude.Generic)

-- |
-- Create a value of 'PutOrganizationConformancePack' 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', 'putOrganizationConformancePack_conformancePackInputParameters' - A list of @ConformancePackInputParameter@ objects.
--
-- 'deliveryS3Bucket', 'putOrganizationConformancePack_deliveryS3Bucket' - The name of the Amazon S3 bucket where Config stores conformance pack
-- templates.
--
-- This field is optional. If used, it must be prefixed with
-- @awsconfigconforms@.
--
-- 'deliveryS3KeyPrefix', 'putOrganizationConformancePack_deliveryS3KeyPrefix' - The prefix for the Amazon S3 bucket.
--
-- This field is optional.
--
-- 'excludedAccounts', 'putOrganizationConformancePack_excludedAccounts' - A list of Amazon Web Services accounts to be excluded from an
-- organization conformance pack while deploying a conformance pack.
--
-- 'templateBody', 'putOrganizationConformancePack_templateBody' - A string containing full conformance pack template body. Structure
-- containing the template body with a minimum length of 1 byte and a
-- maximum length of 51,200 bytes.
--
-- 'templateS3Uri', 'putOrganizationConformancePack_templateS3Uri' - Location of file containing the template body. The uri must point to the
-- conformance pack template (max size: 300 KB).
--
-- You must have access to read Amazon S3 bucket.
--
-- 'organizationConformancePackName', 'putOrganizationConformancePack_organizationConformancePackName' - Name of the organization conformance pack you want to create.
newPutOrganizationConformancePack ::
  -- | 'organizationConformancePackName'
  Prelude.Text ->
  PutOrganizationConformancePack
newPutOrganizationConformancePack :: Text -> PutOrganizationConformancePack
newPutOrganizationConformancePack
  Text
pOrganizationConformancePackName_ =
    PutOrganizationConformancePack'
      { $sel:conformancePackInputParameters:PutOrganizationConformancePack' :: Maybe [ConformancePackInputParameter]
conformancePackInputParameters =
          forall a. Maybe a
Prelude.Nothing,
        $sel:deliveryS3Bucket:PutOrganizationConformancePack' :: Maybe Text
deliveryS3Bucket = forall a. Maybe a
Prelude.Nothing,
        $sel:deliveryS3KeyPrefix:PutOrganizationConformancePack' :: Maybe Text
deliveryS3KeyPrefix = forall a. Maybe a
Prelude.Nothing,
        $sel:excludedAccounts:PutOrganizationConformancePack' :: Maybe [Text]
excludedAccounts = forall a. Maybe a
Prelude.Nothing,
        $sel:templateBody:PutOrganizationConformancePack' :: Maybe Text
templateBody = forall a. Maybe a
Prelude.Nothing,
        $sel:templateS3Uri:PutOrganizationConformancePack' :: Maybe Text
templateS3Uri = forall a. Maybe a
Prelude.Nothing,
        $sel:organizationConformancePackName:PutOrganizationConformancePack' :: Text
organizationConformancePackName =
          Text
pOrganizationConformancePackName_
      }

-- | A list of @ConformancePackInputParameter@ objects.
putOrganizationConformancePack_conformancePackInputParameters :: Lens.Lens' PutOrganizationConformancePack (Prelude.Maybe [ConformancePackInputParameter])
putOrganizationConformancePack_conformancePackInputParameters :: Lens'
  PutOrganizationConformancePack
  (Maybe [ConformancePackInputParameter])
putOrganizationConformancePack_conformancePackInputParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConformancePack' {Maybe [ConformancePackInputParameter]
conformancePackInputParameters :: Maybe [ConformancePackInputParameter]
$sel:conformancePackInputParameters:PutOrganizationConformancePack' :: PutOrganizationConformancePack
-> Maybe [ConformancePackInputParameter]
conformancePackInputParameters} -> Maybe [ConformancePackInputParameter]
conformancePackInputParameters) (\s :: PutOrganizationConformancePack
s@PutOrganizationConformancePack' {} Maybe [ConformancePackInputParameter]
a -> PutOrganizationConformancePack
s {$sel:conformancePackInputParameters:PutOrganizationConformancePack' :: Maybe [ConformancePackInputParameter]
conformancePackInputParameters = Maybe [ConformancePackInputParameter]
a} :: PutOrganizationConformancePack) 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. If used, it must be prefixed with
-- @awsconfigconforms@.
putOrganizationConformancePack_deliveryS3Bucket :: Lens.Lens' PutOrganizationConformancePack (Prelude.Maybe Prelude.Text)
putOrganizationConformancePack_deliveryS3Bucket :: Lens' PutOrganizationConformancePack (Maybe Text)
putOrganizationConformancePack_deliveryS3Bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConformancePack' {Maybe Text
deliveryS3Bucket :: Maybe Text
$sel:deliveryS3Bucket:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
deliveryS3Bucket} -> Maybe Text
deliveryS3Bucket) (\s :: PutOrganizationConformancePack
s@PutOrganizationConformancePack' {} Maybe Text
a -> PutOrganizationConformancePack
s {$sel:deliveryS3Bucket:PutOrganizationConformancePack' :: Maybe Text
deliveryS3Bucket = Maybe Text
a} :: PutOrganizationConformancePack)

-- | The prefix for the Amazon S3 bucket.
--
-- This field is optional.
putOrganizationConformancePack_deliveryS3KeyPrefix :: Lens.Lens' PutOrganizationConformancePack (Prelude.Maybe Prelude.Text)
putOrganizationConformancePack_deliveryS3KeyPrefix :: Lens' PutOrganizationConformancePack (Maybe Text)
putOrganizationConformancePack_deliveryS3KeyPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConformancePack' {Maybe Text
deliveryS3KeyPrefix :: Maybe Text
$sel:deliveryS3KeyPrefix:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
deliveryS3KeyPrefix} -> Maybe Text
deliveryS3KeyPrefix) (\s :: PutOrganizationConformancePack
s@PutOrganizationConformancePack' {} Maybe Text
a -> PutOrganizationConformancePack
s {$sel:deliveryS3KeyPrefix:PutOrganizationConformancePack' :: Maybe Text
deliveryS3KeyPrefix = Maybe Text
a} :: PutOrganizationConformancePack)

-- | A list of Amazon Web Services accounts to be excluded from an
-- organization conformance pack while deploying a conformance pack.
putOrganizationConformancePack_excludedAccounts :: Lens.Lens' PutOrganizationConformancePack (Prelude.Maybe [Prelude.Text])
putOrganizationConformancePack_excludedAccounts :: Lens' PutOrganizationConformancePack (Maybe [Text])
putOrganizationConformancePack_excludedAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConformancePack' {Maybe [Text]
excludedAccounts :: Maybe [Text]
$sel:excludedAccounts:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe [Text]
excludedAccounts} -> Maybe [Text]
excludedAccounts) (\s :: PutOrganizationConformancePack
s@PutOrganizationConformancePack' {} Maybe [Text]
a -> PutOrganizationConformancePack
s {$sel:excludedAccounts:PutOrganizationConformancePack' :: Maybe [Text]
excludedAccounts = Maybe [Text]
a} :: PutOrganizationConformancePack) 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

-- | A string containing full conformance pack template body. Structure
-- containing the template body with a minimum length of 1 byte and a
-- maximum length of 51,200 bytes.
putOrganizationConformancePack_templateBody :: Lens.Lens' PutOrganizationConformancePack (Prelude.Maybe Prelude.Text)
putOrganizationConformancePack_templateBody :: Lens' PutOrganizationConformancePack (Maybe Text)
putOrganizationConformancePack_templateBody = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConformancePack' {Maybe Text
templateBody :: Maybe Text
$sel:templateBody:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
templateBody} -> Maybe Text
templateBody) (\s :: PutOrganizationConformancePack
s@PutOrganizationConformancePack' {} Maybe Text
a -> PutOrganizationConformancePack
s {$sel:templateBody:PutOrganizationConformancePack' :: Maybe Text
templateBody = Maybe Text
a} :: PutOrganizationConformancePack)

-- | Location of file containing the template body. The uri must point to the
-- conformance pack template (max size: 300 KB).
--
-- You must have access to read Amazon S3 bucket.
putOrganizationConformancePack_templateS3Uri :: Lens.Lens' PutOrganizationConformancePack (Prelude.Maybe Prelude.Text)
putOrganizationConformancePack_templateS3Uri :: Lens' PutOrganizationConformancePack (Maybe Text)
putOrganizationConformancePack_templateS3Uri = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConformancePack' {Maybe Text
templateS3Uri :: Maybe Text
$sel:templateS3Uri:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
templateS3Uri} -> Maybe Text
templateS3Uri) (\s :: PutOrganizationConformancePack
s@PutOrganizationConformancePack' {} Maybe Text
a -> PutOrganizationConformancePack
s {$sel:templateS3Uri:PutOrganizationConformancePack' :: Maybe Text
templateS3Uri = Maybe Text
a} :: PutOrganizationConformancePack)

-- | Name of the organization conformance pack you want to create.
putOrganizationConformancePack_organizationConformancePackName :: Lens.Lens' PutOrganizationConformancePack Prelude.Text
putOrganizationConformancePack_organizationConformancePackName :: Lens' PutOrganizationConformancePack Text
putOrganizationConformancePack_organizationConformancePackName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConformancePack' {Text
organizationConformancePackName :: Text
$sel:organizationConformancePackName:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Text
organizationConformancePackName} -> Text
organizationConformancePackName) (\s :: PutOrganizationConformancePack
s@PutOrganizationConformancePack' {} Text
a -> PutOrganizationConformancePack
s {$sel:organizationConformancePackName:PutOrganizationConformancePack' :: Text
organizationConformancePackName = Text
a} :: PutOrganizationConformancePack)

instance
  Core.AWSRequest
    PutOrganizationConformancePack
  where
  type
    AWSResponse PutOrganizationConformancePack =
      PutOrganizationConformancePackResponse
  request :: (Service -> Service)
-> PutOrganizationConformancePack
-> Request PutOrganizationConformancePack
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutOrganizationConformancePack
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse PutOrganizationConformancePack)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> PutOrganizationConformancePackResponse
PutOrganizationConformancePackResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"OrganizationConformancePackArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    PutOrganizationConformancePack
  where
  hashWithSalt :: Int -> PutOrganizationConformancePack -> Int
hashWithSalt
    Int
_salt
    PutOrganizationConformancePack' {Maybe [Text]
Maybe [ConformancePackInputParameter]
Maybe Text
Text
organizationConformancePackName :: Text
templateS3Uri :: Maybe Text
templateBody :: Maybe Text
excludedAccounts :: Maybe [Text]
deliveryS3KeyPrefix :: Maybe Text
deliveryS3Bucket :: Maybe Text
conformancePackInputParameters :: Maybe [ConformancePackInputParameter]
$sel:organizationConformancePackName:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Text
$sel:templateS3Uri:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:templateBody:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:excludedAccounts:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe [Text]
$sel:deliveryS3KeyPrefix:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:deliveryS3Bucket:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:conformancePackInputParameters:PutOrganizationConformancePack' :: PutOrganizationConformancePack
-> 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` Maybe Text
templateBody
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
templateS3Uri
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
organizationConformancePackName

instance
  Prelude.NFData
    PutOrganizationConformancePack
  where
  rnf :: PutOrganizationConformancePack -> ()
rnf PutOrganizationConformancePack' {Maybe [Text]
Maybe [ConformancePackInputParameter]
Maybe Text
Text
organizationConformancePackName :: Text
templateS3Uri :: Maybe Text
templateBody :: Maybe Text
excludedAccounts :: Maybe [Text]
deliveryS3KeyPrefix :: Maybe Text
deliveryS3Bucket :: Maybe Text
conformancePackInputParameters :: Maybe [ConformancePackInputParameter]
$sel:organizationConformancePackName:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Text
$sel:templateS3Uri:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:templateBody:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:excludedAccounts:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe [Text]
$sel:deliveryS3KeyPrefix:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:deliveryS3Bucket:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:conformancePackInputParameters:PutOrganizationConformancePack' :: PutOrganizationConformancePack
-> 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 Maybe Text
templateBody
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
templateS3Uri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
organizationConformancePackName

instance
  Data.ToHeaders
    PutOrganizationConformancePack
  where
  toHeaders :: PutOrganizationConformancePack -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"StarlingDoveService.PutOrganizationConformancePack" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON PutOrganizationConformancePack where
  toJSON :: PutOrganizationConformancePack -> Value
toJSON PutOrganizationConformancePack' {Maybe [Text]
Maybe [ConformancePackInputParameter]
Maybe Text
Text
organizationConformancePackName :: Text
templateS3Uri :: Maybe Text
templateBody :: Maybe Text
excludedAccounts :: Maybe [Text]
deliveryS3KeyPrefix :: Maybe Text
deliveryS3Bucket :: Maybe Text
conformancePackInputParameters :: Maybe [ConformancePackInputParameter]
$sel:organizationConformancePackName:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Text
$sel:templateS3Uri:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:templateBody:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:excludedAccounts:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe [Text]
$sel:deliveryS3KeyPrefix:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:deliveryS3Bucket:PutOrganizationConformancePack' :: PutOrganizationConformancePack -> Maybe Text
$sel:conformancePackInputParameters:PutOrganizationConformancePack' :: PutOrganizationConformancePack
-> Maybe [ConformancePackInputParameter]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ConformancePackInputParameters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ConformancePackInputParameter]
conformancePackInputParameters,
            (Key
"DeliveryS3Bucket" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deliveryS3Bucket,
            (Key
"DeliveryS3KeyPrefix" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deliveryS3KeyPrefix,
            (Key
"ExcludedAccounts" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
excludedAccounts,
            (Key
"TemplateBody" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
templateBody,
            (Key
"TemplateS3Uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
templateS3Uri,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"OrganizationConformancePackName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
organizationConformancePackName
              )
          ]
      )

instance Data.ToPath PutOrganizationConformancePack where
  toPath :: PutOrganizationConformancePack -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery PutOrganizationConformancePack where
  toQuery :: PutOrganizationConformancePack -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newPutOrganizationConformancePackResponse' smart constructor.
data PutOrganizationConformancePackResponse = PutOrganizationConformancePackResponse'
  { -- | ARN of the organization conformance pack.
    PutOrganizationConformancePackResponse -> Maybe Text
organizationConformancePackArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    PutOrganizationConformancePackResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (PutOrganizationConformancePackResponse
-> PutOrganizationConformancePackResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutOrganizationConformancePackResponse
-> PutOrganizationConformancePackResponse -> Bool
$c/= :: PutOrganizationConformancePackResponse
-> PutOrganizationConformancePackResponse -> Bool
== :: PutOrganizationConformancePackResponse
-> PutOrganizationConformancePackResponse -> Bool
$c== :: PutOrganizationConformancePackResponse
-> PutOrganizationConformancePackResponse -> Bool
Prelude.Eq, ReadPrec [PutOrganizationConformancePackResponse]
ReadPrec PutOrganizationConformancePackResponse
Int -> ReadS PutOrganizationConformancePackResponse
ReadS [PutOrganizationConformancePackResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutOrganizationConformancePackResponse]
$creadListPrec :: ReadPrec [PutOrganizationConformancePackResponse]
readPrec :: ReadPrec PutOrganizationConformancePackResponse
$creadPrec :: ReadPrec PutOrganizationConformancePackResponse
readList :: ReadS [PutOrganizationConformancePackResponse]
$creadList :: ReadS [PutOrganizationConformancePackResponse]
readsPrec :: Int -> ReadS PutOrganizationConformancePackResponse
$creadsPrec :: Int -> ReadS PutOrganizationConformancePackResponse
Prelude.Read, Int -> PutOrganizationConformancePackResponse -> ShowS
[PutOrganizationConformancePackResponse] -> ShowS
PutOrganizationConformancePackResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutOrganizationConformancePackResponse] -> ShowS
$cshowList :: [PutOrganizationConformancePackResponse] -> ShowS
show :: PutOrganizationConformancePackResponse -> String
$cshow :: PutOrganizationConformancePackResponse -> String
showsPrec :: Int -> PutOrganizationConformancePackResponse -> ShowS
$cshowsPrec :: Int -> PutOrganizationConformancePackResponse -> ShowS
Prelude.Show, forall x.
Rep PutOrganizationConformancePackResponse x
-> PutOrganizationConformancePackResponse
forall x.
PutOrganizationConformancePackResponse
-> Rep PutOrganizationConformancePackResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutOrganizationConformancePackResponse x
-> PutOrganizationConformancePackResponse
$cfrom :: forall x.
PutOrganizationConformancePackResponse
-> Rep PutOrganizationConformancePackResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutOrganizationConformancePackResponse' 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:
--
-- 'organizationConformancePackArn', 'putOrganizationConformancePackResponse_organizationConformancePackArn' - ARN of the organization conformance pack.
--
-- 'httpStatus', 'putOrganizationConformancePackResponse_httpStatus' - The response's http status code.
newPutOrganizationConformancePackResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutOrganizationConformancePackResponse
newPutOrganizationConformancePackResponse :: Int -> PutOrganizationConformancePackResponse
newPutOrganizationConformancePackResponse
  Int
pHttpStatus_ =
    PutOrganizationConformancePackResponse'
      { $sel:organizationConformancePackArn:PutOrganizationConformancePackResponse' :: Maybe Text
organizationConformancePackArn =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:PutOrganizationConformancePackResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | ARN of the organization conformance pack.
putOrganizationConformancePackResponse_organizationConformancePackArn :: Lens.Lens' PutOrganizationConformancePackResponse (Prelude.Maybe Prelude.Text)
putOrganizationConformancePackResponse_organizationConformancePackArn :: Lens' PutOrganizationConformancePackResponse (Maybe Text)
putOrganizationConformancePackResponse_organizationConformancePackArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConformancePackResponse' {Maybe Text
organizationConformancePackArn :: Maybe Text
$sel:organizationConformancePackArn:PutOrganizationConformancePackResponse' :: PutOrganizationConformancePackResponse -> Maybe Text
organizationConformancePackArn} -> Maybe Text
organizationConformancePackArn) (\s :: PutOrganizationConformancePackResponse
s@PutOrganizationConformancePackResponse' {} Maybe Text
a -> PutOrganizationConformancePackResponse
s {$sel:organizationConformancePackArn:PutOrganizationConformancePackResponse' :: Maybe Text
organizationConformancePackArn = Maybe Text
a} :: PutOrganizationConformancePackResponse)

-- | The response's http status code.
putOrganizationConformancePackResponse_httpStatus :: Lens.Lens' PutOrganizationConformancePackResponse Prelude.Int
putOrganizationConformancePackResponse_httpStatus :: Lens' PutOrganizationConformancePackResponse Int
putOrganizationConformancePackResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConformancePackResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutOrganizationConformancePackResponse' :: PutOrganizationConformancePackResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutOrganizationConformancePackResponse
s@PutOrganizationConformancePackResponse' {} Int
a -> PutOrganizationConformancePackResponse
s {$sel:httpStatus:PutOrganizationConformancePackResponse' :: Int
httpStatus = Int
a} :: PutOrganizationConformancePackResponse)

instance
  Prelude.NFData
    PutOrganizationConformancePackResponse
  where
  rnf :: PutOrganizationConformancePackResponse -> ()
rnf PutOrganizationConformancePackResponse' {Int
Maybe Text
httpStatus :: Int
organizationConformancePackArn :: Maybe Text
$sel:httpStatus:PutOrganizationConformancePackResponse' :: PutOrganizationConformancePackResponse -> Int
$sel:organizationConformancePackArn:PutOrganizationConformancePackResponse' :: PutOrganizationConformancePackResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
organizationConformancePackArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus