{-# 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.Kafka.CreateCluster
-- 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 new MSK cluster.
module Amazonka.Kafka.CreateCluster
  ( -- * Creating a Request
    CreateCluster (..),
    newCreateCluster,

    -- * Request Lenses
    createCluster_enhancedMonitoring,
    createCluster_openMonitoring,
    createCluster_configurationInfo,
    createCluster_loggingInfo,
    createCluster_clientAuthentication,
    createCluster_tags,
    createCluster_encryptionInfo,
    createCluster_brokerNodeGroupInfo,
    createCluster_kafkaVersion,
    createCluster_numberOfBrokerNodes,
    createCluster_clusterName,

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

    -- * Response Lenses
    createClusterResponse_state,
    createClusterResponse_clusterArn,
    createClusterResponse_clusterName,
    createClusterResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Kafka.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:/ 'newCreateCluster' smart constructor.
data CreateCluster = CreateCluster'
  { -- | Specifies the level of monitoring for the MSK cluster. The possible
    -- values are DEFAULT, PER_BROKER, PER_TOPIC_PER_BROKER, and
    -- PER_TOPIC_PER_PARTITION.
    CreateCluster -> Maybe EnhancedMonitoring
enhancedMonitoring :: Prelude.Maybe EnhancedMonitoring,
    -- | The settings for open monitoring.
    CreateCluster -> Maybe OpenMonitoringInfo
openMonitoring :: Prelude.Maybe OpenMonitoringInfo,
    -- | Represents the configuration that you want MSK to use for the brokers in
    -- a cluster.
    CreateCluster -> Maybe ConfigurationInfo
configurationInfo :: Prelude.Maybe ConfigurationInfo,
    CreateCluster -> Maybe LoggingInfo
loggingInfo :: Prelude.Maybe LoggingInfo,
    -- | Includes all client authentication related information.
    CreateCluster -> Maybe ClientAuthentication
clientAuthentication :: Prelude.Maybe ClientAuthentication,
    -- | Create tags when creating the cluster.
    CreateCluster -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Includes all encryption-related information.
    CreateCluster -> Maybe EncryptionInfo
encryptionInfo :: Prelude.Maybe EncryptionInfo,
    -- | Information about the broker nodes in the cluster.
    CreateCluster -> BrokerNodeGroupInfo
brokerNodeGroupInfo :: BrokerNodeGroupInfo,
    -- | The version of Apache Kafka.
    CreateCluster -> Text
kafkaVersion :: Prelude.Text,
    -- | The number of broker nodes in the cluster.
    CreateCluster -> Natural
numberOfBrokerNodes :: Prelude.Natural,
    -- | The name of the cluster.
    CreateCluster -> Text
clusterName :: Prelude.Text
  }
  deriving (CreateCluster -> CreateCluster -> Bool
(CreateCluster -> CreateCluster -> Bool)
-> (CreateCluster -> CreateCluster -> Bool) -> Eq CreateCluster
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]
(Int -> ReadS CreateCluster)
-> ReadS [CreateCluster]
-> ReadPrec CreateCluster
-> ReadPrec [CreateCluster]
-> Read 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
(Int -> CreateCluster -> ShowS)
-> (CreateCluster -> String)
-> ([CreateCluster] -> ShowS)
-> Show CreateCluster
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. CreateCluster -> Rep CreateCluster x)
-> (forall x. Rep CreateCluster x -> CreateCluster)
-> Generic CreateCluster
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:
--
-- 'enhancedMonitoring', 'createCluster_enhancedMonitoring' - Specifies the level of monitoring for the MSK cluster. The possible
-- values are DEFAULT, PER_BROKER, PER_TOPIC_PER_BROKER, and
-- PER_TOPIC_PER_PARTITION.
--
-- 'openMonitoring', 'createCluster_openMonitoring' - The settings for open monitoring.
--
-- 'configurationInfo', 'createCluster_configurationInfo' - Represents the configuration that you want MSK to use for the brokers in
-- a cluster.
--
-- 'loggingInfo', 'createCluster_loggingInfo' - Undocumented member.
--
-- 'clientAuthentication', 'createCluster_clientAuthentication' - Includes all client authentication related information.
--
-- 'tags', 'createCluster_tags' - Create tags when creating the cluster.
--
-- 'encryptionInfo', 'createCluster_encryptionInfo' - Includes all encryption-related information.
--
-- 'brokerNodeGroupInfo', 'createCluster_brokerNodeGroupInfo' - Information about the broker nodes in the cluster.
--
-- 'kafkaVersion', 'createCluster_kafkaVersion' - The version of Apache Kafka.
--
-- 'numberOfBrokerNodes', 'createCluster_numberOfBrokerNodes' - The number of broker nodes in the cluster.
--
-- 'clusterName', 'createCluster_clusterName' - The name of the cluster.
newCreateCluster ::
  -- | 'brokerNodeGroupInfo'
  BrokerNodeGroupInfo ->
  -- | 'kafkaVersion'
  Prelude.Text ->
  -- | 'numberOfBrokerNodes'
  Prelude.Natural ->
  -- | 'clusterName'
  Prelude.Text ->
  CreateCluster
newCreateCluster :: BrokerNodeGroupInfo -> Text -> Natural -> Text -> CreateCluster
newCreateCluster
  BrokerNodeGroupInfo
pBrokerNodeGroupInfo_
  Text
pKafkaVersion_
  Natural
pNumberOfBrokerNodes_
  Text
pClusterName_ =
    CreateCluster' :: Maybe EnhancedMonitoring
-> Maybe OpenMonitoringInfo
-> Maybe ConfigurationInfo
-> Maybe LoggingInfo
-> Maybe ClientAuthentication
-> Maybe (HashMap Text Text)
-> Maybe EncryptionInfo
-> BrokerNodeGroupInfo
-> Text
-> Natural
-> Text
-> CreateCluster
CreateCluster'
      { $sel:enhancedMonitoring:CreateCluster' :: Maybe EnhancedMonitoring
enhancedMonitoring =
          Maybe EnhancedMonitoring
forall a. Maybe a
Prelude.Nothing,
        $sel:openMonitoring:CreateCluster' :: Maybe OpenMonitoringInfo
openMonitoring = Maybe OpenMonitoringInfo
forall a. Maybe a
Prelude.Nothing,
        $sel:configurationInfo:CreateCluster' :: Maybe ConfigurationInfo
configurationInfo = Maybe ConfigurationInfo
forall a. Maybe a
Prelude.Nothing,
        $sel:loggingInfo:CreateCluster' :: Maybe LoggingInfo
loggingInfo = Maybe LoggingInfo
forall a. Maybe a
Prelude.Nothing,
        $sel:clientAuthentication:CreateCluster' :: Maybe ClientAuthentication
clientAuthentication = Maybe ClientAuthentication
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateCluster' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:encryptionInfo:CreateCluster' :: Maybe EncryptionInfo
encryptionInfo = Maybe EncryptionInfo
forall a. Maybe a
Prelude.Nothing,
        $sel:brokerNodeGroupInfo:CreateCluster' :: BrokerNodeGroupInfo
brokerNodeGroupInfo = BrokerNodeGroupInfo
pBrokerNodeGroupInfo_,
        $sel:kafkaVersion:CreateCluster' :: Text
kafkaVersion = Text
pKafkaVersion_,
        $sel:numberOfBrokerNodes:CreateCluster' :: Natural
numberOfBrokerNodes = Natural
pNumberOfBrokerNodes_,
        $sel:clusterName:CreateCluster' :: Text
clusterName = Text
pClusterName_
      }

-- | Specifies the level of monitoring for the MSK cluster. The possible
-- values are DEFAULT, PER_BROKER, PER_TOPIC_PER_BROKER, and
-- PER_TOPIC_PER_PARTITION.
createCluster_enhancedMonitoring :: Lens.Lens' CreateCluster (Prelude.Maybe EnhancedMonitoring)
createCluster_enhancedMonitoring :: (Maybe EnhancedMonitoring -> f (Maybe EnhancedMonitoring))
-> CreateCluster -> f CreateCluster
createCluster_enhancedMonitoring = (CreateCluster -> Maybe EnhancedMonitoring)
-> (CreateCluster -> Maybe EnhancedMonitoring -> CreateCluster)
-> Lens
     CreateCluster
     CreateCluster
     (Maybe EnhancedMonitoring)
     (Maybe EnhancedMonitoring)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe EnhancedMonitoring
enhancedMonitoring :: Maybe EnhancedMonitoring
$sel:enhancedMonitoring:CreateCluster' :: CreateCluster -> Maybe EnhancedMonitoring
enhancedMonitoring} -> Maybe EnhancedMonitoring
enhancedMonitoring) (\s :: CreateCluster
s@CreateCluster' {} Maybe EnhancedMonitoring
a -> CreateCluster
s {$sel:enhancedMonitoring:CreateCluster' :: Maybe EnhancedMonitoring
enhancedMonitoring = Maybe EnhancedMonitoring
a} :: CreateCluster)

-- | The settings for open monitoring.
createCluster_openMonitoring :: Lens.Lens' CreateCluster (Prelude.Maybe OpenMonitoringInfo)
createCluster_openMonitoring :: (Maybe OpenMonitoringInfo -> f (Maybe OpenMonitoringInfo))
-> CreateCluster -> f CreateCluster
createCluster_openMonitoring = (CreateCluster -> Maybe OpenMonitoringInfo)
-> (CreateCluster -> Maybe OpenMonitoringInfo -> CreateCluster)
-> Lens
     CreateCluster
     CreateCluster
     (Maybe OpenMonitoringInfo)
     (Maybe OpenMonitoringInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe OpenMonitoringInfo
openMonitoring :: Maybe OpenMonitoringInfo
$sel:openMonitoring:CreateCluster' :: CreateCluster -> Maybe OpenMonitoringInfo
openMonitoring} -> Maybe OpenMonitoringInfo
openMonitoring) (\s :: CreateCluster
s@CreateCluster' {} Maybe OpenMonitoringInfo
a -> CreateCluster
s {$sel:openMonitoring:CreateCluster' :: Maybe OpenMonitoringInfo
openMonitoring = Maybe OpenMonitoringInfo
a} :: CreateCluster)

-- | Represents the configuration that you want MSK to use for the brokers in
-- a cluster.
createCluster_configurationInfo :: Lens.Lens' CreateCluster (Prelude.Maybe ConfigurationInfo)
createCluster_configurationInfo :: (Maybe ConfigurationInfo -> f (Maybe ConfigurationInfo))
-> CreateCluster -> f CreateCluster
createCluster_configurationInfo = (CreateCluster -> Maybe ConfigurationInfo)
-> (CreateCluster -> Maybe ConfigurationInfo -> CreateCluster)
-> Lens
     CreateCluster
     CreateCluster
     (Maybe ConfigurationInfo)
     (Maybe ConfigurationInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe ConfigurationInfo
configurationInfo :: Maybe ConfigurationInfo
$sel:configurationInfo:CreateCluster' :: CreateCluster -> Maybe ConfigurationInfo
configurationInfo} -> Maybe ConfigurationInfo
configurationInfo) (\s :: CreateCluster
s@CreateCluster' {} Maybe ConfigurationInfo
a -> CreateCluster
s {$sel:configurationInfo:CreateCluster' :: Maybe ConfigurationInfo
configurationInfo = Maybe ConfigurationInfo
a} :: CreateCluster)

-- | Undocumented member.
createCluster_loggingInfo :: Lens.Lens' CreateCluster (Prelude.Maybe LoggingInfo)
createCluster_loggingInfo :: (Maybe LoggingInfo -> f (Maybe LoggingInfo))
-> CreateCluster -> f CreateCluster
createCluster_loggingInfo = (CreateCluster -> Maybe LoggingInfo)
-> (CreateCluster -> Maybe LoggingInfo -> CreateCluster)
-> Lens
     CreateCluster CreateCluster (Maybe LoggingInfo) (Maybe LoggingInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe LoggingInfo
loggingInfo :: Maybe LoggingInfo
$sel:loggingInfo:CreateCluster' :: CreateCluster -> Maybe LoggingInfo
loggingInfo} -> Maybe LoggingInfo
loggingInfo) (\s :: CreateCluster
s@CreateCluster' {} Maybe LoggingInfo
a -> CreateCluster
s {$sel:loggingInfo:CreateCluster' :: Maybe LoggingInfo
loggingInfo = Maybe LoggingInfo
a} :: CreateCluster)

-- | Includes all client authentication related information.
createCluster_clientAuthentication :: Lens.Lens' CreateCluster (Prelude.Maybe ClientAuthentication)
createCluster_clientAuthentication :: (Maybe ClientAuthentication -> f (Maybe ClientAuthentication))
-> CreateCluster -> f CreateCluster
createCluster_clientAuthentication = (CreateCluster -> Maybe ClientAuthentication)
-> (CreateCluster -> Maybe ClientAuthentication -> CreateCluster)
-> Lens
     CreateCluster
     CreateCluster
     (Maybe ClientAuthentication)
     (Maybe ClientAuthentication)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe ClientAuthentication
clientAuthentication :: Maybe ClientAuthentication
$sel:clientAuthentication:CreateCluster' :: CreateCluster -> Maybe ClientAuthentication
clientAuthentication} -> Maybe ClientAuthentication
clientAuthentication) (\s :: CreateCluster
s@CreateCluster' {} Maybe ClientAuthentication
a -> CreateCluster
s {$sel:clientAuthentication:CreateCluster' :: Maybe ClientAuthentication
clientAuthentication = Maybe ClientAuthentication
a} :: CreateCluster)

-- | Create tags when creating the cluster.
createCluster_tags :: Lens.Lens' CreateCluster (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createCluster_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateCluster -> f CreateCluster
createCluster_tags = (CreateCluster -> Maybe (HashMap Text Text))
-> (CreateCluster -> Maybe (HashMap Text Text) -> CreateCluster)
-> Lens
     CreateCluster
     CreateCluster
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateCluster -> f CreateCluster)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateCluster
-> f CreateCluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Includes all encryption-related information.
createCluster_encryptionInfo :: Lens.Lens' CreateCluster (Prelude.Maybe EncryptionInfo)
createCluster_encryptionInfo :: (Maybe EncryptionInfo -> f (Maybe EncryptionInfo))
-> CreateCluster -> f CreateCluster
createCluster_encryptionInfo = (CreateCluster -> Maybe EncryptionInfo)
-> (CreateCluster -> Maybe EncryptionInfo -> CreateCluster)
-> Lens
     CreateCluster
     CreateCluster
     (Maybe EncryptionInfo)
     (Maybe EncryptionInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Maybe EncryptionInfo
encryptionInfo :: Maybe EncryptionInfo
$sel:encryptionInfo:CreateCluster' :: CreateCluster -> Maybe EncryptionInfo
encryptionInfo} -> Maybe EncryptionInfo
encryptionInfo) (\s :: CreateCluster
s@CreateCluster' {} Maybe EncryptionInfo
a -> CreateCluster
s {$sel:encryptionInfo:CreateCluster' :: Maybe EncryptionInfo
encryptionInfo = Maybe EncryptionInfo
a} :: CreateCluster)

-- | Information about the broker nodes in the cluster.
createCluster_brokerNodeGroupInfo :: Lens.Lens' CreateCluster BrokerNodeGroupInfo
createCluster_brokerNodeGroupInfo :: (BrokerNodeGroupInfo -> f BrokerNodeGroupInfo)
-> CreateCluster -> f CreateCluster
createCluster_brokerNodeGroupInfo = (CreateCluster -> BrokerNodeGroupInfo)
-> (CreateCluster -> BrokerNodeGroupInfo -> CreateCluster)
-> Lens
     CreateCluster CreateCluster BrokerNodeGroupInfo BrokerNodeGroupInfo
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {BrokerNodeGroupInfo
brokerNodeGroupInfo :: BrokerNodeGroupInfo
$sel:brokerNodeGroupInfo:CreateCluster' :: CreateCluster -> BrokerNodeGroupInfo
brokerNodeGroupInfo} -> BrokerNodeGroupInfo
brokerNodeGroupInfo) (\s :: CreateCluster
s@CreateCluster' {} BrokerNodeGroupInfo
a -> CreateCluster
s {$sel:brokerNodeGroupInfo:CreateCluster' :: BrokerNodeGroupInfo
brokerNodeGroupInfo = BrokerNodeGroupInfo
a} :: CreateCluster)

-- | The version of Apache Kafka.
createCluster_kafkaVersion :: Lens.Lens' CreateCluster Prelude.Text
createCluster_kafkaVersion :: (Text -> f Text) -> CreateCluster -> f CreateCluster
createCluster_kafkaVersion = (CreateCluster -> Text)
-> (CreateCluster -> Text -> CreateCluster)
-> Lens CreateCluster CreateCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Text
kafkaVersion :: Text
$sel:kafkaVersion:CreateCluster' :: CreateCluster -> Text
kafkaVersion} -> Text
kafkaVersion) (\s :: CreateCluster
s@CreateCluster' {} Text
a -> CreateCluster
s {$sel:kafkaVersion:CreateCluster' :: Text
kafkaVersion = Text
a} :: CreateCluster)

-- | The number of broker nodes in the cluster.
createCluster_numberOfBrokerNodes :: Lens.Lens' CreateCluster Prelude.Natural
createCluster_numberOfBrokerNodes :: (Natural -> f Natural) -> CreateCluster -> f CreateCluster
createCluster_numberOfBrokerNodes = (CreateCluster -> Natural)
-> (CreateCluster -> Natural -> CreateCluster)
-> Lens CreateCluster CreateCluster Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCluster' {Natural
numberOfBrokerNodes :: Natural
$sel:numberOfBrokerNodes:CreateCluster' :: CreateCluster -> Natural
numberOfBrokerNodes} -> Natural
numberOfBrokerNodes) (\s :: CreateCluster
s@CreateCluster' {} Natural
a -> CreateCluster
s {$sel:numberOfBrokerNodes:CreateCluster' :: Natural
numberOfBrokerNodes = Natural
a} :: CreateCluster)

-- | The name of the cluster.
createCluster_clusterName :: Lens.Lens' CreateCluster Prelude.Text
createCluster_clusterName :: (Text -> f Text) -> CreateCluster -> f CreateCluster
createCluster_clusterName = (CreateCluster -> Text)
-> (CreateCluster -> Text -> CreateCluster)
-> Lens CreateCluster CreateCluster Text Text
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)

instance Core.AWSRequest CreateCluster where
  type
    AWSResponse CreateCluster =
      CreateClusterResponse
  request :: CreateCluster -> Request CreateCluster
request = Service -> CreateCluster -> Request CreateCluster
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCluster)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateCluster))
-> Logger
-> Service
-> Proxy CreateCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateCluster)))
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 ClusterState
-> Maybe Text -> Maybe Text -> Int -> CreateClusterResponse
CreateClusterResponse'
            (Maybe ClusterState
 -> Maybe Text -> Maybe Text -> Int -> CreateClusterResponse)
-> Either String (Maybe ClusterState)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> CreateClusterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ClusterState)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"state")
            Either
  String (Maybe Text -> Maybe Text -> Int -> CreateClusterResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateClusterResponse)
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
"clusterArn")
            Either String (Maybe Text -> Int -> CreateClusterResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateClusterResponse)
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
"clusterName")
            Either String (Int -> CreateClusterResponse)
-> Either String Int -> Either String CreateClusterResponse
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 CreateCluster

instance Prelude.NFData CreateCluster

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

instance Core.ToJSON CreateCluster where
  toJSON :: CreateCluster -> Value
toJSON CreateCluster' {Natural
Maybe (HashMap Text Text)
Maybe ConfigurationInfo
Maybe EncryptionInfo
Maybe EnhancedMonitoring
Maybe OpenMonitoringInfo
Maybe LoggingInfo
Maybe ClientAuthentication
Text
BrokerNodeGroupInfo
clusterName :: Text
numberOfBrokerNodes :: Natural
kafkaVersion :: Text
brokerNodeGroupInfo :: BrokerNodeGroupInfo
encryptionInfo :: Maybe EncryptionInfo
tags :: Maybe (HashMap Text Text)
clientAuthentication :: Maybe ClientAuthentication
loggingInfo :: Maybe LoggingInfo
configurationInfo :: Maybe ConfigurationInfo
openMonitoring :: Maybe OpenMonitoringInfo
enhancedMonitoring :: Maybe EnhancedMonitoring
$sel:clusterName:CreateCluster' :: CreateCluster -> Text
$sel:numberOfBrokerNodes:CreateCluster' :: CreateCluster -> Natural
$sel:kafkaVersion:CreateCluster' :: CreateCluster -> Text
$sel:brokerNodeGroupInfo:CreateCluster' :: CreateCluster -> BrokerNodeGroupInfo
$sel:encryptionInfo:CreateCluster' :: CreateCluster -> Maybe EncryptionInfo
$sel:tags:CreateCluster' :: CreateCluster -> Maybe (HashMap Text Text)
$sel:clientAuthentication:CreateCluster' :: CreateCluster -> Maybe ClientAuthentication
$sel:loggingInfo:CreateCluster' :: CreateCluster -> Maybe LoggingInfo
$sel:configurationInfo:CreateCluster' :: CreateCluster -> Maybe ConfigurationInfo
$sel:openMonitoring:CreateCluster' :: CreateCluster -> Maybe OpenMonitoringInfo
$sel:enhancedMonitoring:CreateCluster' :: CreateCluster -> Maybe EnhancedMonitoring
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"enhancedMonitoring" Text -> EnhancedMonitoring -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EnhancedMonitoring -> Pair)
-> Maybe EnhancedMonitoring -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EnhancedMonitoring
enhancedMonitoring,
            (Text
"openMonitoring" Text -> OpenMonitoringInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (OpenMonitoringInfo -> Pair)
-> Maybe OpenMonitoringInfo -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OpenMonitoringInfo
openMonitoring,
            (Text
"configurationInfo" Text -> ConfigurationInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConfigurationInfo -> Pair)
-> Maybe ConfigurationInfo -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConfigurationInfo
configurationInfo,
            (Text
"loggingInfo" Text -> LoggingInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LoggingInfo -> Pair) -> Maybe LoggingInfo -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LoggingInfo
loggingInfo,
            (Text
"clientAuthentication" Text -> ClientAuthentication -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ClientAuthentication -> Pair)
-> Maybe ClientAuthentication -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ClientAuthentication
clientAuthentication,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            (Text
"encryptionInfo" Text -> EncryptionInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EncryptionInfo -> Pair) -> Maybe EncryptionInfo -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncryptionInfo
encryptionInfo,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"brokerNodeGroupInfo" Text -> BrokerNodeGroupInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BrokerNodeGroupInfo
brokerNodeGroupInfo),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"kafkaVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
kafkaVersion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"numberOfBrokerNodes" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
numberOfBrokerNodes),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"clusterName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clusterName)
          ]
      )

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

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

-- | /See:/ 'newCreateClusterResponse' smart constructor.
data CreateClusterResponse = CreateClusterResponse'
  { -- | The state of the cluster. The possible states are ACTIVE, CREATING,
    -- DELETING, FAILED, HEALING, MAINTENANCE, REBOOTING_BROKER, and UPDATING.
    CreateClusterResponse -> Maybe ClusterState
state :: Prelude.Maybe ClusterState,
    -- | The Amazon Resource Name (ARN) of the cluster.
    CreateClusterResponse -> Maybe Text
clusterArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the MSK cluster.
    CreateClusterResponse -> Maybe Text
clusterName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateClusterResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateClusterResponse -> CreateClusterResponse -> Bool
(CreateClusterResponse -> CreateClusterResponse -> Bool)
-> (CreateClusterResponse -> CreateClusterResponse -> Bool)
-> Eq CreateClusterResponse
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]
(Int -> ReadS CreateClusterResponse)
-> ReadS [CreateClusterResponse]
-> ReadPrec CreateClusterResponse
-> ReadPrec [CreateClusterResponse]
-> Read 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
(Int -> CreateClusterResponse -> ShowS)
-> (CreateClusterResponse -> String)
-> ([CreateClusterResponse] -> ShowS)
-> Show CreateClusterResponse
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. CreateClusterResponse -> Rep CreateClusterResponse x)
-> (forall x. Rep CreateClusterResponse x -> CreateClusterResponse)
-> Generic CreateClusterResponse
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:
--
-- 'state', 'createClusterResponse_state' - The state of the cluster. The possible states are ACTIVE, CREATING,
-- DELETING, FAILED, HEALING, MAINTENANCE, REBOOTING_BROKER, and UPDATING.
--
-- 'clusterArn', 'createClusterResponse_clusterArn' - The Amazon Resource Name (ARN) of the cluster.
--
-- 'clusterName', 'createClusterResponse_clusterName' - The name of the MSK cluster.
--
-- 'httpStatus', 'createClusterResponse_httpStatus' - The response's http status code.
newCreateClusterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateClusterResponse
newCreateClusterResponse :: Int -> CreateClusterResponse
newCreateClusterResponse Int
pHttpStatus_ =
  CreateClusterResponse' :: Maybe ClusterState
-> Maybe Text -> Maybe Text -> Int -> CreateClusterResponse
CreateClusterResponse'
    { $sel:state:CreateClusterResponse' :: Maybe ClusterState
state = Maybe ClusterState
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterArn:CreateClusterResponse' :: Maybe Text
clusterArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterName:CreateClusterResponse' :: Maybe Text
clusterName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The state of the cluster. The possible states are ACTIVE, CREATING,
-- DELETING, FAILED, HEALING, MAINTENANCE, REBOOTING_BROKER, and UPDATING.
createClusterResponse_state :: Lens.Lens' CreateClusterResponse (Prelude.Maybe ClusterState)
createClusterResponse_state :: (Maybe ClusterState -> f (Maybe ClusterState))
-> CreateClusterResponse -> f CreateClusterResponse
createClusterResponse_state = (CreateClusterResponse -> Maybe ClusterState)
-> (CreateClusterResponse
    -> Maybe ClusterState -> CreateClusterResponse)
-> Lens
     CreateClusterResponse
     CreateClusterResponse
     (Maybe ClusterState)
     (Maybe ClusterState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateClusterResponse' {Maybe ClusterState
state :: Maybe ClusterState
$sel:state:CreateClusterResponse' :: CreateClusterResponse -> Maybe ClusterState
state} -> Maybe ClusterState
state) (\s :: CreateClusterResponse
s@CreateClusterResponse' {} Maybe ClusterState
a -> CreateClusterResponse
s {$sel:state:CreateClusterResponse' :: Maybe ClusterState
state = Maybe ClusterState
a} :: CreateClusterResponse)

-- | The Amazon Resource Name (ARN) of the cluster.
createClusterResponse_clusterArn :: Lens.Lens' CreateClusterResponse (Prelude.Maybe Prelude.Text)
createClusterResponse_clusterArn :: (Maybe Text -> f (Maybe Text))
-> CreateClusterResponse -> f CreateClusterResponse
createClusterResponse_clusterArn = (CreateClusterResponse -> Maybe Text)
-> (CreateClusterResponse -> Maybe Text -> CreateClusterResponse)
-> Lens
     CreateClusterResponse
     CreateClusterResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateClusterResponse' {Maybe Text
clusterArn :: Maybe Text
$sel:clusterArn:CreateClusterResponse' :: CreateClusterResponse -> Maybe Text
clusterArn} -> Maybe Text
clusterArn) (\s :: CreateClusterResponse
s@CreateClusterResponse' {} Maybe Text
a -> CreateClusterResponse
s {$sel:clusterArn:CreateClusterResponse' :: Maybe Text
clusterArn = Maybe Text
a} :: CreateClusterResponse)

-- | The name of the MSK cluster.
createClusterResponse_clusterName :: Lens.Lens' CreateClusterResponse (Prelude.Maybe Prelude.Text)
createClusterResponse_clusterName :: (Maybe Text -> f (Maybe Text))
-> CreateClusterResponse -> f CreateClusterResponse
createClusterResponse_clusterName = (CreateClusterResponse -> Maybe Text)
-> (CreateClusterResponse -> Maybe Text -> CreateClusterResponse)
-> Lens
     CreateClusterResponse
     CreateClusterResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateClusterResponse' {Maybe Text
clusterName :: Maybe Text
$sel:clusterName:CreateClusterResponse' :: CreateClusterResponse -> Maybe Text
clusterName} -> Maybe Text
clusterName) (\s :: CreateClusterResponse
s@CreateClusterResponse' {} Maybe Text
a -> CreateClusterResponse
s {$sel:clusterName:CreateClusterResponse' :: Maybe Text
clusterName = Maybe Text
a} :: CreateClusterResponse)

-- | The response's http status code.
createClusterResponse_httpStatus :: Lens.Lens' CreateClusterResponse Prelude.Int
createClusterResponse_httpStatus :: (Int -> f Int) -> CreateClusterResponse -> f CreateClusterResponse
createClusterResponse_httpStatus = (CreateClusterResponse -> Int)
-> (CreateClusterResponse -> Int -> CreateClusterResponse)
-> Lens CreateClusterResponse CreateClusterResponse Int Int
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