{-# 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.DisassociateAssets
(
DisassociateAssets (..),
newDisassociateAssets,
disassociateAssets_clientToken,
disassociateAssets_assetId,
disassociateAssets_hierarchyId,
disassociateAssets_childAssetId,
DisassociateAssetsResponse (..),
newDisassociateAssetsResponse,
)
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 DisassociateAssets = DisassociateAssets'
{
DisassociateAssets -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
DisassociateAssets -> Text
assetId :: Prelude.Text,
DisassociateAssets -> Text
hierarchyId :: Prelude.Text,
DisassociateAssets -> Text
childAssetId :: Prelude.Text
}
deriving (DisassociateAssets -> DisassociateAssets -> Bool
(DisassociateAssets -> DisassociateAssets -> Bool)
-> (DisassociateAssets -> DisassociateAssets -> Bool)
-> Eq DisassociateAssets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateAssets -> DisassociateAssets -> Bool
$c/= :: DisassociateAssets -> DisassociateAssets -> Bool
== :: DisassociateAssets -> DisassociateAssets -> Bool
$c== :: DisassociateAssets -> DisassociateAssets -> Bool
Prelude.Eq, ReadPrec [DisassociateAssets]
ReadPrec DisassociateAssets
Int -> ReadS DisassociateAssets
ReadS [DisassociateAssets]
(Int -> ReadS DisassociateAssets)
-> ReadS [DisassociateAssets]
-> ReadPrec DisassociateAssets
-> ReadPrec [DisassociateAssets]
-> Read DisassociateAssets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateAssets]
$creadListPrec :: ReadPrec [DisassociateAssets]
readPrec :: ReadPrec DisassociateAssets
$creadPrec :: ReadPrec DisassociateAssets
readList :: ReadS [DisassociateAssets]
$creadList :: ReadS [DisassociateAssets]
readsPrec :: Int -> ReadS DisassociateAssets
$creadsPrec :: Int -> ReadS DisassociateAssets
Prelude.Read, Int -> DisassociateAssets -> ShowS
[DisassociateAssets] -> ShowS
DisassociateAssets -> String
(Int -> DisassociateAssets -> ShowS)
-> (DisassociateAssets -> String)
-> ([DisassociateAssets] -> ShowS)
-> Show DisassociateAssets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateAssets] -> ShowS
$cshowList :: [DisassociateAssets] -> ShowS
show :: DisassociateAssets -> String
$cshow :: DisassociateAssets -> String
showsPrec :: Int -> DisassociateAssets -> ShowS
$cshowsPrec :: Int -> DisassociateAssets -> ShowS
Prelude.Show, (forall x. DisassociateAssets -> Rep DisassociateAssets x)
-> (forall x. Rep DisassociateAssets x -> DisassociateAssets)
-> Generic DisassociateAssets
forall x. Rep DisassociateAssets x -> DisassociateAssets
forall x. DisassociateAssets -> Rep DisassociateAssets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisassociateAssets x -> DisassociateAssets
$cfrom :: forall x. DisassociateAssets -> Rep DisassociateAssets x
Prelude.Generic)
newDisassociateAssets ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
DisassociateAssets
newDisassociateAssets :: Text -> Text -> Text -> DisassociateAssets
newDisassociateAssets
Text
pAssetId_
Text
pHierarchyId_
Text
pChildAssetId_ =
DisassociateAssets' :: Maybe Text -> Text -> Text -> Text -> DisassociateAssets
DisassociateAssets'
{ $sel:clientToken:DisassociateAssets' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:assetId:DisassociateAssets' :: Text
assetId = Text
pAssetId_,
$sel:hierarchyId:DisassociateAssets' :: Text
hierarchyId = Text
pHierarchyId_,
$sel:childAssetId:DisassociateAssets' :: Text
childAssetId = Text
pChildAssetId_
}
disassociateAssets_clientToken :: Lens.Lens' DisassociateAssets (Prelude.Maybe Prelude.Text)
disassociateAssets_clientToken :: (Maybe Text -> f (Maybe Text))
-> DisassociateAssets -> f DisassociateAssets
disassociateAssets_clientToken = (DisassociateAssets -> Maybe Text)
-> (DisassociateAssets -> Maybe Text -> DisassociateAssets)
-> Lens
DisassociateAssets DisassociateAssets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateAssets' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DisassociateAssets' :: DisassociateAssets -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DisassociateAssets
s@DisassociateAssets' {} Maybe Text
a -> DisassociateAssets
s {$sel:clientToken:DisassociateAssets' :: Maybe Text
clientToken = Maybe Text
a} :: DisassociateAssets)
disassociateAssets_assetId :: Lens.Lens' DisassociateAssets Prelude.Text
disassociateAssets_assetId :: (Text -> f Text) -> DisassociateAssets -> f DisassociateAssets
disassociateAssets_assetId = (DisassociateAssets -> Text)
-> (DisassociateAssets -> Text -> DisassociateAssets)
-> Lens DisassociateAssets DisassociateAssets Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateAssets' {Text
assetId :: Text
$sel:assetId:DisassociateAssets' :: DisassociateAssets -> Text
assetId} -> Text
assetId) (\s :: DisassociateAssets
s@DisassociateAssets' {} Text
a -> DisassociateAssets
s {$sel:assetId:DisassociateAssets' :: Text
assetId = Text
a} :: DisassociateAssets)
disassociateAssets_hierarchyId :: Lens.Lens' DisassociateAssets Prelude.Text
disassociateAssets_hierarchyId :: (Text -> f Text) -> DisassociateAssets -> f DisassociateAssets
disassociateAssets_hierarchyId = (DisassociateAssets -> Text)
-> (DisassociateAssets -> Text -> DisassociateAssets)
-> Lens DisassociateAssets DisassociateAssets Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateAssets' {Text
hierarchyId :: Text
$sel:hierarchyId:DisassociateAssets' :: DisassociateAssets -> Text
hierarchyId} -> Text
hierarchyId) (\s :: DisassociateAssets
s@DisassociateAssets' {} Text
a -> DisassociateAssets
s {$sel:hierarchyId:DisassociateAssets' :: Text
hierarchyId = Text
a} :: DisassociateAssets)
disassociateAssets_childAssetId :: Lens.Lens' DisassociateAssets Prelude.Text
disassociateAssets_childAssetId :: (Text -> f Text) -> DisassociateAssets -> f DisassociateAssets
disassociateAssets_childAssetId = (DisassociateAssets -> Text)
-> (DisassociateAssets -> Text -> DisassociateAssets)
-> Lens DisassociateAssets DisassociateAssets Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateAssets' {Text
childAssetId :: Text
$sel:childAssetId:DisassociateAssets' :: DisassociateAssets -> Text
childAssetId} -> Text
childAssetId) (\s :: DisassociateAssets
s@DisassociateAssets' {} Text
a -> DisassociateAssets
s {$sel:childAssetId:DisassociateAssets' :: Text
childAssetId = Text
a} :: DisassociateAssets)
instance Core.AWSRequest DisassociateAssets where
type
AWSResponse DisassociateAssets =
DisassociateAssetsResponse
request :: DisassociateAssets -> Request DisassociateAssets
request = Service -> DisassociateAssets -> Request DisassociateAssets
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DisassociateAssets
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DisassociateAssets)))
response =
AWSResponse DisassociateAssets
-> Logger
-> Service
-> Proxy DisassociateAssets
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DisassociateAssets)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DisassociateAssets
DisassociateAssetsResponse
DisassociateAssetsResponse'
instance Prelude.Hashable DisassociateAssets
instance Prelude.NFData DisassociateAssets
instance Core.ToHeaders DisassociateAssets where
toHeaders :: DisassociateAssets -> [Header]
toHeaders =
[Header] -> DisassociateAssets -> [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 DisassociateAssets where
toJSON :: DisassociateAssets -> Value
toJSON DisassociateAssets' {Maybe Text
Text
childAssetId :: Text
hierarchyId :: Text
assetId :: Text
clientToken :: Maybe Text
$sel:childAssetId:DisassociateAssets' :: DisassociateAssets -> Text
$sel:hierarchyId:DisassociateAssets' :: DisassociateAssets -> Text
$sel:assetId:DisassociateAssets' :: DisassociateAssets -> Text
$sel:clientToken:DisassociateAssets' :: DisassociateAssets -> 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 DisassociateAssets where
toPath :: DisassociateAssets -> ByteString
toPath DisassociateAssets' {Maybe Text
Text
childAssetId :: Text
hierarchyId :: Text
assetId :: Text
clientToken :: Maybe Text
$sel:childAssetId:DisassociateAssets' :: DisassociateAssets -> Text
$sel:hierarchyId:DisassociateAssets' :: DisassociateAssets -> Text
$sel:assetId:DisassociateAssets' :: DisassociateAssets -> Text
$sel:clientToken:DisassociateAssets' :: DisassociateAssets -> 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
"/disassociate"]
instance Core.ToQuery DisassociateAssets where
toQuery :: DisassociateAssets -> QueryString
toQuery = QueryString -> DisassociateAssets -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DisassociateAssetsResponse = DisassociateAssetsResponse'
{
}
deriving (DisassociateAssetsResponse -> DisassociateAssetsResponse -> Bool
(DisassociateAssetsResponse -> DisassociateAssetsResponse -> Bool)
-> (DisassociateAssetsResponse
-> DisassociateAssetsResponse -> Bool)
-> Eq DisassociateAssetsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateAssetsResponse -> DisassociateAssetsResponse -> Bool
$c/= :: DisassociateAssetsResponse -> DisassociateAssetsResponse -> Bool
== :: DisassociateAssetsResponse -> DisassociateAssetsResponse -> Bool
$c== :: DisassociateAssetsResponse -> DisassociateAssetsResponse -> Bool
Prelude.Eq, ReadPrec [DisassociateAssetsResponse]
ReadPrec DisassociateAssetsResponse
Int -> ReadS DisassociateAssetsResponse
ReadS [DisassociateAssetsResponse]
(Int -> ReadS DisassociateAssetsResponse)
-> ReadS [DisassociateAssetsResponse]
-> ReadPrec DisassociateAssetsResponse
-> ReadPrec [DisassociateAssetsResponse]
-> Read DisassociateAssetsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateAssetsResponse]
$creadListPrec :: ReadPrec [DisassociateAssetsResponse]
readPrec :: ReadPrec DisassociateAssetsResponse
$creadPrec :: ReadPrec DisassociateAssetsResponse
readList :: ReadS [DisassociateAssetsResponse]
$creadList :: ReadS [DisassociateAssetsResponse]
readsPrec :: Int -> ReadS DisassociateAssetsResponse
$creadsPrec :: Int -> ReadS DisassociateAssetsResponse
Prelude.Read, Int -> DisassociateAssetsResponse -> ShowS
[DisassociateAssetsResponse] -> ShowS
DisassociateAssetsResponse -> String
(Int -> DisassociateAssetsResponse -> ShowS)
-> (DisassociateAssetsResponse -> String)
-> ([DisassociateAssetsResponse] -> ShowS)
-> Show DisassociateAssetsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateAssetsResponse] -> ShowS
$cshowList :: [DisassociateAssetsResponse] -> ShowS
show :: DisassociateAssetsResponse -> String
$cshow :: DisassociateAssetsResponse -> String
showsPrec :: Int -> DisassociateAssetsResponse -> ShowS
$cshowsPrec :: Int -> DisassociateAssetsResponse -> ShowS
Prelude.Show, (forall x.
DisassociateAssetsResponse -> Rep DisassociateAssetsResponse x)
-> (forall x.
Rep DisassociateAssetsResponse x -> DisassociateAssetsResponse)
-> Generic DisassociateAssetsResponse
forall x.
Rep DisassociateAssetsResponse x -> DisassociateAssetsResponse
forall x.
DisassociateAssetsResponse -> Rep DisassociateAssetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateAssetsResponse x -> DisassociateAssetsResponse
$cfrom :: forall x.
DisassociateAssetsResponse -> Rep DisassociateAssetsResponse x
Prelude.Generic)
newDisassociateAssetsResponse ::
DisassociateAssetsResponse
newDisassociateAssetsResponse :: DisassociateAssetsResponse
newDisassociateAssetsResponse =
DisassociateAssetsResponse
DisassociateAssetsResponse'
instance Prelude.NFData DisassociateAssetsResponse