{-# 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.CodeDeploy.Types.CloudFormationTarget
-- 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.CodeDeploy.Types.CloudFormationTarget where

import Amazonka.CodeDeploy.Types.LifecycleEvent
import Amazonka.CodeDeploy.Types.TargetStatus
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

-- | Information about the target to be updated by an CloudFormation
-- blue\/green deployment. This target type is used for all deployments
-- initiated by a CloudFormation stack update.
--
-- /See:/ 'newCloudFormationTarget' smart constructor.
data CloudFormationTarget = CloudFormationTarget'
  { -- | The unique ID of an CloudFormation blue\/green deployment.
    CloudFormationTarget -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text,
    -- | The date and time when the target application was updated by an
    -- CloudFormation blue\/green deployment.
    CloudFormationTarget -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Data.POSIX,
    -- | The lifecycle events of the CloudFormation blue\/green deployment to
    -- this target application.
    CloudFormationTarget -> Maybe [LifecycleEvent]
lifecycleEvents :: Prelude.Maybe [LifecycleEvent],
    -- | The resource type for the CloudFormation blue\/green deployment.
    CloudFormationTarget -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The status of an CloudFormation blue\/green deployment\'s target
    -- application.
    CloudFormationTarget -> Maybe TargetStatus
status :: Prelude.Maybe TargetStatus,
    -- | The unique ID of a deployment target that has a type
    -- of @CloudFormationTarget@.
    CloudFormationTarget -> Maybe Text
targetId :: Prelude.Maybe Prelude.Text,
    -- | The percentage of production traffic that the target version of an
    -- CloudFormation blue\/green deployment receives.
    CloudFormationTarget -> Maybe Double
targetVersionWeight :: Prelude.Maybe Prelude.Double
  }
  deriving (CloudFormationTarget -> CloudFormationTarget -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudFormationTarget -> CloudFormationTarget -> Bool
$c/= :: CloudFormationTarget -> CloudFormationTarget -> Bool
== :: CloudFormationTarget -> CloudFormationTarget -> Bool
$c== :: CloudFormationTarget -> CloudFormationTarget -> Bool
Prelude.Eq, ReadPrec [CloudFormationTarget]
ReadPrec CloudFormationTarget
Int -> ReadS CloudFormationTarget
ReadS [CloudFormationTarget]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudFormationTarget]
$creadListPrec :: ReadPrec [CloudFormationTarget]
readPrec :: ReadPrec CloudFormationTarget
$creadPrec :: ReadPrec CloudFormationTarget
readList :: ReadS [CloudFormationTarget]
$creadList :: ReadS [CloudFormationTarget]
readsPrec :: Int -> ReadS CloudFormationTarget
$creadsPrec :: Int -> ReadS CloudFormationTarget
Prelude.Read, Int -> CloudFormationTarget -> ShowS
[CloudFormationTarget] -> ShowS
CloudFormationTarget -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudFormationTarget] -> ShowS
$cshowList :: [CloudFormationTarget] -> ShowS
show :: CloudFormationTarget -> String
$cshow :: CloudFormationTarget -> String
showsPrec :: Int -> CloudFormationTarget -> ShowS
$cshowsPrec :: Int -> CloudFormationTarget -> ShowS
Prelude.Show, forall x. Rep CloudFormationTarget x -> CloudFormationTarget
forall x. CloudFormationTarget -> Rep CloudFormationTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloudFormationTarget x -> CloudFormationTarget
$cfrom :: forall x. CloudFormationTarget -> Rep CloudFormationTarget x
Prelude.Generic)

-- |
-- Create a value of 'CloudFormationTarget' 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:
--
-- 'deploymentId', 'cloudFormationTarget_deploymentId' - The unique ID of an CloudFormation blue\/green deployment.
--
-- 'lastUpdatedAt', 'cloudFormationTarget_lastUpdatedAt' - The date and time when the target application was updated by an
-- CloudFormation blue\/green deployment.
--
-- 'lifecycleEvents', 'cloudFormationTarget_lifecycleEvents' - The lifecycle events of the CloudFormation blue\/green deployment to
-- this target application.
--
-- 'resourceType', 'cloudFormationTarget_resourceType' - The resource type for the CloudFormation blue\/green deployment.
--
-- 'status', 'cloudFormationTarget_status' - The status of an CloudFormation blue\/green deployment\'s target
-- application.
--
-- 'targetId', 'cloudFormationTarget_targetId' - The unique ID of a deployment target that has a type
-- of @CloudFormationTarget@.
--
-- 'targetVersionWeight', 'cloudFormationTarget_targetVersionWeight' - The percentage of production traffic that the target version of an
-- CloudFormation blue\/green deployment receives.
newCloudFormationTarget ::
  CloudFormationTarget
newCloudFormationTarget :: CloudFormationTarget
newCloudFormationTarget =
  CloudFormationTarget'
    { $sel:deploymentId:CloudFormationTarget' :: Maybe Text
deploymentId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedAt:CloudFormationTarget' :: Maybe POSIX
lastUpdatedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:lifecycleEvents:CloudFormationTarget' :: Maybe [LifecycleEvent]
lifecycleEvents = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:CloudFormationTarget' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:status:CloudFormationTarget' :: Maybe TargetStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:targetId:CloudFormationTarget' :: Maybe Text
targetId = forall a. Maybe a
Prelude.Nothing,
      $sel:targetVersionWeight:CloudFormationTarget' :: Maybe Double
targetVersionWeight = forall a. Maybe a
Prelude.Nothing
    }

-- | The unique ID of an CloudFormation blue\/green deployment.
cloudFormationTarget_deploymentId :: Lens.Lens' CloudFormationTarget (Prelude.Maybe Prelude.Text)
cloudFormationTarget_deploymentId :: Lens' CloudFormationTarget (Maybe Text)
cloudFormationTarget_deploymentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationTarget' {Maybe Text
deploymentId :: Maybe Text
$sel:deploymentId:CloudFormationTarget' :: CloudFormationTarget -> Maybe Text
deploymentId} -> Maybe Text
deploymentId) (\s :: CloudFormationTarget
s@CloudFormationTarget' {} Maybe Text
a -> CloudFormationTarget
s {$sel:deploymentId:CloudFormationTarget' :: Maybe Text
deploymentId = Maybe Text
a} :: CloudFormationTarget)

-- | The date and time when the target application was updated by an
-- CloudFormation blue\/green deployment.
cloudFormationTarget_lastUpdatedAt :: Lens.Lens' CloudFormationTarget (Prelude.Maybe Prelude.UTCTime)
cloudFormationTarget_lastUpdatedAt :: Lens' CloudFormationTarget (Maybe UTCTime)
cloudFormationTarget_lastUpdatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationTarget' {Maybe POSIX
lastUpdatedAt :: Maybe POSIX
$sel:lastUpdatedAt:CloudFormationTarget' :: CloudFormationTarget -> Maybe POSIX
lastUpdatedAt} -> Maybe POSIX
lastUpdatedAt) (\s :: CloudFormationTarget
s@CloudFormationTarget' {} Maybe POSIX
a -> CloudFormationTarget
s {$sel:lastUpdatedAt:CloudFormationTarget' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
a} :: CloudFormationTarget) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The lifecycle events of the CloudFormation blue\/green deployment to
-- this target application.
cloudFormationTarget_lifecycleEvents :: Lens.Lens' CloudFormationTarget (Prelude.Maybe [LifecycleEvent])
cloudFormationTarget_lifecycleEvents :: Lens' CloudFormationTarget (Maybe [LifecycleEvent])
cloudFormationTarget_lifecycleEvents = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationTarget' {Maybe [LifecycleEvent]
lifecycleEvents :: Maybe [LifecycleEvent]
$sel:lifecycleEvents:CloudFormationTarget' :: CloudFormationTarget -> Maybe [LifecycleEvent]
lifecycleEvents} -> Maybe [LifecycleEvent]
lifecycleEvents) (\s :: CloudFormationTarget
s@CloudFormationTarget' {} Maybe [LifecycleEvent]
a -> CloudFormationTarget
s {$sel:lifecycleEvents:CloudFormationTarget' :: Maybe [LifecycleEvent]
lifecycleEvents = Maybe [LifecycleEvent]
a} :: CloudFormationTarget) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The resource type for the CloudFormation blue\/green deployment.
cloudFormationTarget_resourceType :: Lens.Lens' CloudFormationTarget (Prelude.Maybe Prelude.Text)
cloudFormationTarget_resourceType :: Lens' CloudFormationTarget (Maybe Text)
cloudFormationTarget_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationTarget' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:CloudFormationTarget' :: CloudFormationTarget -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: CloudFormationTarget
s@CloudFormationTarget' {} Maybe Text
a -> CloudFormationTarget
s {$sel:resourceType:CloudFormationTarget' :: Maybe Text
resourceType = Maybe Text
a} :: CloudFormationTarget)

-- | The status of an CloudFormation blue\/green deployment\'s target
-- application.
cloudFormationTarget_status :: Lens.Lens' CloudFormationTarget (Prelude.Maybe TargetStatus)
cloudFormationTarget_status :: Lens' CloudFormationTarget (Maybe TargetStatus)
cloudFormationTarget_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationTarget' {Maybe TargetStatus
status :: Maybe TargetStatus
$sel:status:CloudFormationTarget' :: CloudFormationTarget -> Maybe TargetStatus
status} -> Maybe TargetStatus
status) (\s :: CloudFormationTarget
s@CloudFormationTarget' {} Maybe TargetStatus
a -> CloudFormationTarget
s {$sel:status:CloudFormationTarget' :: Maybe TargetStatus
status = Maybe TargetStatus
a} :: CloudFormationTarget)

-- | The unique ID of a deployment target that has a type
-- of @CloudFormationTarget@.
cloudFormationTarget_targetId :: Lens.Lens' CloudFormationTarget (Prelude.Maybe Prelude.Text)
cloudFormationTarget_targetId :: Lens' CloudFormationTarget (Maybe Text)
cloudFormationTarget_targetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationTarget' {Maybe Text
targetId :: Maybe Text
$sel:targetId:CloudFormationTarget' :: CloudFormationTarget -> Maybe Text
targetId} -> Maybe Text
targetId) (\s :: CloudFormationTarget
s@CloudFormationTarget' {} Maybe Text
a -> CloudFormationTarget
s {$sel:targetId:CloudFormationTarget' :: Maybe Text
targetId = Maybe Text
a} :: CloudFormationTarget)

-- | The percentage of production traffic that the target version of an
-- CloudFormation blue\/green deployment receives.
cloudFormationTarget_targetVersionWeight :: Lens.Lens' CloudFormationTarget (Prelude.Maybe Prelude.Double)
cloudFormationTarget_targetVersionWeight :: Lens' CloudFormationTarget (Maybe Double)
cloudFormationTarget_targetVersionWeight = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationTarget' {Maybe Double
targetVersionWeight :: Maybe Double
$sel:targetVersionWeight:CloudFormationTarget' :: CloudFormationTarget -> Maybe Double
targetVersionWeight} -> Maybe Double
targetVersionWeight) (\s :: CloudFormationTarget
s@CloudFormationTarget' {} Maybe Double
a -> CloudFormationTarget
s {$sel:targetVersionWeight:CloudFormationTarget' :: Maybe Double
targetVersionWeight = Maybe Double
a} :: CloudFormationTarget)

instance Data.FromJSON CloudFormationTarget where
  parseJSON :: Value -> Parser CloudFormationTarget
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CloudFormationTarget"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe [LifecycleEvent]
-> Maybe Text
-> Maybe TargetStatus
-> Maybe Text
-> Maybe Double
-> CloudFormationTarget
CloudFormationTarget'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"deploymentId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lastUpdatedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lifecycleEvents"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"resourceType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"targetId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"targetVersionWeight")
      )

instance Prelude.Hashable CloudFormationTarget where
  hashWithSalt :: Int -> CloudFormationTarget -> Int
hashWithSalt Int
_salt CloudFormationTarget' {Maybe Double
Maybe [LifecycleEvent]
Maybe Text
Maybe POSIX
Maybe TargetStatus
targetVersionWeight :: Maybe Double
targetId :: Maybe Text
status :: Maybe TargetStatus
resourceType :: Maybe Text
lifecycleEvents :: Maybe [LifecycleEvent]
lastUpdatedAt :: Maybe POSIX
deploymentId :: Maybe Text
$sel:targetVersionWeight:CloudFormationTarget' :: CloudFormationTarget -> Maybe Double
$sel:targetId:CloudFormationTarget' :: CloudFormationTarget -> Maybe Text
$sel:status:CloudFormationTarget' :: CloudFormationTarget -> Maybe TargetStatus
$sel:resourceType:CloudFormationTarget' :: CloudFormationTarget -> Maybe Text
$sel:lifecycleEvents:CloudFormationTarget' :: CloudFormationTarget -> Maybe [LifecycleEvent]
$sel:lastUpdatedAt:CloudFormationTarget' :: CloudFormationTarget -> Maybe POSIX
$sel:deploymentId:CloudFormationTarget' :: CloudFormationTarget -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [LifecycleEvent]
lifecycleEvents
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
targetVersionWeight

instance Prelude.NFData CloudFormationTarget where
  rnf :: CloudFormationTarget -> ()
rnf CloudFormationTarget' {Maybe Double
Maybe [LifecycleEvent]
Maybe Text
Maybe POSIX
Maybe TargetStatus
targetVersionWeight :: Maybe Double
targetId :: Maybe Text
status :: Maybe TargetStatus
resourceType :: Maybe Text
lifecycleEvents :: Maybe [LifecycleEvent]
lastUpdatedAt :: Maybe POSIX
deploymentId :: Maybe Text
$sel:targetVersionWeight:CloudFormationTarget' :: CloudFormationTarget -> Maybe Double
$sel:targetId:CloudFormationTarget' :: CloudFormationTarget -> Maybe Text
$sel:status:CloudFormationTarget' :: CloudFormationTarget -> Maybe TargetStatus
$sel:resourceType:CloudFormationTarget' :: CloudFormationTarget -> Maybe Text
$sel:lifecycleEvents:CloudFormationTarget' :: CloudFormationTarget -> Maybe [LifecycleEvent]
$sel:lastUpdatedAt:CloudFormationTarget' :: CloudFormationTarget -> Maybe POSIX
$sel:deploymentId:CloudFormationTarget' :: CloudFormationTarget -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [LifecycleEvent]
lifecycleEvents
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
targetVersionWeight