{-# 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-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)
--
-- Deploys conformance packs across member accounts in an Amazon Web
-- Services Organization.
--
-- Only a master 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.
--
-- This API enables organization service access for
-- @config-multiaccountsetup.amazonaws.com@ through the
-- @EnableAWSServiceAccess@ action and creates a service linked role
-- @AWSServiceRoleForConfigMultiAccountSetup@ in the master 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.
--
-- You can create 50 conformance packs with 25 Config rules in each pack
-- and 3 delegated administrator per organization.
module Amazonka.Config.PutOrganizationConformancePack
  ( -- * Creating a Request
    PutOrganizationConformancePack (..),
    newPutOrganizationConformancePack,

    -- * Request Lenses
    putOrganizationConformancePack_deliveryS3Bucket,
    putOrganizationConformancePack_deliveryS3KeyPrefix,
    putOrganizationConformancePack_templateS3Uri,
    putOrganizationConformancePack_conformancePackInputParameters,
    putOrganizationConformancePack_excludedAccounts,
    putOrganizationConformancePack_templateBody,
    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.Lens as Lens
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'
  { -- | 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,
    -- | 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,
    -- | A list of @ConformancePackInputParameter@ objects.
    PutOrganizationConformancePack
-> Maybe [ConformancePackInputParameter]
conformancePackInputParameters :: Prelude.Maybe [ConformancePackInputParameter],
    -- | 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,
    -- | Name of the organization conformance pack you want to create.
    PutOrganizationConformancePack -> Text
organizationConformancePackName :: Prelude.Text
  }
  deriving (PutOrganizationConformancePack
-> PutOrganizationConformancePack -> Bool
(PutOrganizationConformancePack
 -> PutOrganizationConformancePack -> Bool)
-> (PutOrganizationConformancePack
    -> PutOrganizationConformancePack -> Bool)
-> Eq PutOrganizationConformancePack
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]
(Int -> ReadS PutOrganizationConformancePack)
-> ReadS [PutOrganizationConformancePack]
-> ReadPrec PutOrganizationConformancePack
-> ReadPrec [PutOrganizationConformancePack]
-> Read 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
(Int -> PutOrganizationConformancePack -> ShowS)
-> (PutOrganizationConformancePack -> String)
-> ([PutOrganizationConformancePack] -> ShowS)
-> Show PutOrganizationConformancePack
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.
 PutOrganizationConformancePack
 -> Rep PutOrganizationConformancePack x)
-> (forall x.
    Rep PutOrganizationConformancePack x
    -> PutOrganizationConformancePack)
-> Generic PutOrganizationConformancePack
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:
--
-- '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.
--
-- '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.
--
-- 'conformancePackInputParameters', 'putOrganizationConformancePack_conformancePackInputParameters' - A list of @ConformancePackInputParameter@ objects.
--
-- '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.
--
-- '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' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [ConformancePackInputParameter]
-> Maybe [Text]
-> Maybe Text
-> Text
-> PutOrganizationConformancePack
PutOrganizationConformancePack'
      { $sel:deliveryS3Bucket:PutOrganizationConformancePack' :: Maybe Text
deliveryS3Bucket =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:deliveryS3KeyPrefix:PutOrganizationConformancePack' :: Maybe Text
deliveryS3KeyPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:templateS3Uri:PutOrganizationConformancePack' :: Maybe Text
templateS3Uri = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:conformancePackInputParameters:PutOrganizationConformancePack' :: Maybe [ConformancePackInputParameter]
conformancePackInputParameters =
          Maybe [ConformancePackInputParameter]
forall a. Maybe a
Prelude.Nothing,
        $sel:excludedAccounts:PutOrganizationConformancePack' :: Maybe [Text]
excludedAccounts = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:templateBody:PutOrganizationConformancePack' :: Maybe Text
templateBody = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:organizationConformancePackName:PutOrganizationConformancePack' :: Text
organizationConformancePackName =
          Text
pOrganizationConformancePackName_
      }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> PutOrganizationConformancePack
-> f PutOrganizationConformancePack
putOrganizationConformancePack_deliveryS3Bucket = (PutOrganizationConformancePack -> Maybe Text)
-> (PutOrganizationConformancePack
    -> Maybe Text -> PutOrganizationConformancePack)
-> Lens
     PutOrganizationConformancePack
     PutOrganizationConformancePack
     (Maybe Text)
     (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> PutOrganizationConformancePack
-> f PutOrganizationConformancePack
putOrganizationConformancePack_deliveryS3KeyPrefix = (PutOrganizationConformancePack -> Maybe Text)
-> (PutOrganizationConformancePack
    -> Maybe Text -> PutOrganizationConformancePack)
-> Lens
     PutOrganizationConformancePack
     PutOrganizationConformancePack
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> PutOrganizationConformancePack
-> f PutOrganizationConformancePack
putOrganizationConformancePack_templateS3Uri = (PutOrganizationConformancePack -> Maybe Text)
-> (PutOrganizationConformancePack
    -> Maybe Text -> PutOrganizationConformancePack)
-> Lens
     PutOrganizationConformancePack
     PutOrganizationConformancePack
     (Maybe Text)
     (Maybe Text)
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)

-- | A list of @ConformancePackInputParameter@ objects.
putOrganizationConformancePack_conformancePackInputParameters :: Lens.Lens' PutOrganizationConformancePack (Prelude.Maybe [ConformancePackInputParameter])
putOrganizationConformancePack_conformancePackInputParameters :: (Maybe [ConformancePackInputParameter]
 -> f (Maybe [ConformancePackInputParameter]))
-> PutOrganizationConformancePack
-> f PutOrganizationConformancePack
putOrganizationConformancePack_conformancePackInputParameters = (PutOrganizationConformancePack
 -> Maybe [ConformancePackInputParameter])
-> (PutOrganizationConformancePack
    -> Maybe [ConformancePackInputParameter]
    -> PutOrganizationConformancePack)
-> Lens
     PutOrganizationConformancePack
     PutOrganizationConformancePack
     (Maybe [ConformancePackInputParameter])
     (Maybe [ConformancePackInputParameter])
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) ((Maybe [ConformancePackInputParameter]
  -> f (Maybe [ConformancePackInputParameter]))
 -> PutOrganizationConformancePack
 -> f PutOrganizationConformancePack)
-> ((Maybe [ConformancePackInputParameter]
     -> f (Maybe [ConformancePackInputParameter]))
    -> Maybe [ConformancePackInputParameter]
    -> f (Maybe [ConformancePackInputParameter]))
-> (Maybe [ConformancePackInputParameter]
    -> f (Maybe [ConformancePackInputParameter]))
-> PutOrganizationConformancePack
-> f PutOrganizationConformancePack
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ConformancePackInputParameter]
  [ConformancePackInputParameter]
  [ConformancePackInputParameter]
  [ConformancePackInputParameter]
-> Iso
     (Maybe [ConformancePackInputParameter])
     (Maybe [ConformancePackInputParameter])
     (Maybe [ConformancePackInputParameter])
     (Maybe [ConformancePackInputParameter])
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
  [ConformancePackInputParameter]
  [ConformancePackInputParameter]
  [ConformancePackInputParameter]
  [ConformancePackInputParameter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe [Text] -> f (Maybe [Text]))
-> PutOrganizationConformancePack
-> f PutOrganizationConformancePack
putOrganizationConformancePack_excludedAccounts = (PutOrganizationConformancePack -> Maybe [Text])
-> (PutOrganizationConformancePack
    -> Maybe [Text] -> PutOrganizationConformancePack)
-> Lens
     PutOrganizationConformancePack
     PutOrganizationConformancePack
     (Maybe [Text])
     (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> PutOrganizationConformancePack
 -> f PutOrganizationConformancePack)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> PutOrganizationConformancePack
-> f PutOrganizationConformancePack
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
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 :: (Maybe Text -> f (Maybe Text))
-> PutOrganizationConformancePack
-> f PutOrganizationConformancePack
putOrganizationConformancePack_templateBody = (PutOrganizationConformancePack -> Maybe Text)
-> (PutOrganizationConformancePack
    -> Maybe Text -> PutOrganizationConformancePack)
-> Lens
     PutOrganizationConformancePack
     PutOrganizationConformancePack
     (Maybe Text)
     (Maybe Text)
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)

-- | Name of the organization conformance pack you want to create.
putOrganizationConformancePack_organizationConformancePackName :: Lens.Lens' PutOrganizationConformancePack Prelude.Text
putOrganizationConformancePack_organizationConformancePackName :: (Text -> f Text)
-> PutOrganizationConformancePack
-> f PutOrganizationConformancePack
putOrganizationConformancePack_organizationConformancePackName = (PutOrganizationConformancePack -> Text)
-> (PutOrganizationConformancePack
    -> Text -> PutOrganizationConformancePack)
-> Lens
     PutOrganizationConformancePack
     PutOrganizationConformancePack
     Text
     Text
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 :: PutOrganizationConformancePack
-> Request PutOrganizationConformancePack
request = Service
-> PutOrganizationConformancePack
-> Request PutOrganizationConformancePack
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutOrganizationConformancePack
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse PutOrganizationConformancePack)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PutOrganizationConformancePack))
-> Logger
-> Service
-> Proxy PutOrganizationConformancePack
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse PutOrganizationConformancePack)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> PutOrganizationConformancePackResponse
PutOrganizationConformancePackResponse'
            (Maybe Text -> Int -> PutOrganizationConformancePackResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PutOrganizationConformancePackResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"OrganizationConformancePackArn")
            Either String (Int -> PutOrganizationConformancePackResponse)
-> Either String Int
-> Either String PutOrganizationConformancePackResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    PutOrganizationConformancePack

instance
  Prelude.NFData
    PutOrganizationConformancePack

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

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

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

instance Core.ToQuery PutOrganizationConformancePack where
  toQuery :: PutOrganizationConformancePack -> QueryString
toQuery = QueryString -> PutOrganizationConformancePack -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(PutOrganizationConformancePackResponse
 -> PutOrganizationConformancePackResponse -> Bool)
-> (PutOrganizationConformancePackResponse
    -> PutOrganizationConformancePackResponse -> Bool)
-> Eq PutOrganizationConformancePackResponse
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]
(Int -> ReadS PutOrganizationConformancePackResponse)
-> ReadS [PutOrganizationConformancePackResponse]
-> ReadPrec PutOrganizationConformancePackResponse
-> ReadPrec [PutOrganizationConformancePackResponse]
-> Read 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
(Int -> PutOrganizationConformancePackResponse -> ShowS)
-> (PutOrganizationConformancePackResponse -> String)
-> ([PutOrganizationConformancePackResponse] -> ShowS)
-> Show PutOrganizationConformancePackResponse
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.
 PutOrganizationConformancePackResponse
 -> Rep PutOrganizationConformancePackResponse x)
-> (forall x.
    Rep PutOrganizationConformancePackResponse x
    -> PutOrganizationConformancePackResponse)
-> Generic PutOrganizationConformancePackResponse
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' :: Maybe Text -> Int -> PutOrganizationConformancePackResponse
PutOrganizationConformancePackResponse'
      { $sel:organizationConformancePackArn:PutOrganizationConformancePackResponse' :: Maybe Text
organizationConformancePackArn =
          Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> PutOrganizationConformancePackResponse
-> f PutOrganizationConformancePackResponse
putOrganizationConformancePackResponse_organizationConformancePackArn = (PutOrganizationConformancePackResponse -> Maybe Text)
-> (PutOrganizationConformancePackResponse
    -> Maybe Text -> PutOrganizationConformancePackResponse)
-> Lens
     PutOrganizationConformancePackResponse
     PutOrganizationConformancePackResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Int -> f Int)
-> PutOrganizationConformancePackResponse
-> f PutOrganizationConformancePackResponse
putOrganizationConformancePackResponse_httpStatus = (PutOrganizationConformancePackResponse -> Int)
-> (PutOrganizationConformancePackResponse
    -> Int -> PutOrganizationConformancePackResponse)
-> Lens
     PutOrganizationConformancePackResponse
     PutOrganizationConformancePackResponse
     Int
     Int
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