{-# 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.Greengrass.UpdateDeviceDefinition
(
UpdateDeviceDefinition (..),
newUpdateDeviceDefinition,
updateDeviceDefinition_name,
updateDeviceDefinition_deviceDefinitionId,
UpdateDeviceDefinitionResponse (..),
newUpdateDeviceDefinitionResponse,
updateDeviceDefinitionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Greengrass.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 UpdateDeviceDefinition = UpdateDeviceDefinition'
{
UpdateDeviceDefinition -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateDeviceDefinition -> Text
deviceDefinitionId :: Prelude.Text
}
deriving (UpdateDeviceDefinition -> UpdateDeviceDefinition -> Bool
(UpdateDeviceDefinition -> UpdateDeviceDefinition -> Bool)
-> (UpdateDeviceDefinition -> UpdateDeviceDefinition -> Bool)
-> Eq UpdateDeviceDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeviceDefinition -> UpdateDeviceDefinition -> Bool
$c/= :: UpdateDeviceDefinition -> UpdateDeviceDefinition -> Bool
== :: UpdateDeviceDefinition -> UpdateDeviceDefinition -> Bool
$c== :: UpdateDeviceDefinition -> UpdateDeviceDefinition -> Bool
Prelude.Eq, ReadPrec [UpdateDeviceDefinition]
ReadPrec UpdateDeviceDefinition
Int -> ReadS UpdateDeviceDefinition
ReadS [UpdateDeviceDefinition]
(Int -> ReadS UpdateDeviceDefinition)
-> ReadS [UpdateDeviceDefinition]
-> ReadPrec UpdateDeviceDefinition
-> ReadPrec [UpdateDeviceDefinition]
-> Read UpdateDeviceDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDeviceDefinition]
$creadListPrec :: ReadPrec [UpdateDeviceDefinition]
readPrec :: ReadPrec UpdateDeviceDefinition
$creadPrec :: ReadPrec UpdateDeviceDefinition
readList :: ReadS [UpdateDeviceDefinition]
$creadList :: ReadS [UpdateDeviceDefinition]
readsPrec :: Int -> ReadS UpdateDeviceDefinition
$creadsPrec :: Int -> ReadS UpdateDeviceDefinition
Prelude.Read, Int -> UpdateDeviceDefinition -> ShowS
[UpdateDeviceDefinition] -> ShowS
UpdateDeviceDefinition -> String
(Int -> UpdateDeviceDefinition -> ShowS)
-> (UpdateDeviceDefinition -> String)
-> ([UpdateDeviceDefinition] -> ShowS)
-> Show UpdateDeviceDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeviceDefinition] -> ShowS
$cshowList :: [UpdateDeviceDefinition] -> ShowS
show :: UpdateDeviceDefinition -> String
$cshow :: UpdateDeviceDefinition -> String
showsPrec :: Int -> UpdateDeviceDefinition -> ShowS
$cshowsPrec :: Int -> UpdateDeviceDefinition -> ShowS
Prelude.Show, (forall x. UpdateDeviceDefinition -> Rep UpdateDeviceDefinition x)
-> (forall x.
Rep UpdateDeviceDefinition x -> UpdateDeviceDefinition)
-> Generic UpdateDeviceDefinition
forall x. Rep UpdateDeviceDefinition x -> UpdateDeviceDefinition
forall x. UpdateDeviceDefinition -> Rep UpdateDeviceDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDeviceDefinition x -> UpdateDeviceDefinition
$cfrom :: forall x. UpdateDeviceDefinition -> Rep UpdateDeviceDefinition x
Prelude.Generic)
newUpdateDeviceDefinition ::
Prelude.Text ->
UpdateDeviceDefinition
newUpdateDeviceDefinition :: Text -> UpdateDeviceDefinition
newUpdateDeviceDefinition Text
pDeviceDefinitionId_ =
UpdateDeviceDefinition' :: Maybe Text -> Text -> UpdateDeviceDefinition
UpdateDeviceDefinition'
{ $sel:name:UpdateDeviceDefinition' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:deviceDefinitionId:UpdateDeviceDefinition' :: Text
deviceDefinitionId = Text
pDeviceDefinitionId_
}
updateDeviceDefinition_name :: Lens.Lens' UpdateDeviceDefinition (Prelude.Maybe Prelude.Text)
updateDeviceDefinition_name :: (Maybe Text -> f (Maybe Text))
-> UpdateDeviceDefinition -> f UpdateDeviceDefinition
updateDeviceDefinition_name = (UpdateDeviceDefinition -> Maybe Text)
-> (UpdateDeviceDefinition -> Maybe Text -> UpdateDeviceDefinition)
-> Lens
UpdateDeviceDefinition
UpdateDeviceDefinition
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceDefinition' {Maybe Text
name :: Maybe Text
$sel:name:UpdateDeviceDefinition' :: UpdateDeviceDefinition -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateDeviceDefinition
s@UpdateDeviceDefinition' {} Maybe Text
a -> UpdateDeviceDefinition
s {$sel:name:UpdateDeviceDefinition' :: Maybe Text
name = Maybe Text
a} :: UpdateDeviceDefinition)
updateDeviceDefinition_deviceDefinitionId :: Lens.Lens' UpdateDeviceDefinition Prelude.Text
updateDeviceDefinition_deviceDefinitionId :: (Text -> f Text)
-> UpdateDeviceDefinition -> f UpdateDeviceDefinition
updateDeviceDefinition_deviceDefinitionId = (UpdateDeviceDefinition -> Text)
-> (UpdateDeviceDefinition -> Text -> UpdateDeviceDefinition)
-> Lens UpdateDeviceDefinition UpdateDeviceDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceDefinition' {Text
deviceDefinitionId :: Text
$sel:deviceDefinitionId:UpdateDeviceDefinition' :: UpdateDeviceDefinition -> Text
deviceDefinitionId} -> Text
deviceDefinitionId) (\s :: UpdateDeviceDefinition
s@UpdateDeviceDefinition' {} Text
a -> UpdateDeviceDefinition
s {$sel:deviceDefinitionId:UpdateDeviceDefinition' :: Text
deviceDefinitionId = Text
a} :: UpdateDeviceDefinition)
instance Core.AWSRequest UpdateDeviceDefinition where
type
AWSResponse UpdateDeviceDefinition =
UpdateDeviceDefinitionResponse
request :: UpdateDeviceDefinition -> Request UpdateDeviceDefinition
request = Service -> UpdateDeviceDefinition -> Request UpdateDeviceDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDeviceDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDeviceDefinition)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateDeviceDefinition))
-> Logger
-> Service
-> Proxy UpdateDeviceDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDeviceDefinition)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateDeviceDefinitionResponse
UpdateDeviceDefinitionResponse'
(Int -> UpdateDeviceDefinitionResponse)
-> Either String Int
-> Either String UpdateDeviceDefinitionResponse
forall (f :: * -> *) a b. Functor 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 UpdateDeviceDefinition
instance Prelude.NFData UpdateDeviceDefinition
instance Core.ToHeaders UpdateDeviceDefinition where
toHeaders :: UpdateDeviceDefinition -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDeviceDefinition -> 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 UpdateDeviceDefinition where
toJSON :: UpdateDeviceDefinition -> Value
toJSON UpdateDeviceDefinition' {Maybe Text
Text
deviceDefinitionId :: Text
name :: Maybe Text
$sel:deviceDefinitionId:UpdateDeviceDefinition' :: UpdateDeviceDefinition -> Text
$sel:name:UpdateDeviceDefinition' :: UpdateDeviceDefinition -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name]
)
instance Core.ToPath UpdateDeviceDefinition where
toPath :: UpdateDeviceDefinition -> ByteString
toPath UpdateDeviceDefinition' {Maybe Text
Text
deviceDefinitionId :: Text
name :: Maybe Text
$sel:deviceDefinitionId:UpdateDeviceDefinition' :: UpdateDeviceDefinition -> Text
$sel:name:UpdateDeviceDefinition' :: UpdateDeviceDefinition -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/greengrass/definition/devices/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
deviceDefinitionId
]
instance Core.ToQuery UpdateDeviceDefinition where
toQuery :: UpdateDeviceDefinition -> QueryString
toQuery = QueryString -> UpdateDeviceDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateDeviceDefinitionResponse = UpdateDeviceDefinitionResponse'
{
UpdateDeviceDefinitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateDeviceDefinitionResponse
-> UpdateDeviceDefinitionResponse -> Bool
(UpdateDeviceDefinitionResponse
-> UpdateDeviceDefinitionResponse -> Bool)
-> (UpdateDeviceDefinitionResponse
-> UpdateDeviceDefinitionResponse -> Bool)
-> Eq UpdateDeviceDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeviceDefinitionResponse
-> UpdateDeviceDefinitionResponse -> Bool
$c/= :: UpdateDeviceDefinitionResponse
-> UpdateDeviceDefinitionResponse -> Bool
== :: UpdateDeviceDefinitionResponse
-> UpdateDeviceDefinitionResponse -> Bool
$c== :: UpdateDeviceDefinitionResponse
-> UpdateDeviceDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDeviceDefinitionResponse]
ReadPrec UpdateDeviceDefinitionResponse
Int -> ReadS UpdateDeviceDefinitionResponse
ReadS [UpdateDeviceDefinitionResponse]
(Int -> ReadS UpdateDeviceDefinitionResponse)
-> ReadS [UpdateDeviceDefinitionResponse]
-> ReadPrec UpdateDeviceDefinitionResponse
-> ReadPrec [UpdateDeviceDefinitionResponse]
-> Read UpdateDeviceDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDeviceDefinitionResponse]
$creadListPrec :: ReadPrec [UpdateDeviceDefinitionResponse]
readPrec :: ReadPrec UpdateDeviceDefinitionResponse
$creadPrec :: ReadPrec UpdateDeviceDefinitionResponse
readList :: ReadS [UpdateDeviceDefinitionResponse]
$creadList :: ReadS [UpdateDeviceDefinitionResponse]
readsPrec :: Int -> ReadS UpdateDeviceDefinitionResponse
$creadsPrec :: Int -> ReadS UpdateDeviceDefinitionResponse
Prelude.Read, Int -> UpdateDeviceDefinitionResponse -> ShowS
[UpdateDeviceDefinitionResponse] -> ShowS
UpdateDeviceDefinitionResponse -> String
(Int -> UpdateDeviceDefinitionResponse -> ShowS)
-> (UpdateDeviceDefinitionResponse -> String)
-> ([UpdateDeviceDefinitionResponse] -> ShowS)
-> Show UpdateDeviceDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeviceDefinitionResponse] -> ShowS
$cshowList :: [UpdateDeviceDefinitionResponse] -> ShowS
show :: UpdateDeviceDefinitionResponse -> String
$cshow :: UpdateDeviceDefinitionResponse -> String
showsPrec :: Int -> UpdateDeviceDefinitionResponse -> ShowS
$cshowsPrec :: Int -> UpdateDeviceDefinitionResponse -> ShowS
Prelude.Show, (forall x.
UpdateDeviceDefinitionResponse
-> Rep UpdateDeviceDefinitionResponse x)
-> (forall x.
Rep UpdateDeviceDefinitionResponse x
-> UpdateDeviceDefinitionResponse)
-> Generic UpdateDeviceDefinitionResponse
forall x.
Rep UpdateDeviceDefinitionResponse x
-> UpdateDeviceDefinitionResponse
forall x.
UpdateDeviceDefinitionResponse
-> Rep UpdateDeviceDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDeviceDefinitionResponse x
-> UpdateDeviceDefinitionResponse
$cfrom :: forall x.
UpdateDeviceDefinitionResponse
-> Rep UpdateDeviceDefinitionResponse x
Prelude.Generic)
newUpdateDeviceDefinitionResponse ::
Prelude.Int ->
UpdateDeviceDefinitionResponse
newUpdateDeviceDefinitionResponse :: Int -> UpdateDeviceDefinitionResponse
newUpdateDeviceDefinitionResponse Int
pHttpStatus_ =
UpdateDeviceDefinitionResponse' :: Int -> UpdateDeviceDefinitionResponse
UpdateDeviceDefinitionResponse'
{ $sel:httpStatus:UpdateDeviceDefinitionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateDeviceDefinitionResponse_httpStatus :: Lens.Lens' UpdateDeviceDefinitionResponse Prelude.Int
updateDeviceDefinitionResponse_httpStatus :: (Int -> f Int)
-> UpdateDeviceDefinitionResponse
-> f UpdateDeviceDefinitionResponse
updateDeviceDefinitionResponse_httpStatus = (UpdateDeviceDefinitionResponse -> Int)
-> (UpdateDeviceDefinitionResponse
-> Int -> UpdateDeviceDefinitionResponse)
-> Lens
UpdateDeviceDefinitionResponse
UpdateDeviceDefinitionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDeviceDefinitionResponse' :: UpdateDeviceDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateDeviceDefinitionResponse
s@UpdateDeviceDefinitionResponse' {} Int
a -> UpdateDeviceDefinitionResponse
s {$sel:httpStatus:UpdateDeviceDefinitionResponse' :: Int
httpStatus = Int
a} :: UpdateDeviceDefinitionResponse)
instance
Prelude.NFData
UpdateDeviceDefinitionResponse