{-# 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 Amazonka.IoT.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 GetOTAUpdate = GetOTAUpdate'
{
GetOTAUpdate -> Text
otaUpdateId :: Prelude.Text
}
deriving (GetOTAUpdate -> GetOTAUpdate -> Bool
(GetOTAUpdate -> GetOTAUpdate -> Bool)
-> (GetOTAUpdate -> GetOTAUpdate -> Bool) -> Eq GetOTAUpdate
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]
(Int -> ReadS GetOTAUpdate)
-> ReadS [GetOTAUpdate]
-> ReadPrec GetOTAUpdate
-> ReadPrec [GetOTAUpdate]
-> Read 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
(Int -> GetOTAUpdate -> ShowS)
-> (GetOTAUpdate -> String)
-> ([GetOTAUpdate] -> ShowS)
-> Show GetOTAUpdate
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. GetOTAUpdate -> Rep GetOTAUpdate x)
-> (forall x. Rep GetOTAUpdate x -> GetOTAUpdate)
-> Generic GetOTAUpdate
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' :: Text -> GetOTAUpdate
GetOTAUpdate' {$sel:otaUpdateId:GetOTAUpdate' :: Text
otaUpdateId = Text
pOtaUpdateId_}
getOTAUpdate_otaUpdateId :: Lens.Lens' GetOTAUpdate Prelude.Text
getOTAUpdate_otaUpdateId :: (Text -> f Text) -> GetOTAUpdate -> f GetOTAUpdate
getOTAUpdate_otaUpdateId = (GetOTAUpdate -> Text)
-> (GetOTAUpdate -> Text -> GetOTAUpdate)
-> Lens GetOTAUpdate GetOTAUpdate Text Text
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 :: GetOTAUpdate -> Request GetOTAUpdate
request = Service -> GetOTAUpdate -> Request GetOTAUpdate
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetOTAUpdate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetOTAUpdate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetOTAUpdate))
-> Logger
-> Service
-> Proxy GetOTAUpdate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetOTAUpdate)))
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 OTAUpdateInfo -> Int -> GetOTAUpdateResponse
GetOTAUpdateResponse'
(Maybe OTAUpdateInfo -> Int -> GetOTAUpdateResponse)
-> Either String (Maybe OTAUpdateInfo)
-> Either String (Int -> GetOTAUpdateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe OTAUpdateInfo)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"otaUpdateInfo")
Either String (Int -> GetOTAUpdateResponse)
-> Either String Int -> Either String GetOTAUpdateResponse
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 GetOTAUpdate
instance Prelude.NFData GetOTAUpdate
instance Core.ToHeaders GetOTAUpdate where
toHeaders :: GetOTAUpdate -> ResponseHeaders
toHeaders = ResponseHeaders -> GetOTAUpdate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetOTAUpdate where
toPath :: GetOTAUpdate -> ByteString
toPath GetOTAUpdate' {Text
otaUpdateId :: Text
$sel:otaUpdateId:GetOTAUpdate' :: GetOTAUpdate -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/otaUpdates/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
otaUpdateId]
instance Core.ToQuery GetOTAUpdate where
toQuery :: GetOTAUpdate -> QueryString
toQuery = QueryString -> GetOTAUpdate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetOTAUpdateResponse -> GetOTAUpdateResponse -> Bool)
-> (GetOTAUpdateResponse -> GetOTAUpdateResponse -> Bool)
-> Eq GetOTAUpdateResponse
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]
(Int -> ReadS GetOTAUpdateResponse)
-> ReadS [GetOTAUpdateResponse]
-> ReadPrec GetOTAUpdateResponse
-> ReadPrec [GetOTAUpdateResponse]
-> Read 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
(Int -> GetOTAUpdateResponse -> ShowS)
-> (GetOTAUpdateResponse -> String)
-> ([GetOTAUpdateResponse] -> ShowS)
-> Show GetOTAUpdateResponse
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. GetOTAUpdateResponse -> Rep GetOTAUpdateResponse x)
-> (forall x. Rep GetOTAUpdateResponse x -> GetOTAUpdateResponse)
-> Generic GetOTAUpdateResponse
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' :: Maybe OTAUpdateInfo -> Int -> GetOTAUpdateResponse
GetOTAUpdateResponse'
{ $sel:otaUpdateInfo:GetOTAUpdateResponse' :: Maybe OTAUpdateInfo
otaUpdateInfo =
Maybe OTAUpdateInfo
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetOTAUpdateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getOTAUpdateResponse_otaUpdateInfo :: Lens.Lens' GetOTAUpdateResponse (Prelude.Maybe OTAUpdateInfo)
getOTAUpdateResponse_otaUpdateInfo :: (Maybe OTAUpdateInfo -> f (Maybe OTAUpdateInfo))
-> GetOTAUpdateResponse -> f GetOTAUpdateResponse
getOTAUpdateResponse_otaUpdateInfo = (GetOTAUpdateResponse -> Maybe OTAUpdateInfo)
-> (GetOTAUpdateResponse
-> Maybe OTAUpdateInfo -> GetOTAUpdateResponse)
-> Lens
GetOTAUpdateResponse
GetOTAUpdateResponse
(Maybe OTAUpdateInfo)
(Maybe 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 :: (Int -> f Int) -> GetOTAUpdateResponse -> f GetOTAUpdateResponse
getOTAUpdateResponse_httpStatus = (GetOTAUpdateResponse -> Int)
-> (GetOTAUpdateResponse -> Int -> GetOTAUpdateResponse)
-> Lens GetOTAUpdateResponse GetOTAUpdateResponse Int Int
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