{-# 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.AdminGetDevice
(
AdminGetDevice (..),
newAdminGetDevice,
adminGetDevice_deviceKey,
adminGetDevice_userPoolId,
adminGetDevice_username,
AdminGetDeviceResponse (..),
newAdminGetDeviceResponse,
adminGetDeviceResponse_httpStatus,
adminGetDeviceResponse_device,
)
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 AdminGetDevice = AdminGetDevice'
{
AdminGetDevice -> Text
deviceKey :: Prelude.Text,
AdminGetDevice -> Text
userPoolId :: Prelude.Text,
AdminGetDevice -> Sensitive Text
username :: Core.Sensitive Prelude.Text
}
deriving (AdminGetDevice -> AdminGetDevice -> Bool
(AdminGetDevice -> AdminGetDevice -> Bool)
-> (AdminGetDevice -> AdminGetDevice -> Bool) -> Eq AdminGetDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminGetDevice -> AdminGetDevice -> Bool
$c/= :: AdminGetDevice -> AdminGetDevice -> Bool
== :: AdminGetDevice -> AdminGetDevice -> Bool
$c== :: AdminGetDevice -> AdminGetDevice -> Bool
Prelude.Eq, Int -> AdminGetDevice -> ShowS
[AdminGetDevice] -> ShowS
AdminGetDevice -> String
(Int -> AdminGetDevice -> ShowS)
-> (AdminGetDevice -> String)
-> ([AdminGetDevice] -> ShowS)
-> Show AdminGetDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminGetDevice] -> ShowS
$cshowList :: [AdminGetDevice] -> ShowS
show :: AdminGetDevice -> String
$cshow :: AdminGetDevice -> String
showsPrec :: Int -> AdminGetDevice -> ShowS
$cshowsPrec :: Int -> AdminGetDevice -> ShowS
Prelude.Show, (forall x. AdminGetDevice -> Rep AdminGetDevice x)
-> (forall x. Rep AdminGetDevice x -> AdminGetDevice)
-> Generic AdminGetDevice
forall x. Rep AdminGetDevice x -> AdminGetDevice
forall x. AdminGetDevice -> Rep AdminGetDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdminGetDevice x -> AdminGetDevice
$cfrom :: forall x. AdminGetDevice -> Rep AdminGetDevice x
Prelude.Generic)
newAdminGetDevice ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
AdminGetDevice
newAdminGetDevice :: Text -> Text -> Text -> AdminGetDevice
newAdminGetDevice Text
pDeviceKey_ Text
pUserPoolId_ Text
pUsername_ =
AdminGetDevice' :: Text -> Text -> Sensitive Text -> AdminGetDevice
AdminGetDevice'
{ $sel:deviceKey:AdminGetDevice' :: Text
deviceKey = Text
pDeviceKey_,
$sel:userPoolId:AdminGetDevice' :: Text
userPoolId = Text
pUserPoolId_,
$sel:username:AdminGetDevice' :: Sensitive Text
username = 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
pUsername_
}
adminGetDevice_deviceKey :: Lens.Lens' AdminGetDevice Prelude.Text
adminGetDevice_deviceKey :: (Text -> f Text) -> AdminGetDevice -> f AdminGetDevice
adminGetDevice_deviceKey = (AdminGetDevice -> Text)
-> (AdminGetDevice -> Text -> AdminGetDevice)
-> Lens AdminGetDevice AdminGetDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminGetDevice' {Text
deviceKey :: Text
$sel:deviceKey:AdminGetDevice' :: AdminGetDevice -> Text
deviceKey} -> Text
deviceKey) (\s :: AdminGetDevice
s@AdminGetDevice' {} Text
a -> AdminGetDevice
s {$sel:deviceKey:AdminGetDevice' :: Text
deviceKey = Text
a} :: AdminGetDevice)
adminGetDevice_userPoolId :: Lens.Lens' AdminGetDevice Prelude.Text
adminGetDevice_userPoolId :: (Text -> f Text) -> AdminGetDevice -> f AdminGetDevice
adminGetDevice_userPoolId = (AdminGetDevice -> Text)
-> (AdminGetDevice -> Text -> AdminGetDevice)
-> Lens AdminGetDevice AdminGetDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminGetDevice' {Text
userPoolId :: Text
$sel:userPoolId:AdminGetDevice' :: AdminGetDevice -> Text
userPoolId} -> Text
userPoolId) (\s :: AdminGetDevice
s@AdminGetDevice' {} Text
a -> AdminGetDevice
s {$sel:userPoolId:AdminGetDevice' :: Text
userPoolId = Text
a} :: AdminGetDevice)
adminGetDevice_username :: Lens.Lens' AdminGetDevice Prelude.Text
adminGetDevice_username :: (Text -> f Text) -> AdminGetDevice -> f AdminGetDevice
adminGetDevice_username = (AdminGetDevice -> Sensitive Text)
-> (AdminGetDevice -> Sensitive Text -> AdminGetDevice)
-> Lens
AdminGetDevice AdminGetDevice (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminGetDevice' {Sensitive Text
username :: Sensitive Text
$sel:username:AdminGetDevice' :: AdminGetDevice -> Sensitive Text
username} -> Sensitive Text
username) (\s :: AdminGetDevice
s@AdminGetDevice' {} Sensitive Text
a -> AdminGetDevice
s {$sel:username:AdminGetDevice' :: Sensitive Text
username = Sensitive Text
a} :: AdminGetDevice) ((Sensitive Text -> f (Sensitive Text))
-> AdminGetDevice -> f AdminGetDevice)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> AdminGetDevice
-> f AdminGetDevice
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 AdminGetDevice where
type
AWSResponse AdminGetDevice =
AdminGetDeviceResponse
request :: AdminGetDevice -> Request AdminGetDevice
request = Service -> AdminGetDevice -> Request AdminGetDevice
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AdminGetDevice
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AdminGetDevice)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AdminGetDevice))
-> Logger
-> Service
-> Proxy AdminGetDevice
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AdminGetDevice)))
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 ->
Int -> DeviceType -> AdminGetDeviceResponse
AdminGetDeviceResponse'
(Int -> DeviceType -> AdminGetDeviceResponse)
-> Either String Int
-> Either String (DeviceType -> AdminGetDeviceResponse)
forall (f :: * -> *) a b. Functor 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 (DeviceType -> AdminGetDeviceResponse)
-> Either String DeviceType -> Either String AdminGetDeviceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String DeviceType
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Device")
)
instance Prelude.Hashable AdminGetDevice
instance Prelude.NFData AdminGetDevice
instance Core.ToHeaders AdminGetDevice where
toHeaders :: AdminGetDevice -> ResponseHeaders
toHeaders =
ResponseHeaders -> AdminGetDevice -> 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.AdminGetDevice" ::
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 AdminGetDevice where
toJSON :: AdminGetDevice -> Value
toJSON AdminGetDevice' {Text
Sensitive Text
username :: Sensitive Text
userPoolId :: Text
deviceKey :: Text
$sel:username:AdminGetDevice' :: AdminGetDevice -> Sensitive Text
$sel:userPoolId:AdminGetDevice' :: AdminGetDevice -> Text
$sel:deviceKey:AdminGetDevice' :: AdminGetDevice -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DeviceKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deviceKey),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Username" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
username)
]
)
instance Core.ToPath AdminGetDevice where
toPath :: AdminGetDevice -> ByteString
toPath = ByteString -> AdminGetDevice -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AdminGetDevice where
toQuery :: AdminGetDevice -> QueryString
toQuery = QueryString -> AdminGetDevice -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AdminGetDeviceResponse = AdminGetDeviceResponse'
{
AdminGetDeviceResponse -> Int
httpStatus :: Prelude.Int,
AdminGetDeviceResponse -> DeviceType
device :: DeviceType
}
deriving (AdminGetDeviceResponse -> AdminGetDeviceResponse -> Bool
(AdminGetDeviceResponse -> AdminGetDeviceResponse -> Bool)
-> (AdminGetDeviceResponse -> AdminGetDeviceResponse -> Bool)
-> Eq AdminGetDeviceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AdminGetDeviceResponse -> AdminGetDeviceResponse -> Bool
$c/= :: AdminGetDeviceResponse -> AdminGetDeviceResponse -> Bool
== :: AdminGetDeviceResponse -> AdminGetDeviceResponse -> Bool
$c== :: AdminGetDeviceResponse -> AdminGetDeviceResponse -> Bool
Prelude.Eq, Int -> AdminGetDeviceResponse -> ShowS
[AdminGetDeviceResponse] -> ShowS
AdminGetDeviceResponse -> String
(Int -> AdminGetDeviceResponse -> ShowS)
-> (AdminGetDeviceResponse -> String)
-> ([AdminGetDeviceResponse] -> ShowS)
-> Show AdminGetDeviceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AdminGetDeviceResponse] -> ShowS
$cshowList :: [AdminGetDeviceResponse] -> ShowS
show :: AdminGetDeviceResponse -> String
$cshow :: AdminGetDeviceResponse -> String
showsPrec :: Int -> AdminGetDeviceResponse -> ShowS
$cshowsPrec :: Int -> AdminGetDeviceResponse -> ShowS
Prelude.Show, (forall x. AdminGetDeviceResponse -> Rep AdminGetDeviceResponse x)
-> (forall x.
Rep AdminGetDeviceResponse x -> AdminGetDeviceResponse)
-> Generic AdminGetDeviceResponse
forall x. Rep AdminGetDeviceResponse x -> AdminGetDeviceResponse
forall x. AdminGetDeviceResponse -> Rep AdminGetDeviceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AdminGetDeviceResponse x -> AdminGetDeviceResponse
$cfrom :: forall x. AdminGetDeviceResponse -> Rep AdminGetDeviceResponse x
Prelude.Generic)
newAdminGetDeviceResponse ::
Prelude.Int ->
DeviceType ->
AdminGetDeviceResponse
newAdminGetDeviceResponse :: Int -> DeviceType -> AdminGetDeviceResponse
newAdminGetDeviceResponse Int
pHttpStatus_ DeviceType
pDevice_ =
AdminGetDeviceResponse' :: Int -> DeviceType -> AdminGetDeviceResponse
AdminGetDeviceResponse'
{ $sel:httpStatus:AdminGetDeviceResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:device:AdminGetDeviceResponse' :: DeviceType
device = DeviceType
pDevice_
}
adminGetDeviceResponse_httpStatus :: Lens.Lens' AdminGetDeviceResponse Prelude.Int
adminGetDeviceResponse_httpStatus :: (Int -> f Int)
-> AdminGetDeviceResponse -> f AdminGetDeviceResponse
adminGetDeviceResponse_httpStatus = (AdminGetDeviceResponse -> Int)
-> (AdminGetDeviceResponse -> Int -> AdminGetDeviceResponse)
-> Lens AdminGetDeviceResponse AdminGetDeviceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminGetDeviceResponse' {Int
httpStatus :: Int
$sel:httpStatus:AdminGetDeviceResponse' :: AdminGetDeviceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AdminGetDeviceResponse
s@AdminGetDeviceResponse' {} Int
a -> AdminGetDeviceResponse
s {$sel:httpStatus:AdminGetDeviceResponse' :: Int
httpStatus = Int
a} :: AdminGetDeviceResponse)
adminGetDeviceResponse_device :: Lens.Lens' AdminGetDeviceResponse DeviceType
adminGetDeviceResponse_device :: (DeviceType -> f DeviceType)
-> AdminGetDeviceResponse -> f AdminGetDeviceResponse
adminGetDeviceResponse_device = (AdminGetDeviceResponse -> DeviceType)
-> (AdminGetDeviceResponse -> DeviceType -> AdminGetDeviceResponse)
-> Lens
AdminGetDeviceResponse AdminGetDeviceResponse DeviceType DeviceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AdminGetDeviceResponse' {DeviceType
device :: DeviceType
$sel:device:AdminGetDeviceResponse' :: AdminGetDeviceResponse -> DeviceType
device} -> DeviceType
device) (\s :: AdminGetDeviceResponse
s@AdminGetDeviceResponse' {} DeviceType
a -> AdminGetDeviceResponse
s {$sel:device:AdminGetDeviceResponse' :: DeviceType
device = DeviceType
a} :: AdminGetDeviceResponse)
instance Prelude.NFData AdminGetDeviceResponse