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

import Amazonka.AppIntegrationS.Types.EventFilter
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The event integration.
--
-- /See:/ 'newEventIntegration' smart constructor.
data EventIntegration = EventIntegration'
  { -- | 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 event integration description.
    EventIntegration -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags.
    EventIntegration -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (EventIntegration -> EventIntegration -> Bool
(EventIntegration -> EventIntegration -> Bool)
-> (EventIntegration -> EventIntegration -> Bool)
-> Eq EventIntegration
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]
(Int -> ReadS EventIntegration)
-> ReadS [EventIntegration]
-> ReadPrec EventIntegration
-> ReadPrec [EventIntegration]
-> Read 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
(Int -> EventIntegration -> ShowS)
-> (EventIntegration -> String)
-> ([EventIntegration] -> ShowS)
-> Show EventIntegration
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. EventIntegration -> Rep EventIntegration x)
-> (forall x. Rep EventIntegration x -> EventIntegration)
-> Generic EventIntegration
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:
--
-- '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.
--
-- 'description', 'eventIntegration_description' - The event integration description.
--
-- 'tags', 'eventIntegration_tags' - The tags.
newEventIntegration ::
  EventIntegration
newEventIntegration :: EventIntegration
newEventIntegration =
  EventIntegration' :: Maybe Text
-> Maybe EventFilter
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> EventIntegration
EventIntegration'
    { $sel:eventBridgeBus:EventIntegration' :: Maybe Text
eventBridgeBus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventFilter:EventIntegration' :: Maybe EventFilter
eventFilter = Maybe EventFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:eventIntegrationArn:EventIntegration' :: Maybe Text
eventIntegrationArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:EventIntegration' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:EventIntegration' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:EventIntegration' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon EventBridge bus for the event integration.
eventIntegration_eventBridgeBus :: Lens.Lens' EventIntegration (Prelude.Maybe Prelude.Text)
eventIntegration_eventBridgeBus :: (Maybe Text -> f (Maybe Text))
-> EventIntegration -> f EventIntegration
eventIntegration_eventBridgeBus = (EventIntegration -> Maybe Text)
-> (EventIntegration -> Maybe Text -> EventIntegration)
-> Lens EventIntegration EventIntegration (Maybe Text) (Maybe Text)
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 :: (Maybe EventFilter -> f (Maybe EventFilter))
-> EventIntegration -> f EventIntegration
eventIntegration_eventFilter = (EventIntegration -> Maybe EventFilter)
-> (EventIntegration -> Maybe EventFilter -> EventIntegration)
-> Lens
     EventIntegration
     EventIntegration
     (Maybe EventFilter)
     (Maybe 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 :: (Maybe Text -> f (Maybe Text))
-> EventIntegration -> f EventIntegration
eventIntegration_eventIntegrationArn = (EventIntegration -> Maybe Text)
-> (EventIntegration -> Maybe Text -> EventIntegration)
-> Lens EventIntegration EventIntegration (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> EventIntegration -> f EventIntegration
eventIntegration_name = (EventIntegration -> Maybe Text)
-> (EventIntegration -> Maybe Text -> EventIntegration)
-> Lens EventIntegration EventIntegration (Maybe Text) (Maybe Text)
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 event integration description.
eventIntegration_description :: Lens.Lens' EventIntegration (Prelude.Maybe Prelude.Text)
eventIntegration_description :: (Maybe Text -> f (Maybe Text))
-> EventIntegration -> f EventIntegration
eventIntegration_description = (EventIntegration -> Maybe Text)
-> (EventIntegration -> Maybe Text -> EventIntegration)
-> Lens EventIntegration EventIntegration (Maybe Text) (Maybe Text)
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 tags.
eventIntegration_tags :: Lens.Lens' EventIntegration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
eventIntegration_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> EventIntegration -> f EventIntegration
eventIntegration_tags = (EventIntegration -> Maybe (HashMap Text Text))
-> (EventIntegration
    -> Maybe (HashMap Text Text) -> EventIntegration)
-> Lens
     EventIntegration
     EventIntegration
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> EventIntegration -> f EventIntegration)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> EventIntegration
-> f EventIntegration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable EventIntegration

instance Prelude.NFData EventIntegration