{-# 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-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)
module Amazonka.KafkaConnect.Types.ApacheKafkaCluster where

import qualified Amazonka.Core as Core
import Amazonka.KafkaConnect.Types.Vpc
import qualified Amazonka.Lens as Lens
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
(ApacheKafkaCluster -> ApacheKafkaCluster -> Bool)
-> (ApacheKafkaCluster -> ApacheKafkaCluster -> Bool)
-> Eq ApacheKafkaCluster
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]
(Int -> ReadS ApacheKafkaCluster)
-> ReadS [ApacheKafkaCluster]
-> ReadPrec ApacheKafkaCluster
-> ReadPrec [ApacheKafkaCluster]
-> Read 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
(Int -> ApacheKafkaCluster -> ShowS)
-> (ApacheKafkaCluster -> String)
-> ([ApacheKafkaCluster] -> ShowS)
-> Show ApacheKafkaCluster
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. ApacheKafkaCluster -> Rep ApacheKafkaCluster x)
-> (forall x. Rep ApacheKafkaCluster x -> ApacheKafkaCluster)
-> Generic ApacheKafkaCluster
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' :: Text -> Vpc -> ApacheKafkaCluster
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 :: (Text -> f Text) -> ApacheKafkaCluster -> f ApacheKafkaCluster
apacheKafkaCluster_bootstrapServers = (ApacheKafkaCluster -> Text)
-> (ApacheKafkaCluster -> Text -> ApacheKafkaCluster)
-> Lens ApacheKafkaCluster ApacheKafkaCluster Text Text
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 :: (Vpc -> f Vpc) -> ApacheKafkaCluster -> f ApacheKafkaCluster
apacheKafkaCluster_vpc = (ApacheKafkaCluster -> Vpc)
-> (ApacheKafkaCluster -> Vpc -> ApacheKafkaCluster)
-> Lens ApacheKafkaCluster ApacheKafkaCluster Vpc 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

instance Prelude.NFData ApacheKafkaCluster

instance Core.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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"bootstrapServers" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bootstrapServers),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"vpc" Text -> Vpc -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Vpc
vpc)
          ]
      )