{-# 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.ServerlessApplicationRepository.Types.RollbackTrigger
-- 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.ServerlessApplicationRepository.Types.RollbackTrigger where

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

-- | This property corresponds to the /AWS CloudFormation
-- <https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/RollbackTrigger RollbackTrigger>/
-- Data Type.
--
-- /See:/ 'newRollbackTrigger' smart constructor.
data RollbackTrigger = RollbackTrigger'
  { -- | This property corresponds to the content of the same name for the /AWS
    -- CloudFormation
    -- <https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/RollbackTrigger RollbackTrigger>/
    -- Data Type.
    RollbackTrigger -> Text
type' :: Prelude.Text,
    -- | This property corresponds to the content of the same name for the /AWS
    -- CloudFormation
    -- <https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/RollbackTrigger RollbackTrigger>/
    -- Data Type.
    RollbackTrigger -> Text
arn :: Prelude.Text
  }
  deriving (RollbackTrigger -> RollbackTrigger -> Bool
(RollbackTrigger -> RollbackTrigger -> Bool)
-> (RollbackTrigger -> RollbackTrigger -> Bool)
-> Eq RollbackTrigger
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RollbackTrigger -> RollbackTrigger -> Bool
$c/= :: RollbackTrigger -> RollbackTrigger -> Bool
== :: RollbackTrigger -> RollbackTrigger -> Bool
$c== :: RollbackTrigger -> RollbackTrigger -> Bool
Prelude.Eq, ReadPrec [RollbackTrigger]
ReadPrec RollbackTrigger
Int -> ReadS RollbackTrigger
ReadS [RollbackTrigger]
(Int -> ReadS RollbackTrigger)
-> ReadS [RollbackTrigger]
-> ReadPrec RollbackTrigger
-> ReadPrec [RollbackTrigger]
-> Read RollbackTrigger
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RollbackTrigger]
$creadListPrec :: ReadPrec [RollbackTrigger]
readPrec :: ReadPrec RollbackTrigger
$creadPrec :: ReadPrec RollbackTrigger
readList :: ReadS [RollbackTrigger]
$creadList :: ReadS [RollbackTrigger]
readsPrec :: Int -> ReadS RollbackTrigger
$creadsPrec :: Int -> ReadS RollbackTrigger
Prelude.Read, Int -> RollbackTrigger -> ShowS
[RollbackTrigger] -> ShowS
RollbackTrigger -> String
(Int -> RollbackTrigger -> ShowS)
-> (RollbackTrigger -> String)
-> ([RollbackTrigger] -> ShowS)
-> Show RollbackTrigger
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RollbackTrigger] -> ShowS
$cshowList :: [RollbackTrigger] -> ShowS
show :: RollbackTrigger -> String
$cshow :: RollbackTrigger -> String
showsPrec :: Int -> RollbackTrigger -> ShowS
$cshowsPrec :: Int -> RollbackTrigger -> ShowS
Prelude.Show, (forall x. RollbackTrigger -> Rep RollbackTrigger x)
-> (forall x. Rep RollbackTrigger x -> RollbackTrigger)
-> Generic RollbackTrigger
forall x. Rep RollbackTrigger x -> RollbackTrigger
forall x. RollbackTrigger -> Rep RollbackTrigger x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RollbackTrigger x -> RollbackTrigger
$cfrom :: forall x. RollbackTrigger -> Rep RollbackTrigger x
Prelude.Generic)

-- |
-- Create a value of 'RollbackTrigger' 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:
--
-- 'type'', 'rollbackTrigger_type' - This property corresponds to the content of the same name for the /AWS
-- CloudFormation
-- <https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/RollbackTrigger RollbackTrigger>/
-- Data Type.
--
-- 'arn', 'rollbackTrigger_arn' - This property corresponds to the content of the same name for the /AWS
-- CloudFormation
-- <https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/RollbackTrigger RollbackTrigger>/
-- Data Type.
newRollbackTrigger ::
  -- | 'type''
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  RollbackTrigger
newRollbackTrigger :: Text -> Text -> RollbackTrigger
newRollbackTrigger Text
pType_ Text
pArn_ =
  RollbackTrigger' :: Text -> Text -> RollbackTrigger
RollbackTrigger' {$sel:type':RollbackTrigger' :: Text
type' = Text
pType_, $sel:arn:RollbackTrigger' :: Text
arn = Text
pArn_}

-- | This property corresponds to the content of the same name for the /AWS
-- CloudFormation
-- <https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/RollbackTrigger RollbackTrigger>/
-- Data Type.
rollbackTrigger_type :: Lens.Lens' RollbackTrigger Prelude.Text
rollbackTrigger_type :: (Text -> f Text) -> RollbackTrigger -> f RollbackTrigger
rollbackTrigger_type = (RollbackTrigger -> Text)
-> (RollbackTrigger -> Text -> RollbackTrigger)
-> Lens RollbackTrigger RollbackTrigger Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RollbackTrigger' {Text
type' :: Text
$sel:type':RollbackTrigger' :: RollbackTrigger -> Text
type'} -> Text
type') (\s :: RollbackTrigger
s@RollbackTrigger' {} Text
a -> RollbackTrigger
s {$sel:type':RollbackTrigger' :: Text
type' = Text
a} :: RollbackTrigger)

-- | This property corresponds to the content of the same name for the /AWS
-- CloudFormation
-- <https://docs.aws.amazon.com/goto/WebAPI/cloudformation-2010-05-15/RollbackTrigger RollbackTrigger>/
-- Data Type.
rollbackTrigger_arn :: Lens.Lens' RollbackTrigger Prelude.Text
rollbackTrigger_arn :: (Text -> f Text) -> RollbackTrigger -> f RollbackTrigger
rollbackTrigger_arn = (RollbackTrigger -> Text)
-> (RollbackTrigger -> Text -> RollbackTrigger)
-> Lens RollbackTrigger RollbackTrigger Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RollbackTrigger' {Text
arn :: Text
$sel:arn:RollbackTrigger' :: RollbackTrigger -> Text
arn} -> Text
arn) (\s :: RollbackTrigger
s@RollbackTrigger' {} Text
a -> RollbackTrigger
s {$sel:arn:RollbackTrigger' :: Text
arn = Text
a} :: RollbackTrigger)

instance Prelude.Hashable RollbackTrigger

instance Prelude.NFData RollbackTrigger

instance Core.ToJSON RollbackTrigger where
  toJSON :: RollbackTrigger -> Value
toJSON RollbackTrigger' {Text
arn :: Text
type' :: Text
$sel:arn:RollbackTrigger' :: RollbackTrigger -> Text
$sel:type':RollbackTrigger' :: RollbackTrigger -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
type'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)
          ]
      )