{-# 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.IAM.ListSSHPublicKeys
-- 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 information about the SSH public keys associated with the
-- specified IAM user. If none exists, the operation returns an empty list.
--
-- The SSH public keys returned by this operation are used only for
-- authenticating the IAM user to an CodeCommit repository. For more
-- information about using SSH keys to authenticate to an CodeCommit
-- repository, see
-- <https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-credentials-ssh.html Set up CodeCommit for SSH connections>
-- in the /CodeCommit User Guide/.
--
-- Although each user is limited to a small number of keys, you can still
-- paginate the results using the @MaxItems@ and @Marker@ parameters.
--
-- This operation returns paginated results.
module Amazonka.IAM.ListSSHPublicKeys
  ( -- * Creating a Request
    ListSSHPublicKeys (..),
    newListSSHPublicKeys,

    -- * Request Lenses
    listSSHPublicKeys_userName,
    listSSHPublicKeys_marker,
    listSSHPublicKeys_maxItems,

    -- * Destructuring the Response
    ListSSHPublicKeysResponse (..),
    newListSSHPublicKeysResponse,

    -- * Response Lenses
    listSSHPublicKeysResponse_sSHPublicKeys,
    listSSHPublicKeysResponse_marker,
    listSSHPublicKeysResponse_isTruncated,
    listSSHPublicKeysResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IAM.Types
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:/ 'newListSSHPublicKeys' smart constructor.
data ListSSHPublicKeys = ListSSHPublicKeys'
  { -- | The name of the IAM user to list SSH public keys for. If none is
    -- specified, the @UserName@ field is determined implicitly based on the
    -- Amazon Web Services access key used to sign the request.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of upper and lowercase alphanumeric characters with no
    -- spaces. You can also include any of the following characters: _+=,.\@-
    ListSSHPublicKeys -> Maybe Text
userName :: Prelude.Maybe Prelude.Text,
    -- | Use this parameter only when paginating results and only after you
    -- receive a response indicating that the results are truncated. Set it to
    -- the value of the @Marker@ element in the response that you received to
    -- indicate where the next call should start.
    ListSSHPublicKeys -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | Use this only when paginating results to indicate the maximum number of
    -- items you want in the response. If additional items exist beyond the
    -- maximum you specify, the @IsTruncated@ response element is @true@.
    --
    -- If you do not include this parameter, the number of items defaults to
    -- 100. Note that IAM might return fewer results, even when there are more
    -- results available. In that case, the @IsTruncated@ response element
    -- returns @true@, and @Marker@ contains a value to include in the
    -- subsequent call that tells the service where to continue from.
    ListSSHPublicKeys -> Maybe Natural
maxItems :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListSSHPublicKeys -> ListSSHPublicKeys -> Bool
(ListSSHPublicKeys -> ListSSHPublicKeys -> Bool)
-> (ListSSHPublicKeys -> ListSSHPublicKeys -> Bool)
-> Eq ListSSHPublicKeys
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSSHPublicKeys -> ListSSHPublicKeys -> Bool
$c/= :: ListSSHPublicKeys -> ListSSHPublicKeys -> Bool
== :: ListSSHPublicKeys -> ListSSHPublicKeys -> Bool
$c== :: ListSSHPublicKeys -> ListSSHPublicKeys -> Bool
Prelude.Eq, ReadPrec [ListSSHPublicKeys]
ReadPrec ListSSHPublicKeys
Int -> ReadS ListSSHPublicKeys
ReadS [ListSSHPublicKeys]
(Int -> ReadS ListSSHPublicKeys)
-> ReadS [ListSSHPublicKeys]
-> ReadPrec ListSSHPublicKeys
-> ReadPrec [ListSSHPublicKeys]
-> Read ListSSHPublicKeys
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSSHPublicKeys]
$creadListPrec :: ReadPrec [ListSSHPublicKeys]
readPrec :: ReadPrec ListSSHPublicKeys
$creadPrec :: ReadPrec ListSSHPublicKeys
readList :: ReadS [ListSSHPublicKeys]
$creadList :: ReadS [ListSSHPublicKeys]
readsPrec :: Int -> ReadS ListSSHPublicKeys
$creadsPrec :: Int -> ReadS ListSSHPublicKeys
Prelude.Read, Int -> ListSSHPublicKeys -> ShowS
[ListSSHPublicKeys] -> ShowS
ListSSHPublicKeys -> String
(Int -> ListSSHPublicKeys -> ShowS)
-> (ListSSHPublicKeys -> String)
-> ([ListSSHPublicKeys] -> ShowS)
-> Show ListSSHPublicKeys
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSSHPublicKeys] -> ShowS
$cshowList :: [ListSSHPublicKeys] -> ShowS
show :: ListSSHPublicKeys -> String
$cshow :: ListSSHPublicKeys -> String
showsPrec :: Int -> ListSSHPublicKeys -> ShowS
$cshowsPrec :: Int -> ListSSHPublicKeys -> ShowS
Prelude.Show, (forall x. ListSSHPublicKeys -> Rep ListSSHPublicKeys x)
-> (forall x. Rep ListSSHPublicKeys x -> ListSSHPublicKeys)
-> Generic ListSSHPublicKeys
forall x. Rep ListSSHPublicKeys x -> ListSSHPublicKeys
forall x. ListSSHPublicKeys -> Rep ListSSHPublicKeys x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSSHPublicKeys x -> ListSSHPublicKeys
$cfrom :: forall x. ListSSHPublicKeys -> Rep ListSSHPublicKeys x
Prelude.Generic)

-- |
-- Create a value of 'ListSSHPublicKeys' 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:
--
-- 'userName', 'listSSHPublicKeys_userName' - The name of the IAM user to list SSH public keys for. If none is
-- specified, the @UserName@ field is determined implicitly based on the
-- Amazon Web Services access key used to sign the request.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
--
-- 'marker', 'listSSHPublicKeys_marker' - Use this parameter only when paginating results and only after you
-- receive a response indicating that the results are truncated. Set it to
-- the value of the @Marker@ element in the response that you received to
-- indicate where the next call should start.
--
-- 'maxItems', 'listSSHPublicKeys_maxItems' - Use this only when paginating results to indicate the maximum number of
-- items you want in the response. If additional items exist beyond the
-- maximum you specify, the @IsTruncated@ response element is @true@.
--
-- If you do not include this parameter, the number of items defaults to
-- 100. Note that IAM might return fewer results, even when there are more
-- results available. In that case, the @IsTruncated@ response element
-- returns @true@, and @Marker@ contains a value to include in the
-- subsequent call that tells the service where to continue from.
newListSSHPublicKeys ::
  ListSSHPublicKeys
newListSSHPublicKeys :: ListSSHPublicKeys
newListSSHPublicKeys =
  ListSSHPublicKeys' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListSSHPublicKeys
ListSSHPublicKeys'
    { $sel:userName:ListSSHPublicKeys' :: Maybe Text
userName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListSSHPublicKeys' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListSSHPublicKeys' :: Maybe Natural
maxItems = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the IAM user to list SSH public keys for. If none is
-- specified, the @UserName@ field is determined implicitly based on the
-- Amazon Web Services access key used to sign the request.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
listSSHPublicKeys_userName :: Lens.Lens' ListSSHPublicKeys (Prelude.Maybe Prelude.Text)
listSSHPublicKeys_userName :: (Maybe Text -> f (Maybe Text))
-> ListSSHPublicKeys -> f ListSSHPublicKeys
listSSHPublicKeys_userName = (ListSSHPublicKeys -> Maybe Text)
-> (ListSSHPublicKeys -> Maybe Text -> ListSSHPublicKeys)
-> Lens
     ListSSHPublicKeys ListSSHPublicKeys (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSSHPublicKeys' {Maybe Text
userName :: Maybe Text
$sel:userName:ListSSHPublicKeys' :: ListSSHPublicKeys -> Maybe Text
userName} -> Maybe Text
userName) (\s :: ListSSHPublicKeys
s@ListSSHPublicKeys' {} Maybe Text
a -> ListSSHPublicKeys
s {$sel:userName:ListSSHPublicKeys' :: Maybe Text
userName = Maybe Text
a} :: ListSSHPublicKeys)

-- | Use this parameter only when paginating results and only after you
-- receive a response indicating that the results are truncated. Set it to
-- the value of the @Marker@ element in the response that you received to
-- indicate where the next call should start.
listSSHPublicKeys_marker :: Lens.Lens' ListSSHPublicKeys (Prelude.Maybe Prelude.Text)
listSSHPublicKeys_marker :: (Maybe Text -> f (Maybe Text))
-> ListSSHPublicKeys -> f ListSSHPublicKeys
listSSHPublicKeys_marker = (ListSSHPublicKeys -> Maybe Text)
-> (ListSSHPublicKeys -> Maybe Text -> ListSSHPublicKeys)
-> Lens
     ListSSHPublicKeys ListSSHPublicKeys (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSSHPublicKeys' {Maybe Text
marker :: Maybe Text
$sel:marker:ListSSHPublicKeys' :: ListSSHPublicKeys -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListSSHPublicKeys
s@ListSSHPublicKeys' {} Maybe Text
a -> ListSSHPublicKeys
s {$sel:marker:ListSSHPublicKeys' :: Maybe Text
marker = Maybe Text
a} :: ListSSHPublicKeys)

-- | Use this only when paginating results to indicate the maximum number of
-- items you want in the response. If additional items exist beyond the
-- maximum you specify, the @IsTruncated@ response element is @true@.
--
-- If you do not include this parameter, the number of items defaults to
-- 100. Note that IAM might return fewer results, even when there are more
-- results available. In that case, the @IsTruncated@ response element
-- returns @true@, and @Marker@ contains a value to include in the
-- subsequent call that tells the service where to continue from.
listSSHPublicKeys_maxItems :: Lens.Lens' ListSSHPublicKeys (Prelude.Maybe Prelude.Natural)
listSSHPublicKeys_maxItems :: (Maybe Natural -> f (Maybe Natural))
-> ListSSHPublicKeys -> f ListSSHPublicKeys
listSSHPublicKeys_maxItems = (ListSSHPublicKeys -> Maybe Natural)
-> (ListSSHPublicKeys -> Maybe Natural -> ListSSHPublicKeys)
-> Lens
     ListSSHPublicKeys ListSSHPublicKeys (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSSHPublicKeys' {Maybe Natural
maxItems :: Maybe Natural
$sel:maxItems:ListSSHPublicKeys' :: ListSSHPublicKeys -> Maybe Natural
maxItems} -> Maybe Natural
maxItems) (\s :: ListSSHPublicKeys
s@ListSSHPublicKeys' {} Maybe Natural
a -> ListSSHPublicKeys
s {$sel:maxItems:ListSSHPublicKeys' :: Maybe Natural
maxItems = Maybe Natural
a} :: ListSSHPublicKeys)

instance Core.AWSPager ListSSHPublicKeys where
  page :: ListSSHPublicKeys
-> AWSResponse ListSSHPublicKeys -> Maybe ListSSHPublicKeys
page ListSSHPublicKeys
rq AWSResponse ListSSHPublicKeys
rs
    | Maybe Bool -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSSHPublicKeys
ListSSHPublicKeysResponse
rs
            ListSSHPublicKeysResponse
-> Getting (First Bool) ListSSHPublicKeysResponse Bool
-> Maybe Bool
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Bool -> Const (First Bool) (Maybe Bool))
-> ListSSHPublicKeysResponse
-> Const (First Bool) ListSSHPublicKeysResponse
Lens' ListSSHPublicKeysResponse (Maybe Bool)
listSSHPublicKeysResponse_isTruncated
              ((Maybe Bool -> Const (First Bool) (Maybe Bool))
 -> ListSSHPublicKeysResponse
 -> Const (First Bool) ListSSHPublicKeysResponse)
-> ((Bool -> Const (First Bool) Bool)
    -> Maybe Bool -> Const (First Bool) (Maybe Bool))
-> Getting (First Bool) ListSSHPublicKeysResponse Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Bool -> Const (First Bool) Bool)
-> Maybe Bool -> Const (First Bool) (Maybe Bool)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListSSHPublicKeys
forall a. Maybe a
Prelude.Nothing
    | Maybe Text -> Bool
forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse ListSSHPublicKeys
ListSSHPublicKeysResponse
rs
            ListSSHPublicKeysResponse
-> Getting (First Text) ListSSHPublicKeysResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSSHPublicKeysResponse
-> Const (First Text) ListSSHPublicKeysResponse
Lens' ListSSHPublicKeysResponse (Maybe Text)
listSSHPublicKeysResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSSHPublicKeysResponse
 -> Const (First Text) ListSSHPublicKeysResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSSHPublicKeysResponse 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 ListSSHPublicKeys
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListSSHPublicKeys -> Maybe ListSSHPublicKeys
forall a. a -> Maybe a
Prelude.Just (ListSSHPublicKeys -> Maybe ListSSHPublicKeys)
-> ListSSHPublicKeys -> Maybe ListSSHPublicKeys
forall a b. (a -> b) -> a -> b
Prelude.$
        ListSSHPublicKeys
rq
          ListSSHPublicKeys
-> (ListSSHPublicKeys -> ListSSHPublicKeys) -> ListSSHPublicKeys
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListSSHPublicKeys -> Identity ListSSHPublicKeys
Lens ListSSHPublicKeys ListSSHPublicKeys (Maybe Text) (Maybe Text)
listSSHPublicKeys_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListSSHPublicKeys -> Identity ListSSHPublicKeys)
-> Maybe Text -> ListSSHPublicKeys -> ListSSHPublicKeys
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSSHPublicKeys
ListSSHPublicKeysResponse
rs
          ListSSHPublicKeysResponse
-> Getting (First Text) ListSSHPublicKeysResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSSHPublicKeysResponse
-> Const (First Text) ListSSHPublicKeysResponse
Lens' ListSSHPublicKeysResponse (Maybe Text)
listSSHPublicKeysResponse_marker ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSSHPublicKeysResponse
 -> Const (First Text) ListSSHPublicKeysResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSSHPublicKeysResponse 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 ListSSHPublicKeys where
  type
    AWSResponse ListSSHPublicKeys =
      ListSSHPublicKeysResponse
  request :: ListSSHPublicKeys -> Request ListSSHPublicKeys
request = Service -> ListSSHPublicKeys -> Request ListSSHPublicKeys
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ListSSHPublicKeys
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSSHPublicKeys)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ListSSHPublicKeys))
-> Logger
-> Service
-> Proxy ListSSHPublicKeys
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSSHPublicKeys)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ListSSHPublicKeysResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [SSHPublicKeyMetadata]
-> Maybe Text -> Maybe Bool -> Int -> ListSSHPublicKeysResponse
ListSSHPublicKeysResponse'
            (Maybe [SSHPublicKeyMetadata]
 -> Maybe Text -> Maybe Bool -> Int -> ListSSHPublicKeysResponse)
-> Either String (Maybe [SSHPublicKeyMetadata])
-> Either
     String
     (Maybe Text -> Maybe Bool -> Int -> ListSSHPublicKeysResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SSHPublicKeys" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [SSHPublicKeyMetadata]))
-> Either String (Maybe [SSHPublicKeyMetadata])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [SSHPublicKeyMetadata])
-> [Node] -> Either String (Maybe [SSHPublicKeyMetadata])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [SSHPublicKeyMetadata]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either
  String
  (Maybe Text -> Maybe Bool -> Int -> ListSSHPublicKeysResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> Int -> ListSSHPublicKeysResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Marker")
            Either String (Maybe Bool -> Int -> ListSSHPublicKeysResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> ListSSHPublicKeysResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsTruncated")
            Either String (Int -> ListSSHPublicKeysResponse)
-> Either String Int -> Either String ListSSHPublicKeysResponse
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 ListSSHPublicKeys

instance Prelude.NFData ListSSHPublicKeys

instance Core.ToHeaders ListSSHPublicKeys where
  toHeaders :: ListSSHPublicKeys -> ResponseHeaders
toHeaders = ResponseHeaders -> ListSSHPublicKeys -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery ListSSHPublicKeys where
  toQuery :: ListSSHPublicKeys -> QueryString
toQuery ListSSHPublicKeys' {Maybe Natural
Maybe Text
maxItems :: Maybe Natural
marker :: Maybe Text
userName :: Maybe Text
$sel:maxItems:ListSSHPublicKeys' :: ListSSHPublicKeys -> Maybe Natural
$sel:marker:ListSSHPublicKeys' :: ListSSHPublicKeys -> Maybe Text
$sel:userName:ListSSHPublicKeys' :: ListSSHPublicKeys -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ListSSHPublicKeys" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"UserName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
userName,
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"MaxItems" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxItems
      ]

-- | Contains the response to a successful ListSSHPublicKeys request.
--
-- /See:/ 'newListSSHPublicKeysResponse' smart constructor.
data ListSSHPublicKeysResponse = ListSSHPublicKeysResponse'
  { -- | A list of the SSH public keys assigned to IAM user.
    ListSSHPublicKeysResponse -> Maybe [SSHPublicKeyMetadata]
sSHPublicKeys :: Prelude.Maybe [SSHPublicKeyMetadata],
    -- | When @IsTruncated@ is @true@, this element is present and contains the
    -- value to use for the @Marker@ parameter in a subsequent pagination
    -- request.
    ListSSHPublicKeysResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A flag that indicates whether there are more items to return. If your
    -- results were truncated, you can make a subsequent pagination request
    -- using the @Marker@ request parameter to retrieve more items. Note that
    -- IAM might return fewer than the @MaxItems@ number of results even when
    -- there are more results available. We recommend that you check
    -- @IsTruncated@ after every call to ensure that you receive all your
    -- results.
    ListSSHPublicKeysResponse -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    ListSSHPublicKeysResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSSHPublicKeysResponse -> ListSSHPublicKeysResponse -> Bool
(ListSSHPublicKeysResponse -> ListSSHPublicKeysResponse -> Bool)
-> (ListSSHPublicKeysResponse -> ListSSHPublicKeysResponse -> Bool)
-> Eq ListSSHPublicKeysResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSSHPublicKeysResponse -> ListSSHPublicKeysResponse -> Bool
$c/= :: ListSSHPublicKeysResponse -> ListSSHPublicKeysResponse -> Bool
== :: ListSSHPublicKeysResponse -> ListSSHPublicKeysResponse -> Bool
$c== :: ListSSHPublicKeysResponse -> ListSSHPublicKeysResponse -> Bool
Prelude.Eq, ReadPrec [ListSSHPublicKeysResponse]
ReadPrec ListSSHPublicKeysResponse
Int -> ReadS ListSSHPublicKeysResponse
ReadS [ListSSHPublicKeysResponse]
(Int -> ReadS ListSSHPublicKeysResponse)
-> ReadS [ListSSHPublicKeysResponse]
-> ReadPrec ListSSHPublicKeysResponse
-> ReadPrec [ListSSHPublicKeysResponse]
-> Read ListSSHPublicKeysResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSSHPublicKeysResponse]
$creadListPrec :: ReadPrec [ListSSHPublicKeysResponse]
readPrec :: ReadPrec ListSSHPublicKeysResponse
$creadPrec :: ReadPrec ListSSHPublicKeysResponse
readList :: ReadS [ListSSHPublicKeysResponse]
$creadList :: ReadS [ListSSHPublicKeysResponse]
readsPrec :: Int -> ReadS ListSSHPublicKeysResponse
$creadsPrec :: Int -> ReadS ListSSHPublicKeysResponse
Prelude.Read, Int -> ListSSHPublicKeysResponse -> ShowS
[ListSSHPublicKeysResponse] -> ShowS
ListSSHPublicKeysResponse -> String
(Int -> ListSSHPublicKeysResponse -> ShowS)
-> (ListSSHPublicKeysResponse -> String)
-> ([ListSSHPublicKeysResponse] -> ShowS)
-> Show ListSSHPublicKeysResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSSHPublicKeysResponse] -> ShowS
$cshowList :: [ListSSHPublicKeysResponse] -> ShowS
show :: ListSSHPublicKeysResponse -> String
$cshow :: ListSSHPublicKeysResponse -> String
showsPrec :: Int -> ListSSHPublicKeysResponse -> ShowS
$cshowsPrec :: Int -> ListSSHPublicKeysResponse -> ShowS
Prelude.Show, (forall x.
 ListSSHPublicKeysResponse -> Rep ListSSHPublicKeysResponse x)
-> (forall x.
    Rep ListSSHPublicKeysResponse x -> ListSSHPublicKeysResponse)
-> Generic ListSSHPublicKeysResponse
forall x.
Rep ListSSHPublicKeysResponse x -> ListSSHPublicKeysResponse
forall x.
ListSSHPublicKeysResponse -> Rep ListSSHPublicKeysResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSSHPublicKeysResponse x -> ListSSHPublicKeysResponse
$cfrom :: forall x.
ListSSHPublicKeysResponse -> Rep ListSSHPublicKeysResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListSSHPublicKeysResponse' 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:
--
-- 'sSHPublicKeys', 'listSSHPublicKeysResponse_sSHPublicKeys' - A list of the SSH public keys assigned to IAM user.
--
-- 'marker', 'listSSHPublicKeysResponse_marker' - When @IsTruncated@ is @true@, this element is present and contains the
-- value to use for the @Marker@ parameter in a subsequent pagination
-- request.
--
-- 'isTruncated', 'listSSHPublicKeysResponse_isTruncated' - A flag that indicates whether there are more items to return. If your
-- results were truncated, you can make a subsequent pagination request
-- using the @Marker@ request parameter to retrieve more items. Note that
-- IAM might return fewer than the @MaxItems@ number of results even when
-- there are more results available. We recommend that you check
-- @IsTruncated@ after every call to ensure that you receive all your
-- results.
--
-- 'httpStatus', 'listSSHPublicKeysResponse_httpStatus' - The response's http status code.
newListSSHPublicKeysResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSSHPublicKeysResponse
newListSSHPublicKeysResponse :: Int -> ListSSHPublicKeysResponse
newListSSHPublicKeysResponse Int
pHttpStatus_ =
  ListSSHPublicKeysResponse' :: Maybe [SSHPublicKeyMetadata]
-> Maybe Text -> Maybe Bool -> Int -> ListSSHPublicKeysResponse
ListSSHPublicKeysResponse'
    { $sel:sSHPublicKeys:ListSSHPublicKeysResponse' :: Maybe [SSHPublicKeyMetadata]
sSHPublicKeys =
        Maybe [SSHPublicKeyMetadata]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:ListSSHPublicKeysResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isTruncated:ListSSHPublicKeysResponse' :: Maybe Bool
isTruncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListSSHPublicKeysResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of the SSH public keys assigned to IAM user.
listSSHPublicKeysResponse_sSHPublicKeys :: Lens.Lens' ListSSHPublicKeysResponse (Prelude.Maybe [SSHPublicKeyMetadata])
listSSHPublicKeysResponse_sSHPublicKeys :: (Maybe [SSHPublicKeyMetadata] -> f (Maybe [SSHPublicKeyMetadata]))
-> ListSSHPublicKeysResponse -> f ListSSHPublicKeysResponse
listSSHPublicKeysResponse_sSHPublicKeys = (ListSSHPublicKeysResponse -> Maybe [SSHPublicKeyMetadata])
-> (ListSSHPublicKeysResponse
    -> Maybe [SSHPublicKeyMetadata] -> ListSSHPublicKeysResponse)
-> Lens
     ListSSHPublicKeysResponse
     ListSSHPublicKeysResponse
     (Maybe [SSHPublicKeyMetadata])
     (Maybe [SSHPublicKeyMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSSHPublicKeysResponse' {Maybe [SSHPublicKeyMetadata]
sSHPublicKeys :: Maybe [SSHPublicKeyMetadata]
$sel:sSHPublicKeys:ListSSHPublicKeysResponse' :: ListSSHPublicKeysResponse -> Maybe [SSHPublicKeyMetadata]
sSHPublicKeys} -> Maybe [SSHPublicKeyMetadata]
sSHPublicKeys) (\s :: ListSSHPublicKeysResponse
s@ListSSHPublicKeysResponse' {} Maybe [SSHPublicKeyMetadata]
a -> ListSSHPublicKeysResponse
s {$sel:sSHPublicKeys:ListSSHPublicKeysResponse' :: Maybe [SSHPublicKeyMetadata]
sSHPublicKeys = Maybe [SSHPublicKeyMetadata]
a} :: ListSSHPublicKeysResponse) ((Maybe [SSHPublicKeyMetadata] -> f (Maybe [SSHPublicKeyMetadata]))
 -> ListSSHPublicKeysResponse -> f ListSSHPublicKeysResponse)
-> ((Maybe [SSHPublicKeyMetadata]
     -> f (Maybe [SSHPublicKeyMetadata]))
    -> Maybe [SSHPublicKeyMetadata]
    -> f (Maybe [SSHPublicKeyMetadata]))
-> (Maybe [SSHPublicKeyMetadata]
    -> f (Maybe [SSHPublicKeyMetadata]))
-> ListSSHPublicKeysResponse
-> f ListSSHPublicKeysResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SSHPublicKeyMetadata]
  [SSHPublicKeyMetadata]
  [SSHPublicKeyMetadata]
  [SSHPublicKeyMetadata]
-> Iso
     (Maybe [SSHPublicKeyMetadata])
     (Maybe [SSHPublicKeyMetadata])
     (Maybe [SSHPublicKeyMetadata])
     (Maybe [SSHPublicKeyMetadata])
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
  [SSHPublicKeyMetadata]
  [SSHPublicKeyMetadata]
  [SSHPublicKeyMetadata]
  [SSHPublicKeyMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | A flag that indicates whether there are more items to return. If your
-- results were truncated, you can make a subsequent pagination request
-- using the @Marker@ request parameter to retrieve more items. Note that
-- IAM might return fewer than the @MaxItems@ number of results even when
-- there are more results available. We recommend that you check
-- @IsTruncated@ after every call to ensure that you receive all your
-- results.
listSSHPublicKeysResponse_isTruncated :: Lens.Lens' ListSSHPublicKeysResponse (Prelude.Maybe Prelude.Bool)
listSSHPublicKeysResponse_isTruncated :: (Maybe Bool -> f (Maybe Bool))
-> ListSSHPublicKeysResponse -> f ListSSHPublicKeysResponse
listSSHPublicKeysResponse_isTruncated = (ListSSHPublicKeysResponse -> Maybe Bool)
-> (ListSSHPublicKeysResponse
    -> Maybe Bool -> ListSSHPublicKeysResponse)
-> Lens' ListSSHPublicKeysResponse (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSSHPublicKeysResponse' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ListSSHPublicKeysResponse' :: ListSSHPublicKeysResponse -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ListSSHPublicKeysResponse
s@ListSSHPublicKeysResponse' {} Maybe Bool
a -> ListSSHPublicKeysResponse
s {$sel:isTruncated:ListSSHPublicKeysResponse' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ListSSHPublicKeysResponse)

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

instance Prelude.NFData ListSSHPublicKeysResponse