{-# 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.ListHapgs
(
ListHapgs (..),
newListHapgs,
listHapgs_nextToken,
ListHapgsResponse (..),
newListHapgsResponse,
listHapgsResponse_nextToken,
listHapgsResponse_httpStatus,
listHapgsResponse_hapgList,
)
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 ListHapgs = ListHapgs'
{
ListHapgs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListHapgs -> ListHapgs -> Bool
(ListHapgs -> ListHapgs -> Bool)
-> (ListHapgs -> ListHapgs -> Bool) -> Eq ListHapgs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHapgs -> ListHapgs -> Bool
$c/= :: ListHapgs -> ListHapgs -> Bool
== :: ListHapgs -> ListHapgs -> Bool
$c== :: ListHapgs -> ListHapgs -> Bool
Prelude.Eq, ReadPrec [ListHapgs]
ReadPrec ListHapgs
Int -> ReadS ListHapgs
ReadS [ListHapgs]
(Int -> ReadS ListHapgs)
-> ReadS [ListHapgs]
-> ReadPrec ListHapgs
-> ReadPrec [ListHapgs]
-> Read ListHapgs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListHapgs]
$creadListPrec :: ReadPrec [ListHapgs]
readPrec :: ReadPrec ListHapgs
$creadPrec :: ReadPrec ListHapgs
readList :: ReadS [ListHapgs]
$creadList :: ReadS [ListHapgs]
readsPrec :: Int -> ReadS ListHapgs
$creadsPrec :: Int -> ReadS ListHapgs
Prelude.Read, Int -> ListHapgs -> ShowS
[ListHapgs] -> ShowS
ListHapgs -> String
(Int -> ListHapgs -> ShowS)
-> (ListHapgs -> String)
-> ([ListHapgs] -> ShowS)
-> Show ListHapgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHapgs] -> ShowS
$cshowList :: [ListHapgs] -> ShowS
show :: ListHapgs -> String
$cshow :: ListHapgs -> String
showsPrec :: Int -> ListHapgs -> ShowS
$cshowsPrec :: Int -> ListHapgs -> ShowS
Prelude.Show, (forall x. ListHapgs -> Rep ListHapgs x)
-> (forall x. Rep ListHapgs x -> ListHapgs) -> Generic ListHapgs
forall x. Rep ListHapgs x -> ListHapgs
forall x. ListHapgs -> Rep ListHapgs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListHapgs x -> ListHapgs
$cfrom :: forall x. ListHapgs -> Rep ListHapgs x
Prelude.Generic)
newListHapgs ::
ListHapgs
newListHapgs :: ListHapgs
newListHapgs =
ListHapgs' :: Maybe Text -> ListHapgs
ListHapgs' {$sel:nextToken:ListHapgs' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing}
listHapgs_nextToken :: Lens.Lens' ListHapgs (Prelude.Maybe Prelude.Text)
listHapgs_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListHapgs -> f ListHapgs
listHapgs_nextToken = (ListHapgs -> Maybe Text)
-> (ListHapgs -> Maybe Text -> ListHapgs)
-> Lens ListHapgs ListHapgs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHapgs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHapgs' :: ListHapgs -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHapgs
s@ListHapgs' {} Maybe Text
a -> ListHapgs
s {$sel:nextToken:ListHapgs' :: Maybe Text
nextToken = Maybe Text
a} :: ListHapgs)
instance Core.AWSPager ListHapgs where
page :: ListHapgs -> AWSResponse ListHapgs -> Maybe ListHapgs
page ListHapgs
rq AWSResponse ListHapgs
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListHapgs
ListHapgsResponse
rs
ListHapgsResponse
-> Getting (First Text) ListHapgsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListHapgsResponse -> Const (First Text) ListHapgsResponse
Lens' ListHapgsResponse (Maybe Text)
listHapgsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListHapgsResponse -> Const (First Text) ListHapgsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListHapgsResponse 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 ListHapgs
forall a. Maybe a
Prelude.Nothing
| [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop (AWSResponse ListHapgs
ListHapgsResponse
rs ListHapgsResponse
-> Getting [Text] ListHapgsResponse [Text] -> [Text]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Text] ListHapgsResponse [Text]
Lens' ListHapgsResponse [Text]
listHapgsResponse_hapgList) =
Maybe ListHapgs
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListHapgs -> Maybe ListHapgs
forall a. a -> Maybe a
Prelude.Just (ListHapgs -> Maybe ListHapgs) -> ListHapgs -> Maybe ListHapgs
forall a b. (a -> b) -> a -> b
Prelude.$
ListHapgs
rq
ListHapgs -> (ListHapgs -> ListHapgs) -> ListHapgs
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListHapgs -> Identity ListHapgs
Lens ListHapgs ListHapgs (Maybe Text) (Maybe Text)
listHapgs_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListHapgs -> Identity ListHapgs)
-> Maybe Text -> ListHapgs -> ListHapgs
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListHapgs
ListHapgsResponse
rs
ListHapgsResponse
-> Getting (First Text) ListHapgsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListHapgsResponse -> Const (First Text) ListHapgsResponse
Lens' ListHapgsResponse (Maybe Text)
listHapgsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListHapgsResponse -> Const (First Text) ListHapgsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListHapgsResponse 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 ListHapgs where
type AWSResponse ListHapgs = ListHapgsResponse
request :: ListHapgs -> Request ListHapgs
request = Service -> ListHapgs -> Request ListHapgs
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListHapgs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListHapgs)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListHapgs))
-> Logger
-> Service
-> Proxy ListHapgs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListHapgs)))
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] -> ListHapgsResponse
ListHapgsResponse'
(Maybe Text -> Int -> [Text] -> ListHapgsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Text] -> ListHapgsResponse)
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] -> ListHapgsResponse)
-> Either String Int -> Either String ([Text] -> ListHapgsResponse)
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] -> ListHapgsResponse)
-> Either String [Text] -> Either String ListHapgsResponse
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
"HapgList" 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 ListHapgs
instance Prelude.NFData ListHapgs
instance Core.ToHeaders ListHapgs where
toHeaders :: ListHapgs -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListHapgs -> 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.ListHapgs" ::
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 ListHapgs where
toJSON :: ListHapgs -> Value
toJSON ListHapgs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHapgs' :: ListHapgs -> 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 ListHapgs where
toPath :: ListHapgs -> ByteString
toPath = ByteString -> ListHapgs -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListHapgs where
toQuery :: ListHapgs -> QueryString
toQuery = QueryString -> ListHapgs -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListHapgsResponse = ListHapgsResponse'
{
ListHapgsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListHapgsResponse -> Int
httpStatus :: Prelude.Int,
ListHapgsResponse -> [Text]
hapgList :: [Prelude.Text]
}
deriving (ListHapgsResponse -> ListHapgsResponse -> Bool
(ListHapgsResponse -> ListHapgsResponse -> Bool)
-> (ListHapgsResponse -> ListHapgsResponse -> Bool)
-> Eq ListHapgsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHapgsResponse -> ListHapgsResponse -> Bool
$c/= :: ListHapgsResponse -> ListHapgsResponse -> Bool
== :: ListHapgsResponse -> ListHapgsResponse -> Bool
$c== :: ListHapgsResponse -> ListHapgsResponse -> Bool
Prelude.Eq, ReadPrec [ListHapgsResponse]
ReadPrec ListHapgsResponse
Int -> ReadS ListHapgsResponse
ReadS [ListHapgsResponse]
(Int -> ReadS ListHapgsResponse)
-> ReadS [ListHapgsResponse]
-> ReadPrec ListHapgsResponse
-> ReadPrec [ListHapgsResponse]
-> Read ListHapgsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListHapgsResponse]
$creadListPrec :: ReadPrec [ListHapgsResponse]
readPrec :: ReadPrec ListHapgsResponse
$creadPrec :: ReadPrec ListHapgsResponse
readList :: ReadS [ListHapgsResponse]
$creadList :: ReadS [ListHapgsResponse]
readsPrec :: Int -> ReadS ListHapgsResponse
$creadsPrec :: Int -> ReadS ListHapgsResponse
Prelude.Read, Int -> ListHapgsResponse -> ShowS
[ListHapgsResponse] -> ShowS
ListHapgsResponse -> String
(Int -> ListHapgsResponse -> ShowS)
-> (ListHapgsResponse -> String)
-> ([ListHapgsResponse] -> ShowS)
-> Show ListHapgsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHapgsResponse] -> ShowS
$cshowList :: [ListHapgsResponse] -> ShowS
show :: ListHapgsResponse -> String
$cshow :: ListHapgsResponse -> String
showsPrec :: Int -> ListHapgsResponse -> ShowS
$cshowsPrec :: Int -> ListHapgsResponse -> ShowS
Prelude.Show, (forall x. ListHapgsResponse -> Rep ListHapgsResponse x)
-> (forall x. Rep ListHapgsResponse x -> ListHapgsResponse)
-> Generic ListHapgsResponse
forall x. Rep ListHapgsResponse x -> ListHapgsResponse
forall x. ListHapgsResponse -> Rep ListHapgsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListHapgsResponse x -> ListHapgsResponse
$cfrom :: forall x. ListHapgsResponse -> Rep ListHapgsResponse x
Prelude.Generic)
newListHapgsResponse ::
Prelude.Int ->
ListHapgsResponse
newListHapgsResponse :: Int -> ListHapgsResponse
newListHapgsResponse Int
pHttpStatus_ =
ListHapgsResponse' :: Maybe Text -> Int -> [Text] -> ListHapgsResponse
ListHapgsResponse'
{ $sel:nextToken:ListHapgsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListHapgsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:hapgList:ListHapgsResponse' :: [Text]
hapgList = [Text]
forall a. Monoid a => a
Prelude.mempty
}
listHapgsResponse_nextToken :: Lens.Lens' ListHapgsResponse (Prelude.Maybe Prelude.Text)
listHapgsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListHapgsResponse -> f ListHapgsResponse
listHapgsResponse_nextToken = (ListHapgsResponse -> Maybe Text)
-> (ListHapgsResponse -> Maybe Text -> ListHapgsResponse)
-> Lens' ListHapgsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHapgsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHapgsResponse' :: ListHapgsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHapgsResponse
s@ListHapgsResponse' {} Maybe Text
a -> ListHapgsResponse
s {$sel:nextToken:ListHapgsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListHapgsResponse)
listHapgsResponse_httpStatus :: Lens.Lens' ListHapgsResponse Prelude.Int
listHapgsResponse_httpStatus :: (Int -> f Int) -> ListHapgsResponse -> f ListHapgsResponse
listHapgsResponse_httpStatus = (ListHapgsResponse -> Int)
-> (ListHapgsResponse -> Int -> ListHapgsResponse)
-> Lens ListHapgsResponse ListHapgsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHapgsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListHapgsResponse' :: ListHapgsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListHapgsResponse
s@ListHapgsResponse' {} Int
a -> ListHapgsResponse
s {$sel:httpStatus:ListHapgsResponse' :: Int
httpStatus = Int
a} :: ListHapgsResponse)
listHapgsResponse_hapgList :: Lens.Lens' ListHapgsResponse [Prelude.Text]
listHapgsResponse_hapgList :: ([Text] -> f [Text]) -> ListHapgsResponse -> f ListHapgsResponse
listHapgsResponse_hapgList = (ListHapgsResponse -> [Text])
-> (ListHapgsResponse -> [Text] -> ListHapgsResponse)
-> Lens' ListHapgsResponse [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHapgsResponse' {[Text]
hapgList :: [Text]
$sel:hapgList:ListHapgsResponse' :: ListHapgsResponse -> [Text]
hapgList} -> [Text]
hapgList) (\s :: ListHapgsResponse
s@ListHapgsResponse' {} [Text]
a -> ListHapgsResponse
s {$sel:hapgList:ListHapgsResponse' :: [Text]
hapgList = [Text]
a} :: ListHapgsResponse) (([Text] -> f [Text]) -> ListHapgsResponse -> f ListHapgsResponse)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ListHapgsResponse
-> f ListHapgsResponse
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 ListHapgsResponse