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