{-# 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.CognitoIdentityProvider.ListDevices
(
ListDevices (..),
newListDevices,
listDevices_paginationToken,
listDevices_limit,
listDevices_accessToken,
ListDevicesResponse (..),
newListDevicesResponse,
listDevicesResponse_paginationToken,
listDevicesResponse_devices,
listDevicesResponse_httpStatus,
)
where
import Amazonka.CognitoIdentityProvider.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 ListDevices = ListDevices'
{
:: Prelude.Maybe Prelude.Text,
ListDevices -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
ListDevices -> Sensitive Text
accessToken :: Core.Sensitive Prelude.Text
}
deriving (ListDevices -> ListDevices -> Bool
(ListDevices -> ListDevices -> Bool)
-> (ListDevices -> ListDevices -> Bool) -> Eq ListDevices
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDevices -> ListDevices -> Bool
$c/= :: ListDevices -> ListDevices -> Bool
== :: ListDevices -> ListDevices -> Bool
$c== :: ListDevices -> ListDevices -> Bool
Prelude.Eq, Int -> ListDevices -> ShowS
[ListDevices] -> ShowS
ListDevices -> String
(Int -> ListDevices -> ShowS)
-> (ListDevices -> String)
-> ([ListDevices] -> ShowS)
-> Show ListDevices
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDevices] -> ShowS
$cshowList :: [ListDevices] -> ShowS
show :: ListDevices -> String
$cshow :: ListDevices -> String
showsPrec :: Int -> ListDevices -> ShowS
$cshowsPrec :: Int -> ListDevices -> ShowS
Prelude.Show, (forall x. ListDevices -> Rep ListDevices x)
-> (forall x. Rep ListDevices x -> ListDevices)
-> Generic ListDevices
forall x. Rep ListDevices x -> ListDevices
forall x. ListDevices -> Rep ListDevices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDevices x -> ListDevices
$cfrom :: forall x. ListDevices -> Rep ListDevices x
Prelude.Generic)
newListDevices ::
Prelude.Text ->
ListDevices
newListDevices :: Text -> ListDevices
newListDevices Text
pAccessToken_ =
ListDevices' :: Maybe Text -> Maybe Natural -> Sensitive Text -> ListDevices
ListDevices'
{ $sel:paginationToken:ListDevices' :: Maybe Text
paginationToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:limit:ListDevices' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:accessToken:ListDevices' :: Sensitive Text
accessToken = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pAccessToken_
}
listDevices_paginationToken :: Lens.Lens' ListDevices (Prelude.Maybe Prelude.Text)
= (ListDevices -> Maybe Text)
-> (ListDevices -> Maybe Text -> ListDevices)
-> Lens ListDevices ListDevices (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevices' {Maybe Text
paginationToken :: Maybe Text
$sel:paginationToken:ListDevices' :: ListDevices -> Maybe Text
paginationToken} -> Maybe Text
paginationToken) (\s :: ListDevices
s@ListDevices' {} Maybe Text
a -> ListDevices
s {$sel:paginationToken:ListDevices' :: Maybe Text
paginationToken = Maybe Text
a} :: ListDevices)
listDevices_limit :: Lens.Lens' ListDevices (Prelude.Maybe Prelude.Natural)
listDevices_limit :: (Maybe Natural -> f (Maybe Natural))
-> ListDevices -> f ListDevices
listDevices_limit = (ListDevices -> Maybe Natural)
-> (ListDevices -> Maybe Natural -> ListDevices)
-> Lens ListDevices ListDevices (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevices' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListDevices' :: ListDevices -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListDevices
s@ListDevices' {} Maybe Natural
a -> ListDevices
s {$sel:limit:ListDevices' :: Maybe Natural
limit = Maybe Natural
a} :: ListDevices)
listDevices_accessToken :: Lens.Lens' ListDevices Prelude.Text
listDevices_accessToken :: (Text -> f Text) -> ListDevices -> f ListDevices
listDevices_accessToken = (ListDevices -> Sensitive Text)
-> (ListDevices -> Sensitive Text -> ListDevices)
-> Lens ListDevices ListDevices (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevices' {Sensitive Text
accessToken :: Sensitive Text
$sel:accessToken:ListDevices' :: ListDevices -> Sensitive Text
accessToken} -> Sensitive Text
accessToken) (\s :: ListDevices
s@ListDevices' {} Sensitive Text
a -> ListDevices
s {$sel:accessToken:ListDevices' :: Sensitive Text
accessToken = Sensitive Text
a} :: ListDevices) ((Sensitive Text -> f (Sensitive Text))
-> ListDevices -> f ListDevices)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> ListDevices
-> f ListDevices
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
instance Core.AWSRequest ListDevices where
type AWSResponse ListDevices = ListDevicesResponse
request :: ListDevices -> Request ListDevices
request = Service -> ListDevices -> Request ListDevices
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListDevices
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDevices)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListDevices))
-> Logger
-> Service
-> Proxy ListDevices
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDevices)))
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 [DeviceType] -> Int -> ListDevicesResponse
ListDevicesResponse'
(Maybe Text -> Maybe [DeviceType] -> Int -> ListDevicesResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [DeviceType] -> Int -> ListDevicesResponse)
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
"PaginationToken")
Either String (Maybe [DeviceType] -> Int -> ListDevicesResponse)
-> Either String (Maybe [DeviceType])
-> Either String (Int -> ListDevicesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [DeviceType]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Devices" Either String (Maybe (Maybe [DeviceType]))
-> Maybe [DeviceType] -> Either String (Maybe [DeviceType])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DeviceType]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListDevicesResponse)
-> Either String Int -> Either String ListDevicesResponse
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 ListDevices
instance Prelude.NFData ListDevices
instance Core.ToHeaders ListDevices where
toHeaders :: ListDevices -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListDevices -> 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
"AWSCognitoIdentityProviderService.ListDevices" ::
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 ListDevices where
toJSON :: ListDevices -> Value
toJSON ListDevices' {Maybe Natural
Maybe Text
Sensitive Text
accessToken :: Sensitive Text
limit :: Maybe Natural
paginationToken :: Maybe Text
$sel:accessToken:ListDevices' :: ListDevices -> Sensitive Text
$sel:limit:ListDevices' :: ListDevices -> Maybe Natural
$sel:paginationToken:ListDevices' :: ListDevices -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PaginationToken" 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
paginationToken,
(Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AccessToken" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
accessToken)
]
)
instance Core.ToPath ListDevices where
toPath :: ListDevices -> ByteString
toPath = ByteString -> ListDevices -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListDevices where
toQuery :: ListDevices -> QueryString
toQuery = QueryString -> ListDevices -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListDevicesResponse = ListDevicesResponse'
{
:: Prelude.Maybe Prelude.Text,
ListDevicesResponse -> Maybe [DeviceType]
devices :: Prelude.Maybe [DeviceType],
ListDevicesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListDevicesResponse -> ListDevicesResponse -> Bool
(ListDevicesResponse -> ListDevicesResponse -> Bool)
-> (ListDevicesResponse -> ListDevicesResponse -> Bool)
-> Eq ListDevicesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDevicesResponse -> ListDevicesResponse -> Bool
$c/= :: ListDevicesResponse -> ListDevicesResponse -> Bool
== :: ListDevicesResponse -> ListDevicesResponse -> Bool
$c== :: ListDevicesResponse -> ListDevicesResponse -> Bool
Prelude.Eq, Int -> ListDevicesResponse -> ShowS
[ListDevicesResponse] -> ShowS
ListDevicesResponse -> String
(Int -> ListDevicesResponse -> ShowS)
-> (ListDevicesResponse -> String)
-> ([ListDevicesResponse] -> ShowS)
-> Show ListDevicesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDevicesResponse] -> ShowS
$cshowList :: [ListDevicesResponse] -> ShowS
show :: ListDevicesResponse -> String
$cshow :: ListDevicesResponse -> String
showsPrec :: Int -> ListDevicesResponse -> ShowS
$cshowsPrec :: Int -> ListDevicesResponse -> ShowS
Prelude.Show, (forall x. ListDevicesResponse -> Rep ListDevicesResponse x)
-> (forall x. Rep ListDevicesResponse x -> ListDevicesResponse)
-> Generic ListDevicesResponse
forall x. Rep ListDevicesResponse x -> ListDevicesResponse
forall x. ListDevicesResponse -> Rep ListDevicesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDevicesResponse x -> ListDevicesResponse
$cfrom :: forall x. ListDevicesResponse -> Rep ListDevicesResponse x
Prelude.Generic)
newListDevicesResponse ::
Prelude.Int ->
ListDevicesResponse
newListDevicesResponse :: Int -> ListDevicesResponse
newListDevicesResponse Int
pHttpStatus_ =
ListDevicesResponse' :: Maybe Text -> Maybe [DeviceType] -> Int -> ListDevicesResponse
ListDevicesResponse'
{ $sel:paginationToken:ListDevicesResponse' :: Maybe Text
paginationToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:devices:ListDevicesResponse' :: Maybe [DeviceType]
devices = Maybe [DeviceType]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDevicesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listDevicesResponse_paginationToken :: Lens.Lens' ListDevicesResponse (Prelude.Maybe Prelude.Text)
= (ListDevicesResponse -> Maybe Text)
-> (ListDevicesResponse -> Maybe Text -> ListDevicesResponse)
-> Lens
ListDevicesResponse ListDevicesResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicesResponse' {Maybe Text
paginationToken :: Maybe Text
$sel:paginationToken:ListDevicesResponse' :: ListDevicesResponse -> Maybe Text
paginationToken} -> Maybe Text
paginationToken) (\s :: ListDevicesResponse
s@ListDevicesResponse' {} Maybe Text
a -> ListDevicesResponse
s {$sel:paginationToken:ListDevicesResponse' :: Maybe Text
paginationToken = Maybe Text
a} :: ListDevicesResponse)
listDevicesResponse_devices :: Lens.Lens' ListDevicesResponse (Prelude.Maybe [DeviceType])
listDevicesResponse_devices :: (Maybe [DeviceType] -> f (Maybe [DeviceType]))
-> ListDevicesResponse -> f ListDevicesResponse
listDevicesResponse_devices = (ListDevicesResponse -> Maybe [DeviceType])
-> (ListDevicesResponse
-> Maybe [DeviceType] -> ListDevicesResponse)
-> Lens
ListDevicesResponse
ListDevicesResponse
(Maybe [DeviceType])
(Maybe [DeviceType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicesResponse' {Maybe [DeviceType]
devices :: Maybe [DeviceType]
$sel:devices:ListDevicesResponse' :: ListDevicesResponse -> Maybe [DeviceType]
devices} -> Maybe [DeviceType]
devices) (\s :: ListDevicesResponse
s@ListDevicesResponse' {} Maybe [DeviceType]
a -> ListDevicesResponse
s {$sel:devices:ListDevicesResponse' :: Maybe [DeviceType]
devices = Maybe [DeviceType]
a} :: ListDevicesResponse) ((Maybe [DeviceType] -> f (Maybe [DeviceType]))
-> ListDevicesResponse -> f ListDevicesResponse)
-> ((Maybe [DeviceType] -> f (Maybe [DeviceType]))
-> Maybe [DeviceType] -> f (Maybe [DeviceType]))
-> (Maybe [DeviceType] -> f (Maybe [DeviceType]))
-> ListDevicesResponse
-> f ListDevicesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [DeviceType] [DeviceType] [DeviceType] [DeviceType]
-> Iso
(Maybe [DeviceType])
(Maybe [DeviceType])
(Maybe [DeviceType])
(Maybe [DeviceType])
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 [DeviceType] [DeviceType] [DeviceType] [DeviceType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listDevicesResponse_httpStatus :: Lens.Lens' ListDevicesResponse Prelude.Int
listDevicesResponse_httpStatus :: (Int -> f Int) -> ListDevicesResponse -> f ListDevicesResponse
listDevicesResponse_httpStatus = (ListDevicesResponse -> Int)
-> (ListDevicesResponse -> Int -> ListDevicesResponse)
-> Lens ListDevicesResponse ListDevicesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDevicesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDevicesResponse' :: ListDevicesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDevicesResponse
s@ListDevicesResponse' {} Int
a -> ListDevicesResponse
s {$sel:httpStatus:ListDevicesResponse' :: Int
httpStatus = Int
a} :: ListDevicesResponse)
instance Prelude.NFData ListDevicesResponse