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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The event integration association.
--
-- /See:/ 'newEventIntegrationAssociation' smart constructor.
data EventIntegrationAssociation = EventIntegrationAssociation'
  { -- | The identifier for the client that is associated with the event
    -- integration.
    EventIntegrationAssociation -> Maybe Text
clientId :: Prelude.Maybe Prelude.Text,
    -- | The name of the event integration.
    EventIntegrationAssociation -> Maybe Text
eventIntegrationName :: Prelude.Maybe Prelude.Text,
    -- | The metadata associated with the client.
    EventIntegrationAssociation -> Maybe (HashMap Text Text)
clientAssociationMetadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The identifier for the event integration association.
    EventIntegrationAssociation -> Maybe Text
eventIntegrationAssociationId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) for the event integration association.
    EventIntegrationAssociation -> Maybe Text
eventIntegrationAssociationArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the EventBridge rule.
    EventIntegrationAssociation -> Maybe Text
eventBridgeRuleName :: Prelude.Maybe Prelude.Text
  }
  deriving (EventIntegrationAssociation -> EventIntegrationAssociation -> Bool
(EventIntegrationAssociation
 -> EventIntegrationAssociation -> Bool)
-> (EventIntegrationAssociation
    -> EventIntegrationAssociation -> Bool)
-> Eq EventIntegrationAssociation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventIntegrationAssociation -> EventIntegrationAssociation -> Bool
$c/= :: EventIntegrationAssociation -> EventIntegrationAssociation -> Bool
== :: EventIntegrationAssociation -> EventIntegrationAssociation -> Bool
$c== :: EventIntegrationAssociation -> EventIntegrationAssociation -> Bool
Prelude.Eq, ReadPrec [EventIntegrationAssociation]
ReadPrec EventIntegrationAssociation
Int -> ReadS EventIntegrationAssociation
ReadS [EventIntegrationAssociation]
(Int -> ReadS EventIntegrationAssociation)
-> ReadS [EventIntegrationAssociation]
-> ReadPrec EventIntegrationAssociation
-> ReadPrec [EventIntegrationAssociation]
-> Read EventIntegrationAssociation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventIntegrationAssociation]
$creadListPrec :: ReadPrec [EventIntegrationAssociation]
readPrec :: ReadPrec EventIntegrationAssociation
$creadPrec :: ReadPrec EventIntegrationAssociation
readList :: ReadS [EventIntegrationAssociation]
$creadList :: ReadS [EventIntegrationAssociation]
readsPrec :: Int -> ReadS EventIntegrationAssociation
$creadsPrec :: Int -> ReadS EventIntegrationAssociation
Prelude.Read, Int -> EventIntegrationAssociation -> ShowS
[EventIntegrationAssociation] -> ShowS
EventIntegrationAssociation -> String
(Int -> EventIntegrationAssociation -> ShowS)
-> (EventIntegrationAssociation -> String)
-> ([EventIntegrationAssociation] -> ShowS)
-> Show EventIntegrationAssociation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventIntegrationAssociation] -> ShowS
$cshowList :: [EventIntegrationAssociation] -> ShowS
show :: EventIntegrationAssociation -> String
$cshow :: EventIntegrationAssociation -> String
showsPrec :: Int -> EventIntegrationAssociation -> ShowS
$cshowsPrec :: Int -> EventIntegrationAssociation -> ShowS
Prelude.Show, (forall x.
 EventIntegrationAssociation -> Rep EventIntegrationAssociation x)
-> (forall x.
    Rep EventIntegrationAssociation x -> EventIntegrationAssociation)
-> Generic EventIntegrationAssociation
forall x.
Rep EventIntegrationAssociation x -> EventIntegrationAssociation
forall x.
EventIntegrationAssociation -> Rep EventIntegrationAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EventIntegrationAssociation x -> EventIntegrationAssociation
$cfrom :: forall x.
EventIntegrationAssociation -> Rep EventIntegrationAssociation x
Prelude.Generic)

-- |
-- Create a value of 'EventIntegrationAssociation' 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:
--
-- 'clientId', 'eventIntegrationAssociation_clientId' - The identifier for the client that is associated with the event
-- integration.
--
-- 'eventIntegrationName', 'eventIntegrationAssociation_eventIntegrationName' - The name of the event integration.
--
-- 'clientAssociationMetadata', 'eventIntegrationAssociation_clientAssociationMetadata' - The metadata associated with the client.
--
-- 'eventIntegrationAssociationId', 'eventIntegrationAssociation_eventIntegrationAssociationId' - The identifier for the event integration association.
--
-- 'eventIntegrationAssociationArn', 'eventIntegrationAssociation_eventIntegrationAssociationArn' - The Amazon Resource Name (ARN) for the event integration association.
--
-- 'eventBridgeRuleName', 'eventIntegrationAssociation_eventBridgeRuleName' - The name of the EventBridge rule.
newEventIntegrationAssociation ::
  EventIntegrationAssociation
newEventIntegrationAssociation :: EventIntegrationAssociation
newEventIntegrationAssociation =
  EventIntegrationAssociation' :: Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> EventIntegrationAssociation
EventIntegrationAssociation'
    { $sel:clientId:EventIntegrationAssociation' :: Maybe Text
clientId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventIntegrationName:EventIntegrationAssociation' :: Maybe Text
eventIntegrationName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clientAssociationMetadata:EventIntegrationAssociation' :: Maybe (HashMap Text Text)
clientAssociationMetadata = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:eventIntegrationAssociationId:EventIntegrationAssociation' :: Maybe Text
eventIntegrationAssociationId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventIntegrationAssociationArn:EventIntegrationAssociation' :: Maybe Text
eventIntegrationAssociationArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventBridgeRuleName:EventIntegrationAssociation' :: Maybe Text
eventBridgeRuleName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier for the client that is associated with the event
-- integration.
eventIntegrationAssociation_clientId :: Lens.Lens' EventIntegrationAssociation (Prelude.Maybe Prelude.Text)
eventIntegrationAssociation_clientId :: (Maybe Text -> f (Maybe Text))
-> EventIntegrationAssociation -> f EventIntegrationAssociation
eventIntegrationAssociation_clientId = (EventIntegrationAssociation -> Maybe Text)
-> (EventIntegrationAssociation
    -> Maybe Text -> EventIntegrationAssociation)
-> Lens
     EventIntegrationAssociation
     EventIntegrationAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventIntegrationAssociation' {Maybe Text
clientId :: Maybe Text
$sel:clientId:EventIntegrationAssociation' :: EventIntegrationAssociation -> Maybe Text
clientId} -> Maybe Text
clientId) (\s :: EventIntegrationAssociation
s@EventIntegrationAssociation' {} Maybe Text
a -> EventIntegrationAssociation
s {$sel:clientId:EventIntegrationAssociation' :: Maybe Text
clientId = Maybe Text
a} :: EventIntegrationAssociation)

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

-- | The metadata associated with the client.
eventIntegrationAssociation_clientAssociationMetadata :: Lens.Lens' EventIntegrationAssociation (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
eventIntegrationAssociation_clientAssociationMetadata :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> EventIntegrationAssociation -> f EventIntegrationAssociation
eventIntegrationAssociation_clientAssociationMetadata = (EventIntegrationAssociation -> Maybe (HashMap Text Text))
-> (EventIntegrationAssociation
    -> Maybe (HashMap Text Text) -> EventIntegrationAssociation)
-> Lens
     EventIntegrationAssociation
     EventIntegrationAssociation
     (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 (\EventIntegrationAssociation' {Maybe (HashMap Text Text)
clientAssociationMetadata :: Maybe (HashMap Text Text)
$sel:clientAssociationMetadata:EventIntegrationAssociation' :: EventIntegrationAssociation -> Maybe (HashMap Text Text)
clientAssociationMetadata} -> Maybe (HashMap Text Text)
clientAssociationMetadata) (\s :: EventIntegrationAssociation
s@EventIntegrationAssociation' {} Maybe (HashMap Text Text)
a -> EventIntegrationAssociation
s {$sel:clientAssociationMetadata:EventIntegrationAssociation' :: Maybe (HashMap Text Text)
clientAssociationMetadata = Maybe (HashMap Text Text)
a} :: EventIntegrationAssociation) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> EventIntegrationAssociation -> f EventIntegrationAssociation)
-> ((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)))
-> EventIntegrationAssociation
-> f EventIntegrationAssociation
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

-- | The identifier for the event integration association.
eventIntegrationAssociation_eventIntegrationAssociationId :: Lens.Lens' EventIntegrationAssociation (Prelude.Maybe Prelude.Text)
eventIntegrationAssociation_eventIntegrationAssociationId :: (Maybe Text -> f (Maybe Text))
-> EventIntegrationAssociation -> f EventIntegrationAssociation
eventIntegrationAssociation_eventIntegrationAssociationId = (EventIntegrationAssociation -> Maybe Text)
-> (EventIntegrationAssociation
    -> Maybe Text -> EventIntegrationAssociation)
-> Lens
     EventIntegrationAssociation
     EventIntegrationAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventIntegrationAssociation' {Maybe Text
eventIntegrationAssociationId :: Maybe Text
$sel:eventIntegrationAssociationId:EventIntegrationAssociation' :: EventIntegrationAssociation -> Maybe Text
eventIntegrationAssociationId} -> Maybe Text
eventIntegrationAssociationId) (\s :: EventIntegrationAssociation
s@EventIntegrationAssociation' {} Maybe Text
a -> EventIntegrationAssociation
s {$sel:eventIntegrationAssociationId:EventIntegrationAssociation' :: Maybe Text
eventIntegrationAssociationId = Maybe Text
a} :: EventIntegrationAssociation)

-- | The Amazon Resource Name (ARN) for the event integration association.
eventIntegrationAssociation_eventIntegrationAssociationArn :: Lens.Lens' EventIntegrationAssociation (Prelude.Maybe Prelude.Text)
eventIntegrationAssociation_eventIntegrationAssociationArn :: (Maybe Text -> f (Maybe Text))
-> EventIntegrationAssociation -> f EventIntegrationAssociation
eventIntegrationAssociation_eventIntegrationAssociationArn = (EventIntegrationAssociation -> Maybe Text)
-> (EventIntegrationAssociation
    -> Maybe Text -> EventIntegrationAssociation)
-> Lens
     EventIntegrationAssociation
     EventIntegrationAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventIntegrationAssociation' {Maybe Text
eventIntegrationAssociationArn :: Maybe Text
$sel:eventIntegrationAssociationArn:EventIntegrationAssociation' :: EventIntegrationAssociation -> Maybe Text
eventIntegrationAssociationArn} -> Maybe Text
eventIntegrationAssociationArn) (\s :: EventIntegrationAssociation
s@EventIntegrationAssociation' {} Maybe Text
a -> EventIntegrationAssociation
s {$sel:eventIntegrationAssociationArn:EventIntegrationAssociation' :: Maybe Text
eventIntegrationAssociationArn = Maybe Text
a} :: EventIntegrationAssociation)

-- | The name of the EventBridge rule.
eventIntegrationAssociation_eventBridgeRuleName :: Lens.Lens' EventIntegrationAssociation (Prelude.Maybe Prelude.Text)
eventIntegrationAssociation_eventBridgeRuleName :: (Maybe Text -> f (Maybe Text))
-> EventIntegrationAssociation -> f EventIntegrationAssociation
eventIntegrationAssociation_eventBridgeRuleName = (EventIntegrationAssociation -> Maybe Text)
-> (EventIntegrationAssociation
    -> Maybe Text -> EventIntegrationAssociation)
-> Lens
     EventIntegrationAssociation
     EventIntegrationAssociation
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventIntegrationAssociation' {Maybe Text
eventBridgeRuleName :: Maybe Text
$sel:eventBridgeRuleName:EventIntegrationAssociation' :: EventIntegrationAssociation -> Maybe Text
eventBridgeRuleName} -> Maybe Text
eventBridgeRuleName) (\s :: EventIntegrationAssociation
s@EventIntegrationAssociation' {} Maybe Text
a -> EventIntegrationAssociation
s {$sel:eventBridgeRuleName:EventIntegrationAssociation' :: Maybe Text
eventBridgeRuleName = Maybe Text
a} :: EventIntegrationAssociation)

instance Core.FromJSON EventIntegrationAssociation where
  parseJSON :: Value -> Parser EventIntegrationAssociation
parseJSON =
    String
-> (Object -> Parser EventIntegrationAssociation)
-> Value
-> Parser EventIntegrationAssociation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EventIntegrationAssociation"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> EventIntegrationAssociation
EventIntegrationAssociation'
            (Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> EventIntegrationAssociation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> EventIntegrationAssociation)
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
"ClientId")
            Parser
  (Maybe Text
   -> Maybe (HashMap Text Text)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> EventIntegrationAssociation)
-> Parser (Maybe Text)
-> Parser
     (Maybe (HashMap Text Text)
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> EventIntegrationAssociation)
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
"EventIntegrationName")
            Parser
  (Maybe (HashMap Text Text)
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> EventIntegrationAssociation)
-> Parser (Maybe (HashMap Text Text))
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> EventIntegrationAssociation)
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
"ClientAssociationMetadata"
                            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
                        )
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> EventIntegrationAssociation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> EventIntegrationAssociation)
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
"EventIntegrationAssociationId")
            Parser (Maybe Text -> Maybe Text -> EventIntegrationAssociation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> EventIntegrationAssociation)
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
"EventIntegrationAssociationArn")
            Parser (Maybe Text -> EventIntegrationAssociation)
-> Parser (Maybe Text) -> Parser EventIntegrationAssociation
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
"EventBridgeRuleName")
      )

instance Prelude.Hashable EventIntegrationAssociation

instance Prelude.NFData EventIntegrationAssociation