{-# 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 #-}
module Amazonka.CloudHSM.ListLunaClients
(
ListLunaClients (..),
newListLunaClients,
listLunaClients_nextToken,
ListLunaClientsResponse (..),
newListLunaClientsResponse,
listLunaClientsResponse_nextToken,
listLunaClientsResponse_httpStatus,
listLunaClientsResponse_clientList,
)
where
import Amazonka.CloudHSM.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
data ListLunaClients = ListLunaClients'
{
ListLunaClients -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListLunaClients -> ListLunaClients -> Bool
(ListLunaClients -> ListLunaClients -> Bool)
-> (ListLunaClients -> ListLunaClients -> Bool)
-> Eq ListLunaClients
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLunaClients -> ListLunaClients -> Bool
$c/= :: ListLunaClients -> ListLunaClients -> Bool
== :: ListLunaClients -> ListLunaClients -> Bool
$c== :: ListLunaClients -> ListLunaClients -> Bool
Prelude.Eq, ReadPrec [ListLunaClients]
ReadPrec ListLunaClients
Int -> ReadS ListLunaClients
ReadS [ListLunaClients]
(Int -> ReadS ListLunaClients)
-> ReadS [ListLunaClients]
-> ReadPrec ListLunaClients
-> ReadPrec [ListLunaClients]
-> Read ListLunaClients
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLunaClients]
$creadListPrec :: ReadPrec [ListLunaClients]
readPrec :: ReadPrec ListLunaClients
$creadPrec :: ReadPrec ListLunaClients
readList :: ReadS [ListLunaClients]
$creadList :: ReadS [ListLunaClients]
readsPrec :: Int -> ReadS ListLunaClients
$creadsPrec :: Int -> ReadS ListLunaClients
Prelude.Read, Int -> ListLunaClients -> ShowS
[ListLunaClients] -> ShowS
ListLunaClients -> String
(Int -> ListLunaClients -> ShowS)
-> (ListLunaClients -> String)
-> ([ListLunaClients] -> ShowS)
-> Show ListLunaClients
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLunaClients] -> ShowS
$cshowList :: [ListLunaClients] -> ShowS
show :: ListLunaClients -> String
$cshow :: ListLunaClients -> String
showsPrec :: Int -> ListLunaClients -> ShowS
$cshowsPrec :: Int -> ListLunaClients -> ShowS
Prelude.Show, (forall x. ListLunaClients -> Rep ListLunaClients x)
-> (forall x. Rep ListLunaClients x -> ListLunaClients)
-> Generic ListLunaClients
forall x. Rep ListLunaClients x -> ListLunaClients
forall x. ListLunaClients -> Rep ListLunaClients x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLunaClients x -> ListLunaClients
$cfrom :: forall x. ListLunaClients -> Rep ListLunaClients x
Prelude.Generic)
newListLunaClients ::
ListLunaClients
newListLunaClients :: ListLunaClients
newListLunaClients =
ListLunaClients' :: Maybe Text -> ListLunaClients
ListLunaClients' {$sel:nextToken:ListLunaClients' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing}
listLunaClients_nextToken :: Lens.Lens' ListLunaClients (Prelude.Maybe Prelude.Text)
listLunaClients_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListLunaClients -> f ListLunaClients
listLunaClients_nextToken = (ListLunaClients -> Maybe Text)
-> (ListLunaClients -> Maybe Text -> ListLunaClients)
-> Lens ListLunaClients ListLunaClients (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLunaClients' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLunaClients' :: ListLunaClients -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLunaClients
s@ListLunaClients' {} Maybe Text
a -> ListLunaClients
s {$sel:nextToken:ListLunaClients' :: Maybe Text
nextToken = Maybe Text
a} :: ListLunaClients)
instance Core.AWSPager ListLunaClients where
page :: ListLunaClients
-> AWSResponse ListLunaClients -> Maybe ListLunaClients
page ListLunaClients
rq AWSResponse ListLunaClients
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListLunaClients
ListLunaClientsResponse
rs
ListLunaClientsResponse
-> Getting (First Text) ListLunaClientsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListLunaClientsResponse
-> Const (First Text) ListLunaClientsResponse
Lens' ListLunaClientsResponse (Maybe Text)
listLunaClientsResponse_nextToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListLunaClientsResponse
-> Const (First Text) ListLunaClientsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListLunaClientsResponse 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 ListLunaClients
forall a. Maybe a
Prelude.Nothing
| [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListLunaClients
ListLunaClientsResponse
rs ListLunaClientsResponse
-> Getting [Text] ListLunaClientsResponse [Text] -> [Text]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Text] ListLunaClientsResponse [Text]
Lens' ListLunaClientsResponse [Text]
listLunaClientsResponse_clientList) =
Maybe ListLunaClients
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListLunaClients -> Maybe ListLunaClients
forall a. a -> Maybe a
Prelude.Just (ListLunaClients -> Maybe ListLunaClients)
-> ListLunaClients -> Maybe ListLunaClients
forall a b. (a -> b) -> a -> b
Prelude.$
ListLunaClients
rq
ListLunaClients
-> (ListLunaClients -> ListLunaClients) -> ListLunaClients
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListLunaClients -> Identity ListLunaClients
Lens ListLunaClients ListLunaClients (Maybe Text) (Maybe Text)
listLunaClients_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListLunaClients -> Identity ListLunaClients)
-> Maybe Text -> ListLunaClients -> ListLunaClients
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListLunaClients
ListLunaClientsResponse
rs
ListLunaClientsResponse
-> Getting (First Text) ListLunaClientsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListLunaClientsResponse
-> Const (First Text) ListLunaClientsResponse
Lens' ListLunaClientsResponse (Maybe Text)
listLunaClientsResponse_nextToken
((Maybe Text -> Const (First Text) (Maybe Text))
-> ListLunaClientsResponse
-> Const (First Text) ListLunaClientsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListLunaClientsResponse 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 ListLunaClients where
type
AWSResponse ListLunaClients =
ListLunaClientsResponse
request :: ListLunaClients -> Request ListLunaClients
request = Service -> ListLunaClients -> Request ListLunaClients
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListLunaClients
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListLunaClients)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListLunaClients))
-> Logger
-> Service
-> Proxy ListLunaClients
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListLunaClients)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> [Text] -> ListLunaClientsResponse
ListLunaClientsResponse'
(Maybe Text -> Int -> [Text] -> ListLunaClientsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Text] -> ListLunaClientsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Int -> [Text] -> ListLunaClientsResponse)
-> Either String Int
-> Either String ([Text] -> ListLunaClientsResponse)
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))
Either String ([Text] -> ListLunaClientsResponse)
-> Either String [Text] -> Either String ListLunaClientsResponse
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
"ClientList" Either String (Maybe [Text]) -> [Text] -> Either String [Text]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Text]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListLunaClients
instance Prelude.NFData ListLunaClients
instance Core.ToHeaders ListLunaClients where
toHeaders :: ListLunaClients -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListLunaClients -> 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
"CloudHsmFrontendService.ListLunaClients" ::
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 ListLunaClients where
toJSON :: ListLunaClients -> Value
toJSON ListLunaClients' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLunaClients' :: ListLunaClients -> 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]
)
instance Core.ToPath ListLunaClients where
toPath :: ListLunaClients -> ByteString
toPath = ByteString -> ListLunaClients -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListLunaClients where
toQuery :: ListLunaClients -> QueryString
toQuery = QueryString -> ListLunaClients -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListLunaClientsResponse = ListLunaClientsResponse'
{
ListLunaClientsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListLunaClientsResponse -> Int
httpStatus :: Prelude.Int,
ListLunaClientsResponse -> [Text]
clientList :: [Prelude.Text]
}
deriving (ListLunaClientsResponse -> ListLunaClientsResponse -> Bool
(ListLunaClientsResponse -> ListLunaClientsResponse -> Bool)
-> (ListLunaClientsResponse -> ListLunaClientsResponse -> Bool)
-> Eq ListLunaClientsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLunaClientsResponse -> ListLunaClientsResponse -> Bool
$c/= :: ListLunaClientsResponse -> ListLunaClientsResponse -> Bool
== :: ListLunaClientsResponse -> ListLunaClientsResponse -> Bool
$c== :: ListLunaClientsResponse -> ListLunaClientsResponse -> Bool
Prelude.Eq, ReadPrec [ListLunaClientsResponse]
ReadPrec ListLunaClientsResponse
Int -> ReadS ListLunaClientsResponse
ReadS [ListLunaClientsResponse]
(Int -> ReadS ListLunaClientsResponse)
-> ReadS [ListLunaClientsResponse]
-> ReadPrec ListLunaClientsResponse
-> ReadPrec [ListLunaClientsResponse]
-> Read ListLunaClientsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLunaClientsResponse]
$creadListPrec :: ReadPrec [ListLunaClientsResponse]
readPrec :: ReadPrec ListLunaClientsResponse
$creadPrec :: ReadPrec ListLunaClientsResponse
readList :: ReadS [ListLunaClientsResponse]
$creadList :: ReadS [ListLunaClientsResponse]
readsPrec :: Int -> ReadS ListLunaClientsResponse
$creadsPrec :: Int -> ReadS ListLunaClientsResponse
Prelude.Read, Int -> ListLunaClientsResponse -> ShowS
[ListLunaClientsResponse] -> ShowS
ListLunaClientsResponse -> String
(Int -> ListLunaClientsResponse -> ShowS)
-> (ListLunaClientsResponse -> String)
-> ([ListLunaClientsResponse] -> ShowS)
-> Show ListLunaClientsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLunaClientsResponse] -> ShowS
$cshowList :: [ListLunaClientsResponse] -> ShowS
show :: ListLunaClientsResponse -> String
$cshow :: ListLunaClientsResponse -> String
showsPrec :: Int -> ListLunaClientsResponse -> ShowS
$cshowsPrec :: Int -> ListLunaClientsResponse -> ShowS
Prelude.Show, (forall x.
ListLunaClientsResponse -> Rep ListLunaClientsResponse x)
-> (forall x.
Rep ListLunaClientsResponse x -> ListLunaClientsResponse)
-> Generic ListLunaClientsResponse
forall x. Rep ListLunaClientsResponse x -> ListLunaClientsResponse
forall x. ListLunaClientsResponse -> Rep ListLunaClientsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLunaClientsResponse x -> ListLunaClientsResponse
$cfrom :: forall x. ListLunaClientsResponse -> Rep ListLunaClientsResponse x
Prelude.Generic)
newListLunaClientsResponse ::
Prelude.Int ->
ListLunaClientsResponse
newListLunaClientsResponse :: Int -> ListLunaClientsResponse
newListLunaClientsResponse Int
pHttpStatus_ =
ListLunaClientsResponse' :: Maybe Text -> Int -> [Text] -> ListLunaClientsResponse
ListLunaClientsResponse'
{ $sel:nextToken:ListLunaClientsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListLunaClientsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:clientList:ListLunaClientsResponse' :: [Text]
clientList = [Text]
forall a. Monoid a => a
Prelude.mempty
}
listLunaClientsResponse_nextToken :: Lens.Lens' ListLunaClientsResponse (Prelude.Maybe Prelude.Text)
listLunaClientsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListLunaClientsResponse -> f ListLunaClientsResponse
listLunaClientsResponse_nextToken = (ListLunaClientsResponse -> Maybe Text)
-> (ListLunaClientsResponse
-> Maybe Text -> ListLunaClientsResponse)
-> Lens' ListLunaClientsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLunaClientsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLunaClientsResponse' :: ListLunaClientsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLunaClientsResponse
s@ListLunaClientsResponse' {} Maybe Text
a -> ListLunaClientsResponse
s {$sel:nextToken:ListLunaClientsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListLunaClientsResponse)
listLunaClientsResponse_httpStatus :: Lens.Lens' ListLunaClientsResponse Prelude.Int
listLunaClientsResponse_httpStatus :: (Int -> f Int)
-> ListLunaClientsResponse -> f ListLunaClientsResponse
listLunaClientsResponse_httpStatus = (ListLunaClientsResponse -> Int)
-> (ListLunaClientsResponse -> Int -> ListLunaClientsResponse)
-> Lens ListLunaClientsResponse ListLunaClientsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLunaClientsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListLunaClientsResponse' :: ListLunaClientsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListLunaClientsResponse
s@ListLunaClientsResponse' {} Int
a -> ListLunaClientsResponse
s {$sel:httpStatus:ListLunaClientsResponse' :: Int
httpStatus = Int
a} :: ListLunaClientsResponse)
listLunaClientsResponse_clientList :: Lens.Lens' ListLunaClientsResponse [Prelude.Text]
listLunaClientsResponse_clientList :: ([Text] -> f [Text])
-> ListLunaClientsResponse -> f ListLunaClientsResponse
listLunaClientsResponse_clientList = (ListLunaClientsResponse -> [Text])
-> (ListLunaClientsResponse -> [Text] -> ListLunaClientsResponse)
-> Lens' ListLunaClientsResponse [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLunaClientsResponse' {[Text]
clientList :: [Text]
$sel:clientList:ListLunaClientsResponse' :: ListLunaClientsResponse -> [Text]
clientList} -> [Text]
clientList) (\s :: ListLunaClientsResponse
s@ListLunaClientsResponse' {} [Text]
a -> ListLunaClientsResponse
s {$sel:clientList:ListLunaClientsResponse' :: [Text]
clientList = [Text]
a} :: ListLunaClientsResponse) (([Text] -> f [Text])
-> ListLunaClientsResponse -> f ListLunaClientsResponse)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ListLunaClientsResponse
-> f ListLunaClientsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListLunaClientsResponse