{-# 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.CloudTrail.ListPublicKeys
-- 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)
--
-- Returns all public keys whose private keys were used to sign the digest
-- files within the specified time range. The public key is needed to
-- validate digest files that were signed with its corresponding private
-- key.
--
-- CloudTrail uses different private and public key pairs per region. Each
-- digest file is signed with a private key unique to its region. When you
-- validate a digest file from a specific region, you must look in the same
-- region for its corresponding public key.
--
-- This operation returns paginated results.
module Amazonka.CloudTrail.ListPublicKeys
  ( -- * Creating a Request
    ListPublicKeys (..),
    newListPublicKeys,

    -- * Request Lenses
    listPublicKeys_startTime,
    listPublicKeys_nextToken,
    listPublicKeys_endTime,

    -- * Destructuring the Response
    ListPublicKeysResponse (..),
    newListPublicKeysResponse,

    -- * Response Lenses
    listPublicKeysResponse_publicKeyList,
    listPublicKeysResponse_nextToken,
    listPublicKeysResponse_httpStatus,
  )
where

import Amazonka.CloudTrail.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

-- | Requests the public keys for a specified time range.
--
-- /See:/ 'newListPublicKeys' smart constructor.
data ListPublicKeys = ListPublicKeys'
  { -- | Optionally specifies, in UTC, the start of the time range to look up
    -- public keys for CloudTrail digest files. If not specified, the current
    -- time is used, and the current public key is returned.
    ListPublicKeys -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | Reserved for future use.
    ListPublicKeys -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Optionally specifies, in UTC, the end of the time range to look up
    -- public keys for CloudTrail digest files. If not specified, the current
    -- time is used.
    ListPublicKeys -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX
  }
  deriving (ListPublicKeys -> ListPublicKeys -> Bool
(ListPublicKeys -> ListPublicKeys -> Bool)
-> (ListPublicKeys -> ListPublicKeys -> Bool) -> Eq ListPublicKeys
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPublicKeys -> ListPublicKeys -> Bool
$c/= :: ListPublicKeys -> ListPublicKeys -> Bool
== :: ListPublicKeys -> ListPublicKeys -> Bool
$c== :: ListPublicKeys -> ListPublicKeys -> Bool
Prelude.Eq, ReadPrec [ListPublicKeys]
ReadPrec ListPublicKeys
Int -> ReadS ListPublicKeys
ReadS [ListPublicKeys]
(Int -> ReadS ListPublicKeys)
-> ReadS [ListPublicKeys]
-> ReadPrec ListPublicKeys
-> ReadPrec [ListPublicKeys]
-> Read ListPublicKeys
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPublicKeys]
$creadListPrec :: ReadPrec [ListPublicKeys]
readPrec :: ReadPrec ListPublicKeys
$creadPrec :: ReadPrec ListPublicKeys
readList :: ReadS [ListPublicKeys]
$creadList :: ReadS [ListPublicKeys]
readsPrec :: Int -> ReadS ListPublicKeys
$creadsPrec :: Int -> ReadS ListPublicKeys
Prelude.Read, Int -> ListPublicKeys -> ShowS
[ListPublicKeys] -> ShowS
ListPublicKeys -> String
(Int -> ListPublicKeys -> ShowS)
-> (ListPublicKeys -> String)
-> ([ListPublicKeys] -> ShowS)
-> Show ListPublicKeys
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPublicKeys] -> ShowS
$cshowList :: [ListPublicKeys] -> ShowS
show :: ListPublicKeys -> String
$cshow :: ListPublicKeys -> String
showsPrec :: Int -> ListPublicKeys -> ShowS
$cshowsPrec :: Int -> ListPublicKeys -> ShowS
Prelude.Show, (forall x. ListPublicKeys -> Rep ListPublicKeys x)
-> (forall x. Rep ListPublicKeys x -> ListPublicKeys)
-> Generic ListPublicKeys
forall x. Rep ListPublicKeys x -> ListPublicKeys
forall x. ListPublicKeys -> Rep ListPublicKeys x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPublicKeys x -> ListPublicKeys
$cfrom :: forall x. ListPublicKeys -> Rep ListPublicKeys x
Prelude.Generic)

-- |
-- Create a value of 'ListPublicKeys' 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:
--
-- 'startTime', 'listPublicKeys_startTime' - Optionally specifies, in UTC, the start of the time range to look up
-- public keys for CloudTrail digest files. If not specified, the current
-- time is used, and the current public key is returned.
--
-- 'nextToken', 'listPublicKeys_nextToken' - Reserved for future use.
--
-- 'endTime', 'listPublicKeys_endTime' - Optionally specifies, in UTC, the end of the time range to look up
-- public keys for CloudTrail digest files. If not specified, the current
-- time is used.
newListPublicKeys ::
  ListPublicKeys
newListPublicKeys :: ListPublicKeys
newListPublicKeys =
  ListPublicKeys' :: Maybe POSIX -> Maybe Text -> Maybe POSIX -> ListPublicKeys
ListPublicKeys'
    { $sel:startTime:ListPublicKeys' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPublicKeys' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:ListPublicKeys' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | Optionally specifies, in UTC, the start of the time range to look up
-- public keys for CloudTrail digest files. If not specified, the current
-- time is used, and the current public key is returned.
listPublicKeys_startTime :: Lens.Lens' ListPublicKeys (Prelude.Maybe Prelude.UTCTime)
listPublicKeys_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListPublicKeys -> f ListPublicKeys
listPublicKeys_startTime = (ListPublicKeys -> Maybe POSIX)
-> (ListPublicKeys -> Maybe POSIX -> ListPublicKeys)
-> Lens ListPublicKeys ListPublicKeys (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublicKeys' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:ListPublicKeys' :: ListPublicKeys -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: ListPublicKeys
s@ListPublicKeys' {} Maybe POSIX
a -> ListPublicKeys
s {$sel:startTime:ListPublicKeys' :: Maybe POSIX
startTime = Maybe POSIX
a} :: ListPublicKeys) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListPublicKeys -> f ListPublicKeys)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListPublicKeys
-> f ListPublicKeys
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Reserved for future use.
listPublicKeys_nextToken :: Lens.Lens' ListPublicKeys (Prelude.Maybe Prelude.Text)
listPublicKeys_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPublicKeys -> f ListPublicKeys
listPublicKeys_nextToken = (ListPublicKeys -> Maybe Text)
-> (ListPublicKeys -> Maybe Text -> ListPublicKeys)
-> Lens ListPublicKeys ListPublicKeys (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublicKeys' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPublicKeys' :: ListPublicKeys -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPublicKeys
s@ListPublicKeys' {} Maybe Text
a -> ListPublicKeys
s {$sel:nextToken:ListPublicKeys' :: Maybe Text
nextToken = Maybe Text
a} :: ListPublicKeys)

-- | Optionally specifies, in UTC, the end of the time range to look up
-- public keys for CloudTrail digest files. If not specified, the current
-- time is used.
listPublicKeys_endTime :: Lens.Lens' ListPublicKeys (Prelude.Maybe Prelude.UTCTime)
listPublicKeys_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListPublicKeys -> f ListPublicKeys
listPublicKeys_endTime = (ListPublicKeys -> Maybe POSIX)
-> (ListPublicKeys -> Maybe POSIX -> ListPublicKeys)
-> Lens ListPublicKeys ListPublicKeys (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublicKeys' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:ListPublicKeys' :: ListPublicKeys -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: ListPublicKeys
s@ListPublicKeys' {} Maybe POSIX
a -> ListPublicKeys
s {$sel:endTime:ListPublicKeys' :: Maybe POSIX
endTime = Maybe POSIX
a} :: ListPublicKeys) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListPublicKeys -> f ListPublicKeys)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListPublicKeys
-> f ListPublicKeys
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

instance Prelude.NFData ListPublicKeys

instance Core.ToHeaders ListPublicKeys where
  toHeaders :: ListPublicKeys -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListPublicKeys -> 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
"com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.ListPublicKeys" ::
                          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 ListPublicKeys where
  toJSON :: ListPublicKeys -> Value
toJSON ListPublicKeys' {Maybe Text
Maybe POSIX
endTime :: Maybe POSIX
nextToken :: Maybe Text
startTime :: Maybe POSIX
$sel:endTime:ListPublicKeys' :: ListPublicKeys -> Maybe POSIX
$sel:nextToken:ListPublicKeys' :: ListPublicKeys -> Maybe Text
$sel:startTime:ListPublicKeys' :: ListPublicKeys -> Maybe POSIX
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"StartTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
startTime,
            (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
"EndTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (POSIX -> Pair) -> Maybe POSIX -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
endTime
          ]
      )

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

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

-- | Returns the objects or data listed below if successful. Otherwise,
-- returns an error.
--
-- /See:/ 'newListPublicKeysResponse' smart constructor.
data ListPublicKeysResponse = ListPublicKeysResponse'
  { -- | Contains an array of PublicKey objects.
    --
    -- The returned public keys may have validity time ranges that overlap.
    ListPublicKeysResponse -> Maybe [PublicKey]
publicKeyList :: Prelude.Maybe [PublicKey],
    -- | Reserved for future use.
    ListPublicKeysResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListPublicKeysResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPublicKeysResponse -> ListPublicKeysResponse -> Bool
(ListPublicKeysResponse -> ListPublicKeysResponse -> Bool)
-> (ListPublicKeysResponse -> ListPublicKeysResponse -> Bool)
-> Eq ListPublicKeysResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPublicKeysResponse -> ListPublicKeysResponse -> Bool
$c/= :: ListPublicKeysResponse -> ListPublicKeysResponse -> Bool
== :: ListPublicKeysResponse -> ListPublicKeysResponse -> Bool
$c== :: ListPublicKeysResponse -> ListPublicKeysResponse -> Bool
Prelude.Eq, ReadPrec [ListPublicKeysResponse]
ReadPrec ListPublicKeysResponse
Int -> ReadS ListPublicKeysResponse
ReadS [ListPublicKeysResponse]
(Int -> ReadS ListPublicKeysResponse)
-> ReadS [ListPublicKeysResponse]
-> ReadPrec ListPublicKeysResponse
-> ReadPrec [ListPublicKeysResponse]
-> Read ListPublicKeysResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPublicKeysResponse]
$creadListPrec :: ReadPrec [ListPublicKeysResponse]
readPrec :: ReadPrec ListPublicKeysResponse
$creadPrec :: ReadPrec ListPublicKeysResponse
readList :: ReadS [ListPublicKeysResponse]
$creadList :: ReadS [ListPublicKeysResponse]
readsPrec :: Int -> ReadS ListPublicKeysResponse
$creadsPrec :: Int -> ReadS ListPublicKeysResponse
Prelude.Read, Int -> ListPublicKeysResponse -> ShowS
[ListPublicKeysResponse] -> ShowS
ListPublicKeysResponse -> String
(Int -> ListPublicKeysResponse -> ShowS)
-> (ListPublicKeysResponse -> String)
-> ([ListPublicKeysResponse] -> ShowS)
-> Show ListPublicKeysResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPublicKeysResponse] -> ShowS
$cshowList :: [ListPublicKeysResponse] -> ShowS
show :: ListPublicKeysResponse -> String
$cshow :: ListPublicKeysResponse -> String
showsPrec :: Int -> ListPublicKeysResponse -> ShowS
$cshowsPrec :: Int -> ListPublicKeysResponse -> ShowS
Prelude.Show, (forall x. ListPublicKeysResponse -> Rep ListPublicKeysResponse x)
-> (forall x.
    Rep ListPublicKeysResponse x -> ListPublicKeysResponse)
-> Generic ListPublicKeysResponse
forall x. Rep ListPublicKeysResponse x -> ListPublicKeysResponse
forall x. ListPublicKeysResponse -> Rep ListPublicKeysResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPublicKeysResponse x -> ListPublicKeysResponse
$cfrom :: forall x. ListPublicKeysResponse -> Rep ListPublicKeysResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPublicKeysResponse' 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:
--
-- 'publicKeyList', 'listPublicKeysResponse_publicKeyList' - Contains an array of PublicKey objects.
--
-- The returned public keys may have validity time ranges that overlap.
--
-- 'nextToken', 'listPublicKeysResponse_nextToken' - Reserved for future use.
--
-- 'httpStatus', 'listPublicKeysResponse_httpStatus' - The response's http status code.
newListPublicKeysResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPublicKeysResponse
newListPublicKeysResponse :: Int -> ListPublicKeysResponse
newListPublicKeysResponse Int
pHttpStatus_ =
  ListPublicKeysResponse' :: Maybe [PublicKey] -> Maybe Text -> Int -> ListPublicKeysResponse
ListPublicKeysResponse'
    { $sel:publicKeyList:ListPublicKeysResponse' :: Maybe [PublicKey]
publicKeyList =
        Maybe [PublicKey]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPublicKeysResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPublicKeysResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Contains an array of PublicKey objects.
--
-- The returned public keys may have validity time ranges that overlap.
listPublicKeysResponse_publicKeyList :: Lens.Lens' ListPublicKeysResponse (Prelude.Maybe [PublicKey])
listPublicKeysResponse_publicKeyList :: (Maybe [PublicKey] -> f (Maybe [PublicKey]))
-> ListPublicKeysResponse -> f ListPublicKeysResponse
listPublicKeysResponse_publicKeyList = (ListPublicKeysResponse -> Maybe [PublicKey])
-> (ListPublicKeysResponse
    -> Maybe [PublicKey] -> ListPublicKeysResponse)
-> Lens' ListPublicKeysResponse (Maybe [PublicKey])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublicKeysResponse' {Maybe [PublicKey]
publicKeyList :: Maybe [PublicKey]
$sel:publicKeyList:ListPublicKeysResponse' :: ListPublicKeysResponse -> Maybe [PublicKey]
publicKeyList} -> Maybe [PublicKey]
publicKeyList) (\s :: ListPublicKeysResponse
s@ListPublicKeysResponse' {} Maybe [PublicKey]
a -> ListPublicKeysResponse
s {$sel:publicKeyList:ListPublicKeysResponse' :: Maybe [PublicKey]
publicKeyList = Maybe [PublicKey]
a} :: ListPublicKeysResponse) ((Maybe [PublicKey] -> f (Maybe [PublicKey]))
 -> ListPublicKeysResponse -> f ListPublicKeysResponse)
-> ((Maybe [PublicKey] -> f (Maybe [PublicKey]))
    -> Maybe [PublicKey] -> f (Maybe [PublicKey]))
-> (Maybe [PublicKey] -> f (Maybe [PublicKey]))
-> ListPublicKeysResponse
-> f ListPublicKeysResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PublicKey] [PublicKey] [PublicKey] [PublicKey]
-> Iso
     (Maybe [PublicKey])
     (Maybe [PublicKey])
     (Maybe [PublicKey])
     (Maybe [PublicKey])
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 [PublicKey] [PublicKey] [PublicKey] [PublicKey]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Reserved for future use.
listPublicKeysResponse_nextToken :: Lens.Lens' ListPublicKeysResponse (Prelude.Maybe Prelude.Text)
listPublicKeysResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListPublicKeysResponse -> f ListPublicKeysResponse
listPublicKeysResponse_nextToken = (ListPublicKeysResponse -> Maybe Text)
-> (ListPublicKeysResponse -> Maybe Text -> ListPublicKeysResponse)
-> Lens' ListPublicKeysResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPublicKeysResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPublicKeysResponse' :: ListPublicKeysResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPublicKeysResponse
s@ListPublicKeysResponse' {} Maybe Text
a -> ListPublicKeysResponse
s {$sel:nextToken:ListPublicKeysResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPublicKeysResponse)

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

instance Prelude.NFData ListPublicKeysResponse