{-# 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.IoTSiteWise.AssociateAssets
(
AssociateAssets (..),
newAssociateAssets,
associateAssets_clientToken,
associateAssets_assetId,
associateAssets_hierarchyId,
associateAssets_childAssetId,
AssociateAssetsResponse (..),
newAssociateAssetsResponse,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.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 AssociateAssets = AssociateAssets'
{
AssociateAssets -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
AssociateAssets -> Text
assetId :: Prelude.Text,
AssociateAssets -> Text
hierarchyId :: Prelude.Text,
AssociateAssets -> Text
childAssetId :: Prelude.Text
}
deriving (AssociateAssets -> AssociateAssets -> Bool
(AssociateAssets -> AssociateAssets -> Bool)
-> (AssociateAssets -> AssociateAssets -> Bool)
-> Eq AssociateAssets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateAssets -> AssociateAssets -> Bool
$c/= :: AssociateAssets -> AssociateAssets -> Bool
== :: AssociateAssets -> AssociateAssets -> Bool
$c== :: AssociateAssets -> AssociateAssets -> Bool
Prelude.Eq, ReadPrec [AssociateAssets]
ReadPrec AssociateAssets
Int -> ReadS AssociateAssets
ReadS [AssociateAssets]
(Int -> ReadS AssociateAssets)
-> ReadS [AssociateAssets]
-> ReadPrec AssociateAssets
-> ReadPrec [AssociateAssets]
-> Read AssociateAssets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateAssets]
$creadListPrec :: ReadPrec [AssociateAssets]
readPrec :: ReadPrec AssociateAssets
$creadPrec :: ReadPrec AssociateAssets
readList :: ReadS [AssociateAssets]
$creadList :: ReadS [AssociateAssets]
readsPrec :: Int -> ReadS AssociateAssets
$creadsPrec :: Int -> ReadS AssociateAssets
Prelude.Read, Int -> AssociateAssets -> ShowS
[AssociateAssets] -> ShowS
AssociateAssets -> String
(Int -> AssociateAssets -> ShowS)
-> (AssociateAssets -> String)
-> ([AssociateAssets] -> ShowS)
-> Show AssociateAssets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateAssets] -> ShowS
$cshowList :: [AssociateAssets] -> ShowS
show :: AssociateAssets -> String
$cshow :: AssociateAssets -> String
showsPrec :: Int -> AssociateAssets -> ShowS
$cshowsPrec :: Int -> AssociateAssets -> ShowS
Prelude.Show, (forall x. AssociateAssets -> Rep AssociateAssets x)
-> (forall x. Rep AssociateAssets x -> AssociateAssets)
-> Generic AssociateAssets
forall x. Rep AssociateAssets x -> AssociateAssets
forall x. AssociateAssets -> Rep AssociateAssets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateAssets x -> AssociateAssets
$cfrom :: forall x. AssociateAssets -> Rep AssociateAssets x
Prelude.Generic)
newAssociateAssets ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
AssociateAssets
newAssociateAssets :: Text -> Text -> Text -> AssociateAssets
newAssociateAssets
Text
pAssetId_
Text
pHierarchyId_
Text
pChildAssetId_ =
AssociateAssets' :: Maybe Text -> Text -> Text -> Text -> AssociateAssets
AssociateAssets'
{ $sel:clientToken:AssociateAssets' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:assetId:AssociateAssets' :: Text
assetId = Text
pAssetId_,
$sel:hierarchyId:AssociateAssets' :: Text
hierarchyId = Text
pHierarchyId_,
$sel:childAssetId:AssociateAssets' :: Text
childAssetId = Text
pChildAssetId_
}
associateAssets_clientToken :: Lens.Lens' AssociateAssets (Prelude.Maybe Prelude.Text)
associateAssets_clientToken :: (Maybe Text -> f (Maybe Text))
-> AssociateAssets -> f AssociateAssets
associateAssets_clientToken = (AssociateAssets -> Maybe Text)
-> (AssociateAssets -> Maybe Text -> AssociateAssets)
-> Lens AssociateAssets AssociateAssets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAssets' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:AssociateAssets' :: AssociateAssets -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: AssociateAssets
s@AssociateAssets' {} Maybe Text
a -> AssociateAssets
s {$sel:clientToken:AssociateAssets' :: Maybe Text
clientToken = Maybe Text
a} :: AssociateAssets)
associateAssets_assetId :: Lens.Lens' AssociateAssets Prelude.Text
associateAssets_assetId :: (Text -> f Text) -> AssociateAssets -> f AssociateAssets
associateAssets_assetId = (AssociateAssets -> Text)
-> (AssociateAssets -> Text -> AssociateAssets)
-> Lens AssociateAssets AssociateAssets Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAssets' {Text
assetId :: Text
$sel:assetId:AssociateAssets' :: AssociateAssets -> Text
assetId} -> Text
assetId) (\s :: AssociateAssets
s@AssociateAssets' {} Text
a -> AssociateAssets
s {$sel:assetId:AssociateAssets' :: Text
assetId = Text
a} :: AssociateAssets)
associateAssets_hierarchyId :: Lens.Lens' AssociateAssets Prelude.Text
associateAssets_hierarchyId :: (Text -> f Text) -> AssociateAssets -> f AssociateAssets
associateAssets_hierarchyId = (AssociateAssets -> Text)
-> (AssociateAssets -> Text -> AssociateAssets)
-> Lens AssociateAssets AssociateAssets Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAssets' {Text
hierarchyId :: Text
$sel:hierarchyId:AssociateAssets' :: AssociateAssets -> Text
hierarchyId} -> Text
hierarchyId) (\s :: AssociateAssets
s@AssociateAssets' {} Text
a -> AssociateAssets
s {$sel:hierarchyId:AssociateAssets' :: Text
hierarchyId = Text
a} :: AssociateAssets)
associateAssets_childAssetId :: Lens.Lens' AssociateAssets Prelude.Text
associateAssets_childAssetId :: (Text -> f Text) -> AssociateAssets -> f AssociateAssets
associateAssets_childAssetId = (AssociateAssets -> Text)
-> (AssociateAssets -> Text -> AssociateAssets)
-> Lens AssociateAssets AssociateAssets Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateAssets' {Text
childAssetId :: Text
$sel:childAssetId:AssociateAssets' :: AssociateAssets -> Text
childAssetId} -> Text
childAssetId) (\s :: AssociateAssets
s@AssociateAssets' {} Text
a -> AssociateAssets
s {$sel:childAssetId:AssociateAssets' :: Text
childAssetId = Text
a} :: AssociateAssets)
instance Core.AWSRequest AssociateAssets where
type
AWSResponse AssociateAssets =
AssociateAssetsResponse
request :: AssociateAssets -> Request AssociateAssets
request = Service -> AssociateAssets -> Request AssociateAssets
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateAssets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateAssets)))
response =
AWSResponse AssociateAssets
-> Logger
-> Service
-> Proxy AssociateAssets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateAssets)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse AssociateAssets
AssociateAssetsResponse
AssociateAssetsResponse'
instance Prelude.Hashable AssociateAssets
instance Prelude.NFData AssociateAssets
instance Core.ToHeaders AssociateAssets where
toHeaders :: AssociateAssets -> [Header]
toHeaders =
[Header] -> AssociateAssets -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON AssociateAssets where
toJSON :: AssociateAssets -> Value
toJSON AssociateAssets' {Maybe Text
Text
childAssetId :: Text
hierarchyId :: Text
assetId :: Text
clientToken :: Maybe Text
$sel:childAssetId:AssociateAssets' :: AssociateAssets -> Text
$sel:hierarchyId:AssociateAssets' :: AssociateAssets -> Text
$sel:assetId:AssociateAssets' :: AssociateAssets -> Text
$sel:clientToken:AssociateAssets' :: AssociateAssets -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientToken" 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
clientToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"hierarchyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
hierarchyId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"childAssetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
childAssetId)
]
)
instance Core.ToPath AssociateAssets where
toPath :: AssociateAssets -> ByteString
toPath AssociateAssets' {Maybe Text
Text
childAssetId :: Text
hierarchyId :: Text
assetId :: Text
clientToken :: Maybe Text
$sel:childAssetId:AssociateAssets' :: AssociateAssets -> Text
$sel:hierarchyId:AssociateAssets' :: AssociateAssets -> Text
$sel:assetId:AssociateAssets' :: AssociateAssets -> Text
$sel:clientToken:AssociateAssets' :: AssociateAssets -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/assets/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
assetId, ByteString
"/associate"]
instance Core.ToQuery AssociateAssets where
toQuery :: AssociateAssets -> QueryString
toQuery = QueryString -> AssociateAssets -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateAssetsResponse = AssociateAssetsResponse'
{
}
deriving (AssociateAssetsResponse -> AssociateAssetsResponse -> Bool
(AssociateAssetsResponse -> AssociateAssetsResponse -> Bool)
-> (AssociateAssetsResponse -> AssociateAssetsResponse -> Bool)
-> Eq AssociateAssetsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateAssetsResponse -> AssociateAssetsResponse -> Bool
$c/= :: AssociateAssetsResponse -> AssociateAssetsResponse -> Bool
== :: AssociateAssetsResponse -> AssociateAssetsResponse -> Bool
$c== :: AssociateAssetsResponse -> AssociateAssetsResponse -> Bool
Prelude.Eq, ReadPrec [AssociateAssetsResponse]
ReadPrec AssociateAssetsResponse
Int -> ReadS AssociateAssetsResponse
ReadS [AssociateAssetsResponse]
(Int -> ReadS AssociateAssetsResponse)
-> ReadS [AssociateAssetsResponse]
-> ReadPrec AssociateAssetsResponse
-> ReadPrec [AssociateAssetsResponse]
-> Read AssociateAssetsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateAssetsResponse]
$creadListPrec :: ReadPrec [AssociateAssetsResponse]
readPrec :: ReadPrec AssociateAssetsResponse
$creadPrec :: ReadPrec AssociateAssetsResponse
readList :: ReadS [AssociateAssetsResponse]
$creadList :: ReadS [AssociateAssetsResponse]
readsPrec :: Int -> ReadS AssociateAssetsResponse
$creadsPrec :: Int -> ReadS AssociateAssetsResponse
Prelude.Read, Int -> AssociateAssetsResponse -> ShowS
[AssociateAssetsResponse] -> ShowS
AssociateAssetsResponse -> String
(Int -> AssociateAssetsResponse -> ShowS)
-> (AssociateAssetsResponse -> String)
-> ([AssociateAssetsResponse] -> ShowS)
-> Show AssociateAssetsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateAssetsResponse] -> ShowS
$cshowList :: [AssociateAssetsResponse] -> ShowS
show :: AssociateAssetsResponse -> String
$cshow :: AssociateAssetsResponse -> String
showsPrec :: Int -> AssociateAssetsResponse -> ShowS
$cshowsPrec :: Int -> AssociateAssetsResponse -> ShowS
Prelude.Show, (forall x.
AssociateAssetsResponse -> Rep AssociateAssetsResponse x)
-> (forall x.
Rep AssociateAssetsResponse x -> AssociateAssetsResponse)
-> Generic AssociateAssetsResponse
forall x. Rep AssociateAssetsResponse x -> AssociateAssetsResponse
forall x. AssociateAssetsResponse -> Rep AssociateAssetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateAssetsResponse x -> AssociateAssetsResponse
$cfrom :: forall x. AssociateAssetsResponse -> Rep AssociateAssetsResponse x
Prelude.Generic)
newAssociateAssetsResponse ::
AssociateAssetsResponse
newAssociateAssetsResponse :: AssociateAssetsResponse
newAssociateAssetsResponse = AssociateAssetsResponse
AssociateAssetsResponse'
instance Prelude.NFData AssociateAssetsResponse