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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(WorkerConfiguration -> WorkerConfiguration -> Bool)
-> (WorkerConfiguration -> WorkerConfiguration -> Bool)
-> Eq WorkerConfiguration
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]
(Int -> ReadS WorkerConfiguration)
-> ReadS [WorkerConfiguration]
-> ReadPrec WorkerConfiguration
-> ReadPrec [WorkerConfiguration]
-> Read 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
(Int -> WorkerConfiguration -> ShowS)
-> (WorkerConfiguration -> String)
-> ([WorkerConfiguration] -> ShowS)
-> Show WorkerConfiguration
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. WorkerConfiguration -> Rep WorkerConfiguration x)
-> (forall x. Rep WorkerConfiguration x -> WorkerConfiguration)
-> Generic WorkerConfiguration
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' :: Natural -> Text -> WorkerConfiguration
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 :: (Natural -> f Natural)
-> WorkerConfiguration -> f WorkerConfiguration
workerConfiguration_revision = (WorkerConfiguration -> Natural)
-> (WorkerConfiguration -> Natural -> WorkerConfiguration)
-> Lens WorkerConfiguration WorkerConfiguration Natural Natural
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 :: (Text -> f Text) -> WorkerConfiguration -> f WorkerConfiguration
workerConfiguration_workerConfigurationArn = (WorkerConfiguration -> Text)
-> (WorkerConfiguration -> Text -> WorkerConfiguration)
-> Lens WorkerConfiguration WorkerConfiguration Text Text
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

instance Prelude.NFData WorkerConfiguration

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