{-# 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.Panorama.UpdateDeviceMetadata
(
UpdateDeviceMetadata (..),
newUpdateDeviceMetadata,
updateDeviceMetadata_description,
updateDeviceMetadata_deviceId,
UpdateDeviceMetadataResponse (..),
newUpdateDeviceMetadataResponse,
updateDeviceMetadataResponse_deviceId,
updateDeviceMetadataResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateDeviceMetadata = UpdateDeviceMetadata'
{
UpdateDeviceMetadata -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateDeviceMetadata -> Text
deviceId :: Prelude.Text
}
deriving (UpdateDeviceMetadata -> UpdateDeviceMetadata -> Bool
(UpdateDeviceMetadata -> UpdateDeviceMetadata -> Bool)
-> (UpdateDeviceMetadata -> UpdateDeviceMetadata -> Bool)
-> Eq UpdateDeviceMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeviceMetadata -> UpdateDeviceMetadata -> Bool
$c/= :: UpdateDeviceMetadata -> UpdateDeviceMetadata -> Bool
== :: UpdateDeviceMetadata -> UpdateDeviceMetadata -> Bool
$c== :: UpdateDeviceMetadata -> UpdateDeviceMetadata -> Bool
Prelude.Eq, ReadPrec [UpdateDeviceMetadata]
ReadPrec UpdateDeviceMetadata
Int -> ReadS UpdateDeviceMetadata
ReadS [UpdateDeviceMetadata]
(Int -> ReadS UpdateDeviceMetadata)
-> ReadS [UpdateDeviceMetadata]
-> ReadPrec UpdateDeviceMetadata
-> ReadPrec [UpdateDeviceMetadata]
-> Read UpdateDeviceMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDeviceMetadata]
$creadListPrec :: ReadPrec [UpdateDeviceMetadata]
readPrec :: ReadPrec UpdateDeviceMetadata
$creadPrec :: ReadPrec UpdateDeviceMetadata
readList :: ReadS [UpdateDeviceMetadata]
$creadList :: ReadS [UpdateDeviceMetadata]
readsPrec :: Int -> ReadS UpdateDeviceMetadata
$creadsPrec :: Int -> ReadS UpdateDeviceMetadata
Prelude.Read, Int -> UpdateDeviceMetadata -> ShowS
[UpdateDeviceMetadata] -> ShowS
UpdateDeviceMetadata -> String
(Int -> UpdateDeviceMetadata -> ShowS)
-> (UpdateDeviceMetadata -> String)
-> ([UpdateDeviceMetadata] -> ShowS)
-> Show UpdateDeviceMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeviceMetadata] -> ShowS
$cshowList :: [UpdateDeviceMetadata] -> ShowS
show :: UpdateDeviceMetadata -> String
$cshow :: UpdateDeviceMetadata -> String
showsPrec :: Int -> UpdateDeviceMetadata -> ShowS
$cshowsPrec :: Int -> UpdateDeviceMetadata -> ShowS
Prelude.Show, (forall x. UpdateDeviceMetadata -> Rep UpdateDeviceMetadata x)
-> (forall x. Rep UpdateDeviceMetadata x -> UpdateDeviceMetadata)
-> Generic UpdateDeviceMetadata
forall x. Rep UpdateDeviceMetadata x -> UpdateDeviceMetadata
forall x. UpdateDeviceMetadata -> Rep UpdateDeviceMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDeviceMetadata x -> UpdateDeviceMetadata
$cfrom :: forall x. UpdateDeviceMetadata -> Rep UpdateDeviceMetadata x
Prelude.Generic)
newUpdateDeviceMetadata ::
Prelude.Text ->
UpdateDeviceMetadata
newUpdateDeviceMetadata :: Text -> UpdateDeviceMetadata
newUpdateDeviceMetadata Text
pDeviceId_ =
UpdateDeviceMetadata' :: Maybe Text -> Text -> UpdateDeviceMetadata
UpdateDeviceMetadata'
{ $sel:description:UpdateDeviceMetadata' :: Maybe Text
description =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:deviceId:UpdateDeviceMetadata' :: Text
deviceId = Text
pDeviceId_
}
updateDeviceMetadata_description :: Lens.Lens' UpdateDeviceMetadata (Prelude.Maybe Prelude.Text)
updateDeviceMetadata_description :: (Maybe Text -> f (Maybe Text))
-> UpdateDeviceMetadata -> f UpdateDeviceMetadata
updateDeviceMetadata_description = (UpdateDeviceMetadata -> Maybe Text)
-> (UpdateDeviceMetadata -> Maybe Text -> UpdateDeviceMetadata)
-> Lens
UpdateDeviceMetadata UpdateDeviceMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceMetadata' {Maybe Text
description :: Maybe Text
$sel:description:UpdateDeviceMetadata' :: UpdateDeviceMetadata -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateDeviceMetadata
s@UpdateDeviceMetadata' {} Maybe Text
a -> UpdateDeviceMetadata
s {$sel:description:UpdateDeviceMetadata' :: Maybe Text
description = Maybe Text
a} :: UpdateDeviceMetadata)
updateDeviceMetadata_deviceId :: Lens.Lens' UpdateDeviceMetadata Prelude.Text
updateDeviceMetadata_deviceId :: (Text -> f Text) -> UpdateDeviceMetadata -> f UpdateDeviceMetadata
updateDeviceMetadata_deviceId = (UpdateDeviceMetadata -> Text)
-> (UpdateDeviceMetadata -> Text -> UpdateDeviceMetadata)
-> Lens UpdateDeviceMetadata UpdateDeviceMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceMetadata' {Text
deviceId :: Text
$sel:deviceId:UpdateDeviceMetadata' :: UpdateDeviceMetadata -> Text
deviceId} -> Text
deviceId) (\s :: UpdateDeviceMetadata
s@UpdateDeviceMetadata' {} Text
a -> UpdateDeviceMetadata
s {$sel:deviceId:UpdateDeviceMetadata' :: Text
deviceId = Text
a} :: UpdateDeviceMetadata)
instance Core.AWSRequest UpdateDeviceMetadata where
type
AWSResponse UpdateDeviceMetadata =
UpdateDeviceMetadataResponse
request :: UpdateDeviceMetadata -> Request UpdateDeviceMetadata
request = Service -> UpdateDeviceMetadata -> Request UpdateDeviceMetadata
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDeviceMetadata
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDeviceMetadata)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateDeviceMetadata))
-> Logger
-> Service
-> Proxy UpdateDeviceMetadata
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDeviceMetadata)))
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 -> Int -> UpdateDeviceMetadataResponse
UpdateDeviceMetadataResponse'
(Maybe Text -> Int -> UpdateDeviceMetadataResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateDeviceMetadataResponse)
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
"DeviceId")
Either String (Int -> UpdateDeviceMetadataResponse)
-> Either String Int -> Either String UpdateDeviceMetadataResponse
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 UpdateDeviceMetadata
instance Prelude.NFData UpdateDeviceMetadata
instance Core.ToHeaders UpdateDeviceMetadata where
toHeaders :: UpdateDeviceMetadata -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDeviceMetadata -> 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 UpdateDeviceMetadata where
toJSON :: UpdateDeviceMetadata -> Value
toJSON UpdateDeviceMetadata' {Maybe Text
Text
deviceId :: Text
description :: Maybe Text
$sel:deviceId:UpdateDeviceMetadata' :: UpdateDeviceMetadata -> Text
$sel:description:UpdateDeviceMetadata' :: UpdateDeviceMetadata -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Description" 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
description]
)
instance Core.ToPath UpdateDeviceMetadata where
toPath :: UpdateDeviceMetadata -> ByteString
toPath UpdateDeviceMetadata' {Maybe Text
Text
deviceId :: Text
description :: Maybe Text
$sel:deviceId:UpdateDeviceMetadata' :: UpdateDeviceMetadata -> Text
$sel:description:UpdateDeviceMetadata' :: UpdateDeviceMetadata -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/devices/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
deviceId]
instance Core.ToQuery UpdateDeviceMetadata where
toQuery :: UpdateDeviceMetadata -> QueryString
toQuery = QueryString -> UpdateDeviceMetadata -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateDeviceMetadataResponse = UpdateDeviceMetadataResponse'
{
UpdateDeviceMetadataResponse -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
UpdateDeviceMetadataResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateDeviceMetadataResponse
-> UpdateDeviceMetadataResponse -> Bool
(UpdateDeviceMetadataResponse
-> UpdateDeviceMetadataResponse -> Bool)
-> (UpdateDeviceMetadataResponse
-> UpdateDeviceMetadataResponse -> Bool)
-> Eq UpdateDeviceMetadataResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDeviceMetadataResponse
-> UpdateDeviceMetadataResponse -> Bool
$c/= :: UpdateDeviceMetadataResponse
-> UpdateDeviceMetadataResponse -> Bool
== :: UpdateDeviceMetadataResponse
-> UpdateDeviceMetadataResponse -> Bool
$c== :: UpdateDeviceMetadataResponse
-> UpdateDeviceMetadataResponse -> Bool
Prelude.Eq, ReadPrec [UpdateDeviceMetadataResponse]
ReadPrec UpdateDeviceMetadataResponse
Int -> ReadS UpdateDeviceMetadataResponse
ReadS [UpdateDeviceMetadataResponse]
(Int -> ReadS UpdateDeviceMetadataResponse)
-> ReadS [UpdateDeviceMetadataResponse]
-> ReadPrec UpdateDeviceMetadataResponse
-> ReadPrec [UpdateDeviceMetadataResponse]
-> Read UpdateDeviceMetadataResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDeviceMetadataResponse]
$creadListPrec :: ReadPrec [UpdateDeviceMetadataResponse]
readPrec :: ReadPrec UpdateDeviceMetadataResponse
$creadPrec :: ReadPrec UpdateDeviceMetadataResponse
readList :: ReadS [UpdateDeviceMetadataResponse]
$creadList :: ReadS [UpdateDeviceMetadataResponse]
readsPrec :: Int -> ReadS UpdateDeviceMetadataResponse
$creadsPrec :: Int -> ReadS UpdateDeviceMetadataResponse
Prelude.Read, Int -> UpdateDeviceMetadataResponse -> ShowS
[UpdateDeviceMetadataResponse] -> ShowS
UpdateDeviceMetadataResponse -> String
(Int -> UpdateDeviceMetadataResponse -> ShowS)
-> (UpdateDeviceMetadataResponse -> String)
-> ([UpdateDeviceMetadataResponse] -> ShowS)
-> Show UpdateDeviceMetadataResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDeviceMetadataResponse] -> ShowS
$cshowList :: [UpdateDeviceMetadataResponse] -> ShowS
show :: UpdateDeviceMetadataResponse -> String
$cshow :: UpdateDeviceMetadataResponse -> String
showsPrec :: Int -> UpdateDeviceMetadataResponse -> ShowS
$cshowsPrec :: Int -> UpdateDeviceMetadataResponse -> ShowS
Prelude.Show, (forall x.
UpdateDeviceMetadataResponse -> Rep UpdateDeviceMetadataResponse x)
-> (forall x.
Rep UpdateDeviceMetadataResponse x -> UpdateDeviceMetadataResponse)
-> Generic UpdateDeviceMetadataResponse
forall x.
Rep UpdateDeviceMetadataResponse x -> UpdateDeviceMetadataResponse
forall x.
UpdateDeviceMetadataResponse -> Rep UpdateDeviceMetadataResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDeviceMetadataResponse x -> UpdateDeviceMetadataResponse
$cfrom :: forall x.
UpdateDeviceMetadataResponse -> Rep UpdateDeviceMetadataResponse x
Prelude.Generic)
newUpdateDeviceMetadataResponse ::
Prelude.Int ->
UpdateDeviceMetadataResponse
newUpdateDeviceMetadataResponse :: Int -> UpdateDeviceMetadataResponse
newUpdateDeviceMetadataResponse Int
pHttpStatus_ =
UpdateDeviceMetadataResponse' :: Maybe Text -> Int -> UpdateDeviceMetadataResponse
UpdateDeviceMetadataResponse'
{ $sel:deviceId:UpdateDeviceMetadataResponse' :: Maybe Text
deviceId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateDeviceMetadataResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateDeviceMetadataResponse_deviceId :: Lens.Lens' UpdateDeviceMetadataResponse (Prelude.Maybe Prelude.Text)
updateDeviceMetadataResponse_deviceId :: (Maybe Text -> f (Maybe Text))
-> UpdateDeviceMetadataResponse -> f UpdateDeviceMetadataResponse
updateDeviceMetadataResponse_deviceId = (UpdateDeviceMetadataResponse -> Maybe Text)
-> (UpdateDeviceMetadataResponse
-> Maybe Text -> UpdateDeviceMetadataResponse)
-> Lens
UpdateDeviceMetadataResponse
UpdateDeviceMetadataResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceMetadataResponse' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:UpdateDeviceMetadataResponse' :: UpdateDeviceMetadataResponse -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: UpdateDeviceMetadataResponse
s@UpdateDeviceMetadataResponse' {} Maybe Text
a -> UpdateDeviceMetadataResponse
s {$sel:deviceId:UpdateDeviceMetadataResponse' :: Maybe Text
deviceId = Maybe Text
a} :: UpdateDeviceMetadataResponse)
updateDeviceMetadataResponse_httpStatus :: Lens.Lens' UpdateDeviceMetadataResponse Prelude.Int
updateDeviceMetadataResponse_httpStatus :: (Int -> f Int)
-> UpdateDeviceMetadataResponse -> f UpdateDeviceMetadataResponse
updateDeviceMetadataResponse_httpStatus = (UpdateDeviceMetadataResponse -> Int)
-> (UpdateDeviceMetadataResponse
-> Int -> UpdateDeviceMetadataResponse)
-> Lens
UpdateDeviceMetadataResponse UpdateDeviceMetadataResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDeviceMetadataResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDeviceMetadataResponse' :: UpdateDeviceMetadataResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateDeviceMetadataResponse
s@UpdateDeviceMetadataResponse' {} Int
a -> UpdateDeviceMetadataResponse
s {$sel:httpStatus:UpdateDeviceMetadataResponse' :: Int
httpStatus = Int
a} :: UpdateDeviceMetadataResponse)
instance Prelude.NFData UpdateDeviceMetadataResponse