{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoT.CreateDomainConfiguration
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a domain configuration.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions CreateDomainConfiguration>
-- action.
module Amazonka.IoT.CreateDomainConfiguration
  ( -- * Creating a Request
    CreateDomainConfiguration (..),
    newCreateDomainConfiguration,

    -- * Request Lenses
    createDomainConfiguration_authorizerConfig,
    createDomainConfiguration_serverCertificateArns,
    createDomainConfiguration_domainName,
    createDomainConfiguration_serviceType,
    createDomainConfiguration_validationCertificateArn,
    createDomainConfiguration_tags,
    createDomainConfiguration_domainConfigurationName,

    -- * Destructuring the Response
    CreateDomainConfigurationResponse (..),
    newCreateDomainConfigurationResponse,

    -- * Response Lenses
    createDomainConfigurationResponse_domainConfigurationName,
    createDomainConfigurationResponse_domainConfigurationArn,
    createDomainConfigurationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateDomainConfiguration' smart constructor.
data CreateDomainConfiguration = CreateDomainConfiguration'
  { -- | An object that specifies the authorization service for a domain.
    CreateDomainConfiguration -> Maybe AuthorizerConfig
authorizerConfig :: Prelude.Maybe AuthorizerConfig,
    -- | The ARNs of the certificates that IoT passes to the device during the
    -- TLS handshake. Currently you can specify only one certificate ARN. This
    -- value is not required for Amazon Web Services-managed domains.
    CreateDomainConfiguration -> Maybe [Text]
serverCertificateArns :: Prelude.Maybe [Prelude.Text],
    -- | The name of the domain.
    CreateDomainConfiguration -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text,
    -- | The type of service delivered by the endpoint.
    --
    -- Amazon Web Services IoT Core currently supports only the @DATA@ service
    -- type.
    CreateDomainConfiguration -> Maybe ServiceType
serviceType :: Prelude.Maybe ServiceType,
    -- | The certificate used to validate the server certificate and prove domain
    -- name ownership. This certificate must be signed by a public certificate
    -- authority. This value is not required for Amazon Web Services-managed
    -- domains.
    CreateDomainConfiguration -> Maybe Text
validationCertificateArn :: Prelude.Maybe Prelude.Text,
    -- | Metadata which can be used to manage the domain configuration.
    --
    -- For URI Request parameters use format: ...key1=value1&key2=value2...
    --
    -- For the CLI command-line parameter use format: &&tags
    -- \"key1=value1&key2=value2...\"
    --
    -- For the cli-input-json file use format: \"tags\":
    -- \"key1=value1&key2=value2...\"
    CreateDomainConfiguration -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the domain configuration. This value must be unique to a
    -- region.
    CreateDomainConfiguration -> Text
domainConfigurationName :: Prelude.Text
  }
  deriving (CreateDomainConfiguration -> CreateDomainConfiguration -> Bool
(CreateDomainConfiguration -> CreateDomainConfiguration -> Bool)
-> (CreateDomainConfiguration -> CreateDomainConfiguration -> Bool)
-> Eq CreateDomainConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDomainConfiguration -> CreateDomainConfiguration -> Bool
$c/= :: CreateDomainConfiguration -> CreateDomainConfiguration -> Bool
== :: CreateDomainConfiguration -> CreateDomainConfiguration -> Bool
$c== :: CreateDomainConfiguration -> CreateDomainConfiguration -> Bool
Prelude.Eq, ReadPrec [CreateDomainConfiguration]
ReadPrec CreateDomainConfiguration
Int -> ReadS CreateDomainConfiguration
ReadS [CreateDomainConfiguration]
(Int -> ReadS CreateDomainConfiguration)
-> ReadS [CreateDomainConfiguration]
-> ReadPrec CreateDomainConfiguration
-> ReadPrec [CreateDomainConfiguration]
-> Read CreateDomainConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDomainConfiguration]
$creadListPrec :: ReadPrec [CreateDomainConfiguration]
readPrec :: ReadPrec CreateDomainConfiguration
$creadPrec :: ReadPrec CreateDomainConfiguration
readList :: ReadS [CreateDomainConfiguration]
$creadList :: ReadS [CreateDomainConfiguration]
readsPrec :: Int -> ReadS CreateDomainConfiguration
$creadsPrec :: Int -> ReadS CreateDomainConfiguration
Prelude.Read, Int -> CreateDomainConfiguration -> ShowS
[CreateDomainConfiguration] -> ShowS
CreateDomainConfiguration -> String
(Int -> CreateDomainConfiguration -> ShowS)
-> (CreateDomainConfiguration -> String)
-> ([CreateDomainConfiguration] -> ShowS)
-> Show CreateDomainConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDomainConfiguration] -> ShowS
$cshowList :: [CreateDomainConfiguration] -> ShowS
show :: CreateDomainConfiguration -> String
$cshow :: CreateDomainConfiguration -> String
showsPrec :: Int -> CreateDomainConfiguration -> ShowS
$cshowsPrec :: Int -> CreateDomainConfiguration -> ShowS
Prelude.Show, (forall x.
 CreateDomainConfiguration -> Rep CreateDomainConfiguration x)
-> (forall x.
    Rep CreateDomainConfiguration x -> CreateDomainConfiguration)
-> Generic CreateDomainConfiguration
forall x.
Rep CreateDomainConfiguration x -> CreateDomainConfiguration
forall x.
CreateDomainConfiguration -> Rep CreateDomainConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDomainConfiguration x -> CreateDomainConfiguration
$cfrom :: forall x.
CreateDomainConfiguration -> Rep CreateDomainConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CreateDomainConfiguration' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'authorizerConfig', 'createDomainConfiguration_authorizerConfig' - An object that specifies the authorization service for a domain.
--
-- 'serverCertificateArns', 'createDomainConfiguration_serverCertificateArns' - The ARNs of the certificates that IoT passes to the device during the
-- TLS handshake. Currently you can specify only one certificate ARN. This
-- value is not required for Amazon Web Services-managed domains.
--
-- 'domainName', 'createDomainConfiguration_domainName' - The name of the domain.
--
-- 'serviceType', 'createDomainConfiguration_serviceType' - The type of service delivered by the endpoint.
--
-- Amazon Web Services IoT Core currently supports only the @DATA@ service
-- type.
--
-- 'validationCertificateArn', 'createDomainConfiguration_validationCertificateArn' - The certificate used to validate the server certificate and prove domain
-- name ownership. This certificate must be signed by a public certificate
-- authority. This value is not required for Amazon Web Services-managed
-- domains.
--
-- 'tags', 'createDomainConfiguration_tags' - Metadata which can be used to manage the domain configuration.
--
-- For URI Request parameters use format: ...key1=value1&key2=value2...
--
-- For the CLI command-line parameter use format: &&tags
-- \"key1=value1&key2=value2...\"
--
-- For the cli-input-json file use format: \"tags\":
-- \"key1=value1&key2=value2...\"
--
-- 'domainConfigurationName', 'createDomainConfiguration_domainConfigurationName' - The name of the domain configuration. This value must be unique to a
-- region.
newCreateDomainConfiguration ::
  -- | 'domainConfigurationName'
  Prelude.Text ->
  CreateDomainConfiguration
newCreateDomainConfiguration :: Text -> CreateDomainConfiguration
newCreateDomainConfiguration
  Text
pDomainConfigurationName_ =
    CreateDomainConfiguration' :: Maybe AuthorizerConfig
-> Maybe [Text]
-> Maybe Text
-> Maybe ServiceType
-> Maybe Text
-> Maybe [Tag]
-> Text
-> CreateDomainConfiguration
CreateDomainConfiguration'
      { $sel:authorizerConfig:CreateDomainConfiguration' :: Maybe AuthorizerConfig
authorizerConfig =
          Maybe AuthorizerConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:serverCertificateArns:CreateDomainConfiguration' :: Maybe [Text]
serverCertificateArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:domainName:CreateDomainConfiguration' :: Maybe Text
domainName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:serviceType:CreateDomainConfiguration' :: Maybe ServiceType
serviceType = Maybe ServiceType
forall a. Maybe a
Prelude.Nothing,
        $sel:validationCertificateArn:CreateDomainConfiguration' :: Maybe Text
validationCertificateArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateDomainConfiguration' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:domainConfigurationName:CreateDomainConfiguration' :: Text
domainConfigurationName =
          Text
pDomainConfigurationName_
      }

-- | An object that specifies the authorization service for a domain.
createDomainConfiguration_authorizerConfig :: Lens.Lens' CreateDomainConfiguration (Prelude.Maybe AuthorizerConfig)
createDomainConfiguration_authorizerConfig :: (Maybe AuthorizerConfig -> f (Maybe AuthorizerConfig))
-> CreateDomainConfiguration -> f CreateDomainConfiguration
createDomainConfiguration_authorizerConfig = (CreateDomainConfiguration -> Maybe AuthorizerConfig)
-> (CreateDomainConfiguration
    -> Maybe AuthorizerConfig -> CreateDomainConfiguration)
-> Lens
     CreateDomainConfiguration
     CreateDomainConfiguration
     (Maybe AuthorizerConfig)
     (Maybe AuthorizerConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainConfiguration' {Maybe AuthorizerConfig
authorizerConfig :: Maybe AuthorizerConfig
$sel:authorizerConfig:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe AuthorizerConfig
authorizerConfig} -> Maybe AuthorizerConfig
authorizerConfig) (\s :: CreateDomainConfiguration
s@CreateDomainConfiguration' {} Maybe AuthorizerConfig
a -> CreateDomainConfiguration
s {$sel:authorizerConfig:CreateDomainConfiguration' :: Maybe AuthorizerConfig
authorizerConfig = Maybe AuthorizerConfig
a} :: CreateDomainConfiguration)

-- | The ARNs of the certificates that IoT passes to the device during the
-- TLS handshake. Currently you can specify only one certificate ARN. This
-- value is not required for Amazon Web Services-managed domains.
createDomainConfiguration_serverCertificateArns :: Lens.Lens' CreateDomainConfiguration (Prelude.Maybe [Prelude.Text])
createDomainConfiguration_serverCertificateArns :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateDomainConfiguration -> f CreateDomainConfiguration
createDomainConfiguration_serverCertificateArns = (CreateDomainConfiguration -> Maybe [Text])
-> (CreateDomainConfiguration
    -> Maybe [Text] -> CreateDomainConfiguration)
-> Lens
     CreateDomainConfiguration
     CreateDomainConfiguration
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainConfiguration' {Maybe [Text]
serverCertificateArns :: Maybe [Text]
$sel:serverCertificateArns:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe [Text]
serverCertificateArns} -> Maybe [Text]
serverCertificateArns) (\s :: CreateDomainConfiguration
s@CreateDomainConfiguration' {} Maybe [Text]
a -> CreateDomainConfiguration
s {$sel:serverCertificateArns:CreateDomainConfiguration' :: Maybe [Text]
serverCertificateArns = Maybe [Text]
a} :: CreateDomainConfiguration) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateDomainConfiguration -> f CreateDomainConfiguration)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateDomainConfiguration
-> f CreateDomainConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the domain.
createDomainConfiguration_domainName :: Lens.Lens' CreateDomainConfiguration (Prelude.Maybe Prelude.Text)
createDomainConfiguration_domainName :: (Maybe Text -> f (Maybe Text))
-> CreateDomainConfiguration -> f CreateDomainConfiguration
createDomainConfiguration_domainName = (CreateDomainConfiguration -> Maybe Text)
-> (CreateDomainConfiguration
    -> Maybe Text -> CreateDomainConfiguration)
-> Lens
     CreateDomainConfiguration
     CreateDomainConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainConfiguration' {Maybe Text
domainName :: Maybe Text
$sel:domainName:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe Text
domainName} -> Maybe Text
domainName) (\s :: CreateDomainConfiguration
s@CreateDomainConfiguration' {} Maybe Text
a -> CreateDomainConfiguration
s {$sel:domainName:CreateDomainConfiguration' :: Maybe Text
domainName = Maybe Text
a} :: CreateDomainConfiguration)

-- | The type of service delivered by the endpoint.
--
-- Amazon Web Services IoT Core currently supports only the @DATA@ service
-- type.
createDomainConfiguration_serviceType :: Lens.Lens' CreateDomainConfiguration (Prelude.Maybe ServiceType)
createDomainConfiguration_serviceType :: (Maybe ServiceType -> f (Maybe ServiceType))
-> CreateDomainConfiguration -> f CreateDomainConfiguration
createDomainConfiguration_serviceType = (CreateDomainConfiguration -> Maybe ServiceType)
-> (CreateDomainConfiguration
    -> Maybe ServiceType -> CreateDomainConfiguration)
-> Lens
     CreateDomainConfiguration
     CreateDomainConfiguration
     (Maybe ServiceType)
     (Maybe ServiceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainConfiguration' {Maybe ServiceType
serviceType :: Maybe ServiceType
$sel:serviceType:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe ServiceType
serviceType} -> Maybe ServiceType
serviceType) (\s :: CreateDomainConfiguration
s@CreateDomainConfiguration' {} Maybe ServiceType
a -> CreateDomainConfiguration
s {$sel:serviceType:CreateDomainConfiguration' :: Maybe ServiceType
serviceType = Maybe ServiceType
a} :: CreateDomainConfiguration)

-- | The certificate used to validate the server certificate and prove domain
-- name ownership. This certificate must be signed by a public certificate
-- authority. This value is not required for Amazon Web Services-managed
-- domains.
createDomainConfiguration_validationCertificateArn :: Lens.Lens' CreateDomainConfiguration (Prelude.Maybe Prelude.Text)
createDomainConfiguration_validationCertificateArn :: (Maybe Text -> f (Maybe Text))
-> CreateDomainConfiguration -> f CreateDomainConfiguration
createDomainConfiguration_validationCertificateArn = (CreateDomainConfiguration -> Maybe Text)
-> (CreateDomainConfiguration
    -> Maybe Text -> CreateDomainConfiguration)
-> Lens
     CreateDomainConfiguration
     CreateDomainConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainConfiguration' {Maybe Text
validationCertificateArn :: Maybe Text
$sel:validationCertificateArn:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe Text
validationCertificateArn} -> Maybe Text
validationCertificateArn) (\s :: CreateDomainConfiguration
s@CreateDomainConfiguration' {} Maybe Text
a -> CreateDomainConfiguration
s {$sel:validationCertificateArn:CreateDomainConfiguration' :: Maybe Text
validationCertificateArn = Maybe Text
a} :: CreateDomainConfiguration)

-- | Metadata which can be used to manage the domain configuration.
--
-- For URI Request parameters use format: ...key1=value1&key2=value2...
--
-- For the CLI command-line parameter use format: &&tags
-- \"key1=value1&key2=value2...\"
--
-- For the cli-input-json file use format: \"tags\":
-- \"key1=value1&key2=value2...\"
createDomainConfiguration_tags :: Lens.Lens' CreateDomainConfiguration (Prelude.Maybe [Tag])
createDomainConfiguration_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDomainConfiguration -> f CreateDomainConfiguration
createDomainConfiguration_tags = (CreateDomainConfiguration -> Maybe [Tag])
-> (CreateDomainConfiguration
    -> Maybe [Tag] -> CreateDomainConfiguration)
-> Lens
     CreateDomainConfiguration
     CreateDomainConfiguration
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainConfiguration' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDomainConfiguration
s@CreateDomainConfiguration' {} Maybe [Tag]
a -> CreateDomainConfiguration
s {$sel:tags:CreateDomainConfiguration' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDomainConfiguration) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateDomainConfiguration -> f CreateDomainConfiguration)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDomainConfiguration
-> f CreateDomainConfiguration
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

-- | The name of the domain configuration. This value must be unique to a
-- region.
createDomainConfiguration_domainConfigurationName :: Lens.Lens' CreateDomainConfiguration Prelude.Text
createDomainConfiguration_domainConfigurationName :: (Text -> f Text)
-> CreateDomainConfiguration -> f CreateDomainConfiguration
createDomainConfiguration_domainConfigurationName = (CreateDomainConfiguration -> Text)
-> (CreateDomainConfiguration -> Text -> CreateDomainConfiguration)
-> Lens
     CreateDomainConfiguration CreateDomainConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainConfiguration' {Text
domainConfigurationName :: Text
$sel:domainConfigurationName:CreateDomainConfiguration' :: CreateDomainConfiguration -> Text
domainConfigurationName} -> Text
domainConfigurationName) (\s :: CreateDomainConfiguration
s@CreateDomainConfiguration' {} Text
a -> CreateDomainConfiguration
s {$sel:domainConfigurationName:CreateDomainConfiguration' :: Text
domainConfigurationName = Text
a} :: CreateDomainConfiguration)

instance Core.AWSRequest CreateDomainConfiguration where
  type
    AWSResponse CreateDomainConfiguration =
      CreateDomainConfigurationResponse
  request :: CreateDomainConfiguration -> Request CreateDomainConfiguration
request = Service
-> CreateDomainConfiguration -> Request CreateDomainConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDomainConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDomainConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateDomainConfiguration))
-> Logger
-> Service
-> Proxy CreateDomainConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDomainConfiguration)))
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 -> CreateDomainConfigurationResponse
CreateDomainConfigurationResponse'
            (Maybe Text
 -> Maybe Text -> Int -> CreateDomainConfigurationResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> CreateDomainConfigurationResponse)
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
"domainConfigurationName")
            Either
  String (Maybe Text -> Int -> CreateDomainConfigurationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateDomainConfigurationResponse)
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
"domainConfigurationArn")
            Either String (Int -> CreateDomainConfigurationResponse)
-> Either String Int
-> Either String CreateDomainConfigurationResponse
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 CreateDomainConfiguration

instance Prelude.NFData CreateDomainConfiguration

instance Core.ToHeaders CreateDomainConfiguration where
  toHeaders :: CreateDomainConfiguration -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateDomainConfiguration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreateDomainConfiguration where
  toJSON :: CreateDomainConfiguration -> Value
toJSON CreateDomainConfiguration' {Maybe [Text]
Maybe [Tag]
Maybe Text
Maybe AuthorizerConfig
Maybe ServiceType
Text
domainConfigurationName :: Text
tags :: Maybe [Tag]
validationCertificateArn :: Maybe Text
serviceType :: Maybe ServiceType
domainName :: Maybe Text
serverCertificateArns :: Maybe [Text]
authorizerConfig :: Maybe AuthorizerConfig
$sel:domainConfigurationName:CreateDomainConfiguration' :: CreateDomainConfiguration -> Text
$sel:tags:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe [Tag]
$sel:validationCertificateArn:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe Text
$sel:serviceType:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe ServiceType
$sel:domainName:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe Text
$sel:serverCertificateArns:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe [Text]
$sel:authorizerConfig:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe AuthorizerConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"authorizerConfig" Text -> AuthorizerConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AuthorizerConfig -> Pair) -> Maybe AuthorizerConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AuthorizerConfig
authorizerConfig,
            (Text
"serverCertificateArns" 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]
serverCertificateArns,
            (Text
"domainName" 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
domainName,
            (Text
"serviceType" Text -> ServiceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ServiceType -> Pair) -> Maybe ServiceType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ServiceType
serviceType,
            (Text
"validationCertificateArn" 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
validationCertificateArn,
            (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
          ]
      )

instance Core.ToPath CreateDomainConfiguration where
  toPath :: CreateDomainConfiguration -> ByteString
toPath CreateDomainConfiguration' {Maybe [Text]
Maybe [Tag]
Maybe Text
Maybe AuthorizerConfig
Maybe ServiceType
Text
domainConfigurationName :: Text
tags :: Maybe [Tag]
validationCertificateArn :: Maybe Text
serviceType :: Maybe ServiceType
domainName :: Maybe Text
serverCertificateArns :: Maybe [Text]
authorizerConfig :: Maybe AuthorizerConfig
$sel:domainConfigurationName:CreateDomainConfiguration' :: CreateDomainConfiguration -> Text
$sel:tags:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe [Tag]
$sel:validationCertificateArn:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe Text
$sel:serviceType:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe ServiceType
$sel:domainName:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe Text
$sel:serverCertificateArns:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe [Text]
$sel:authorizerConfig:CreateDomainConfiguration' :: CreateDomainConfiguration -> Maybe AuthorizerConfig
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/domainConfigurations/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
domainConfigurationName
      ]

instance Core.ToQuery CreateDomainConfiguration where
  toQuery :: CreateDomainConfiguration -> QueryString
toQuery = QueryString -> CreateDomainConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateDomainConfigurationResponse' smart constructor.
data CreateDomainConfigurationResponse = CreateDomainConfigurationResponse'
  { -- | The name of the domain configuration.
    CreateDomainConfigurationResponse -> Maybe Text
domainConfigurationName :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the domain configuration.
    CreateDomainConfigurationResponse -> Maybe Text
domainConfigurationArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateDomainConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDomainConfigurationResponse
-> CreateDomainConfigurationResponse -> Bool
(CreateDomainConfigurationResponse
 -> CreateDomainConfigurationResponse -> Bool)
-> (CreateDomainConfigurationResponse
    -> CreateDomainConfigurationResponse -> Bool)
-> Eq CreateDomainConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDomainConfigurationResponse
-> CreateDomainConfigurationResponse -> Bool
$c/= :: CreateDomainConfigurationResponse
-> CreateDomainConfigurationResponse -> Bool
== :: CreateDomainConfigurationResponse
-> CreateDomainConfigurationResponse -> Bool
$c== :: CreateDomainConfigurationResponse
-> CreateDomainConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [CreateDomainConfigurationResponse]
ReadPrec CreateDomainConfigurationResponse
Int -> ReadS CreateDomainConfigurationResponse
ReadS [CreateDomainConfigurationResponse]
(Int -> ReadS CreateDomainConfigurationResponse)
-> ReadS [CreateDomainConfigurationResponse]
-> ReadPrec CreateDomainConfigurationResponse
-> ReadPrec [CreateDomainConfigurationResponse]
-> Read CreateDomainConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDomainConfigurationResponse]
$creadListPrec :: ReadPrec [CreateDomainConfigurationResponse]
readPrec :: ReadPrec CreateDomainConfigurationResponse
$creadPrec :: ReadPrec CreateDomainConfigurationResponse
readList :: ReadS [CreateDomainConfigurationResponse]
$creadList :: ReadS [CreateDomainConfigurationResponse]
readsPrec :: Int -> ReadS CreateDomainConfigurationResponse
$creadsPrec :: Int -> ReadS CreateDomainConfigurationResponse
Prelude.Read, Int -> CreateDomainConfigurationResponse -> ShowS
[CreateDomainConfigurationResponse] -> ShowS
CreateDomainConfigurationResponse -> String
(Int -> CreateDomainConfigurationResponse -> ShowS)
-> (CreateDomainConfigurationResponse -> String)
-> ([CreateDomainConfigurationResponse] -> ShowS)
-> Show CreateDomainConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDomainConfigurationResponse] -> ShowS
$cshowList :: [CreateDomainConfigurationResponse] -> ShowS
show :: CreateDomainConfigurationResponse -> String
$cshow :: CreateDomainConfigurationResponse -> String
showsPrec :: Int -> CreateDomainConfigurationResponse -> ShowS
$cshowsPrec :: Int -> CreateDomainConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 CreateDomainConfigurationResponse
 -> Rep CreateDomainConfigurationResponse x)
-> (forall x.
    Rep CreateDomainConfigurationResponse x
    -> CreateDomainConfigurationResponse)
-> Generic CreateDomainConfigurationResponse
forall x.
Rep CreateDomainConfigurationResponse x
-> CreateDomainConfigurationResponse
forall x.
CreateDomainConfigurationResponse
-> Rep CreateDomainConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDomainConfigurationResponse x
-> CreateDomainConfigurationResponse
$cfrom :: forall x.
CreateDomainConfigurationResponse
-> Rep CreateDomainConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDomainConfigurationResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'domainConfigurationName', 'createDomainConfigurationResponse_domainConfigurationName' - The name of the domain configuration.
--
-- 'domainConfigurationArn', 'createDomainConfigurationResponse_domainConfigurationArn' - The ARN of the domain configuration.
--
-- 'httpStatus', 'createDomainConfigurationResponse_httpStatus' - The response's http status code.
newCreateDomainConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDomainConfigurationResponse
newCreateDomainConfigurationResponse :: Int -> CreateDomainConfigurationResponse
newCreateDomainConfigurationResponse Int
pHttpStatus_ =
  CreateDomainConfigurationResponse' :: Maybe Text
-> Maybe Text -> Int -> CreateDomainConfigurationResponse
CreateDomainConfigurationResponse'
    { $sel:domainConfigurationName:CreateDomainConfigurationResponse' :: Maybe Text
domainConfigurationName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domainConfigurationArn:CreateDomainConfigurationResponse' :: Maybe Text
domainConfigurationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDomainConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The name of the domain configuration.
createDomainConfigurationResponse_domainConfigurationName :: Lens.Lens' CreateDomainConfigurationResponse (Prelude.Maybe Prelude.Text)
createDomainConfigurationResponse_domainConfigurationName :: (Maybe Text -> f (Maybe Text))
-> CreateDomainConfigurationResponse
-> f CreateDomainConfigurationResponse
createDomainConfigurationResponse_domainConfigurationName = (CreateDomainConfigurationResponse -> Maybe Text)
-> (CreateDomainConfigurationResponse
    -> Maybe Text -> CreateDomainConfigurationResponse)
-> Lens
     CreateDomainConfigurationResponse
     CreateDomainConfigurationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainConfigurationResponse' {Maybe Text
domainConfigurationName :: Maybe Text
$sel:domainConfigurationName:CreateDomainConfigurationResponse' :: CreateDomainConfigurationResponse -> Maybe Text
domainConfigurationName} -> Maybe Text
domainConfigurationName) (\s :: CreateDomainConfigurationResponse
s@CreateDomainConfigurationResponse' {} Maybe Text
a -> CreateDomainConfigurationResponse
s {$sel:domainConfigurationName:CreateDomainConfigurationResponse' :: Maybe Text
domainConfigurationName = Maybe Text
a} :: CreateDomainConfigurationResponse)

-- | The ARN of the domain configuration.
createDomainConfigurationResponse_domainConfigurationArn :: Lens.Lens' CreateDomainConfigurationResponse (Prelude.Maybe Prelude.Text)
createDomainConfigurationResponse_domainConfigurationArn :: (Maybe Text -> f (Maybe Text))
-> CreateDomainConfigurationResponse
-> f CreateDomainConfigurationResponse
createDomainConfigurationResponse_domainConfigurationArn = (CreateDomainConfigurationResponse -> Maybe Text)
-> (CreateDomainConfigurationResponse
    -> Maybe Text -> CreateDomainConfigurationResponse)
-> Lens
     CreateDomainConfigurationResponse
     CreateDomainConfigurationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainConfigurationResponse' {Maybe Text
domainConfigurationArn :: Maybe Text
$sel:domainConfigurationArn:CreateDomainConfigurationResponse' :: CreateDomainConfigurationResponse -> Maybe Text
domainConfigurationArn} -> Maybe Text
domainConfigurationArn) (\s :: CreateDomainConfigurationResponse
s@CreateDomainConfigurationResponse' {} Maybe Text
a -> CreateDomainConfigurationResponse
s {$sel:domainConfigurationArn:CreateDomainConfigurationResponse' :: Maybe Text
domainConfigurationArn = Maybe Text
a} :: CreateDomainConfigurationResponse)

-- | The response's http status code.
createDomainConfigurationResponse_httpStatus :: Lens.Lens' CreateDomainConfigurationResponse Prelude.Int
createDomainConfigurationResponse_httpStatus :: (Int -> f Int)
-> CreateDomainConfigurationResponse
-> f CreateDomainConfigurationResponse
createDomainConfigurationResponse_httpStatus = (CreateDomainConfigurationResponse -> Int)
-> (CreateDomainConfigurationResponse
    -> Int -> CreateDomainConfigurationResponse)
-> Lens
     CreateDomainConfigurationResponse
     CreateDomainConfigurationResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDomainConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDomainConfigurationResponse' :: CreateDomainConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDomainConfigurationResponse
s@CreateDomainConfigurationResponse' {} Int
a -> CreateDomainConfigurationResponse
s {$sel:httpStatus:CreateDomainConfigurationResponse' :: Int
httpStatus = Int
a} :: CreateDomainConfigurationResponse)

instance
  Prelude.NFData
    CreateDomainConfigurationResponse