{-# 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.EKS.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 an Amazon EKS control plane.
--
-- The Amazon EKS control plane consists of control plane instances that
-- run the Kubernetes software, such as @etcd@ and the API server. The
-- control plane runs in an account managed by Amazon Web Services, and the
-- Kubernetes API is exposed by the Amazon EKS API server endpoint. Each
-- Amazon EKS cluster control plane is single tenant and unique. It runs on
-- its own set of Amazon EC2 instances.
--
-- The cluster control plane is provisioned across multiple Availability
-- Zones and fronted by an Elastic Load Balancing Network Load Balancer.
-- Amazon EKS also provisions elastic network interfaces in your VPC
-- subnets to provide connectivity from the control plane instances to the
-- nodes (for example, to support @kubectl exec@, @logs@, and @proxy@ data
-- flows).
--
-- Amazon EKS nodes run in your Amazon Web Services account and connect to
-- your cluster\'s control plane over the Kubernetes API server endpoint
-- and a certificate file that is created for your cluster.
--
-- In most cases, it takes several minutes to create a cluster. After you
-- create an Amazon EKS cluster, you must configure your Kubernetes tooling
-- to communicate with the API server and launch nodes into your cluster.
-- For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/managing-auth.html Managing Cluster Authentication>
-- and
-- <https://docs.aws.amazon.com/eks/latest/userguide/launch-workers.html Launching Amazon EKS nodes>
-- in the /Amazon EKS User Guide/.
module Amazonka.EKS.CreateCluster
  ( -- * Creating a Request
    CreateCluster (..),
    newCreateCluster,

    -- * Request Lenses
    createCluster_clientRequestToken,
    createCluster_encryptionConfig,
    createCluster_kubernetesNetworkConfig,
    createCluster_logging,
    createCluster_outpostConfig,
    createCluster_tags,
    createCluster_version,
    createCluster_name,
    createCluster_roleArn,
    createCluster_resourcesVpcConfig,

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

    -- * Response Lenses
    createClusterResponse_cluster,
    createClusterResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EKS.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'
  { -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    CreateCluster -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The encryption configuration for the cluster.
    CreateCluster -> Maybe [EncryptionConfig]
encryptionConfig :: Prelude.Maybe [EncryptionConfig],
    -- | The Kubernetes network configuration for the cluster.
    CreateCluster -> Maybe KubernetesNetworkConfigRequest
kubernetesNetworkConfig :: Prelude.Maybe KubernetesNetworkConfigRequest,
    -- | Enable or disable exporting the Kubernetes control plane logs for your
    -- cluster to CloudWatch Logs. By default, cluster control plane logs
    -- aren\'t exported to CloudWatch Logs. For more information, see
    -- <https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html Amazon EKS Cluster control plane logs>
    -- in the //Amazon EKS User Guide// .
    --
    -- CloudWatch Logs ingestion, archive storage, and data scanning rates
    -- apply to exported control plane logs. For more information, see
    -- <http://aws.amazon.com/cloudwatch/pricing/ CloudWatch Pricing>.
    CreateCluster -> Maybe Logging
logging :: Prelude.Maybe Logging,
    -- | An object representing the configuration of your local Amazon EKS
    -- cluster on an Amazon Web Services Outpost. Before creating a local
    -- cluster on an Outpost, review
    -- <https://docs.aws.amazon.com/eks/latest/userguide/eks-outposts-local-cluster-overview.html Local clusters for Amazon EKS on Amazon Web Services Outposts>
    -- in the /Amazon EKS User Guide/. This object isn\'t available for
    -- creating Amazon EKS clusters on the Amazon Web Services cloud.
    CreateCluster -> Maybe OutpostConfigRequest
outpostConfig :: Prelude.Maybe OutpostConfigRequest,
    -- | The metadata to apply to the cluster to assist with categorization and
    -- organization. Each tag consists of a key and an optional value. You
    -- define both.
    CreateCluster -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The desired Kubernetes version for your cluster. If you don\'t specify a
    -- value here, the default version available in Amazon EKS is used.
    --
    -- The default version might not be the latest version available.
    CreateCluster -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The unique name to give to your cluster.
    CreateCluster -> Text
name :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role that provides permissions
    -- for the Kubernetes control plane to make calls to Amazon Web Services
    -- API operations on your behalf. For more information, see
    -- <https://docs.aws.amazon.com/eks/latest/userguide/service_IAM_role.html Amazon EKS Service IAM Role>
    -- in the //Amazon EKS User Guide// .
    CreateCluster -> Text
roleArn :: Prelude.Text,
    -- | The VPC configuration that\'s used by the cluster control plane. Amazon
    -- EKS VPC resources have specific requirements to work properly with
    -- Kubernetes. For more information, see
    -- <https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html Cluster VPC Considerations>
    -- and
    -- <https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html Cluster Security Group Considerations>
    -- in the /Amazon EKS User Guide/. You must specify at least two subnets.
    -- You can specify up to five security groups. However, we recommend that
    -- you use a dedicated security group for your cluster control plane.
    CreateCluster -> VpcConfigRequest
resourcesVpcConfig :: VpcConfigRequest
  }
  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, ReadPrec [CreateCluster]
ReadPrec CreateCluster
Int -> ReadS CreateCluster
ReadS [CreateCluster]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCluster]
$creadListPrec :: ReadPrec [CreateCluster]
readPrec :: ReadPrec CreateCluster
$creadPrec :: ReadPrec CreateCluster
readList :: ReadS [CreateCluster]
$creadList :: ReadS [CreateCluster]
readsPrec :: Int -> ReadS CreateCluster
$creadsPrec :: Int -> ReadS CreateCluster
Prelude.Read, 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:
--
-- 'clientRequestToken', 'createCluster_clientRequestToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'encryptionConfig', 'createCluster_encryptionConfig' - The encryption configuration for the cluster.
--
-- 'kubernetesNetworkConfig', 'createCluster_kubernetesNetworkConfig' - The Kubernetes network configuration for the cluster.
--
-- 'logging', 'createCluster_logging' - Enable or disable exporting the Kubernetes control plane logs for your
-- cluster to CloudWatch Logs. By default, cluster control plane logs
-- aren\'t exported to CloudWatch Logs. For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html Amazon EKS Cluster control plane logs>
-- in the //Amazon EKS User Guide// .
--
-- CloudWatch Logs ingestion, archive storage, and data scanning rates
-- apply to exported control plane logs. For more information, see
-- <http://aws.amazon.com/cloudwatch/pricing/ CloudWatch Pricing>.
--
-- 'outpostConfig', 'createCluster_outpostConfig' - An object representing the configuration of your local Amazon EKS
-- cluster on an Amazon Web Services Outpost. Before creating a local
-- cluster on an Outpost, review
-- <https://docs.aws.amazon.com/eks/latest/userguide/eks-outposts-local-cluster-overview.html Local clusters for Amazon EKS on Amazon Web Services Outposts>
-- in the /Amazon EKS User Guide/. This object isn\'t available for
-- creating Amazon EKS clusters on the Amazon Web Services cloud.
--
-- 'tags', 'createCluster_tags' - The metadata to apply to the cluster to assist with categorization and
-- organization. Each tag consists of a key and an optional value. You
-- define both.
--
-- 'version', 'createCluster_version' - The desired Kubernetes version for your cluster. If you don\'t specify a
-- value here, the default version available in Amazon EKS is used.
--
-- The default version might not be the latest version available.
--
-- 'name', 'createCluster_name' - The unique name to give to your cluster.
--
-- 'roleArn', 'createCluster_roleArn' - The Amazon Resource Name (ARN) of the IAM role that provides permissions
-- for the Kubernetes control plane to make calls to Amazon Web Services
-- API operations on your behalf. For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/service_IAM_role.html Amazon EKS Service IAM Role>
-- in the //Amazon EKS User Guide// .
--
-- 'resourcesVpcConfig', 'createCluster_resourcesVpcConfig' - The VPC configuration that\'s used by the cluster control plane. Amazon
-- EKS VPC resources have specific requirements to work properly with
-- Kubernetes. For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html Cluster VPC Considerations>
-- and
-- <https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html Cluster Security Group Considerations>
-- in the /Amazon EKS User Guide/. You must specify at least two subnets.
-- You can specify up to five security groups. However, we recommend that
-- you use a dedicated security group for your cluster control plane.
newCreateCluster ::
  -- | 'name'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  -- | 'resourcesVpcConfig'
  VpcConfigRequest ->
  CreateCluster
newCreateCluster :: Text -> Text -> VpcConfigRequest -> CreateCluster
newCreateCluster
  Text
pName_
  Text
pRoleArn_
  VpcConfigRequest
pResourcesVpcConfig_ =
    CreateCluster'
      { $sel:clientRequestToken:CreateCluster' :: Maybe Text
clientRequestToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:encryptionConfig:CreateCluster' :: Maybe [EncryptionConfig]
encryptionConfig = forall a. Maybe a
Prelude.Nothing,
        $sel:kubernetesNetworkConfig:CreateCluster' :: Maybe KubernetesNetworkConfigRequest
kubernetesNetworkConfig = forall a. Maybe a
Prelude.Nothing,
        $sel:logging:CreateCluster' :: Maybe Logging
logging = forall a. Maybe a
Prelude.Nothing,
        $sel:outpostConfig:CreateCluster' :: Maybe OutpostConfigRequest
outpostConfig = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateCluster' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:version:CreateCluster' :: Maybe Text
version = forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateCluster' :: Text
name = Text
pName_,
        $sel:roleArn:CreateCluster' :: Text
roleArn = Text
pRoleArn_,
        $sel:resourcesVpcConfig:CreateCluster' :: VpcConfigRequest
resourcesVpcConfig = VpcConfigRequest
pResourcesVpcConfig_
      }

-- | Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
createCluster_clientRequestToken :: Lens.Lens' CreateCluster (Prelude.Maybe Prelude.Text)
createCluster_clientRequestToken :: Lens' CreateCluster (Maybe Text)
createCluster_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:CreateCluster' :: CreateCluster -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: CreateCluster
s@CreateCluster' {} Maybe Text
a -> CreateCluster
s {$sel:clientRequestToken:CreateCluster' :: Maybe Text
clientRequestToken = Maybe Text
a} :: CreateCluster)

-- | The encryption configuration for the cluster.
createCluster_encryptionConfig :: Lens.Lens' CreateCluster (Prelude.Maybe [EncryptionConfig])
createCluster_encryptionConfig :: Lens' CreateCluster (Maybe [EncryptionConfig])
createCluster_encryptionConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe [EncryptionConfig]
encryptionConfig :: Maybe [EncryptionConfig]
$sel:encryptionConfig:CreateCluster' :: CreateCluster -> Maybe [EncryptionConfig]
encryptionConfig} -> Maybe [EncryptionConfig]
encryptionConfig) (\s :: CreateCluster
s@CreateCluster' {} Maybe [EncryptionConfig]
a -> CreateCluster
s {$sel:encryptionConfig:CreateCluster' :: Maybe [EncryptionConfig]
encryptionConfig = Maybe [EncryptionConfig]
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 Kubernetes network configuration for the cluster.
createCluster_kubernetesNetworkConfig :: Lens.Lens' CreateCluster (Prelude.Maybe KubernetesNetworkConfigRequest)
createCluster_kubernetesNetworkConfig :: Lens' CreateCluster (Maybe KubernetesNetworkConfigRequest)
createCluster_kubernetesNetworkConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe KubernetesNetworkConfigRequest
kubernetesNetworkConfig :: Maybe KubernetesNetworkConfigRequest
$sel:kubernetesNetworkConfig:CreateCluster' :: CreateCluster -> Maybe KubernetesNetworkConfigRequest
kubernetesNetworkConfig} -> Maybe KubernetesNetworkConfigRequest
kubernetesNetworkConfig) (\s :: CreateCluster
s@CreateCluster' {} Maybe KubernetesNetworkConfigRequest
a -> CreateCluster
s {$sel:kubernetesNetworkConfig:CreateCluster' :: Maybe KubernetesNetworkConfigRequest
kubernetesNetworkConfig = Maybe KubernetesNetworkConfigRequest
a} :: CreateCluster)

-- | Enable or disable exporting the Kubernetes control plane logs for your
-- cluster to CloudWatch Logs. By default, cluster control plane logs
-- aren\'t exported to CloudWatch Logs. For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/control-plane-logs.html Amazon EKS Cluster control plane logs>
-- in the //Amazon EKS User Guide// .
--
-- CloudWatch Logs ingestion, archive storage, and data scanning rates
-- apply to exported control plane logs. For more information, see
-- <http://aws.amazon.com/cloudwatch/pricing/ CloudWatch Pricing>.
createCluster_logging :: Lens.Lens' CreateCluster (Prelude.Maybe Logging)
createCluster_logging :: Lens' CreateCluster (Maybe Logging)
createCluster_logging = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe Logging
logging :: Maybe Logging
$sel:logging:CreateCluster' :: CreateCluster -> Maybe Logging
logging} -> Maybe Logging
logging) (\s :: CreateCluster
s@CreateCluster' {} Maybe Logging
a -> CreateCluster
s {$sel:logging:CreateCluster' :: Maybe Logging
logging = Maybe Logging
a} :: CreateCluster)

-- | An object representing the configuration of your local Amazon EKS
-- cluster on an Amazon Web Services Outpost. Before creating a local
-- cluster on an Outpost, review
-- <https://docs.aws.amazon.com/eks/latest/userguide/eks-outposts-local-cluster-overview.html Local clusters for Amazon EKS on Amazon Web Services Outposts>
-- in the /Amazon EKS User Guide/. This object isn\'t available for
-- creating Amazon EKS clusters on the Amazon Web Services cloud.
createCluster_outpostConfig :: Lens.Lens' CreateCluster (Prelude.Maybe OutpostConfigRequest)
createCluster_outpostConfig :: Lens' CreateCluster (Maybe OutpostConfigRequest)
createCluster_outpostConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe OutpostConfigRequest
outpostConfig :: Maybe OutpostConfigRequest
$sel:outpostConfig:CreateCluster' :: CreateCluster -> Maybe OutpostConfigRequest
outpostConfig} -> Maybe OutpostConfigRequest
outpostConfig) (\s :: CreateCluster
s@CreateCluster' {} Maybe OutpostConfigRequest
a -> CreateCluster
s {$sel:outpostConfig:CreateCluster' :: Maybe OutpostConfigRequest
outpostConfig = Maybe OutpostConfigRequest
a} :: CreateCluster)

-- | The metadata to apply to the cluster to assist with categorization and
-- organization. Each tag consists of a key and an optional value. You
-- define both.
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

-- | The desired Kubernetes version for your cluster. If you don\'t specify a
-- value here, the default version available in Amazon EKS is used.
--
-- The default version might not be the latest version available.
createCluster_version :: Lens.Lens' CreateCluster (Prelude.Maybe Prelude.Text)
createCluster_version :: Lens' CreateCluster (Maybe Text)
createCluster_version = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe Text
version :: Maybe Text
$sel:version:CreateCluster' :: CreateCluster -> Maybe Text
version} -> Maybe Text
version) (\s :: CreateCluster
s@CreateCluster' {} Maybe Text
a -> CreateCluster
s {$sel:version:CreateCluster' :: Maybe Text
version = Maybe Text
a} :: CreateCluster)

-- | The unique name to give to your cluster.
createCluster_name :: Lens.Lens' CreateCluster Prelude.Text
createCluster_name :: Lens' CreateCluster Text
createCluster_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Text
name :: Text
$sel:name:CreateCluster' :: CreateCluster -> Text
name} -> Text
name) (\s :: CreateCluster
s@CreateCluster' {} Text
a -> CreateCluster
s {$sel:name:CreateCluster' :: Text
name = Text
a} :: CreateCluster)

-- | The Amazon Resource Name (ARN) of the IAM role that provides permissions
-- for the Kubernetes control plane to make calls to Amazon Web Services
-- API operations on your behalf. For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/service_IAM_role.html Amazon EKS Service IAM Role>
-- in the //Amazon EKS User Guide// .
createCluster_roleArn :: Lens.Lens' CreateCluster Prelude.Text
createCluster_roleArn :: Lens' CreateCluster Text
createCluster_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Text
roleArn :: Text
$sel:roleArn:CreateCluster' :: CreateCluster -> Text
roleArn} -> Text
roleArn) (\s :: CreateCluster
s@CreateCluster' {} Text
a -> CreateCluster
s {$sel:roleArn:CreateCluster' :: Text
roleArn = Text
a} :: CreateCluster)

-- | The VPC configuration that\'s used by the cluster control plane. Amazon
-- EKS VPC resources have specific requirements to work properly with
-- Kubernetes. For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html Cluster VPC Considerations>
-- and
-- <https://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html Cluster Security Group Considerations>
-- in the /Amazon EKS User Guide/. You must specify at least two subnets.
-- You can specify up to five security groups. However, we recommend that
-- you use a dedicated security group for your cluster control plane.
createCluster_resourcesVpcConfig :: Lens.Lens' CreateCluster VpcConfigRequest
createCluster_resourcesVpcConfig :: Lens' CreateCluster VpcConfigRequest
createCluster_resourcesVpcConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {VpcConfigRequest
resourcesVpcConfig :: VpcConfigRequest
$sel:resourcesVpcConfig:CreateCluster' :: CreateCluster -> VpcConfigRequest
resourcesVpcConfig} -> VpcConfigRequest
resourcesVpcConfig) (\s :: CreateCluster
s@CreateCluster' {} VpcConfigRequest
a -> CreateCluster
s {$sel:resourcesVpcConfig:CreateCluster' :: VpcConfigRequest
resourcesVpcConfig = VpcConfigRequest
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 ->
          Maybe Cluster -> Int -> CreateClusterResponse
CreateClusterResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"cluster")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateCluster where
  hashWithSalt :: Int -> CreateCluster -> Int
hashWithSalt Int
_salt CreateCluster' {Maybe [EncryptionConfig]
Maybe Text
Maybe (HashMap Text Text)
Maybe KubernetesNetworkConfigRequest
Maybe Logging
Maybe OutpostConfigRequest
Text
VpcConfigRequest
resourcesVpcConfig :: VpcConfigRequest
roleArn :: Text
name :: Text
version :: Maybe Text
tags :: Maybe (HashMap Text Text)
outpostConfig :: Maybe OutpostConfigRequest
logging :: Maybe Logging
kubernetesNetworkConfig :: Maybe KubernetesNetworkConfigRequest
encryptionConfig :: Maybe [EncryptionConfig]
clientRequestToken :: Maybe Text
$sel:resourcesVpcConfig:CreateCluster' :: CreateCluster -> VpcConfigRequest
$sel:roleArn:CreateCluster' :: CreateCluster -> Text
$sel:name:CreateCluster' :: CreateCluster -> Text
$sel:version:CreateCluster' :: CreateCluster -> Maybe Text
$sel:tags:CreateCluster' :: CreateCluster -> Maybe (HashMap Text Text)
$sel:outpostConfig:CreateCluster' :: CreateCluster -> Maybe OutpostConfigRequest
$sel:logging:CreateCluster' :: CreateCluster -> Maybe Logging
$sel:kubernetesNetworkConfig:CreateCluster' :: CreateCluster -> Maybe KubernetesNetworkConfigRequest
$sel:encryptionConfig:CreateCluster' :: CreateCluster -> Maybe [EncryptionConfig]
$sel:clientRequestToken:CreateCluster' :: CreateCluster -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientRequestToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EncryptionConfig]
encryptionConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KubernetesNetworkConfigRequest
kubernetesNetworkConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Logging
logging
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OutpostConfigRequest
outpostConfig
      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
version
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` VpcConfigRequest
resourcesVpcConfig

instance Prelude.NFData CreateCluster where
  rnf :: CreateCluster -> ()
rnf CreateCluster' {Maybe [EncryptionConfig]
Maybe Text
Maybe (HashMap Text Text)
Maybe KubernetesNetworkConfigRequest
Maybe Logging
Maybe OutpostConfigRequest
Text
VpcConfigRequest
resourcesVpcConfig :: VpcConfigRequest
roleArn :: Text
name :: Text
version :: Maybe Text
tags :: Maybe (HashMap Text Text)
outpostConfig :: Maybe OutpostConfigRequest
logging :: Maybe Logging
kubernetesNetworkConfig :: Maybe KubernetesNetworkConfigRequest
encryptionConfig :: Maybe [EncryptionConfig]
clientRequestToken :: Maybe Text
$sel:resourcesVpcConfig:CreateCluster' :: CreateCluster -> VpcConfigRequest
$sel:roleArn:CreateCluster' :: CreateCluster -> Text
$sel:name:CreateCluster' :: CreateCluster -> Text
$sel:version:CreateCluster' :: CreateCluster -> Maybe Text
$sel:tags:CreateCluster' :: CreateCluster -> Maybe (HashMap Text Text)
$sel:outpostConfig:CreateCluster' :: CreateCluster -> Maybe OutpostConfigRequest
$sel:logging:CreateCluster' :: CreateCluster -> Maybe Logging
$sel:kubernetesNetworkConfig:CreateCluster' :: CreateCluster -> Maybe KubernetesNetworkConfigRequest
$sel:encryptionConfig:CreateCluster' :: CreateCluster -> Maybe [EncryptionConfig]
$sel:clientRequestToken:CreateCluster' :: CreateCluster -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientRequestToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [EncryptionConfig]
encryptionConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KubernetesNetworkConfigRequest
kubernetesNetworkConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Logging
logging
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OutpostConfigRequest
outpostConfig
      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
version
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf VpcConfigRequest
resourcesVpcConfig

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' {Maybe [EncryptionConfig]
Maybe Text
Maybe (HashMap Text Text)
Maybe KubernetesNetworkConfigRequest
Maybe Logging
Maybe OutpostConfigRequest
Text
VpcConfigRequest
resourcesVpcConfig :: VpcConfigRequest
roleArn :: Text
name :: Text
version :: Maybe Text
tags :: Maybe (HashMap Text Text)
outpostConfig :: Maybe OutpostConfigRequest
logging :: Maybe Logging
kubernetesNetworkConfig :: Maybe KubernetesNetworkConfigRequest
encryptionConfig :: Maybe [EncryptionConfig]
clientRequestToken :: Maybe Text
$sel:resourcesVpcConfig:CreateCluster' :: CreateCluster -> VpcConfigRequest
$sel:roleArn:CreateCluster' :: CreateCluster -> Text
$sel:name:CreateCluster' :: CreateCluster -> Text
$sel:version:CreateCluster' :: CreateCluster -> Maybe Text
$sel:tags:CreateCluster' :: CreateCluster -> Maybe (HashMap Text Text)
$sel:outpostConfig:CreateCluster' :: CreateCluster -> Maybe OutpostConfigRequest
$sel:logging:CreateCluster' :: CreateCluster -> Maybe Logging
$sel:kubernetesNetworkConfig:CreateCluster' :: CreateCluster -> Maybe KubernetesNetworkConfigRequest
$sel:encryptionConfig:CreateCluster' :: CreateCluster -> Maybe [EncryptionConfig]
$sel:clientRequestToken:CreateCluster' :: CreateCluster -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"clientRequestToken" 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
clientRequestToken,
            (Key
"encryptionConfig" 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 [EncryptionConfig]
encryptionConfig,
            (Key
"kubernetesNetworkConfig" 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 KubernetesNetworkConfigRequest
kubernetesNetworkConfig,
            (Key
"logging" 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 Logging
logging,
            (Key
"outpostConfig" 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 OutpostConfigRequest
outpostConfig,
            (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
"version" 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
version,
            forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"resourcesVpcConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= VpcConfigRequest
resourcesVpcConfig)
          ]
      )

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

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 full description of your new cluster.
    CreateClusterResponse -> Maybe Cluster
cluster :: Prelude.Maybe Cluster,
    -- | The response's http status code.
    CreateClusterResponse -> Int
httpStatus :: Prelude.Int
  }
  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:
--
-- 'cluster', 'createClusterResponse_cluster' - The full description of your new cluster.
--
-- 'httpStatus', 'createClusterResponse_httpStatus' - The response's http status code.
newCreateClusterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateClusterResponse
newCreateClusterResponse :: Int -> CreateClusterResponse
newCreateClusterResponse Int
pHttpStatus_ =
  CreateClusterResponse'
    { $sel:cluster:CreateClusterResponse' :: Maybe Cluster
cluster = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The full description of your new cluster.
createClusterResponse_cluster :: Lens.Lens' CreateClusterResponse (Prelude.Maybe Cluster)
createClusterResponse_cluster :: Lens' CreateClusterResponse (Maybe Cluster)
createClusterResponse_cluster = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateClusterResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:CreateClusterResponse' :: CreateClusterResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: CreateClusterResponse
s@CreateClusterResponse' {} Maybe Cluster
a -> CreateClusterResponse
s {$sel:cluster:CreateClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: CreateClusterResponse)

-- | 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)

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