{-# 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.CreateOrganization
(
CreateOrganization (..),
newCreateOrganization,
createOrganization_clientToken,
createOrganization_directoryId,
createOrganization_domains,
createOrganization_enableInteroperability,
createOrganization_kmsKeyArn,
createOrganization_alias,
CreateOrganizationResponse (..),
newCreateOrganizationResponse,
createOrganizationResponse_organizationId,
createOrganizationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkMail.Types
data CreateOrganization = CreateOrganization'
{
CreateOrganization -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateOrganization -> Maybe Text
directoryId :: Prelude.Maybe Prelude.Text,
CreateOrganization -> Maybe [Domain]
domains :: Prelude.Maybe [Domain],
CreateOrganization -> Maybe Bool
enableInteroperability :: Prelude.Maybe Prelude.Bool,
CreateOrganization -> Maybe Text
kmsKeyArn :: Prelude.Maybe Prelude.Text,
CreateOrganization -> Text
alias :: Prelude.Text
}
deriving (CreateOrganization -> CreateOrganization -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateOrganization -> CreateOrganization -> Bool
$c/= :: CreateOrganization -> CreateOrganization -> Bool
== :: CreateOrganization -> CreateOrganization -> Bool
$c== :: CreateOrganization -> CreateOrganization -> Bool
Prelude.Eq, ReadPrec [CreateOrganization]
ReadPrec CreateOrganization
Int -> ReadS CreateOrganization
ReadS [CreateOrganization]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateOrganization]
$creadListPrec :: ReadPrec [CreateOrganization]
readPrec :: ReadPrec CreateOrganization
$creadPrec :: ReadPrec CreateOrganization
readList :: ReadS [CreateOrganization]
$creadList :: ReadS [CreateOrganization]
readsPrec :: Int -> ReadS CreateOrganization
$creadsPrec :: Int -> ReadS CreateOrganization
Prelude.Read, Int -> CreateOrganization -> ShowS
[CreateOrganization] -> ShowS
CreateOrganization -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateOrganization] -> ShowS
$cshowList :: [CreateOrganization] -> ShowS
show :: CreateOrganization -> String
$cshow :: CreateOrganization -> String
showsPrec :: Int -> CreateOrganization -> ShowS
$cshowsPrec :: Int -> CreateOrganization -> ShowS
Prelude.Show, forall x. Rep CreateOrganization x -> CreateOrganization
forall x. CreateOrganization -> Rep CreateOrganization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateOrganization x -> CreateOrganization
$cfrom :: forall x. CreateOrganization -> Rep CreateOrganization x
Prelude.Generic)
newCreateOrganization ::
Prelude.Text ->
CreateOrganization
newCreateOrganization :: Text -> CreateOrganization
newCreateOrganization Text
pAlias_ =
CreateOrganization'
{ $sel:clientToken:CreateOrganization' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
$sel:directoryId:CreateOrganization' :: Maybe Text
directoryId = forall a. Maybe a
Prelude.Nothing,
$sel:domains:CreateOrganization' :: Maybe [Domain]
domains = forall a. Maybe a
Prelude.Nothing,
$sel:enableInteroperability:CreateOrganization' :: Maybe Bool
enableInteroperability = forall a. Maybe a
Prelude.Nothing,
$sel:kmsKeyArn:CreateOrganization' :: Maybe Text
kmsKeyArn = forall a. Maybe a
Prelude.Nothing,
$sel:alias:CreateOrganization' :: Text
alias = Text
pAlias_
}
createOrganization_clientToken :: Lens.Lens' CreateOrganization (Prelude.Maybe Prelude.Text)
createOrganization_clientToken :: Lens' CreateOrganization (Maybe Text)
createOrganization_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganization' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateOrganization' :: CreateOrganization -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateOrganization
s@CreateOrganization' {} Maybe Text
a -> CreateOrganization
s {$sel:clientToken:CreateOrganization' :: Maybe Text
clientToken = Maybe Text
a} :: CreateOrganization)
createOrganization_directoryId :: Lens.Lens' CreateOrganization (Prelude.Maybe Prelude.Text)
createOrganization_directoryId :: Lens' CreateOrganization (Maybe Text)
createOrganization_directoryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganization' {Maybe Text
directoryId :: Maybe Text
$sel:directoryId:CreateOrganization' :: CreateOrganization -> Maybe Text
directoryId} -> Maybe Text
directoryId) (\s :: CreateOrganization
s@CreateOrganization' {} Maybe Text
a -> CreateOrganization
s {$sel:directoryId:CreateOrganization' :: Maybe Text
directoryId = Maybe Text
a} :: CreateOrganization)
createOrganization_domains :: Lens.Lens' CreateOrganization (Prelude.Maybe [Domain])
createOrganization_domains :: Lens' CreateOrganization (Maybe [Domain])
createOrganization_domains = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganization' {Maybe [Domain]
domains :: Maybe [Domain]
$sel:domains:CreateOrganization' :: CreateOrganization -> Maybe [Domain]
domains} -> Maybe [Domain]
domains) (\s :: CreateOrganization
s@CreateOrganization' {} Maybe [Domain]
a -> CreateOrganization
s {$sel:domains:CreateOrganization' :: Maybe [Domain]
domains = Maybe [Domain]
a} :: CreateOrganization) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createOrganization_enableInteroperability :: Lens.Lens' CreateOrganization (Prelude.Maybe Prelude.Bool)
createOrganization_enableInteroperability :: Lens' CreateOrganization (Maybe Bool)
createOrganization_enableInteroperability = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganization' {Maybe Bool
enableInteroperability :: Maybe Bool
$sel:enableInteroperability:CreateOrganization' :: CreateOrganization -> Maybe Bool
enableInteroperability} -> Maybe Bool
enableInteroperability) (\s :: CreateOrganization
s@CreateOrganization' {} Maybe Bool
a -> CreateOrganization
s {$sel:enableInteroperability:CreateOrganization' :: Maybe Bool
enableInteroperability = Maybe Bool
a} :: CreateOrganization)
createOrganization_kmsKeyArn :: Lens.Lens' CreateOrganization (Prelude.Maybe Prelude.Text)
createOrganization_kmsKeyArn :: Lens' CreateOrganization (Maybe Text)
createOrganization_kmsKeyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganization' {Maybe Text
kmsKeyArn :: Maybe Text
$sel:kmsKeyArn:CreateOrganization' :: CreateOrganization -> Maybe Text
kmsKeyArn} -> Maybe Text
kmsKeyArn) (\s :: CreateOrganization
s@CreateOrganization' {} Maybe Text
a -> CreateOrganization
s {$sel:kmsKeyArn:CreateOrganization' :: Maybe Text
kmsKeyArn = Maybe Text
a} :: CreateOrganization)
createOrganization_alias :: Lens.Lens' CreateOrganization Prelude.Text
createOrganization_alias :: Lens' CreateOrganization Text
createOrganization_alias = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganization' {Text
alias :: Text
$sel:alias:CreateOrganization' :: CreateOrganization -> Text
alias} -> Text
alias) (\s :: CreateOrganization
s@CreateOrganization' {} Text
a -> CreateOrganization
s {$sel:alias:CreateOrganization' :: Text
alias = Text
a} :: CreateOrganization)
instance Core.AWSRequest CreateOrganization where
type
AWSResponse CreateOrganization =
CreateOrganizationResponse
request :: (Service -> Service)
-> CreateOrganization -> Request CreateOrganization
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateOrganization
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateOrganization)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CreateOrganizationResponse
CreateOrganizationResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"OrganizationId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateOrganization where
hashWithSalt :: Int -> CreateOrganization -> Int
hashWithSalt Int
_salt CreateOrganization' {Maybe Bool
Maybe [Domain]
Maybe Text
Text
alias :: Text
kmsKeyArn :: Maybe Text
enableInteroperability :: Maybe Bool
domains :: Maybe [Domain]
directoryId :: Maybe Text
clientToken :: Maybe Text
$sel:alias:CreateOrganization' :: CreateOrganization -> Text
$sel:kmsKeyArn:CreateOrganization' :: CreateOrganization -> Maybe Text
$sel:enableInteroperability:CreateOrganization' :: CreateOrganization -> Maybe Bool
$sel:domains:CreateOrganization' :: CreateOrganization -> Maybe [Domain]
$sel:directoryId:CreateOrganization' :: CreateOrganization -> Maybe Text
$sel:clientToken:CreateOrganization' :: CreateOrganization -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
directoryId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Domain]
domains
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enableInteroperability
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
alias
instance Prelude.NFData CreateOrganization where
rnf :: CreateOrganization -> ()
rnf CreateOrganization' {Maybe Bool
Maybe [Domain]
Maybe Text
Text
alias :: Text
kmsKeyArn :: Maybe Text
enableInteroperability :: Maybe Bool
domains :: Maybe [Domain]
directoryId :: Maybe Text
clientToken :: Maybe Text
$sel:alias:CreateOrganization' :: CreateOrganization -> Text
$sel:kmsKeyArn:CreateOrganization' :: CreateOrganization -> Maybe Text
$sel:enableInteroperability:CreateOrganization' :: CreateOrganization -> Maybe Bool
$sel:domains:CreateOrganization' :: CreateOrganization -> Maybe [Domain]
$sel:directoryId:CreateOrganization' :: CreateOrganization -> Maybe Text
$sel:clientToken:CreateOrganization' :: CreateOrganization -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
directoryId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Domain]
domains
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enableInteroperability
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
alias
instance Data.ToHeaders CreateOrganization where
toHeaders :: CreateOrganization -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"WorkMailService.CreateOrganization" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateOrganization where
toJSON :: CreateOrganization -> Value
toJSON CreateOrganization' {Maybe Bool
Maybe [Domain]
Maybe Text
Text
alias :: Text
kmsKeyArn :: Maybe Text
enableInteroperability :: Maybe Bool
domains :: Maybe [Domain]
directoryId :: Maybe Text
clientToken :: Maybe Text
$sel:alias:CreateOrganization' :: CreateOrganization -> Text
$sel:kmsKeyArn:CreateOrganization' :: CreateOrganization -> Maybe Text
$sel:enableInteroperability:CreateOrganization' :: CreateOrganization -> Maybe Bool
$sel:domains:CreateOrganization' :: CreateOrganization -> Maybe [Domain]
$sel:directoryId:CreateOrganization' :: CreateOrganization -> Maybe Text
$sel:clientToken:CreateOrganization' :: CreateOrganization -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ClientToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
(Key
"DirectoryId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
directoryId,
(Key
"Domains" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Domain]
domains,
(Key
"EnableInteroperability" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableInteroperability,
(Key
"KmsKeyArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyArn,
forall a. a -> Maybe a
Prelude.Just (Key
"Alias" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
alias)
]
)
instance Data.ToPath CreateOrganization where
toPath :: CreateOrganization -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateOrganization where
toQuery :: CreateOrganization -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateOrganizationResponse = CreateOrganizationResponse'
{
CreateOrganizationResponse -> Maybe Text
organizationId :: Prelude.Maybe Prelude.Text,
CreateOrganizationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateOrganizationResponse -> CreateOrganizationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateOrganizationResponse -> CreateOrganizationResponse -> Bool
$c/= :: CreateOrganizationResponse -> CreateOrganizationResponse -> Bool
== :: CreateOrganizationResponse -> CreateOrganizationResponse -> Bool
$c== :: CreateOrganizationResponse -> CreateOrganizationResponse -> Bool
Prelude.Eq, ReadPrec [CreateOrganizationResponse]
ReadPrec CreateOrganizationResponse
Int -> ReadS CreateOrganizationResponse
ReadS [CreateOrganizationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateOrganizationResponse]
$creadListPrec :: ReadPrec [CreateOrganizationResponse]
readPrec :: ReadPrec CreateOrganizationResponse
$creadPrec :: ReadPrec CreateOrganizationResponse
readList :: ReadS [CreateOrganizationResponse]
$creadList :: ReadS [CreateOrganizationResponse]
readsPrec :: Int -> ReadS CreateOrganizationResponse
$creadsPrec :: Int -> ReadS CreateOrganizationResponse
Prelude.Read, Int -> CreateOrganizationResponse -> ShowS
[CreateOrganizationResponse] -> ShowS
CreateOrganizationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateOrganizationResponse] -> ShowS
$cshowList :: [CreateOrganizationResponse] -> ShowS
show :: CreateOrganizationResponse -> String
$cshow :: CreateOrganizationResponse -> String
showsPrec :: Int -> CreateOrganizationResponse -> ShowS
$cshowsPrec :: Int -> CreateOrganizationResponse -> ShowS
Prelude.Show, forall x.
Rep CreateOrganizationResponse x -> CreateOrganizationResponse
forall x.
CreateOrganizationResponse -> Rep CreateOrganizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateOrganizationResponse x -> CreateOrganizationResponse
$cfrom :: forall x.
CreateOrganizationResponse -> Rep CreateOrganizationResponse x
Prelude.Generic)
newCreateOrganizationResponse ::
Prelude.Int ->
CreateOrganizationResponse
newCreateOrganizationResponse :: Int -> CreateOrganizationResponse
newCreateOrganizationResponse Int
pHttpStatus_ =
CreateOrganizationResponse'
{ $sel:organizationId:CreateOrganizationResponse' :: Maybe Text
organizationId =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateOrganizationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createOrganizationResponse_organizationId :: Lens.Lens' CreateOrganizationResponse (Prelude.Maybe Prelude.Text)
createOrganizationResponse_organizationId :: Lens' CreateOrganizationResponse (Maybe Text)
createOrganizationResponse_organizationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganizationResponse' {Maybe Text
organizationId :: Maybe Text
$sel:organizationId:CreateOrganizationResponse' :: CreateOrganizationResponse -> Maybe Text
organizationId} -> Maybe Text
organizationId) (\s :: CreateOrganizationResponse
s@CreateOrganizationResponse' {} Maybe Text
a -> CreateOrganizationResponse
s {$sel:organizationId:CreateOrganizationResponse' :: Maybe Text
organizationId = Maybe Text
a} :: CreateOrganizationResponse)
createOrganizationResponse_httpStatus :: Lens.Lens' CreateOrganizationResponse Prelude.Int
createOrganizationResponse_httpStatus :: Lens' CreateOrganizationResponse Int
createOrganizationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateOrganizationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateOrganizationResponse' :: CreateOrganizationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateOrganizationResponse
s@CreateOrganizationResponse' {} Int
a -> CreateOrganizationResponse
s {$sel:httpStatus:CreateOrganizationResponse' :: Int
httpStatus = Int
a} :: CreateOrganizationResponse)
instance Prelude.NFData CreateOrganizationResponse where
rnf :: CreateOrganizationResponse -> ()
rnf CreateOrganizationResponse' {Int
Maybe Text
httpStatus :: Int
organizationId :: Maybe Text
$sel:httpStatus:CreateOrganizationResponse' :: CreateOrganizationResponse -> Int
$sel:organizationId:CreateOrganizationResponse' :: CreateOrganizationResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
organizationId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus