{-# 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.IoT.GetOTAUpdate
(
GetOTAUpdate (..),
newGetOTAUpdate,
getOTAUpdate_otaUpdateId,
GetOTAUpdateResponse (..),
newGetOTAUpdateResponse,
getOTAUpdateResponse_otaUpdateInfo,
getOTAUpdateResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetOTAUpdate = GetOTAUpdate'
{
GetOTAUpdate -> Text
otaUpdateId :: Prelude.Text
}
deriving (GetOTAUpdate -> GetOTAUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOTAUpdate -> GetOTAUpdate -> Bool
$c/= :: GetOTAUpdate -> GetOTAUpdate -> Bool
== :: GetOTAUpdate -> GetOTAUpdate -> Bool
$c== :: GetOTAUpdate -> GetOTAUpdate -> Bool
Prelude.Eq, ReadPrec [GetOTAUpdate]
ReadPrec GetOTAUpdate
Int -> ReadS GetOTAUpdate
ReadS [GetOTAUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOTAUpdate]
$creadListPrec :: ReadPrec [GetOTAUpdate]
readPrec :: ReadPrec GetOTAUpdate
$creadPrec :: ReadPrec GetOTAUpdate
readList :: ReadS [GetOTAUpdate]
$creadList :: ReadS [GetOTAUpdate]
readsPrec :: Int -> ReadS GetOTAUpdate
$creadsPrec :: Int -> ReadS GetOTAUpdate
Prelude.Read, Int -> GetOTAUpdate -> ShowS
[GetOTAUpdate] -> ShowS
GetOTAUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOTAUpdate] -> ShowS
$cshowList :: [GetOTAUpdate] -> ShowS
show :: GetOTAUpdate -> String
$cshow :: GetOTAUpdate -> String
showsPrec :: Int -> GetOTAUpdate -> ShowS
$cshowsPrec :: Int -> GetOTAUpdate -> ShowS
Prelude.Show, forall x. Rep GetOTAUpdate x -> GetOTAUpdate
forall x. GetOTAUpdate -> Rep GetOTAUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetOTAUpdate x -> GetOTAUpdate
$cfrom :: forall x. GetOTAUpdate -> Rep GetOTAUpdate x
Prelude.Generic)
newGetOTAUpdate ::
Prelude.Text ->
GetOTAUpdate
newGetOTAUpdate :: Text -> GetOTAUpdate
newGetOTAUpdate Text
pOtaUpdateId_ =
GetOTAUpdate' {$sel:otaUpdateId:GetOTAUpdate' :: Text
otaUpdateId = Text
pOtaUpdateId_}
getOTAUpdate_otaUpdateId :: Lens.Lens' GetOTAUpdate Prelude.Text
getOTAUpdate_otaUpdateId :: Lens' GetOTAUpdate Text
getOTAUpdate_otaUpdateId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOTAUpdate' {Text
otaUpdateId :: Text
$sel:otaUpdateId:GetOTAUpdate' :: GetOTAUpdate -> Text
otaUpdateId} -> Text
otaUpdateId) (\s :: GetOTAUpdate
s@GetOTAUpdate' {} Text
a -> GetOTAUpdate
s {$sel:otaUpdateId:GetOTAUpdate' :: Text
otaUpdateId = Text
a} :: GetOTAUpdate)
instance Core.AWSRequest GetOTAUpdate where
type AWSResponse GetOTAUpdate = GetOTAUpdateResponse
request :: (Service -> Service) -> GetOTAUpdate -> Request GetOTAUpdate
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 GetOTAUpdate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetOTAUpdate)))
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 OTAUpdateInfo -> Int -> GetOTAUpdateResponse
GetOTAUpdateResponse'
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
"otaUpdateInfo")
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 GetOTAUpdate where
hashWithSalt :: Int -> GetOTAUpdate -> Int
hashWithSalt Int
_salt GetOTAUpdate' {Text
otaUpdateId :: Text
$sel:otaUpdateId:GetOTAUpdate' :: GetOTAUpdate -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
otaUpdateId
instance Prelude.NFData GetOTAUpdate where
rnf :: GetOTAUpdate -> ()
rnf GetOTAUpdate' {Text
otaUpdateId :: Text
$sel:otaUpdateId:GetOTAUpdate' :: GetOTAUpdate -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
otaUpdateId
instance Data.ToHeaders GetOTAUpdate where
toHeaders :: GetOTAUpdate -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath GetOTAUpdate where
toPath :: GetOTAUpdate -> ByteString
toPath GetOTAUpdate' {Text
otaUpdateId :: Text
$sel:otaUpdateId:GetOTAUpdate' :: GetOTAUpdate -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/otaUpdates/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
otaUpdateId]
instance Data.ToQuery GetOTAUpdate where
toQuery :: GetOTAUpdate -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetOTAUpdateResponse = GetOTAUpdateResponse'
{
GetOTAUpdateResponse -> Maybe OTAUpdateInfo
otaUpdateInfo :: Prelude.Maybe OTAUpdateInfo,
GetOTAUpdateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetOTAUpdateResponse -> GetOTAUpdateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOTAUpdateResponse -> GetOTAUpdateResponse -> Bool
$c/= :: GetOTAUpdateResponse -> GetOTAUpdateResponse -> Bool
== :: GetOTAUpdateResponse -> GetOTAUpdateResponse -> Bool
$c== :: GetOTAUpdateResponse -> GetOTAUpdateResponse -> Bool
Prelude.Eq, ReadPrec [GetOTAUpdateResponse]
ReadPrec GetOTAUpdateResponse
Int -> ReadS GetOTAUpdateResponse
ReadS [GetOTAUpdateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOTAUpdateResponse]
$creadListPrec :: ReadPrec [GetOTAUpdateResponse]
readPrec :: ReadPrec GetOTAUpdateResponse
$creadPrec :: ReadPrec GetOTAUpdateResponse
readList :: ReadS [GetOTAUpdateResponse]
$creadList :: ReadS [GetOTAUpdateResponse]
readsPrec :: Int -> ReadS GetOTAUpdateResponse
$creadsPrec :: Int -> ReadS GetOTAUpdateResponse
Prelude.Read, Int -> GetOTAUpdateResponse -> ShowS
[GetOTAUpdateResponse] -> ShowS
GetOTAUpdateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOTAUpdateResponse] -> ShowS
$cshowList :: [GetOTAUpdateResponse] -> ShowS
show :: GetOTAUpdateResponse -> String
$cshow :: GetOTAUpdateResponse -> String
showsPrec :: Int -> GetOTAUpdateResponse -> ShowS
$cshowsPrec :: Int -> GetOTAUpdateResponse -> ShowS
Prelude.Show, forall x. Rep GetOTAUpdateResponse x -> GetOTAUpdateResponse
forall x. GetOTAUpdateResponse -> Rep GetOTAUpdateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetOTAUpdateResponse x -> GetOTAUpdateResponse
$cfrom :: forall x. GetOTAUpdateResponse -> Rep GetOTAUpdateResponse x
Prelude.Generic)
newGetOTAUpdateResponse ::
Prelude.Int ->
GetOTAUpdateResponse
newGetOTAUpdateResponse :: Int -> GetOTAUpdateResponse
newGetOTAUpdateResponse Int
pHttpStatus_ =
GetOTAUpdateResponse'
{ $sel:otaUpdateInfo:GetOTAUpdateResponse' :: Maybe OTAUpdateInfo
otaUpdateInfo =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetOTAUpdateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getOTAUpdateResponse_otaUpdateInfo :: Lens.Lens' GetOTAUpdateResponse (Prelude.Maybe OTAUpdateInfo)
getOTAUpdateResponse_otaUpdateInfo :: Lens' GetOTAUpdateResponse (Maybe OTAUpdateInfo)
getOTAUpdateResponse_otaUpdateInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOTAUpdateResponse' {Maybe OTAUpdateInfo
otaUpdateInfo :: Maybe OTAUpdateInfo
$sel:otaUpdateInfo:GetOTAUpdateResponse' :: GetOTAUpdateResponse -> Maybe OTAUpdateInfo
otaUpdateInfo} -> Maybe OTAUpdateInfo
otaUpdateInfo) (\s :: GetOTAUpdateResponse
s@GetOTAUpdateResponse' {} Maybe OTAUpdateInfo
a -> GetOTAUpdateResponse
s {$sel:otaUpdateInfo:GetOTAUpdateResponse' :: Maybe OTAUpdateInfo
otaUpdateInfo = Maybe OTAUpdateInfo
a} :: GetOTAUpdateResponse)
getOTAUpdateResponse_httpStatus :: Lens.Lens' GetOTAUpdateResponse Prelude.Int
getOTAUpdateResponse_httpStatus :: Lens' GetOTAUpdateResponse Int
getOTAUpdateResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOTAUpdateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetOTAUpdateResponse' :: GetOTAUpdateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetOTAUpdateResponse
s@GetOTAUpdateResponse' {} Int
a -> GetOTAUpdateResponse
s {$sel:httpStatus:GetOTAUpdateResponse' :: Int
httpStatus = Int
a} :: GetOTAUpdateResponse)
instance Prelude.NFData GetOTAUpdateResponse where
rnf :: GetOTAUpdateResponse -> ()
rnf GetOTAUpdateResponse' {Int
Maybe OTAUpdateInfo
httpStatus :: Int
otaUpdateInfo :: Maybe OTAUpdateInfo
$sel:httpStatus:GetOTAUpdateResponse' :: GetOTAUpdateResponse -> Int
$sel:otaUpdateInfo:GetOTAUpdateResponse' :: GetOTAUpdateResponse -> Maybe OTAUpdateInfo
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe OTAUpdateInfo
otaUpdateInfo
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus