{-# 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.ListCertificateAuthorities
-- 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)
--
-- Lists the private certificate authorities that you created by using the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CreateCertificateAuthority.html CreateCertificateAuthority>
-- action.
--
-- This operation returns paginated results.
module Amazonka.CertificateManagerPCA.ListCertificateAuthorities
  ( -- * Creating a Request
    ListCertificateAuthorities (..),
    newListCertificateAuthorities,

    -- * Request Lenses
    listCertificateAuthorities_nextToken,
    listCertificateAuthorities_resourceOwner,
    listCertificateAuthorities_maxResults,

    -- * Destructuring the Response
    ListCertificateAuthoritiesResponse (..),
    newListCertificateAuthoritiesResponse,

    -- * Response Lenses
    listCertificateAuthoritiesResponse_certificateAuthorities,
    listCertificateAuthoritiesResponse_nextToken,
    listCertificateAuthoritiesResponse_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:/ 'newListCertificateAuthorities' smart constructor.
data ListCertificateAuthorities = ListCertificateAuthorities'
  { -- | Use this parameter when paginating results in a subsequent request after
    -- you receive a response with truncated results. Set it to the value of
    -- the @NextToken@ parameter from the response you just received.
    ListCertificateAuthorities -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Use this parameter to filter the returned set of certificate authorities
    -- based on their owner. The default is SELF.
    ListCertificateAuthorities -> Maybe ResourceOwner
resourceOwner :: Prelude.Maybe ResourceOwner,
    -- | Use this parameter when paginating results to specify the maximum number
    -- of items to return in the response on each page. 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.
    ListCertificateAuthorities -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListCertificateAuthorities -> ListCertificateAuthorities -> Bool
(ListCertificateAuthorities -> ListCertificateAuthorities -> Bool)
-> (ListCertificateAuthorities
    -> ListCertificateAuthorities -> Bool)
-> Eq ListCertificateAuthorities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCertificateAuthorities -> ListCertificateAuthorities -> Bool
$c/= :: ListCertificateAuthorities -> ListCertificateAuthorities -> Bool
== :: ListCertificateAuthorities -> ListCertificateAuthorities -> Bool
$c== :: ListCertificateAuthorities -> ListCertificateAuthorities -> Bool
Prelude.Eq, ReadPrec [ListCertificateAuthorities]
ReadPrec ListCertificateAuthorities
Int -> ReadS ListCertificateAuthorities
ReadS [ListCertificateAuthorities]
(Int -> ReadS ListCertificateAuthorities)
-> ReadS [ListCertificateAuthorities]
-> ReadPrec ListCertificateAuthorities
-> ReadPrec [ListCertificateAuthorities]
-> Read ListCertificateAuthorities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCertificateAuthorities]
$creadListPrec :: ReadPrec [ListCertificateAuthorities]
readPrec :: ReadPrec ListCertificateAuthorities
$creadPrec :: ReadPrec ListCertificateAuthorities
readList :: ReadS [ListCertificateAuthorities]
$creadList :: ReadS [ListCertificateAuthorities]
readsPrec :: Int -> ReadS ListCertificateAuthorities
$creadsPrec :: Int -> ReadS ListCertificateAuthorities
Prelude.Read, Int -> ListCertificateAuthorities -> ShowS
[ListCertificateAuthorities] -> ShowS
ListCertificateAuthorities -> String
(Int -> ListCertificateAuthorities -> ShowS)
-> (ListCertificateAuthorities -> String)
-> ([ListCertificateAuthorities] -> ShowS)
-> Show ListCertificateAuthorities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCertificateAuthorities] -> ShowS
$cshowList :: [ListCertificateAuthorities] -> ShowS
show :: ListCertificateAuthorities -> String
$cshow :: ListCertificateAuthorities -> String
showsPrec :: Int -> ListCertificateAuthorities -> ShowS
$cshowsPrec :: Int -> ListCertificateAuthorities -> ShowS
Prelude.Show, (forall x.
 ListCertificateAuthorities -> Rep ListCertificateAuthorities x)
-> (forall x.
    Rep ListCertificateAuthorities x -> ListCertificateAuthorities)
-> Generic ListCertificateAuthorities
forall x.
Rep ListCertificateAuthorities x -> ListCertificateAuthorities
forall x.
ListCertificateAuthorities -> Rep ListCertificateAuthorities x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCertificateAuthorities x -> ListCertificateAuthorities
$cfrom :: forall x.
ListCertificateAuthorities -> Rep ListCertificateAuthorities x
Prelude.Generic)

-- |
-- Create a value of 'ListCertificateAuthorities' 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', 'listCertificateAuthorities_nextToken' - Use this parameter when paginating results in a subsequent request after
-- you receive a response with truncated results. Set it to the value of
-- the @NextToken@ parameter from the response you just received.
--
-- 'resourceOwner', 'listCertificateAuthorities_resourceOwner' - Use this parameter to filter the returned set of certificate authorities
-- based on their owner. The default is SELF.
--
-- 'maxResults', 'listCertificateAuthorities_maxResults' - Use this parameter when paginating results to specify the maximum number
-- of items to return in the response on each page. 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.
newListCertificateAuthorities ::
  ListCertificateAuthorities
newListCertificateAuthorities :: ListCertificateAuthorities
newListCertificateAuthorities =
  ListCertificateAuthorities' :: Maybe Text
-> Maybe ResourceOwner
-> Maybe Natural
-> ListCertificateAuthorities
ListCertificateAuthorities'
    { $sel:nextToken:ListCertificateAuthorities' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceOwner:ListCertificateAuthorities' :: Maybe ResourceOwner
resourceOwner = Maybe ResourceOwner
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListCertificateAuthorities' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Use this parameter to filter the returned set of certificate authorities
-- based on their owner. The default is SELF.
listCertificateAuthorities_resourceOwner :: Lens.Lens' ListCertificateAuthorities (Prelude.Maybe ResourceOwner)
listCertificateAuthorities_resourceOwner :: (Maybe ResourceOwner -> f (Maybe ResourceOwner))
-> ListCertificateAuthorities -> f ListCertificateAuthorities
listCertificateAuthorities_resourceOwner = (ListCertificateAuthorities -> Maybe ResourceOwner)
-> (ListCertificateAuthorities
    -> Maybe ResourceOwner -> ListCertificateAuthorities)
-> Lens
     ListCertificateAuthorities
     ListCertificateAuthorities
     (Maybe ResourceOwner)
     (Maybe ResourceOwner)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCertificateAuthorities' {Maybe ResourceOwner
resourceOwner :: Maybe ResourceOwner
$sel:resourceOwner:ListCertificateAuthorities' :: ListCertificateAuthorities -> Maybe ResourceOwner
resourceOwner} -> Maybe ResourceOwner
resourceOwner) (\s :: ListCertificateAuthorities
s@ListCertificateAuthorities' {} Maybe ResourceOwner
a -> ListCertificateAuthorities
s {$sel:resourceOwner:ListCertificateAuthorities' :: Maybe ResourceOwner
resourceOwner = Maybe ResourceOwner
a} :: ListCertificateAuthorities)

-- | Use this parameter when paginating results to specify the maximum number
-- of items to return in the response on each page. 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.
listCertificateAuthorities_maxResults :: Lens.Lens' ListCertificateAuthorities (Prelude.Maybe Prelude.Natural)
listCertificateAuthorities_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListCertificateAuthorities -> f ListCertificateAuthorities
listCertificateAuthorities_maxResults = (ListCertificateAuthorities -> Maybe Natural)
-> (ListCertificateAuthorities
    -> Maybe Natural -> ListCertificateAuthorities)
-> Lens
     ListCertificateAuthorities
     ListCertificateAuthorities
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCertificateAuthorities' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListCertificateAuthorities' :: ListCertificateAuthorities -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListCertificateAuthorities
s@ListCertificateAuthorities' {} Maybe Natural
a -> ListCertificateAuthorities
s {$sel:maxResults:ListCertificateAuthorities' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListCertificateAuthorities)

instance Core.AWSPager ListCertificateAuthorities where
  page :: ListCertificateAuthorities
-> AWSResponse ListCertificateAuthorities
-> Maybe ListCertificateAuthorities
page ListCertificateAuthorities
rq AWSResponse ListCertificateAuthorities
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListCertificateAuthorities
ListCertificateAuthoritiesResponse
rs
            ListCertificateAuthoritiesResponse
-> Getting (First Text) ListCertificateAuthoritiesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListCertificateAuthoritiesResponse
-> Const (First Text) ListCertificateAuthoritiesResponse
Lens' ListCertificateAuthoritiesResponse (Maybe Text)
listCertificateAuthoritiesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListCertificateAuthoritiesResponse
 -> Const (First Text) ListCertificateAuthoritiesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListCertificateAuthoritiesResponse 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 ListCertificateAuthorities
forall a. Maybe a
Prelude.Nothing
    | Maybe [CertificateAuthority] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListCertificateAuthorities
ListCertificateAuthoritiesResponse
rs
            ListCertificateAuthoritiesResponse
-> Getting
     (First [CertificateAuthority])
     ListCertificateAuthoritiesResponse
     [CertificateAuthority]
-> Maybe [CertificateAuthority]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [CertificateAuthority]
 -> Const
      (First [CertificateAuthority]) (Maybe [CertificateAuthority]))
-> ListCertificateAuthoritiesResponse
-> Const
     (First [CertificateAuthority]) ListCertificateAuthoritiesResponse
Lens'
  ListCertificateAuthoritiesResponse (Maybe [CertificateAuthority])
listCertificateAuthoritiesResponse_certificateAuthorities
              ((Maybe [CertificateAuthority]
  -> Const
       (First [CertificateAuthority]) (Maybe [CertificateAuthority]))
 -> ListCertificateAuthoritiesResponse
 -> Const
      (First [CertificateAuthority]) ListCertificateAuthoritiesResponse)
-> (([CertificateAuthority]
     -> Const (First [CertificateAuthority]) [CertificateAuthority])
    -> Maybe [CertificateAuthority]
    -> Const
         (First [CertificateAuthority]) (Maybe [CertificateAuthority]))
-> Getting
     (First [CertificateAuthority])
     ListCertificateAuthoritiesResponse
     [CertificateAuthority]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([CertificateAuthority]
 -> Const (First [CertificateAuthority]) [CertificateAuthority])
-> Maybe [CertificateAuthority]
-> Const
     (First [CertificateAuthority]) (Maybe [CertificateAuthority])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListCertificateAuthorities
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListCertificateAuthorities -> Maybe ListCertificateAuthorities
forall a. a -> Maybe a
Prelude.Just (ListCertificateAuthorities -> Maybe ListCertificateAuthorities)
-> ListCertificateAuthorities -> Maybe ListCertificateAuthorities
forall a b. (a -> b) -> a -> b
Prelude.$
        ListCertificateAuthorities
rq
          ListCertificateAuthorities
-> (ListCertificateAuthorities -> ListCertificateAuthorities)
-> ListCertificateAuthorities
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListCertificateAuthorities
-> Identity ListCertificateAuthorities
Lens
  ListCertificateAuthorities
  ListCertificateAuthorities
  (Maybe Text)
  (Maybe Text)
listCertificateAuthorities_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListCertificateAuthorities
 -> Identity ListCertificateAuthorities)
-> Maybe Text
-> ListCertificateAuthorities
-> ListCertificateAuthorities
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListCertificateAuthorities
ListCertificateAuthoritiesResponse
rs
          ListCertificateAuthoritiesResponse
-> Getting (First Text) ListCertificateAuthoritiesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListCertificateAuthoritiesResponse
-> Const (First Text) ListCertificateAuthoritiesResponse
Lens' ListCertificateAuthoritiesResponse (Maybe Text)
listCertificateAuthoritiesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListCertificateAuthoritiesResponse
 -> Const (First Text) ListCertificateAuthoritiesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListCertificateAuthoritiesResponse 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 ListCertificateAuthorities where
  type
    AWSResponse ListCertificateAuthorities =
      ListCertificateAuthoritiesResponse
  request :: ListCertificateAuthorities -> Request ListCertificateAuthorities
request = Service
-> ListCertificateAuthorities -> Request ListCertificateAuthorities
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListCertificateAuthorities
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListCertificateAuthorities)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListCertificateAuthorities))
-> Logger
-> Service
-> Proxy ListCertificateAuthorities
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListCertificateAuthorities)))
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 [CertificateAuthority]
-> Maybe Text -> Int -> ListCertificateAuthoritiesResponse
ListCertificateAuthoritiesResponse'
            (Maybe [CertificateAuthority]
 -> Maybe Text -> Int -> ListCertificateAuthoritiesResponse)
-> Either String (Maybe [CertificateAuthority])
-> Either
     String (Maybe Text -> Int -> ListCertificateAuthoritiesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [CertificateAuthority]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CertificateAuthorities"
                            Either String (Maybe (Maybe [CertificateAuthority]))
-> Maybe [CertificateAuthority]
-> Either String (Maybe [CertificateAuthority])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [CertificateAuthority]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Maybe Text -> Int -> ListCertificateAuthoritiesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListCertificateAuthoritiesResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> ListCertificateAuthoritiesResponse)
-> Either String Int
-> Either String ListCertificateAuthoritiesResponse
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 ListCertificateAuthorities

instance Prelude.NFData ListCertificateAuthorities

instance Core.ToHeaders ListCertificateAuthorities where
  toHeaders :: ListCertificateAuthorities -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListCertificateAuthorities -> 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.ListCertificateAuthorities" ::
                          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 ListCertificateAuthorities where
  toJSON :: ListCertificateAuthorities -> Value
toJSON ListCertificateAuthorities' {Maybe Natural
Maybe Text
Maybe ResourceOwner
maxResults :: Maybe Natural
resourceOwner :: Maybe ResourceOwner
nextToken :: Maybe Text
$sel:maxResults:ListCertificateAuthorities' :: ListCertificateAuthorities -> Maybe Natural
$sel:resourceOwner:ListCertificateAuthorities' :: ListCertificateAuthorities -> Maybe ResourceOwner
$sel:nextToken:ListCertificateAuthorities' :: ListCertificateAuthorities -> 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
"ResourceOwner" Text -> ResourceOwner -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ResourceOwner -> Pair) -> Maybe ResourceOwner -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResourceOwner
resourceOwner,
            (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
          ]
      )

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

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

-- | /See:/ 'newListCertificateAuthoritiesResponse' smart constructor.
data ListCertificateAuthoritiesResponse = ListCertificateAuthoritiesResponse'
  { -- | Summary information about each certificate authority you have created.
    ListCertificateAuthoritiesResponse -> Maybe [CertificateAuthority]
certificateAuthorities :: Prelude.Maybe [CertificateAuthority],
    -- | When the list is truncated, this value is present and should be used for
    -- the @NextToken@ parameter in a subsequent pagination request.
    ListCertificateAuthoritiesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListCertificateAuthoritiesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListCertificateAuthoritiesResponse
-> ListCertificateAuthoritiesResponse -> Bool
(ListCertificateAuthoritiesResponse
 -> ListCertificateAuthoritiesResponse -> Bool)
-> (ListCertificateAuthoritiesResponse
    -> ListCertificateAuthoritiesResponse -> Bool)
-> Eq ListCertificateAuthoritiesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCertificateAuthoritiesResponse
-> ListCertificateAuthoritiesResponse -> Bool
$c/= :: ListCertificateAuthoritiesResponse
-> ListCertificateAuthoritiesResponse -> Bool
== :: ListCertificateAuthoritiesResponse
-> ListCertificateAuthoritiesResponse -> Bool
$c== :: ListCertificateAuthoritiesResponse
-> ListCertificateAuthoritiesResponse -> Bool
Prelude.Eq, ReadPrec [ListCertificateAuthoritiesResponse]
ReadPrec ListCertificateAuthoritiesResponse
Int -> ReadS ListCertificateAuthoritiesResponse
ReadS [ListCertificateAuthoritiesResponse]
(Int -> ReadS ListCertificateAuthoritiesResponse)
-> ReadS [ListCertificateAuthoritiesResponse]
-> ReadPrec ListCertificateAuthoritiesResponse
-> ReadPrec [ListCertificateAuthoritiesResponse]
-> Read ListCertificateAuthoritiesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCertificateAuthoritiesResponse]
$creadListPrec :: ReadPrec [ListCertificateAuthoritiesResponse]
readPrec :: ReadPrec ListCertificateAuthoritiesResponse
$creadPrec :: ReadPrec ListCertificateAuthoritiesResponse
readList :: ReadS [ListCertificateAuthoritiesResponse]
$creadList :: ReadS [ListCertificateAuthoritiesResponse]
readsPrec :: Int -> ReadS ListCertificateAuthoritiesResponse
$creadsPrec :: Int -> ReadS ListCertificateAuthoritiesResponse
Prelude.Read, Int -> ListCertificateAuthoritiesResponse -> ShowS
[ListCertificateAuthoritiesResponse] -> ShowS
ListCertificateAuthoritiesResponse -> String
(Int -> ListCertificateAuthoritiesResponse -> ShowS)
-> (ListCertificateAuthoritiesResponse -> String)
-> ([ListCertificateAuthoritiesResponse] -> ShowS)
-> Show ListCertificateAuthoritiesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCertificateAuthoritiesResponse] -> ShowS
$cshowList :: [ListCertificateAuthoritiesResponse] -> ShowS
show :: ListCertificateAuthoritiesResponse -> String
$cshow :: ListCertificateAuthoritiesResponse -> String
showsPrec :: Int -> ListCertificateAuthoritiesResponse -> ShowS
$cshowsPrec :: Int -> ListCertificateAuthoritiesResponse -> ShowS
Prelude.Show, (forall x.
 ListCertificateAuthoritiesResponse
 -> Rep ListCertificateAuthoritiesResponse x)
-> (forall x.
    Rep ListCertificateAuthoritiesResponse x
    -> ListCertificateAuthoritiesResponse)
-> Generic ListCertificateAuthoritiesResponse
forall x.
Rep ListCertificateAuthoritiesResponse x
-> ListCertificateAuthoritiesResponse
forall x.
ListCertificateAuthoritiesResponse
-> Rep ListCertificateAuthoritiesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCertificateAuthoritiesResponse x
-> ListCertificateAuthoritiesResponse
$cfrom :: forall x.
ListCertificateAuthoritiesResponse
-> Rep ListCertificateAuthoritiesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListCertificateAuthoritiesResponse' 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:
--
-- 'certificateAuthorities', 'listCertificateAuthoritiesResponse_certificateAuthorities' - Summary information about each certificate authority you have created.
--
-- 'nextToken', 'listCertificateAuthoritiesResponse_nextToken' - When the list is truncated, this value is present and should be used for
-- the @NextToken@ parameter in a subsequent pagination request.
--
-- 'httpStatus', 'listCertificateAuthoritiesResponse_httpStatus' - The response's http status code.
newListCertificateAuthoritiesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListCertificateAuthoritiesResponse
newListCertificateAuthoritiesResponse :: Int -> ListCertificateAuthoritiesResponse
newListCertificateAuthoritiesResponse Int
pHttpStatus_ =
  ListCertificateAuthoritiesResponse' :: Maybe [CertificateAuthority]
-> Maybe Text -> Int -> ListCertificateAuthoritiesResponse
ListCertificateAuthoritiesResponse'
    { $sel:certificateAuthorities:ListCertificateAuthoritiesResponse' :: Maybe [CertificateAuthority]
certificateAuthorities =
        Maybe [CertificateAuthority]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListCertificateAuthoritiesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListCertificateAuthoritiesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Summary information about each certificate authority you have created.
listCertificateAuthoritiesResponse_certificateAuthorities :: Lens.Lens' ListCertificateAuthoritiesResponse (Prelude.Maybe [CertificateAuthority])
listCertificateAuthoritiesResponse_certificateAuthorities :: (Maybe [CertificateAuthority] -> f (Maybe [CertificateAuthority]))
-> ListCertificateAuthoritiesResponse
-> f ListCertificateAuthoritiesResponse
listCertificateAuthoritiesResponse_certificateAuthorities = (ListCertificateAuthoritiesResponse
 -> Maybe [CertificateAuthority])
-> (ListCertificateAuthoritiesResponse
    -> Maybe [CertificateAuthority]
    -> ListCertificateAuthoritiesResponse)
-> Lens'
     ListCertificateAuthoritiesResponse (Maybe [CertificateAuthority])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCertificateAuthoritiesResponse' {Maybe [CertificateAuthority]
certificateAuthorities :: Maybe [CertificateAuthority]
$sel:certificateAuthorities:ListCertificateAuthoritiesResponse' :: ListCertificateAuthoritiesResponse -> Maybe [CertificateAuthority]
certificateAuthorities} -> Maybe [CertificateAuthority]
certificateAuthorities) (\s :: ListCertificateAuthoritiesResponse
s@ListCertificateAuthoritiesResponse' {} Maybe [CertificateAuthority]
a -> ListCertificateAuthoritiesResponse
s {$sel:certificateAuthorities:ListCertificateAuthoritiesResponse' :: Maybe [CertificateAuthority]
certificateAuthorities = Maybe [CertificateAuthority]
a} :: ListCertificateAuthoritiesResponse) ((Maybe [CertificateAuthority] -> f (Maybe [CertificateAuthority]))
 -> ListCertificateAuthoritiesResponse
 -> f ListCertificateAuthoritiesResponse)
-> ((Maybe [CertificateAuthority]
     -> f (Maybe [CertificateAuthority]))
    -> Maybe [CertificateAuthority]
    -> f (Maybe [CertificateAuthority]))
-> (Maybe [CertificateAuthority]
    -> f (Maybe [CertificateAuthority]))
-> ListCertificateAuthoritiesResponse
-> f ListCertificateAuthoritiesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CertificateAuthority]
  [CertificateAuthority]
  [CertificateAuthority]
  [CertificateAuthority]
-> Iso
     (Maybe [CertificateAuthority])
     (Maybe [CertificateAuthority])
     (Maybe [CertificateAuthority])
     (Maybe [CertificateAuthority])
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
  [CertificateAuthority]
  [CertificateAuthority]
  [CertificateAuthority]
  [CertificateAuthority]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance
  Prelude.NFData
    ListCertificateAuthoritiesResponse