{-# 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.CloudFormation.Types.ChangeSetHookTargetDetails
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudFormation.Types.ChangeSetHookTargetDetails where

import Amazonka.CloudFormation.Types.ChangeSetHookResourceTargetDetails
import Amazonka.CloudFormation.Types.HookTargetType
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Specifies target details for an activated hook.
--
-- /See:/ 'newChangeSetHookTargetDetails' smart constructor.
data ChangeSetHookTargetDetails = ChangeSetHookTargetDetails'
  { -- | Required if @TargetType@ is @RESOURCE@.
    ChangeSetHookTargetDetails
-> Maybe ChangeSetHookResourceTargetDetails
resourceTargetDetails :: Prelude.Maybe ChangeSetHookResourceTargetDetails,
    -- | The name of the type.
    ChangeSetHookTargetDetails -> Maybe HookTargetType
targetType :: Prelude.Maybe HookTargetType
  }
  deriving (ChangeSetHookTargetDetails -> ChangeSetHookTargetDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChangeSetHookTargetDetails -> ChangeSetHookTargetDetails -> Bool
$c/= :: ChangeSetHookTargetDetails -> ChangeSetHookTargetDetails -> Bool
== :: ChangeSetHookTargetDetails -> ChangeSetHookTargetDetails -> Bool
$c== :: ChangeSetHookTargetDetails -> ChangeSetHookTargetDetails -> Bool
Prelude.Eq, ReadPrec [ChangeSetHookTargetDetails]
ReadPrec ChangeSetHookTargetDetails
Int -> ReadS ChangeSetHookTargetDetails
ReadS [ChangeSetHookTargetDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChangeSetHookTargetDetails]
$creadListPrec :: ReadPrec [ChangeSetHookTargetDetails]
readPrec :: ReadPrec ChangeSetHookTargetDetails
$creadPrec :: ReadPrec ChangeSetHookTargetDetails
readList :: ReadS [ChangeSetHookTargetDetails]
$creadList :: ReadS [ChangeSetHookTargetDetails]
readsPrec :: Int -> ReadS ChangeSetHookTargetDetails
$creadsPrec :: Int -> ReadS ChangeSetHookTargetDetails
Prelude.Read, Int -> ChangeSetHookTargetDetails -> ShowS
[ChangeSetHookTargetDetails] -> ShowS
ChangeSetHookTargetDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChangeSetHookTargetDetails] -> ShowS
$cshowList :: [ChangeSetHookTargetDetails] -> ShowS
show :: ChangeSetHookTargetDetails -> String
$cshow :: ChangeSetHookTargetDetails -> String
showsPrec :: Int -> ChangeSetHookTargetDetails -> ShowS
$cshowsPrec :: Int -> ChangeSetHookTargetDetails -> ShowS
Prelude.Show, forall x.
Rep ChangeSetHookTargetDetails x -> ChangeSetHookTargetDetails
forall x.
ChangeSetHookTargetDetails -> Rep ChangeSetHookTargetDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ChangeSetHookTargetDetails x -> ChangeSetHookTargetDetails
$cfrom :: forall x.
ChangeSetHookTargetDetails -> Rep ChangeSetHookTargetDetails x
Prelude.Generic)

-- |
-- Create a value of 'ChangeSetHookTargetDetails' 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:
--
-- 'resourceTargetDetails', 'changeSetHookTargetDetails_resourceTargetDetails' - Required if @TargetType@ is @RESOURCE@.
--
-- 'targetType', 'changeSetHookTargetDetails_targetType' - The name of the type.
newChangeSetHookTargetDetails ::
  ChangeSetHookTargetDetails
newChangeSetHookTargetDetails :: ChangeSetHookTargetDetails
newChangeSetHookTargetDetails =
  ChangeSetHookTargetDetails'
    { $sel:resourceTargetDetails:ChangeSetHookTargetDetails' :: Maybe ChangeSetHookResourceTargetDetails
resourceTargetDetails =
        forall a. Maybe a
Prelude.Nothing,
      $sel:targetType:ChangeSetHookTargetDetails' :: Maybe HookTargetType
targetType = forall a. Maybe a
Prelude.Nothing
    }

-- | Required if @TargetType@ is @RESOURCE@.
changeSetHookTargetDetails_resourceTargetDetails :: Lens.Lens' ChangeSetHookTargetDetails (Prelude.Maybe ChangeSetHookResourceTargetDetails)
changeSetHookTargetDetails_resourceTargetDetails :: Lens'
  ChangeSetHookTargetDetails
  (Maybe ChangeSetHookResourceTargetDetails)
changeSetHookTargetDetails_resourceTargetDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeSetHookTargetDetails' {Maybe ChangeSetHookResourceTargetDetails
resourceTargetDetails :: Maybe ChangeSetHookResourceTargetDetails
$sel:resourceTargetDetails:ChangeSetHookTargetDetails' :: ChangeSetHookTargetDetails
-> Maybe ChangeSetHookResourceTargetDetails
resourceTargetDetails} -> Maybe ChangeSetHookResourceTargetDetails
resourceTargetDetails) (\s :: ChangeSetHookTargetDetails
s@ChangeSetHookTargetDetails' {} Maybe ChangeSetHookResourceTargetDetails
a -> ChangeSetHookTargetDetails
s {$sel:resourceTargetDetails:ChangeSetHookTargetDetails' :: Maybe ChangeSetHookResourceTargetDetails
resourceTargetDetails = Maybe ChangeSetHookResourceTargetDetails
a} :: ChangeSetHookTargetDetails)

-- | The name of the type.
changeSetHookTargetDetails_targetType :: Lens.Lens' ChangeSetHookTargetDetails (Prelude.Maybe HookTargetType)
changeSetHookTargetDetails_targetType :: Lens' ChangeSetHookTargetDetails (Maybe HookTargetType)
changeSetHookTargetDetails_targetType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeSetHookTargetDetails' {Maybe HookTargetType
targetType :: Maybe HookTargetType
$sel:targetType:ChangeSetHookTargetDetails' :: ChangeSetHookTargetDetails -> Maybe HookTargetType
targetType} -> Maybe HookTargetType
targetType) (\s :: ChangeSetHookTargetDetails
s@ChangeSetHookTargetDetails' {} Maybe HookTargetType
a -> ChangeSetHookTargetDetails
s {$sel:targetType:ChangeSetHookTargetDetails' :: Maybe HookTargetType
targetType = Maybe HookTargetType
a} :: ChangeSetHookTargetDetails)

instance Data.FromXML ChangeSetHookTargetDetails where
  parseXML :: [Node] -> Either String ChangeSetHookTargetDetails
parseXML [Node]
x =
    Maybe ChangeSetHookResourceTargetDetails
-> Maybe HookTargetType -> ChangeSetHookTargetDetails
ChangeSetHookTargetDetails'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ResourceTargetDetails")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"TargetType")

instance Prelude.Hashable ChangeSetHookTargetDetails where
  hashWithSalt :: Int -> ChangeSetHookTargetDetails -> Int
hashWithSalt Int
_salt ChangeSetHookTargetDetails' {Maybe ChangeSetHookResourceTargetDetails
Maybe HookTargetType
targetType :: Maybe HookTargetType
resourceTargetDetails :: Maybe ChangeSetHookResourceTargetDetails
$sel:targetType:ChangeSetHookTargetDetails' :: ChangeSetHookTargetDetails -> Maybe HookTargetType
$sel:resourceTargetDetails:ChangeSetHookTargetDetails' :: ChangeSetHookTargetDetails
-> Maybe ChangeSetHookResourceTargetDetails
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ChangeSetHookResourceTargetDetails
resourceTargetDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HookTargetType
targetType

instance Prelude.NFData ChangeSetHookTargetDetails where
  rnf :: ChangeSetHookTargetDetails -> ()
rnf ChangeSetHookTargetDetails' {Maybe ChangeSetHookResourceTargetDetails
Maybe HookTargetType
targetType :: Maybe HookTargetType
resourceTargetDetails :: Maybe ChangeSetHookResourceTargetDetails
$sel:targetType:ChangeSetHookTargetDetails' :: ChangeSetHookTargetDetails -> Maybe HookTargetType
$sel:resourceTargetDetails:ChangeSetHookTargetDetails' :: ChangeSetHookTargetDetails
-> Maybe ChangeSetHookResourceTargetDetails
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ChangeSetHookResourceTargetDetails
resourceTargetDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HookTargetType
targetType