{-# 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.DirectoryService.DeleteSnapshot
(
DeleteSnapshot (..),
newDeleteSnapshot,
deleteSnapshot_snapshotId,
DeleteSnapshotResponse (..),
newDeleteSnapshotResponse,
deleteSnapshotResponse_snapshotId,
deleteSnapshotResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.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 DeleteSnapshot = DeleteSnapshot'
{
DeleteSnapshot -> Text
snapshotId :: Prelude.Text
}
deriving (DeleteSnapshot -> DeleteSnapshot -> Bool
(DeleteSnapshot -> DeleteSnapshot -> Bool)
-> (DeleteSnapshot -> DeleteSnapshot -> Bool) -> Eq DeleteSnapshot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSnapshot -> DeleteSnapshot -> Bool
$c/= :: DeleteSnapshot -> DeleteSnapshot -> Bool
== :: DeleteSnapshot -> DeleteSnapshot -> Bool
$c== :: DeleteSnapshot -> DeleteSnapshot -> Bool
Prelude.Eq, ReadPrec [DeleteSnapshot]
ReadPrec DeleteSnapshot
Int -> ReadS DeleteSnapshot
ReadS [DeleteSnapshot]
(Int -> ReadS DeleteSnapshot)
-> ReadS [DeleteSnapshot]
-> ReadPrec DeleteSnapshot
-> ReadPrec [DeleteSnapshot]
-> Read DeleteSnapshot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSnapshot]
$creadListPrec :: ReadPrec [DeleteSnapshot]
readPrec :: ReadPrec DeleteSnapshot
$creadPrec :: ReadPrec DeleteSnapshot
readList :: ReadS [DeleteSnapshot]
$creadList :: ReadS [DeleteSnapshot]
readsPrec :: Int -> ReadS DeleteSnapshot
$creadsPrec :: Int -> ReadS DeleteSnapshot
Prelude.Read, Int -> DeleteSnapshot -> ShowS
[DeleteSnapshot] -> ShowS
DeleteSnapshot -> String
(Int -> DeleteSnapshot -> ShowS)
-> (DeleteSnapshot -> String)
-> ([DeleteSnapshot] -> ShowS)
-> Show DeleteSnapshot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSnapshot] -> ShowS
$cshowList :: [DeleteSnapshot] -> ShowS
show :: DeleteSnapshot -> String
$cshow :: DeleteSnapshot -> String
showsPrec :: Int -> DeleteSnapshot -> ShowS
$cshowsPrec :: Int -> DeleteSnapshot -> ShowS
Prelude.Show, (forall x. DeleteSnapshot -> Rep DeleteSnapshot x)
-> (forall x. Rep DeleteSnapshot x -> DeleteSnapshot)
-> Generic DeleteSnapshot
forall x. Rep DeleteSnapshot x -> DeleteSnapshot
forall x. DeleteSnapshot -> Rep DeleteSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSnapshot x -> DeleteSnapshot
$cfrom :: forall x. DeleteSnapshot -> Rep DeleteSnapshot x
Prelude.Generic)
newDeleteSnapshot ::
Prelude.Text ->
DeleteSnapshot
newDeleteSnapshot :: Text -> DeleteSnapshot
newDeleteSnapshot Text
pSnapshotId_ =
DeleteSnapshot' :: Text -> DeleteSnapshot
DeleteSnapshot' {$sel:snapshotId:DeleteSnapshot' :: Text
snapshotId = Text
pSnapshotId_}
deleteSnapshot_snapshotId :: Lens.Lens' DeleteSnapshot Prelude.Text
deleteSnapshot_snapshotId :: (Text -> f Text) -> DeleteSnapshot -> f DeleteSnapshot
deleteSnapshot_snapshotId = (DeleteSnapshot -> Text)
-> (DeleteSnapshot -> Text -> DeleteSnapshot)
-> Lens DeleteSnapshot DeleteSnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSnapshot' {Text
snapshotId :: Text
$sel:snapshotId:DeleteSnapshot' :: DeleteSnapshot -> Text
snapshotId} -> Text
snapshotId) (\s :: DeleteSnapshot
s@DeleteSnapshot' {} Text
a -> DeleteSnapshot
s {$sel:snapshotId:DeleteSnapshot' :: Text
snapshotId = Text
a} :: DeleteSnapshot)
instance Core.AWSRequest DeleteSnapshot where
type
AWSResponse DeleteSnapshot =
DeleteSnapshotResponse
request :: DeleteSnapshot -> Request DeleteSnapshot
request = Service -> DeleteSnapshot -> Request DeleteSnapshot
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteSnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSnapshot)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteSnapshot))
-> Logger
-> Service
-> Proxy DeleteSnapshot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSnapshot)))
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 Text -> Int -> DeleteSnapshotResponse
DeleteSnapshotResponse'
(Maybe Text -> Int -> DeleteSnapshotResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteSnapshotResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SnapshotId")
Either String (Int -> DeleteSnapshotResponse)
-> Either String Int -> Either String DeleteSnapshotResponse
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 DeleteSnapshot
instance Prelude.NFData DeleteSnapshot
instance Core.ToHeaders DeleteSnapshot where
toHeaders :: DeleteSnapshot -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteSnapshot -> 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
"DirectoryService_20150416.DeleteSnapshot" ::
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 DeleteSnapshot where
toJSON :: DeleteSnapshot -> Value
toJSON DeleteSnapshot' {Text
snapshotId :: Text
$sel:snapshotId:DeleteSnapshot' :: DeleteSnapshot -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SnapshotId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
snapshotId)]
)
instance Core.ToPath DeleteSnapshot where
toPath :: DeleteSnapshot -> ByteString
toPath = ByteString -> DeleteSnapshot -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteSnapshot where
toQuery :: DeleteSnapshot -> QueryString
toQuery = QueryString -> DeleteSnapshot -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteSnapshotResponse = DeleteSnapshotResponse'
{
DeleteSnapshotResponse -> Maybe Text
snapshotId :: Prelude.Maybe Prelude.Text,
DeleteSnapshotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteSnapshotResponse -> DeleteSnapshotResponse -> Bool
(DeleteSnapshotResponse -> DeleteSnapshotResponse -> Bool)
-> (DeleteSnapshotResponse -> DeleteSnapshotResponse -> Bool)
-> Eq DeleteSnapshotResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSnapshotResponse -> DeleteSnapshotResponse -> Bool
$c/= :: DeleteSnapshotResponse -> DeleteSnapshotResponse -> Bool
== :: DeleteSnapshotResponse -> DeleteSnapshotResponse -> Bool
$c== :: DeleteSnapshotResponse -> DeleteSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [DeleteSnapshotResponse]
ReadPrec DeleteSnapshotResponse
Int -> ReadS DeleteSnapshotResponse
ReadS [DeleteSnapshotResponse]
(Int -> ReadS DeleteSnapshotResponse)
-> ReadS [DeleteSnapshotResponse]
-> ReadPrec DeleteSnapshotResponse
-> ReadPrec [DeleteSnapshotResponse]
-> Read DeleteSnapshotResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSnapshotResponse]
$creadListPrec :: ReadPrec [DeleteSnapshotResponse]
readPrec :: ReadPrec DeleteSnapshotResponse
$creadPrec :: ReadPrec DeleteSnapshotResponse
readList :: ReadS [DeleteSnapshotResponse]
$creadList :: ReadS [DeleteSnapshotResponse]
readsPrec :: Int -> ReadS DeleteSnapshotResponse
$creadsPrec :: Int -> ReadS DeleteSnapshotResponse
Prelude.Read, Int -> DeleteSnapshotResponse -> ShowS
[DeleteSnapshotResponse] -> ShowS
DeleteSnapshotResponse -> String
(Int -> DeleteSnapshotResponse -> ShowS)
-> (DeleteSnapshotResponse -> String)
-> ([DeleteSnapshotResponse] -> ShowS)
-> Show DeleteSnapshotResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSnapshotResponse] -> ShowS
$cshowList :: [DeleteSnapshotResponse] -> ShowS
show :: DeleteSnapshotResponse -> String
$cshow :: DeleteSnapshotResponse -> String
showsPrec :: Int -> DeleteSnapshotResponse -> ShowS
$cshowsPrec :: Int -> DeleteSnapshotResponse -> ShowS
Prelude.Show, (forall x. DeleteSnapshotResponse -> Rep DeleteSnapshotResponse x)
-> (forall x.
Rep DeleteSnapshotResponse x -> DeleteSnapshotResponse)
-> Generic DeleteSnapshotResponse
forall x. Rep DeleteSnapshotResponse x -> DeleteSnapshotResponse
forall x. DeleteSnapshotResponse -> Rep DeleteSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSnapshotResponse x -> DeleteSnapshotResponse
$cfrom :: forall x. DeleteSnapshotResponse -> Rep DeleteSnapshotResponse x
Prelude.Generic)
newDeleteSnapshotResponse ::
Prelude.Int ->
DeleteSnapshotResponse
newDeleteSnapshotResponse :: Int -> DeleteSnapshotResponse
newDeleteSnapshotResponse Int
pHttpStatus_ =
DeleteSnapshotResponse' :: Maybe Text -> Int -> DeleteSnapshotResponse
DeleteSnapshotResponse'
{ $sel:snapshotId:DeleteSnapshotResponse' :: Maybe Text
snapshotId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteSnapshotResponse_snapshotId :: Lens.Lens' DeleteSnapshotResponse (Prelude.Maybe Prelude.Text)
deleteSnapshotResponse_snapshotId :: (Maybe Text -> f (Maybe Text))
-> DeleteSnapshotResponse -> f DeleteSnapshotResponse
deleteSnapshotResponse_snapshotId = (DeleteSnapshotResponse -> Maybe Text)
-> (DeleteSnapshotResponse -> Maybe Text -> DeleteSnapshotResponse)
-> Lens
DeleteSnapshotResponse
DeleteSnapshotResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSnapshotResponse' {Maybe Text
snapshotId :: Maybe Text
$sel:snapshotId:DeleteSnapshotResponse' :: DeleteSnapshotResponse -> Maybe Text
snapshotId} -> Maybe Text
snapshotId) (\s :: DeleteSnapshotResponse
s@DeleteSnapshotResponse' {} Maybe Text
a -> DeleteSnapshotResponse
s {$sel:snapshotId:DeleteSnapshotResponse' :: Maybe Text
snapshotId = Maybe Text
a} :: DeleteSnapshotResponse)
deleteSnapshotResponse_httpStatus :: Lens.Lens' DeleteSnapshotResponse Prelude.Int
deleteSnapshotResponse_httpStatus :: (Int -> f Int)
-> DeleteSnapshotResponse -> f DeleteSnapshotResponse
deleteSnapshotResponse_httpStatus = (DeleteSnapshotResponse -> Int)
-> (DeleteSnapshotResponse -> Int -> DeleteSnapshotResponse)
-> Lens DeleteSnapshotResponse DeleteSnapshotResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteSnapshotResponse' :: DeleteSnapshotResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteSnapshotResponse
s@DeleteSnapshotResponse' {} Int
a -> DeleteSnapshotResponse
s {$sel:httpStatus:DeleteSnapshotResponse' :: Int
httpStatus = Int
a} :: DeleteSnapshotResponse)
instance Prelude.NFData DeleteSnapshotResponse