{-# 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.Connect.Types.EventBridgeActionDefinition
-- 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.Connect.Types.EventBridgeActionDefinition 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 EventBridge action definition.
--
-- /See:/ 'newEventBridgeActionDefinition' smart constructor.
data EventBridgeActionDefinition = EventBridgeActionDefinition'
  { -- | The name.
    EventBridgeActionDefinition -> Text
name :: Prelude.Text
  }
  deriving (EventBridgeActionDefinition -> EventBridgeActionDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventBridgeActionDefinition -> EventBridgeActionDefinition -> Bool
$c/= :: EventBridgeActionDefinition -> EventBridgeActionDefinition -> Bool
== :: EventBridgeActionDefinition -> EventBridgeActionDefinition -> Bool
$c== :: EventBridgeActionDefinition -> EventBridgeActionDefinition -> Bool
Prelude.Eq, ReadPrec [EventBridgeActionDefinition]
ReadPrec EventBridgeActionDefinition
Int -> ReadS EventBridgeActionDefinition
ReadS [EventBridgeActionDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventBridgeActionDefinition]
$creadListPrec :: ReadPrec [EventBridgeActionDefinition]
readPrec :: ReadPrec EventBridgeActionDefinition
$creadPrec :: ReadPrec EventBridgeActionDefinition
readList :: ReadS [EventBridgeActionDefinition]
$creadList :: ReadS [EventBridgeActionDefinition]
readsPrec :: Int -> ReadS EventBridgeActionDefinition
$creadsPrec :: Int -> ReadS EventBridgeActionDefinition
Prelude.Read, Int -> EventBridgeActionDefinition -> ShowS
[EventBridgeActionDefinition] -> ShowS
EventBridgeActionDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventBridgeActionDefinition] -> ShowS
$cshowList :: [EventBridgeActionDefinition] -> ShowS
show :: EventBridgeActionDefinition -> String
$cshow :: EventBridgeActionDefinition -> String
showsPrec :: Int -> EventBridgeActionDefinition -> ShowS
$cshowsPrec :: Int -> EventBridgeActionDefinition -> ShowS
Prelude.Show, forall x.
Rep EventBridgeActionDefinition x -> EventBridgeActionDefinition
forall x.
EventBridgeActionDefinition -> Rep EventBridgeActionDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EventBridgeActionDefinition x -> EventBridgeActionDefinition
$cfrom :: forall x.
EventBridgeActionDefinition -> Rep EventBridgeActionDefinition x
Prelude.Generic)

-- |
-- Create a value of 'EventBridgeActionDefinition' 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:
--
-- 'name', 'eventBridgeActionDefinition_name' - The name.
newEventBridgeActionDefinition ::
  -- | 'name'
  Prelude.Text ->
  EventBridgeActionDefinition
newEventBridgeActionDefinition :: Text -> EventBridgeActionDefinition
newEventBridgeActionDefinition Text
pName_ =
  EventBridgeActionDefinition' {$sel:name:EventBridgeActionDefinition' :: Text
name = Text
pName_}

-- | The name.
eventBridgeActionDefinition_name :: Lens.Lens' EventBridgeActionDefinition Prelude.Text
eventBridgeActionDefinition_name :: Lens' EventBridgeActionDefinition Text
eventBridgeActionDefinition_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventBridgeActionDefinition' {Text
name :: Text
$sel:name:EventBridgeActionDefinition' :: EventBridgeActionDefinition -> Text
name} -> Text
name) (\s :: EventBridgeActionDefinition
s@EventBridgeActionDefinition' {} Text
a -> EventBridgeActionDefinition
s {$sel:name:EventBridgeActionDefinition' :: Text
name = Text
a} :: EventBridgeActionDefinition)

instance Data.FromJSON EventBridgeActionDefinition where
  parseJSON :: Value -> Parser EventBridgeActionDefinition
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EventBridgeActionDefinition"
      ( \Object
x ->
          Text -> EventBridgeActionDefinition
EventBridgeActionDefinition'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Name")
      )

instance Prelude.Hashable EventBridgeActionDefinition where
  hashWithSalt :: Int -> EventBridgeActionDefinition -> Int
hashWithSalt Int
_salt EventBridgeActionDefinition' {Text
name :: Text
$sel:name:EventBridgeActionDefinition' :: EventBridgeActionDefinition -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData EventBridgeActionDefinition where
  rnf :: EventBridgeActionDefinition -> ()
rnf EventBridgeActionDefinition' {Text
name :: Text
$sel:name:EventBridgeActionDefinition' :: EventBridgeActionDefinition -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name

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