{-# 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.CloudControl.DeleteResource
(
DeleteResource (..),
newDeleteResource,
deleteResource_clientToken,
deleteResource_typeVersionId,
deleteResource_roleArn,
deleteResource_typeName,
deleteResource_identifier,
DeleteResourceResponse (..),
newDeleteResourceResponse,
deleteResourceResponse_progressEvent,
deleteResourceResponse_httpStatus,
)
where
import Amazonka.CloudControl.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 DeleteResource = DeleteResource'
{
DeleteResource -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
DeleteResource -> Maybe Text
typeVersionId :: Prelude.Maybe Prelude.Text,
DeleteResource -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
DeleteResource -> Text
typeName :: Prelude.Text,
DeleteResource -> Text
identifier :: Prelude.Text
}
deriving (DeleteResource -> DeleteResource -> Bool
(DeleteResource -> DeleteResource -> Bool)
-> (DeleteResource -> DeleteResource -> Bool) -> Eq DeleteResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResource -> DeleteResource -> Bool
$c/= :: DeleteResource -> DeleteResource -> Bool
== :: DeleteResource -> DeleteResource -> Bool
$c== :: DeleteResource -> DeleteResource -> Bool
Prelude.Eq, ReadPrec [DeleteResource]
ReadPrec DeleteResource
Int -> ReadS DeleteResource
ReadS [DeleteResource]
(Int -> ReadS DeleteResource)
-> ReadS [DeleteResource]
-> ReadPrec DeleteResource
-> ReadPrec [DeleteResource]
-> Read DeleteResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResource]
$creadListPrec :: ReadPrec [DeleteResource]
readPrec :: ReadPrec DeleteResource
$creadPrec :: ReadPrec DeleteResource
readList :: ReadS [DeleteResource]
$creadList :: ReadS [DeleteResource]
readsPrec :: Int -> ReadS DeleteResource
$creadsPrec :: Int -> ReadS DeleteResource
Prelude.Read, Int -> DeleteResource -> ShowS
[DeleteResource] -> ShowS
DeleteResource -> String
(Int -> DeleteResource -> ShowS)
-> (DeleteResource -> String)
-> ([DeleteResource] -> ShowS)
-> Show DeleteResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResource] -> ShowS
$cshowList :: [DeleteResource] -> ShowS
show :: DeleteResource -> String
$cshow :: DeleteResource -> String
showsPrec :: Int -> DeleteResource -> ShowS
$cshowsPrec :: Int -> DeleteResource -> ShowS
Prelude.Show, (forall x. DeleteResource -> Rep DeleteResource x)
-> (forall x. Rep DeleteResource x -> DeleteResource)
-> Generic DeleteResource
forall x. Rep DeleteResource x -> DeleteResource
forall x. DeleteResource -> Rep DeleteResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResource x -> DeleteResource
$cfrom :: forall x. DeleteResource -> Rep DeleteResource x
Prelude.Generic)
newDeleteResource ::
Prelude.Text ->
Prelude.Text ->
DeleteResource
newDeleteResource :: Text -> Text -> DeleteResource
newDeleteResource Text
pTypeName_ Text
pIdentifier_ =
DeleteResource' :: Maybe Text
-> Maybe Text -> Maybe Text -> Text -> Text -> DeleteResource
DeleteResource'
{ $sel:clientToken:DeleteResource' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:typeVersionId:DeleteResource' :: Maybe Text
typeVersionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:DeleteResource' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:typeName:DeleteResource' :: Text
typeName = Text
pTypeName_,
$sel:identifier:DeleteResource' :: Text
identifier = Text
pIdentifier_
}
deleteResource_clientToken :: Lens.Lens' DeleteResource (Prelude.Maybe Prelude.Text)
deleteResource_clientToken :: (Maybe Text -> f (Maybe Text))
-> DeleteResource -> f DeleteResource
deleteResource_clientToken = (DeleteResource -> Maybe Text)
-> (DeleteResource -> Maybe Text -> DeleteResource)
-> Lens DeleteResource DeleteResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResource' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteResource' :: DeleteResource -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteResource
s@DeleteResource' {} Maybe Text
a -> DeleteResource
s {$sel:clientToken:DeleteResource' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteResource)
deleteResource_typeVersionId :: Lens.Lens' DeleteResource (Prelude.Maybe Prelude.Text)
deleteResource_typeVersionId :: (Maybe Text -> f (Maybe Text))
-> DeleteResource -> f DeleteResource
deleteResource_typeVersionId = (DeleteResource -> Maybe Text)
-> (DeleteResource -> Maybe Text -> DeleteResource)
-> Lens DeleteResource DeleteResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResource' {Maybe Text
typeVersionId :: Maybe Text
$sel:typeVersionId:DeleteResource' :: DeleteResource -> Maybe Text
typeVersionId} -> Maybe Text
typeVersionId) (\s :: DeleteResource
s@DeleteResource' {} Maybe Text
a -> DeleteResource
s {$sel:typeVersionId:DeleteResource' :: Maybe Text
typeVersionId = Maybe Text
a} :: DeleteResource)
deleteResource_roleArn :: Lens.Lens' DeleteResource (Prelude.Maybe Prelude.Text)
deleteResource_roleArn :: (Maybe Text -> f (Maybe Text))
-> DeleteResource -> f DeleteResource
deleteResource_roleArn = (DeleteResource -> Maybe Text)
-> (DeleteResource -> Maybe Text -> DeleteResource)
-> Lens DeleteResource DeleteResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResource' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:DeleteResource' :: DeleteResource -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: DeleteResource
s@DeleteResource' {} Maybe Text
a -> DeleteResource
s {$sel:roleArn:DeleteResource' :: Maybe Text
roleArn = Maybe Text
a} :: DeleteResource)
deleteResource_typeName :: Lens.Lens' DeleteResource Prelude.Text
deleteResource_typeName :: (Text -> f Text) -> DeleteResource -> f DeleteResource
deleteResource_typeName = (DeleteResource -> Text)
-> (DeleteResource -> Text -> DeleteResource)
-> Lens DeleteResource DeleteResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResource' {Text
typeName :: Text
$sel:typeName:DeleteResource' :: DeleteResource -> Text
typeName} -> Text
typeName) (\s :: DeleteResource
s@DeleteResource' {} Text
a -> DeleteResource
s {$sel:typeName:DeleteResource' :: Text
typeName = Text
a} :: DeleteResource)
deleteResource_identifier :: Lens.Lens' DeleteResource Prelude.Text
deleteResource_identifier :: (Text -> f Text) -> DeleteResource -> f DeleteResource
deleteResource_identifier = (DeleteResource -> Text)
-> (DeleteResource -> Text -> DeleteResource)
-> Lens DeleteResource DeleteResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResource' {Text
identifier :: Text
$sel:identifier:DeleteResource' :: DeleteResource -> Text
identifier} -> Text
identifier) (\s :: DeleteResource
s@DeleteResource' {} Text
a -> DeleteResource
s {$sel:identifier:DeleteResource' :: Text
identifier = Text
a} :: DeleteResource)
instance Core.AWSRequest DeleteResource where
type
AWSResponse DeleteResource =
DeleteResourceResponse
request :: DeleteResource -> Request DeleteResource
request = Service -> DeleteResource -> Request DeleteResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteResource)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteResource))
-> Logger
-> Service
-> Proxy DeleteResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteResource)))
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 ->
Maybe ProgressEvent -> Int -> DeleteResourceResponse
DeleteResourceResponse'
(Maybe ProgressEvent -> Int -> DeleteResourceResponse)
-> Either String (Maybe ProgressEvent)
-> Either String (Int -> DeleteResourceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ProgressEvent)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProgressEvent")
Either String (Int -> DeleteResourceResponse)
-> Either String Int -> Either String DeleteResourceResponse
forall (f :: * -> *) a b. Applicative f => 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 DeleteResource
instance Prelude.NFData DeleteResource
instance Core.ToHeaders DeleteResource where
toHeaders :: DeleteResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteResource -> 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
"CloudApiService.DeleteResource" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DeleteResource where
toJSON :: DeleteResource -> Value
toJSON DeleteResource' {Maybe Text
Text
identifier :: Text
typeName :: Text
roleArn :: Maybe Text
typeVersionId :: Maybe Text
clientToken :: Maybe Text
$sel:identifier:DeleteResource' :: DeleteResource -> Text
$sel:typeName:DeleteResource' :: DeleteResource -> Text
$sel:roleArn:DeleteResource' :: DeleteResource -> Maybe Text
$sel:typeVersionId:DeleteResource' :: DeleteResource -> Maybe Text
$sel:clientToken:DeleteResource' :: DeleteResource -> 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,
(Text
"TypeVersionId" 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
typeVersionId,
(Text
"RoleArn" 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
roleArn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TypeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
typeName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Identifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
identifier)
]
)
instance Core.ToPath DeleteResource where
toPath :: DeleteResource -> ByteString
toPath = ByteString -> DeleteResource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteResource where
toQuery :: DeleteResource -> QueryString
toQuery = QueryString -> DeleteResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteResourceResponse = DeleteResourceResponse'
{
DeleteResourceResponse -> Maybe ProgressEvent
progressEvent :: Prelude.Maybe ProgressEvent,
DeleteResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteResourceResponse -> DeleteResourceResponse -> Bool
(DeleteResourceResponse -> DeleteResourceResponse -> Bool)
-> (DeleteResourceResponse -> DeleteResourceResponse -> Bool)
-> Eq DeleteResourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResourceResponse -> DeleteResourceResponse -> Bool
$c/= :: DeleteResourceResponse -> DeleteResourceResponse -> Bool
== :: DeleteResourceResponse -> DeleteResourceResponse -> Bool
$c== :: DeleteResourceResponse -> DeleteResourceResponse -> Bool
Prelude.Eq, Int -> DeleteResourceResponse -> ShowS
[DeleteResourceResponse] -> ShowS
DeleteResourceResponse -> String
(Int -> DeleteResourceResponse -> ShowS)
-> (DeleteResourceResponse -> String)
-> ([DeleteResourceResponse] -> ShowS)
-> Show DeleteResourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResourceResponse] -> ShowS
$cshowList :: [DeleteResourceResponse] -> ShowS
show :: DeleteResourceResponse -> String
$cshow :: DeleteResourceResponse -> String
showsPrec :: Int -> DeleteResourceResponse -> ShowS
$cshowsPrec :: Int -> DeleteResourceResponse -> ShowS
Prelude.Show, (forall x. DeleteResourceResponse -> Rep DeleteResourceResponse x)
-> (forall x.
Rep DeleteResourceResponse x -> DeleteResourceResponse)
-> Generic DeleteResourceResponse
forall x. Rep DeleteResourceResponse x -> DeleteResourceResponse
forall x. DeleteResourceResponse -> Rep DeleteResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResourceResponse x -> DeleteResourceResponse
$cfrom :: forall x. DeleteResourceResponse -> Rep DeleteResourceResponse x
Prelude.Generic)
newDeleteResourceResponse ::
Prelude.Int ->
DeleteResourceResponse
newDeleteResourceResponse :: Int -> DeleteResourceResponse
newDeleteResourceResponse Int
pHttpStatus_ =
DeleteResourceResponse' :: Maybe ProgressEvent -> Int -> DeleteResourceResponse
DeleteResourceResponse'
{ $sel:progressEvent:DeleteResourceResponse' :: Maybe ProgressEvent
progressEvent =
Maybe ProgressEvent
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteResourceResponse_progressEvent :: Lens.Lens' DeleteResourceResponse (Prelude.Maybe ProgressEvent)
deleteResourceResponse_progressEvent :: (Maybe ProgressEvent -> f (Maybe ProgressEvent))
-> DeleteResourceResponse -> f DeleteResourceResponse
deleteResourceResponse_progressEvent = (DeleteResourceResponse -> Maybe ProgressEvent)
-> (DeleteResourceResponse
-> Maybe ProgressEvent -> DeleteResourceResponse)
-> Lens
DeleteResourceResponse
DeleteResourceResponse
(Maybe ProgressEvent)
(Maybe ProgressEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceResponse' {Maybe ProgressEvent
progressEvent :: Maybe ProgressEvent
$sel:progressEvent:DeleteResourceResponse' :: DeleteResourceResponse -> Maybe ProgressEvent
progressEvent} -> Maybe ProgressEvent
progressEvent) (\s :: DeleteResourceResponse
s@DeleteResourceResponse' {} Maybe ProgressEvent
a -> DeleteResourceResponse
s {$sel:progressEvent:DeleteResourceResponse' :: Maybe ProgressEvent
progressEvent = Maybe ProgressEvent
a} :: DeleteResourceResponse)
deleteResourceResponse_httpStatus :: Lens.Lens' DeleteResourceResponse Prelude.Int
deleteResourceResponse_httpStatus :: (Int -> f Int)
-> DeleteResourceResponse -> f DeleteResourceResponse
deleteResourceResponse_httpStatus = (DeleteResourceResponse -> Int)
-> (DeleteResourceResponse -> Int -> DeleteResourceResponse)
-> Lens DeleteResourceResponse DeleteResourceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteResourceResponse' :: DeleteResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteResourceResponse
s@DeleteResourceResponse' {} Int
a -> DeleteResourceResponse
s {$sel:httpStatus:DeleteResourceResponse' :: Int
httpStatus = Int
a} :: DeleteResourceResponse)
instance Prelude.NFData DeleteResourceResponse