{-# 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.UnclaimDevice
(
UnclaimDevice (..),
newUnclaimDevice,
unclaimDevice_deviceId,
UnclaimDeviceResponse (..),
newUnclaimDeviceResponse,
unclaimDeviceResponse_state,
unclaimDeviceResponse_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 UnclaimDevice = UnclaimDevice'
{
UnclaimDevice -> Text
deviceId :: Prelude.Text
}
deriving (UnclaimDevice -> UnclaimDevice -> Bool
(UnclaimDevice -> UnclaimDevice -> Bool)
-> (UnclaimDevice -> UnclaimDevice -> Bool) -> Eq UnclaimDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnclaimDevice -> UnclaimDevice -> Bool
$c/= :: UnclaimDevice -> UnclaimDevice -> Bool
== :: UnclaimDevice -> UnclaimDevice -> Bool
$c== :: UnclaimDevice -> UnclaimDevice -> Bool
Prelude.Eq, ReadPrec [UnclaimDevice]
ReadPrec UnclaimDevice
Int -> ReadS UnclaimDevice
ReadS [UnclaimDevice]
(Int -> ReadS UnclaimDevice)
-> ReadS [UnclaimDevice]
-> ReadPrec UnclaimDevice
-> ReadPrec [UnclaimDevice]
-> Read UnclaimDevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnclaimDevice]
$creadListPrec :: ReadPrec [UnclaimDevice]
readPrec :: ReadPrec UnclaimDevice
$creadPrec :: ReadPrec UnclaimDevice
readList :: ReadS [UnclaimDevice]
$creadList :: ReadS [UnclaimDevice]
readsPrec :: Int -> ReadS UnclaimDevice
$creadsPrec :: Int -> ReadS UnclaimDevice
Prelude.Read, Int -> UnclaimDevice -> ShowS
[UnclaimDevice] -> ShowS
UnclaimDevice -> String
(Int -> UnclaimDevice -> ShowS)
-> (UnclaimDevice -> String)
-> ([UnclaimDevice] -> ShowS)
-> Show UnclaimDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnclaimDevice] -> ShowS
$cshowList :: [UnclaimDevice] -> ShowS
show :: UnclaimDevice -> String
$cshow :: UnclaimDevice -> String
showsPrec :: Int -> UnclaimDevice -> ShowS
$cshowsPrec :: Int -> UnclaimDevice -> ShowS
Prelude.Show, (forall x. UnclaimDevice -> Rep UnclaimDevice x)
-> (forall x. Rep UnclaimDevice x -> UnclaimDevice)
-> Generic UnclaimDevice
forall x. Rep UnclaimDevice x -> UnclaimDevice
forall x. UnclaimDevice -> Rep UnclaimDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnclaimDevice x -> UnclaimDevice
$cfrom :: forall x. UnclaimDevice -> Rep UnclaimDevice x
Prelude.Generic)
newUnclaimDevice ::
Prelude.Text ->
UnclaimDevice
newUnclaimDevice :: Text -> UnclaimDevice
newUnclaimDevice Text
pDeviceId_ =
UnclaimDevice' :: Text -> UnclaimDevice
UnclaimDevice' {$sel:deviceId:UnclaimDevice' :: Text
deviceId = Text
pDeviceId_}
unclaimDevice_deviceId :: Lens.Lens' UnclaimDevice Prelude.Text
unclaimDevice_deviceId :: (Text -> f Text) -> UnclaimDevice -> f UnclaimDevice
unclaimDevice_deviceId = (UnclaimDevice -> Text)
-> (UnclaimDevice -> Text -> UnclaimDevice)
-> Lens UnclaimDevice UnclaimDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnclaimDevice' {Text
deviceId :: Text
$sel:deviceId:UnclaimDevice' :: UnclaimDevice -> Text
deviceId} -> Text
deviceId) (\s :: UnclaimDevice
s@UnclaimDevice' {} Text
a -> UnclaimDevice
s {$sel:deviceId:UnclaimDevice' :: Text
deviceId = Text
a} :: UnclaimDevice)
instance Core.AWSRequest UnclaimDevice where
type
AWSResponse UnclaimDevice =
UnclaimDeviceResponse
request :: UnclaimDevice -> Request UnclaimDevice
request = Service -> UnclaimDevice -> Request UnclaimDevice
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UnclaimDevice
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UnclaimDevice)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UnclaimDevice))
-> Logger
-> Service
-> Proxy UnclaimDevice
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UnclaimDevice)))
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 -> UnclaimDeviceResponse
UnclaimDeviceResponse'
(Maybe Text -> Int -> UnclaimDeviceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UnclaimDeviceResponse)
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 -> UnclaimDeviceResponse)
-> Either String Int -> Either String UnclaimDeviceResponse
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 UnclaimDevice
instance Prelude.NFData UnclaimDevice
instance Core.ToHeaders UnclaimDevice where
toHeaders :: UnclaimDevice -> ResponseHeaders
toHeaders =
ResponseHeaders -> UnclaimDevice -> 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 UnclaimDevice where
toJSON :: UnclaimDevice -> Value
toJSON = Value -> UnclaimDevice -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath UnclaimDevice where
toPath :: UnclaimDevice -> ByteString
toPath UnclaimDevice' {Text
deviceId :: Text
$sel:deviceId:UnclaimDevice' :: UnclaimDevice -> 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
"/unclaim"]
instance Core.ToQuery UnclaimDevice where
toQuery :: UnclaimDevice -> QueryString
toQuery = QueryString -> UnclaimDevice -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UnclaimDeviceResponse = UnclaimDeviceResponse'
{
UnclaimDeviceResponse -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
UnclaimDeviceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UnclaimDeviceResponse -> UnclaimDeviceResponse -> Bool
(UnclaimDeviceResponse -> UnclaimDeviceResponse -> Bool)
-> (UnclaimDeviceResponse -> UnclaimDeviceResponse -> Bool)
-> Eq UnclaimDeviceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnclaimDeviceResponse -> UnclaimDeviceResponse -> Bool
$c/= :: UnclaimDeviceResponse -> UnclaimDeviceResponse -> Bool
== :: UnclaimDeviceResponse -> UnclaimDeviceResponse -> Bool
$c== :: UnclaimDeviceResponse -> UnclaimDeviceResponse -> Bool
Prelude.Eq, ReadPrec [UnclaimDeviceResponse]
ReadPrec UnclaimDeviceResponse
Int -> ReadS UnclaimDeviceResponse
ReadS [UnclaimDeviceResponse]
(Int -> ReadS UnclaimDeviceResponse)
-> ReadS [UnclaimDeviceResponse]
-> ReadPrec UnclaimDeviceResponse
-> ReadPrec [UnclaimDeviceResponse]
-> Read UnclaimDeviceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnclaimDeviceResponse]
$creadListPrec :: ReadPrec [UnclaimDeviceResponse]
readPrec :: ReadPrec UnclaimDeviceResponse
$creadPrec :: ReadPrec UnclaimDeviceResponse
readList :: ReadS [UnclaimDeviceResponse]
$creadList :: ReadS [UnclaimDeviceResponse]
readsPrec :: Int -> ReadS UnclaimDeviceResponse
$creadsPrec :: Int -> ReadS UnclaimDeviceResponse
Prelude.Read, Int -> UnclaimDeviceResponse -> ShowS
[UnclaimDeviceResponse] -> ShowS
UnclaimDeviceResponse -> String
(Int -> UnclaimDeviceResponse -> ShowS)
-> (UnclaimDeviceResponse -> String)
-> ([UnclaimDeviceResponse] -> ShowS)
-> Show UnclaimDeviceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnclaimDeviceResponse] -> ShowS
$cshowList :: [UnclaimDeviceResponse] -> ShowS
show :: UnclaimDeviceResponse -> String
$cshow :: UnclaimDeviceResponse -> String
showsPrec :: Int -> UnclaimDeviceResponse -> ShowS
$cshowsPrec :: Int -> UnclaimDeviceResponse -> ShowS
Prelude.Show, (forall x. UnclaimDeviceResponse -> Rep UnclaimDeviceResponse x)
-> (forall x. Rep UnclaimDeviceResponse x -> UnclaimDeviceResponse)
-> Generic UnclaimDeviceResponse
forall x. Rep UnclaimDeviceResponse x -> UnclaimDeviceResponse
forall x. UnclaimDeviceResponse -> Rep UnclaimDeviceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UnclaimDeviceResponse x -> UnclaimDeviceResponse
$cfrom :: forall x. UnclaimDeviceResponse -> Rep UnclaimDeviceResponse x
Prelude.Generic)
newUnclaimDeviceResponse ::
Prelude.Int ->
UnclaimDeviceResponse
newUnclaimDeviceResponse :: Int -> UnclaimDeviceResponse
newUnclaimDeviceResponse Int
pHttpStatus_ =
UnclaimDeviceResponse' :: Maybe Text -> Int -> UnclaimDeviceResponse
UnclaimDeviceResponse'
{ $sel:state:UnclaimDeviceResponse' :: Maybe Text
state = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UnclaimDeviceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
unclaimDeviceResponse_state :: Lens.Lens' UnclaimDeviceResponse (Prelude.Maybe Prelude.Text)
unclaimDeviceResponse_state :: (Maybe Text -> f (Maybe Text))
-> UnclaimDeviceResponse -> f UnclaimDeviceResponse
unclaimDeviceResponse_state = (UnclaimDeviceResponse -> Maybe Text)
-> (UnclaimDeviceResponse -> Maybe Text -> UnclaimDeviceResponse)
-> Lens
UnclaimDeviceResponse
UnclaimDeviceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnclaimDeviceResponse' {Maybe Text
state :: Maybe Text
$sel:state:UnclaimDeviceResponse' :: UnclaimDeviceResponse -> Maybe Text
state} -> Maybe Text
state) (\s :: UnclaimDeviceResponse
s@UnclaimDeviceResponse' {} Maybe Text
a -> UnclaimDeviceResponse
s {$sel:state:UnclaimDeviceResponse' :: Maybe Text
state = Maybe Text
a} :: UnclaimDeviceResponse)
unclaimDeviceResponse_httpStatus :: Lens.Lens' UnclaimDeviceResponse Prelude.Int
unclaimDeviceResponse_httpStatus :: (Int -> f Int) -> UnclaimDeviceResponse -> f UnclaimDeviceResponse
unclaimDeviceResponse_httpStatus = (UnclaimDeviceResponse -> Int)
-> (UnclaimDeviceResponse -> Int -> UnclaimDeviceResponse)
-> Lens UnclaimDeviceResponse UnclaimDeviceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnclaimDeviceResponse' {Int
httpStatus :: Int
$sel:httpStatus:UnclaimDeviceResponse' :: UnclaimDeviceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UnclaimDeviceResponse
s@UnclaimDeviceResponse' {} Int
a -> UnclaimDeviceResponse
s {$sel:httpStatus:UnclaimDeviceResponse' :: Int
httpStatus = Int
a} :: UnclaimDeviceResponse)
instance Prelude.NFData UnclaimDeviceResponse