{-# 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.Lambda.Types.AmazonManagedKafkaEventSourceConfig
-- 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.Lambda.Types.AmazonManagedKafkaEventSourceConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Specific configuration settings for an Amazon Managed Streaming for
-- Apache Kafka (Amazon MSK) event source.
--
-- /See:/ 'newAmazonManagedKafkaEventSourceConfig' smart constructor.
data AmazonManagedKafkaEventSourceConfig = AmazonManagedKafkaEventSourceConfig'
  { -- | The identifier for the Kafka consumer group to join. The consumer group
    -- ID must be unique among all your Kafka event sources. After creating a
    -- Kafka event source mapping with the consumer group ID specified, you
    -- cannot update this value. For more information, see
    -- <https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-consumer-group-id Customizable consumer group ID>.
    AmazonManagedKafkaEventSourceConfig -> Maybe Text
consumerGroupId :: Prelude.Maybe Prelude.Text
  }
  deriving (AmazonManagedKafkaEventSourceConfig
-> AmazonManagedKafkaEventSourceConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AmazonManagedKafkaEventSourceConfig
-> AmazonManagedKafkaEventSourceConfig -> Bool
$c/= :: AmazonManagedKafkaEventSourceConfig
-> AmazonManagedKafkaEventSourceConfig -> Bool
== :: AmazonManagedKafkaEventSourceConfig
-> AmazonManagedKafkaEventSourceConfig -> Bool
$c== :: AmazonManagedKafkaEventSourceConfig
-> AmazonManagedKafkaEventSourceConfig -> Bool
Prelude.Eq, ReadPrec [AmazonManagedKafkaEventSourceConfig]
ReadPrec AmazonManagedKafkaEventSourceConfig
Int -> ReadS AmazonManagedKafkaEventSourceConfig
ReadS [AmazonManagedKafkaEventSourceConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AmazonManagedKafkaEventSourceConfig]
$creadListPrec :: ReadPrec [AmazonManagedKafkaEventSourceConfig]
readPrec :: ReadPrec AmazonManagedKafkaEventSourceConfig
$creadPrec :: ReadPrec AmazonManagedKafkaEventSourceConfig
readList :: ReadS [AmazonManagedKafkaEventSourceConfig]
$creadList :: ReadS [AmazonManagedKafkaEventSourceConfig]
readsPrec :: Int -> ReadS AmazonManagedKafkaEventSourceConfig
$creadsPrec :: Int -> ReadS AmazonManagedKafkaEventSourceConfig
Prelude.Read, Int -> AmazonManagedKafkaEventSourceConfig -> ShowS
[AmazonManagedKafkaEventSourceConfig] -> ShowS
AmazonManagedKafkaEventSourceConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AmazonManagedKafkaEventSourceConfig] -> ShowS
$cshowList :: [AmazonManagedKafkaEventSourceConfig] -> ShowS
show :: AmazonManagedKafkaEventSourceConfig -> String
$cshow :: AmazonManagedKafkaEventSourceConfig -> String
showsPrec :: Int -> AmazonManagedKafkaEventSourceConfig -> ShowS
$cshowsPrec :: Int -> AmazonManagedKafkaEventSourceConfig -> ShowS
Prelude.Show, forall x.
Rep AmazonManagedKafkaEventSourceConfig x
-> AmazonManagedKafkaEventSourceConfig
forall x.
AmazonManagedKafkaEventSourceConfig
-> Rep AmazonManagedKafkaEventSourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AmazonManagedKafkaEventSourceConfig x
-> AmazonManagedKafkaEventSourceConfig
$cfrom :: forall x.
AmazonManagedKafkaEventSourceConfig
-> Rep AmazonManagedKafkaEventSourceConfig x
Prelude.Generic)

-- |
-- Create a value of 'AmazonManagedKafkaEventSourceConfig' 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:
--
-- 'consumerGroupId', 'amazonManagedKafkaEventSourceConfig_consumerGroupId' - The identifier for the Kafka consumer group to join. The consumer group
-- ID must be unique among all your Kafka event sources. After creating a
-- Kafka event source mapping with the consumer group ID specified, you
-- cannot update this value. For more information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-consumer-group-id Customizable consumer group ID>.
newAmazonManagedKafkaEventSourceConfig ::
  AmazonManagedKafkaEventSourceConfig
newAmazonManagedKafkaEventSourceConfig :: AmazonManagedKafkaEventSourceConfig
newAmazonManagedKafkaEventSourceConfig =
  AmazonManagedKafkaEventSourceConfig'
    { $sel:consumerGroupId:AmazonManagedKafkaEventSourceConfig' :: Maybe Text
consumerGroupId =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier for the Kafka consumer group to join. The consumer group
-- ID must be unique among all your Kafka event sources. After creating a
-- Kafka event source mapping with the consumer group ID specified, you
-- cannot update this value. For more information, see
-- <https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-consumer-group-id Customizable consumer group ID>.
amazonManagedKafkaEventSourceConfig_consumerGroupId :: Lens.Lens' AmazonManagedKafkaEventSourceConfig (Prelude.Maybe Prelude.Text)
amazonManagedKafkaEventSourceConfig_consumerGroupId :: Lens' AmazonManagedKafkaEventSourceConfig (Maybe Text)
amazonManagedKafkaEventSourceConfig_consumerGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AmazonManagedKafkaEventSourceConfig' {Maybe Text
consumerGroupId :: Maybe Text
$sel:consumerGroupId:AmazonManagedKafkaEventSourceConfig' :: AmazonManagedKafkaEventSourceConfig -> Maybe Text
consumerGroupId} -> Maybe Text
consumerGroupId) (\s :: AmazonManagedKafkaEventSourceConfig
s@AmazonManagedKafkaEventSourceConfig' {} Maybe Text
a -> AmazonManagedKafkaEventSourceConfig
s {$sel:consumerGroupId:AmazonManagedKafkaEventSourceConfig' :: Maybe Text
consumerGroupId = Maybe Text
a} :: AmazonManagedKafkaEventSourceConfig)

instance
  Data.FromJSON
    AmazonManagedKafkaEventSourceConfig
  where
  parseJSON :: Value -> Parser AmazonManagedKafkaEventSourceConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AmazonManagedKafkaEventSourceConfig"
      ( \Object
x ->
          Maybe Text -> AmazonManagedKafkaEventSourceConfig
AmazonManagedKafkaEventSourceConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ConsumerGroupId")
      )

instance
  Prelude.Hashable
    AmazonManagedKafkaEventSourceConfig
  where
  hashWithSalt :: Int -> AmazonManagedKafkaEventSourceConfig -> Int
hashWithSalt
    Int
_salt
    AmazonManagedKafkaEventSourceConfig' {Maybe Text
consumerGroupId :: Maybe Text
$sel:consumerGroupId:AmazonManagedKafkaEventSourceConfig' :: AmazonManagedKafkaEventSourceConfig -> Maybe Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
consumerGroupId

instance
  Prelude.NFData
    AmazonManagedKafkaEventSourceConfig
  where
  rnf :: AmazonManagedKafkaEventSourceConfig -> ()
rnf AmazonManagedKafkaEventSourceConfig' {Maybe Text
consumerGroupId :: Maybe Text
$sel:consumerGroupId:AmazonManagedKafkaEventSourceConfig' :: AmazonManagedKafkaEventSourceConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
consumerGroupId

instance
  Data.ToJSON
    AmazonManagedKafkaEventSourceConfig
  where
  toJSON :: AmazonManagedKafkaEventSourceConfig -> Value
toJSON AmazonManagedKafkaEventSourceConfig' {Maybe Text
consumerGroupId :: Maybe Text
$sel:consumerGroupId:AmazonManagedKafkaEventSourceConfig' :: AmazonManagedKafkaEventSourceConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ConsumerGroupId" 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
consumerGroupId
          ]
      )