{-# 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.CognitoIdentityProvider.CreateUserPoolDomain
(
CreateUserPoolDomain (..),
newCreateUserPoolDomain,
createUserPoolDomain_customDomainConfig,
createUserPoolDomain_domain,
createUserPoolDomain_userPoolId,
CreateUserPoolDomainResponse (..),
newCreateUserPoolDomainResponse,
createUserPoolDomainResponse_cloudFrontDomain,
createUserPoolDomainResponse_httpStatus,
)
where
import Amazonka.CognitoIdentityProvider.Types
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
data CreateUserPoolDomain = CreateUserPoolDomain'
{
CreateUserPoolDomain -> Maybe CustomDomainConfigType
customDomainConfig :: Prelude.Maybe CustomDomainConfigType,
CreateUserPoolDomain -> Text
domain :: Prelude.Text,
CreateUserPoolDomain -> Text
userPoolId :: Prelude.Text
}
deriving (CreateUserPoolDomain -> CreateUserPoolDomain -> Bool
(CreateUserPoolDomain -> CreateUserPoolDomain -> Bool)
-> (CreateUserPoolDomain -> CreateUserPoolDomain -> Bool)
-> Eq CreateUserPoolDomain
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUserPoolDomain -> CreateUserPoolDomain -> Bool
$c/= :: CreateUserPoolDomain -> CreateUserPoolDomain -> Bool
== :: CreateUserPoolDomain -> CreateUserPoolDomain -> Bool
$c== :: CreateUserPoolDomain -> CreateUserPoolDomain -> Bool
Prelude.Eq, ReadPrec [CreateUserPoolDomain]
ReadPrec CreateUserPoolDomain
Int -> ReadS CreateUserPoolDomain
ReadS [CreateUserPoolDomain]
(Int -> ReadS CreateUserPoolDomain)
-> ReadS [CreateUserPoolDomain]
-> ReadPrec CreateUserPoolDomain
-> ReadPrec [CreateUserPoolDomain]
-> Read CreateUserPoolDomain
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUserPoolDomain]
$creadListPrec :: ReadPrec [CreateUserPoolDomain]
readPrec :: ReadPrec CreateUserPoolDomain
$creadPrec :: ReadPrec CreateUserPoolDomain
readList :: ReadS [CreateUserPoolDomain]
$creadList :: ReadS [CreateUserPoolDomain]
readsPrec :: Int -> ReadS CreateUserPoolDomain
$creadsPrec :: Int -> ReadS CreateUserPoolDomain
Prelude.Read, Int -> CreateUserPoolDomain -> ShowS
[CreateUserPoolDomain] -> ShowS
CreateUserPoolDomain -> String
(Int -> CreateUserPoolDomain -> ShowS)
-> (CreateUserPoolDomain -> String)
-> ([CreateUserPoolDomain] -> ShowS)
-> Show CreateUserPoolDomain
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUserPoolDomain] -> ShowS
$cshowList :: [CreateUserPoolDomain] -> ShowS
show :: CreateUserPoolDomain -> String
$cshow :: CreateUserPoolDomain -> String
showsPrec :: Int -> CreateUserPoolDomain -> ShowS
$cshowsPrec :: Int -> CreateUserPoolDomain -> ShowS
Prelude.Show, (forall x. CreateUserPoolDomain -> Rep CreateUserPoolDomain x)
-> (forall x. Rep CreateUserPoolDomain x -> CreateUserPoolDomain)
-> Generic CreateUserPoolDomain
forall x. Rep CreateUserPoolDomain x -> CreateUserPoolDomain
forall x. CreateUserPoolDomain -> Rep CreateUserPoolDomain x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateUserPoolDomain x -> CreateUserPoolDomain
$cfrom :: forall x. CreateUserPoolDomain -> Rep CreateUserPoolDomain x
Prelude.Generic)
newCreateUserPoolDomain ::
Prelude.Text ->
Prelude.Text ->
CreateUserPoolDomain
newCreateUserPoolDomain :: Text -> Text -> CreateUserPoolDomain
newCreateUserPoolDomain Text
pDomain_ Text
pUserPoolId_ =
CreateUserPoolDomain' :: Maybe CustomDomainConfigType
-> Text -> Text -> CreateUserPoolDomain
CreateUserPoolDomain'
{ $sel:customDomainConfig:CreateUserPoolDomain' :: Maybe CustomDomainConfigType
customDomainConfig =
Maybe CustomDomainConfigType
forall a. Maybe a
Prelude.Nothing,
$sel:domain:CreateUserPoolDomain' :: Text
domain = Text
pDomain_,
$sel:userPoolId:CreateUserPoolDomain' :: Text
userPoolId = Text
pUserPoolId_
}
createUserPoolDomain_customDomainConfig :: Lens.Lens' CreateUserPoolDomain (Prelude.Maybe CustomDomainConfigType)
createUserPoolDomain_customDomainConfig :: (Maybe CustomDomainConfigType -> f (Maybe CustomDomainConfigType))
-> CreateUserPoolDomain -> f CreateUserPoolDomain
createUserPoolDomain_customDomainConfig = (CreateUserPoolDomain -> Maybe CustomDomainConfigType)
-> (CreateUserPoolDomain
-> Maybe CustomDomainConfigType -> CreateUserPoolDomain)
-> Lens
CreateUserPoolDomain
CreateUserPoolDomain
(Maybe CustomDomainConfigType)
(Maybe CustomDomainConfigType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserPoolDomain' {Maybe CustomDomainConfigType
customDomainConfig :: Maybe CustomDomainConfigType
$sel:customDomainConfig:CreateUserPoolDomain' :: CreateUserPoolDomain -> Maybe CustomDomainConfigType
customDomainConfig} -> Maybe CustomDomainConfigType
customDomainConfig) (\s :: CreateUserPoolDomain
s@CreateUserPoolDomain' {} Maybe CustomDomainConfigType
a -> CreateUserPoolDomain
s {$sel:customDomainConfig:CreateUserPoolDomain' :: Maybe CustomDomainConfigType
customDomainConfig = Maybe CustomDomainConfigType
a} :: CreateUserPoolDomain)
createUserPoolDomain_domain :: Lens.Lens' CreateUserPoolDomain Prelude.Text
createUserPoolDomain_domain :: (Text -> f Text) -> CreateUserPoolDomain -> f CreateUserPoolDomain
createUserPoolDomain_domain = (CreateUserPoolDomain -> Text)
-> (CreateUserPoolDomain -> Text -> CreateUserPoolDomain)
-> Lens CreateUserPoolDomain CreateUserPoolDomain Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserPoolDomain' {Text
domain :: Text
$sel:domain:CreateUserPoolDomain' :: CreateUserPoolDomain -> Text
domain} -> Text
domain) (\s :: CreateUserPoolDomain
s@CreateUserPoolDomain' {} Text
a -> CreateUserPoolDomain
s {$sel:domain:CreateUserPoolDomain' :: Text
domain = Text
a} :: CreateUserPoolDomain)
createUserPoolDomain_userPoolId :: Lens.Lens' CreateUserPoolDomain Prelude.Text
createUserPoolDomain_userPoolId :: (Text -> f Text) -> CreateUserPoolDomain -> f CreateUserPoolDomain
createUserPoolDomain_userPoolId = (CreateUserPoolDomain -> Text)
-> (CreateUserPoolDomain -> Text -> CreateUserPoolDomain)
-> Lens CreateUserPoolDomain CreateUserPoolDomain Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserPoolDomain' {Text
userPoolId :: Text
$sel:userPoolId:CreateUserPoolDomain' :: CreateUserPoolDomain -> Text
userPoolId} -> Text
userPoolId) (\s :: CreateUserPoolDomain
s@CreateUserPoolDomain' {} Text
a -> CreateUserPoolDomain
s {$sel:userPoolId:CreateUserPoolDomain' :: Text
userPoolId = Text
a} :: CreateUserPoolDomain)
instance Core.AWSRequest CreateUserPoolDomain where
type
AWSResponse CreateUserPoolDomain =
CreateUserPoolDomainResponse
request :: CreateUserPoolDomain -> Request CreateUserPoolDomain
request = Service -> CreateUserPoolDomain -> Request CreateUserPoolDomain
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateUserPoolDomain
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateUserPoolDomain)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateUserPoolDomain))
-> Logger
-> Service
-> Proxy CreateUserPoolDomain
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateUserPoolDomain)))
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 -> CreateUserPoolDomainResponse
CreateUserPoolDomainResponse'
(Maybe Text -> Int -> CreateUserPoolDomainResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateUserPoolDomainResponse)
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
"CloudFrontDomain")
Either String (Int -> CreateUserPoolDomainResponse)
-> Either String Int -> Either String CreateUserPoolDomainResponse
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 CreateUserPoolDomain
instance Prelude.NFData CreateUserPoolDomain
instance Core.ToHeaders CreateUserPoolDomain where
toHeaders :: CreateUserPoolDomain -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateUserPoolDomain -> 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
"AWSCognitoIdentityProviderService.CreateUserPoolDomain" ::
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 CreateUserPoolDomain where
toJSON :: CreateUserPoolDomain -> Value
toJSON CreateUserPoolDomain' {Maybe CustomDomainConfigType
Text
userPoolId :: Text
domain :: Text
customDomainConfig :: Maybe CustomDomainConfigType
$sel:userPoolId:CreateUserPoolDomain' :: CreateUserPoolDomain -> Text
$sel:domain:CreateUserPoolDomain' :: CreateUserPoolDomain -> Text
$sel:customDomainConfig:CreateUserPoolDomain' :: CreateUserPoolDomain -> Maybe CustomDomainConfigType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CustomDomainConfig" Text -> CustomDomainConfigType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CustomDomainConfigType -> Pair)
-> Maybe CustomDomainConfigType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CustomDomainConfigType
customDomainConfig,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domain),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserPoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userPoolId)
]
)
instance Core.ToPath CreateUserPoolDomain where
toPath :: CreateUserPoolDomain -> ByteString
toPath = ByteString -> CreateUserPoolDomain -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateUserPoolDomain where
toQuery :: CreateUserPoolDomain -> QueryString
toQuery = QueryString -> CreateUserPoolDomain -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateUserPoolDomainResponse = CreateUserPoolDomainResponse'
{
CreateUserPoolDomainResponse -> Maybe Text
cloudFrontDomain :: Prelude.Maybe Prelude.Text,
CreateUserPoolDomainResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateUserPoolDomainResponse
-> CreateUserPoolDomainResponse -> Bool
(CreateUserPoolDomainResponse
-> CreateUserPoolDomainResponse -> Bool)
-> (CreateUserPoolDomainResponse
-> CreateUserPoolDomainResponse -> Bool)
-> Eq CreateUserPoolDomainResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUserPoolDomainResponse
-> CreateUserPoolDomainResponse -> Bool
$c/= :: CreateUserPoolDomainResponse
-> CreateUserPoolDomainResponse -> Bool
== :: CreateUserPoolDomainResponse
-> CreateUserPoolDomainResponse -> Bool
$c== :: CreateUserPoolDomainResponse
-> CreateUserPoolDomainResponse -> Bool
Prelude.Eq, ReadPrec [CreateUserPoolDomainResponse]
ReadPrec CreateUserPoolDomainResponse
Int -> ReadS CreateUserPoolDomainResponse
ReadS [CreateUserPoolDomainResponse]
(Int -> ReadS CreateUserPoolDomainResponse)
-> ReadS [CreateUserPoolDomainResponse]
-> ReadPrec CreateUserPoolDomainResponse
-> ReadPrec [CreateUserPoolDomainResponse]
-> Read CreateUserPoolDomainResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUserPoolDomainResponse]
$creadListPrec :: ReadPrec [CreateUserPoolDomainResponse]
readPrec :: ReadPrec CreateUserPoolDomainResponse
$creadPrec :: ReadPrec CreateUserPoolDomainResponse
readList :: ReadS [CreateUserPoolDomainResponse]
$creadList :: ReadS [CreateUserPoolDomainResponse]
readsPrec :: Int -> ReadS CreateUserPoolDomainResponse
$creadsPrec :: Int -> ReadS CreateUserPoolDomainResponse
Prelude.Read, Int -> CreateUserPoolDomainResponse -> ShowS
[CreateUserPoolDomainResponse] -> ShowS
CreateUserPoolDomainResponse -> String
(Int -> CreateUserPoolDomainResponse -> ShowS)
-> (CreateUserPoolDomainResponse -> String)
-> ([CreateUserPoolDomainResponse] -> ShowS)
-> Show CreateUserPoolDomainResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUserPoolDomainResponse] -> ShowS
$cshowList :: [CreateUserPoolDomainResponse] -> ShowS
show :: CreateUserPoolDomainResponse -> String
$cshow :: CreateUserPoolDomainResponse -> String
showsPrec :: Int -> CreateUserPoolDomainResponse -> ShowS
$cshowsPrec :: Int -> CreateUserPoolDomainResponse -> ShowS
Prelude.Show, (forall x.
CreateUserPoolDomainResponse -> Rep CreateUserPoolDomainResponse x)
-> (forall x.
Rep CreateUserPoolDomainResponse x -> CreateUserPoolDomainResponse)
-> Generic CreateUserPoolDomainResponse
forall x.
Rep CreateUserPoolDomainResponse x -> CreateUserPoolDomainResponse
forall x.
CreateUserPoolDomainResponse -> Rep CreateUserPoolDomainResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateUserPoolDomainResponse x -> CreateUserPoolDomainResponse
$cfrom :: forall x.
CreateUserPoolDomainResponse -> Rep CreateUserPoolDomainResponse x
Prelude.Generic)
newCreateUserPoolDomainResponse ::
Prelude.Int ->
CreateUserPoolDomainResponse
newCreateUserPoolDomainResponse :: Int -> CreateUserPoolDomainResponse
newCreateUserPoolDomainResponse Int
pHttpStatus_ =
CreateUserPoolDomainResponse' :: Maybe Text -> Int -> CreateUserPoolDomainResponse
CreateUserPoolDomainResponse'
{ $sel:cloudFrontDomain:CreateUserPoolDomainResponse' :: Maybe Text
cloudFrontDomain =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateUserPoolDomainResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createUserPoolDomainResponse_cloudFrontDomain :: Lens.Lens' CreateUserPoolDomainResponse (Prelude.Maybe Prelude.Text)
createUserPoolDomainResponse_cloudFrontDomain :: (Maybe Text -> f (Maybe Text))
-> CreateUserPoolDomainResponse -> f CreateUserPoolDomainResponse
createUserPoolDomainResponse_cloudFrontDomain = (CreateUserPoolDomainResponse -> Maybe Text)
-> (CreateUserPoolDomainResponse
-> Maybe Text -> CreateUserPoolDomainResponse)
-> Lens
CreateUserPoolDomainResponse
CreateUserPoolDomainResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserPoolDomainResponse' {Maybe Text
cloudFrontDomain :: Maybe Text
$sel:cloudFrontDomain:CreateUserPoolDomainResponse' :: CreateUserPoolDomainResponse -> Maybe Text
cloudFrontDomain} -> Maybe Text
cloudFrontDomain) (\s :: CreateUserPoolDomainResponse
s@CreateUserPoolDomainResponse' {} Maybe Text
a -> CreateUserPoolDomainResponse
s {$sel:cloudFrontDomain:CreateUserPoolDomainResponse' :: Maybe Text
cloudFrontDomain = Maybe Text
a} :: CreateUserPoolDomainResponse)
createUserPoolDomainResponse_httpStatus :: Lens.Lens' CreateUserPoolDomainResponse Prelude.Int
createUserPoolDomainResponse_httpStatus :: (Int -> f Int)
-> CreateUserPoolDomainResponse -> f CreateUserPoolDomainResponse
createUserPoolDomainResponse_httpStatus = (CreateUserPoolDomainResponse -> Int)
-> (CreateUserPoolDomainResponse
-> Int -> CreateUserPoolDomainResponse)
-> Lens
CreateUserPoolDomainResponse CreateUserPoolDomainResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserPoolDomainResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateUserPoolDomainResponse' :: CreateUserPoolDomainResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateUserPoolDomainResponse
s@CreateUserPoolDomainResponse' {} Int
a -> CreateUserPoolDomainResponse
s {$sel:httpStatus:CreateUserPoolDomainResponse' :: Int
httpStatus = Int
a} :: CreateUserPoolDomainResponse)
instance Prelude.NFData CreateUserPoolDomainResponse