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

import qualified Amazonka.Core as Core
import Amazonka.KafkaConnect.Types.CustomPluginDescription
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The description of the plugin.
--
-- /See:/ 'newPluginDescription' smart constructor.
data PluginDescription = PluginDescription'
  { -- | Details about a custom plugin.
    PluginDescription -> Maybe CustomPluginDescription
customPlugin :: Prelude.Maybe CustomPluginDescription
  }
  deriving (PluginDescription -> PluginDescription -> Bool
(PluginDescription -> PluginDescription -> Bool)
-> (PluginDescription -> PluginDescription -> Bool)
-> Eq PluginDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PluginDescription -> PluginDescription -> Bool
$c/= :: PluginDescription -> PluginDescription -> Bool
== :: PluginDescription -> PluginDescription -> Bool
$c== :: PluginDescription -> PluginDescription -> Bool
Prelude.Eq, ReadPrec [PluginDescription]
ReadPrec PluginDescription
Int -> ReadS PluginDescription
ReadS [PluginDescription]
(Int -> ReadS PluginDescription)
-> ReadS [PluginDescription]
-> ReadPrec PluginDescription
-> ReadPrec [PluginDescription]
-> Read PluginDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PluginDescription]
$creadListPrec :: ReadPrec [PluginDescription]
readPrec :: ReadPrec PluginDescription
$creadPrec :: ReadPrec PluginDescription
readList :: ReadS [PluginDescription]
$creadList :: ReadS [PluginDescription]
readsPrec :: Int -> ReadS PluginDescription
$creadsPrec :: Int -> ReadS PluginDescription
Prelude.Read, Int -> PluginDescription -> ShowS
[PluginDescription] -> ShowS
PluginDescription -> String
(Int -> PluginDescription -> ShowS)
-> (PluginDescription -> String)
-> ([PluginDescription] -> ShowS)
-> Show PluginDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PluginDescription] -> ShowS
$cshowList :: [PluginDescription] -> ShowS
show :: PluginDescription -> String
$cshow :: PluginDescription -> String
showsPrec :: Int -> PluginDescription -> ShowS
$cshowsPrec :: Int -> PluginDescription -> ShowS
Prelude.Show, (forall x. PluginDescription -> Rep PluginDescription x)
-> (forall x. Rep PluginDescription x -> PluginDescription)
-> Generic PluginDescription
forall x. Rep PluginDescription x -> PluginDescription
forall x. PluginDescription -> Rep PluginDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PluginDescription x -> PluginDescription
$cfrom :: forall x. PluginDescription -> Rep PluginDescription x
Prelude.Generic)

-- |
-- Create a value of 'PluginDescription' 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:
--
-- 'customPlugin', 'pluginDescription_customPlugin' - Details about a custom plugin.
newPluginDescription ::
  PluginDescription
newPluginDescription :: PluginDescription
newPluginDescription =
  PluginDescription' :: Maybe CustomPluginDescription -> PluginDescription
PluginDescription' {$sel:customPlugin:PluginDescription' :: Maybe CustomPluginDescription
customPlugin = Maybe CustomPluginDescription
forall a. Maybe a
Prelude.Nothing}

-- | Details about a custom plugin.
pluginDescription_customPlugin :: Lens.Lens' PluginDescription (Prelude.Maybe CustomPluginDescription)
pluginDescription_customPlugin :: (Maybe CustomPluginDescription
 -> f (Maybe CustomPluginDescription))
-> PluginDescription -> f PluginDescription
pluginDescription_customPlugin = (PluginDescription -> Maybe CustomPluginDescription)
-> (PluginDescription
    -> Maybe CustomPluginDescription -> PluginDescription)
-> Lens
     PluginDescription
     PluginDescription
     (Maybe CustomPluginDescription)
     (Maybe CustomPluginDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PluginDescription' {Maybe CustomPluginDescription
customPlugin :: Maybe CustomPluginDescription
$sel:customPlugin:PluginDescription' :: PluginDescription -> Maybe CustomPluginDescription
customPlugin} -> Maybe CustomPluginDescription
customPlugin) (\s :: PluginDescription
s@PluginDescription' {} Maybe CustomPluginDescription
a -> PluginDescription
s {$sel:customPlugin:PluginDescription' :: Maybe CustomPluginDescription
customPlugin = Maybe CustomPluginDescription
a} :: PluginDescription)

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

instance Prelude.Hashable PluginDescription

instance Prelude.NFData PluginDescription