{-# 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.IoTWireless.UpdateWirelessDevice
(
UpdateWirelessDevice (..),
newUpdateWirelessDevice,
updateWirelessDevice_loRaWAN,
updateWirelessDevice_name,
updateWirelessDevice_destinationName,
updateWirelessDevice_description,
updateWirelessDevice_id,
UpdateWirelessDeviceResponse (..),
newUpdateWirelessDeviceResponse,
updateWirelessDeviceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTWireless.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 UpdateWirelessDevice = UpdateWirelessDevice'
{
UpdateWirelessDevice -> Maybe LoRaWANUpdateDevice
loRaWAN :: Prelude.Maybe LoRaWANUpdateDevice,
UpdateWirelessDevice -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateWirelessDevice -> Maybe Text
destinationName :: Prelude.Maybe Prelude.Text,
UpdateWirelessDevice -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateWirelessDevice -> Text
id :: Prelude.Text
}
deriving (UpdateWirelessDevice -> UpdateWirelessDevice -> Bool
(UpdateWirelessDevice -> UpdateWirelessDevice -> Bool)
-> (UpdateWirelessDevice -> UpdateWirelessDevice -> Bool)
-> Eq UpdateWirelessDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWirelessDevice -> UpdateWirelessDevice -> Bool
$c/= :: UpdateWirelessDevice -> UpdateWirelessDevice -> Bool
== :: UpdateWirelessDevice -> UpdateWirelessDevice -> Bool
$c== :: UpdateWirelessDevice -> UpdateWirelessDevice -> Bool
Prelude.Eq, ReadPrec [UpdateWirelessDevice]
ReadPrec UpdateWirelessDevice
Int -> ReadS UpdateWirelessDevice
ReadS [UpdateWirelessDevice]
(Int -> ReadS UpdateWirelessDevice)
-> ReadS [UpdateWirelessDevice]
-> ReadPrec UpdateWirelessDevice
-> ReadPrec [UpdateWirelessDevice]
-> Read UpdateWirelessDevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWirelessDevice]
$creadListPrec :: ReadPrec [UpdateWirelessDevice]
readPrec :: ReadPrec UpdateWirelessDevice
$creadPrec :: ReadPrec UpdateWirelessDevice
readList :: ReadS [UpdateWirelessDevice]
$creadList :: ReadS [UpdateWirelessDevice]
readsPrec :: Int -> ReadS UpdateWirelessDevice
$creadsPrec :: Int -> ReadS UpdateWirelessDevice
Prelude.Read, Int -> UpdateWirelessDevice -> ShowS
[UpdateWirelessDevice] -> ShowS
UpdateWirelessDevice -> String
(Int -> UpdateWirelessDevice -> ShowS)
-> (UpdateWirelessDevice -> String)
-> ([UpdateWirelessDevice] -> ShowS)
-> Show UpdateWirelessDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWirelessDevice] -> ShowS
$cshowList :: [UpdateWirelessDevice] -> ShowS
show :: UpdateWirelessDevice -> String
$cshow :: UpdateWirelessDevice -> String
showsPrec :: Int -> UpdateWirelessDevice -> ShowS
$cshowsPrec :: Int -> UpdateWirelessDevice -> ShowS
Prelude.Show, (forall x. UpdateWirelessDevice -> Rep UpdateWirelessDevice x)
-> (forall x. Rep UpdateWirelessDevice x -> UpdateWirelessDevice)
-> Generic UpdateWirelessDevice
forall x. Rep UpdateWirelessDevice x -> UpdateWirelessDevice
forall x. UpdateWirelessDevice -> Rep UpdateWirelessDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWirelessDevice x -> UpdateWirelessDevice
$cfrom :: forall x. UpdateWirelessDevice -> Rep UpdateWirelessDevice x
Prelude.Generic)
newUpdateWirelessDevice ::
Prelude.Text ->
UpdateWirelessDevice
newUpdateWirelessDevice :: Text -> UpdateWirelessDevice
newUpdateWirelessDevice Text
pId_ =
UpdateWirelessDevice' :: Maybe LoRaWANUpdateDevice
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> UpdateWirelessDevice
UpdateWirelessDevice'
{ $sel:loRaWAN:UpdateWirelessDevice' :: Maybe LoRaWANUpdateDevice
loRaWAN = Maybe LoRaWANUpdateDevice
forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateWirelessDevice' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:destinationName:UpdateWirelessDevice' :: Maybe Text
destinationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateWirelessDevice' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:UpdateWirelessDevice' :: Text
id = Text
pId_
}
updateWirelessDevice_loRaWAN :: Lens.Lens' UpdateWirelessDevice (Prelude.Maybe LoRaWANUpdateDevice)
updateWirelessDevice_loRaWAN :: (Maybe LoRaWANUpdateDevice -> f (Maybe LoRaWANUpdateDevice))
-> UpdateWirelessDevice -> f UpdateWirelessDevice
updateWirelessDevice_loRaWAN = (UpdateWirelessDevice -> Maybe LoRaWANUpdateDevice)
-> (UpdateWirelessDevice
-> Maybe LoRaWANUpdateDevice -> UpdateWirelessDevice)
-> Lens
UpdateWirelessDevice
UpdateWirelessDevice
(Maybe LoRaWANUpdateDevice)
(Maybe LoRaWANUpdateDevice)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWirelessDevice' {Maybe LoRaWANUpdateDevice
loRaWAN :: Maybe LoRaWANUpdateDevice
$sel:loRaWAN:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe LoRaWANUpdateDevice
loRaWAN} -> Maybe LoRaWANUpdateDevice
loRaWAN) (\s :: UpdateWirelessDevice
s@UpdateWirelessDevice' {} Maybe LoRaWANUpdateDevice
a -> UpdateWirelessDevice
s {$sel:loRaWAN:UpdateWirelessDevice' :: Maybe LoRaWANUpdateDevice
loRaWAN = Maybe LoRaWANUpdateDevice
a} :: UpdateWirelessDevice)
updateWirelessDevice_name :: Lens.Lens' UpdateWirelessDevice (Prelude.Maybe Prelude.Text)
updateWirelessDevice_name :: (Maybe Text -> f (Maybe Text))
-> UpdateWirelessDevice -> f UpdateWirelessDevice
updateWirelessDevice_name = (UpdateWirelessDevice -> Maybe Text)
-> (UpdateWirelessDevice -> Maybe Text -> UpdateWirelessDevice)
-> Lens
UpdateWirelessDevice UpdateWirelessDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWirelessDevice' {Maybe Text
name :: Maybe Text
$sel:name:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateWirelessDevice
s@UpdateWirelessDevice' {} Maybe Text
a -> UpdateWirelessDevice
s {$sel:name:UpdateWirelessDevice' :: Maybe Text
name = Maybe Text
a} :: UpdateWirelessDevice)
updateWirelessDevice_destinationName :: Lens.Lens' UpdateWirelessDevice (Prelude.Maybe Prelude.Text)
updateWirelessDevice_destinationName :: (Maybe Text -> f (Maybe Text))
-> UpdateWirelessDevice -> f UpdateWirelessDevice
updateWirelessDevice_destinationName = (UpdateWirelessDevice -> Maybe Text)
-> (UpdateWirelessDevice -> Maybe Text -> UpdateWirelessDevice)
-> Lens
UpdateWirelessDevice UpdateWirelessDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWirelessDevice' {Maybe Text
destinationName :: Maybe Text
$sel:destinationName:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe Text
destinationName} -> Maybe Text
destinationName) (\s :: UpdateWirelessDevice
s@UpdateWirelessDevice' {} Maybe Text
a -> UpdateWirelessDevice
s {$sel:destinationName:UpdateWirelessDevice' :: Maybe Text
destinationName = Maybe Text
a} :: UpdateWirelessDevice)
updateWirelessDevice_description :: Lens.Lens' UpdateWirelessDevice (Prelude.Maybe Prelude.Text)
updateWirelessDevice_description :: (Maybe Text -> f (Maybe Text))
-> UpdateWirelessDevice -> f UpdateWirelessDevice
updateWirelessDevice_description = (UpdateWirelessDevice -> Maybe Text)
-> (UpdateWirelessDevice -> Maybe Text -> UpdateWirelessDevice)
-> Lens
UpdateWirelessDevice UpdateWirelessDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWirelessDevice' {Maybe Text
description :: Maybe Text
$sel:description:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateWirelessDevice
s@UpdateWirelessDevice' {} Maybe Text
a -> UpdateWirelessDevice
s {$sel:description:UpdateWirelessDevice' :: Maybe Text
description = Maybe Text
a} :: UpdateWirelessDevice)
updateWirelessDevice_id :: Lens.Lens' UpdateWirelessDevice Prelude.Text
updateWirelessDevice_id :: (Text -> f Text) -> UpdateWirelessDevice -> f UpdateWirelessDevice
updateWirelessDevice_id = (UpdateWirelessDevice -> Text)
-> (UpdateWirelessDevice -> Text -> UpdateWirelessDevice)
-> Lens UpdateWirelessDevice UpdateWirelessDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWirelessDevice' {Text
id :: Text
$sel:id:UpdateWirelessDevice' :: UpdateWirelessDevice -> Text
id} -> Text
id) (\s :: UpdateWirelessDevice
s@UpdateWirelessDevice' {} Text
a -> UpdateWirelessDevice
s {$sel:id:UpdateWirelessDevice' :: Text
id = Text
a} :: UpdateWirelessDevice)
instance Core.AWSRequest UpdateWirelessDevice where
type
AWSResponse UpdateWirelessDevice =
UpdateWirelessDeviceResponse
request :: UpdateWirelessDevice -> Request UpdateWirelessDevice
request = Service -> UpdateWirelessDevice -> Request UpdateWirelessDevice
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateWirelessDevice
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateWirelessDevice)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateWirelessDevice))
-> Logger
-> Service
-> Proxy UpdateWirelessDevice
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateWirelessDevice)))
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 -> UpdateWirelessDeviceResponse
UpdateWirelessDeviceResponse'
(Int -> UpdateWirelessDeviceResponse)
-> Either String Int -> Either String UpdateWirelessDeviceResponse
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 UpdateWirelessDevice
instance Prelude.NFData UpdateWirelessDevice
instance Core.ToHeaders UpdateWirelessDevice where
toHeaders :: UpdateWirelessDevice -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateWirelessDevice -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON UpdateWirelessDevice where
toJSON :: UpdateWirelessDevice -> Value
toJSON UpdateWirelessDevice' {Maybe Text
Maybe LoRaWANUpdateDevice
Text
id :: Text
description :: Maybe Text
destinationName :: Maybe Text
name :: Maybe Text
loRaWAN :: Maybe LoRaWANUpdateDevice
$sel:id:UpdateWirelessDevice' :: UpdateWirelessDevice -> Text
$sel:description:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe Text
$sel:destinationName:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe Text
$sel:name:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe Text
$sel:loRaWAN:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe LoRaWANUpdateDevice
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"LoRaWAN" Text -> LoRaWANUpdateDevice -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LoRaWANUpdateDevice -> Pair)
-> Maybe LoRaWANUpdateDevice -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LoRaWANUpdateDevice
loRaWAN,
(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,
(Text
"DestinationName" 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
destinationName,
(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 UpdateWirelessDevice where
toPath :: UpdateWirelessDevice -> ByteString
toPath UpdateWirelessDevice' {Maybe Text
Maybe LoRaWANUpdateDevice
Text
id :: Text
description :: Maybe Text
destinationName :: Maybe Text
name :: Maybe Text
loRaWAN :: Maybe LoRaWANUpdateDevice
$sel:id:UpdateWirelessDevice' :: UpdateWirelessDevice -> Text
$sel:description:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe Text
$sel:destinationName:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe Text
$sel:name:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe Text
$sel:loRaWAN:UpdateWirelessDevice' :: UpdateWirelessDevice -> Maybe LoRaWANUpdateDevice
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/wireless-devices/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]
instance Core.ToQuery UpdateWirelessDevice where
toQuery :: UpdateWirelessDevice -> QueryString
toQuery = QueryString -> UpdateWirelessDevice -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateWirelessDeviceResponse = UpdateWirelessDeviceResponse'
{
UpdateWirelessDeviceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateWirelessDeviceResponse
-> UpdateWirelessDeviceResponse -> Bool
(UpdateWirelessDeviceResponse
-> UpdateWirelessDeviceResponse -> Bool)
-> (UpdateWirelessDeviceResponse
-> UpdateWirelessDeviceResponse -> Bool)
-> Eq UpdateWirelessDeviceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWirelessDeviceResponse
-> UpdateWirelessDeviceResponse -> Bool
$c/= :: UpdateWirelessDeviceResponse
-> UpdateWirelessDeviceResponse -> Bool
== :: UpdateWirelessDeviceResponse
-> UpdateWirelessDeviceResponse -> Bool
$c== :: UpdateWirelessDeviceResponse
-> UpdateWirelessDeviceResponse -> Bool
Prelude.Eq, ReadPrec [UpdateWirelessDeviceResponse]
ReadPrec UpdateWirelessDeviceResponse
Int -> ReadS UpdateWirelessDeviceResponse
ReadS [UpdateWirelessDeviceResponse]
(Int -> ReadS UpdateWirelessDeviceResponse)
-> ReadS [UpdateWirelessDeviceResponse]
-> ReadPrec UpdateWirelessDeviceResponse
-> ReadPrec [UpdateWirelessDeviceResponse]
-> Read UpdateWirelessDeviceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWirelessDeviceResponse]
$creadListPrec :: ReadPrec [UpdateWirelessDeviceResponse]
readPrec :: ReadPrec UpdateWirelessDeviceResponse
$creadPrec :: ReadPrec UpdateWirelessDeviceResponse
readList :: ReadS [UpdateWirelessDeviceResponse]
$creadList :: ReadS [UpdateWirelessDeviceResponse]
readsPrec :: Int -> ReadS UpdateWirelessDeviceResponse
$creadsPrec :: Int -> ReadS UpdateWirelessDeviceResponse
Prelude.Read, Int -> UpdateWirelessDeviceResponse -> ShowS
[UpdateWirelessDeviceResponse] -> ShowS
UpdateWirelessDeviceResponse -> String
(Int -> UpdateWirelessDeviceResponse -> ShowS)
-> (UpdateWirelessDeviceResponse -> String)
-> ([UpdateWirelessDeviceResponse] -> ShowS)
-> Show UpdateWirelessDeviceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWirelessDeviceResponse] -> ShowS
$cshowList :: [UpdateWirelessDeviceResponse] -> ShowS
show :: UpdateWirelessDeviceResponse -> String
$cshow :: UpdateWirelessDeviceResponse -> String
showsPrec :: Int -> UpdateWirelessDeviceResponse -> ShowS
$cshowsPrec :: Int -> UpdateWirelessDeviceResponse -> ShowS
Prelude.Show, (forall x.
UpdateWirelessDeviceResponse -> Rep UpdateWirelessDeviceResponse x)
-> (forall x.
Rep UpdateWirelessDeviceResponse x -> UpdateWirelessDeviceResponse)
-> Generic UpdateWirelessDeviceResponse
forall x.
Rep UpdateWirelessDeviceResponse x -> UpdateWirelessDeviceResponse
forall x.
UpdateWirelessDeviceResponse -> Rep UpdateWirelessDeviceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateWirelessDeviceResponse x -> UpdateWirelessDeviceResponse
$cfrom :: forall x.
UpdateWirelessDeviceResponse -> Rep UpdateWirelessDeviceResponse x
Prelude.Generic)
newUpdateWirelessDeviceResponse ::
Prelude.Int ->
UpdateWirelessDeviceResponse
newUpdateWirelessDeviceResponse :: Int -> UpdateWirelessDeviceResponse
newUpdateWirelessDeviceResponse Int
pHttpStatus_ =
UpdateWirelessDeviceResponse' :: Int -> UpdateWirelessDeviceResponse
UpdateWirelessDeviceResponse'
{ $sel:httpStatus:UpdateWirelessDeviceResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateWirelessDeviceResponse_httpStatus :: Lens.Lens' UpdateWirelessDeviceResponse Prelude.Int
updateWirelessDeviceResponse_httpStatus :: (Int -> f Int)
-> UpdateWirelessDeviceResponse -> f UpdateWirelessDeviceResponse
updateWirelessDeviceResponse_httpStatus = (UpdateWirelessDeviceResponse -> Int)
-> (UpdateWirelessDeviceResponse
-> Int -> UpdateWirelessDeviceResponse)
-> Lens
UpdateWirelessDeviceResponse UpdateWirelessDeviceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWirelessDeviceResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateWirelessDeviceResponse' :: UpdateWirelessDeviceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateWirelessDeviceResponse
s@UpdateWirelessDeviceResponse' {} Int
a -> UpdateWirelessDeviceResponse
s {$sel:httpStatus:UpdateWirelessDeviceResponse' :: Int
httpStatus = Int
a} :: UpdateWirelessDeviceResponse)
instance Prelude.NFData UpdateWirelessDeviceResponse