{-# 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.SageMakerEdge.GetDeviceRegistration
(
GetDeviceRegistration (..),
newGetDeviceRegistration,
getDeviceRegistration_deviceName,
getDeviceRegistration_deviceFleetName,
GetDeviceRegistrationResponse (..),
newGetDeviceRegistrationResponse,
getDeviceRegistrationResponse_cacheTTL,
getDeviceRegistrationResponse_deviceRegistration,
getDeviceRegistrationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMakerEdge.Types
data GetDeviceRegistration = GetDeviceRegistration'
{
GetDeviceRegistration -> Text
deviceName :: Prelude.Text,
GetDeviceRegistration -> Text
deviceFleetName :: Prelude.Text
}
deriving (GetDeviceRegistration -> GetDeviceRegistration -> Bool
(GetDeviceRegistration -> GetDeviceRegistration -> Bool)
-> (GetDeviceRegistration -> GetDeviceRegistration -> Bool)
-> Eq GetDeviceRegistration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeviceRegistration -> GetDeviceRegistration -> Bool
$c/= :: GetDeviceRegistration -> GetDeviceRegistration -> Bool
== :: GetDeviceRegistration -> GetDeviceRegistration -> Bool
$c== :: GetDeviceRegistration -> GetDeviceRegistration -> Bool
Prelude.Eq, ReadPrec [GetDeviceRegistration]
ReadPrec GetDeviceRegistration
Int -> ReadS GetDeviceRegistration
ReadS [GetDeviceRegistration]
(Int -> ReadS GetDeviceRegistration)
-> ReadS [GetDeviceRegistration]
-> ReadPrec GetDeviceRegistration
-> ReadPrec [GetDeviceRegistration]
-> Read GetDeviceRegistration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDeviceRegistration]
$creadListPrec :: ReadPrec [GetDeviceRegistration]
readPrec :: ReadPrec GetDeviceRegistration
$creadPrec :: ReadPrec GetDeviceRegistration
readList :: ReadS [GetDeviceRegistration]
$creadList :: ReadS [GetDeviceRegistration]
readsPrec :: Int -> ReadS GetDeviceRegistration
$creadsPrec :: Int -> ReadS GetDeviceRegistration
Prelude.Read, Int -> GetDeviceRegistration -> ShowS
[GetDeviceRegistration] -> ShowS
GetDeviceRegistration -> String
(Int -> GetDeviceRegistration -> ShowS)
-> (GetDeviceRegistration -> String)
-> ([GetDeviceRegistration] -> ShowS)
-> Show GetDeviceRegistration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeviceRegistration] -> ShowS
$cshowList :: [GetDeviceRegistration] -> ShowS
show :: GetDeviceRegistration -> String
$cshow :: GetDeviceRegistration -> String
showsPrec :: Int -> GetDeviceRegistration -> ShowS
$cshowsPrec :: Int -> GetDeviceRegistration -> ShowS
Prelude.Show, (forall x. GetDeviceRegistration -> Rep GetDeviceRegistration x)
-> (forall x. Rep GetDeviceRegistration x -> GetDeviceRegistration)
-> Generic GetDeviceRegistration
forall x. Rep GetDeviceRegistration x -> GetDeviceRegistration
forall x. GetDeviceRegistration -> Rep GetDeviceRegistration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDeviceRegistration x -> GetDeviceRegistration
$cfrom :: forall x. GetDeviceRegistration -> Rep GetDeviceRegistration x
Prelude.Generic)
newGetDeviceRegistration ::
Prelude.Text ->
Prelude.Text ->
GetDeviceRegistration
newGetDeviceRegistration :: Text -> Text -> GetDeviceRegistration
newGetDeviceRegistration
Text
pDeviceName_
Text
pDeviceFleetName_ =
GetDeviceRegistration' :: Text -> Text -> GetDeviceRegistration
GetDeviceRegistration'
{ $sel:deviceName:GetDeviceRegistration' :: Text
deviceName = Text
pDeviceName_,
$sel:deviceFleetName:GetDeviceRegistration' :: Text
deviceFleetName = Text
pDeviceFleetName_
}
getDeviceRegistration_deviceName :: Lens.Lens' GetDeviceRegistration Prelude.Text
getDeviceRegistration_deviceName :: (Text -> f Text)
-> GetDeviceRegistration -> f GetDeviceRegistration
getDeviceRegistration_deviceName = (GetDeviceRegistration -> Text)
-> (GetDeviceRegistration -> Text -> GetDeviceRegistration)
-> Lens GetDeviceRegistration GetDeviceRegistration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceRegistration' {Text
deviceName :: Text
$sel:deviceName:GetDeviceRegistration' :: GetDeviceRegistration -> Text
deviceName} -> Text
deviceName) (\s :: GetDeviceRegistration
s@GetDeviceRegistration' {} Text
a -> GetDeviceRegistration
s {$sel:deviceName:GetDeviceRegistration' :: Text
deviceName = Text
a} :: GetDeviceRegistration)
getDeviceRegistration_deviceFleetName :: Lens.Lens' GetDeviceRegistration Prelude.Text
getDeviceRegistration_deviceFleetName :: (Text -> f Text)
-> GetDeviceRegistration -> f GetDeviceRegistration
getDeviceRegistration_deviceFleetName = (GetDeviceRegistration -> Text)
-> (GetDeviceRegistration -> Text -> GetDeviceRegistration)
-> Lens GetDeviceRegistration GetDeviceRegistration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceRegistration' {Text
deviceFleetName :: Text
$sel:deviceFleetName:GetDeviceRegistration' :: GetDeviceRegistration -> Text
deviceFleetName} -> Text
deviceFleetName) (\s :: GetDeviceRegistration
s@GetDeviceRegistration' {} Text
a -> GetDeviceRegistration
s {$sel:deviceFleetName:GetDeviceRegistration' :: Text
deviceFleetName = Text
a} :: GetDeviceRegistration)
instance Core.AWSRequest GetDeviceRegistration where
type
AWSResponse GetDeviceRegistration =
GetDeviceRegistrationResponse
request :: GetDeviceRegistration -> Request GetDeviceRegistration
request = Service -> GetDeviceRegistration -> Request GetDeviceRegistration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetDeviceRegistration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDeviceRegistration)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetDeviceRegistration))
-> Logger
-> Service
-> Proxy GetDeviceRegistration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDeviceRegistration)))
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 -> Maybe Text -> Int -> GetDeviceRegistrationResponse
GetDeviceRegistrationResponse'
(Maybe Text -> Maybe Text -> Int -> GetDeviceRegistrationResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Int -> GetDeviceRegistrationResponse)
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
"CacheTTL")
Either String (Maybe Text -> Int -> GetDeviceRegistrationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetDeviceRegistrationResponse)
forall (f :: * -> *) a b. Applicative f => 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
"DeviceRegistration")
Either String (Int -> GetDeviceRegistrationResponse)
-> Either String Int -> Either String GetDeviceRegistrationResponse
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 GetDeviceRegistration
instance Prelude.NFData GetDeviceRegistration
instance Core.ToHeaders GetDeviceRegistration where
toHeaders :: GetDeviceRegistration -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetDeviceRegistration -> 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 GetDeviceRegistration where
toJSON :: GetDeviceRegistration -> Value
toJSON GetDeviceRegistration' {Text
deviceFleetName :: Text
deviceName :: Text
$sel:deviceFleetName:GetDeviceRegistration' :: GetDeviceRegistration -> Text
$sel:deviceName:GetDeviceRegistration' :: GetDeviceRegistration -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DeviceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deviceName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DeviceFleetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deviceFleetName)
]
)
instance Core.ToPath GetDeviceRegistration where
toPath :: GetDeviceRegistration -> ByteString
toPath = ByteString -> GetDeviceRegistration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/GetDeviceRegistration"
instance Core.ToQuery GetDeviceRegistration where
toQuery :: GetDeviceRegistration -> QueryString
toQuery = QueryString -> GetDeviceRegistration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetDeviceRegistrationResponse = GetDeviceRegistrationResponse'
{
GetDeviceRegistrationResponse -> Maybe Text
cacheTTL :: Prelude.Maybe Prelude.Text,
GetDeviceRegistrationResponse -> Maybe Text
deviceRegistration :: Prelude.Maybe Prelude.Text,
GetDeviceRegistrationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDeviceRegistrationResponse
-> GetDeviceRegistrationResponse -> Bool
(GetDeviceRegistrationResponse
-> GetDeviceRegistrationResponse -> Bool)
-> (GetDeviceRegistrationResponse
-> GetDeviceRegistrationResponse -> Bool)
-> Eq GetDeviceRegistrationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeviceRegistrationResponse
-> GetDeviceRegistrationResponse -> Bool
$c/= :: GetDeviceRegistrationResponse
-> GetDeviceRegistrationResponse -> Bool
== :: GetDeviceRegistrationResponse
-> GetDeviceRegistrationResponse -> Bool
$c== :: GetDeviceRegistrationResponse
-> GetDeviceRegistrationResponse -> Bool
Prelude.Eq, ReadPrec [GetDeviceRegistrationResponse]
ReadPrec GetDeviceRegistrationResponse
Int -> ReadS GetDeviceRegistrationResponse
ReadS [GetDeviceRegistrationResponse]
(Int -> ReadS GetDeviceRegistrationResponse)
-> ReadS [GetDeviceRegistrationResponse]
-> ReadPrec GetDeviceRegistrationResponse
-> ReadPrec [GetDeviceRegistrationResponse]
-> Read GetDeviceRegistrationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDeviceRegistrationResponse]
$creadListPrec :: ReadPrec [GetDeviceRegistrationResponse]
readPrec :: ReadPrec GetDeviceRegistrationResponse
$creadPrec :: ReadPrec GetDeviceRegistrationResponse
readList :: ReadS [GetDeviceRegistrationResponse]
$creadList :: ReadS [GetDeviceRegistrationResponse]
readsPrec :: Int -> ReadS GetDeviceRegistrationResponse
$creadsPrec :: Int -> ReadS GetDeviceRegistrationResponse
Prelude.Read, Int -> GetDeviceRegistrationResponse -> ShowS
[GetDeviceRegistrationResponse] -> ShowS
GetDeviceRegistrationResponse -> String
(Int -> GetDeviceRegistrationResponse -> ShowS)
-> (GetDeviceRegistrationResponse -> String)
-> ([GetDeviceRegistrationResponse] -> ShowS)
-> Show GetDeviceRegistrationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeviceRegistrationResponse] -> ShowS
$cshowList :: [GetDeviceRegistrationResponse] -> ShowS
show :: GetDeviceRegistrationResponse -> String
$cshow :: GetDeviceRegistrationResponse -> String
showsPrec :: Int -> GetDeviceRegistrationResponse -> ShowS
$cshowsPrec :: Int -> GetDeviceRegistrationResponse -> ShowS
Prelude.Show, (forall x.
GetDeviceRegistrationResponse
-> Rep GetDeviceRegistrationResponse x)
-> (forall x.
Rep GetDeviceRegistrationResponse x
-> GetDeviceRegistrationResponse)
-> Generic GetDeviceRegistrationResponse
forall x.
Rep GetDeviceRegistrationResponse x
-> GetDeviceRegistrationResponse
forall x.
GetDeviceRegistrationResponse
-> Rep GetDeviceRegistrationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDeviceRegistrationResponse x
-> GetDeviceRegistrationResponse
$cfrom :: forall x.
GetDeviceRegistrationResponse
-> Rep GetDeviceRegistrationResponse x
Prelude.Generic)
newGetDeviceRegistrationResponse ::
Prelude.Int ->
GetDeviceRegistrationResponse
newGetDeviceRegistrationResponse :: Int -> GetDeviceRegistrationResponse
newGetDeviceRegistrationResponse Int
pHttpStatus_ =
GetDeviceRegistrationResponse' :: Maybe Text -> Maybe Text -> Int -> GetDeviceRegistrationResponse
GetDeviceRegistrationResponse'
{ $sel:cacheTTL:GetDeviceRegistrationResponse' :: Maybe Text
cacheTTL =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:deviceRegistration:GetDeviceRegistrationResponse' :: Maybe Text
deviceRegistration = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDeviceRegistrationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDeviceRegistrationResponse_cacheTTL :: Lens.Lens' GetDeviceRegistrationResponse (Prelude.Maybe Prelude.Text)
getDeviceRegistrationResponse_cacheTTL :: (Maybe Text -> f (Maybe Text))
-> GetDeviceRegistrationResponse -> f GetDeviceRegistrationResponse
getDeviceRegistrationResponse_cacheTTL = (GetDeviceRegistrationResponse -> Maybe Text)
-> (GetDeviceRegistrationResponse
-> Maybe Text -> GetDeviceRegistrationResponse)
-> Lens
GetDeviceRegistrationResponse
GetDeviceRegistrationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceRegistrationResponse' {Maybe Text
cacheTTL :: Maybe Text
$sel:cacheTTL:GetDeviceRegistrationResponse' :: GetDeviceRegistrationResponse -> Maybe Text
cacheTTL} -> Maybe Text
cacheTTL) (\s :: GetDeviceRegistrationResponse
s@GetDeviceRegistrationResponse' {} Maybe Text
a -> GetDeviceRegistrationResponse
s {$sel:cacheTTL:GetDeviceRegistrationResponse' :: Maybe Text
cacheTTL = Maybe Text
a} :: GetDeviceRegistrationResponse)
getDeviceRegistrationResponse_deviceRegistration :: Lens.Lens' GetDeviceRegistrationResponse (Prelude.Maybe Prelude.Text)
getDeviceRegistrationResponse_deviceRegistration :: (Maybe Text -> f (Maybe Text))
-> GetDeviceRegistrationResponse -> f GetDeviceRegistrationResponse
getDeviceRegistrationResponse_deviceRegistration = (GetDeviceRegistrationResponse -> Maybe Text)
-> (GetDeviceRegistrationResponse
-> Maybe Text -> GetDeviceRegistrationResponse)
-> Lens
GetDeviceRegistrationResponse
GetDeviceRegistrationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceRegistrationResponse' {Maybe Text
deviceRegistration :: Maybe Text
$sel:deviceRegistration:GetDeviceRegistrationResponse' :: GetDeviceRegistrationResponse -> Maybe Text
deviceRegistration} -> Maybe Text
deviceRegistration) (\s :: GetDeviceRegistrationResponse
s@GetDeviceRegistrationResponse' {} Maybe Text
a -> GetDeviceRegistrationResponse
s {$sel:deviceRegistration:GetDeviceRegistrationResponse' :: Maybe Text
deviceRegistration = Maybe Text
a} :: GetDeviceRegistrationResponse)
getDeviceRegistrationResponse_httpStatus :: Lens.Lens' GetDeviceRegistrationResponse Prelude.Int
getDeviceRegistrationResponse_httpStatus :: (Int -> f Int)
-> GetDeviceRegistrationResponse -> f GetDeviceRegistrationResponse
getDeviceRegistrationResponse_httpStatus = (GetDeviceRegistrationResponse -> Int)
-> (GetDeviceRegistrationResponse
-> Int -> GetDeviceRegistrationResponse)
-> Lens
GetDeviceRegistrationResponse GetDeviceRegistrationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceRegistrationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDeviceRegistrationResponse' :: GetDeviceRegistrationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDeviceRegistrationResponse
s@GetDeviceRegistrationResponse' {} Int
a -> GetDeviceRegistrationResponse
s {$sel:httpStatus:GetDeviceRegistrationResponse' :: Int
httpStatus = Int
a} :: GetDeviceRegistrationResponse)
instance Prelude.NFData GetDeviceRegistrationResponse