{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$sel:nextToken:ListHapgs' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing}
listHapgs_nextToken :: Lens.Lens' ListHapgs (Prelude.Maybe Prelude.Text)
listHapgs_nextToken :: Lens' ListHapgs (Maybe Text)
listHapgs_nextToken = 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
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListHapgs
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListHapgsResponse (Maybe Text)
listHapgsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop (AWSResponse ListHapgs
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListHapgsResponse [Text]
listHapgsResponse_hapgList) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListHapgs
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListHapgs (Maybe Text)
listHapgs_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListHapgs
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListHapgsResponse (Maybe Text)
listHapgsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListHapgs where
type AWSResponse ListHapgs = ListHapgsResponse
request :: (Service -> Service) -> ListHapgs -> Request ListHapgs
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListHapgs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListHapgs)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> 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'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"HapgList" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListHapgs where
hashWithSalt :: Int -> ListHapgs -> Int
hashWithSalt Int
_salt ListHapgs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHapgs' :: ListHapgs -> Maybe Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListHapgs where
rnf :: ListHapgs -> ()
rnf ListHapgs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHapgs' :: ListHapgs -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListHapgs where
toHeaders :: ListHapgs -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"CloudHsmFrontendService.ListHapgs" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListHapgs where
toJSON :: ListHapgs -> Value
toJSON ListHapgs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHapgs' :: ListHapgs -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken]
)
instance Data.ToPath ListHapgs where
toPath :: ListHapgs -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListHapgs where
toQuery :: ListHapgs -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $sel:nextToken:ListHapgsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListHapgsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:hapgList:ListHapgsResponse' :: [Text]
hapgList = forall a. Monoid a => a
Prelude.mempty
}
listHapgsResponse_nextToken :: Lens.Lens' ListHapgsResponse (Prelude.Maybe Prelude.Text)
listHapgsResponse_nextToken :: Lens' ListHapgsResponse (Maybe Text)
listHapgsResponse_nextToken = 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 :: Lens' ListHapgsResponse Int
listHapgsResponse_httpStatus = 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 :: Lens' ListHapgsResponse [Text]
listHapgsResponse_hapgList = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListHapgsResponse where
rnf :: ListHapgsResponse -> ()
rnf ListHapgsResponse' {Int
[Text]
Maybe Text
hapgList :: [Text]
httpStatus :: Int
nextToken :: Maybe Text
$sel:hapgList:ListHapgsResponse' :: ListHapgsResponse -> [Text]
$sel:httpStatus:ListHapgsResponse' :: ListHapgsResponse -> Int
$sel:nextToken:ListHapgsResponse' :: ListHapgsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
hapgList