{-# 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.Lens as Lens
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 (Core.Sensitive Prelude.Text),
CreateDomain -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateDomain -> Sensitive Text
name :: Core.Sensitive Prelude.Text,
CreateDomain -> ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration :: ServerSideEncryptionConfiguration
}
deriving (CreateDomain -> CreateDomain -> Bool
(CreateDomain -> CreateDomain -> Bool)
-> (CreateDomain -> CreateDomain -> Bool) -> Eq CreateDomain
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
(Int -> CreateDomain -> ShowS)
-> (CreateDomain -> String)
-> ([CreateDomain] -> ShowS)
-> Show CreateDomain
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. CreateDomain -> Rep CreateDomain x)
-> (forall x. Rep CreateDomain x -> CreateDomain)
-> Generic CreateDomain
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' :: Maybe Text
-> Maybe (Sensitive Text)
-> Maybe [Tag]
-> Sensitive Text
-> ServerSideEncryptionConfiguration
-> CreateDomain
CreateDomain'
{ $sel:clientToken:CreateDomain' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateDomain' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateDomain' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateDomain' :: Sensitive Text
name = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
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 :: (Maybe Text -> f (Maybe Text)) -> CreateDomain -> f CreateDomain
createDomain_clientToken = (CreateDomain -> Maybe Text)
-> (CreateDomain -> Maybe Text -> CreateDomain)
-> Lens CreateDomain CreateDomain (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> CreateDomain -> f CreateDomain
createDomain_description = (CreateDomain -> Maybe (Sensitive Text))
-> (CreateDomain -> Maybe (Sensitive Text) -> CreateDomain)
-> Lens
CreateDomain
CreateDomain
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
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) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> CreateDomain -> f CreateDomain)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateDomain
-> f CreateDomain
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
createDomain_tags :: Lens.Lens' CreateDomain (Prelude.Maybe [Tag])
createDomain_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateDomain -> f CreateDomain
createDomain_tags = (CreateDomain -> Maybe [Tag])
-> (CreateDomain -> Maybe [Tag] -> CreateDomain)
-> Lens CreateDomain CreateDomain (Maybe [Tag]) (Maybe [Tag])
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) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDomain -> f CreateDomain)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDomain
-> f CreateDomain
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
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 :: (Text -> f Text) -> CreateDomain -> f CreateDomain
createDomain_name = (CreateDomain -> Sensitive Text)
-> (CreateDomain -> Sensitive Text -> CreateDomain)
-> Lens CreateDomain CreateDomain (Sensitive Text) (Sensitive Text)
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) ((Sensitive Text -> f (Sensitive Text))
-> CreateDomain -> f CreateDomain)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateDomain
-> f CreateDomain
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
createDomain_serverSideEncryptionConfiguration :: Lens.Lens' CreateDomain ServerSideEncryptionConfiguration
createDomain_serverSideEncryptionConfiguration :: (ServerSideEncryptionConfiguration
-> f ServerSideEncryptionConfiguration)
-> CreateDomain -> f CreateDomain
createDomain_serverSideEncryptionConfiguration = (CreateDomain -> ServerSideEncryptionConfiguration)
-> (CreateDomain
-> ServerSideEncryptionConfiguration -> CreateDomain)
-> Lens
CreateDomain
CreateDomain
ServerSideEncryptionConfiguration
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 :: CreateDomain -> Request CreateDomain
request = Service -> CreateDomain -> Request CreateDomain
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDomain
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDomain)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateDomain))
-> Logger
-> Service
-> Proxy CreateDomain
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDomain)))
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 Domain -> Int -> CreateDomainResponse
CreateDomainResponse'
(Maybe Domain -> Int -> CreateDomainResponse)
-> Either String (Maybe Domain)
-> Either String (Int -> CreateDomainResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Domain)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Domain")
Either String (Int -> CreateDomainResponse)
-> Either String Int -> Either String CreateDomainResponse
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 CreateDomain
instance Prelude.NFData CreateDomain
instance Core.ToHeaders CreateDomain where
toHeaders :: CreateDomain -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDomain -> 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
"VoiceID.CreateDomain" :: Prelude.ByteString),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.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
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,
(Text
"Description" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
description,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"ServerSideEncryptionConfiguration"
Text -> ServerSideEncryptionConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ServerSideEncryptionConfiguration
serverSideEncryptionConfiguration
)
]
)
instance Core.ToPath CreateDomain where
toPath :: CreateDomain -> ByteString
toPath = ByteString -> CreateDomain -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDomain where
toQuery :: CreateDomain -> QueryString
toQuery = QueryString -> CreateDomain -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(CreateDomainResponse -> CreateDomainResponse -> Bool)
-> (CreateDomainResponse -> CreateDomainResponse -> Bool)
-> Eq CreateDomainResponse
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
(Int -> CreateDomainResponse -> ShowS)
-> (CreateDomainResponse -> String)
-> ([CreateDomainResponse] -> ShowS)
-> Show CreateDomainResponse
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. CreateDomainResponse -> Rep CreateDomainResponse x)
-> (forall x. Rep CreateDomainResponse x -> CreateDomainResponse)
-> Generic CreateDomainResponse
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' :: Maybe Domain -> Int -> CreateDomainResponse
CreateDomainResponse'
{ $sel:domain:CreateDomainResponse' :: Maybe Domain
domain = Maybe Domain
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDomainResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDomainResponse_domain :: Lens.Lens' CreateDomainResponse (Prelude.Maybe Domain)
createDomainResponse_domain :: (Maybe Domain -> f (Maybe Domain))
-> CreateDomainResponse -> f CreateDomainResponse
createDomainResponse_domain = (CreateDomainResponse -> Maybe Domain)
-> (CreateDomainResponse -> Maybe Domain -> CreateDomainResponse)
-> Lens
CreateDomainResponse
CreateDomainResponse
(Maybe Domain)
(Maybe 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 :: (Int -> f Int) -> CreateDomainResponse -> f CreateDomainResponse
createDomainResponse_httpStatus = (CreateDomainResponse -> Int)
-> (CreateDomainResponse -> Int -> CreateDomainResponse)
-> Lens CreateDomainResponse CreateDomainResponse Int Int
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