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

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

-- | A plugin is an AWS resource that contains the code that defines a
-- connector\'s logic.
--
-- /See:/ 'newCustomPlugin' smart constructor.
data CustomPlugin = CustomPlugin'
  { -- | The Amazon Resource Name (ARN) of the custom plugin.
    CustomPlugin -> Text
customPluginArn :: Prelude.Text,
    -- | The revision of the custom plugin.
    CustomPlugin -> Natural
revision :: Prelude.Natural
  }
  deriving (CustomPlugin -> CustomPlugin -> Bool
(CustomPlugin -> CustomPlugin -> Bool)
-> (CustomPlugin -> CustomPlugin -> Bool) -> Eq CustomPlugin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomPlugin -> CustomPlugin -> Bool
$c/= :: CustomPlugin -> CustomPlugin -> Bool
== :: CustomPlugin -> CustomPlugin -> Bool
$c== :: CustomPlugin -> CustomPlugin -> Bool
Prelude.Eq, ReadPrec [CustomPlugin]
ReadPrec CustomPlugin
Int -> ReadS CustomPlugin
ReadS [CustomPlugin]
(Int -> ReadS CustomPlugin)
-> ReadS [CustomPlugin]
-> ReadPrec CustomPlugin
-> ReadPrec [CustomPlugin]
-> Read CustomPlugin
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomPlugin]
$creadListPrec :: ReadPrec [CustomPlugin]
readPrec :: ReadPrec CustomPlugin
$creadPrec :: ReadPrec CustomPlugin
readList :: ReadS [CustomPlugin]
$creadList :: ReadS [CustomPlugin]
readsPrec :: Int -> ReadS CustomPlugin
$creadsPrec :: Int -> ReadS CustomPlugin
Prelude.Read, Int -> CustomPlugin -> ShowS
[CustomPlugin] -> ShowS
CustomPlugin -> String
(Int -> CustomPlugin -> ShowS)
-> (CustomPlugin -> String)
-> ([CustomPlugin] -> ShowS)
-> Show CustomPlugin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomPlugin] -> ShowS
$cshowList :: [CustomPlugin] -> ShowS
show :: CustomPlugin -> String
$cshow :: CustomPlugin -> String
showsPrec :: Int -> CustomPlugin -> ShowS
$cshowsPrec :: Int -> CustomPlugin -> ShowS
Prelude.Show, (forall x. CustomPlugin -> Rep CustomPlugin x)
-> (forall x. Rep CustomPlugin x -> CustomPlugin)
-> Generic CustomPlugin
forall x. Rep CustomPlugin x -> CustomPlugin
forall x. CustomPlugin -> Rep CustomPlugin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomPlugin x -> CustomPlugin
$cfrom :: forall x. CustomPlugin -> Rep CustomPlugin x
Prelude.Generic)

-- |
-- Create a value of 'CustomPlugin' 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:
--
-- 'customPluginArn', 'customPlugin_customPluginArn' - The Amazon Resource Name (ARN) of the custom plugin.
--
-- 'revision', 'customPlugin_revision' - The revision of the custom plugin.
newCustomPlugin ::
  -- | 'customPluginArn'
  Prelude.Text ->
  -- | 'revision'
  Prelude.Natural ->
  CustomPlugin
newCustomPlugin :: Text -> Natural -> CustomPlugin
newCustomPlugin Text
pCustomPluginArn_ Natural
pRevision_ =
  CustomPlugin' :: Text -> Natural -> CustomPlugin
CustomPlugin'
    { $sel:customPluginArn:CustomPlugin' :: Text
customPluginArn = Text
pCustomPluginArn_,
      $sel:revision:CustomPlugin' :: Natural
revision = Natural
pRevision_
    }

-- | The Amazon Resource Name (ARN) of the custom plugin.
customPlugin_customPluginArn :: Lens.Lens' CustomPlugin Prelude.Text
customPlugin_customPluginArn :: (Text -> f Text) -> CustomPlugin -> f CustomPlugin
customPlugin_customPluginArn = (CustomPlugin -> Text)
-> (CustomPlugin -> Text -> CustomPlugin)
-> Lens CustomPlugin CustomPlugin Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomPlugin' {Text
customPluginArn :: Text
$sel:customPluginArn:CustomPlugin' :: CustomPlugin -> Text
customPluginArn} -> Text
customPluginArn) (\s :: CustomPlugin
s@CustomPlugin' {} Text
a -> CustomPlugin
s {$sel:customPluginArn:CustomPlugin' :: Text
customPluginArn = Text
a} :: CustomPlugin)

-- | The revision of the custom plugin.
customPlugin_revision :: Lens.Lens' CustomPlugin Prelude.Natural
customPlugin_revision :: (Natural -> f Natural) -> CustomPlugin -> f CustomPlugin
customPlugin_revision = (CustomPlugin -> Natural)
-> (CustomPlugin -> Natural -> CustomPlugin)
-> Lens CustomPlugin CustomPlugin Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomPlugin' {Natural
revision :: Natural
$sel:revision:CustomPlugin' :: CustomPlugin -> Natural
revision} -> Natural
revision) (\s :: CustomPlugin
s@CustomPlugin' {} Natural
a -> CustomPlugin
s {$sel:revision:CustomPlugin' :: Natural
revision = Natural
a} :: CustomPlugin)

instance Prelude.Hashable CustomPlugin

instance Prelude.NFData CustomPlugin

instance Core.ToJSON CustomPlugin where
  toJSON :: CustomPlugin -> Value
toJSON CustomPlugin' {Natural
Text
revision :: Natural
customPluginArn :: Text
$sel:revision:CustomPlugin' :: CustomPlugin -> Natural
$sel:customPluginArn:CustomPlugin' :: CustomPlugin -> 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
"customPluginArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
customPluginArn),
            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)
          ]
      )