{-# 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.KafkaCluster
-- 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.KafkaCluster where

import qualified Amazonka.Core as Core
import Amazonka.KafkaConnect.Types.ApacheKafkaCluster
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:/ 'newKafkaCluster' smart constructor.
data KafkaCluster = KafkaCluster'
  { -- | The Apache Kafka cluster to which the connector is connected.
    KafkaCluster -> ApacheKafkaCluster
apacheKafkaCluster :: ApacheKafkaCluster
  }
  deriving (KafkaCluster -> KafkaCluster -> Bool
(KafkaCluster -> KafkaCluster -> Bool)
-> (KafkaCluster -> KafkaCluster -> Bool) -> Eq KafkaCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KafkaCluster -> KafkaCluster -> Bool
$c/= :: KafkaCluster -> KafkaCluster -> Bool
== :: KafkaCluster -> KafkaCluster -> Bool
$c== :: KafkaCluster -> KafkaCluster -> Bool
Prelude.Eq, ReadPrec [KafkaCluster]
ReadPrec KafkaCluster
Int -> ReadS KafkaCluster
ReadS [KafkaCluster]
(Int -> ReadS KafkaCluster)
-> ReadS [KafkaCluster]
-> ReadPrec KafkaCluster
-> ReadPrec [KafkaCluster]
-> Read KafkaCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KafkaCluster]
$creadListPrec :: ReadPrec [KafkaCluster]
readPrec :: ReadPrec KafkaCluster
$creadPrec :: ReadPrec KafkaCluster
readList :: ReadS [KafkaCluster]
$creadList :: ReadS [KafkaCluster]
readsPrec :: Int -> ReadS KafkaCluster
$creadsPrec :: Int -> ReadS KafkaCluster
Prelude.Read, Int -> KafkaCluster -> ShowS
[KafkaCluster] -> ShowS
KafkaCluster -> String
(Int -> KafkaCluster -> ShowS)
-> (KafkaCluster -> String)
-> ([KafkaCluster] -> ShowS)
-> Show KafkaCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KafkaCluster] -> ShowS
$cshowList :: [KafkaCluster] -> ShowS
show :: KafkaCluster -> String
$cshow :: KafkaCluster -> String
showsPrec :: Int -> KafkaCluster -> ShowS
$cshowsPrec :: Int -> KafkaCluster -> ShowS
Prelude.Show, (forall x. KafkaCluster -> Rep KafkaCluster x)
-> (forall x. Rep KafkaCluster x -> KafkaCluster)
-> Generic KafkaCluster
forall x. Rep KafkaCluster x -> KafkaCluster
forall x. KafkaCluster -> Rep KafkaCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KafkaCluster x -> KafkaCluster
$cfrom :: forall x. KafkaCluster -> Rep KafkaCluster x
Prelude.Generic)

-- |
-- Create a value of 'KafkaCluster' 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:
--
-- 'apacheKafkaCluster', 'kafkaCluster_apacheKafkaCluster' - The Apache Kafka cluster to which the connector is connected.
newKafkaCluster ::
  -- | 'apacheKafkaCluster'
  ApacheKafkaCluster ->
  KafkaCluster
newKafkaCluster :: ApacheKafkaCluster -> KafkaCluster
newKafkaCluster ApacheKafkaCluster
pApacheKafkaCluster_ =
  KafkaCluster' :: ApacheKafkaCluster -> KafkaCluster
KafkaCluster'
    { $sel:apacheKafkaCluster:KafkaCluster' :: ApacheKafkaCluster
apacheKafkaCluster =
        ApacheKafkaCluster
pApacheKafkaCluster_
    }

-- | The Apache Kafka cluster to which the connector is connected.
kafkaCluster_apacheKafkaCluster :: Lens.Lens' KafkaCluster ApacheKafkaCluster
kafkaCluster_apacheKafkaCluster :: (ApacheKafkaCluster -> f ApacheKafkaCluster)
-> KafkaCluster -> f KafkaCluster
kafkaCluster_apacheKafkaCluster = (KafkaCluster -> ApacheKafkaCluster)
-> (KafkaCluster -> ApacheKafkaCluster -> KafkaCluster)
-> Lens
     KafkaCluster KafkaCluster ApacheKafkaCluster ApacheKafkaCluster
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KafkaCluster' {ApacheKafkaCluster
apacheKafkaCluster :: ApacheKafkaCluster
$sel:apacheKafkaCluster:KafkaCluster' :: KafkaCluster -> ApacheKafkaCluster
apacheKafkaCluster} -> ApacheKafkaCluster
apacheKafkaCluster) (\s :: KafkaCluster
s@KafkaCluster' {} ApacheKafkaCluster
a -> KafkaCluster
s {$sel:apacheKafkaCluster:KafkaCluster' :: ApacheKafkaCluster
apacheKafkaCluster = ApacheKafkaCluster
a} :: KafkaCluster)

instance Prelude.Hashable KafkaCluster

instance Prelude.NFData KafkaCluster

instance Core.ToJSON KafkaCluster where
  toJSON :: KafkaCluster -> Value
toJSON KafkaCluster' {ApacheKafkaCluster
apacheKafkaCluster :: ApacheKafkaCluster
$sel:apacheKafkaCluster:KafkaCluster' :: KafkaCluster -> ApacheKafkaCluster
..} =
    [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
"apacheKafkaCluster" Text -> ApacheKafkaCluster -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ApacheKafkaCluster
apacheKafkaCluster)
          ]
      )