{-# 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.DeleteAsset
(
DeleteAsset (..),
newDeleteAsset,
deleteAsset_clientToken,
deleteAsset_assetId,
DeleteAssetResponse (..),
newDeleteAssetResponse,
deleteAssetResponse_httpStatus,
deleteAssetResponse_assetStatus,
)
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 DeleteAsset = DeleteAsset'
{
DeleteAsset -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
DeleteAsset -> Text
assetId :: Prelude.Text
}
deriving (DeleteAsset -> DeleteAsset -> Bool
(DeleteAsset -> DeleteAsset -> Bool)
-> (DeleteAsset -> DeleteAsset -> Bool) -> Eq DeleteAsset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAsset -> DeleteAsset -> Bool
$c/= :: DeleteAsset -> DeleteAsset -> Bool
== :: DeleteAsset -> DeleteAsset -> Bool
$c== :: DeleteAsset -> DeleteAsset -> Bool
Prelude.Eq, ReadPrec [DeleteAsset]
ReadPrec DeleteAsset
Int -> ReadS DeleteAsset
ReadS [DeleteAsset]
(Int -> ReadS DeleteAsset)
-> ReadS [DeleteAsset]
-> ReadPrec DeleteAsset
-> ReadPrec [DeleteAsset]
-> Read DeleteAsset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAsset]
$creadListPrec :: ReadPrec [DeleteAsset]
readPrec :: ReadPrec DeleteAsset
$creadPrec :: ReadPrec DeleteAsset
readList :: ReadS [DeleteAsset]
$creadList :: ReadS [DeleteAsset]
readsPrec :: Int -> ReadS DeleteAsset
$creadsPrec :: Int -> ReadS DeleteAsset
Prelude.Read, Int -> DeleteAsset -> ShowS
[DeleteAsset] -> ShowS
DeleteAsset -> String
(Int -> DeleteAsset -> ShowS)
-> (DeleteAsset -> String)
-> ([DeleteAsset] -> ShowS)
-> Show DeleteAsset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAsset] -> ShowS
$cshowList :: [DeleteAsset] -> ShowS
show :: DeleteAsset -> String
$cshow :: DeleteAsset -> String
showsPrec :: Int -> DeleteAsset -> ShowS
$cshowsPrec :: Int -> DeleteAsset -> ShowS
Prelude.Show, (forall x. DeleteAsset -> Rep DeleteAsset x)
-> (forall x. Rep DeleteAsset x -> DeleteAsset)
-> Generic DeleteAsset
forall x. Rep DeleteAsset x -> DeleteAsset
forall x. DeleteAsset -> Rep DeleteAsset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAsset x -> DeleteAsset
$cfrom :: forall x. DeleteAsset -> Rep DeleteAsset x
Prelude.Generic)
newDeleteAsset ::
Prelude.Text ->
DeleteAsset
newDeleteAsset :: Text -> DeleteAsset
newDeleteAsset Text
pAssetId_ =
DeleteAsset' :: Maybe Text -> Text -> DeleteAsset
DeleteAsset'
{ $sel:clientToken:DeleteAsset' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:assetId:DeleteAsset' :: Text
assetId = Text
pAssetId_
}
deleteAsset_clientToken :: Lens.Lens' DeleteAsset (Prelude.Maybe Prelude.Text)
deleteAsset_clientToken :: (Maybe Text -> f (Maybe Text)) -> DeleteAsset -> f DeleteAsset
deleteAsset_clientToken = (DeleteAsset -> Maybe Text)
-> (DeleteAsset -> Maybe Text -> DeleteAsset)
-> Lens DeleteAsset DeleteAsset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAsset' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteAsset' :: DeleteAsset -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteAsset
s@DeleteAsset' {} Maybe Text
a -> DeleteAsset
s {$sel:clientToken:DeleteAsset' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteAsset)
deleteAsset_assetId :: Lens.Lens' DeleteAsset Prelude.Text
deleteAsset_assetId :: (Text -> f Text) -> DeleteAsset -> f DeleteAsset
deleteAsset_assetId = (DeleteAsset -> Text)
-> (DeleteAsset -> Text -> DeleteAsset)
-> Lens DeleteAsset DeleteAsset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAsset' {Text
assetId :: Text
$sel:assetId:DeleteAsset' :: DeleteAsset -> Text
assetId} -> Text
assetId) (\s :: DeleteAsset
s@DeleteAsset' {} Text
a -> DeleteAsset
s {$sel:assetId:DeleteAsset' :: Text
assetId = Text
a} :: DeleteAsset)
instance Core.AWSRequest DeleteAsset where
type AWSResponse DeleteAsset = DeleteAssetResponse
request :: DeleteAsset -> Request DeleteAsset
request = Service -> DeleteAsset -> Request DeleteAsset
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteAsset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAsset)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteAsset))
-> Logger
-> Service
-> Proxy DeleteAsset
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAsset)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> AssetStatus -> DeleteAssetResponse
DeleteAssetResponse'
(Int -> AssetStatus -> DeleteAssetResponse)
-> Either String Int
-> Either String (AssetStatus -> DeleteAssetResponse)
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))
Either String (AssetStatus -> DeleteAssetResponse)
-> Either String AssetStatus -> Either String DeleteAssetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String AssetStatus
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"assetStatus")
)
instance Prelude.Hashable DeleteAsset
instance Prelude.NFData DeleteAsset
instance Core.ToHeaders DeleteAsset where
toHeaders :: DeleteAsset -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteAsset -> 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.ToPath DeleteAsset where
toPath :: DeleteAsset -> ByteString
toPath DeleteAsset' {Maybe Text
Text
assetId :: Text
clientToken :: Maybe Text
$sel:assetId:DeleteAsset' :: DeleteAsset -> Text
$sel:clientToken:DeleteAsset' :: DeleteAsset -> 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]
instance Core.ToQuery DeleteAsset where
toQuery :: DeleteAsset -> QueryString
toQuery DeleteAsset' {Maybe Text
Text
assetId :: Text
clientToken :: Maybe Text
$sel:assetId:DeleteAsset' :: DeleteAsset -> Text
$sel:clientToken:DeleteAsset' :: DeleteAsset -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"clientToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clientToken]
data DeleteAssetResponse = DeleteAssetResponse'
{
DeleteAssetResponse -> Int
httpStatus :: Prelude.Int,
DeleteAssetResponse -> AssetStatus
assetStatus :: AssetStatus
}
deriving (DeleteAssetResponse -> DeleteAssetResponse -> Bool
(DeleteAssetResponse -> DeleteAssetResponse -> Bool)
-> (DeleteAssetResponse -> DeleteAssetResponse -> Bool)
-> Eq DeleteAssetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAssetResponse -> DeleteAssetResponse -> Bool
$c/= :: DeleteAssetResponse -> DeleteAssetResponse -> Bool
== :: DeleteAssetResponse -> DeleteAssetResponse -> Bool
$c== :: DeleteAssetResponse -> DeleteAssetResponse -> Bool
Prelude.Eq, ReadPrec [DeleteAssetResponse]
ReadPrec DeleteAssetResponse
Int -> ReadS DeleteAssetResponse
ReadS [DeleteAssetResponse]
(Int -> ReadS DeleteAssetResponse)
-> ReadS [DeleteAssetResponse]
-> ReadPrec DeleteAssetResponse
-> ReadPrec [DeleteAssetResponse]
-> Read DeleteAssetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAssetResponse]
$creadListPrec :: ReadPrec [DeleteAssetResponse]
readPrec :: ReadPrec DeleteAssetResponse
$creadPrec :: ReadPrec DeleteAssetResponse
readList :: ReadS [DeleteAssetResponse]
$creadList :: ReadS [DeleteAssetResponse]
readsPrec :: Int -> ReadS DeleteAssetResponse
$creadsPrec :: Int -> ReadS DeleteAssetResponse
Prelude.Read, Int -> DeleteAssetResponse -> ShowS
[DeleteAssetResponse] -> ShowS
DeleteAssetResponse -> String
(Int -> DeleteAssetResponse -> ShowS)
-> (DeleteAssetResponse -> String)
-> ([DeleteAssetResponse] -> ShowS)
-> Show DeleteAssetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAssetResponse] -> ShowS
$cshowList :: [DeleteAssetResponse] -> ShowS
show :: DeleteAssetResponse -> String
$cshow :: DeleteAssetResponse -> String
showsPrec :: Int -> DeleteAssetResponse -> ShowS
$cshowsPrec :: Int -> DeleteAssetResponse -> ShowS
Prelude.Show, (forall x. DeleteAssetResponse -> Rep DeleteAssetResponse x)
-> (forall x. Rep DeleteAssetResponse x -> DeleteAssetResponse)
-> Generic DeleteAssetResponse
forall x. Rep DeleteAssetResponse x -> DeleteAssetResponse
forall x. DeleteAssetResponse -> Rep DeleteAssetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAssetResponse x -> DeleteAssetResponse
$cfrom :: forall x. DeleteAssetResponse -> Rep DeleteAssetResponse x
Prelude.Generic)
newDeleteAssetResponse ::
Prelude.Int ->
AssetStatus ->
DeleteAssetResponse
newDeleteAssetResponse :: Int -> AssetStatus -> DeleteAssetResponse
newDeleteAssetResponse Int
pHttpStatus_ AssetStatus
pAssetStatus_ =
DeleteAssetResponse' :: Int -> AssetStatus -> DeleteAssetResponse
DeleteAssetResponse'
{ $sel:httpStatus:DeleteAssetResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:assetStatus:DeleteAssetResponse' :: AssetStatus
assetStatus = AssetStatus
pAssetStatus_
}
deleteAssetResponse_httpStatus :: Lens.Lens' DeleteAssetResponse Prelude.Int
deleteAssetResponse_httpStatus :: (Int -> f Int) -> DeleteAssetResponse -> f DeleteAssetResponse
deleteAssetResponse_httpStatus = (DeleteAssetResponse -> Int)
-> (DeleteAssetResponse -> Int -> DeleteAssetResponse)
-> Lens DeleteAssetResponse DeleteAssetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAssetResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteAssetResponse' :: DeleteAssetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteAssetResponse
s@DeleteAssetResponse' {} Int
a -> DeleteAssetResponse
s {$sel:httpStatus:DeleteAssetResponse' :: Int
httpStatus = Int
a} :: DeleteAssetResponse)
deleteAssetResponse_assetStatus :: Lens.Lens' DeleteAssetResponse AssetStatus
deleteAssetResponse_assetStatus :: (AssetStatus -> f AssetStatus)
-> DeleteAssetResponse -> f DeleteAssetResponse
deleteAssetResponse_assetStatus = (DeleteAssetResponse -> AssetStatus)
-> (DeleteAssetResponse -> AssetStatus -> DeleteAssetResponse)
-> Lens
DeleteAssetResponse DeleteAssetResponse AssetStatus AssetStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAssetResponse' {AssetStatus
assetStatus :: AssetStatus
$sel:assetStatus:DeleteAssetResponse' :: DeleteAssetResponse -> AssetStatus
assetStatus} -> AssetStatus
assetStatus) (\s :: DeleteAssetResponse
s@DeleteAssetResponse' {} AssetStatus
a -> DeleteAssetResponse
s {$sel:assetStatus:DeleteAssetResponse' :: AssetStatus
assetStatus = AssetStatus
a} :: DeleteAssetResponse)
instance Prelude.NFData DeleteAssetResponse