{-# 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.PutOrganizationConfigRule
-- 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)
--
-- Adds or updates organization config rule for your entire organization
-- evaluating whether your Amazon Web Services resources comply with your
-- desired configurations.
--
-- Only a master account and a delegated administrator can create or update
-- an organization config rule. When calling this API with a delegated
-- administrator, you must ensure Organizations
-- @ListDelegatedAdministrator@ permissions are added.
--
-- This API enables organization service access 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. Config
-- verifies the existence of role with @GetRole@ action.
--
-- To use this API with delegated administrator, register a delegated
-- administrator by calling Amazon Web Services Organization
-- @register-delegated-administrator@ for
-- @config-multiaccountsetup.amazonaws.com@.
--
-- You can use this action to create both custom Config rules and Config
-- managed rules. If you are adding a new custom Config rule, you must
-- first create Lambda function in the master account or a delegated
-- administrator that the rule invokes to evaluate your resources. You also
-- need to create an IAM role in the managed-account that can be assumed by
-- the Lambda function. When you use the @PutOrganizationConfigRule@ action
-- to add the rule to Config, you must specify the Amazon Resource Name
-- (ARN) that Lambda assigns to the function. If you are adding an Config
-- managed rule, specify the rule\'s identifier for the @RuleIdentifier@
-- key.
--
-- The maximum number of organization config rules that Config supports is
-- 150 and 3 delegated administrator per organization.
--
-- Prerequisite: Ensure you call @EnableAllFeatures@ API to enable all
-- features in an organization.
--
-- Specify either @OrganizationCustomRuleMetadata@ or
-- @OrganizationManagedRuleMetadata@.
module Amazonka.Config.PutOrganizationConfigRule
  ( -- * Creating a Request
    PutOrganizationConfigRule (..),
    newPutOrganizationConfigRule,

    -- * Request Lenses
    putOrganizationConfigRule_organizationManagedRuleMetadata,
    putOrganizationConfigRule_excludedAccounts,
    putOrganizationConfigRule_organizationCustomRuleMetadata,
    putOrganizationConfigRule_organizationConfigRuleName,

    -- * Destructuring the Response
    PutOrganizationConfigRuleResponse (..),
    newPutOrganizationConfigRuleResponse,

    -- * Response Lenses
    putOrganizationConfigRuleResponse_organizationConfigRuleArn,
    putOrganizationConfigRuleResponse_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:/ 'newPutOrganizationConfigRule' smart constructor.
data PutOrganizationConfigRule = PutOrganizationConfigRule'
  { -- | An @OrganizationManagedRuleMetadata@ object.
    PutOrganizationConfigRule -> Maybe OrganizationManagedRuleMetadata
organizationManagedRuleMetadata :: Prelude.Maybe OrganizationManagedRuleMetadata,
    -- | A comma-separated list of accounts that you want to exclude from an
    -- organization config rule.
    PutOrganizationConfigRule -> Maybe [Text]
excludedAccounts :: Prelude.Maybe [Prelude.Text],
    -- | An @OrganizationCustomRuleMetadata@ object.
    PutOrganizationConfigRule -> Maybe OrganizationCustomRuleMetadata
organizationCustomRuleMetadata :: Prelude.Maybe OrganizationCustomRuleMetadata,
    -- | The name that you assign to an organization config rule.
    PutOrganizationConfigRule -> Text
organizationConfigRuleName :: Prelude.Text
  }
  deriving (PutOrganizationConfigRule -> PutOrganizationConfigRule -> Bool
(PutOrganizationConfigRule -> PutOrganizationConfigRule -> Bool)
-> (PutOrganizationConfigRule -> PutOrganizationConfigRule -> Bool)
-> Eq PutOrganizationConfigRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutOrganizationConfigRule -> PutOrganizationConfigRule -> Bool
$c/= :: PutOrganizationConfigRule -> PutOrganizationConfigRule -> Bool
== :: PutOrganizationConfigRule -> PutOrganizationConfigRule -> Bool
$c== :: PutOrganizationConfigRule -> PutOrganizationConfigRule -> Bool
Prelude.Eq, ReadPrec [PutOrganizationConfigRule]
ReadPrec PutOrganizationConfigRule
Int -> ReadS PutOrganizationConfigRule
ReadS [PutOrganizationConfigRule]
(Int -> ReadS PutOrganizationConfigRule)
-> ReadS [PutOrganizationConfigRule]
-> ReadPrec PutOrganizationConfigRule
-> ReadPrec [PutOrganizationConfigRule]
-> Read PutOrganizationConfigRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutOrganizationConfigRule]
$creadListPrec :: ReadPrec [PutOrganizationConfigRule]
readPrec :: ReadPrec PutOrganizationConfigRule
$creadPrec :: ReadPrec PutOrganizationConfigRule
readList :: ReadS [PutOrganizationConfigRule]
$creadList :: ReadS [PutOrganizationConfigRule]
readsPrec :: Int -> ReadS PutOrganizationConfigRule
$creadsPrec :: Int -> ReadS PutOrganizationConfigRule
Prelude.Read, Int -> PutOrganizationConfigRule -> ShowS
[PutOrganizationConfigRule] -> ShowS
PutOrganizationConfigRule -> String
(Int -> PutOrganizationConfigRule -> ShowS)
-> (PutOrganizationConfigRule -> String)
-> ([PutOrganizationConfigRule] -> ShowS)
-> Show PutOrganizationConfigRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutOrganizationConfigRule] -> ShowS
$cshowList :: [PutOrganizationConfigRule] -> ShowS
show :: PutOrganizationConfigRule -> String
$cshow :: PutOrganizationConfigRule -> String
showsPrec :: Int -> PutOrganizationConfigRule -> ShowS
$cshowsPrec :: Int -> PutOrganizationConfigRule -> ShowS
Prelude.Show, (forall x.
 PutOrganizationConfigRule -> Rep PutOrganizationConfigRule x)
-> (forall x.
    Rep PutOrganizationConfigRule x -> PutOrganizationConfigRule)
-> Generic PutOrganizationConfigRule
forall x.
Rep PutOrganizationConfigRule x -> PutOrganizationConfigRule
forall x.
PutOrganizationConfigRule -> Rep PutOrganizationConfigRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PutOrganizationConfigRule x -> PutOrganizationConfigRule
$cfrom :: forall x.
PutOrganizationConfigRule -> Rep PutOrganizationConfigRule x
Prelude.Generic)

-- |
-- Create a value of 'PutOrganizationConfigRule' 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:
--
-- 'organizationManagedRuleMetadata', 'putOrganizationConfigRule_organizationManagedRuleMetadata' - An @OrganizationManagedRuleMetadata@ object.
--
-- 'excludedAccounts', 'putOrganizationConfigRule_excludedAccounts' - A comma-separated list of accounts that you want to exclude from an
-- organization config rule.
--
-- 'organizationCustomRuleMetadata', 'putOrganizationConfigRule_organizationCustomRuleMetadata' - An @OrganizationCustomRuleMetadata@ object.
--
-- 'organizationConfigRuleName', 'putOrganizationConfigRule_organizationConfigRuleName' - The name that you assign to an organization config rule.
newPutOrganizationConfigRule ::
  -- | 'organizationConfigRuleName'
  Prelude.Text ->
  PutOrganizationConfigRule
newPutOrganizationConfigRule :: Text -> PutOrganizationConfigRule
newPutOrganizationConfigRule
  Text
pOrganizationConfigRuleName_ =
    PutOrganizationConfigRule' :: Maybe OrganizationManagedRuleMetadata
-> Maybe [Text]
-> Maybe OrganizationCustomRuleMetadata
-> Text
-> PutOrganizationConfigRule
PutOrganizationConfigRule'
      { $sel:organizationManagedRuleMetadata:PutOrganizationConfigRule' :: Maybe OrganizationManagedRuleMetadata
organizationManagedRuleMetadata =
          Maybe OrganizationManagedRuleMetadata
forall a. Maybe a
Prelude.Nothing,
        $sel:excludedAccounts:PutOrganizationConfigRule' :: Maybe [Text]
excludedAccounts = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:organizationCustomRuleMetadata:PutOrganizationConfigRule' :: Maybe OrganizationCustomRuleMetadata
organizationCustomRuleMetadata = Maybe OrganizationCustomRuleMetadata
forall a. Maybe a
Prelude.Nothing,
        $sel:organizationConfigRuleName:PutOrganizationConfigRule' :: Text
organizationConfigRuleName =
          Text
pOrganizationConfigRuleName_
      }

-- | An @OrganizationManagedRuleMetadata@ object.
putOrganizationConfigRule_organizationManagedRuleMetadata :: Lens.Lens' PutOrganizationConfigRule (Prelude.Maybe OrganizationManagedRuleMetadata)
putOrganizationConfigRule_organizationManagedRuleMetadata :: (Maybe OrganizationManagedRuleMetadata
 -> f (Maybe OrganizationManagedRuleMetadata))
-> PutOrganizationConfigRule -> f PutOrganizationConfigRule
putOrganizationConfigRule_organizationManagedRuleMetadata = (PutOrganizationConfigRule
 -> Maybe OrganizationManagedRuleMetadata)
-> (PutOrganizationConfigRule
    -> Maybe OrganizationManagedRuleMetadata
    -> PutOrganizationConfigRule)
-> Lens
     PutOrganizationConfigRule
     PutOrganizationConfigRule
     (Maybe OrganizationManagedRuleMetadata)
     (Maybe OrganizationManagedRuleMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConfigRule' {Maybe OrganizationManagedRuleMetadata
organizationManagedRuleMetadata :: Maybe OrganizationManagedRuleMetadata
$sel:organizationManagedRuleMetadata:PutOrganizationConfigRule' :: PutOrganizationConfigRule -> Maybe OrganizationManagedRuleMetadata
organizationManagedRuleMetadata} -> Maybe OrganizationManagedRuleMetadata
organizationManagedRuleMetadata) (\s :: PutOrganizationConfigRule
s@PutOrganizationConfigRule' {} Maybe OrganizationManagedRuleMetadata
a -> PutOrganizationConfigRule
s {$sel:organizationManagedRuleMetadata:PutOrganizationConfigRule' :: Maybe OrganizationManagedRuleMetadata
organizationManagedRuleMetadata = Maybe OrganizationManagedRuleMetadata
a} :: PutOrganizationConfigRule)

-- | A comma-separated list of accounts that you want to exclude from an
-- organization config rule.
putOrganizationConfigRule_excludedAccounts :: Lens.Lens' PutOrganizationConfigRule (Prelude.Maybe [Prelude.Text])
putOrganizationConfigRule_excludedAccounts :: (Maybe [Text] -> f (Maybe [Text]))
-> PutOrganizationConfigRule -> f PutOrganizationConfigRule
putOrganizationConfigRule_excludedAccounts = (PutOrganizationConfigRule -> Maybe [Text])
-> (PutOrganizationConfigRule
    -> Maybe [Text] -> PutOrganizationConfigRule)
-> Lens
     PutOrganizationConfigRule
     PutOrganizationConfigRule
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConfigRule' {Maybe [Text]
excludedAccounts :: Maybe [Text]
$sel:excludedAccounts:PutOrganizationConfigRule' :: PutOrganizationConfigRule -> Maybe [Text]
excludedAccounts} -> Maybe [Text]
excludedAccounts) (\s :: PutOrganizationConfigRule
s@PutOrganizationConfigRule' {} Maybe [Text]
a -> PutOrganizationConfigRule
s {$sel:excludedAccounts:PutOrganizationConfigRule' :: Maybe [Text]
excludedAccounts = Maybe [Text]
a} :: PutOrganizationConfigRule) ((Maybe [Text] -> f (Maybe [Text]))
 -> PutOrganizationConfigRule -> f PutOrganizationConfigRule)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> PutOrganizationConfigRule
-> f PutOrganizationConfigRule
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

-- | An @OrganizationCustomRuleMetadata@ object.
putOrganizationConfigRule_organizationCustomRuleMetadata :: Lens.Lens' PutOrganizationConfigRule (Prelude.Maybe OrganizationCustomRuleMetadata)
putOrganizationConfigRule_organizationCustomRuleMetadata :: (Maybe OrganizationCustomRuleMetadata
 -> f (Maybe OrganizationCustomRuleMetadata))
-> PutOrganizationConfigRule -> f PutOrganizationConfigRule
putOrganizationConfigRule_organizationCustomRuleMetadata = (PutOrganizationConfigRule -> Maybe OrganizationCustomRuleMetadata)
-> (PutOrganizationConfigRule
    -> Maybe OrganizationCustomRuleMetadata
    -> PutOrganizationConfigRule)
-> Lens
     PutOrganizationConfigRule
     PutOrganizationConfigRule
     (Maybe OrganizationCustomRuleMetadata)
     (Maybe OrganizationCustomRuleMetadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConfigRule' {Maybe OrganizationCustomRuleMetadata
organizationCustomRuleMetadata :: Maybe OrganizationCustomRuleMetadata
$sel:organizationCustomRuleMetadata:PutOrganizationConfigRule' :: PutOrganizationConfigRule -> Maybe OrganizationCustomRuleMetadata
organizationCustomRuleMetadata} -> Maybe OrganizationCustomRuleMetadata
organizationCustomRuleMetadata) (\s :: PutOrganizationConfigRule
s@PutOrganizationConfigRule' {} Maybe OrganizationCustomRuleMetadata
a -> PutOrganizationConfigRule
s {$sel:organizationCustomRuleMetadata:PutOrganizationConfigRule' :: Maybe OrganizationCustomRuleMetadata
organizationCustomRuleMetadata = Maybe OrganizationCustomRuleMetadata
a} :: PutOrganizationConfigRule)

-- | The name that you assign to an organization config rule.
putOrganizationConfigRule_organizationConfigRuleName :: Lens.Lens' PutOrganizationConfigRule Prelude.Text
putOrganizationConfigRule_organizationConfigRuleName :: (Text -> f Text)
-> PutOrganizationConfigRule -> f PutOrganizationConfigRule
putOrganizationConfigRule_organizationConfigRuleName = (PutOrganizationConfigRule -> Text)
-> (PutOrganizationConfigRule -> Text -> PutOrganizationConfigRule)
-> Lens
     PutOrganizationConfigRule PutOrganizationConfigRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConfigRule' {Text
organizationConfigRuleName :: Text
$sel:organizationConfigRuleName:PutOrganizationConfigRule' :: PutOrganizationConfigRule -> Text
organizationConfigRuleName} -> Text
organizationConfigRuleName) (\s :: PutOrganizationConfigRule
s@PutOrganizationConfigRule' {} Text
a -> PutOrganizationConfigRule
s {$sel:organizationConfigRuleName:PutOrganizationConfigRule' :: Text
organizationConfigRuleName = Text
a} :: PutOrganizationConfigRule)

instance Core.AWSRequest PutOrganizationConfigRule where
  type
    AWSResponse PutOrganizationConfigRule =
      PutOrganizationConfigRuleResponse
  request :: PutOrganizationConfigRule -> Request PutOrganizationConfigRule
request = Service
-> PutOrganizationConfigRule -> Request PutOrganizationConfigRule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutOrganizationConfigRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutOrganizationConfigRule)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PutOrganizationConfigRule))
-> Logger
-> Service
-> Proxy PutOrganizationConfigRule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PutOrganizationConfigRule)))
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 -> PutOrganizationConfigRuleResponse
PutOrganizationConfigRuleResponse'
            (Maybe Text -> Int -> PutOrganizationConfigRuleResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PutOrganizationConfigRuleResponse)
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
"OrganizationConfigRuleArn")
            Either String (Int -> PutOrganizationConfigRuleResponse)
-> Either String Int
-> Either String PutOrganizationConfigRuleResponse
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 PutOrganizationConfigRule

instance Prelude.NFData PutOrganizationConfigRule

instance Core.ToHeaders PutOrganizationConfigRule where
  toHeaders :: PutOrganizationConfigRule -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutOrganizationConfigRule -> 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.PutOrganizationConfigRule" ::
                          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 PutOrganizationConfigRule where
  toJSON :: PutOrganizationConfigRule -> Value
toJSON PutOrganizationConfigRule' {Maybe [Text]
Maybe OrganizationCustomRuleMetadata
Maybe OrganizationManagedRuleMetadata
Text
organizationConfigRuleName :: Text
organizationCustomRuleMetadata :: Maybe OrganizationCustomRuleMetadata
excludedAccounts :: Maybe [Text]
organizationManagedRuleMetadata :: Maybe OrganizationManagedRuleMetadata
$sel:organizationConfigRuleName:PutOrganizationConfigRule' :: PutOrganizationConfigRule -> Text
$sel:organizationCustomRuleMetadata:PutOrganizationConfigRule' :: PutOrganizationConfigRule -> Maybe OrganizationCustomRuleMetadata
$sel:excludedAccounts:PutOrganizationConfigRule' :: PutOrganizationConfigRule -> Maybe [Text]
$sel:organizationManagedRuleMetadata:PutOrganizationConfigRule' :: PutOrganizationConfigRule -> Maybe OrganizationManagedRuleMetadata
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"OrganizationManagedRuleMetadata" Text -> OrganizationManagedRuleMetadata -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (OrganizationManagedRuleMetadata -> Pair)
-> Maybe OrganizationManagedRuleMetadata -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OrganizationManagedRuleMetadata
organizationManagedRuleMetadata,
            (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
"OrganizationCustomRuleMetadata" Text -> OrganizationCustomRuleMetadata -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (OrganizationCustomRuleMetadata -> Pair)
-> Maybe OrganizationCustomRuleMetadata -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OrganizationCustomRuleMetadata
organizationCustomRuleMetadata,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"OrganizationConfigRuleName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationConfigRuleName
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'PutOrganizationConfigRuleResponse' 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:
--
-- 'organizationConfigRuleArn', 'putOrganizationConfigRuleResponse_organizationConfigRuleArn' - The Amazon Resource Name (ARN) of an organization config rule.
--
-- 'httpStatus', 'putOrganizationConfigRuleResponse_httpStatus' - The response's http status code.
newPutOrganizationConfigRuleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutOrganizationConfigRuleResponse
newPutOrganizationConfigRuleResponse :: Int -> PutOrganizationConfigRuleResponse
newPutOrganizationConfigRuleResponse Int
pHttpStatus_ =
  PutOrganizationConfigRuleResponse' :: Maybe Text -> Int -> PutOrganizationConfigRuleResponse
PutOrganizationConfigRuleResponse'
    { $sel:organizationConfigRuleArn:PutOrganizationConfigRuleResponse' :: Maybe Text
organizationConfigRuleArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PutOrganizationConfigRuleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of an organization config rule.
putOrganizationConfigRuleResponse_organizationConfigRuleArn :: Lens.Lens' PutOrganizationConfigRuleResponse (Prelude.Maybe Prelude.Text)
putOrganizationConfigRuleResponse_organizationConfigRuleArn :: (Maybe Text -> f (Maybe Text))
-> PutOrganizationConfigRuleResponse
-> f PutOrganizationConfigRuleResponse
putOrganizationConfigRuleResponse_organizationConfigRuleArn = (PutOrganizationConfigRuleResponse -> Maybe Text)
-> (PutOrganizationConfigRuleResponse
    -> Maybe Text -> PutOrganizationConfigRuleResponse)
-> Lens
     PutOrganizationConfigRuleResponse
     PutOrganizationConfigRuleResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutOrganizationConfigRuleResponse' {Maybe Text
organizationConfigRuleArn :: Maybe Text
$sel:organizationConfigRuleArn:PutOrganizationConfigRuleResponse' :: PutOrganizationConfigRuleResponse -> Maybe Text
organizationConfigRuleArn} -> Maybe Text
organizationConfigRuleArn) (\s :: PutOrganizationConfigRuleResponse
s@PutOrganizationConfigRuleResponse' {} Maybe Text
a -> PutOrganizationConfigRuleResponse
s {$sel:organizationConfigRuleArn:PutOrganizationConfigRuleResponse' :: Maybe Text
organizationConfigRuleArn = Maybe Text
a} :: PutOrganizationConfigRuleResponse)

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

instance
  Prelude.NFData
    PutOrganizationConfigRuleResponse