{-# 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_limit,
listDevices_paginationToken,
listDevices_accessToken,
ListDevicesResponse (..),
newListDevicesResponse,
listDevicesResponse_devices,
listDevicesResponse_paginationToken,
listDevicesResponse_httpStatus,
)
where
import Amazonka.CognitoIdentityProvider.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 ListDevices = ListDevices'
{
ListDevices -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
:: Prelude.Maybe Prelude.Text,
ListDevices -> Sensitive Text
accessToken :: Data.Sensitive Prelude.Text
}
deriving (ListDevices -> ListDevices -> Bool
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
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. 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'
{ $sel:limit:ListDevices' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
$sel:paginationToken:ListDevices' :: Maybe Text
paginationToken = forall a. Maybe a
Prelude.Nothing,
$sel:accessToken:ListDevices' :: Sensitive Text
accessToken = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pAccessToken_
}
listDevices_limit :: Lens.Lens' ListDevices (Prelude.Maybe Prelude.Natural)
listDevices_limit :: Lens' ListDevices (Maybe Natural)
listDevices_limit = 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_paginationToken :: Lens.Lens' ListDevices (Prelude.Maybe Prelude.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_accessToken :: Lens.Lens' ListDevices Prelude.Text
listDevices_accessToken :: Lens' ListDevices Text
listDevices_accessToken = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Core.AWSRequest ListDevices where
type AWSResponse ListDevices = ListDevicesResponse
request :: (Service -> Service) -> ListDevices -> Request ListDevices
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 ListDevices
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDevices)))
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 [DeviceType] -> Maybe Text -> Int -> ListDevicesResponse
ListDevicesResponse'
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
"Devices" 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
"PaginationToken")
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 ListDevices where
hashWithSalt :: Int -> ListDevices -> Int
hashWithSalt Int
_salt ListDevices' {Maybe Natural
Maybe Text
Sensitive Text
accessToken :: Sensitive Text
paginationToken :: Maybe Text
limit :: Maybe Natural
$sel:accessToken:ListDevices' :: ListDevices -> Sensitive Text
$sel:paginationToken:ListDevices' :: ListDevices -> Maybe Text
$sel:limit:ListDevices' :: ListDevices -> 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
paginationToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
accessToken
instance Prelude.NFData ListDevices where
rnf :: ListDevices -> ()
rnf ListDevices' {Maybe Natural
Maybe Text
Sensitive Text
accessToken :: Sensitive Text
paginationToken :: Maybe Text
limit :: Maybe Natural
$sel:accessToken:ListDevices' :: ListDevices -> Sensitive Text
$sel:paginationToken:ListDevices' :: ListDevices -> Maybe Text
$sel:limit:ListDevices' :: ListDevices -> 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
paginationToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
accessToken
instance Data.ToHeaders ListDevices where
toHeaders :: ListDevices -> 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
"AWSCognitoIdentityProviderService.ListDevices" ::
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 ListDevices where
toJSON :: ListDevices -> Value
toJSON ListDevices' {Maybe Natural
Maybe Text
Sensitive Text
accessToken :: Sensitive Text
paginationToken :: Maybe Text
limit :: Maybe Natural
$sel:accessToken:ListDevices' :: ListDevices -> Sensitive Text
$sel:paginationToken:ListDevices' :: ListDevices -> Maybe Text
$sel:limit:ListDevices' :: ListDevices -> 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
"PaginationToken" 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
paginationToken,
forall a. a -> Maybe a
Prelude.Just (Key
"AccessToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
accessToken)
]
)
instance Data.ToPath ListDevices where
toPath :: ListDevices -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListDevices where
toQuery :: ListDevices -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListDevicesResponse = ListDevicesResponse'
{
ListDevicesResponse -> Maybe [DeviceType]
devices :: Prelude.Maybe [DeviceType],
:: Prelude.Maybe Prelude.Text,
ListDevicesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListDevicesResponse -> ListDevicesResponse -> Bool
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
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. 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'
{ $sel:devices:ListDevicesResponse' :: Maybe [DeviceType]
devices = forall a. Maybe a
Prelude.Nothing,
$sel:paginationToken:ListDevicesResponse' :: Maybe Text
paginationToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDevicesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listDevicesResponse_devices :: Lens.Lens' ListDevicesResponse (Prelude.Maybe [DeviceType])
listDevicesResponse_devices :: Lens' ListDevicesResponse (Maybe [DeviceType])
listDevicesResponse_devices = 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) 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
listDevicesResponse_paginationToken :: Lens.Lens' ListDevicesResponse (Prelude.Maybe Prelude.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_httpStatus :: Lens.Lens' ListDevicesResponse Prelude.Int
listDevicesResponse_httpStatus :: Lens' ListDevicesResponse Int
listDevicesResponse_httpStatus = 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 where
rnf :: ListDevicesResponse -> ()
rnf ListDevicesResponse' {Int
Maybe [DeviceType]
Maybe Text
httpStatus :: Int
paginationToken :: Maybe Text
devices :: Maybe [DeviceType]
$sel:httpStatus:ListDevicesResponse' :: ListDevicesResponse -> Int
$sel:paginationToken:ListDevicesResponse' :: ListDevicesResponse -> Maybe Text
$sel:devices:ListDevicesResponse' :: ListDevicesResponse -> Maybe [DeviceType]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [DeviceType]
devices
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
paginationToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus