{-# 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.VoiceId.CreateDomain
(
CreateDomain (..),
newCreateDomain,
createDomain_clientToken,
createDomain_description,
createDomain_tags,
createDomain_name,
createDomain_serverSideEncryptionConfiguration,
CreateDomainResponse (..),
newCreateDomainResponse,
createDomainResponse_domain,
createDomainResponse_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.VoiceId.Types
data CreateDomain = CreateDomain'
{
CreateDomain -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateDomain -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Data.Sensitive Prelude.Text),
CreateDomain -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateDomain -> Sensitive Text
name :: Data.Sensitive Prelude.Text,
CreateDomain -> ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration :: ServerSideEncryptionConfiguration
}
deriving (CreateDomain -> CreateDomain -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDomain -> CreateDomain -> Bool
$c/= :: CreateDomain -> CreateDomain -> Bool
== :: CreateDomain -> CreateDomain -> Bool
$c== :: CreateDomain -> CreateDomain -> Bool
Prelude.Eq, Int -> CreateDomain -> ShowS
[CreateDomain] -> ShowS
CreateDomain -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDomain] -> ShowS
$cshowList :: [CreateDomain] -> ShowS
show :: CreateDomain -> String
$cshow :: CreateDomain -> String
showsPrec :: Int -> CreateDomain -> ShowS
$cshowsPrec :: Int -> CreateDomain -> ShowS
Prelude.Show, forall x. Rep CreateDomain x -> CreateDomain
forall x. CreateDomain -> Rep CreateDomain x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDomain x -> CreateDomain
$cfrom :: forall x. CreateDomain -> Rep CreateDomain x
Prelude.Generic)
newCreateDomain ::
Prelude.Text ->
ServerSideEncryptionConfiguration ->
CreateDomain
newCreateDomain :: Text -> ServerSideEncryptionConfiguration -> CreateDomain
newCreateDomain
Text
pName_
ServerSideEncryptionConfiguration
pServerSideEncryptionConfiguration_ =
CreateDomain'
{ $sel:clientToken:CreateDomain' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateDomain' :: Maybe (Sensitive Text)
description = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateDomain' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateDomain' :: Sensitive Text
name = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pName_,
$sel:serverSideEncryptionConfiguration:CreateDomain' :: ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration =
ServerSideEncryptionConfiguration
pServerSideEncryptionConfiguration_
}
createDomain_clientToken :: Lens.Lens' CreateDomain (Prelude.Maybe Prelude.Text)
createDomain_clientToken :: Lens' CreateDomain (Maybe Text)
createDomain_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomain' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateDomain' :: CreateDomain -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateDomain
s@CreateDomain' {} Maybe Text
a -> CreateDomain
s {$sel:clientToken:CreateDomain' :: Maybe Text
clientToken = Maybe Text
a} :: CreateDomain)
createDomain_description :: Lens.Lens' CreateDomain (Prelude.Maybe Prelude.Text)
createDomain_description :: Lens' CreateDomain (Maybe Text)
createDomain_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomain' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:CreateDomain' :: CreateDomain -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: CreateDomain
s@CreateDomain' {} Maybe (Sensitive Text)
a -> CreateDomain
s {$sel:description:CreateDomain' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: CreateDomain) 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 a. Iso' (Sensitive a) a
Data._Sensitive
createDomain_tags :: Lens.Lens' CreateDomain (Prelude.Maybe [Tag])
createDomain_tags :: Lens' CreateDomain (Maybe [Tag])
createDomain_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomain' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDomain' :: CreateDomain -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDomain
s@CreateDomain' {} Maybe [Tag]
a -> CreateDomain
s {$sel:tags:CreateDomain' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDomain) 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
createDomain_name :: Lens.Lens' CreateDomain Prelude.Text
createDomain_name :: Lens' CreateDomain Text
createDomain_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomain' {Sensitive Text
name :: Sensitive Text
$sel:name:CreateDomain' :: CreateDomain -> Sensitive Text
name} -> Sensitive Text
name) (\s :: CreateDomain
s@CreateDomain' {} Sensitive Text
a -> CreateDomain
s {$sel:name:CreateDomain' :: Sensitive Text
name = Sensitive Text
a} :: CreateDomain) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
createDomain_serverSideEncryptionConfiguration :: Lens.Lens' CreateDomain ServerSideEncryptionConfiguration
createDomain_serverSideEncryptionConfiguration :: Lens' CreateDomain ServerSideEncryptionConfiguration
createDomain_serverSideEncryptionConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomain' {ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration :: ServerSideEncryptionConfiguration
$sel:serverSideEncryptionConfiguration:CreateDomain' :: CreateDomain -> ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration} -> ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration) (\s :: CreateDomain
s@CreateDomain' {} ServerSideEncryptionConfiguration
a -> CreateDomain
s {$sel:serverSideEncryptionConfiguration:CreateDomain' :: ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration = ServerSideEncryptionConfiguration
a} :: CreateDomain)
instance Core.AWSRequest CreateDomain where
type AWSResponse CreateDomain = CreateDomainResponse
request :: (Service -> Service) -> CreateDomain -> Request CreateDomain
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 CreateDomain
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDomain)))
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 Domain -> Int -> CreateDomainResponse
CreateDomainResponse'
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
"Domain")
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 CreateDomain where
hashWithSalt :: Int -> CreateDomain -> Int
hashWithSalt Int
_salt CreateDomain' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Sensitive Text
ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration :: ServerSideEncryptionConfiguration
name :: Sensitive Text
tags :: Maybe [Tag]
description :: Maybe (Sensitive Text)
clientToken :: Maybe Text
$sel:serverSideEncryptionConfiguration:CreateDomain' :: CreateDomain -> ServerSideEncryptionConfiguration
$sel:name:CreateDomain' :: CreateDomain -> Sensitive Text
$sel:tags:CreateDomain' :: CreateDomain -> Maybe [Tag]
$sel:description:CreateDomain' :: CreateDomain -> Maybe (Sensitive Text)
$sel:clientToken:CreateDomain' :: CreateDomain -> 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 (Sensitive Text)
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration
instance Prelude.NFData CreateDomain where
rnf :: CreateDomain -> ()
rnf CreateDomain' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Sensitive Text
ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration :: ServerSideEncryptionConfiguration
name :: Sensitive Text
tags :: Maybe [Tag]
description :: Maybe (Sensitive Text)
clientToken :: Maybe Text
$sel:serverSideEncryptionConfiguration:CreateDomain' :: CreateDomain -> ServerSideEncryptionConfiguration
$sel:name:CreateDomain' :: CreateDomain -> Sensitive Text
$sel:tags:CreateDomain' :: CreateDomain -> Maybe [Tag]
$sel:description:CreateDomain' :: CreateDomain -> Maybe (Sensitive Text)
$sel:clientToken:CreateDomain' :: CreateDomain -> 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 (Sensitive Text)
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration
instance Data.ToHeaders CreateDomain where
toHeaders :: CreateDomain -> 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
"VoiceID.CreateDomain" :: Prelude.ByteString),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateDomain where
toJSON :: CreateDomain -> Value
toJSON CreateDomain' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Sensitive Text
ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration :: ServerSideEncryptionConfiguration
name :: Sensitive Text
tags :: Maybe [Tag]
description :: Maybe (Sensitive Text)
clientToken :: Maybe Text
$sel:serverSideEncryptionConfiguration:CreateDomain' :: CreateDomain -> ServerSideEncryptionConfiguration
$sel:name:CreateDomain' :: CreateDomain -> Sensitive Text
$sel:tags:CreateDomain' :: CreateDomain -> Maybe [Tag]
$sel:description:CreateDomain' :: CreateDomain -> Maybe (Sensitive Text)
$sel:clientToken:CreateDomain' :: CreateDomain -> 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
"Description" 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 (Sensitive Text)
description,
(Key
"Tags" 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 [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
name),
forall a. a -> Maybe a
Prelude.Just
( Key
"ServerSideEncryptionConfiguration"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration
)
]
)
instance Data.ToPath CreateDomain where
toPath :: CreateDomain -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateDomain where
toQuery :: CreateDomain -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateDomainResponse = CreateDomainResponse'
{
CreateDomainResponse -> Maybe Domain
domain :: Prelude.Maybe Domain,
CreateDomainResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDomainResponse -> CreateDomainResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDomainResponse -> CreateDomainResponse -> Bool
$c/= :: CreateDomainResponse -> CreateDomainResponse -> Bool
== :: CreateDomainResponse -> CreateDomainResponse -> Bool
$c== :: CreateDomainResponse -> CreateDomainResponse -> Bool
Prelude.Eq, Int -> CreateDomainResponse -> ShowS
[CreateDomainResponse] -> ShowS
CreateDomainResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDomainResponse] -> ShowS
$cshowList :: [CreateDomainResponse] -> ShowS
show :: CreateDomainResponse -> String
$cshow :: CreateDomainResponse -> String
showsPrec :: Int -> CreateDomainResponse -> ShowS
$cshowsPrec :: Int -> CreateDomainResponse -> ShowS
Prelude.Show, forall x. Rep CreateDomainResponse x -> CreateDomainResponse
forall x. CreateDomainResponse -> Rep CreateDomainResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDomainResponse x -> CreateDomainResponse
$cfrom :: forall x. CreateDomainResponse -> Rep CreateDomainResponse x
Prelude.Generic)
newCreateDomainResponse ::
Prelude.Int ->
CreateDomainResponse
newCreateDomainResponse :: Int -> CreateDomainResponse
newCreateDomainResponse Int
pHttpStatus_ =
CreateDomainResponse'
{ $sel:domain:CreateDomainResponse' :: Maybe Domain
domain = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDomainResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDomainResponse_domain :: Lens.Lens' CreateDomainResponse (Prelude.Maybe Domain)
createDomainResponse_domain :: Lens' CreateDomainResponse (Maybe Domain)
createDomainResponse_domain = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainResponse' {Maybe Domain
domain :: Maybe Domain
$sel:domain:CreateDomainResponse' :: CreateDomainResponse -> Maybe Domain
domain} -> Maybe Domain
domain) (\s :: CreateDomainResponse
s@CreateDomainResponse' {} Maybe Domain
a -> CreateDomainResponse
s {$sel:domain:CreateDomainResponse' :: Maybe Domain
domain = Maybe Domain
a} :: CreateDomainResponse)
createDomainResponse_httpStatus :: Lens.Lens' CreateDomainResponse Prelude.Int
createDomainResponse_httpStatus :: Lens' CreateDomainResponse Int
createDomainResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDomainResponse' :: CreateDomainResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDomainResponse
s@CreateDomainResponse' {} Int
a -> CreateDomainResponse
s {$sel:httpStatus:CreateDomainResponse' :: Int
httpStatus = Int
a} :: CreateDomainResponse)
instance Prelude.NFData CreateDomainResponse where
rnf :: CreateDomainResponse -> ()
rnf CreateDomainResponse' {Int
Maybe Domain
httpStatus :: Int
domain :: Maybe Domain
$sel:httpStatus:CreateDomainResponse' :: CreateDomainResponse -> Int
$sel:domain:CreateDomainResponse' :: CreateDomainResponse -> Maybe Domain
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Domain
domain
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus