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

-- | 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
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]
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
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. 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'
    { $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 :: Lens' CustomPlugin Text
customPlugin_customPluginArn = 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 :: Lens' CustomPlugin Natural
customPlugin_revision = 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 where
  hashWithSalt :: Int -> CustomPlugin -> Int
hashWithSalt Int
_salt CustomPlugin' {Natural
Text
revision :: Natural
customPluginArn :: Text
$sel:revision:CustomPlugin' :: CustomPlugin -> Natural
$sel:customPluginArn:CustomPlugin' :: CustomPlugin -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
customPluginArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
revision

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

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