{-# 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.Snowball.Types.EventTriggerDefinition
-- 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.Snowball.Types.EventTriggerDefinition where

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

-- | The container for the EventTriggerDefinition$EventResourceARN.
--
-- /See:/ 'newEventTriggerDefinition' smart constructor.
data EventTriggerDefinition = EventTriggerDefinition'
  { -- | The Amazon Resource Name (ARN) for any local Amazon S3 resource that is
    -- an AWS Lambda function\'s event trigger associated with this job.
    EventTriggerDefinition -> Maybe Text
eventResourceARN :: Prelude.Maybe Prelude.Text
  }
  deriving (EventTriggerDefinition -> EventTriggerDefinition -> Bool
(EventTriggerDefinition -> EventTriggerDefinition -> Bool)
-> (EventTriggerDefinition -> EventTriggerDefinition -> Bool)
-> Eq EventTriggerDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventTriggerDefinition -> EventTriggerDefinition -> Bool
$c/= :: EventTriggerDefinition -> EventTriggerDefinition -> Bool
== :: EventTriggerDefinition -> EventTriggerDefinition -> Bool
$c== :: EventTriggerDefinition -> EventTriggerDefinition -> Bool
Prelude.Eq, ReadPrec [EventTriggerDefinition]
ReadPrec EventTriggerDefinition
Int -> ReadS EventTriggerDefinition
ReadS [EventTriggerDefinition]
(Int -> ReadS EventTriggerDefinition)
-> ReadS [EventTriggerDefinition]
-> ReadPrec EventTriggerDefinition
-> ReadPrec [EventTriggerDefinition]
-> Read EventTriggerDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventTriggerDefinition]
$creadListPrec :: ReadPrec [EventTriggerDefinition]
readPrec :: ReadPrec EventTriggerDefinition
$creadPrec :: ReadPrec EventTriggerDefinition
readList :: ReadS [EventTriggerDefinition]
$creadList :: ReadS [EventTriggerDefinition]
readsPrec :: Int -> ReadS EventTriggerDefinition
$creadsPrec :: Int -> ReadS EventTriggerDefinition
Prelude.Read, Int -> EventTriggerDefinition -> ShowS
[EventTriggerDefinition] -> ShowS
EventTriggerDefinition -> String
(Int -> EventTriggerDefinition -> ShowS)
-> (EventTriggerDefinition -> String)
-> ([EventTriggerDefinition] -> ShowS)
-> Show EventTriggerDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventTriggerDefinition] -> ShowS
$cshowList :: [EventTriggerDefinition] -> ShowS
show :: EventTriggerDefinition -> String
$cshow :: EventTriggerDefinition -> String
showsPrec :: Int -> EventTriggerDefinition -> ShowS
$cshowsPrec :: Int -> EventTriggerDefinition -> ShowS
Prelude.Show, (forall x. EventTriggerDefinition -> Rep EventTriggerDefinition x)
-> (forall x.
    Rep EventTriggerDefinition x -> EventTriggerDefinition)
-> Generic EventTriggerDefinition
forall x. Rep EventTriggerDefinition x -> EventTriggerDefinition
forall x. EventTriggerDefinition -> Rep EventTriggerDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventTriggerDefinition x -> EventTriggerDefinition
$cfrom :: forall x. EventTriggerDefinition -> Rep EventTriggerDefinition x
Prelude.Generic)

-- |
-- Create a value of 'EventTriggerDefinition' 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:
--
-- 'eventResourceARN', 'eventTriggerDefinition_eventResourceARN' - The Amazon Resource Name (ARN) for any local Amazon S3 resource that is
-- an AWS Lambda function\'s event trigger associated with this job.
newEventTriggerDefinition ::
  EventTriggerDefinition
newEventTriggerDefinition :: EventTriggerDefinition
newEventTriggerDefinition =
  EventTriggerDefinition' :: Maybe Text -> EventTriggerDefinition
EventTriggerDefinition'
    { $sel:eventResourceARN:EventTriggerDefinition' :: Maybe Text
eventResourceARN =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) for any local Amazon S3 resource that is
-- an AWS Lambda function\'s event trigger associated with this job.
eventTriggerDefinition_eventResourceARN :: Lens.Lens' EventTriggerDefinition (Prelude.Maybe Prelude.Text)
eventTriggerDefinition_eventResourceARN :: (Maybe Text -> f (Maybe Text))
-> EventTriggerDefinition -> f EventTriggerDefinition
eventTriggerDefinition_eventResourceARN = (EventTriggerDefinition -> Maybe Text)
-> (EventTriggerDefinition -> Maybe Text -> EventTriggerDefinition)
-> Lens
     EventTriggerDefinition
     EventTriggerDefinition
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventTriggerDefinition' {Maybe Text
eventResourceARN :: Maybe Text
$sel:eventResourceARN:EventTriggerDefinition' :: EventTriggerDefinition -> Maybe Text
eventResourceARN} -> Maybe Text
eventResourceARN) (\s :: EventTriggerDefinition
s@EventTriggerDefinition' {} Maybe Text
a -> EventTriggerDefinition
s {$sel:eventResourceARN:EventTriggerDefinition' :: Maybe Text
eventResourceARN = Maybe Text
a} :: EventTriggerDefinition)

instance Core.FromJSON EventTriggerDefinition where
  parseJSON :: Value -> Parser EventTriggerDefinition
parseJSON =
    String
-> (Object -> Parser EventTriggerDefinition)
-> Value
-> Parser EventTriggerDefinition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EventTriggerDefinition"
      ( \Object
x ->
          Maybe Text -> EventTriggerDefinition
EventTriggerDefinition'
            (Maybe Text -> EventTriggerDefinition)
-> Parser (Maybe Text) -> Parser EventTriggerDefinition
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
"EventResourceARN")
      )

instance Prelude.Hashable EventTriggerDefinition

instance Prelude.NFData EventTriggerDefinition

instance Core.ToJSON EventTriggerDefinition where
  toJSON :: EventTriggerDefinition -> Value
toJSON EventTriggerDefinition' {Maybe Text
eventResourceARN :: Maybe Text
$sel:eventResourceARN:EventTriggerDefinition' :: EventTriggerDefinition -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"EventResourceARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
eventResourceARN
          ]
      )