{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

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

-- |
-- Module      : Amazonka.KafkaConnect.Types.ApacheKafkaCluster
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KafkaConnect.Types.ApacheKafkaCluster where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KafkaConnect.Types.Vpc
import qualified Amazonka.Prelude as Prelude

-- | The details of the Apache Kafka cluster to which the connector is
-- connected.
--
-- /See:/ 'newApacheKafkaCluster' smart constructor.
data ApacheKafkaCluster = ApacheKafkaCluster'
  { -- | The bootstrap servers of the cluster.
    ApacheKafkaCluster -> Text
bootstrapServers :: Prelude.Text,
    -- | Details of an Amazon VPC which has network connectivity to the Apache
    -- Kafka cluster.
    ApacheKafkaCluster -> Vpc
vpc :: Vpc
  }
  deriving (ApacheKafkaCluster -> ApacheKafkaCluster -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApacheKafkaCluster -> ApacheKafkaCluster -> Bool
$c/= :: ApacheKafkaCluster -> ApacheKafkaCluster -> Bool
== :: ApacheKafkaCluster -> ApacheKafkaCluster -> Bool
$c== :: ApacheKafkaCluster -> ApacheKafkaCluster -> Bool
Prelude.Eq, ReadPrec [ApacheKafkaCluster]
ReadPrec ApacheKafkaCluster
Int -> ReadS ApacheKafkaCluster
ReadS [ApacheKafkaCluster]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApacheKafkaCluster]
$creadListPrec :: ReadPrec [ApacheKafkaCluster]
readPrec :: ReadPrec ApacheKafkaCluster
$creadPrec :: ReadPrec ApacheKafkaCluster
readList :: ReadS [ApacheKafkaCluster]
$creadList :: ReadS [ApacheKafkaCluster]
readsPrec :: Int -> ReadS ApacheKafkaCluster
$creadsPrec :: Int -> ReadS ApacheKafkaCluster
Prelude.Read, Int -> ApacheKafkaCluster -> ShowS
[ApacheKafkaCluster] -> ShowS
ApacheKafkaCluster -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApacheKafkaCluster] -> ShowS
$cshowList :: [ApacheKafkaCluster] -> ShowS
show :: ApacheKafkaCluster -> String
$cshow :: ApacheKafkaCluster -> String
showsPrec :: Int -> ApacheKafkaCluster -> ShowS
$cshowsPrec :: Int -> ApacheKafkaCluster -> ShowS
Prelude.Show, forall x. Rep ApacheKafkaCluster x -> ApacheKafkaCluster
forall x. ApacheKafkaCluster -> Rep ApacheKafkaCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApacheKafkaCluster x -> ApacheKafkaCluster
$cfrom :: forall x. ApacheKafkaCluster -> Rep ApacheKafkaCluster x
Prelude.Generic)

-- |
-- Create a value of 'ApacheKafkaCluster' 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:
--
-- 'bootstrapServers', 'apacheKafkaCluster_bootstrapServers' - The bootstrap servers of the cluster.
--
-- 'vpc', 'apacheKafkaCluster_vpc' - Details of an Amazon VPC which has network connectivity to the Apache
-- Kafka cluster.
newApacheKafkaCluster ::
  -- | 'bootstrapServers'
  Prelude.Text ->
  -- | 'vpc'
  Vpc ->
  ApacheKafkaCluster
newApacheKafkaCluster :: Text -> Vpc -> ApacheKafkaCluster
newApacheKafkaCluster Text
pBootstrapServers_ Vpc
pVpc_ =
  ApacheKafkaCluster'
    { $sel:bootstrapServers:ApacheKafkaCluster' :: Text
bootstrapServers =
        Text
pBootstrapServers_,
      $sel:vpc:ApacheKafkaCluster' :: Vpc
vpc = Vpc
pVpc_
    }

-- | The bootstrap servers of the cluster.
apacheKafkaCluster_bootstrapServers :: Lens.Lens' ApacheKafkaCluster Prelude.Text
apacheKafkaCluster_bootstrapServers :: Lens' ApacheKafkaCluster Text
apacheKafkaCluster_bootstrapServers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApacheKafkaCluster' {Text
bootstrapServers :: Text
$sel:bootstrapServers:ApacheKafkaCluster' :: ApacheKafkaCluster -> Text
bootstrapServers} -> Text
bootstrapServers) (\s :: ApacheKafkaCluster
s@ApacheKafkaCluster' {} Text
a -> ApacheKafkaCluster
s {$sel:bootstrapServers:ApacheKafkaCluster' :: Text
bootstrapServers = Text
a} :: ApacheKafkaCluster)

-- | Details of an Amazon VPC which has network connectivity to the Apache
-- Kafka cluster.
apacheKafkaCluster_vpc :: Lens.Lens' ApacheKafkaCluster Vpc
apacheKafkaCluster_vpc :: Lens' ApacheKafkaCluster Vpc
apacheKafkaCluster_vpc = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApacheKafkaCluster' {Vpc
vpc :: Vpc
$sel:vpc:ApacheKafkaCluster' :: ApacheKafkaCluster -> Vpc
vpc} -> Vpc
vpc) (\s :: ApacheKafkaCluster
s@ApacheKafkaCluster' {} Vpc
a -> ApacheKafkaCluster
s {$sel:vpc:ApacheKafkaCluster' :: Vpc
vpc = Vpc
a} :: ApacheKafkaCluster)

instance Prelude.Hashable ApacheKafkaCluster where
  hashWithSalt :: Int -> ApacheKafkaCluster -> Int
hashWithSalt Int
_salt ApacheKafkaCluster' {Text
Vpc
vpc :: Vpc
bootstrapServers :: Text
$sel:vpc:ApacheKafkaCluster' :: ApacheKafkaCluster -> Vpc
$sel:bootstrapServers:ApacheKafkaCluster' :: ApacheKafkaCluster -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bootstrapServers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Vpc
vpc

instance Prelude.NFData ApacheKafkaCluster where
  rnf :: ApacheKafkaCluster -> ()
rnf ApacheKafkaCluster' {Text
Vpc
vpc :: Vpc
bootstrapServers :: Text
$sel:vpc:ApacheKafkaCluster' :: ApacheKafkaCluster -> Vpc
$sel:bootstrapServers:ApacheKafkaCluster' :: ApacheKafkaCluster -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
bootstrapServers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Vpc
vpc

instance Data.ToJSON ApacheKafkaCluster where
  toJSON :: ApacheKafkaCluster -> Value
toJSON ApacheKafkaCluster' {Text
Vpc
vpc :: Vpc
bootstrapServers :: Text
$sel:vpc:ApacheKafkaCluster' :: ApacheKafkaCluster -> Vpc
$sel:bootstrapServers:ApacheKafkaCluster' :: ApacheKafkaCluster -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"bootstrapServers" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bootstrapServers),
            forall a. a -> Maybe a
Prelude.Just (Key
"vpc" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Vpc
vpc)
          ]
      )