{-# 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.DocDbElastic.CreateCluster
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new Elastic DocumentDB cluster and returns its Cluster
-- structure.
module Amazonka.DocDbElastic.CreateCluster
  ( -- * Creating a Request
    CreateCluster (..),
    newCreateCluster,

    -- * Request Lenses
    createCluster_clientToken,
    createCluster_kmsKeyId,
    createCluster_preferredMaintenanceWindow,
    createCluster_subnetIds,
    createCluster_tags,
    createCluster_vpcSecurityGroupIds,
    createCluster_adminUserName,
    createCluster_adminUserPassword,
    createCluster_authType,
    createCluster_clusterName,
    createCluster_shardCapacity,
    createCluster_shardCount,

    -- * Destructuring the Response
    CreateClusterResponse (..),
    newCreateClusterResponse,

    -- * Response Lenses
    createClusterResponse_httpStatus,
    createClusterResponse_cluster,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DocDbElastic.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateCluster' smart constructor.
data CreateCluster = CreateCluster'
  { -- | The client token for the Elastic DocumentDB cluster.
    CreateCluster -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The KMS key identifier to use to encrypt the new Elastic DocumentDB
    -- cluster.
    --
    -- The KMS key identifier is the Amazon Resource Name (ARN) for the KMS
    -- encryption key. If you are creating a cluster using the same Amazon
    -- account that owns this KMS encryption key, you can use the KMS key alias
    -- instead of the ARN as the KMS encryption key.
    --
    -- If an encryption key is not specified, Elastic DocumentDB uses the
    -- default encryption key that KMS creates for your account. Your account
    -- has a different default encryption key for each Amazon Region.
    CreateCluster -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The weekly time range during which system maintenance can occur, in
    -- Universal Coordinated Time (UTC).
    --
    -- /Format/: @ddd:hh24:mi-ddd:hh24:mi@
    --
    -- /Default/: a 30-minute window selected at random from an 8-hour block of
    -- time for each Amazon Web Services Region, occurring on a random day of
    -- the week.
    --
    -- /Valid days/: Mon, Tue, Wed, Thu, Fri, Sat, Sun
    --
    -- /Constraints/: Minimum 30-minute window.
    CreateCluster -> Maybe Text
preferredMaintenanceWindow :: Prelude.Maybe Prelude.Text,
    -- | The Amazon EC2 subnet IDs for the new Elastic DocumentDB cluster.
    CreateCluster -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
    -- | The tags to be assigned to the new Elastic DocumentDB cluster.
    CreateCluster -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A list of EC2 VPC security groups to associate with the new Elastic
    -- DocumentDB cluster.
    CreateCluster -> Maybe [Text]
vpcSecurityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | The name of the Elastic DocumentDB cluster administrator.
    --
    -- /Constraints/:
    --
    -- -   Must be from 1 to 63 letters or numbers.
    --
    -- -   The first character must be a letter.
    --
    -- -   Cannot be a reserved word.
    CreateCluster -> Text
adminUserName :: Prelude.Text,
    -- | The password for the Elastic DocumentDB cluster administrator and can
    -- contain any printable ASCII characters.
    --
    -- /Constraints/:
    --
    -- -   Must contain from 8 to 100 characters.
    --
    -- -   Cannot contain a forward slash (\/), double quote (\"), or the
    --     \"at\" symbol (\@).
    CreateCluster -> Sensitive Text
adminUserPassword :: Data.Sensitive Prelude.Text,
    -- | The authentication type for the Elastic DocumentDB cluster.
    CreateCluster -> Auth
authType :: Auth,
    -- | The name of the new Elastic DocumentDB cluster. This parameter is stored
    -- as a lowercase string.
    --
    -- /Constraints/:
    --
    -- -   Must contain from 1 to 63 letters, numbers, or hyphens.
    --
    -- -   The first character must be a letter.
    --
    -- -   Cannot end with a hyphen or contain two consecutive hyphens.
    --
    -- /Example/: @my-cluster@
    CreateCluster -> Text
clusterName :: Prelude.Text,
    -- | The capacity of each shard in the new Elastic DocumentDB cluster.
    CreateCluster -> Int
shardCapacity :: Prelude.Int,
    -- | The number of shards to create in the new Elastic DocumentDB cluster.
    CreateCluster -> Int
shardCount :: Prelude.Int
  }
  deriving (CreateCluster -> CreateCluster -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCluster -> CreateCluster -> Bool
$c/= :: CreateCluster -> CreateCluster -> Bool
== :: CreateCluster -> CreateCluster -> Bool
$c== :: CreateCluster -> CreateCluster -> Bool
Prelude.Eq, Int -> CreateCluster -> ShowS
[CreateCluster] -> ShowS
CreateCluster -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCluster] -> ShowS
$cshowList :: [CreateCluster] -> ShowS
show :: CreateCluster -> String
$cshow :: CreateCluster -> String
showsPrec :: Int -> CreateCluster -> ShowS
$cshowsPrec :: Int -> CreateCluster -> ShowS
Prelude.Show, forall x. Rep CreateCluster x -> CreateCluster
forall x. CreateCluster -> Rep CreateCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCluster x -> CreateCluster
$cfrom :: forall x. CreateCluster -> Rep CreateCluster x
Prelude.Generic)

-- |
-- Create a value of 'CreateCluster' 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:
--
-- 'clientToken', 'createCluster_clientToken' - The client token for the Elastic DocumentDB cluster.
--
-- 'kmsKeyId', 'createCluster_kmsKeyId' - The KMS key identifier to use to encrypt the new Elastic DocumentDB
-- cluster.
--
-- The KMS key identifier is the Amazon Resource Name (ARN) for the KMS
-- encryption key. If you are creating a cluster using the same Amazon
-- account that owns this KMS encryption key, you can use the KMS key alias
-- instead of the ARN as the KMS encryption key.
--
-- If an encryption key is not specified, Elastic DocumentDB uses the
-- default encryption key that KMS creates for your account. Your account
-- has a different default encryption key for each Amazon Region.
--
-- 'preferredMaintenanceWindow', 'createCluster_preferredMaintenanceWindow' - The weekly time range during which system maintenance can occur, in
-- Universal Coordinated Time (UTC).
--
-- /Format/: @ddd:hh24:mi-ddd:hh24:mi@
--
-- /Default/: a 30-minute window selected at random from an 8-hour block of
-- time for each Amazon Web Services Region, occurring on a random day of
-- the week.
--
-- /Valid days/: Mon, Tue, Wed, Thu, Fri, Sat, Sun
--
-- /Constraints/: Minimum 30-minute window.
--
-- 'subnetIds', 'createCluster_subnetIds' - The Amazon EC2 subnet IDs for the new Elastic DocumentDB cluster.
--
-- 'tags', 'createCluster_tags' - The tags to be assigned to the new Elastic DocumentDB cluster.
--
-- 'vpcSecurityGroupIds', 'createCluster_vpcSecurityGroupIds' - A list of EC2 VPC security groups to associate with the new Elastic
-- DocumentDB cluster.
--
-- 'adminUserName', 'createCluster_adminUserName' - The name of the Elastic DocumentDB cluster administrator.
--
-- /Constraints/:
--
-- -   Must be from 1 to 63 letters or numbers.
--
-- -   The first character must be a letter.
--
-- -   Cannot be a reserved word.
--
-- 'adminUserPassword', 'createCluster_adminUserPassword' - The password for the Elastic DocumentDB cluster administrator and can
-- contain any printable ASCII characters.
--
-- /Constraints/:
--
-- -   Must contain from 8 to 100 characters.
--
-- -   Cannot contain a forward slash (\/), double quote (\"), or the
--     \"at\" symbol (\@).
--
-- 'authType', 'createCluster_authType' - The authentication type for the Elastic DocumentDB cluster.
--
-- 'clusterName', 'createCluster_clusterName' - The name of the new Elastic DocumentDB cluster. This parameter is stored
-- as a lowercase string.
--
-- /Constraints/:
--
-- -   Must contain from 1 to 63 letters, numbers, or hyphens.
--
-- -   The first character must be a letter.
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens.
--
-- /Example/: @my-cluster@
--
-- 'shardCapacity', 'createCluster_shardCapacity' - The capacity of each shard in the new Elastic DocumentDB cluster.
--
-- 'shardCount', 'createCluster_shardCount' - The number of shards to create in the new Elastic DocumentDB cluster.
newCreateCluster ::
  -- | 'adminUserName'
  Prelude.Text ->
  -- | 'adminUserPassword'
  Prelude.Text ->
  -- | 'authType'
  Auth ->
  -- | 'clusterName'
  Prelude.Text ->
  -- | 'shardCapacity'
  Prelude.Int ->
  -- | 'shardCount'
  Prelude.Int ->
  CreateCluster
newCreateCluster :: Text -> Text -> Auth -> Text -> Int -> Int -> CreateCluster
newCreateCluster
  Text
pAdminUserName_
  Text
pAdminUserPassword_
  Auth
pAuthType_
  Text
pClusterName_
  Int
pShardCapacity_
  Int
pShardCount_ =
    CreateCluster'
      { $sel:clientToken:CreateCluster' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:CreateCluster' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
        $sel:preferredMaintenanceWindow:CreateCluster' :: Maybe Text
preferredMaintenanceWindow = forall a. Maybe a
Prelude.Nothing,
        $sel:subnetIds:CreateCluster' :: Maybe [Text]
subnetIds = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateCluster' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:vpcSecurityGroupIds:CreateCluster' :: Maybe [Text]
vpcSecurityGroupIds = forall a. Maybe a
Prelude.Nothing,
        $sel:adminUserName:CreateCluster' :: Text
adminUserName = Text
pAdminUserName_,
        $sel:adminUserPassword:CreateCluster' :: Sensitive Text
adminUserPassword =
          forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pAdminUserPassword_,
        $sel:authType:CreateCluster' :: Auth
authType = Auth
pAuthType_,
        $sel:clusterName:CreateCluster' :: Text
clusterName = Text
pClusterName_,
        $sel:shardCapacity:CreateCluster' :: Int
shardCapacity = Int
pShardCapacity_,
        $sel:shardCount:CreateCluster' :: Int
shardCount = Int
pShardCount_
      }

-- | The client token for the Elastic DocumentDB cluster.
createCluster_clientToken :: Lens.Lens' CreateCluster (Prelude.Maybe Prelude.Text)
createCluster_clientToken :: Lens' CreateCluster (Maybe Text)
createCluster_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateCluster' :: CreateCluster -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateCluster
s@CreateCluster' {} Maybe Text
a -> CreateCluster
s {$sel:clientToken:CreateCluster' :: Maybe Text
clientToken = Maybe Text
a} :: CreateCluster)

-- | The KMS key identifier to use to encrypt the new Elastic DocumentDB
-- cluster.
--
-- The KMS key identifier is the Amazon Resource Name (ARN) for the KMS
-- encryption key. If you are creating a cluster using the same Amazon
-- account that owns this KMS encryption key, you can use the KMS key alias
-- instead of the ARN as the KMS encryption key.
--
-- If an encryption key is not specified, Elastic DocumentDB uses the
-- default encryption key that KMS creates for your account. Your account
-- has a different default encryption key for each Amazon Region.
createCluster_kmsKeyId :: Lens.Lens' CreateCluster (Prelude.Maybe Prelude.Text)
createCluster_kmsKeyId :: Lens' CreateCluster (Maybe Text)
createCluster_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateCluster' :: CreateCluster -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateCluster
s@CreateCluster' {} Maybe Text
a -> CreateCluster
s {$sel:kmsKeyId:CreateCluster' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateCluster)

-- | The weekly time range during which system maintenance can occur, in
-- Universal Coordinated Time (UTC).
--
-- /Format/: @ddd:hh24:mi-ddd:hh24:mi@
--
-- /Default/: a 30-minute window selected at random from an 8-hour block of
-- time for each Amazon Web Services Region, occurring on a random day of
-- the week.
--
-- /Valid days/: Mon, Tue, Wed, Thu, Fri, Sat, Sun
--
-- /Constraints/: Minimum 30-minute window.
createCluster_preferredMaintenanceWindow :: Lens.Lens' CreateCluster (Prelude.Maybe Prelude.Text)
createCluster_preferredMaintenanceWindow :: Lens' CreateCluster (Maybe Text)
createCluster_preferredMaintenanceWindow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe Text
preferredMaintenanceWindow :: Maybe Text
$sel:preferredMaintenanceWindow:CreateCluster' :: CreateCluster -> Maybe Text
preferredMaintenanceWindow} -> Maybe Text
preferredMaintenanceWindow) (\s :: CreateCluster
s@CreateCluster' {} Maybe Text
a -> CreateCluster
s {$sel:preferredMaintenanceWindow:CreateCluster' :: Maybe Text
preferredMaintenanceWindow = Maybe Text
a} :: CreateCluster)

-- | The Amazon EC2 subnet IDs for the new Elastic DocumentDB cluster.
createCluster_subnetIds :: Lens.Lens' CreateCluster (Prelude.Maybe [Prelude.Text])
createCluster_subnetIds :: Lens' CreateCluster (Maybe [Text])
createCluster_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:CreateCluster' :: CreateCluster -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: CreateCluster
s@CreateCluster' {} Maybe [Text]
a -> CreateCluster
s {$sel:subnetIds:CreateCluster' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: CreateCluster) 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

-- | The tags to be assigned to the new Elastic DocumentDB cluster.
createCluster_tags :: Lens.Lens' CreateCluster (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createCluster_tags :: Lens' CreateCluster (Maybe (HashMap Text Text))
createCluster_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateCluster' :: CreateCluster -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateCluster
s@CreateCluster' {} Maybe (HashMap Text Text)
a -> CreateCluster
s {$sel:tags:CreateCluster' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateCluster) 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

-- | A list of EC2 VPC security groups to associate with the new Elastic
-- DocumentDB cluster.
createCluster_vpcSecurityGroupIds :: Lens.Lens' CreateCluster (Prelude.Maybe [Prelude.Text])
createCluster_vpcSecurityGroupIds :: Lens' CreateCluster (Maybe [Text])
createCluster_vpcSecurityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe [Text]
vpcSecurityGroupIds :: Maybe [Text]
$sel:vpcSecurityGroupIds:CreateCluster' :: CreateCluster -> Maybe [Text]
vpcSecurityGroupIds} -> Maybe [Text]
vpcSecurityGroupIds) (\s :: CreateCluster
s@CreateCluster' {} Maybe [Text]
a -> CreateCluster
s {$sel:vpcSecurityGroupIds:CreateCluster' :: Maybe [Text]
vpcSecurityGroupIds = Maybe [Text]
a} :: CreateCluster) 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

-- | The name of the Elastic DocumentDB cluster administrator.
--
-- /Constraints/:
--
-- -   Must be from 1 to 63 letters or numbers.
--
-- -   The first character must be a letter.
--
-- -   Cannot be a reserved word.
createCluster_adminUserName :: Lens.Lens' CreateCluster Prelude.Text
createCluster_adminUserName :: Lens' CreateCluster Text
createCluster_adminUserName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Text
adminUserName :: Text
$sel:adminUserName:CreateCluster' :: CreateCluster -> Text
adminUserName} -> Text
adminUserName) (\s :: CreateCluster
s@CreateCluster' {} Text
a -> CreateCluster
s {$sel:adminUserName:CreateCluster' :: Text
adminUserName = Text
a} :: CreateCluster)

-- | The password for the Elastic DocumentDB cluster administrator and can
-- contain any printable ASCII characters.
--
-- /Constraints/:
--
-- -   Must contain from 8 to 100 characters.
--
-- -   Cannot contain a forward slash (\/), double quote (\"), or the
--     \"at\" symbol (\@).
createCluster_adminUserPassword :: Lens.Lens' CreateCluster Prelude.Text
createCluster_adminUserPassword :: Lens' CreateCluster Text
createCluster_adminUserPassword = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Sensitive Text
adminUserPassword :: Sensitive Text
$sel:adminUserPassword:CreateCluster' :: CreateCluster -> Sensitive Text
adminUserPassword} -> Sensitive Text
adminUserPassword) (\s :: CreateCluster
s@CreateCluster' {} Sensitive Text
a -> CreateCluster
s {$sel:adminUserPassword:CreateCluster' :: Sensitive Text
adminUserPassword = Sensitive Text
a} :: CreateCluster) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The authentication type for the Elastic DocumentDB cluster.
createCluster_authType :: Lens.Lens' CreateCluster Auth
createCluster_authType :: Lens' CreateCluster Auth
createCluster_authType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Auth
authType :: Auth
$sel:authType:CreateCluster' :: CreateCluster -> Auth
authType} -> Auth
authType) (\s :: CreateCluster
s@CreateCluster' {} Auth
a -> CreateCluster
s {$sel:authType:CreateCluster' :: Auth
authType = Auth
a} :: CreateCluster)

-- | The name of the new Elastic DocumentDB cluster. This parameter is stored
-- as a lowercase string.
--
-- /Constraints/:
--
-- -   Must contain from 1 to 63 letters, numbers, or hyphens.
--
-- -   The first character must be a letter.
--
-- -   Cannot end with a hyphen or contain two consecutive hyphens.
--
-- /Example/: @my-cluster@
createCluster_clusterName :: Lens.Lens' CreateCluster Prelude.Text
createCluster_clusterName :: Lens' CreateCluster Text
createCluster_clusterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Text
clusterName :: Text
$sel:clusterName:CreateCluster' :: CreateCluster -> Text
clusterName} -> Text
clusterName) (\s :: CreateCluster
s@CreateCluster' {} Text
a -> CreateCluster
s {$sel:clusterName:CreateCluster' :: Text
clusterName = Text
a} :: CreateCluster)

-- | The capacity of each shard in the new Elastic DocumentDB cluster.
createCluster_shardCapacity :: Lens.Lens' CreateCluster Prelude.Int
createCluster_shardCapacity :: Lens' CreateCluster Int
createCluster_shardCapacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Int
shardCapacity :: Int
$sel:shardCapacity:CreateCluster' :: CreateCluster -> Int
shardCapacity} -> Int
shardCapacity) (\s :: CreateCluster
s@CreateCluster' {} Int
a -> CreateCluster
s {$sel:shardCapacity:CreateCluster' :: Int
shardCapacity = Int
a} :: CreateCluster)

-- | The number of shards to create in the new Elastic DocumentDB cluster.
createCluster_shardCount :: Lens.Lens' CreateCluster Prelude.Int
createCluster_shardCount :: Lens' CreateCluster Int
createCluster_shardCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Int
shardCount :: Int
$sel:shardCount:CreateCluster' :: CreateCluster -> Int
shardCount} -> Int
shardCount) (\s :: CreateCluster
s@CreateCluster' {} Int
a -> CreateCluster
s {$sel:shardCount:CreateCluster' :: Int
shardCount = Int
a} :: CreateCluster)

instance Core.AWSRequest CreateCluster where
  type
    AWSResponse CreateCluster =
      CreateClusterResponse
  request :: (Service -> Service) -> CreateCluster -> Request CreateCluster
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 CreateCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCluster)))
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 ->
          Int -> Cluster -> CreateClusterResponse
CreateClusterResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"cluster")
      )

instance Prelude.Hashable CreateCluster where
  hashWithSalt :: Int -> CreateCluster -> Int
hashWithSalt Int
_salt CreateCluster' {Int
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Text
Sensitive Text
Auth
shardCount :: Int
shardCapacity :: Int
clusterName :: Text
authType :: Auth
adminUserPassword :: Sensitive Text
adminUserName :: Text
vpcSecurityGroupIds :: Maybe [Text]
tags :: Maybe (HashMap Text Text)
subnetIds :: Maybe [Text]
preferredMaintenanceWindow :: Maybe Text
kmsKeyId :: Maybe Text
clientToken :: Maybe Text
$sel:shardCount:CreateCluster' :: CreateCluster -> Int
$sel:shardCapacity:CreateCluster' :: CreateCluster -> Int
$sel:clusterName:CreateCluster' :: CreateCluster -> Text
$sel:authType:CreateCluster' :: CreateCluster -> Auth
$sel:adminUserPassword:CreateCluster' :: CreateCluster -> Sensitive Text
$sel:adminUserName:CreateCluster' :: CreateCluster -> Text
$sel:vpcSecurityGroupIds:CreateCluster' :: CreateCluster -> Maybe [Text]
$sel:tags:CreateCluster' :: CreateCluster -> Maybe (HashMap Text Text)
$sel:subnetIds:CreateCluster' :: CreateCluster -> Maybe [Text]
$sel:preferredMaintenanceWindow:CreateCluster' :: CreateCluster -> Maybe Text
$sel:kmsKeyId:CreateCluster' :: CreateCluster -> Maybe Text
$sel:clientToken:CreateCluster' :: CreateCluster -> 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
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
preferredMaintenanceWindow
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subnetIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
vpcSecurityGroupIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
adminUserName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
adminUserPassword
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Auth
authType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
shardCapacity
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
shardCount

instance Prelude.NFData CreateCluster where
  rnf :: CreateCluster -> ()
rnf CreateCluster' {Int
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Text
Sensitive Text
Auth
shardCount :: Int
shardCapacity :: Int
clusterName :: Text
authType :: Auth
adminUserPassword :: Sensitive Text
adminUserName :: Text
vpcSecurityGroupIds :: Maybe [Text]
tags :: Maybe (HashMap Text Text)
subnetIds :: Maybe [Text]
preferredMaintenanceWindow :: Maybe Text
kmsKeyId :: Maybe Text
clientToken :: Maybe Text
$sel:shardCount:CreateCluster' :: CreateCluster -> Int
$sel:shardCapacity:CreateCluster' :: CreateCluster -> Int
$sel:clusterName:CreateCluster' :: CreateCluster -> Text
$sel:authType:CreateCluster' :: CreateCluster -> Auth
$sel:adminUserPassword:CreateCluster' :: CreateCluster -> Sensitive Text
$sel:adminUserName:CreateCluster' :: CreateCluster -> Text
$sel:vpcSecurityGroupIds:CreateCluster' :: CreateCluster -> Maybe [Text]
$sel:tags:CreateCluster' :: CreateCluster -> Maybe (HashMap Text Text)
$sel:subnetIds:CreateCluster' :: CreateCluster -> Maybe [Text]
$sel:preferredMaintenanceWindow:CreateCluster' :: CreateCluster -> Maybe Text
$sel:kmsKeyId:CreateCluster' :: CreateCluster -> Maybe Text
$sel:clientToken:CreateCluster' :: CreateCluster -> 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
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
preferredMaintenanceWindow
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
subnetIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
vpcSecurityGroupIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
adminUserName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
adminUserPassword
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Auth
authType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
clusterName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
shardCapacity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
shardCount

instance Data.ToHeaders CreateCluster where
  toHeaders :: CreateCluster -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateCluster where
  toJSON :: CreateCluster -> Value
toJSON CreateCluster' {Int
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Text
Sensitive Text
Auth
shardCount :: Int
shardCapacity :: Int
clusterName :: Text
authType :: Auth
adminUserPassword :: Sensitive Text
adminUserName :: Text
vpcSecurityGroupIds :: Maybe [Text]
tags :: Maybe (HashMap Text Text)
subnetIds :: Maybe [Text]
preferredMaintenanceWindow :: Maybe Text
kmsKeyId :: Maybe Text
clientToken :: Maybe Text
$sel:shardCount:CreateCluster' :: CreateCluster -> Int
$sel:shardCapacity:CreateCluster' :: CreateCluster -> Int
$sel:clusterName:CreateCluster' :: CreateCluster -> Text
$sel:authType:CreateCluster' :: CreateCluster -> Auth
$sel:adminUserPassword:CreateCluster' :: CreateCluster -> Sensitive Text
$sel:adminUserName:CreateCluster' :: CreateCluster -> Text
$sel:vpcSecurityGroupIds:CreateCluster' :: CreateCluster -> Maybe [Text]
$sel:tags:CreateCluster' :: CreateCluster -> Maybe (HashMap Text Text)
$sel:subnetIds:CreateCluster' :: CreateCluster -> Maybe [Text]
$sel:preferredMaintenanceWindow:CreateCluster' :: CreateCluster -> Maybe Text
$sel:kmsKeyId:CreateCluster' :: CreateCluster -> Maybe Text
$sel:clientToken:CreateCluster' :: CreateCluster -> 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
"kmsKeyId" 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
kmsKeyId,
            (Key
"preferredMaintenanceWindow" 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
preferredMaintenanceWindow,
            (Key
"subnetIds" 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]
subnetIds,
            (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 (HashMap Text Text)
tags,
            (Key
"vpcSecurityGroupIds" 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]
vpcSecurityGroupIds,
            forall a. a -> Maybe a
Prelude.Just (Key
"adminUserName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
adminUserName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"adminUserPassword" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
adminUserPassword),
            forall a. a -> Maybe a
Prelude.Just (Key
"authType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Auth
authType),
            forall a. a -> Maybe a
Prelude.Just (Key
"clusterName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
clusterName),
            forall a. a -> Maybe a
Prelude.Just (Key
"shardCapacity" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Int
shardCapacity),
            forall a. a -> Maybe a
Prelude.Just (Key
"shardCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Int
shardCount)
          ]
      )

instance Data.ToPath CreateCluster where
  toPath :: CreateCluster -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/cluster"

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

-- | /See:/ 'newCreateClusterResponse' smart constructor.
data CreateClusterResponse = CreateClusterResponse'
  { -- | The response's http status code.
    CreateClusterResponse -> Int
httpStatus :: Prelude.Int,
    -- | The new Elastic DocumentDB cluster that has been created.
    CreateClusterResponse -> Cluster
cluster :: Cluster
  }
  deriving (CreateClusterResponse -> CreateClusterResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateClusterResponse -> CreateClusterResponse -> Bool
$c/= :: CreateClusterResponse -> CreateClusterResponse -> Bool
== :: CreateClusterResponse -> CreateClusterResponse -> Bool
$c== :: CreateClusterResponse -> CreateClusterResponse -> Bool
Prelude.Eq, ReadPrec [CreateClusterResponse]
ReadPrec CreateClusterResponse
Int -> ReadS CreateClusterResponse
ReadS [CreateClusterResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateClusterResponse]
$creadListPrec :: ReadPrec [CreateClusterResponse]
readPrec :: ReadPrec CreateClusterResponse
$creadPrec :: ReadPrec CreateClusterResponse
readList :: ReadS [CreateClusterResponse]
$creadList :: ReadS [CreateClusterResponse]
readsPrec :: Int -> ReadS CreateClusterResponse
$creadsPrec :: Int -> ReadS CreateClusterResponse
Prelude.Read, Int -> CreateClusterResponse -> ShowS
[CreateClusterResponse] -> ShowS
CreateClusterResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateClusterResponse] -> ShowS
$cshowList :: [CreateClusterResponse] -> ShowS
show :: CreateClusterResponse -> String
$cshow :: CreateClusterResponse -> String
showsPrec :: Int -> CreateClusterResponse -> ShowS
$cshowsPrec :: Int -> CreateClusterResponse -> ShowS
Prelude.Show, forall x. Rep CreateClusterResponse x -> CreateClusterResponse
forall x. CreateClusterResponse -> Rep CreateClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateClusterResponse x -> CreateClusterResponse
$cfrom :: forall x. CreateClusterResponse -> Rep CreateClusterResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateClusterResponse' 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:
--
-- 'httpStatus', 'createClusterResponse_httpStatus' - The response's http status code.
--
-- 'cluster', 'createClusterResponse_cluster' - The new Elastic DocumentDB cluster that has been created.
newCreateClusterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'cluster'
  Cluster ->
  CreateClusterResponse
newCreateClusterResponse :: Int -> Cluster -> CreateClusterResponse
newCreateClusterResponse Int
pHttpStatus_ Cluster
pCluster_ =
  CreateClusterResponse'
    { $sel:httpStatus:CreateClusterResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:cluster:CreateClusterResponse' :: Cluster
cluster = Cluster
pCluster_
    }

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

-- | The new Elastic DocumentDB cluster that has been created.
createClusterResponse_cluster :: Lens.Lens' CreateClusterResponse Cluster
createClusterResponse_cluster :: Lens' CreateClusterResponse Cluster
createClusterResponse_cluster = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateClusterResponse' {Cluster
cluster :: Cluster
$sel:cluster:CreateClusterResponse' :: CreateClusterResponse -> Cluster
cluster} -> Cluster
cluster) (\s :: CreateClusterResponse
s@CreateClusterResponse' {} Cluster
a -> CreateClusterResponse
s {$sel:cluster:CreateClusterResponse' :: Cluster
cluster = Cluster
a} :: CreateClusterResponse)

instance Prelude.NFData CreateClusterResponse where
  rnf :: CreateClusterResponse -> ()
rnf CreateClusterResponse' {Int
Cluster
cluster :: Cluster
httpStatus :: Int
$sel:cluster:CreateClusterResponse' :: CreateClusterResponse -> Cluster
$sel:httpStatus:CreateClusterResponse' :: CreateClusterResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Cluster
cluster