{-# 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.WorkMail.DeleteOrganization
(
DeleteOrganization (..),
newDeleteOrganization,
deleteOrganization_clientToken,
deleteOrganization_organizationId,
deleteOrganization_deleteDirectory,
DeleteOrganizationResponse (..),
newDeleteOrganizationResponse,
deleteOrganizationResponse_state,
deleteOrganizationResponse_organizationId,
deleteOrganizationResponse_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.WorkMail.Types
data DeleteOrganization = DeleteOrganization'
{
DeleteOrganization -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
DeleteOrganization -> Text
organizationId :: Prelude.Text,
DeleteOrganization -> Bool
deleteDirectory :: Prelude.Bool
}
deriving (DeleteOrganization -> DeleteOrganization -> Bool
(DeleteOrganization -> DeleteOrganization -> Bool)
-> (DeleteOrganization -> DeleteOrganization -> Bool)
-> Eq DeleteOrganization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteOrganization -> DeleteOrganization -> Bool
$c/= :: DeleteOrganization -> DeleteOrganization -> Bool
== :: DeleteOrganization -> DeleteOrganization -> Bool
$c== :: DeleteOrganization -> DeleteOrganization -> Bool
Prelude.Eq, ReadPrec [DeleteOrganization]
ReadPrec DeleteOrganization
Int -> ReadS DeleteOrganization
ReadS [DeleteOrganization]
(Int -> ReadS DeleteOrganization)
-> ReadS [DeleteOrganization]
-> ReadPrec DeleteOrganization
-> ReadPrec [DeleteOrganization]
-> Read DeleteOrganization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteOrganization]
$creadListPrec :: ReadPrec [DeleteOrganization]
readPrec :: ReadPrec DeleteOrganization
$creadPrec :: ReadPrec DeleteOrganization
readList :: ReadS [DeleteOrganization]
$creadList :: ReadS [DeleteOrganization]
readsPrec :: Int -> ReadS DeleteOrganization
$creadsPrec :: Int -> ReadS DeleteOrganization
Prelude.Read, Int -> DeleteOrganization -> ShowS
[DeleteOrganization] -> ShowS
DeleteOrganization -> String
(Int -> DeleteOrganization -> ShowS)
-> (DeleteOrganization -> String)
-> ([DeleteOrganization] -> ShowS)
-> Show DeleteOrganization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteOrganization] -> ShowS
$cshowList :: [DeleteOrganization] -> ShowS
show :: DeleteOrganization -> String
$cshow :: DeleteOrganization -> String
showsPrec :: Int -> DeleteOrganization -> ShowS
$cshowsPrec :: Int -> DeleteOrganization -> ShowS
Prelude.Show, (forall x. DeleteOrganization -> Rep DeleteOrganization x)
-> (forall x. Rep DeleteOrganization x -> DeleteOrganization)
-> Generic DeleteOrganization
forall x. Rep DeleteOrganization x -> DeleteOrganization
forall x. DeleteOrganization -> Rep DeleteOrganization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteOrganization x -> DeleteOrganization
$cfrom :: forall x. DeleteOrganization -> Rep DeleteOrganization x
Prelude.Generic)
newDeleteOrganization ::
Prelude.Text ->
Prelude.Bool ->
DeleteOrganization
newDeleteOrganization :: Text -> Bool -> DeleteOrganization
newDeleteOrganization
Text
pOrganizationId_
Bool
pDeleteDirectory_ =
DeleteOrganization' :: Maybe Text -> Text -> Bool -> DeleteOrganization
DeleteOrganization'
{ $sel:clientToken:DeleteOrganization' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:organizationId:DeleteOrganization' :: Text
organizationId = Text
pOrganizationId_,
$sel:deleteDirectory:DeleteOrganization' :: Bool
deleteDirectory = Bool
pDeleteDirectory_
}
deleteOrganization_clientToken :: Lens.Lens' DeleteOrganization (Prelude.Maybe Prelude.Text)
deleteOrganization_clientToken :: (Maybe Text -> f (Maybe Text))
-> DeleteOrganization -> f DeleteOrganization
deleteOrganization_clientToken = (DeleteOrganization -> Maybe Text)
-> (DeleteOrganization -> Maybe Text -> DeleteOrganization)
-> Lens
DeleteOrganization DeleteOrganization (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteOrganization' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteOrganization' :: DeleteOrganization -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteOrganization
s@DeleteOrganization' {} Maybe Text
a -> DeleteOrganization
s {$sel:clientToken:DeleteOrganization' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteOrganization)
deleteOrganization_organizationId :: Lens.Lens' DeleteOrganization Prelude.Text
deleteOrganization_organizationId :: (Text -> f Text) -> DeleteOrganization -> f DeleteOrganization
deleteOrganization_organizationId = (DeleteOrganization -> Text)
-> (DeleteOrganization -> Text -> DeleteOrganization)
-> Lens DeleteOrganization DeleteOrganization Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteOrganization' {Text
organizationId :: Text
$sel:organizationId:DeleteOrganization' :: DeleteOrganization -> Text
organizationId} -> Text
organizationId) (\s :: DeleteOrganization
s@DeleteOrganization' {} Text
a -> DeleteOrganization
s {$sel:organizationId:DeleteOrganization' :: Text
organizationId = Text
a} :: DeleteOrganization)
deleteOrganization_deleteDirectory :: Lens.Lens' DeleteOrganization Prelude.Bool
deleteOrganization_deleteDirectory :: (Bool -> f Bool) -> DeleteOrganization -> f DeleteOrganization
deleteOrganization_deleteDirectory = (DeleteOrganization -> Bool)
-> (DeleteOrganization -> Bool -> DeleteOrganization)
-> Lens DeleteOrganization DeleteOrganization Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteOrganization' {Bool
deleteDirectory :: Bool
$sel:deleteDirectory:DeleteOrganization' :: DeleteOrganization -> Bool
deleteDirectory} -> Bool
deleteDirectory) (\s :: DeleteOrganization
s@DeleteOrganization' {} Bool
a -> DeleteOrganization
s {$sel:deleteDirectory:DeleteOrganization' :: Bool
deleteDirectory = Bool
a} :: DeleteOrganization)
instance Core.AWSRequest DeleteOrganization where
type
AWSResponse DeleteOrganization =
DeleteOrganizationResponse
request :: DeleteOrganization -> Request DeleteOrganization
request = Service -> DeleteOrganization -> Request DeleteOrganization
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteOrganization
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteOrganization)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteOrganization))
-> Logger
-> Service
-> Proxy DeleteOrganization
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeleteOrganization)))
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 -> Maybe Text -> Int -> DeleteOrganizationResponse
DeleteOrganizationResponse'
(Maybe Text -> Maybe Text -> Int -> DeleteOrganizationResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> DeleteOrganizationResponse)
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
"State")
Either String (Maybe Text -> Int -> DeleteOrganizationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteOrganizationResponse)
forall (f :: * -> *) a b. Applicative f => 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
"OrganizationId")
Either String (Int -> DeleteOrganizationResponse)
-> Either String Int -> Either String DeleteOrganizationResponse
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 DeleteOrganization
instance Prelude.NFData DeleteOrganization
instance Core.ToHeaders DeleteOrganization where
toHeaders :: DeleteOrganization -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteOrganization -> 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
"WorkMailService.DeleteOrganization" ::
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 DeleteOrganization where
toJSON :: DeleteOrganization -> Value
toJSON DeleteOrganization' {Bool
Maybe Text
Text
deleteDirectory :: Bool
organizationId :: Text
clientToken :: Maybe Text
$sel:deleteDirectory:DeleteOrganization' :: DeleteOrganization -> Bool
$sel:organizationId:DeleteOrganization' :: DeleteOrganization -> Text
$sel:clientToken:DeleteOrganization' :: DeleteOrganization -> 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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"OrganizationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
organizationId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DeleteDirectory" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
deleteDirectory)
]
)
instance Core.ToPath DeleteOrganization where
toPath :: DeleteOrganization -> ByteString
toPath = ByteString -> DeleteOrganization -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteOrganization where
toQuery :: DeleteOrganization -> QueryString
toQuery = QueryString -> DeleteOrganization -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteOrganizationResponse = DeleteOrganizationResponse'
{
DeleteOrganizationResponse -> Maybe Text
state :: Prelude.Maybe Prelude.Text,
DeleteOrganizationResponse -> Maybe Text
organizationId :: Prelude.Maybe Prelude.Text,
DeleteOrganizationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteOrganizationResponse -> DeleteOrganizationResponse -> Bool
(DeleteOrganizationResponse -> DeleteOrganizationResponse -> Bool)
-> (DeleteOrganizationResponse
-> DeleteOrganizationResponse -> Bool)
-> Eq DeleteOrganizationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteOrganizationResponse -> DeleteOrganizationResponse -> Bool
$c/= :: DeleteOrganizationResponse -> DeleteOrganizationResponse -> Bool
== :: DeleteOrganizationResponse -> DeleteOrganizationResponse -> Bool
$c== :: DeleteOrganizationResponse -> DeleteOrganizationResponse -> Bool
Prelude.Eq, ReadPrec [DeleteOrganizationResponse]
ReadPrec DeleteOrganizationResponse
Int -> ReadS DeleteOrganizationResponse
ReadS [DeleteOrganizationResponse]
(Int -> ReadS DeleteOrganizationResponse)
-> ReadS [DeleteOrganizationResponse]
-> ReadPrec DeleteOrganizationResponse
-> ReadPrec [DeleteOrganizationResponse]
-> Read DeleteOrganizationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteOrganizationResponse]
$creadListPrec :: ReadPrec [DeleteOrganizationResponse]
readPrec :: ReadPrec DeleteOrganizationResponse
$creadPrec :: ReadPrec DeleteOrganizationResponse
readList :: ReadS [DeleteOrganizationResponse]
$creadList :: ReadS [DeleteOrganizationResponse]
readsPrec :: Int -> ReadS DeleteOrganizationResponse
$creadsPrec :: Int -> ReadS DeleteOrganizationResponse
Prelude.Read, Int -> DeleteOrganizationResponse -> ShowS
[DeleteOrganizationResponse] -> ShowS
DeleteOrganizationResponse -> String
(Int -> DeleteOrganizationResponse -> ShowS)
-> (DeleteOrganizationResponse -> String)
-> ([DeleteOrganizationResponse] -> ShowS)
-> Show DeleteOrganizationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteOrganizationResponse] -> ShowS
$cshowList :: [DeleteOrganizationResponse] -> ShowS
show :: DeleteOrganizationResponse -> String
$cshow :: DeleteOrganizationResponse -> String
showsPrec :: Int -> DeleteOrganizationResponse -> ShowS
$cshowsPrec :: Int -> DeleteOrganizationResponse -> ShowS
Prelude.Show, (forall x.
DeleteOrganizationResponse -> Rep DeleteOrganizationResponse x)
-> (forall x.
Rep DeleteOrganizationResponse x -> DeleteOrganizationResponse)
-> Generic DeleteOrganizationResponse
forall x.
Rep DeleteOrganizationResponse x -> DeleteOrganizationResponse
forall x.
DeleteOrganizationResponse -> Rep DeleteOrganizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteOrganizationResponse x -> DeleteOrganizationResponse
$cfrom :: forall x.
DeleteOrganizationResponse -> Rep DeleteOrganizationResponse x
Prelude.Generic)
newDeleteOrganizationResponse ::
Prelude.Int ->
DeleteOrganizationResponse
newDeleteOrganizationResponse :: Int -> DeleteOrganizationResponse
newDeleteOrganizationResponse Int
pHttpStatus_ =
DeleteOrganizationResponse' :: Maybe Text -> Maybe Text -> Int -> DeleteOrganizationResponse
DeleteOrganizationResponse'
{ $sel:state:DeleteOrganizationResponse' :: Maybe Text
state =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:organizationId:DeleteOrganizationResponse' :: Maybe Text
organizationId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteOrganizationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteOrganizationResponse_state :: Lens.Lens' DeleteOrganizationResponse (Prelude.Maybe Prelude.Text)
deleteOrganizationResponse_state :: (Maybe Text -> f (Maybe Text))
-> DeleteOrganizationResponse -> f DeleteOrganizationResponse
deleteOrganizationResponse_state = (DeleteOrganizationResponse -> Maybe Text)
-> (DeleteOrganizationResponse
-> Maybe Text -> DeleteOrganizationResponse)
-> Lens
DeleteOrganizationResponse
DeleteOrganizationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteOrganizationResponse' {Maybe Text
state :: Maybe Text
$sel:state:DeleteOrganizationResponse' :: DeleteOrganizationResponse -> Maybe Text
state} -> Maybe Text
state) (\s :: DeleteOrganizationResponse
s@DeleteOrganizationResponse' {} Maybe Text
a -> DeleteOrganizationResponse
s {$sel:state:DeleteOrganizationResponse' :: Maybe Text
state = Maybe Text
a} :: DeleteOrganizationResponse)
deleteOrganizationResponse_organizationId :: Lens.Lens' DeleteOrganizationResponse (Prelude.Maybe Prelude.Text)
deleteOrganizationResponse_organizationId :: (Maybe Text -> f (Maybe Text))
-> DeleteOrganizationResponse -> f DeleteOrganizationResponse
deleteOrganizationResponse_organizationId = (DeleteOrganizationResponse -> Maybe Text)
-> (DeleteOrganizationResponse
-> Maybe Text -> DeleteOrganizationResponse)
-> Lens
DeleteOrganizationResponse
DeleteOrganizationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteOrganizationResponse' {Maybe Text
organizationId :: Maybe Text
$sel:organizationId:DeleteOrganizationResponse' :: DeleteOrganizationResponse -> Maybe Text
organizationId} -> Maybe Text
organizationId) (\s :: DeleteOrganizationResponse
s@DeleteOrganizationResponse' {} Maybe Text
a -> DeleteOrganizationResponse
s {$sel:organizationId:DeleteOrganizationResponse' :: Maybe Text
organizationId = Maybe Text
a} :: DeleteOrganizationResponse)
deleteOrganizationResponse_httpStatus :: Lens.Lens' DeleteOrganizationResponse Prelude.Int
deleteOrganizationResponse_httpStatus :: (Int -> f Int)
-> DeleteOrganizationResponse -> f DeleteOrganizationResponse
deleteOrganizationResponse_httpStatus = (DeleteOrganizationResponse -> Int)
-> (DeleteOrganizationResponse
-> Int -> DeleteOrganizationResponse)
-> Lens
DeleteOrganizationResponse DeleteOrganizationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteOrganizationResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteOrganizationResponse' :: DeleteOrganizationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteOrganizationResponse
s@DeleteOrganizationResponse' {} Int
a -> DeleteOrganizationResponse
s {$sel:httpStatus:DeleteOrganizationResponse' :: Int
httpStatus = Int
a} :: DeleteOrganizationResponse)
instance Prelude.NFData DeleteOrganizationResponse