{-# 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.CertificateManagerPCA.ListPermissions
-- 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)
--
-- List all permissions on a private CA, if any, granted to the AWS
-- Certificate Manager (ACM) service principal (acm.amazonaws.com).
--
-- These permissions allow ACM to issue and renew ACM certificates that
-- reside in the same AWS account as the CA.
--
-- Permissions can be granted with the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CreatePermission.html CreatePermission>
-- action and revoked with the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_DeletePermission.html DeletePermission>
-- action.
--
-- __About Permissions__
--
-- -   If the private CA and the certificates it issues reside in the same
--     account, you can use @CreatePermission@ to grant permissions for ACM
--     to carry out automatic certificate renewals.
--
-- -   For automatic certificate renewal to succeed, the ACM service
--     principal needs permissions to create, retrieve, and list
--     certificates.
--
-- -   If the private CA and the ACM certificates reside in different
--     accounts, then permissions cannot be used to enable automatic
--     renewals. Instead, the ACM certificate owner must set up a
--     resource-based policy to enable cross-account issuance and renewals.
--     For more information, see
--     <https://docs.aws.amazon.com/acm-pca/latest/userguide/pca-rbp.html Using a Resource Based Policy with ACM Private CA>.
--
-- This operation returns paginated results.
module Amazonka.CertificateManagerPCA.ListPermissions
  ( -- * Creating a Request
    ListPermissions (..),
    newListPermissions,

    -- * Request Lenses
    listPermissions_nextToken,
    listPermissions_maxResults,
    listPermissions_certificateAuthorityArn,

    -- * Destructuring the Response
    ListPermissionsResponse (..),
    newListPermissionsResponse,

    -- * Response Lenses
    listPermissionsResponse_nextToken,
    listPermissionsResponse_permissions,
    listPermissionsResponse_httpStatus,
  )
where

import Amazonka.CertificateManagerPCA.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:/ 'newListPermissions' smart constructor.
data ListPermissions = ListPermissions'
  { -- | When paginating results, use this parameter in a subsequent request
    -- after you receive a response with truncated results. Set it to the value
    -- of __NextToken__ from the response you just received.
    ListPermissions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | When paginating results, use this parameter to specify the maximum
    -- number of items to return in the response. If additional items exist
    -- beyond the number you specify, the __NextToken__ element is sent in the
    -- response. Use this __NextToken__ value in a subsequent request to
    -- retrieve additional items.
    ListPermissions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Number (ARN) of the private CA to inspect. You can
    -- find the ARN by calling the
    -- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_ListCertificateAuthorities.html ListCertificateAuthorities>
    -- action. This must be of the form:
    -- @arn:aws:acm-pca:region:account:certificate-authority\/12345678-1234-1234-1234-123456789012@
    -- You can get a private CA\'s ARN by running the
    -- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_ListCertificateAuthorities.html ListCertificateAuthorities>
    -- action.
    ListPermissions -> Text
certificateAuthorityArn :: Prelude.Text
  }
  deriving (ListPermissions -> ListPermissions -> Bool
(ListPermissions -> ListPermissions -> Bool)
-> (ListPermissions -> ListPermissions -> Bool)
-> Eq ListPermissions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPermissions -> ListPermissions -> Bool
$c/= :: ListPermissions -> ListPermissions -> Bool
== :: ListPermissions -> ListPermissions -> Bool
$c== :: ListPermissions -> ListPermissions -> Bool
Prelude.Eq, ReadPrec [ListPermissions]
ReadPrec ListPermissions
Int -> ReadS ListPermissions
ReadS [ListPermissions]
(Int -> ReadS ListPermissions)
-> ReadS [ListPermissions]
-> ReadPrec ListPermissions
-> ReadPrec [ListPermissions]
-> Read ListPermissions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPermissions]
$creadListPrec :: ReadPrec [ListPermissions]
readPrec :: ReadPrec ListPermissions
$creadPrec :: ReadPrec ListPermissions
readList :: ReadS [ListPermissions]
$creadList :: ReadS [ListPermissions]
readsPrec :: Int -> ReadS ListPermissions
$creadsPrec :: Int -> ReadS ListPermissions
Prelude.Read, Int -> ListPermissions -> ShowS
[ListPermissions] -> ShowS
ListPermissions -> String
(Int -> ListPermissions -> ShowS)
-> (ListPermissions -> String)
-> ([ListPermissions] -> ShowS)
-> Show ListPermissions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPermissions] -> ShowS
$cshowList :: [ListPermissions] -> ShowS
show :: ListPermissions -> String
$cshow :: ListPermissions -> String
showsPrec :: Int -> ListPermissions -> ShowS
$cshowsPrec :: Int -> ListPermissions -> ShowS
Prelude.Show, (forall x. ListPermissions -> Rep ListPermissions x)
-> (forall x. Rep ListPermissions x -> ListPermissions)
-> Generic ListPermissions
forall x. Rep ListPermissions x -> ListPermissions
forall x. ListPermissions -> Rep ListPermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPermissions x -> ListPermissions
$cfrom :: forall x. ListPermissions -> Rep ListPermissions x
Prelude.Generic)

-- |
-- Create a value of 'ListPermissions' 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:
--
-- 'nextToken', 'listPermissions_nextToken' - When paginating results, use this parameter in a subsequent request
-- after you receive a response with truncated results. Set it to the value
-- of __NextToken__ from the response you just received.
--
-- 'maxResults', 'listPermissions_maxResults' - When paginating results, use this parameter to specify the maximum
-- number of items to return in the response. If additional items exist
-- beyond the number you specify, the __NextToken__ element is sent in the
-- response. Use this __NextToken__ value in a subsequent request to
-- retrieve additional items.
--
-- 'certificateAuthorityArn', 'listPermissions_certificateAuthorityArn' - The Amazon Resource Number (ARN) of the private CA to inspect. You can
-- find the ARN by calling the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_ListCertificateAuthorities.html ListCertificateAuthorities>
-- action. This must be of the form:
-- @arn:aws:acm-pca:region:account:certificate-authority\/12345678-1234-1234-1234-123456789012@
-- You can get a private CA\'s ARN by running the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_ListCertificateAuthorities.html ListCertificateAuthorities>
-- action.
newListPermissions ::
  -- | 'certificateAuthorityArn'
  Prelude.Text ->
  ListPermissions
newListPermissions :: Text -> ListPermissions
newListPermissions Text
pCertificateAuthorityArn_ =
  ListPermissions' :: Maybe Text -> Maybe Natural -> Text -> ListPermissions
ListPermissions'
    { $sel:nextToken:ListPermissions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListPermissions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:certificateAuthorityArn:ListPermissions' :: Text
certificateAuthorityArn = Text
pCertificateAuthorityArn_
    }

-- | When paginating results, use this parameter in a subsequent request
-- after you receive a response with truncated results. Set it to the value
-- of __NextToken__ from the response you just received.
listPermissions_nextToken :: Lens.Lens' ListPermissions (Prelude.Maybe Prelude.Text)
listPermissions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPermissions -> f ListPermissions
listPermissions_nextToken = (ListPermissions -> Maybe Text)
-> (ListPermissions -> Maybe Text -> ListPermissions)
-> Lens ListPermissions ListPermissions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPermissions' :: ListPermissions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPermissions
s@ListPermissions' {} Maybe Text
a -> ListPermissions
s {$sel:nextToken:ListPermissions' :: Maybe Text
nextToken = Maybe Text
a} :: ListPermissions)

-- | When paginating results, use this parameter to specify the maximum
-- number of items to return in the response. If additional items exist
-- beyond the number you specify, the __NextToken__ element is sent in the
-- response. Use this __NextToken__ value in a subsequent request to
-- retrieve additional items.
listPermissions_maxResults :: Lens.Lens' ListPermissions (Prelude.Maybe Prelude.Natural)
listPermissions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListPermissions -> f ListPermissions
listPermissions_maxResults = (ListPermissions -> Maybe Natural)
-> (ListPermissions -> Maybe Natural -> ListPermissions)
-> Lens
     ListPermissions ListPermissions (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPermissions' :: ListPermissions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPermissions
s@ListPermissions' {} Maybe Natural
a -> ListPermissions
s {$sel:maxResults:ListPermissions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPermissions)

-- | The Amazon Resource Number (ARN) of the private CA to inspect. You can
-- find the ARN by calling the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_ListCertificateAuthorities.html ListCertificateAuthorities>
-- action. This must be of the form:
-- @arn:aws:acm-pca:region:account:certificate-authority\/12345678-1234-1234-1234-123456789012@
-- You can get a private CA\'s ARN by running the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_ListCertificateAuthorities.html ListCertificateAuthorities>
-- action.
listPermissions_certificateAuthorityArn :: Lens.Lens' ListPermissions Prelude.Text
listPermissions_certificateAuthorityArn :: (Text -> f Text) -> ListPermissions -> f ListPermissions
listPermissions_certificateAuthorityArn = (ListPermissions -> Text)
-> (ListPermissions -> Text -> ListPermissions)
-> Lens ListPermissions ListPermissions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissions' {Text
certificateAuthorityArn :: Text
$sel:certificateAuthorityArn:ListPermissions' :: ListPermissions -> Text
certificateAuthorityArn} -> Text
certificateAuthorityArn) (\s :: ListPermissions
s@ListPermissions' {} Text
a -> ListPermissions
s {$sel:certificateAuthorityArn:ListPermissions' :: Text
certificateAuthorityArn = Text
a} :: ListPermissions)

instance Core.AWSPager ListPermissions where
  page :: ListPermissions
-> AWSResponse ListPermissions -> Maybe ListPermissions
page ListPermissions
rq AWSResponse ListPermissions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPermissions
ListPermissionsResponse
rs
            ListPermissionsResponse
-> Getting (First Text) ListPermissionsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPermissionsResponse
-> Const (First Text) ListPermissionsResponse
Lens' ListPermissionsResponse (Maybe Text)
listPermissionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListPermissionsResponse
 -> Const (First Text) ListPermissionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPermissionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListPermissions
forall a. Maybe a
Prelude.Nothing
    | Maybe [Permission] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPermissions
ListPermissionsResponse
rs
            ListPermissionsResponse
-> Getting
     (First [Permission]) ListPermissionsResponse [Permission]
-> Maybe [Permission]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Permission]
 -> Const (First [Permission]) (Maybe [Permission]))
-> ListPermissionsResponse
-> Const (First [Permission]) ListPermissionsResponse
Lens' ListPermissionsResponse (Maybe [Permission])
listPermissionsResponse_permissions
              ((Maybe [Permission]
  -> Const (First [Permission]) (Maybe [Permission]))
 -> ListPermissionsResponse
 -> Const (First [Permission]) ListPermissionsResponse)
-> (([Permission] -> Const (First [Permission]) [Permission])
    -> Maybe [Permission]
    -> Const (First [Permission]) (Maybe [Permission]))
-> Getting
     (First [Permission]) ListPermissionsResponse [Permission]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Permission] -> Const (First [Permission]) [Permission])
-> Maybe [Permission]
-> Const (First [Permission]) (Maybe [Permission])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListPermissions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListPermissions -> Maybe ListPermissions
forall a. a -> Maybe a
Prelude.Just (ListPermissions -> Maybe ListPermissions)
-> ListPermissions -> Maybe ListPermissions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListPermissions
rq
          ListPermissions
-> (ListPermissions -> ListPermissions) -> ListPermissions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListPermissions -> Identity ListPermissions
Lens ListPermissions ListPermissions (Maybe Text) (Maybe Text)
listPermissions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListPermissions -> Identity ListPermissions)
-> Maybe Text -> ListPermissions -> ListPermissions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPermissions
ListPermissionsResponse
rs
          ListPermissionsResponse
-> Getting (First Text) ListPermissionsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListPermissionsResponse
-> Const (First Text) ListPermissionsResponse
Lens' ListPermissionsResponse (Maybe Text)
listPermissionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListPermissionsResponse
 -> Const (First Text) ListPermissionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListPermissionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListPermissions where
  type
    AWSResponse ListPermissions =
      ListPermissionsResponse
  request :: ListPermissions -> Request ListPermissions
request = Service -> ListPermissions -> Request ListPermissions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListPermissions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPermissions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListPermissions))
-> Logger
-> Service
-> Proxy ListPermissions
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPermissions)))
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 -> Maybe [Permission] -> Int -> ListPermissionsResponse
ListPermissionsResponse'
            (Maybe Text
 -> Maybe [Permission] -> Int -> ListPermissionsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [Permission] -> Int -> ListPermissionsResponse)
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
"NextToken")
            Either
  String (Maybe [Permission] -> Int -> ListPermissionsResponse)
-> Either String (Maybe [Permission])
-> Either String (Int -> ListPermissionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Permission]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Permissions" Either String (Maybe (Maybe [Permission]))
-> Maybe [Permission] -> Either String (Maybe [Permission])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Permission]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListPermissionsResponse)
-> Either String Int -> Either String ListPermissionsResponse
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 ListPermissions

instance Prelude.NFData ListPermissions

instance Core.ToHeaders ListPermissions where
  toHeaders :: ListPermissions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListPermissions -> 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
"ACMPrivateCA.ListPermissions" ::
                          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 ListPermissions where
  toJSON :: ListPermissions -> Value
toJSON ListPermissions' {Maybe Natural
Maybe Text
Text
certificateAuthorityArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:certificateAuthorityArn:ListPermissions' :: ListPermissions -> Text
$sel:maxResults:ListPermissions' :: ListPermissions -> Maybe Natural
$sel:nextToken:ListPermissions' :: ListPermissions -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" 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
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"CertificateAuthorityArn"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateAuthorityArn
              )
          ]
      )

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

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

-- | /See:/ 'newListPermissionsResponse' smart constructor.
data ListPermissionsResponse = ListPermissionsResponse'
  { -- | When the list is truncated, this value is present and should be used for
    -- the __NextToken__ parameter in a subsequent pagination request.
    ListPermissionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Summary information about each permission assigned by the specified
    -- private CA, including the action enabled, the policy provided, and the
    -- time of creation.
    ListPermissionsResponse -> Maybe [Permission]
permissions :: Prelude.Maybe [Permission],
    -- | The response's http status code.
    ListPermissionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPermissionsResponse -> ListPermissionsResponse -> Bool
(ListPermissionsResponse -> ListPermissionsResponse -> Bool)
-> (ListPermissionsResponse -> ListPermissionsResponse -> Bool)
-> Eq ListPermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
$c/= :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
== :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
$c== :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
Prelude.Eq, ReadPrec [ListPermissionsResponse]
ReadPrec ListPermissionsResponse
Int -> ReadS ListPermissionsResponse
ReadS [ListPermissionsResponse]
(Int -> ReadS ListPermissionsResponse)
-> ReadS [ListPermissionsResponse]
-> ReadPrec ListPermissionsResponse
-> ReadPrec [ListPermissionsResponse]
-> Read ListPermissionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPermissionsResponse]
$creadListPrec :: ReadPrec [ListPermissionsResponse]
readPrec :: ReadPrec ListPermissionsResponse
$creadPrec :: ReadPrec ListPermissionsResponse
readList :: ReadS [ListPermissionsResponse]
$creadList :: ReadS [ListPermissionsResponse]
readsPrec :: Int -> ReadS ListPermissionsResponse
$creadsPrec :: Int -> ReadS ListPermissionsResponse
Prelude.Read, Int -> ListPermissionsResponse -> ShowS
[ListPermissionsResponse] -> ShowS
ListPermissionsResponse -> String
(Int -> ListPermissionsResponse -> ShowS)
-> (ListPermissionsResponse -> String)
-> ([ListPermissionsResponse] -> ShowS)
-> Show ListPermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPermissionsResponse] -> ShowS
$cshowList :: [ListPermissionsResponse] -> ShowS
show :: ListPermissionsResponse -> String
$cshow :: ListPermissionsResponse -> String
showsPrec :: Int -> ListPermissionsResponse -> ShowS
$cshowsPrec :: Int -> ListPermissionsResponse -> ShowS
Prelude.Show, (forall x.
 ListPermissionsResponse -> Rep ListPermissionsResponse x)
-> (forall x.
    Rep ListPermissionsResponse x -> ListPermissionsResponse)
-> Generic ListPermissionsResponse
forall x. Rep ListPermissionsResponse x -> ListPermissionsResponse
forall x. ListPermissionsResponse -> Rep ListPermissionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPermissionsResponse x -> ListPermissionsResponse
$cfrom :: forall x. ListPermissionsResponse -> Rep ListPermissionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPermissionsResponse' 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:
--
-- 'nextToken', 'listPermissionsResponse_nextToken' - When the list is truncated, this value is present and should be used for
-- the __NextToken__ parameter in a subsequent pagination request.
--
-- 'permissions', 'listPermissionsResponse_permissions' - Summary information about each permission assigned by the specified
-- private CA, including the action enabled, the policy provided, and the
-- time of creation.
--
-- 'httpStatus', 'listPermissionsResponse_httpStatus' - The response's http status code.
newListPermissionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPermissionsResponse
newListPermissionsResponse :: Int -> ListPermissionsResponse
newListPermissionsResponse Int
pHttpStatus_ =
  ListPermissionsResponse' :: Maybe Text -> Maybe [Permission] -> Int -> ListPermissionsResponse
ListPermissionsResponse'
    { $sel:nextToken:ListPermissionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:permissions:ListPermissionsResponse' :: Maybe [Permission]
permissions = Maybe [Permission]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPermissionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | When the list is truncated, this value is present and should be used for
-- the __NextToken__ parameter in a subsequent pagination request.
listPermissionsResponse_nextToken :: Lens.Lens' ListPermissionsResponse (Prelude.Maybe Prelude.Text)
listPermissionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPermissionsResponse -> f ListPermissionsResponse
listPermissionsResponse_nextToken = (ListPermissionsResponse -> Maybe Text)
-> (ListPermissionsResponse
    -> Maybe Text -> ListPermissionsResponse)
-> Lens' ListPermissionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPermissionsResponse' :: ListPermissionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPermissionsResponse
s@ListPermissionsResponse' {} Maybe Text
a -> ListPermissionsResponse
s {$sel:nextToken:ListPermissionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPermissionsResponse)

-- | Summary information about each permission assigned by the specified
-- private CA, including the action enabled, the policy provided, and the
-- time of creation.
listPermissionsResponse_permissions :: Lens.Lens' ListPermissionsResponse (Prelude.Maybe [Permission])
listPermissionsResponse_permissions :: (Maybe [Permission] -> f (Maybe [Permission]))
-> ListPermissionsResponse -> f ListPermissionsResponse
listPermissionsResponse_permissions = (ListPermissionsResponse -> Maybe [Permission])
-> (ListPermissionsResponse
    -> Maybe [Permission] -> ListPermissionsResponse)
-> Lens' ListPermissionsResponse (Maybe [Permission])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPermissionsResponse' {Maybe [Permission]
permissions :: Maybe [Permission]
$sel:permissions:ListPermissionsResponse' :: ListPermissionsResponse -> Maybe [Permission]
permissions} -> Maybe [Permission]
permissions) (\s :: ListPermissionsResponse
s@ListPermissionsResponse' {} Maybe [Permission]
a -> ListPermissionsResponse
s {$sel:permissions:ListPermissionsResponse' :: Maybe [Permission]
permissions = Maybe [Permission]
a} :: ListPermissionsResponse) ((Maybe [Permission] -> f (Maybe [Permission]))
 -> ListPermissionsResponse -> f ListPermissionsResponse)
-> ((Maybe [Permission] -> f (Maybe [Permission]))
    -> Maybe [Permission] -> f (Maybe [Permission]))
-> (Maybe [Permission] -> f (Maybe [Permission]))
-> ListPermissionsResponse
-> f ListPermissionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Permission] [Permission] [Permission] [Permission]
-> Iso
     (Maybe [Permission])
     (Maybe [Permission])
     (Maybe [Permission])
     (Maybe [Permission])
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 [Permission] [Permission] [Permission] [Permission]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListPermissionsResponse