{-# 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.AppIntegrationS.Types.EventIntegration
-- 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.AppIntegrationS.Types.EventIntegration where

import Amazonka.AppIntegrationS.Types.EventFilter
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 event integration.
--
-- /See:/ 'newEventIntegration' smart constructor.
data EventIntegration = EventIntegration'
  { -- | The event integration description.
    EventIntegration -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The Amazon EventBridge bus for the event integration.
    EventIntegration -> Maybe Text
eventBridgeBus :: Prelude.Maybe Prelude.Text,
    -- | The event integration filter.
    EventIntegration -> Maybe EventFilter
eventFilter :: Prelude.Maybe EventFilter,
    -- | The Amazon Resource Name (ARN) of the event integration.
    EventIntegration -> Maybe Text
eventIntegrationArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the event integration.
    EventIntegration -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The tags.
    EventIntegration -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (EventIntegration -> EventIntegration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventIntegration -> EventIntegration -> Bool
$c/= :: EventIntegration -> EventIntegration -> Bool
== :: EventIntegration -> EventIntegration -> Bool
$c== :: EventIntegration -> EventIntegration -> Bool
Prelude.Eq, ReadPrec [EventIntegration]
ReadPrec EventIntegration
Int -> ReadS EventIntegration
ReadS [EventIntegration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventIntegration]
$creadListPrec :: ReadPrec [EventIntegration]
readPrec :: ReadPrec EventIntegration
$creadPrec :: ReadPrec EventIntegration
readList :: ReadS [EventIntegration]
$creadList :: ReadS [EventIntegration]
readsPrec :: Int -> ReadS EventIntegration
$creadsPrec :: Int -> ReadS EventIntegration
Prelude.Read, Int -> EventIntegration -> ShowS
[EventIntegration] -> ShowS
EventIntegration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventIntegration] -> ShowS
$cshowList :: [EventIntegration] -> ShowS
show :: EventIntegration -> String
$cshow :: EventIntegration -> String
showsPrec :: Int -> EventIntegration -> ShowS
$cshowsPrec :: Int -> EventIntegration -> ShowS
Prelude.Show, forall x. Rep EventIntegration x -> EventIntegration
forall x. EventIntegration -> Rep EventIntegration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventIntegration x -> EventIntegration
$cfrom :: forall x. EventIntegration -> Rep EventIntegration x
Prelude.Generic)

-- |
-- Create a value of 'EventIntegration' 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:
--
-- 'description', 'eventIntegration_description' - The event integration description.
--
-- 'eventBridgeBus', 'eventIntegration_eventBridgeBus' - The Amazon EventBridge bus for the event integration.
--
-- 'eventFilter', 'eventIntegration_eventFilter' - The event integration filter.
--
-- 'eventIntegrationArn', 'eventIntegration_eventIntegrationArn' - The Amazon Resource Name (ARN) of the event integration.
--
-- 'name', 'eventIntegration_name' - The name of the event integration.
--
-- 'tags', 'eventIntegration_tags' - The tags.
newEventIntegration ::
  EventIntegration
newEventIntegration :: EventIntegration
newEventIntegration =
  EventIntegration'
    { $sel:description:EventIntegration' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:eventBridgeBus:EventIntegration' :: Maybe Text
eventBridgeBus = forall a. Maybe a
Prelude.Nothing,
      $sel:eventFilter:EventIntegration' :: Maybe EventFilter
eventFilter = forall a. Maybe a
Prelude.Nothing,
      $sel:eventIntegrationArn:EventIntegration' :: Maybe Text
eventIntegrationArn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:EventIntegration' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:EventIntegration' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The event integration description.
eventIntegration_description :: Lens.Lens' EventIntegration (Prelude.Maybe Prelude.Text)
eventIntegration_description :: Lens' EventIntegration (Maybe Text)
eventIntegration_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventIntegration' {Maybe Text
description :: Maybe Text
$sel:description:EventIntegration' :: EventIntegration -> Maybe Text
description} -> Maybe Text
description) (\s :: EventIntegration
s@EventIntegration' {} Maybe Text
a -> EventIntegration
s {$sel:description:EventIntegration' :: Maybe Text
description = Maybe Text
a} :: EventIntegration)

-- | The Amazon EventBridge bus for the event integration.
eventIntegration_eventBridgeBus :: Lens.Lens' EventIntegration (Prelude.Maybe Prelude.Text)
eventIntegration_eventBridgeBus :: Lens' EventIntegration (Maybe Text)
eventIntegration_eventBridgeBus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventIntegration' {Maybe Text
eventBridgeBus :: Maybe Text
$sel:eventBridgeBus:EventIntegration' :: EventIntegration -> Maybe Text
eventBridgeBus} -> Maybe Text
eventBridgeBus) (\s :: EventIntegration
s@EventIntegration' {} Maybe Text
a -> EventIntegration
s {$sel:eventBridgeBus:EventIntegration' :: Maybe Text
eventBridgeBus = Maybe Text
a} :: EventIntegration)

-- | The event integration filter.
eventIntegration_eventFilter :: Lens.Lens' EventIntegration (Prelude.Maybe EventFilter)
eventIntegration_eventFilter :: Lens' EventIntegration (Maybe EventFilter)
eventIntegration_eventFilter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventIntegration' {Maybe EventFilter
eventFilter :: Maybe EventFilter
$sel:eventFilter:EventIntegration' :: EventIntegration -> Maybe EventFilter
eventFilter} -> Maybe EventFilter
eventFilter) (\s :: EventIntegration
s@EventIntegration' {} Maybe EventFilter
a -> EventIntegration
s {$sel:eventFilter:EventIntegration' :: Maybe EventFilter
eventFilter = Maybe EventFilter
a} :: EventIntegration)

-- | The Amazon Resource Name (ARN) of the event integration.
eventIntegration_eventIntegrationArn :: Lens.Lens' EventIntegration (Prelude.Maybe Prelude.Text)
eventIntegration_eventIntegrationArn :: Lens' EventIntegration (Maybe Text)
eventIntegration_eventIntegrationArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventIntegration' {Maybe Text
eventIntegrationArn :: Maybe Text
$sel:eventIntegrationArn:EventIntegration' :: EventIntegration -> Maybe Text
eventIntegrationArn} -> Maybe Text
eventIntegrationArn) (\s :: EventIntegration
s@EventIntegration' {} Maybe Text
a -> EventIntegration
s {$sel:eventIntegrationArn:EventIntegration' :: Maybe Text
eventIntegrationArn = Maybe Text
a} :: EventIntegration)

-- | The name of the event integration.
eventIntegration_name :: Lens.Lens' EventIntegration (Prelude.Maybe Prelude.Text)
eventIntegration_name :: Lens' EventIntegration (Maybe Text)
eventIntegration_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventIntegration' {Maybe Text
name :: Maybe Text
$sel:name:EventIntegration' :: EventIntegration -> Maybe Text
name} -> Maybe Text
name) (\s :: EventIntegration
s@EventIntegration' {} Maybe Text
a -> EventIntegration
s {$sel:name:EventIntegration' :: Maybe Text
name = Maybe Text
a} :: EventIntegration)

-- | The tags.
eventIntegration_tags :: Lens.Lens' EventIntegration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
eventIntegration_tags :: Lens' EventIntegration (Maybe (HashMap Text Text))
eventIntegration_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventIntegration' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:EventIntegration' :: EventIntegration -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: EventIntegration
s@EventIntegration' {} Maybe (HashMap Text Text)
a -> EventIntegration
s {$sel:tags:EventIntegration' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: EventIntegration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON EventIntegration where
  parseJSON :: Value -> Parser EventIntegration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EventIntegration"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe EventFilter
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> EventIntegration
EventIntegration'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EventBridgeBus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EventFilter")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EventIntegrationArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable EventIntegration where
  hashWithSalt :: Int -> EventIntegration -> Int
hashWithSalt Int
_salt EventIntegration' {Maybe Text
Maybe (HashMap Text Text)
Maybe EventFilter
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
eventIntegrationArn :: Maybe Text
eventFilter :: Maybe EventFilter
eventBridgeBus :: Maybe Text
description :: Maybe Text
$sel:tags:EventIntegration' :: EventIntegration -> Maybe (HashMap Text Text)
$sel:name:EventIntegration' :: EventIntegration -> Maybe Text
$sel:eventIntegrationArn:EventIntegration' :: EventIntegration -> Maybe Text
$sel:eventFilter:EventIntegration' :: EventIntegration -> Maybe EventFilter
$sel:eventBridgeBus:EventIntegration' :: EventIntegration -> Maybe Text
$sel:description:EventIntegration' :: EventIntegration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventBridgeBus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EventFilter
eventFilter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eventIntegrationArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData EventIntegration where
  rnf :: EventIntegration -> ()
rnf EventIntegration' {Maybe Text
Maybe (HashMap Text Text)
Maybe EventFilter
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
eventIntegrationArn :: Maybe Text
eventFilter :: Maybe EventFilter
eventBridgeBus :: Maybe Text
description :: Maybe Text
$sel:tags:EventIntegration' :: EventIntegration -> Maybe (HashMap Text Text)
$sel:name:EventIntegration' :: EventIntegration -> Maybe Text
$sel:eventIntegrationArn:EventIntegration' :: EventIntegration -> Maybe Text
$sel:eventFilter:EventIntegration' :: EventIntegration -> Maybe EventFilter
$sel:eventBridgeBus:EventIntegration' :: EventIntegration -> Maybe Text
$sel:description:EventIntegration' :: EventIntegration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventBridgeBus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EventFilter
eventFilter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eventIntegrationArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags