{-# 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.UpdateDeviceStatus
(
UpdateDeviceStatus (..),
newUpdateDeviceStatus,
updateDeviceStatus_deviceRememberedStatus,
updateDeviceStatus_accessToken,
updateDeviceStatus_deviceKey,
UpdateDeviceStatusResponse (..),
newUpdateDeviceStatusResponse,
updateDeviceStatusResponse_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 UpdateDeviceStatus = UpdateDeviceStatus'
{
UpdateDeviceStatus -> Maybe DeviceRememberedStatusType
deviceRememberedStatus :: Prelude.Maybe DeviceRememberedStatusType,
UpdateDeviceStatus -> Sensitive Text
accessToken :: Core.Sensitive Prelude.Text,
UpdateDeviceStatus -> Text
deviceKey :: Prelude.Text
}
deriving (UpdateDeviceStatus -> UpdateDeviceStatus -> Bool
(UpdateDeviceStatus -> UpdateDeviceStatus -> Bool)
-> (UpdateDeviceStatus -> UpdateDeviceStatus -> Bool)
-> Eq UpdateDeviceStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeviceStatus -> UpdateDeviceStatus -> Bool
$c/= :: UpdateDeviceStatus -> UpdateDeviceStatus -> Bool
== :: UpdateDeviceStatus -> UpdateDeviceStatus -> Bool
$c== :: UpdateDeviceStatus -> UpdateDeviceStatus -> Bool
Prelude.Eq, Int -> UpdateDeviceStatus -> ShowS
[UpdateDeviceStatus] -> ShowS
UpdateDeviceStatus -> String
(Int -> UpdateDeviceStatus -> ShowS)
-> (UpdateDeviceStatus -> String)
-> ([UpdateDeviceStatus] -> ShowS)
-> Show UpdateDeviceStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeviceStatus] -> ShowS
$cshowList :: [UpdateDeviceStatus] -> ShowS
show :: UpdateDeviceStatus -> String
$cshow :: UpdateDeviceStatus -> String
showsPrec :: Int -> UpdateDeviceStatus -> ShowS
$cshowsPrec :: Int -> UpdateDeviceStatus -> ShowS
Prelude.Show, (forall x. UpdateDeviceStatus -> Rep UpdateDeviceStatus x)
-> (forall x. Rep UpdateDeviceStatus x -> UpdateDeviceStatus)
-> Generic UpdateDeviceStatus
forall x. Rep UpdateDeviceStatus x -> UpdateDeviceStatus
forall x. UpdateDeviceStatus -> Rep UpdateDeviceStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDeviceStatus x -> UpdateDeviceStatus
$cfrom :: forall x. UpdateDeviceStatus -> Rep UpdateDeviceStatus x
Prelude.Generic)
newUpdateDeviceStatus ::
Prelude.Text ->
Prelude.Text ->
UpdateDeviceStatus
newUpdateDeviceStatus :: Text -> Text -> UpdateDeviceStatus
newUpdateDeviceStatus Text
pAccessToken_ Text
pDeviceKey_ =
UpdateDeviceStatus' :: Maybe DeviceRememberedStatusType
-> Sensitive Text -> Text -> UpdateDeviceStatus
UpdateDeviceStatus'
{ $sel:deviceRememberedStatus:UpdateDeviceStatus' :: Maybe DeviceRememberedStatusType
deviceRememberedStatus =
Maybe DeviceRememberedStatusType
forall a. Maybe a
Prelude.Nothing,
$sel:accessToken:UpdateDeviceStatus' :: 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_,
$sel:deviceKey:UpdateDeviceStatus' :: Text
deviceKey = Text
pDeviceKey_
}
updateDeviceStatus_deviceRememberedStatus :: Lens.Lens' UpdateDeviceStatus (Prelude.Maybe DeviceRememberedStatusType)
updateDeviceStatus_deviceRememberedStatus :: (Maybe DeviceRememberedStatusType
-> f (Maybe DeviceRememberedStatusType))
-> UpdateDeviceStatus -> f UpdateDeviceStatus
updateDeviceStatus_deviceRememberedStatus = (UpdateDeviceStatus -> Maybe DeviceRememberedStatusType)
-> (UpdateDeviceStatus
-> Maybe DeviceRememberedStatusType -> UpdateDeviceStatus)
-> Lens
UpdateDeviceStatus
UpdateDeviceStatus
(Maybe DeviceRememberedStatusType)
(Maybe DeviceRememberedStatusType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceStatus' {Maybe DeviceRememberedStatusType
deviceRememberedStatus :: Maybe DeviceRememberedStatusType
$sel:deviceRememberedStatus:UpdateDeviceStatus' :: UpdateDeviceStatus -> Maybe DeviceRememberedStatusType
deviceRememberedStatus} -> Maybe DeviceRememberedStatusType
deviceRememberedStatus) (\s :: UpdateDeviceStatus
s@UpdateDeviceStatus' {} Maybe DeviceRememberedStatusType
a -> UpdateDeviceStatus
s {$sel:deviceRememberedStatus:UpdateDeviceStatus' :: Maybe DeviceRememberedStatusType
deviceRememberedStatus = Maybe DeviceRememberedStatusType
a} :: UpdateDeviceStatus)
updateDeviceStatus_accessToken :: Lens.Lens' UpdateDeviceStatus Prelude.Text
updateDeviceStatus_accessToken :: (Text -> f Text) -> UpdateDeviceStatus -> f UpdateDeviceStatus
updateDeviceStatus_accessToken = (UpdateDeviceStatus -> Sensitive Text)
-> (UpdateDeviceStatus -> Sensitive Text -> UpdateDeviceStatus)
-> Lens
UpdateDeviceStatus
UpdateDeviceStatus
(Sensitive Text)
(Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceStatus' {Sensitive Text
accessToken :: Sensitive Text
$sel:accessToken:UpdateDeviceStatus' :: UpdateDeviceStatus -> Sensitive Text
accessToken} -> Sensitive Text
accessToken) (\s :: UpdateDeviceStatus
s@UpdateDeviceStatus' {} Sensitive Text
a -> UpdateDeviceStatus
s {$sel:accessToken:UpdateDeviceStatus' :: Sensitive Text
accessToken = Sensitive Text
a} :: UpdateDeviceStatus) ((Sensitive Text -> f (Sensitive Text))
-> UpdateDeviceStatus -> f UpdateDeviceStatus)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> UpdateDeviceStatus
-> f UpdateDeviceStatus
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
updateDeviceStatus_deviceKey :: Lens.Lens' UpdateDeviceStatus Prelude.Text
updateDeviceStatus_deviceKey :: (Text -> f Text) -> UpdateDeviceStatus -> f UpdateDeviceStatus
updateDeviceStatus_deviceKey = (UpdateDeviceStatus -> Text)
-> (UpdateDeviceStatus -> Text -> UpdateDeviceStatus)
-> Lens UpdateDeviceStatus UpdateDeviceStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceStatus' {Text
deviceKey :: Text
$sel:deviceKey:UpdateDeviceStatus' :: UpdateDeviceStatus -> Text
deviceKey} -> Text
deviceKey) (\s :: UpdateDeviceStatus
s@UpdateDeviceStatus' {} Text
a -> UpdateDeviceStatus
s {$sel:deviceKey:UpdateDeviceStatus' :: Text
deviceKey = Text
a} :: UpdateDeviceStatus)
instance Core.AWSRequest UpdateDeviceStatus where
type
AWSResponse UpdateDeviceStatus =
UpdateDeviceStatusResponse
request :: UpdateDeviceStatus -> Request UpdateDeviceStatus
request = Service -> UpdateDeviceStatus -> Request UpdateDeviceStatus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDeviceStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDeviceStatus)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateDeviceStatus))
-> Logger
-> Service
-> Proxy UpdateDeviceStatus
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDeviceStatus)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateDeviceStatusResponse
UpdateDeviceStatusResponse'
(Int -> UpdateDeviceStatusResponse)
-> Either String Int -> Either String UpdateDeviceStatusResponse
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))
)
instance Prelude.Hashable UpdateDeviceStatus
instance Prelude.NFData UpdateDeviceStatus
instance Core.ToHeaders UpdateDeviceStatus where
toHeaders :: UpdateDeviceStatus -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDeviceStatus -> 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.UpdateDeviceStatus" ::
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 UpdateDeviceStatus where
toJSON :: UpdateDeviceStatus -> Value
toJSON UpdateDeviceStatus' {Maybe DeviceRememberedStatusType
Text
Sensitive Text
deviceKey :: Text
accessToken :: Sensitive Text
deviceRememberedStatus :: Maybe DeviceRememberedStatusType
$sel:deviceKey:UpdateDeviceStatus' :: UpdateDeviceStatus -> Text
$sel:accessToken:UpdateDeviceStatus' :: UpdateDeviceStatus -> Sensitive Text
$sel:deviceRememberedStatus:UpdateDeviceStatus' :: UpdateDeviceStatus -> Maybe DeviceRememberedStatusType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DeviceRememberedStatus" Text -> DeviceRememberedStatusType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DeviceRememberedStatusType -> Pair)
-> Maybe DeviceRememberedStatusType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeviceRememberedStatusType
deviceRememberedStatus,
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),
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)
]
)
instance Core.ToPath UpdateDeviceStatus where
toPath :: UpdateDeviceStatus -> ByteString
toPath = ByteString -> UpdateDeviceStatus -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateDeviceStatus where
toQuery :: UpdateDeviceStatus -> QueryString
toQuery = QueryString -> UpdateDeviceStatus -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateDeviceStatusResponse = UpdateDeviceStatusResponse'
{
UpdateDeviceStatusResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateDeviceStatusResponse -> UpdateDeviceStatusResponse -> Bool
(UpdateDeviceStatusResponse -> UpdateDeviceStatusResponse -> Bool)
-> (UpdateDeviceStatusResponse
-> UpdateDeviceStatusResponse -> Bool)
-> Eq UpdateDeviceStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeviceStatusResponse -> UpdateDeviceStatusResponse -> Bool
$c/= :: UpdateDeviceStatusResponse -> UpdateDeviceStatusResponse -> Bool
== :: UpdateDeviceStatusResponse -> UpdateDeviceStatusResponse -> Bool
$c== :: UpdateDeviceStatusResponse -> UpdateDeviceStatusResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDeviceStatusResponse]
ReadPrec UpdateDeviceStatusResponse
Int -> ReadS UpdateDeviceStatusResponse
ReadS [UpdateDeviceStatusResponse]
(Int -> ReadS UpdateDeviceStatusResponse)
-> ReadS [UpdateDeviceStatusResponse]
-> ReadPrec UpdateDeviceStatusResponse
-> ReadPrec [UpdateDeviceStatusResponse]
-> Read UpdateDeviceStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDeviceStatusResponse]
$creadListPrec :: ReadPrec [UpdateDeviceStatusResponse]
readPrec :: ReadPrec UpdateDeviceStatusResponse
$creadPrec :: ReadPrec UpdateDeviceStatusResponse
readList :: ReadS [UpdateDeviceStatusResponse]
$creadList :: ReadS [UpdateDeviceStatusResponse]
readsPrec :: Int -> ReadS UpdateDeviceStatusResponse
$creadsPrec :: Int -> ReadS UpdateDeviceStatusResponse
Prelude.Read, Int -> UpdateDeviceStatusResponse -> ShowS
[UpdateDeviceStatusResponse] -> ShowS
UpdateDeviceStatusResponse -> String
(Int -> UpdateDeviceStatusResponse -> ShowS)
-> (UpdateDeviceStatusResponse -> String)
-> ([UpdateDeviceStatusResponse] -> ShowS)
-> Show UpdateDeviceStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeviceStatusResponse] -> ShowS
$cshowList :: [UpdateDeviceStatusResponse] -> ShowS
show :: UpdateDeviceStatusResponse -> String
$cshow :: UpdateDeviceStatusResponse -> String
showsPrec :: Int -> UpdateDeviceStatusResponse -> ShowS
$cshowsPrec :: Int -> UpdateDeviceStatusResponse -> ShowS
Prelude.Show, (forall x.
UpdateDeviceStatusResponse -> Rep UpdateDeviceStatusResponse x)
-> (forall x.
Rep UpdateDeviceStatusResponse x -> UpdateDeviceStatusResponse)
-> Generic UpdateDeviceStatusResponse
forall x.
Rep UpdateDeviceStatusResponse x -> UpdateDeviceStatusResponse
forall x.
UpdateDeviceStatusResponse -> Rep UpdateDeviceStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDeviceStatusResponse x -> UpdateDeviceStatusResponse
$cfrom :: forall x.
UpdateDeviceStatusResponse -> Rep UpdateDeviceStatusResponse x
Prelude.Generic)
newUpdateDeviceStatusResponse ::
Prelude.Int ->
UpdateDeviceStatusResponse
newUpdateDeviceStatusResponse :: Int -> UpdateDeviceStatusResponse
newUpdateDeviceStatusResponse Int
pHttpStatus_ =
UpdateDeviceStatusResponse' :: Int -> UpdateDeviceStatusResponse
UpdateDeviceStatusResponse'
{ $sel:httpStatus:UpdateDeviceStatusResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateDeviceStatusResponse_httpStatus :: Lens.Lens' UpdateDeviceStatusResponse Prelude.Int
updateDeviceStatusResponse_httpStatus :: (Int -> f Int)
-> UpdateDeviceStatusResponse -> f UpdateDeviceStatusResponse
updateDeviceStatusResponse_httpStatus = (UpdateDeviceStatusResponse -> Int)
-> (UpdateDeviceStatusResponse
-> Int -> UpdateDeviceStatusResponse)
-> Lens
UpdateDeviceStatusResponse UpdateDeviceStatusResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceStatusResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDeviceStatusResponse' :: UpdateDeviceStatusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateDeviceStatusResponse
s@UpdateDeviceStatusResponse' {} Int
a -> UpdateDeviceStatusResponse
s {$sel:httpStatus:UpdateDeviceStatusResponse' :: Int
httpStatus = Int
a} :: UpdateDeviceStatusResponse)
instance Prelude.NFData UpdateDeviceStatusResponse