{-# 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.KMS.ListKeys
(
ListKeys (..),
newListKeys,
listKeys_limit,
listKeys_marker,
ListKeysResponse (..),
newListKeysResponse,
listKeysResponse_keys,
listKeysResponse_nextMarker,
listKeysResponse_truncated,
listKeysResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KMS.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListKeys = ListKeys'
{
ListKeys -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
ListKeys -> Maybe Text
marker :: Prelude.Maybe Prelude.Text
}
deriving (ListKeys -> ListKeys -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListKeys -> ListKeys -> Bool
$c/= :: ListKeys -> ListKeys -> Bool
== :: ListKeys -> ListKeys -> Bool
$c== :: ListKeys -> ListKeys -> Bool
Prelude.Eq, ReadPrec [ListKeys]
ReadPrec ListKeys
Int -> ReadS ListKeys
ReadS [ListKeys]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListKeys]
$creadListPrec :: ReadPrec [ListKeys]
readPrec :: ReadPrec ListKeys
$creadPrec :: ReadPrec ListKeys
readList :: ReadS [ListKeys]
$creadList :: ReadS [ListKeys]
readsPrec :: Int -> ReadS ListKeys
$creadsPrec :: Int -> ReadS ListKeys
Prelude.Read, Int -> ListKeys -> ShowS
[ListKeys] -> ShowS
ListKeys -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListKeys] -> ShowS
$cshowList :: [ListKeys] -> ShowS
show :: ListKeys -> String
$cshow :: ListKeys -> String
showsPrec :: Int -> ListKeys -> ShowS
$cshowsPrec :: Int -> ListKeys -> ShowS
Prelude.Show, forall x. Rep ListKeys x -> ListKeys
forall x. ListKeys -> Rep ListKeys x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListKeys x -> ListKeys
$cfrom :: forall x. ListKeys -> Rep ListKeys x
Prelude.Generic)
newListKeys ::
ListKeys
newListKeys :: ListKeys
newListKeys =
ListKeys'
{ $sel:limit:ListKeys' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
$sel:marker:ListKeys' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing
}
listKeys_limit :: Lens.Lens' ListKeys (Prelude.Maybe Prelude.Natural)
listKeys_limit :: Lens' ListKeys (Maybe Natural)
listKeys_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeys' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListKeys' :: ListKeys -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListKeys
s@ListKeys' {} Maybe Natural
a -> ListKeys
s {$sel:limit:ListKeys' :: Maybe Natural
limit = Maybe Natural
a} :: ListKeys)
listKeys_marker :: Lens.Lens' ListKeys (Prelude.Maybe Prelude.Text)
listKeys_marker :: Lens' ListKeys (Maybe Text)
listKeys_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeys' {Maybe Text
marker :: Maybe Text
$sel:marker:ListKeys' :: ListKeys -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListKeys
s@ListKeys' {} Maybe Text
a -> ListKeys
s {$sel:marker:ListKeys' :: Maybe Text
marker = Maybe Text
a} :: ListKeys)
instance Core.AWSPager ListKeys where
page :: ListKeys -> AWSResponse ListKeys -> Maybe ListKeys
page ListKeys
rq AWSResponse ListKeys
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListKeys
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListKeysResponse (Maybe Bool)
listKeysResponse_truncated
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. Maybe a -> Bool
Prelude.isNothing
( AWSResponse ListKeys
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListKeysResponse (Maybe Text)
listKeysResponse_nextMarker
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
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListKeys
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListKeys (Maybe Text)
listKeys_marker
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListKeys
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListKeysResponse (Maybe Text)
listKeysResponse_nextMarker
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 ListKeys where
type AWSResponse ListKeys = ListKeysResponse
request :: (Service -> Service) -> ListKeys -> Request ListKeys
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 ListKeys
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListKeys)))
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 [KeyListEntry]
-> Maybe Text -> Maybe Bool -> Int -> ListKeysResponse
ListKeysResponse'
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
"Keys" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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
"NextMarker")
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
"Truncated")
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))
)
instance Prelude.Hashable ListKeys where
hashWithSalt :: Int -> ListKeys -> Int
hashWithSalt Int
_salt ListKeys' {Maybe Natural
Maybe Text
marker :: Maybe Text
limit :: Maybe Natural
$sel:marker:ListKeys' :: ListKeys -> Maybe Text
$sel:limit:ListKeys' :: ListKeys -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
instance Prelude.NFData ListKeys where
rnf :: ListKeys -> ()
rnf ListKeys' {Maybe Natural
Maybe Text
marker :: Maybe Text
limit :: Maybe Natural
$sel:marker:ListKeys' :: ListKeys -> Maybe Text
$sel:limit:ListKeys' :: ListKeys -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
instance Data.ToHeaders ListKeys where
toHeaders :: ListKeys -> 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
"TrentService.ListKeys" :: 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 ListKeys where
toJSON :: ListKeys -> Value
toJSON ListKeys' {Maybe Natural
Maybe Text
marker :: Maybe Text
limit :: Maybe Natural
$sel:marker:ListKeys' :: ListKeys -> Maybe Text
$sel:limit:ListKeys' :: ListKeys -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Limit" 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 Natural
limit,
(Key
"Marker" 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
marker
]
)
instance Data.ToPath ListKeys where
toPath :: ListKeys -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListKeys where
toQuery :: ListKeys -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListKeysResponse = ListKeysResponse'
{
ListKeysResponse -> Maybe [KeyListEntry]
keys :: Prelude.Maybe [KeyListEntry],
ListKeysResponse -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
ListKeysResponse -> Maybe Bool
truncated :: Prelude.Maybe Prelude.Bool,
ListKeysResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListKeysResponse -> ListKeysResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListKeysResponse -> ListKeysResponse -> Bool
$c/= :: ListKeysResponse -> ListKeysResponse -> Bool
== :: ListKeysResponse -> ListKeysResponse -> Bool
$c== :: ListKeysResponse -> ListKeysResponse -> Bool
Prelude.Eq, ReadPrec [ListKeysResponse]
ReadPrec ListKeysResponse
Int -> ReadS ListKeysResponse
ReadS [ListKeysResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListKeysResponse]
$creadListPrec :: ReadPrec [ListKeysResponse]
readPrec :: ReadPrec ListKeysResponse
$creadPrec :: ReadPrec ListKeysResponse
readList :: ReadS [ListKeysResponse]
$creadList :: ReadS [ListKeysResponse]
readsPrec :: Int -> ReadS ListKeysResponse
$creadsPrec :: Int -> ReadS ListKeysResponse
Prelude.Read, Int -> ListKeysResponse -> ShowS
[ListKeysResponse] -> ShowS
ListKeysResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListKeysResponse] -> ShowS
$cshowList :: [ListKeysResponse] -> ShowS
show :: ListKeysResponse -> String
$cshow :: ListKeysResponse -> String
showsPrec :: Int -> ListKeysResponse -> ShowS
$cshowsPrec :: Int -> ListKeysResponse -> ShowS
Prelude.Show, forall x. Rep ListKeysResponse x -> ListKeysResponse
forall x. ListKeysResponse -> Rep ListKeysResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListKeysResponse x -> ListKeysResponse
$cfrom :: forall x. ListKeysResponse -> Rep ListKeysResponse x
Prelude.Generic)
newListKeysResponse ::
Prelude.Int ->
ListKeysResponse
newListKeysResponse :: Int -> ListKeysResponse
newListKeysResponse Int
pHttpStatus_ =
ListKeysResponse'
{ $sel:keys:ListKeysResponse' :: Maybe [KeyListEntry]
keys = forall a. Maybe a
Prelude.Nothing,
$sel:nextMarker:ListKeysResponse' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing,
$sel:truncated:ListKeysResponse' :: Maybe Bool
truncated = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListKeysResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listKeysResponse_keys :: Lens.Lens' ListKeysResponse (Prelude.Maybe [KeyListEntry])
listKeysResponse_keys :: Lens' ListKeysResponse (Maybe [KeyListEntry])
listKeysResponse_keys = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeysResponse' {Maybe [KeyListEntry]
keys :: Maybe [KeyListEntry]
$sel:keys:ListKeysResponse' :: ListKeysResponse -> Maybe [KeyListEntry]
keys} -> Maybe [KeyListEntry]
keys) (\s :: ListKeysResponse
s@ListKeysResponse' {} Maybe [KeyListEntry]
a -> ListKeysResponse
s {$sel:keys:ListKeysResponse' :: Maybe [KeyListEntry]
keys = Maybe [KeyListEntry]
a} :: ListKeysResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listKeysResponse_nextMarker :: Lens.Lens' ListKeysResponse (Prelude.Maybe Prelude.Text)
listKeysResponse_nextMarker :: Lens' ListKeysResponse (Maybe Text)
listKeysResponse_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeysResponse' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListKeysResponse' :: ListKeysResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListKeysResponse
s@ListKeysResponse' {} Maybe Text
a -> ListKeysResponse
s {$sel:nextMarker:ListKeysResponse' :: Maybe Text
nextMarker = Maybe Text
a} :: ListKeysResponse)
listKeysResponse_truncated :: Lens.Lens' ListKeysResponse (Prelude.Maybe Prelude.Bool)
listKeysResponse_truncated :: Lens' ListKeysResponse (Maybe Bool)
listKeysResponse_truncated = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeysResponse' {Maybe Bool
truncated :: Maybe Bool
$sel:truncated:ListKeysResponse' :: ListKeysResponse -> Maybe Bool
truncated} -> Maybe Bool
truncated) (\s :: ListKeysResponse
s@ListKeysResponse' {} Maybe Bool
a -> ListKeysResponse
s {$sel:truncated:ListKeysResponse' :: Maybe Bool
truncated = Maybe Bool
a} :: ListKeysResponse)
listKeysResponse_httpStatus :: Lens.Lens' ListKeysResponse Prelude.Int
listKeysResponse_httpStatus :: Lens' ListKeysResponse Int
listKeysResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeysResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListKeysResponse' :: ListKeysResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListKeysResponse
s@ListKeysResponse' {} Int
a -> ListKeysResponse
s {$sel:httpStatus:ListKeysResponse' :: Int
httpStatus = Int
a} :: ListKeysResponse)
instance Prelude.NFData ListKeysResponse where
rnf :: ListKeysResponse -> ()
rnf ListKeysResponse' {Int
Maybe Bool
Maybe [KeyListEntry]
Maybe Text
httpStatus :: Int
truncated :: Maybe Bool
nextMarker :: Maybe Text
keys :: Maybe [KeyListEntry]
$sel:httpStatus:ListKeysResponse' :: ListKeysResponse -> Int
$sel:truncated:ListKeysResponse' :: ListKeysResponse -> Maybe Bool
$sel:nextMarker:ListKeysResponse' :: ListKeysResponse -> Maybe Text
$sel:keys:ListKeysResponse' :: ListKeysResponse -> Maybe [KeyListEntry]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [KeyListEntry]
keys
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextMarker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
truncated
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus