{-# 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.ListKeyPolicies
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the names of the key policies that are attached to a KMS key. This
-- operation is designed to get policy names that you can use in a
-- GetKeyPolicy operation. However, the only valid policy name is
-- @default@.
--
-- __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:ListKeyPolicies>
-- (key policy)
--
-- __Related operations:__
--
-- -   GetKeyPolicy
--
-- -   PutKeyPolicy
--
-- This operation returns paginated results.
module Amazonka.KMS.ListKeyPolicies
  ( -- * Creating a Request
    ListKeyPolicies (..),
    newListKeyPolicies,

    -- * Request Lenses
    listKeyPolicies_limit,
    listKeyPolicies_marker,
    listKeyPolicies_keyId,

    -- * Destructuring the Response
    ListKeyPoliciesResponse (..),
    newListKeyPoliciesResponse,

    -- * Response Lenses
    listKeyPoliciesResponse_nextMarker,
    listKeyPoliciesResponse_policyNames,
    listKeyPoliciesResponse_truncated,
    listKeyPoliciesResponse_httpStatus,
  )
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:/ 'newListKeyPolicies' smart constructor.
data ListKeyPolicies = ListKeyPolicies'
  { -- | Use this parameter to specify the maximum number of items to return.
    -- When this value is present, KMS does not return more than the specified
    -- number of items, but it might return fewer.
    --
    -- This value is optional. If you include a value, it must be between 1 and
    -- 1000, inclusive. If you do not include a value, it defaults to 100.
    --
    -- Only one policy can be attached to a key.
    ListKeyPolicies -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | Use this parameter in a subsequent request after you receive a response
    -- with truncated results. Set it to the value of @NextMarker@ from the
    -- truncated response you just received.
    ListKeyPolicies -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | Gets the names of key policies for 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.
    ListKeyPolicies -> Text
keyId :: Prelude.Text
  }
  deriving (ListKeyPolicies -> ListKeyPolicies -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListKeyPolicies -> ListKeyPolicies -> Bool
$c/= :: ListKeyPolicies -> ListKeyPolicies -> Bool
== :: ListKeyPolicies -> ListKeyPolicies -> Bool
$c== :: ListKeyPolicies -> ListKeyPolicies -> Bool
Prelude.Eq, ReadPrec [ListKeyPolicies]
ReadPrec ListKeyPolicies
Int -> ReadS ListKeyPolicies
ReadS [ListKeyPolicies]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListKeyPolicies]
$creadListPrec :: ReadPrec [ListKeyPolicies]
readPrec :: ReadPrec ListKeyPolicies
$creadPrec :: ReadPrec ListKeyPolicies
readList :: ReadS [ListKeyPolicies]
$creadList :: ReadS [ListKeyPolicies]
readsPrec :: Int -> ReadS ListKeyPolicies
$creadsPrec :: Int -> ReadS ListKeyPolicies
Prelude.Read, Int -> ListKeyPolicies -> ShowS
[ListKeyPolicies] -> ShowS
ListKeyPolicies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListKeyPolicies] -> ShowS
$cshowList :: [ListKeyPolicies] -> ShowS
show :: ListKeyPolicies -> String
$cshow :: ListKeyPolicies -> String
showsPrec :: Int -> ListKeyPolicies -> ShowS
$cshowsPrec :: Int -> ListKeyPolicies -> ShowS
Prelude.Show, forall x. Rep ListKeyPolicies x -> ListKeyPolicies
forall x. ListKeyPolicies -> Rep ListKeyPolicies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListKeyPolicies x -> ListKeyPolicies
$cfrom :: forall x. ListKeyPolicies -> Rep ListKeyPolicies x
Prelude.Generic)

-- |
-- Create a value of 'ListKeyPolicies' 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:
--
-- 'limit', 'listKeyPolicies_limit' - Use this parameter to specify the maximum number of items to return.
-- When this value is present, KMS does not return more than the specified
-- number of items, but it might return fewer.
--
-- This value is optional. If you include a value, it must be between 1 and
-- 1000, inclusive. If you do not include a value, it defaults to 100.
--
-- Only one policy can be attached to a key.
--
-- 'marker', 'listKeyPolicies_marker' - Use this parameter in a subsequent request after you receive a response
-- with truncated results. Set it to the value of @NextMarker@ from the
-- truncated response you just received.
--
-- 'keyId', 'listKeyPolicies_keyId' - Gets the names of key policies for 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.
newListKeyPolicies ::
  -- | 'keyId'
  Prelude.Text ->
  ListKeyPolicies
newListKeyPolicies :: Text -> ListKeyPolicies
newListKeyPolicies Text
pKeyId_ =
  ListKeyPolicies'
    { $sel:limit:ListKeyPolicies' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListKeyPolicies' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:keyId:ListKeyPolicies' :: Text
keyId = Text
pKeyId_
    }

-- | Use this parameter to specify the maximum number of items to return.
-- When this value is present, KMS does not return more than the specified
-- number of items, but it might return fewer.
--
-- This value is optional. If you include a value, it must be between 1 and
-- 1000, inclusive. If you do not include a value, it defaults to 100.
--
-- Only one policy can be attached to a key.
listKeyPolicies_limit :: Lens.Lens' ListKeyPolicies (Prelude.Maybe Prelude.Natural)
listKeyPolicies_limit :: Lens' ListKeyPolicies (Maybe Natural)
listKeyPolicies_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyPolicies' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListKeyPolicies' :: ListKeyPolicies -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListKeyPolicies
s@ListKeyPolicies' {} Maybe Natural
a -> ListKeyPolicies
s {$sel:limit:ListKeyPolicies' :: Maybe Natural
limit = Maybe Natural
a} :: ListKeyPolicies)

-- | Use this parameter in a subsequent request after you receive a response
-- with truncated results. Set it to the value of @NextMarker@ from the
-- truncated response you just received.
listKeyPolicies_marker :: Lens.Lens' ListKeyPolicies (Prelude.Maybe Prelude.Text)
listKeyPolicies_marker :: Lens' ListKeyPolicies (Maybe Text)
listKeyPolicies_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyPolicies' {Maybe Text
marker :: Maybe Text
$sel:marker:ListKeyPolicies' :: ListKeyPolicies -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListKeyPolicies
s@ListKeyPolicies' {} Maybe Text
a -> ListKeyPolicies
s {$sel:marker:ListKeyPolicies' :: Maybe Text
marker = Maybe Text
a} :: ListKeyPolicies)

-- | Gets the names of key policies for 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.
listKeyPolicies_keyId :: Lens.Lens' ListKeyPolicies Prelude.Text
listKeyPolicies_keyId :: Lens' ListKeyPolicies Text
listKeyPolicies_keyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyPolicies' {Text
keyId :: Text
$sel:keyId:ListKeyPolicies' :: ListKeyPolicies -> Text
keyId} -> Text
keyId) (\s :: ListKeyPolicies
s@ListKeyPolicies' {} Text
a -> ListKeyPolicies
s {$sel:keyId:ListKeyPolicies' :: Text
keyId = Text
a} :: ListKeyPolicies)

instance Core.AWSPager ListKeyPolicies where
  page :: ListKeyPolicies
-> AWSResponse ListKeyPolicies -> Maybe ListKeyPolicies
page ListKeyPolicies
rq AWSResponse ListKeyPolicies
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListKeyPolicies
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListKeyPoliciesResponse (Maybe Bool)
listKeyPoliciesResponse_truncated
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListKeyPolicies
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListKeyPoliciesResponse (Maybe Text)
listKeyPoliciesResponse_nextMarker
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListKeyPolicies
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListKeyPolicies (Maybe Text)
listKeyPolicies_marker
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListKeyPolicies
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListKeyPoliciesResponse (Maybe Text)
listKeyPoliciesResponse_nextMarker
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListKeyPolicies where
  type
    AWSResponse ListKeyPolicies =
      ListKeyPoliciesResponse
  request :: (Service -> Service) -> ListKeyPolicies -> Request ListKeyPolicies
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 ListKeyPolicies
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListKeyPolicies)))
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
-> Maybe [Text] -> Maybe Bool -> Int -> ListKeyPoliciesResponse
ListKeyPoliciesResponse'
            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
"NextMarker")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PolicyNames" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Truncated")
            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 ListKeyPolicies where
  hashWithSalt :: Int -> ListKeyPolicies -> Int
hashWithSalt Int
_salt ListKeyPolicies' {Maybe Natural
Maybe Text
Text
keyId :: Text
marker :: Maybe Text
limit :: Maybe Natural
$sel:keyId:ListKeyPolicies' :: ListKeyPolicies -> Text
$sel:marker:ListKeyPolicies' :: ListKeyPolicies -> Maybe Text
$sel:limit:ListKeyPolicies' :: ListKeyPolicies -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
keyId

instance Prelude.NFData ListKeyPolicies where
  rnf :: ListKeyPolicies -> ()
rnf ListKeyPolicies' {Maybe Natural
Maybe Text
Text
keyId :: Text
marker :: Maybe Text
limit :: Maybe Natural
$sel:keyId:ListKeyPolicies' :: ListKeyPolicies -> Text
$sel:marker:ListKeyPolicies' :: ListKeyPolicies -> Maybe Text
$sel:limit:ListKeyPolicies' :: ListKeyPolicies -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
keyId

instance Data.ToHeaders ListKeyPolicies where
  toHeaders :: ListKeyPolicies -> 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
"TrentService.ListKeyPolicies" ::
                          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 ListKeyPolicies where
  toJSON :: ListKeyPolicies -> Value
toJSON ListKeyPolicies' {Maybe Natural
Maybe Text
Text
keyId :: Text
marker :: Maybe Text
limit :: Maybe Natural
$sel:keyId:ListKeyPolicies' :: ListKeyPolicies -> Text
$sel:marker:ListKeyPolicies' :: ListKeyPolicies -> Maybe Text
$sel:limit:ListKeyPolicies' :: ListKeyPolicies -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Limit" 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 Natural
limit,
            (Key
"Marker" 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
marker,
            forall a. a -> Maybe a
Prelude.Just (Key
"KeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
keyId)
          ]
      )

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

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

-- | /See:/ 'newListKeyPoliciesResponse' smart constructor.
data ListKeyPoliciesResponse = ListKeyPoliciesResponse'
  { -- | When @Truncated@ is true, this element is present and contains the value
    -- to use for the @Marker@ parameter in a subsequent request.
    ListKeyPoliciesResponse -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | A list of key policy names. The only valid value is @default@.
    ListKeyPoliciesResponse -> Maybe [Text]
policyNames :: Prelude.Maybe [Prelude.Text],
    -- | A flag that indicates whether there are more items in the list. When
    -- this value is true, the list in this response is truncated. To get more
    -- items, pass the value of the @NextMarker@ element in thisresponse to the
    -- @Marker@ parameter in a subsequent request.
    ListKeyPoliciesResponse -> Maybe Bool
truncated :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    ListKeyPoliciesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListKeyPoliciesResponse -> ListKeyPoliciesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListKeyPoliciesResponse -> ListKeyPoliciesResponse -> Bool
$c/= :: ListKeyPoliciesResponse -> ListKeyPoliciesResponse -> Bool
== :: ListKeyPoliciesResponse -> ListKeyPoliciesResponse -> Bool
$c== :: ListKeyPoliciesResponse -> ListKeyPoliciesResponse -> Bool
Prelude.Eq, ReadPrec [ListKeyPoliciesResponse]
ReadPrec ListKeyPoliciesResponse
Int -> ReadS ListKeyPoliciesResponse
ReadS [ListKeyPoliciesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListKeyPoliciesResponse]
$creadListPrec :: ReadPrec [ListKeyPoliciesResponse]
readPrec :: ReadPrec ListKeyPoliciesResponse
$creadPrec :: ReadPrec ListKeyPoliciesResponse
readList :: ReadS [ListKeyPoliciesResponse]
$creadList :: ReadS [ListKeyPoliciesResponse]
readsPrec :: Int -> ReadS ListKeyPoliciesResponse
$creadsPrec :: Int -> ReadS ListKeyPoliciesResponse
Prelude.Read, Int -> ListKeyPoliciesResponse -> ShowS
[ListKeyPoliciesResponse] -> ShowS
ListKeyPoliciesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListKeyPoliciesResponse] -> ShowS
$cshowList :: [ListKeyPoliciesResponse] -> ShowS
show :: ListKeyPoliciesResponse -> String
$cshow :: ListKeyPoliciesResponse -> String
showsPrec :: Int -> ListKeyPoliciesResponse -> ShowS
$cshowsPrec :: Int -> ListKeyPoliciesResponse -> ShowS
Prelude.Show, forall x. Rep ListKeyPoliciesResponse x -> ListKeyPoliciesResponse
forall x. ListKeyPoliciesResponse -> Rep ListKeyPoliciesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListKeyPoliciesResponse x -> ListKeyPoliciesResponse
$cfrom :: forall x. ListKeyPoliciesResponse -> Rep ListKeyPoliciesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListKeyPoliciesResponse' 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:
--
-- 'nextMarker', 'listKeyPoliciesResponse_nextMarker' - When @Truncated@ is true, this element is present and contains the value
-- to use for the @Marker@ parameter in a subsequent request.
--
-- 'policyNames', 'listKeyPoliciesResponse_policyNames' - A list of key policy names. The only valid value is @default@.
--
-- 'truncated', 'listKeyPoliciesResponse_truncated' - A flag that indicates whether there are more items in the list. When
-- this value is true, the list in this response is truncated. To get more
-- items, pass the value of the @NextMarker@ element in thisresponse to the
-- @Marker@ parameter in a subsequent request.
--
-- 'httpStatus', 'listKeyPoliciesResponse_httpStatus' - The response's http status code.
newListKeyPoliciesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListKeyPoliciesResponse
newListKeyPoliciesResponse :: Int -> ListKeyPoliciesResponse
newListKeyPoliciesResponse Int
pHttpStatus_ =
  ListKeyPoliciesResponse'
    { $sel:nextMarker:ListKeyPoliciesResponse' :: Maybe Text
nextMarker =
        forall a. Maybe a
Prelude.Nothing,
      $sel:policyNames:ListKeyPoliciesResponse' :: Maybe [Text]
policyNames = forall a. Maybe a
Prelude.Nothing,
      $sel:truncated:ListKeyPoliciesResponse' :: Maybe Bool
truncated = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListKeyPoliciesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | When @Truncated@ is true, this element is present and contains the value
-- to use for the @Marker@ parameter in a subsequent request.
listKeyPoliciesResponse_nextMarker :: Lens.Lens' ListKeyPoliciesResponse (Prelude.Maybe Prelude.Text)
listKeyPoliciesResponse_nextMarker :: Lens' ListKeyPoliciesResponse (Maybe Text)
listKeyPoliciesResponse_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyPoliciesResponse' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListKeyPoliciesResponse' :: ListKeyPoliciesResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListKeyPoliciesResponse
s@ListKeyPoliciesResponse' {} Maybe Text
a -> ListKeyPoliciesResponse
s {$sel:nextMarker:ListKeyPoliciesResponse' :: Maybe Text
nextMarker = Maybe Text
a} :: ListKeyPoliciesResponse)

-- | A list of key policy names. The only valid value is @default@.
listKeyPoliciesResponse_policyNames :: Lens.Lens' ListKeyPoliciesResponse (Prelude.Maybe [Prelude.Text])
listKeyPoliciesResponse_policyNames :: Lens' ListKeyPoliciesResponse (Maybe [Text])
listKeyPoliciesResponse_policyNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyPoliciesResponse' {Maybe [Text]
policyNames :: Maybe [Text]
$sel:policyNames:ListKeyPoliciesResponse' :: ListKeyPoliciesResponse -> Maybe [Text]
policyNames} -> Maybe [Text]
policyNames) (\s :: ListKeyPoliciesResponse
s@ListKeyPoliciesResponse' {} Maybe [Text]
a -> ListKeyPoliciesResponse
s {$sel:policyNames:ListKeyPoliciesResponse' :: Maybe [Text]
policyNames = Maybe [Text]
a} :: ListKeyPoliciesResponse) 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 flag that indicates whether there are more items in the list. When
-- this value is true, the list in this response is truncated. To get more
-- items, pass the value of the @NextMarker@ element in thisresponse to the
-- @Marker@ parameter in a subsequent request.
listKeyPoliciesResponse_truncated :: Lens.Lens' ListKeyPoliciesResponse (Prelude.Maybe Prelude.Bool)
listKeyPoliciesResponse_truncated :: Lens' ListKeyPoliciesResponse (Maybe Bool)
listKeyPoliciesResponse_truncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyPoliciesResponse' {Maybe Bool
truncated :: Maybe Bool
$sel:truncated:ListKeyPoliciesResponse' :: ListKeyPoliciesResponse -> Maybe Bool
truncated} -> Maybe Bool
truncated) (\s :: ListKeyPoliciesResponse
s@ListKeyPoliciesResponse' {} Maybe Bool
a -> ListKeyPoliciesResponse
s {$sel:truncated:ListKeyPoliciesResponse' :: Maybe Bool
truncated = Maybe Bool
a} :: ListKeyPoliciesResponse)

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

instance Prelude.NFData ListKeyPoliciesResponse where
  rnf :: ListKeyPoliciesResponse -> ()
rnf ListKeyPoliciesResponse' {Int
Maybe Bool
Maybe [Text]
Maybe Text
httpStatus :: Int
truncated :: Maybe Bool
policyNames :: Maybe [Text]
nextMarker :: Maybe Text
$sel:httpStatus:ListKeyPoliciesResponse' :: ListKeyPoliciesResponse -> Int
$sel:truncated:ListKeyPoliciesResponse' :: ListKeyPoliciesResponse -> Maybe Bool
$sel:policyNames:ListKeyPoliciesResponse' :: ListKeyPoliciesResponse -> Maybe [Text]
$sel:nextMarker:ListKeyPoliciesResponse' :: ListKeyPoliciesResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextMarker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
policyNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
truncated
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus