{-# 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.DescribeDevice
(
DescribeDevice (..),
newDescribeDevice,
describeDevice_deviceId,
DescribeDeviceResponse (..),
newDescribeDeviceResponse,
describeDeviceResponse_deviceDescription,
describeDeviceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT1ClickDevices.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeDevice = DescribeDevice'
{
DescribeDevice -> Text
deviceId :: Prelude.Text
}
deriving (DescribeDevice -> DescribeDevice -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDevice -> DescribeDevice -> Bool
$c/= :: DescribeDevice -> DescribeDevice -> Bool
== :: DescribeDevice -> DescribeDevice -> Bool
$c== :: DescribeDevice -> DescribeDevice -> Bool
Prelude.Eq, ReadPrec [DescribeDevice]
ReadPrec DescribeDevice
Int -> ReadS DescribeDevice
ReadS [DescribeDevice]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDevice]
$creadListPrec :: ReadPrec [DescribeDevice]
readPrec :: ReadPrec DescribeDevice
$creadPrec :: ReadPrec DescribeDevice
readList :: ReadS [DescribeDevice]
$creadList :: ReadS [DescribeDevice]
readsPrec :: Int -> ReadS DescribeDevice
$creadsPrec :: Int -> ReadS DescribeDevice
Prelude.Read, Int -> DescribeDevice -> ShowS
[DescribeDevice] -> ShowS
DescribeDevice -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDevice] -> ShowS
$cshowList :: [DescribeDevice] -> ShowS
show :: DescribeDevice -> String
$cshow :: DescribeDevice -> String
showsPrec :: Int -> DescribeDevice -> ShowS
$cshowsPrec :: Int -> DescribeDevice -> ShowS
Prelude.Show, forall x. Rep DescribeDevice x -> DescribeDevice
forall x. DescribeDevice -> Rep DescribeDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDevice x -> DescribeDevice
$cfrom :: forall x. DescribeDevice -> Rep DescribeDevice x
Prelude.Generic)
newDescribeDevice ::
Prelude.Text ->
DescribeDevice
newDescribeDevice :: Text -> DescribeDevice
newDescribeDevice Text
pDeviceId_ =
DescribeDevice' {$sel:deviceId:DescribeDevice' :: Text
deviceId = Text
pDeviceId_}
describeDevice_deviceId :: Lens.Lens' DescribeDevice Prelude.Text
describeDevice_deviceId :: Lens' DescribeDevice Text
describeDevice_deviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDevice' {Text
deviceId :: Text
$sel:deviceId:DescribeDevice' :: DescribeDevice -> Text
deviceId} -> Text
deviceId) (\s :: DescribeDevice
s@DescribeDevice' {} Text
a -> DescribeDevice
s {$sel:deviceId:DescribeDevice' :: Text
deviceId = Text
a} :: DescribeDevice)
instance Core.AWSRequest DescribeDevice where
type
AWSResponse DescribeDevice =
DescribeDeviceResponse
request :: (Service -> Service) -> DescribeDevice -> Request DescribeDevice
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeDevice
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeDevice)))
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 DeviceDescription -> Int -> DescribeDeviceResponse
DescribeDeviceResponse'
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
"deviceDescription")
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 DescribeDevice where
hashWithSalt :: Int -> DescribeDevice -> Int
hashWithSalt Int
_salt DescribeDevice' {Text
deviceId :: Text
$sel:deviceId:DescribeDevice' :: DescribeDevice -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deviceId
instance Prelude.NFData DescribeDevice where
rnf :: DescribeDevice -> ()
rnf DescribeDevice' {Text
deviceId :: Text
$sel:deviceId:DescribeDevice' :: DescribeDevice -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
deviceId
instance Data.ToHeaders DescribeDevice where
toHeaders :: DescribeDevice -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath DescribeDevice where
toPath :: DescribeDevice -> ByteString
toPath DescribeDevice' {Text
deviceId :: Text
$sel:deviceId:DescribeDevice' :: DescribeDevice -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/devices/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
deviceId]
instance Data.ToQuery DescribeDevice where
toQuery :: DescribeDevice -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DescribeDeviceResponse = DescribeDeviceResponse'
{
DescribeDeviceResponse -> Maybe DeviceDescription
deviceDescription :: Prelude.Maybe DeviceDescription,
DescribeDeviceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeDeviceResponse -> DescribeDeviceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDeviceResponse -> DescribeDeviceResponse -> Bool
$c/= :: DescribeDeviceResponse -> DescribeDeviceResponse -> Bool
== :: DescribeDeviceResponse -> DescribeDeviceResponse -> Bool
$c== :: DescribeDeviceResponse -> DescribeDeviceResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDeviceResponse]
ReadPrec DescribeDeviceResponse
Int -> ReadS DescribeDeviceResponse
ReadS [DescribeDeviceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDeviceResponse]
$creadListPrec :: ReadPrec [DescribeDeviceResponse]
readPrec :: ReadPrec DescribeDeviceResponse
$creadPrec :: ReadPrec DescribeDeviceResponse
readList :: ReadS [DescribeDeviceResponse]
$creadList :: ReadS [DescribeDeviceResponse]
readsPrec :: Int -> ReadS DescribeDeviceResponse
$creadsPrec :: Int -> ReadS DescribeDeviceResponse
Prelude.Read, Int -> DescribeDeviceResponse -> ShowS
[DescribeDeviceResponse] -> ShowS
DescribeDeviceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDeviceResponse] -> ShowS
$cshowList :: [DescribeDeviceResponse] -> ShowS
show :: DescribeDeviceResponse -> String
$cshow :: DescribeDeviceResponse -> String
showsPrec :: Int -> DescribeDeviceResponse -> ShowS
$cshowsPrec :: Int -> DescribeDeviceResponse -> ShowS
Prelude.Show, forall x. Rep DescribeDeviceResponse x -> DescribeDeviceResponse
forall x. DescribeDeviceResponse -> Rep DescribeDeviceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDeviceResponse x -> DescribeDeviceResponse
$cfrom :: forall x. DescribeDeviceResponse -> Rep DescribeDeviceResponse x
Prelude.Generic)
newDescribeDeviceResponse ::
Prelude.Int ->
DescribeDeviceResponse
newDescribeDeviceResponse :: Int -> DescribeDeviceResponse
newDescribeDeviceResponse Int
pHttpStatus_ =
DescribeDeviceResponse'
{ $sel:deviceDescription:DescribeDeviceResponse' :: Maybe DeviceDescription
deviceDescription =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeDeviceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeDeviceResponse_deviceDescription :: Lens.Lens' DescribeDeviceResponse (Prelude.Maybe DeviceDescription)
describeDeviceResponse_deviceDescription :: Lens' DescribeDeviceResponse (Maybe DeviceDescription)
describeDeviceResponse_deviceDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDeviceResponse' {Maybe DeviceDescription
deviceDescription :: Maybe DeviceDescription
$sel:deviceDescription:DescribeDeviceResponse' :: DescribeDeviceResponse -> Maybe DeviceDescription
deviceDescription} -> Maybe DeviceDescription
deviceDescription) (\s :: DescribeDeviceResponse
s@DescribeDeviceResponse' {} Maybe DeviceDescription
a -> DescribeDeviceResponse
s {$sel:deviceDescription:DescribeDeviceResponse' :: Maybe DeviceDescription
deviceDescription = Maybe DeviceDescription
a} :: DescribeDeviceResponse)
describeDeviceResponse_httpStatus :: Lens.Lens' DescribeDeviceResponse Prelude.Int
describeDeviceResponse_httpStatus :: Lens' DescribeDeviceResponse Int
describeDeviceResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDeviceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeDeviceResponse' :: DescribeDeviceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeDeviceResponse
s@DescribeDeviceResponse' {} Int
a -> DescribeDeviceResponse
s {$sel:httpStatus:DescribeDeviceResponse' :: Int
httpStatus = Int
a} :: DescribeDeviceResponse)
instance Prelude.NFData DescribeDeviceResponse where
rnf :: DescribeDeviceResponse -> ()
rnf DescribeDeviceResponse' {Int
Maybe DeviceDescription
httpStatus :: Int
deviceDescription :: Maybe DeviceDescription
$sel:httpStatus:DescribeDeviceResponse' :: DescribeDeviceResponse -> Int
$sel:deviceDescription:DescribeDeviceResponse' :: DescribeDeviceResponse -> Maybe DeviceDescription
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe DeviceDescription
deviceDescription
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus