{-# 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.IoT1ClickProjects.AssociateDeviceWithPlacement
(
AssociateDeviceWithPlacement (..),
newAssociateDeviceWithPlacement,
associateDeviceWithPlacement_projectName,
associateDeviceWithPlacement_placementName,
associateDeviceWithPlacement_deviceId,
associateDeviceWithPlacement_deviceTemplateName,
AssociateDeviceWithPlacementResponse (..),
newAssociateDeviceWithPlacementResponse,
associateDeviceWithPlacementResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT1ClickProjects.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 AssociateDeviceWithPlacement = AssociateDeviceWithPlacement'
{
AssociateDeviceWithPlacement -> Text
projectName :: Prelude.Text,
AssociateDeviceWithPlacement -> Text
placementName :: Prelude.Text,
AssociateDeviceWithPlacement -> Text
deviceId :: Prelude.Text,
AssociateDeviceWithPlacement -> Text
deviceTemplateName :: Prelude.Text
}
deriving (AssociateDeviceWithPlacement
-> AssociateDeviceWithPlacement -> Bool
(AssociateDeviceWithPlacement
-> AssociateDeviceWithPlacement -> Bool)
-> (AssociateDeviceWithPlacement
-> AssociateDeviceWithPlacement -> Bool)
-> Eq AssociateDeviceWithPlacement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateDeviceWithPlacement
-> AssociateDeviceWithPlacement -> Bool
$c/= :: AssociateDeviceWithPlacement
-> AssociateDeviceWithPlacement -> Bool
== :: AssociateDeviceWithPlacement
-> AssociateDeviceWithPlacement -> Bool
$c== :: AssociateDeviceWithPlacement
-> AssociateDeviceWithPlacement -> Bool
Prelude.Eq, ReadPrec [AssociateDeviceWithPlacement]
ReadPrec AssociateDeviceWithPlacement
Int -> ReadS AssociateDeviceWithPlacement
ReadS [AssociateDeviceWithPlacement]
(Int -> ReadS AssociateDeviceWithPlacement)
-> ReadS [AssociateDeviceWithPlacement]
-> ReadPrec AssociateDeviceWithPlacement
-> ReadPrec [AssociateDeviceWithPlacement]
-> Read AssociateDeviceWithPlacement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateDeviceWithPlacement]
$creadListPrec :: ReadPrec [AssociateDeviceWithPlacement]
readPrec :: ReadPrec AssociateDeviceWithPlacement
$creadPrec :: ReadPrec AssociateDeviceWithPlacement
readList :: ReadS [AssociateDeviceWithPlacement]
$creadList :: ReadS [AssociateDeviceWithPlacement]
readsPrec :: Int -> ReadS AssociateDeviceWithPlacement
$creadsPrec :: Int -> ReadS AssociateDeviceWithPlacement
Prelude.Read, Int -> AssociateDeviceWithPlacement -> ShowS
[AssociateDeviceWithPlacement] -> ShowS
AssociateDeviceWithPlacement -> String
(Int -> AssociateDeviceWithPlacement -> ShowS)
-> (AssociateDeviceWithPlacement -> String)
-> ([AssociateDeviceWithPlacement] -> ShowS)
-> Show AssociateDeviceWithPlacement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateDeviceWithPlacement] -> ShowS
$cshowList :: [AssociateDeviceWithPlacement] -> ShowS
show :: AssociateDeviceWithPlacement -> String
$cshow :: AssociateDeviceWithPlacement -> String
showsPrec :: Int -> AssociateDeviceWithPlacement -> ShowS
$cshowsPrec :: Int -> AssociateDeviceWithPlacement -> ShowS
Prelude.Show, (forall x.
AssociateDeviceWithPlacement -> Rep AssociateDeviceWithPlacement x)
-> (forall x.
Rep AssociateDeviceWithPlacement x -> AssociateDeviceWithPlacement)
-> Generic AssociateDeviceWithPlacement
forall x.
Rep AssociateDeviceWithPlacement x -> AssociateDeviceWithPlacement
forall x.
AssociateDeviceWithPlacement -> Rep AssociateDeviceWithPlacement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateDeviceWithPlacement x -> AssociateDeviceWithPlacement
$cfrom :: forall x.
AssociateDeviceWithPlacement -> Rep AssociateDeviceWithPlacement x
Prelude.Generic)
newAssociateDeviceWithPlacement ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
AssociateDeviceWithPlacement
newAssociateDeviceWithPlacement :: Text -> Text -> Text -> Text -> AssociateDeviceWithPlacement
newAssociateDeviceWithPlacement
Text
pProjectName_
Text
pPlacementName_
Text
pDeviceId_
Text
pDeviceTemplateName_ =
AssociateDeviceWithPlacement' :: Text -> Text -> Text -> Text -> AssociateDeviceWithPlacement
AssociateDeviceWithPlacement'
{ $sel:projectName:AssociateDeviceWithPlacement' :: Text
projectName =
Text
pProjectName_,
$sel:placementName:AssociateDeviceWithPlacement' :: Text
placementName = Text
pPlacementName_,
$sel:deviceId:AssociateDeviceWithPlacement' :: Text
deviceId = Text
pDeviceId_,
$sel:deviceTemplateName:AssociateDeviceWithPlacement' :: Text
deviceTemplateName = Text
pDeviceTemplateName_
}
associateDeviceWithPlacement_projectName :: Lens.Lens' AssociateDeviceWithPlacement Prelude.Text
associateDeviceWithPlacement_projectName :: (Text -> f Text)
-> AssociateDeviceWithPlacement -> f AssociateDeviceWithPlacement
associateDeviceWithPlacement_projectName = (AssociateDeviceWithPlacement -> Text)
-> (AssociateDeviceWithPlacement
-> Text -> AssociateDeviceWithPlacement)
-> Lens
AssociateDeviceWithPlacement AssociateDeviceWithPlacement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDeviceWithPlacement' {Text
projectName :: Text
$sel:projectName:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
projectName} -> Text
projectName) (\s :: AssociateDeviceWithPlacement
s@AssociateDeviceWithPlacement' {} Text
a -> AssociateDeviceWithPlacement
s {$sel:projectName:AssociateDeviceWithPlacement' :: Text
projectName = Text
a} :: AssociateDeviceWithPlacement)
associateDeviceWithPlacement_placementName :: Lens.Lens' AssociateDeviceWithPlacement Prelude.Text
associateDeviceWithPlacement_placementName :: (Text -> f Text)
-> AssociateDeviceWithPlacement -> f AssociateDeviceWithPlacement
associateDeviceWithPlacement_placementName = (AssociateDeviceWithPlacement -> Text)
-> (AssociateDeviceWithPlacement
-> Text -> AssociateDeviceWithPlacement)
-> Lens
AssociateDeviceWithPlacement AssociateDeviceWithPlacement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDeviceWithPlacement' {Text
placementName :: Text
$sel:placementName:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
placementName} -> Text
placementName) (\s :: AssociateDeviceWithPlacement
s@AssociateDeviceWithPlacement' {} Text
a -> AssociateDeviceWithPlacement
s {$sel:placementName:AssociateDeviceWithPlacement' :: Text
placementName = Text
a} :: AssociateDeviceWithPlacement)
associateDeviceWithPlacement_deviceId :: Lens.Lens' AssociateDeviceWithPlacement Prelude.Text
associateDeviceWithPlacement_deviceId :: (Text -> f Text)
-> AssociateDeviceWithPlacement -> f AssociateDeviceWithPlacement
associateDeviceWithPlacement_deviceId = (AssociateDeviceWithPlacement -> Text)
-> (AssociateDeviceWithPlacement
-> Text -> AssociateDeviceWithPlacement)
-> Lens
AssociateDeviceWithPlacement AssociateDeviceWithPlacement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDeviceWithPlacement' {Text
deviceId :: Text
$sel:deviceId:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
deviceId} -> Text
deviceId) (\s :: AssociateDeviceWithPlacement
s@AssociateDeviceWithPlacement' {} Text
a -> AssociateDeviceWithPlacement
s {$sel:deviceId:AssociateDeviceWithPlacement' :: Text
deviceId = Text
a} :: AssociateDeviceWithPlacement)
associateDeviceWithPlacement_deviceTemplateName :: Lens.Lens' AssociateDeviceWithPlacement Prelude.Text
associateDeviceWithPlacement_deviceTemplateName :: (Text -> f Text)
-> AssociateDeviceWithPlacement -> f AssociateDeviceWithPlacement
associateDeviceWithPlacement_deviceTemplateName = (AssociateDeviceWithPlacement -> Text)
-> (AssociateDeviceWithPlacement
-> Text -> AssociateDeviceWithPlacement)
-> Lens
AssociateDeviceWithPlacement AssociateDeviceWithPlacement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDeviceWithPlacement' {Text
deviceTemplateName :: Text
$sel:deviceTemplateName:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
deviceTemplateName} -> Text
deviceTemplateName) (\s :: AssociateDeviceWithPlacement
s@AssociateDeviceWithPlacement' {} Text
a -> AssociateDeviceWithPlacement
s {$sel:deviceTemplateName:AssociateDeviceWithPlacement' :: Text
deviceTemplateName = Text
a} :: AssociateDeviceWithPlacement)
instance Core.AWSRequest AssociateDeviceWithPlacement where
type
AWSResponse AssociateDeviceWithPlacement =
AssociateDeviceWithPlacementResponse
request :: AssociateDeviceWithPlacement
-> Request AssociateDeviceWithPlacement
request = Service
-> AssociateDeviceWithPlacement
-> Request AssociateDeviceWithPlacement
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateDeviceWithPlacement
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateDeviceWithPlacement)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AssociateDeviceWithPlacement))
-> Logger
-> Service
-> Proxy AssociateDeviceWithPlacement
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateDeviceWithPlacement)))
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 -> AssociateDeviceWithPlacementResponse
AssociateDeviceWithPlacementResponse'
(Int -> AssociateDeviceWithPlacementResponse)
-> Either String Int
-> Either String AssociateDeviceWithPlacementResponse
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
AssociateDeviceWithPlacement
instance Prelude.NFData AssociateDeviceWithPlacement
instance Core.ToHeaders AssociateDeviceWithPlacement where
toHeaders :: AssociateDeviceWithPlacement -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateDeviceWithPlacement -> 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 AssociateDeviceWithPlacement where
toJSON :: AssociateDeviceWithPlacement -> Value
toJSON AssociateDeviceWithPlacement' {Text
deviceTemplateName :: Text
deviceId :: Text
placementName :: Text
projectName :: Text
$sel:deviceTemplateName:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
$sel:deviceId:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
$sel:placementName:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
$sel:projectName:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> 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
"deviceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deviceId)]
)
instance Core.ToPath AssociateDeviceWithPlacement where
toPath :: AssociateDeviceWithPlacement -> ByteString
toPath AssociateDeviceWithPlacement' {Text
deviceTemplateName :: Text
deviceId :: Text
placementName :: Text
projectName :: Text
$sel:deviceTemplateName:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
$sel:deviceId:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
$sel:placementName:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
$sel:projectName:AssociateDeviceWithPlacement' :: AssociateDeviceWithPlacement -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/projects/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
projectName,
ByteString
"/placements/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
placementName,
ByteString
"/devices/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
deviceTemplateName
]
instance Core.ToQuery AssociateDeviceWithPlacement where
toQuery :: AssociateDeviceWithPlacement -> QueryString
toQuery = QueryString -> AssociateDeviceWithPlacement -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateDeviceWithPlacementResponse = AssociateDeviceWithPlacementResponse'
{
AssociateDeviceWithPlacementResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateDeviceWithPlacementResponse
-> AssociateDeviceWithPlacementResponse -> Bool
(AssociateDeviceWithPlacementResponse
-> AssociateDeviceWithPlacementResponse -> Bool)
-> (AssociateDeviceWithPlacementResponse
-> AssociateDeviceWithPlacementResponse -> Bool)
-> Eq AssociateDeviceWithPlacementResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateDeviceWithPlacementResponse
-> AssociateDeviceWithPlacementResponse -> Bool
$c/= :: AssociateDeviceWithPlacementResponse
-> AssociateDeviceWithPlacementResponse -> Bool
== :: AssociateDeviceWithPlacementResponse
-> AssociateDeviceWithPlacementResponse -> Bool
$c== :: AssociateDeviceWithPlacementResponse
-> AssociateDeviceWithPlacementResponse -> Bool
Prelude.Eq, ReadPrec [AssociateDeviceWithPlacementResponse]
ReadPrec AssociateDeviceWithPlacementResponse
Int -> ReadS AssociateDeviceWithPlacementResponse
ReadS [AssociateDeviceWithPlacementResponse]
(Int -> ReadS AssociateDeviceWithPlacementResponse)
-> ReadS [AssociateDeviceWithPlacementResponse]
-> ReadPrec AssociateDeviceWithPlacementResponse
-> ReadPrec [AssociateDeviceWithPlacementResponse]
-> Read AssociateDeviceWithPlacementResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateDeviceWithPlacementResponse]
$creadListPrec :: ReadPrec [AssociateDeviceWithPlacementResponse]
readPrec :: ReadPrec AssociateDeviceWithPlacementResponse
$creadPrec :: ReadPrec AssociateDeviceWithPlacementResponse
readList :: ReadS [AssociateDeviceWithPlacementResponse]
$creadList :: ReadS [AssociateDeviceWithPlacementResponse]
readsPrec :: Int -> ReadS AssociateDeviceWithPlacementResponse
$creadsPrec :: Int -> ReadS AssociateDeviceWithPlacementResponse
Prelude.Read, Int -> AssociateDeviceWithPlacementResponse -> ShowS
[AssociateDeviceWithPlacementResponse] -> ShowS
AssociateDeviceWithPlacementResponse -> String
(Int -> AssociateDeviceWithPlacementResponse -> ShowS)
-> (AssociateDeviceWithPlacementResponse -> String)
-> ([AssociateDeviceWithPlacementResponse] -> ShowS)
-> Show AssociateDeviceWithPlacementResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateDeviceWithPlacementResponse] -> ShowS
$cshowList :: [AssociateDeviceWithPlacementResponse] -> ShowS
show :: AssociateDeviceWithPlacementResponse -> String
$cshow :: AssociateDeviceWithPlacementResponse -> String
showsPrec :: Int -> AssociateDeviceWithPlacementResponse -> ShowS
$cshowsPrec :: Int -> AssociateDeviceWithPlacementResponse -> ShowS
Prelude.Show, (forall x.
AssociateDeviceWithPlacementResponse
-> Rep AssociateDeviceWithPlacementResponse x)
-> (forall x.
Rep AssociateDeviceWithPlacementResponse x
-> AssociateDeviceWithPlacementResponse)
-> Generic AssociateDeviceWithPlacementResponse
forall x.
Rep AssociateDeviceWithPlacementResponse x
-> AssociateDeviceWithPlacementResponse
forall x.
AssociateDeviceWithPlacementResponse
-> Rep AssociateDeviceWithPlacementResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateDeviceWithPlacementResponse x
-> AssociateDeviceWithPlacementResponse
$cfrom :: forall x.
AssociateDeviceWithPlacementResponse
-> Rep AssociateDeviceWithPlacementResponse x
Prelude.Generic)
newAssociateDeviceWithPlacementResponse ::
Prelude.Int ->
AssociateDeviceWithPlacementResponse
newAssociateDeviceWithPlacementResponse :: Int -> AssociateDeviceWithPlacementResponse
newAssociateDeviceWithPlacementResponse Int
pHttpStatus_ =
AssociateDeviceWithPlacementResponse' :: Int -> AssociateDeviceWithPlacementResponse
AssociateDeviceWithPlacementResponse'
{ $sel:httpStatus:AssociateDeviceWithPlacementResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
associateDeviceWithPlacementResponse_httpStatus :: Lens.Lens' AssociateDeviceWithPlacementResponse Prelude.Int
associateDeviceWithPlacementResponse_httpStatus :: (Int -> f Int)
-> AssociateDeviceWithPlacementResponse
-> f AssociateDeviceWithPlacementResponse
associateDeviceWithPlacementResponse_httpStatus = (AssociateDeviceWithPlacementResponse -> Int)
-> (AssociateDeviceWithPlacementResponse
-> Int -> AssociateDeviceWithPlacementResponse)
-> Lens
AssociateDeviceWithPlacementResponse
AssociateDeviceWithPlacementResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDeviceWithPlacementResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateDeviceWithPlacementResponse' :: AssociateDeviceWithPlacementResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateDeviceWithPlacementResponse
s@AssociateDeviceWithPlacementResponse' {} Int
a -> AssociateDeviceWithPlacementResponse
s {$sel:httpStatus:AssociateDeviceWithPlacementResponse' :: Int
httpStatus = Int
a} :: AssociateDeviceWithPlacementResponse)
instance
Prelude.NFData
AssociateDeviceWithPlacementResponse