{-# 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.AlexaBusiness.StartDeviceSync
(
StartDeviceSync (..),
newStartDeviceSync,
startDeviceSync_deviceArn,
startDeviceSync_roomArn,
startDeviceSync_features,
StartDeviceSyncResponse (..),
newStartDeviceSyncResponse,
startDeviceSyncResponse_httpStatus,
)
where
import Amazonka.AlexaBusiness.Types
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
data StartDeviceSync = StartDeviceSync'
{
StartDeviceSync -> Maybe Text
deviceArn :: Prelude.Maybe Prelude.Text,
StartDeviceSync -> Maybe Text
roomArn :: Prelude.Maybe Prelude.Text,
StartDeviceSync -> [Feature]
features :: [Feature]
}
deriving (StartDeviceSync -> StartDeviceSync -> Bool
(StartDeviceSync -> StartDeviceSync -> Bool)
-> (StartDeviceSync -> StartDeviceSync -> Bool)
-> Eq StartDeviceSync
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDeviceSync -> StartDeviceSync -> Bool
$c/= :: StartDeviceSync -> StartDeviceSync -> Bool
== :: StartDeviceSync -> StartDeviceSync -> Bool
$c== :: StartDeviceSync -> StartDeviceSync -> Bool
Prelude.Eq, ReadPrec [StartDeviceSync]
ReadPrec StartDeviceSync
Int -> ReadS StartDeviceSync
ReadS [StartDeviceSync]
(Int -> ReadS StartDeviceSync)
-> ReadS [StartDeviceSync]
-> ReadPrec StartDeviceSync
-> ReadPrec [StartDeviceSync]
-> Read StartDeviceSync
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDeviceSync]
$creadListPrec :: ReadPrec [StartDeviceSync]
readPrec :: ReadPrec StartDeviceSync
$creadPrec :: ReadPrec StartDeviceSync
readList :: ReadS [StartDeviceSync]
$creadList :: ReadS [StartDeviceSync]
readsPrec :: Int -> ReadS StartDeviceSync
$creadsPrec :: Int -> ReadS StartDeviceSync
Prelude.Read, Int -> StartDeviceSync -> ShowS
[StartDeviceSync] -> ShowS
StartDeviceSync -> String
(Int -> StartDeviceSync -> ShowS)
-> (StartDeviceSync -> String)
-> ([StartDeviceSync] -> ShowS)
-> Show StartDeviceSync
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDeviceSync] -> ShowS
$cshowList :: [StartDeviceSync] -> ShowS
show :: StartDeviceSync -> String
$cshow :: StartDeviceSync -> String
showsPrec :: Int -> StartDeviceSync -> ShowS
$cshowsPrec :: Int -> StartDeviceSync -> ShowS
Prelude.Show, (forall x. StartDeviceSync -> Rep StartDeviceSync x)
-> (forall x. Rep StartDeviceSync x -> StartDeviceSync)
-> Generic StartDeviceSync
forall x. Rep StartDeviceSync x -> StartDeviceSync
forall x. StartDeviceSync -> Rep StartDeviceSync x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartDeviceSync x -> StartDeviceSync
$cfrom :: forall x. StartDeviceSync -> Rep StartDeviceSync x
Prelude.Generic)
newStartDeviceSync ::
StartDeviceSync
newStartDeviceSync :: StartDeviceSync
newStartDeviceSync =
StartDeviceSync' :: Maybe Text -> Maybe Text -> [Feature] -> StartDeviceSync
StartDeviceSync'
{ $sel:deviceArn:StartDeviceSync' :: Maybe Text
deviceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roomArn:StartDeviceSync' :: Maybe Text
roomArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:features:StartDeviceSync' :: [Feature]
features = [Feature]
forall a. Monoid a => a
Prelude.mempty
}
startDeviceSync_deviceArn :: Lens.Lens' StartDeviceSync (Prelude.Maybe Prelude.Text)
startDeviceSync_deviceArn :: (Maybe Text -> f (Maybe Text))
-> StartDeviceSync -> f StartDeviceSync
startDeviceSync_deviceArn = (StartDeviceSync -> Maybe Text)
-> (StartDeviceSync -> Maybe Text -> StartDeviceSync)
-> Lens StartDeviceSync StartDeviceSync (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceSync' {Maybe Text
deviceArn :: Maybe Text
$sel:deviceArn:StartDeviceSync' :: StartDeviceSync -> Maybe Text
deviceArn} -> Maybe Text
deviceArn) (\s :: StartDeviceSync
s@StartDeviceSync' {} Maybe Text
a -> StartDeviceSync
s {$sel:deviceArn:StartDeviceSync' :: Maybe Text
deviceArn = Maybe Text
a} :: StartDeviceSync)
startDeviceSync_roomArn :: Lens.Lens' StartDeviceSync (Prelude.Maybe Prelude.Text)
startDeviceSync_roomArn :: (Maybe Text -> f (Maybe Text))
-> StartDeviceSync -> f StartDeviceSync
startDeviceSync_roomArn = (StartDeviceSync -> Maybe Text)
-> (StartDeviceSync -> Maybe Text -> StartDeviceSync)
-> Lens StartDeviceSync StartDeviceSync (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceSync' {Maybe Text
roomArn :: Maybe Text
$sel:roomArn:StartDeviceSync' :: StartDeviceSync -> Maybe Text
roomArn} -> Maybe Text
roomArn) (\s :: StartDeviceSync
s@StartDeviceSync' {} Maybe Text
a -> StartDeviceSync
s {$sel:roomArn:StartDeviceSync' :: Maybe Text
roomArn = Maybe Text
a} :: StartDeviceSync)
startDeviceSync_features :: Lens.Lens' StartDeviceSync [Feature]
startDeviceSync_features :: ([Feature] -> f [Feature]) -> StartDeviceSync -> f StartDeviceSync
startDeviceSync_features = (StartDeviceSync -> [Feature])
-> (StartDeviceSync -> [Feature] -> StartDeviceSync)
-> Lens StartDeviceSync StartDeviceSync [Feature] [Feature]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceSync' {[Feature]
features :: [Feature]
$sel:features:StartDeviceSync' :: StartDeviceSync -> [Feature]
features} -> [Feature]
features) (\s :: StartDeviceSync
s@StartDeviceSync' {} [Feature]
a -> StartDeviceSync
s {$sel:features:StartDeviceSync' :: [Feature]
features = [Feature]
a} :: StartDeviceSync) (([Feature] -> f [Feature])
-> StartDeviceSync -> f StartDeviceSync)
-> (([Feature] -> f [Feature]) -> [Feature] -> f [Feature])
-> ([Feature] -> f [Feature])
-> StartDeviceSync
-> f StartDeviceSync
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Feature] -> f [Feature]) -> [Feature] -> f [Feature]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest StartDeviceSync where
type
AWSResponse StartDeviceSync =
StartDeviceSyncResponse
request :: StartDeviceSync -> Request StartDeviceSync
request = Service -> StartDeviceSync -> Request StartDeviceSync
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartDeviceSync
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartDeviceSync)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse StartDeviceSync))
-> Logger
-> Service
-> Proxy StartDeviceSync
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartDeviceSync)))
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 -> StartDeviceSyncResponse
StartDeviceSyncResponse'
(Int -> StartDeviceSyncResponse)
-> Either String Int -> Either String StartDeviceSyncResponse
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 StartDeviceSync
instance Prelude.NFData StartDeviceSync
instance Core.ToHeaders StartDeviceSync where
toHeaders :: StartDeviceSync -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartDeviceSync -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AlexaForBusiness.StartDeviceSync" ::
Prelude.ByteString
),
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 StartDeviceSync where
toJSON :: StartDeviceSync -> Value
toJSON StartDeviceSync' {[Feature]
Maybe Text
features :: [Feature]
roomArn :: Maybe Text
deviceArn :: Maybe Text
$sel:features:StartDeviceSync' :: StartDeviceSync -> [Feature]
$sel:roomArn:StartDeviceSync' :: StartDeviceSync -> Maybe Text
$sel:deviceArn:StartDeviceSync' :: StartDeviceSync -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DeviceArn" 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
deviceArn,
(Text
"RoomArn" 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
roomArn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Features" Text -> [Feature] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Feature]
features)
]
)
instance Core.ToPath StartDeviceSync where
toPath :: StartDeviceSync -> ByteString
toPath = ByteString -> StartDeviceSync -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartDeviceSync where
toQuery :: StartDeviceSync -> QueryString
toQuery = QueryString -> StartDeviceSync -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartDeviceSyncResponse = StartDeviceSyncResponse'
{
StartDeviceSyncResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartDeviceSyncResponse -> StartDeviceSyncResponse -> Bool
(StartDeviceSyncResponse -> StartDeviceSyncResponse -> Bool)
-> (StartDeviceSyncResponse -> StartDeviceSyncResponse -> Bool)
-> Eq StartDeviceSyncResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDeviceSyncResponse -> StartDeviceSyncResponse -> Bool
$c/= :: StartDeviceSyncResponse -> StartDeviceSyncResponse -> Bool
== :: StartDeviceSyncResponse -> StartDeviceSyncResponse -> Bool
$c== :: StartDeviceSyncResponse -> StartDeviceSyncResponse -> Bool
Prelude.Eq, ReadPrec [StartDeviceSyncResponse]
ReadPrec StartDeviceSyncResponse
Int -> ReadS StartDeviceSyncResponse
ReadS [StartDeviceSyncResponse]
(Int -> ReadS StartDeviceSyncResponse)
-> ReadS [StartDeviceSyncResponse]
-> ReadPrec StartDeviceSyncResponse
-> ReadPrec [StartDeviceSyncResponse]
-> Read StartDeviceSyncResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDeviceSyncResponse]
$creadListPrec :: ReadPrec [StartDeviceSyncResponse]
readPrec :: ReadPrec StartDeviceSyncResponse
$creadPrec :: ReadPrec StartDeviceSyncResponse
readList :: ReadS [StartDeviceSyncResponse]
$creadList :: ReadS [StartDeviceSyncResponse]
readsPrec :: Int -> ReadS StartDeviceSyncResponse
$creadsPrec :: Int -> ReadS StartDeviceSyncResponse
Prelude.Read, Int -> StartDeviceSyncResponse -> ShowS
[StartDeviceSyncResponse] -> ShowS
StartDeviceSyncResponse -> String
(Int -> StartDeviceSyncResponse -> ShowS)
-> (StartDeviceSyncResponse -> String)
-> ([StartDeviceSyncResponse] -> ShowS)
-> Show StartDeviceSyncResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDeviceSyncResponse] -> ShowS
$cshowList :: [StartDeviceSyncResponse] -> ShowS
show :: StartDeviceSyncResponse -> String
$cshow :: StartDeviceSyncResponse -> String
showsPrec :: Int -> StartDeviceSyncResponse -> ShowS
$cshowsPrec :: Int -> StartDeviceSyncResponse -> ShowS
Prelude.Show, (forall x.
StartDeviceSyncResponse -> Rep StartDeviceSyncResponse x)
-> (forall x.
Rep StartDeviceSyncResponse x -> StartDeviceSyncResponse)
-> Generic StartDeviceSyncResponse
forall x. Rep StartDeviceSyncResponse x -> StartDeviceSyncResponse
forall x. StartDeviceSyncResponse -> Rep StartDeviceSyncResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartDeviceSyncResponse x -> StartDeviceSyncResponse
$cfrom :: forall x. StartDeviceSyncResponse -> Rep StartDeviceSyncResponse x
Prelude.Generic)
newStartDeviceSyncResponse ::
Prelude.Int ->
StartDeviceSyncResponse
newStartDeviceSyncResponse :: Int -> StartDeviceSyncResponse
newStartDeviceSyncResponse Int
pHttpStatus_ =
StartDeviceSyncResponse' :: Int -> StartDeviceSyncResponse
StartDeviceSyncResponse' {$sel:httpStatus:StartDeviceSyncResponse' :: Int
httpStatus = Int
pHttpStatus_}
startDeviceSyncResponse_httpStatus :: Lens.Lens' StartDeviceSyncResponse Prelude.Int
startDeviceSyncResponse_httpStatus :: (Int -> f Int)
-> StartDeviceSyncResponse -> f StartDeviceSyncResponse
startDeviceSyncResponse_httpStatus = (StartDeviceSyncResponse -> Int)
-> (StartDeviceSyncResponse -> Int -> StartDeviceSyncResponse)
-> Lens StartDeviceSyncResponse StartDeviceSyncResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeviceSyncResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartDeviceSyncResponse' :: StartDeviceSyncResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartDeviceSyncResponse
s@StartDeviceSyncResponse' {} Int
a -> StartDeviceSyncResponse
s {$sel:httpStatus:StartDeviceSyncResponse' :: Int
httpStatus = Int
a} :: StartDeviceSyncResponse)
instance Prelude.NFData StartDeviceSyncResponse