{-# 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.SSM.DeleteDocument
(
DeleteDocument (..),
newDeleteDocument,
deleteDocument_versionName,
deleteDocument_force,
deleteDocument_documentVersion,
deleteDocument_name,
DeleteDocumentResponse (..),
newDeleteDocumentResponse,
deleteDocumentResponse_httpStatus,
)
where
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
import Amazonka.SSM.Types
data DeleteDocument = DeleteDocument'
{
DeleteDocument -> Maybe Text
versionName :: Prelude.Maybe Prelude.Text,
DeleteDocument -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
DeleteDocument -> Maybe Text
documentVersion :: Prelude.Maybe Prelude.Text,
DeleteDocument -> Text
name :: Prelude.Text
}
deriving (DeleteDocument -> DeleteDocument -> Bool
(DeleteDocument -> DeleteDocument -> Bool)
-> (DeleteDocument -> DeleteDocument -> Bool) -> Eq DeleteDocument
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDocument -> DeleteDocument -> Bool
$c/= :: DeleteDocument -> DeleteDocument -> Bool
== :: DeleteDocument -> DeleteDocument -> Bool
$c== :: DeleteDocument -> DeleteDocument -> Bool
Prelude.Eq, ReadPrec [DeleteDocument]
ReadPrec DeleteDocument
Int -> ReadS DeleteDocument
ReadS [DeleteDocument]
(Int -> ReadS DeleteDocument)
-> ReadS [DeleteDocument]
-> ReadPrec DeleteDocument
-> ReadPrec [DeleteDocument]
-> Read DeleteDocument
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDocument]
$creadListPrec :: ReadPrec [DeleteDocument]
readPrec :: ReadPrec DeleteDocument
$creadPrec :: ReadPrec DeleteDocument
readList :: ReadS [DeleteDocument]
$creadList :: ReadS [DeleteDocument]
readsPrec :: Int -> ReadS DeleteDocument
$creadsPrec :: Int -> ReadS DeleteDocument
Prelude.Read, Int -> DeleteDocument -> ShowS
[DeleteDocument] -> ShowS
DeleteDocument -> String
(Int -> DeleteDocument -> ShowS)
-> (DeleteDocument -> String)
-> ([DeleteDocument] -> ShowS)
-> Show DeleteDocument
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDocument] -> ShowS
$cshowList :: [DeleteDocument] -> ShowS
show :: DeleteDocument -> String
$cshow :: DeleteDocument -> String
showsPrec :: Int -> DeleteDocument -> ShowS
$cshowsPrec :: Int -> DeleteDocument -> ShowS
Prelude.Show, (forall x. DeleteDocument -> Rep DeleteDocument x)
-> (forall x. Rep DeleteDocument x -> DeleteDocument)
-> Generic DeleteDocument
forall x. Rep DeleteDocument x -> DeleteDocument
forall x. DeleteDocument -> Rep DeleteDocument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDocument x -> DeleteDocument
$cfrom :: forall x. DeleteDocument -> Rep DeleteDocument x
Prelude.Generic)
newDeleteDocument ::
Prelude.Text ->
DeleteDocument
newDeleteDocument :: Text -> DeleteDocument
newDeleteDocument Text
pName_ =
DeleteDocument' :: Maybe Text -> Maybe Bool -> Maybe Text -> Text -> DeleteDocument
DeleteDocument'
{ $sel:versionName:DeleteDocument' :: Maybe Text
versionName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:force:DeleteDocument' :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:documentVersion:DeleteDocument' :: Maybe Text
documentVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:DeleteDocument' :: Text
name = Text
pName_
}
deleteDocument_versionName :: Lens.Lens' DeleteDocument (Prelude.Maybe Prelude.Text)
deleteDocument_versionName :: (Maybe Text -> f (Maybe Text))
-> DeleteDocument -> f DeleteDocument
deleteDocument_versionName = (DeleteDocument -> Maybe Text)
-> (DeleteDocument -> Maybe Text -> DeleteDocument)
-> Lens DeleteDocument DeleteDocument (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDocument' {Maybe Text
versionName :: Maybe Text
$sel:versionName:DeleteDocument' :: DeleteDocument -> Maybe Text
versionName} -> Maybe Text
versionName) (\s :: DeleteDocument
s@DeleteDocument' {} Maybe Text
a -> DeleteDocument
s {$sel:versionName:DeleteDocument' :: Maybe Text
versionName = Maybe Text
a} :: DeleteDocument)
deleteDocument_force :: Lens.Lens' DeleteDocument (Prelude.Maybe Prelude.Bool)
deleteDocument_force :: (Maybe Bool -> f (Maybe Bool))
-> DeleteDocument -> f DeleteDocument
deleteDocument_force = (DeleteDocument -> Maybe Bool)
-> (DeleteDocument -> Maybe Bool -> DeleteDocument)
-> Lens DeleteDocument DeleteDocument (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDocument' {Maybe Bool
force :: Maybe Bool
$sel:force:DeleteDocument' :: DeleteDocument -> Maybe Bool
force} -> Maybe Bool
force) (\s :: DeleteDocument
s@DeleteDocument' {} Maybe Bool
a -> DeleteDocument
s {$sel:force:DeleteDocument' :: Maybe Bool
force = Maybe Bool
a} :: DeleteDocument)
deleteDocument_documentVersion :: Lens.Lens' DeleteDocument (Prelude.Maybe Prelude.Text)
deleteDocument_documentVersion :: (Maybe Text -> f (Maybe Text))
-> DeleteDocument -> f DeleteDocument
deleteDocument_documentVersion = (DeleteDocument -> Maybe Text)
-> (DeleteDocument -> Maybe Text -> DeleteDocument)
-> Lens DeleteDocument DeleteDocument (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDocument' {Maybe Text
documentVersion :: Maybe Text
$sel:documentVersion:DeleteDocument' :: DeleteDocument -> Maybe Text
documentVersion} -> Maybe Text
documentVersion) (\s :: DeleteDocument
s@DeleteDocument' {} Maybe Text
a -> DeleteDocument
s {$sel:documentVersion:DeleteDocument' :: Maybe Text
documentVersion = Maybe Text
a} :: DeleteDocument)
deleteDocument_name :: Lens.Lens' DeleteDocument Prelude.Text
deleteDocument_name :: (Text -> f Text) -> DeleteDocument -> f DeleteDocument
deleteDocument_name = (DeleteDocument -> Text)
-> (DeleteDocument -> Text -> DeleteDocument)
-> Lens DeleteDocument DeleteDocument Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDocument' {Text
name :: Text
$sel:name:DeleteDocument' :: DeleteDocument -> Text
name} -> Text
name) (\s :: DeleteDocument
s@DeleteDocument' {} Text
a -> DeleteDocument
s {$sel:name:DeleteDocument' :: Text
name = Text
a} :: DeleteDocument)
instance Core.AWSRequest DeleteDocument where
type
AWSResponse DeleteDocument =
DeleteDocumentResponse
request :: DeleteDocument -> Request DeleteDocument
request = Service -> DeleteDocument -> Request DeleteDocument
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDocument)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse DeleteDocument))
-> Logger
-> Service
-> Proxy DeleteDocument
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDocument)))
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 -> DeleteDocumentResponse
DeleteDocumentResponse'
(Int -> DeleteDocumentResponse)
-> Either String Int -> Either String DeleteDocumentResponse
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 DeleteDocument
instance Prelude.NFData DeleteDocument
instance Core.ToHeaders DeleteDocument where
toHeaders :: DeleteDocument -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteDocument -> 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
"AmazonSSM.DeleteDocument" :: Prelude.ByteString),
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 DeleteDocument where
toJSON :: DeleteDocument -> Value
toJSON DeleteDocument' {Maybe Bool
Maybe Text
Text
name :: Text
documentVersion :: Maybe Text
force :: Maybe Bool
versionName :: Maybe Text
$sel:name:DeleteDocument' :: DeleteDocument -> Text
$sel:documentVersion:DeleteDocument' :: DeleteDocument -> Maybe Text
$sel:force:DeleteDocument' :: DeleteDocument -> Maybe Bool
$sel:versionName:DeleteDocument' :: DeleteDocument -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"VersionName" 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
versionName,
(Text
"Force" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
force,
(Text
"DocumentVersion" 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
documentVersion,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)
instance Core.ToPath DeleteDocument where
toPath :: DeleteDocument -> ByteString
toPath = ByteString -> DeleteDocument -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteDocument where
toQuery :: DeleteDocument -> QueryString
toQuery = QueryString -> DeleteDocument -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteDocumentResponse = DeleteDocumentResponse'
{
DeleteDocumentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
(DeleteDocumentResponse -> DeleteDocumentResponse -> Bool)
-> (DeleteDocumentResponse -> DeleteDocumentResponse -> Bool)
-> Eq DeleteDocumentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
$c/= :: DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
== :: DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
$c== :: DeleteDocumentResponse -> DeleteDocumentResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDocumentResponse]
ReadPrec DeleteDocumentResponse
Int -> ReadS DeleteDocumentResponse
ReadS [DeleteDocumentResponse]
(Int -> ReadS DeleteDocumentResponse)
-> ReadS [DeleteDocumentResponse]
-> ReadPrec DeleteDocumentResponse
-> ReadPrec [DeleteDocumentResponse]
-> Read DeleteDocumentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDocumentResponse]
$creadListPrec :: ReadPrec [DeleteDocumentResponse]
readPrec :: ReadPrec DeleteDocumentResponse
$creadPrec :: ReadPrec DeleteDocumentResponse
readList :: ReadS [DeleteDocumentResponse]
$creadList :: ReadS [DeleteDocumentResponse]
readsPrec :: Int -> ReadS DeleteDocumentResponse
$creadsPrec :: Int -> ReadS DeleteDocumentResponse
Prelude.Read, Int -> DeleteDocumentResponse -> ShowS
[DeleteDocumentResponse] -> ShowS
DeleteDocumentResponse -> String
(Int -> DeleteDocumentResponse -> ShowS)
-> (DeleteDocumentResponse -> String)
-> ([DeleteDocumentResponse] -> ShowS)
-> Show DeleteDocumentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDocumentResponse] -> ShowS
$cshowList :: [DeleteDocumentResponse] -> ShowS
show :: DeleteDocumentResponse -> String
$cshow :: DeleteDocumentResponse -> String
showsPrec :: Int -> DeleteDocumentResponse -> ShowS
$cshowsPrec :: Int -> DeleteDocumentResponse -> ShowS
Prelude.Show, (forall x. DeleteDocumentResponse -> Rep DeleteDocumentResponse x)
-> (forall x.
Rep DeleteDocumentResponse x -> DeleteDocumentResponse)
-> Generic DeleteDocumentResponse
forall x. Rep DeleteDocumentResponse x -> DeleteDocumentResponse
forall x. DeleteDocumentResponse -> Rep DeleteDocumentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDocumentResponse x -> DeleteDocumentResponse
$cfrom :: forall x. DeleteDocumentResponse -> Rep DeleteDocumentResponse x
Prelude.Generic)
newDeleteDocumentResponse ::
Prelude.Int ->
DeleteDocumentResponse
newDeleteDocumentResponse :: Int -> DeleteDocumentResponse
newDeleteDocumentResponse Int
pHttpStatus_ =
DeleteDocumentResponse' :: Int -> DeleteDocumentResponse
DeleteDocumentResponse' {$sel:httpStatus:DeleteDocumentResponse' :: Int
httpStatus = Int
pHttpStatus_}
deleteDocumentResponse_httpStatus :: Lens.Lens' DeleteDocumentResponse Prelude.Int
deleteDocumentResponse_httpStatus :: (Int -> f Int)
-> DeleteDocumentResponse -> f DeleteDocumentResponse
deleteDocumentResponse_httpStatus = (DeleteDocumentResponse -> Int)
-> (DeleteDocumentResponse -> Int -> DeleteDocumentResponse)
-> Lens DeleteDocumentResponse DeleteDocumentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDocumentResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDocumentResponse' :: DeleteDocumentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteDocumentResponse
s@DeleteDocumentResponse' {} Int
a -> DeleteDocumentResponse
s {$sel:httpStatus:DeleteDocumentResponse' :: Int
httpStatus = Int
a} :: DeleteDocumentResponse)
instance Prelude.NFData DeleteDocumentResponse