{-# 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.IoT1ClickDevices.FinalizeDeviceClaim
(
FinalizeDeviceClaim (..),
newFinalizeDeviceClaim,
finalizeDeviceClaim_tags,
finalizeDeviceClaim_deviceId,
FinalizeDeviceClaimResponse (..),
newFinalizeDeviceClaimResponse,
finalizeDeviceClaimResponse_state,
finalizeDeviceClaimResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT1ClickDevices.Types
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 FinalizeDeviceClaim = FinalizeDeviceClaim'
{
FinalizeDeviceClaim -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
FinalizeDeviceClaim -> Text
deviceId :: Prelude.Text
}
deriving (FinalizeDeviceClaim -> FinalizeDeviceClaim -> Bool
(FinalizeDeviceClaim -> FinalizeDeviceClaim -> Bool)
-> (FinalizeDeviceClaim -> FinalizeDeviceClaim -> Bool)
-> Eq FinalizeDeviceClaim
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FinalizeDeviceClaim -> FinalizeDeviceClaim -> Bool
$c/= :: FinalizeDeviceClaim -> FinalizeDeviceClaim -> Bool
== :: FinalizeDeviceClaim -> FinalizeDeviceClaim -> Bool
$c== :: FinalizeDeviceClaim -> FinalizeDeviceClaim -> Bool
Prelude.Eq, ReadPrec [FinalizeDeviceClaim]
ReadPrec FinalizeDeviceClaim
Int -> ReadS FinalizeDeviceClaim
ReadS [FinalizeDeviceClaim]
(Int -> ReadS FinalizeDeviceClaim)
-> ReadS [FinalizeDeviceClaim]
-> ReadPrec FinalizeDeviceClaim
-> ReadPrec [FinalizeDeviceClaim]
-> Read FinalizeDeviceClaim
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FinalizeDeviceClaim]
$creadListPrec :: ReadPrec [FinalizeDeviceClaim]
readPrec :: ReadPrec FinalizeDeviceClaim
$creadPrec :: ReadPrec FinalizeDeviceClaim
readList :: ReadS [FinalizeDeviceClaim]
$creadList :: ReadS [FinalizeDeviceClaim]
readsPrec :: Int -> ReadS FinalizeDeviceClaim
$creadsPrec :: Int -> ReadS FinalizeDeviceClaim
Prelude.Read, Int -> FinalizeDeviceClaim -> ShowS
[FinalizeDeviceClaim] -> ShowS
FinalizeDeviceClaim -> String
(Int -> FinalizeDeviceClaim -> ShowS)
-> (FinalizeDeviceClaim -> String)
-> ([FinalizeDeviceClaim] -> ShowS)
-> Show FinalizeDeviceClaim
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FinalizeDeviceClaim] -> ShowS
$cshowList :: [FinalizeDeviceClaim] -> ShowS
show :: FinalizeDeviceClaim -> String
$cshow :: FinalizeDeviceClaim -> String
showsPrec :: Int -> FinalizeDeviceClaim -> ShowS
$cshowsPrec :: Int -> FinalizeDeviceClaim -> ShowS
Prelude.Show, (forall x. FinalizeDeviceClaim -> Rep FinalizeDeviceClaim x)
-> (forall x. Rep FinalizeDeviceClaim x -> FinalizeDeviceClaim)
-> Generic FinalizeDeviceClaim
forall x. Rep FinalizeDeviceClaim x -> FinalizeDeviceClaim
forall x. FinalizeDeviceClaim -> Rep FinalizeDeviceClaim x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FinalizeDeviceClaim x -> FinalizeDeviceClaim
$cfrom :: forall x. FinalizeDeviceClaim -> Rep FinalizeDeviceClaim x
Prelude.Generic)
newFinalizeDeviceClaim ::
Prelude.Text ->
FinalizeDeviceClaim
newFinalizeDeviceClaim :: Text -> FinalizeDeviceClaim
newFinalizeDeviceClaim Text
pDeviceId_ =
FinalizeDeviceClaim' :: Maybe (HashMap Text Text) -> Text -> FinalizeDeviceClaim
FinalizeDeviceClaim'
{ $sel:tags:FinalizeDeviceClaim' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:deviceId:FinalizeDeviceClaim' :: Text
deviceId = Text
pDeviceId_
}
finalizeDeviceClaim_tags :: Lens.Lens' FinalizeDeviceClaim (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
finalizeDeviceClaim_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> FinalizeDeviceClaim -> f FinalizeDeviceClaim
finalizeDeviceClaim_tags = (FinalizeDeviceClaim -> Maybe (HashMap Text Text))
-> (FinalizeDeviceClaim
-> Maybe (HashMap Text Text) -> FinalizeDeviceClaim)
-> Lens
FinalizeDeviceClaim
FinalizeDeviceClaim
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinalizeDeviceClaim' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:FinalizeDeviceClaim' :: FinalizeDeviceClaim -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: FinalizeDeviceClaim
s@FinalizeDeviceClaim' {} Maybe (HashMap Text Text)
a -> FinalizeDeviceClaim
s {$sel:tags:FinalizeDeviceClaim' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: FinalizeDeviceClaim) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> FinalizeDeviceClaim -> f FinalizeDeviceClaim)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> FinalizeDeviceClaim
-> f FinalizeDeviceClaim
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
finalizeDeviceClaim_deviceId :: Lens.Lens' FinalizeDeviceClaim Prelude.Text
finalizeDeviceClaim_deviceId :: (Text -> f Text) -> FinalizeDeviceClaim -> f FinalizeDeviceClaim
finalizeDeviceClaim_deviceId = (FinalizeDeviceClaim -> Text)
-> (FinalizeDeviceClaim -> Text -> FinalizeDeviceClaim)
-> Lens FinalizeDeviceClaim FinalizeDeviceClaim Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinalizeDeviceClaim' {Text
deviceId :: Text
$sel:deviceId:FinalizeDeviceClaim' :: FinalizeDeviceClaim -> Text
deviceId} -> Text
deviceId) (\s :: FinalizeDeviceClaim
s@FinalizeDeviceClaim' {} Text
a -> FinalizeDeviceClaim
s {$sel:deviceId:FinalizeDeviceClaim' :: Text
deviceId = Text
a} :: FinalizeDeviceClaim)
instance Core.AWSRequest FinalizeDeviceClaim where
type
AWSResponse FinalizeDeviceClaim =
FinalizeDeviceClaimResponse
request :: FinalizeDeviceClaim -> Request FinalizeDeviceClaim
request = Service -> FinalizeDeviceClaim -> Request FinalizeDeviceClaim
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy FinalizeDeviceClaim
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse FinalizeDeviceClaim)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse FinalizeDeviceClaim))
-> Logger
-> Service
-> Proxy FinalizeDeviceClaim
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse FinalizeDeviceClaim)))
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 -> Int -> FinalizeDeviceClaimResponse
FinalizeDeviceClaimResponse'
(Maybe Text -> Int -> FinalizeDeviceClaimResponse)
-> Either String (Maybe Text)
-> Either String (Int -> FinalizeDeviceClaimResponse)
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
"state")
Either String (Int -> FinalizeDeviceClaimResponse)
-> Either String Int -> Either String FinalizeDeviceClaimResponse
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 FinalizeDeviceClaim
instance Prelude.NFData FinalizeDeviceClaim
instance Core.ToHeaders FinalizeDeviceClaim where
toHeaders :: FinalizeDeviceClaim -> ResponseHeaders
toHeaders =
ResponseHeaders -> FinalizeDeviceClaim -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 FinalizeDeviceClaim where
toJSON :: FinalizeDeviceClaim -> Value
toJSON FinalizeDeviceClaim' {Maybe (HashMap Text Text)
Text
deviceId :: Text
tags :: Maybe (HashMap Text Text)
$sel:deviceId:FinalizeDeviceClaim' :: FinalizeDeviceClaim -> Text
$sel:tags:FinalizeDeviceClaim' :: FinalizeDeviceClaim -> Maybe (HashMap Text Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags]
)
instance Core.ToPath FinalizeDeviceClaim where
toPath :: FinalizeDeviceClaim -> ByteString
toPath FinalizeDeviceClaim' {Maybe (HashMap Text Text)
Text
deviceId :: Text
tags :: Maybe (HashMap Text Text)
$sel:deviceId:FinalizeDeviceClaim' :: FinalizeDeviceClaim -> Text
$sel:tags:FinalizeDeviceClaim' :: FinalizeDeviceClaim -> Maybe (HashMap Text Text)
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/devices/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
deviceId, ByteString
"/finalize-claim"]
instance Core.ToQuery FinalizeDeviceClaim where
toQuery :: FinalizeDeviceClaim -> QueryString
toQuery = QueryString -> FinalizeDeviceClaim -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data FinalizeDeviceClaimResponse = FinalizeDeviceClaimResponse'
{
FinalizeDeviceClaimResponse -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
FinalizeDeviceClaimResponse -> Int
httpStatus :: Prelude.Int
}
deriving (FinalizeDeviceClaimResponse -> FinalizeDeviceClaimResponse -> Bool
(FinalizeDeviceClaimResponse
-> FinalizeDeviceClaimResponse -> Bool)
-> (FinalizeDeviceClaimResponse
-> FinalizeDeviceClaimResponse -> Bool)
-> Eq FinalizeDeviceClaimResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FinalizeDeviceClaimResponse -> FinalizeDeviceClaimResponse -> Bool
$c/= :: FinalizeDeviceClaimResponse -> FinalizeDeviceClaimResponse -> Bool
== :: FinalizeDeviceClaimResponse -> FinalizeDeviceClaimResponse -> Bool
$c== :: FinalizeDeviceClaimResponse -> FinalizeDeviceClaimResponse -> Bool
Prelude.Eq, ReadPrec [FinalizeDeviceClaimResponse]
ReadPrec FinalizeDeviceClaimResponse
Int -> ReadS FinalizeDeviceClaimResponse
ReadS [FinalizeDeviceClaimResponse]
(Int -> ReadS FinalizeDeviceClaimResponse)
-> ReadS [FinalizeDeviceClaimResponse]
-> ReadPrec FinalizeDeviceClaimResponse
-> ReadPrec [FinalizeDeviceClaimResponse]
-> Read FinalizeDeviceClaimResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FinalizeDeviceClaimResponse]
$creadListPrec :: ReadPrec [FinalizeDeviceClaimResponse]
readPrec :: ReadPrec FinalizeDeviceClaimResponse
$creadPrec :: ReadPrec FinalizeDeviceClaimResponse
readList :: ReadS [FinalizeDeviceClaimResponse]
$creadList :: ReadS [FinalizeDeviceClaimResponse]
readsPrec :: Int -> ReadS FinalizeDeviceClaimResponse
$creadsPrec :: Int -> ReadS FinalizeDeviceClaimResponse
Prelude.Read, Int -> FinalizeDeviceClaimResponse -> ShowS
[FinalizeDeviceClaimResponse] -> ShowS
FinalizeDeviceClaimResponse -> String
(Int -> FinalizeDeviceClaimResponse -> ShowS)
-> (FinalizeDeviceClaimResponse -> String)
-> ([FinalizeDeviceClaimResponse] -> ShowS)
-> Show FinalizeDeviceClaimResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FinalizeDeviceClaimResponse] -> ShowS
$cshowList :: [FinalizeDeviceClaimResponse] -> ShowS
show :: FinalizeDeviceClaimResponse -> String
$cshow :: FinalizeDeviceClaimResponse -> String
showsPrec :: Int -> FinalizeDeviceClaimResponse -> ShowS
$cshowsPrec :: Int -> FinalizeDeviceClaimResponse -> ShowS
Prelude.Show, (forall x.
FinalizeDeviceClaimResponse -> Rep FinalizeDeviceClaimResponse x)
-> (forall x.
Rep FinalizeDeviceClaimResponse x -> FinalizeDeviceClaimResponse)
-> Generic FinalizeDeviceClaimResponse
forall x.
Rep FinalizeDeviceClaimResponse x -> FinalizeDeviceClaimResponse
forall x.
FinalizeDeviceClaimResponse -> Rep FinalizeDeviceClaimResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FinalizeDeviceClaimResponse x -> FinalizeDeviceClaimResponse
$cfrom :: forall x.
FinalizeDeviceClaimResponse -> Rep FinalizeDeviceClaimResponse x
Prelude.Generic)
newFinalizeDeviceClaimResponse ::
Prelude.Int ->
FinalizeDeviceClaimResponse
newFinalizeDeviceClaimResponse :: Int -> FinalizeDeviceClaimResponse
newFinalizeDeviceClaimResponse Int
pHttpStatus_ =
FinalizeDeviceClaimResponse' :: Maybe Text -> Int -> FinalizeDeviceClaimResponse
FinalizeDeviceClaimResponse'
{ $sel:state:FinalizeDeviceClaimResponse' :: Maybe Text
state =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:FinalizeDeviceClaimResponse' :: Int
httpStatus = Int
pHttpStatus_
}
finalizeDeviceClaimResponse_state :: Lens.Lens' FinalizeDeviceClaimResponse (Prelude.Maybe Prelude.Text)
finalizeDeviceClaimResponse_state :: (Maybe Text -> f (Maybe Text))
-> FinalizeDeviceClaimResponse -> f FinalizeDeviceClaimResponse
finalizeDeviceClaimResponse_state = (FinalizeDeviceClaimResponse -> Maybe Text)
-> (FinalizeDeviceClaimResponse
-> Maybe Text -> FinalizeDeviceClaimResponse)
-> Lens
FinalizeDeviceClaimResponse
FinalizeDeviceClaimResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinalizeDeviceClaimResponse' {Maybe Text
state :: Maybe Text
$sel:state:FinalizeDeviceClaimResponse' :: FinalizeDeviceClaimResponse -> Maybe Text
state} -> Maybe Text
state) (\s :: FinalizeDeviceClaimResponse
s@FinalizeDeviceClaimResponse' {} Maybe Text
a -> FinalizeDeviceClaimResponse
s {$sel:state:FinalizeDeviceClaimResponse' :: Maybe Text
state = Maybe Text
a} :: FinalizeDeviceClaimResponse)
finalizeDeviceClaimResponse_httpStatus :: Lens.Lens' FinalizeDeviceClaimResponse Prelude.Int
finalizeDeviceClaimResponse_httpStatus :: (Int -> f Int)
-> FinalizeDeviceClaimResponse -> f FinalizeDeviceClaimResponse
finalizeDeviceClaimResponse_httpStatus = (FinalizeDeviceClaimResponse -> Int)
-> (FinalizeDeviceClaimResponse
-> Int -> FinalizeDeviceClaimResponse)
-> Lens
FinalizeDeviceClaimResponse FinalizeDeviceClaimResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FinalizeDeviceClaimResponse' {Int
httpStatus :: Int
$sel:httpStatus:FinalizeDeviceClaimResponse' :: FinalizeDeviceClaimResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: FinalizeDeviceClaimResponse
s@FinalizeDeviceClaimResponse' {} Int
a -> FinalizeDeviceClaimResponse
s {$sel:httpStatus:FinalizeDeviceClaimResponse' :: Int
httpStatus = Int
a} :: FinalizeDeviceClaimResponse)
instance Prelude.NFData FinalizeDeviceClaimResponse