{-# 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.ElasticBeanstalk.Types.Trigger
-- 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.ElasticBeanstalk.Types.Trigger where

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

-- | Describes a trigger.
--
-- /See:/ 'newTrigger' smart constructor.
data Trigger = Trigger'
  { -- | The name of the trigger.
    Trigger -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (Trigger -> Trigger -> Bool
(Trigger -> Trigger -> Bool)
-> (Trigger -> Trigger -> Bool) -> Eq Trigger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Trigger -> Trigger -> Bool
$c/= :: Trigger -> Trigger -> Bool
== :: Trigger -> Trigger -> Bool
$c== :: Trigger -> Trigger -> Bool
Prelude.Eq, ReadPrec [Trigger]
ReadPrec Trigger
Int -> ReadS Trigger
ReadS [Trigger]
(Int -> ReadS Trigger)
-> ReadS [Trigger]
-> ReadPrec Trigger
-> ReadPrec [Trigger]
-> Read Trigger
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Trigger]
$creadListPrec :: ReadPrec [Trigger]
readPrec :: ReadPrec Trigger
$creadPrec :: ReadPrec Trigger
readList :: ReadS [Trigger]
$creadList :: ReadS [Trigger]
readsPrec :: Int -> ReadS Trigger
$creadsPrec :: Int -> ReadS Trigger
Prelude.Read, Int -> Trigger -> ShowS
[Trigger] -> ShowS
Trigger -> String
(Int -> Trigger -> ShowS)
-> (Trigger -> String) -> ([Trigger] -> ShowS) -> Show Trigger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Trigger] -> ShowS
$cshowList :: [Trigger] -> ShowS
show :: Trigger -> String
$cshow :: Trigger -> String
showsPrec :: Int -> Trigger -> ShowS
$cshowsPrec :: Int -> Trigger -> ShowS
Prelude.Show, (forall x. Trigger -> Rep Trigger x)
-> (forall x. Rep Trigger x -> Trigger) -> Generic Trigger
forall x. Rep Trigger x -> Trigger
forall x. Trigger -> Rep Trigger x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Trigger x -> Trigger
$cfrom :: forall x. Trigger -> Rep Trigger x
Prelude.Generic)

-- |
-- Create a value of 'Trigger' 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', 'trigger_name' - The name of the trigger.
newTrigger ::
  Trigger
newTrigger :: Trigger
newTrigger = Trigger' :: Maybe Text -> Trigger
Trigger' {$sel:name:Trigger' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The name of the trigger.
trigger_name :: Lens.Lens' Trigger (Prelude.Maybe Prelude.Text)
trigger_name :: (Maybe Text -> f (Maybe Text)) -> Trigger -> f Trigger
trigger_name = (Trigger -> Maybe Text)
-> (Trigger -> Maybe Text -> Trigger)
-> Lens Trigger Trigger (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Trigger' {Maybe Text
name :: Maybe Text
$sel:name:Trigger' :: Trigger -> Maybe Text
name} -> Maybe Text
name) (\s :: Trigger
s@Trigger' {} Maybe Text
a -> Trigger
s {$sel:name:Trigger' :: Maybe Text
name = Maybe Text
a} :: Trigger)

instance Core.FromXML Trigger where
  parseXML :: [Node] -> Either String Trigger
parseXML [Node]
x = Maybe Text -> Trigger
Trigger' (Maybe Text -> Trigger)
-> Either String (Maybe Text) -> Either String Trigger
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Name")

instance Prelude.Hashable Trigger

instance Prelude.NFData Trigger