{-# 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.DeleteDirectory
(
DeleteDirectory (..),
newDeleteDirectory,
deleteDirectory_directoryId,
DeleteDirectoryResponse (..),
newDeleteDirectoryResponse,
deleteDirectoryResponse_directoryId,
deleteDirectoryResponse_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 DeleteDirectory = DeleteDirectory'
{
DeleteDirectory -> Text
directoryId :: Prelude.Text
}
deriving (DeleteDirectory -> DeleteDirectory -> Bool
(DeleteDirectory -> DeleteDirectory -> Bool)
-> (DeleteDirectory -> DeleteDirectory -> Bool)
-> Eq DeleteDirectory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDirectory -> DeleteDirectory -> Bool
$c/= :: DeleteDirectory -> DeleteDirectory -> Bool
== :: DeleteDirectory -> DeleteDirectory -> Bool
$c== :: DeleteDirectory -> DeleteDirectory -> Bool
Prelude.Eq, ReadPrec [DeleteDirectory]
ReadPrec DeleteDirectory
Int -> ReadS DeleteDirectory
ReadS [DeleteDirectory]
(Int -> ReadS DeleteDirectory)
-> ReadS [DeleteDirectory]
-> ReadPrec DeleteDirectory
-> ReadPrec [DeleteDirectory]
-> Read DeleteDirectory
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDirectory]
$creadListPrec :: ReadPrec [DeleteDirectory]
readPrec :: ReadPrec DeleteDirectory
$creadPrec :: ReadPrec DeleteDirectory
readList :: ReadS [DeleteDirectory]
$creadList :: ReadS [DeleteDirectory]
readsPrec :: Int -> ReadS DeleteDirectory
$creadsPrec :: Int -> ReadS DeleteDirectory
Prelude.Read, Int -> DeleteDirectory -> ShowS
[DeleteDirectory] -> ShowS
DeleteDirectory -> String
(Int -> DeleteDirectory -> ShowS)
-> (DeleteDirectory -> String)
-> ([DeleteDirectory] -> ShowS)
-> Show DeleteDirectory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDirectory] -> ShowS
$cshowList :: [DeleteDirectory] -> ShowS
show :: DeleteDirectory -> String
$cshow :: DeleteDirectory -> String
showsPrec :: Int -> DeleteDirectory -> ShowS
$cshowsPrec :: Int -> DeleteDirectory -> ShowS
Prelude.Show, (forall x. DeleteDirectory -> Rep DeleteDirectory x)
-> (forall x. Rep DeleteDirectory x -> DeleteDirectory)
-> Generic DeleteDirectory
forall x. Rep DeleteDirectory x -> DeleteDirectory
forall x. DeleteDirectory -> Rep DeleteDirectory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDirectory x -> DeleteDirectory
$cfrom :: forall x. DeleteDirectory -> Rep DeleteDirectory x
Prelude.Generic)
newDeleteDirectory ::
Prelude.Text ->
DeleteDirectory
newDeleteDirectory :: Text -> DeleteDirectory
newDeleteDirectory Text
pDirectoryId_ =
DeleteDirectory' :: Text -> DeleteDirectory
DeleteDirectory' {$sel:directoryId:DeleteDirectory' :: Text
directoryId = Text
pDirectoryId_}
deleteDirectory_directoryId :: Lens.Lens' DeleteDirectory Prelude.Text
deleteDirectory_directoryId :: (Text -> f Text) -> DeleteDirectory -> f DeleteDirectory
deleteDirectory_directoryId = (DeleteDirectory -> Text)
-> (DeleteDirectory -> Text -> DeleteDirectory)
-> Lens DeleteDirectory DeleteDirectory Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDirectory' {Text
directoryId :: Text
$sel:directoryId:DeleteDirectory' :: DeleteDirectory -> Text
directoryId} -> Text
directoryId) (\s :: DeleteDirectory
s@DeleteDirectory' {} Text
a -> DeleteDirectory
s {$sel:directoryId:DeleteDirectory' :: Text
directoryId = Text
a} :: DeleteDirectory)
instance Core.AWSRequest DeleteDirectory where
type
AWSResponse DeleteDirectory =
DeleteDirectoryResponse
request :: DeleteDirectory -> Request DeleteDirectory
request = Service -> DeleteDirectory -> Request DeleteDirectory
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteDirectory
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDirectory)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteDirectory))
-> Logger
-> Service
-> Proxy DeleteDirectory
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDirectory)))
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 -> DeleteDirectoryResponse
DeleteDirectoryResponse'
(Maybe Text -> Int -> DeleteDirectoryResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteDirectoryResponse)
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
"DirectoryId")
Either String (Int -> DeleteDirectoryResponse)
-> Either String Int -> Either String DeleteDirectoryResponse
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 DeleteDirectory
instance Prelude.NFData DeleteDirectory
instance Core.ToHeaders DeleteDirectory where
toHeaders :: DeleteDirectory -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteDirectory -> 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.DeleteDirectory" ::
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 DeleteDirectory where
toJSON :: DeleteDirectory -> Value
toJSON DeleteDirectory' {Text
directoryId :: Text
$sel:directoryId:DeleteDirectory' :: DeleteDirectory -> 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
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId)]
)
instance Core.ToPath DeleteDirectory where
toPath :: DeleteDirectory -> ByteString
toPath = ByteString -> DeleteDirectory -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteDirectory where
toQuery :: DeleteDirectory -> QueryString
toQuery = QueryString -> DeleteDirectory -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteDirectoryResponse = DeleteDirectoryResponse'
{
DeleteDirectoryResponse -> Maybe Text
directoryId :: Prelude.Maybe Prelude.Text,
DeleteDirectoryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteDirectoryResponse -> DeleteDirectoryResponse -> Bool
(DeleteDirectoryResponse -> DeleteDirectoryResponse -> Bool)
-> (DeleteDirectoryResponse -> DeleteDirectoryResponse -> Bool)
-> Eq DeleteDirectoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDirectoryResponse -> DeleteDirectoryResponse -> Bool
$c/= :: DeleteDirectoryResponse -> DeleteDirectoryResponse -> Bool
== :: DeleteDirectoryResponse -> DeleteDirectoryResponse -> Bool
$c== :: DeleteDirectoryResponse -> DeleteDirectoryResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDirectoryResponse]
ReadPrec DeleteDirectoryResponse
Int -> ReadS DeleteDirectoryResponse
ReadS [DeleteDirectoryResponse]
(Int -> ReadS DeleteDirectoryResponse)
-> ReadS [DeleteDirectoryResponse]
-> ReadPrec DeleteDirectoryResponse
-> ReadPrec [DeleteDirectoryResponse]
-> Read DeleteDirectoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDirectoryResponse]
$creadListPrec :: ReadPrec [DeleteDirectoryResponse]
readPrec :: ReadPrec DeleteDirectoryResponse
$creadPrec :: ReadPrec DeleteDirectoryResponse
readList :: ReadS [DeleteDirectoryResponse]
$creadList :: ReadS [DeleteDirectoryResponse]
readsPrec :: Int -> ReadS DeleteDirectoryResponse
$creadsPrec :: Int -> ReadS DeleteDirectoryResponse
Prelude.Read, Int -> DeleteDirectoryResponse -> ShowS
[DeleteDirectoryResponse] -> ShowS
DeleteDirectoryResponse -> String
(Int -> DeleteDirectoryResponse -> ShowS)
-> (DeleteDirectoryResponse -> String)
-> ([DeleteDirectoryResponse] -> ShowS)
-> Show DeleteDirectoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDirectoryResponse] -> ShowS
$cshowList :: [DeleteDirectoryResponse] -> ShowS
show :: DeleteDirectoryResponse -> String
$cshow :: DeleteDirectoryResponse -> String
showsPrec :: Int -> DeleteDirectoryResponse -> ShowS
$cshowsPrec :: Int -> DeleteDirectoryResponse -> ShowS
Prelude.Show, (forall x.
DeleteDirectoryResponse -> Rep DeleteDirectoryResponse x)
-> (forall x.
Rep DeleteDirectoryResponse x -> DeleteDirectoryResponse)
-> Generic DeleteDirectoryResponse
forall x. Rep DeleteDirectoryResponse x -> DeleteDirectoryResponse
forall x. DeleteDirectoryResponse -> Rep DeleteDirectoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDirectoryResponse x -> DeleteDirectoryResponse
$cfrom :: forall x. DeleteDirectoryResponse -> Rep DeleteDirectoryResponse x
Prelude.Generic)
newDeleteDirectoryResponse ::
Prelude.Int ->
DeleteDirectoryResponse
newDeleteDirectoryResponse :: Int -> DeleteDirectoryResponse
newDeleteDirectoryResponse Int
pHttpStatus_ =
DeleteDirectoryResponse' :: Maybe Text -> Int -> DeleteDirectoryResponse
DeleteDirectoryResponse'
{ $sel:directoryId:DeleteDirectoryResponse' :: Maybe Text
directoryId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteDirectoryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteDirectoryResponse_directoryId :: Lens.Lens' DeleteDirectoryResponse (Prelude.Maybe Prelude.Text)
deleteDirectoryResponse_directoryId :: (Maybe Text -> f (Maybe Text))
-> DeleteDirectoryResponse -> f DeleteDirectoryResponse
deleteDirectoryResponse_directoryId = (DeleteDirectoryResponse -> Maybe Text)
-> (DeleteDirectoryResponse
-> Maybe Text -> DeleteDirectoryResponse)
-> Lens
DeleteDirectoryResponse
DeleteDirectoryResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDirectoryResponse' {Maybe Text
directoryId :: Maybe Text
$sel:directoryId:DeleteDirectoryResponse' :: DeleteDirectoryResponse -> Maybe Text
directoryId} -> Maybe Text
directoryId) (\s :: DeleteDirectoryResponse
s@DeleteDirectoryResponse' {} Maybe Text
a -> DeleteDirectoryResponse
s {$sel:directoryId:DeleteDirectoryResponse' :: Maybe Text
directoryId = Maybe Text
a} :: DeleteDirectoryResponse)
deleteDirectoryResponse_httpStatus :: Lens.Lens' DeleteDirectoryResponse Prelude.Int
deleteDirectoryResponse_httpStatus :: (Int -> f Int)
-> DeleteDirectoryResponse -> f DeleteDirectoryResponse
deleteDirectoryResponse_httpStatus = (DeleteDirectoryResponse -> Int)
-> (DeleteDirectoryResponse -> Int -> DeleteDirectoryResponse)
-> Lens DeleteDirectoryResponse DeleteDirectoryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDirectoryResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDirectoryResponse' :: DeleteDirectoryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteDirectoryResponse
s@DeleteDirectoryResponse' {} Int
a -> DeleteDirectoryResponse
s {$sel:httpStatus:DeleteDirectoryResponse' :: Int
httpStatus = Int
a} :: DeleteDirectoryResponse)
instance Prelude.NFData DeleteDirectoryResponse