{-# 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.KMS.PutKeyPolicy
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Attaches a key policy to the specified KMS key.
--
-- For more information about key policies, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html Key Policies>
-- in the /Key Management Service Developer Guide/. For help writing and
-- formatting a JSON policy document, see the
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html IAM JSON Policy Reference>
-- in the //Identity and Access Management User Guide// . For examples of
-- adding a key policy in multiple programming languages, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/programming-key-policies.html#put-policy Setting a key policy>
-- in the /Key Management Service Developer Guide/.
--
-- __Cross-account use__: No. You cannot perform this operation on a KMS
-- key in a different Amazon Web Services account.
--
-- __Required permissions__:
-- <https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html kms:PutKeyPolicy>
-- (key policy)
--
-- __Related operations__: GetKeyPolicy
module Amazonka.KMS.PutKeyPolicy
  ( -- * Creating a Request
    PutKeyPolicy (..),
    newPutKeyPolicy,

    -- * Request Lenses
    putKeyPolicy_bypassPolicyLockoutSafetyCheck,
    putKeyPolicy_keyId,
    putKeyPolicy_policyName,
    putKeyPolicy_policy,

    -- * Destructuring the Response
    PutKeyPolicyResponse (..),
    newPutKeyPolicyResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KMS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newPutKeyPolicy' smart constructor.
data PutKeyPolicy = PutKeyPolicy'
  { -- | A flag to indicate whether to bypass the key policy lockout safety
    -- check.
    --
    -- Setting this value to true increases the risk that the KMS key becomes
    -- unmanageable. Do not set this value to true indiscriminately.
    --
    -- For more information, refer to the scenario in the
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam Default Key Policy>
    -- section in the /Key Management Service Developer Guide/.
    --
    -- Use this parameter only when you intend to prevent the principal that is
    -- making the request from making a subsequent @PutKeyPolicy@ request on
    -- the KMS key.
    --
    -- The default value is false.
    PutKeyPolicy -> Maybe Bool
bypassPolicyLockoutSafetyCheck :: Prelude.Maybe Prelude.Bool,
    -- | Sets the key policy on the specified KMS key.
    --
    -- Specify the key ID or key ARN of the KMS key.
    --
    -- For example:
    --
    -- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
    --
    -- -   Key ARN:
    --     @arn:aws:kms:us-east-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
    --
    -- To get the key ID and key ARN for a KMS key, use ListKeys or
    -- DescribeKey.
    PutKeyPolicy -> Text
keyId :: Prelude.Text,
    -- | The name of the key policy. The only valid value is @default@.
    PutKeyPolicy -> Text
policyName :: Prelude.Text,
    -- | The key policy to attach to the KMS key.
    --
    -- The key policy must meet the following criteria:
    --
    -- -   If you don\'t set @BypassPolicyLockoutSafetyCheck@ to true, the key
    --     policy must allow the principal that is making the @PutKeyPolicy@
    --     request to make a subsequent @PutKeyPolicy@ request on the KMS key.
    --     This reduces the risk that the KMS key becomes unmanageable. For
    --     more information, refer to the scenario in the
    --     <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam Default Key Policy>
    --     section of the /Key Management Service Developer Guide/.
    --
    -- -   Each statement in the key policy must contain one or more
    --     principals. The principals in the key policy must exist and be
    --     visible to KMS. When you create a new Amazon Web Services principal
    --     (for example, an IAM user or role), you might need to enforce a
    --     delay before including the new principal in a key policy because the
    --     new principal might not be immediately visible to KMS. For more
    --     information, see
    --     <https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency Changes that I make are not always immediately visible>
    --     in the /Amazon Web Services Identity and Access Management User
    --     Guide/.
    --
    -- A key policy document can include only the following characters:
    --
    -- -   Printable ASCII characters from the space character (@\\u0020@)
    --     through the end of the ASCII character range.
    --
    -- -   Printable characters in the Basic Latin and Latin-1 Supplement
    --     character set (through @\\u00FF@).
    --
    -- -   The tab (@\\u0009@), line feed (@\\u000A@), and carriage return
    --     (@\\u000D@) special characters
    --
    -- For information about key policies, see
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html Key policies in KMS>
    -- in the /Key Management Service Developer Guide/.For help writing and
    -- formatting a JSON policy document, see the
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html IAM JSON Policy Reference>
    -- in the //Identity and Access Management User Guide// .
    PutKeyPolicy -> Text
policy :: Prelude.Text
  }
  deriving (PutKeyPolicy -> PutKeyPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutKeyPolicy -> PutKeyPolicy -> Bool
$c/= :: PutKeyPolicy -> PutKeyPolicy -> Bool
== :: PutKeyPolicy -> PutKeyPolicy -> Bool
$c== :: PutKeyPolicy -> PutKeyPolicy -> Bool
Prelude.Eq, ReadPrec [PutKeyPolicy]
ReadPrec PutKeyPolicy
Int -> ReadS PutKeyPolicy
ReadS [PutKeyPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutKeyPolicy]
$creadListPrec :: ReadPrec [PutKeyPolicy]
readPrec :: ReadPrec PutKeyPolicy
$creadPrec :: ReadPrec PutKeyPolicy
readList :: ReadS [PutKeyPolicy]
$creadList :: ReadS [PutKeyPolicy]
readsPrec :: Int -> ReadS PutKeyPolicy
$creadsPrec :: Int -> ReadS PutKeyPolicy
Prelude.Read, Int -> PutKeyPolicy -> ShowS
[PutKeyPolicy] -> ShowS
PutKeyPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutKeyPolicy] -> ShowS
$cshowList :: [PutKeyPolicy] -> ShowS
show :: PutKeyPolicy -> String
$cshow :: PutKeyPolicy -> String
showsPrec :: Int -> PutKeyPolicy -> ShowS
$cshowsPrec :: Int -> PutKeyPolicy -> ShowS
Prelude.Show, forall x. Rep PutKeyPolicy x -> PutKeyPolicy
forall x. PutKeyPolicy -> Rep PutKeyPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutKeyPolicy x -> PutKeyPolicy
$cfrom :: forall x. PutKeyPolicy -> Rep PutKeyPolicy x
Prelude.Generic)

-- |
-- Create a value of 'PutKeyPolicy' 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:
--
-- 'bypassPolicyLockoutSafetyCheck', 'putKeyPolicy_bypassPolicyLockoutSafetyCheck' - A flag to indicate whether to bypass the key policy lockout safety
-- check.
--
-- Setting this value to true increases the risk that the KMS key becomes
-- unmanageable. Do not set this value to true indiscriminately.
--
-- For more information, refer to the scenario in the
-- <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam Default Key Policy>
-- section in the /Key Management Service Developer Guide/.
--
-- Use this parameter only when you intend to prevent the principal that is
-- making the request from making a subsequent @PutKeyPolicy@ request on
-- the KMS key.
--
-- The default value is false.
--
-- 'keyId', 'putKeyPolicy_keyId' - Sets the key policy on the specified KMS key.
--
-- Specify the key ID or key ARN of the KMS key.
--
-- For example:
--
-- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Key ARN:
--     @arn:aws:kms:us-east-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- To get the key ID and key ARN for a KMS key, use ListKeys or
-- DescribeKey.
--
-- 'policyName', 'putKeyPolicy_policyName' - The name of the key policy. The only valid value is @default@.
--
-- 'policy', 'putKeyPolicy_policy' - The key policy to attach to the KMS key.
--
-- The key policy must meet the following criteria:
--
-- -   If you don\'t set @BypassPolicyLockoutSafetyCheck@ to true, the key
--     policy must allow the principal that is making the @PutKeyPolicy@
--     request to make a subsequent @PutKeyPolicy@ request on the KMS key.
--     This reduces the risk that the KMS key becomes unmanageable. For
--     more information, refer to the scenario in the
--     <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam Default Key Policy>
--     section of the /Key Management Service Developer Guide/.
--
-- -   Each statement in the key policy must contain one or more
--     principals. The principals in the key policy must exist and be
--     visible to KMS. When you create a new Amazon Web Services principal
--     (for example, an IAM user or role), you might need to enforce a
--     delay before including the new principal in a key policy because the
--     new principal might not be immediately visible to KMS. For more
--     information, see
--     <https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency Changes that I make are not always immediately visible>
--     in the /Amazon Web Services Identity and Access Management User
--     Guide/.
--
-- A key policy document can include only the following characters:
--
-- -   Printable ASCII characters from the space character (@\\u0020@)
--     through the end of the ASCII character range.
--
-- -   Printable characters in the Basic Latin and Latin-1 Supplement
--     character set (through @\\u00FF@).
--
-- -   The tab (@\\u0009@), line feed (@\\u000A@), and carriage return
--     (@\\u000D@) special characters
--
-- For information about key policies, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html Key policies in KMS>
-- in the /Key Management Service Developer Guide/.For help writing and
-- formatting a JSON policy document, see the
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html IAM JSON Policy Reference>
-- in the //Identity and Access Management User Guide// .
newPutKeyPolicy ::
  -- | 'keyId'
  Prelude.Text ->
  -- | 'policyName'
  Prelude.Text ->
  -- | 'policy'
  Prelude.Text ->
  PutKeyPolicy
newPutKeyPolicy :: Text -> Text -> Text -> PutKeyPolicy
newPutKeyPolicy Text
pKeyId_ Text
pPolicyName_ Text
pPolicy_ =
  PutKeyPolicy'
    { $sel:bypassPolicyLockoutSafetyCheck:PutKeyPolicy' :: Maybe Bool
bypassPolicyLockoutSafetyCheck =
        forall a. Maybe a
Prelude.Nothing,
      $sel:keyId:PutKeyPolicy' :: Text
keyId = Text
pKeyId_,
      $sel:policyName:PutKeyPolicy' :: Text
policyName = Text
pPolicyName_,
      $sel:policy:PutKeyPolicy' :: Text
policy = Text
pPolicy_
    }

-- | A flag to indicate whether to bypass the key policy lockout safety
-- check.
--
-- Setting this value to true increases the risk that the KMS key becomes
-- unmanageable. Do not set this value to true indiscriminately.
--
-- For more information, refer to the scenario in the
-- <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam Default Key Policy>
-- section in the /Key Management Service Developer Guide/.
--
-- Use this parameter only when you intend to prevent the principal that is
-- making the request from making a subsequent @PutKeyPolicy@ request on
-- the KMS key.
--
-- The default value is false.
putKeyPolicy_bypassPolicyLockoutSafetyCheck :: Lens.Lens' PutKeyPolicy (Prelude.Maybe Prelude.Bool)
putKeyPolicy_bypassPolicyLockoutSafetyCheck :: Lens' PutKeyPolicy (Maybe Bool)
putKeyPolicy_bypassPolicyLockoutSafetyCheck = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutKeyPolicy' {Maybe Bool
bypassPolicyLockoutSafetyCheck :: Maybe Bool
$sel:bypassPolicyLockoutSafetyCheck:PutKeyPolicy' :: PutKeyPolicy -> Maybe Bool
bypassPolicyLockoutSafetyCheck} -> Maybe Bool
bypassPolicyLockoutSafetyCheck) (\s :: PutKeyPolicy
s@PutKeyPolicy' {} Maybe Bool
a -> PutKeyPolicy
s {$sel:bypassPolicyLockoutSafetyCheck:PutKeyPolicy' :: Maybe Bool
bypassPolicyLockoutSafetyCheck = Maybe Bool
a} :: PutKeyPolicy)

-- | Sets the key policy on the specified KMS key.
--
-- Specify the key ID or key ARN of the KMS key.
--
-- For example:
--
-- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Key ARN:
--     @arn:aws:kms:us-east-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- To get the key ID and key ARN for a KMS key, use ListKeys or
-- DescribeKey.
putKeyPolicy_keyId :: Lens.Lens' PutKeyPolicy Prelude.Text
putKeyPolicy_keyId :: Lens' PutKeyPolicy Text
putKeyPolicy_keyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutKeyPolicy' {Text
keyId :: Text
$sel:keyId:PutKeyPolicy' :: PutKeyPolicy -> Text
keyId} -> Text
keyId) (\s :: PutKeyPolicy
s@PutKeyPolicy' {} Text
a -> PutKeyPolicy
s {$sel:keyId:PutKeyPolicy' :: Text
keyId = Text
a} :: PutKeyPolicy)

-- | The name of the key policy. The only valid value is @default@.
putKeyPolicy_policyName :: Lens.Lens' PutKeyPolicy Prelude.Text
putKeyPolicy_policyName :: Lens' PutKeyPolicy Text
putKeyPolicy_policyName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutKeyPolicy' {Text
policyName :: Text
$sel:policyName:PutKeyPolicy' :: PutKeyPolicy -> Text
policyName} -> Text
policyName) (\s :: PutKeyPolicy
s@PutKeyPolicy' {} Text
a -> PutKeyPolicy
s {$sel:policyName:PutKeyPolicy' :: Text
policyName = Text
a} :: PutKeyPolicy)

-- | The key policy to attach to the KMS key.
--
-- The key policy must meet the following criteria:
--
-- -   If you don\'t set @BypassPolicyLockoutSafetyCheck@ to true, the key
--     policy must allow the principal that is making the @PutKeyPolicy@
--     request to make a subsequent @PutKeyPolicy@ request on the KMS key.
--     This reduces the risk that the KMS key becomes unmanageable. For
--     more information, refer to the scenario in the
--     <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default-allow-root-enable-iam Default Key Policy>
--     section of the /Key Management Service Developer Guide/.
--
-- -   Each statement in the key policy must contain one or more
--     principals. The principals in the key policy must exist and be
--     visible to KMS. When you create a new Amazon Web Services principal
--     (for example, an IAM user or role), you might need to enforce a
--     delay before including the new principal in a key policy because the
--     new principal might not be immediately visible to KMS. For more
--     information, see
--     <https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency Changes that I make are not always immediately visible>
--     in the /Amazon Web Services Identity and Access Management User
--     Guide/.
--
-- A key policy document can include only the following characters:
--
-- -   Printable ASCII characters from the space character (@\\u0020@)
--     through the end of the ASCII character range.
--
-- -   Printable characters in the Basic Latin and Latin-1 Supplement
--     character set (through @\\u00FF@).
--
-- -   The tab (@\\u0009@), line feed (@\\u000A@), and carriage return
--     (@\\u000D@) special characters
--
-- For information about key policies, see
-- <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html Key policies in KMS>
-- in the /Key Management Service Developer Guide/.For help writing and
-- formatting a JSON policy document, see the
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html IAM JSON Policy Reference>
-- in the //Identity and Access Management User Guide// .
putKeyPolicy_policy :: Lens.Lens' PutKeyPolicy Prelude.Text
putKeyPolicy_policy :: Lens' PutKeyPolicy Text
putKeyPolicy_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutKeyPolicy' {Text
policy :: Text
$sel:policy:PutKeyPolicy' :: PutKeyPolicy -> Text
policy} -> Text
policy) (\s :: PutKeyPolicy
s@PutKeyPolicy' {} Text
a -> PutKeyPolicy
s {$sel:policy:PutKeyPolicy' :: Text
policy = Text
a} :: PutKeyPolicy)

instance Core.AWSRequest PutKeyPolicy where
  type AWSResponse PutKeyPolicy = PutKeyPolicyResponse
  request :: (Service -> Service) -> PutKeyPolicy -> Request PutKeyPolicy
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 PutKeyPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutKeyPolicy)))
response = forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull PutKeyPolicyResponse
PutKeyPolicyResponse'

instance Prelude.Hashable PutKeyPolicy where
  hashWithSalt :: Int -> PutKeyPolicy -> Int
hashWithSalt Int
_salt PutKeyPolicy' {Maybe Bool
Text
policy :: Text
policyName :: Text
keyId :: Text
bypassPolicyLockoutSafetyCheck :: Maybe Bool
$sel:policy:PutKeyPolicy' :: PutKeyPolicy -> Text
$sel:policyName:PutKeyPolicy' :: PutKeyPolicy -> Text
$sel:keyId:PutKeyPolicy' :: PutKeyPolicy -> Text
$sel:bypassPolicyLockoutSafetyCheck:PutKeyPolicy' :: PutKeyPolicy -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
bypassPolicyLockoutSafetyCheck
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
keyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policyName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policy

instance Prelude.NFData PutKeyPolicy where
  rnf :: PutKeyPolicy -> ()
rnf PutKeyPolicy' {Maybe Bool
Text
policy :: Text
policyName :: Text
keyId :: Text
bypassPolicyLockoutSafetyCheck :: Maybe Bool
$sel:policy:PutKeyPolicy' :: PutKeyPolicy -> Text
$sel:policyName:PutKeyPolicy' :: PutKeyPolicy -> Text
$sel:keyId:PutKeyPolicy' :: PutKeyPolicy -> Text
$sel:bypassPolicyLockoutSafetyCheck:PutKeyPolicy' :: PutKeyPolicy -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
bypassPolicyLockoutSafetyCheck
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
keyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policyName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policy

instance Data.ToHeaders PutKeyPolicy where
  toHeaders :: PutKeyPolicy -> [Header]
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 -> [Header]
Data.=# (ByteString
"TrentService.PutKeyPolicy" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON PutKeyPolicy where
  toJSON :: PutKeyPolicy -> Value
toJSON PutKeyPolicy' {Maybe Bool
Text
policy :: Text
policyName :: Text
keyId :: Text
bypassPolicyLockoutSafetyCheck :: Maybe Bool
$sel:policy:PutKeyPolicy' :: PutKeyPolicy -> Text
$sel:policyName:PutKeyPolicy' :: PutKeyPolicy -> Text
$sel:keyId:PutKeyPolicy' :: PutKeyPolicy -> Text
$sel:bypassPolicyLockoutSafetyCheck:PutKeyPolicy' :: PutKeyPolicy -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"BypassPolicyLockoutSafetyCheck" 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 Bool
bypassPolicyLockoutSafetyCheck,
            forall a. a -> Maybe a
Prelude.Just (Key
"KeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
keyId),
            forall a. a -> Maybe a
Prelude.Just (Key
"PolicyName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
policyName),
            forall a. a -> Maybe a
Prelude.Just (Key
"Policy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
policy)
          ]
      )

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

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

-- | /See:/ 'newPutKeyPolicyResponse' smart constructor.
data PutKeyPolicyResponse = PutKeyPolicyResponse'
  {
  }
  deriving (PutKeyPolicyResponse -> PutKeyPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutKeyPolicyResponse -> PutKeyPolicyResponse -> Bool
$c/= :: PutKeyPolicyResponse -> PutKeyPolicyResponse -> Bool
== :: PutKeyPolicyResponse -> PutKeyPolicyResponse -> Bool
$c== :: PutKeyPolicyResponse -> PutKeyPolicyResponse -> Bool
Prelude.Eq, ReadPrec [PutKeyPolicyResponse]
ReadPrec PutKeyPolicyResponse
Int -> ReadS PutKeyPolicyResponse
ReadS [PutKeyPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutKeyPolicyResponse]
$creadListPrec :: ReadPrec [PutKeyPolicyResponse]
readPrec :: ReadPrec PutKeyPolicyResponse
$creadPrec :: ReadPrec PutKeyPolicyResponse
readList :: ReadS [PutKeyPolicyResponse]
$creadList :: ReadS [PutKeyPolicyResponse]
readsPrec :: Int -> ReadS PutKeyPolicyResponse
$creadsPrec :: Int -> ReadS PutKeyPolicyResponse
Prelude.Read, Int -> PutKeyPolicyResponse -> ShowS
[PutKeyPolicyResponse] -> ShowS
PutKeyPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutKeyPolicyResponse] -> ShowS
$cshowList :: [PutKeyPolicyResponse] -> ShowS
show :: PutKeyPolicyResponse -> String
$cshow :: PutKeyPolicyResponse -> String
showsPrec :: Int -> PutKeyPolicyResponse -> ShowS
$cshowsPrec :: Int -> PutKeyPolicyResponse -> ShowS
Prelude.Show, forall x. Rep PutKeyPolicyResponse x -> PutKeyPolicyResponse
forall x. PutKeyPolicyResponse -> Rep PutKeyPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutKeyPolicyResponse x -> PutKeyPolicyResponse
$cfrom :: forall x. PutKeyPolicyResponse -> Rep PutKeyPolicyResponse x
Prelude.Generic)

-- |
-- Create a value of 'PutKeyPolicyResponse' 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.
newPutKeyPolicyResponse ::
  PutKeyPolicyResponse
newPutKeyPolicyResponse :: PutKeyPolicyResponse
newPutKeyPolicyResponse = PutKeyPolicyResponse
PutKeyPolicyResponse'

instance Prelude.NFData PutKeyPolicyResponse where
  rnf :: PutKeyPolicyResponse -> ()
rnf PutKeyPolicyResponse
_ = ()