{-# 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.WorkerConfiguration
-- 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.WorkerConfiguration 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

-- | The configuration of the workers, which are the processes that run the
-- connector logic.
--
-- /See:/ 'newWorkerConfiguration' smart constructor.
data WorkerConfiguration = WorkerConfiguration'
  { -- | The revision of the worker configuration.
    WorkerConfiguration -> Natural
revision :: Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the worker configuration.
    WorkerConfiguration -> Text
workerConfigurationArn :: Prelude.Text
  }
  deriving (WorkerConfiguration -> WorkerConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkerConfiguration -> WorkerConfiguration -> Bool
$c/= :: WorkerConfiguration -> WorkerConfiguration -> Bool
== :: WorkerConfiguration -> WorkerConfiguration -> Bool
$c== :: WorkerConfiguration -> WorkerConfiguration -> Bool
Prelude.Eq, ReadPrec [WorkerConfiguration]
ReadPrec WorkerConfiguration
Int -> ReadS WorkerConfiguration
ReadS [WorkerConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkerConfiguration]
$creadListPrec :: ReadPrec [WorkerConfiguration]
readPrec :: ReadPrec WorkerConfiguration
$creadPrec :: ReadPrec WorkerConfiguration
readList :: ReadS [WorkerConfiguration]
$creadList :: ReadS [WorkerConfiguration]
readsPrec :: Int -> ReadS WorkerConfiguration
$creadsPrec :: Int -> ReadS WorkerConfiguration
Prelude.Read, Int -> WorkerConfiguration -> ShowS
[WorkerConfiguration] -> ShowS
WorkerConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkerConfiguration] -> ShowS
$cshowList :: [WorkerConfiguration] -> ShowS
show :: WorkerConfiguration -> String
$cshow :: WorkerConfiguration -> String
showsPrec :: Int -> WorkerConfiguration -> ShowS
$cshowsPrec :: Int -> WorkerConfiguration -> ShowS
Prelude.Show, forall x. Rep WorkerConfiguration x -> WorkerConfiguration
forall x. WorkerConfiguration -> Rep WorkerConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkerConfiguration x -> WorkerConfiguration
$cfrom :: forall x. WorkerConfiguration -> Rep WorkerConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'WorkerConfiguration' 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:
--
-- 'revision', 'workerConfiguration_revision' - The revision of the worker configuration.
--
-- 'workerConfigurationArn', 'workerConfiguration_workerConfigurationArn' - The Amazon Resource Name (ARN) of the worker configuration.
newWorkerConfiguration ::
  -- | 'revision'
  Prelude.Natural ->
  -- | 'workerConfigurationArn'
  Prelude.Text ->
  WorkerConfiguration
newWorkerConfiguration :: Natural -> Text -> WorkerConfiguration
newWorkerConfiguration
  Natural
pRevision_
  Text
pWorkerConfigurationArn_ =
    WorkerConfiguration'
      { $sel:revision:WorkerConfiguration' :: Natural
revision = Natural
pRevision_,
        $sel:workerConfigurationArn:WorkerConfiguration' :: Text
workerConfigurationArn = Text
pWorkerConfigurationArn_
      }

-- | The revision of the worker configuration.
workerConfiguration_revision :: Lens.Lens' WorkerConfiguration Prelude.Natural
workerConfiguration_revision :: Lens' WorkerConfiguration Natural
workerConfiguration_revision = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkerConfiguration' {Natural
revision :: Natural
$sel:revision:WorkerConfiguration' :: WorkerConfiguration -> Natural
revision} -> Natural
revision) (\s :: WorkerConfiguration
s@WorkerConfiguration' {} Natural
a -> WorkerConfiguration
s {$sel:revision:WorkerConfiguration' :: Natural
revision = Natural
a} :: WorkerConfiguration)

-- | The Amazon Resource Name (ARN) of the worker configuration.
workerConfiguration_workerConfigurationArn :: Lens.Lens' WorkerConfiguration Prelude.Text
workerConfiguration_workerConfigurationArn :: Lens' WorkerConfiguration Text
workerConfiguration_workerConfigurationArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkerConfiguration' {Text
workerConfigurationArn :: Text
$sel:workerConfigurationArn:WorkerConfiguration' :: WorkerConfiguration -> Text
workerConfigurationArn} -> Text
workerConfigurationArn) (\s :: WorkerConfiguration
s@WorkerConfiguration' {} Text
a -> WorkerConfiguration
s {$sel:workerConfigurationArn:WorkerConfiguration' :: Text
workerConfigurationArn = Text
a} :: WorkerConfiguration)

instance Prelude.Hashable WorkerConfiguration where
  hashWithSalt :: Int -> WorkerConfiguration -> Int
hashWithSalt Int
_salt WorkerConfiguration' {Natural
Text
workerConfigurationArn :: Text
revision :: Natural
$sel:workerConfigurationArn:WorkerConfiguration' :: WorkerConfiguration -> Text
$sel:revision:WorkerConfiguration' :: WorkerConfiguration -> Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
revision
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workerConfigurationArn

instance Prelude.NFData WorkerConfiguration where
  rnf :: WorkerConfiguration -> ()
rnf WorkerConfiguration' {Natural
Text
workerConfigurationArn :: Text
revision :: Natural
$sel:workerConfigurationArn:WorkerConfiguration' :: WorkerConfiguration -> Text
$sel:revision:WorkerConfiguration' :: WorkerConfiguration -> Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Natural
revision
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workerConfigurationArn

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