{-# 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.AppConfig.Types.DeploymentStrategy
-- 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.AppConfig.Types.DeploymentStrategy where

import Amazonka.AppConfig.Types.GrowthType
import Amazonka.AppConfig.Types.ReplicateTo
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

-- | /See:/ 'newDeploymentStrategy' smart constructor.
data DeploymentStrategy = DeploymentStrategy'
  { -- | Total amount of time the deployment lasted.
    DeploymentStrategy -> Maybe Natural
deploymentDurationInMinutes :: Prelude.Maybe Prelude.Natural,
    -- | The description of the deployment strategy.
    DeploymentStrategy -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The amount of time that AppConfig monitored for alarms before
    -- considering the deployment to be complete and no longer eligible for
    -- automatic rollback.
    DeploymentStrategy -> Maybe Natural
finalBakeTimeInMinutes :: Prelude.Maybe Prelude.Natural,
    -- | The percentage of targets that received a deployed configuration during
    -- each interval.
    DeploymentStrategy -> Maybe Double
growthFactor :: Prelude.Maybe Prelude.Double,
    -- | The algorithm used to define how percentage grew over time.
    DeploymentStrategy -> Maybe GrowthType
growthType :: Prelude.Maybe GrowthType,
    -- | The deployment strategy ID.
    DeploymentStrategy -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of the deployment strategy.
    DeploymentStrategy -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Save the deployment strategy to a Systems Manager (SSM) document.
    DeploymentStrategy -> Maybe ReplicateTo
replicateTo :: Prelude.Maybe ReplicateTo
  }
  deriving (DeploymentStrategy -> DeploymentStrategy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeploymentStrategy -> DeploymentStrategy -> Bool
$c/= :: DeploymentStrategy -> DeploymentStrategy -> Bool
== :: DeploymentStrategy -> DeploymentStrategy -> Bool
$c== :: DeploymentStrategy -> DeploymentStrategy -> Bool
Prelude.Eq, ReadPrec [DeploymentStrategy]
ReadPrec DeploymentStrategy
Int -> ReadS DeploymentStrategy
ReadS [DeploymentStrategy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeploymentStrategy]
$creadListPrec :: ReadPrec [DeploymentStrategy]
readPrec :: ReadPrec DeploymentStrategy
$creadPrec :: ReadPrec DeploymentStrategy
readList :: ReadS [DeploymentStrategy]
$creadList :: ReadS [DeploymentStrategy]
readsPrec :: Int -> ReadS DeploymentStrategy
$creadsPrec :: Int -> ReadS DeploymentStrategy
Prelude.Read, Int -> DeploymentStrategy -> ShowS
[DeploymentStrategy] -> ShowS
DeploymentStrategy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeploymentStrategy] -> ShowS
$cshowList :: [DeploymentStrategy] -> ShowS
show :: DeploymentStrategy -> String
$cshow :: DeploymentStrategy -> String
showsPrec :: Int -> DeploymentStrategy -> ShowS
$cshowsPrec :: Int -> DeploymentStrategy -> ShowS
Prelude.Show, forall x. Rep DeploymentStrategy x -> DeploymentStrategy
forall x. DeploymentStrategy -> Rep DeploymentStrategy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeploymentStrategy x -> DeploymentStrategy
$cfrom :: forall x. DeploymentStrategy -> Rep DeploymentStrategy x
Prelude.Generic)

-- |
-- Create a value of 'DeploymentStrategy' 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:
--
-- 'deploymentDurationInMinutes', 'deploymentStrategy_deploymentDurationInMinutes' - Total amount of time the deployment lasted.
--
-- 'description', 'deploymentStrategy_description' - The description of the deployment strategy.
--
-- 'finalBakeTimeInMinutes', 'deploymentStrategy_finalBakeTimeInMinutes' - The amount of time that AppConfig monitored for alarms before
-- considering the deployment to be complete and no longer eligible for
-- automatic rollback.
--
-- 'growthFactor', 'deploymentStrategy_growthFactor' - The percentage of targets that received a deployed configuration during
-- each interval.
--
-- 'growthType', 'deploymentStrategy_growthType' - The algorithm used to define how percentage grew over time.
--
-- 'id', 'deploymentStrategy_id' - The deployment strategy ID.
--
-- 'name', 'deploymentStrategy_name' - The name of the deployment strategy.
--
-- 'replicateTo', 'deploymentStrategy_replicateTo' - Save the deployment strategy to a Systems Manager (SSM) document.
newDeploymentStrategy ::
  DeploymentStrategy
newDeploymentStrategy :: DeploymentStrategy
newDeploymentStrategy =
  DeploymentStrategy'
    { $sel:deploymentDurationInMinutes:DeploymentStrategy' :: Maybe Natural
deploymentDurationInMinutes =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:DeploymentStrategy' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:finalBakeTimeInMinutes:DeploymentStrategy' :: Maybe Natural
finalBakeTimeInMinutes = forall a. Maybe a
Prelude.Nothing,
      $sel:growthFactor:DeploymentStrategy' :: Maybe Double
growthFactor = forall a. Maybe a
Prelude.Nothing,
      $sel:growthType:DeploymentStrategy' :: Maybe GrowthType
growthType = forall a. Maybe a
Prelude.Nothing,
      $sel:id:DeploymentStrategy' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:DeploymentStrategy' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:replicateTo:DeploymentStrategy' :: Maybe ReplicateTo
replicateTo = forall a. Maybe a
Prelude.Nothing
    }

-- | Total amount of time the deployment lasted.
deploymentStrategy_deploymentDurationInMinutes :: Lens.Lens' DeploymentStrategy (Prelude.Maybe Prelude.Natural)
deploymentStrategy_deploymentDurationInMinutes :: Lens' DeploymentStrategy (Maybe Natural)
deploymentStrategy_deploymentDurationInMinutes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStrategy' {Maybe Natural
deploymentDurationInMinutes :: Maybe Natural
$sel:deploymentDurationInMinutes:DeploymentStrategy' :: DeploymentStrategy -> Maybe Natural
deploymentDurationInMinutes} -> Maybe Natural
deploymentDurationInMinutes) (\s :: DeploymentStrategy
s@DeploymentStrategy' {} Maybe Natural
a -> DeploymentStrategy
s {$sel:deploymentDurationInMinutes:DeploymentStrategy' :: Maybe Natural
deploymentDurationInMinutes = Maybe Natural
a} :: DeploymentStrategy)

-- | The description of the deployment strategy.
deploymentStrategy_description :: Lens.Lens' DeploymentStrategy (Prelude.Maybe Prelude.Text)
deploymentStrategy_description :: Lens' DeploymentStrategy (Maybe Text)
deploymentStrategy_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStrategy' {Maybe Text
description :: Maybe Text
$sel:description:DeploymentStrategy' :: DeploymentStrategy -> Maybe Text
description} -> Maybe Text
description) (\s :: DeploymentStrategy
s@DeploymentStrategy' {} Maybe Text
a -> DeploymentStrategy
s {$sel:description:DeploymentStrategy' :: Maybe Text
description = Maybe Text
a} :: DeploymentStrategy)

-- | The amount of time that AppConfig monitored for alarms before
-- considering the deployment to be complete and no longer eligible for
-- automatic rollback.
deploymentStrategy_finalBakeTimeInMinutes :: Lens.Lens' DeploymentStrategy (Prelude.Maybe Prelude.Natural)
deploymentStrategy_finalBakeTimeInMinutes :: Lens' DeploymentStrategy (Maybe Natural)
deploymentStrategy_finalBakeTimeInMinutes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStrategy' {Maybe Natural
finalBakeTimeInMinutes :: Maybe Natural
$sel:finalBakeTimeInMinutes:DeploymentStrategy' :: DeploymentStrategy -> Maybe Natural
finalBakeTimeInMinutes} -> Maybe Natural
finalBakeTimeInMinutes) (\s :: DeploymentStrategy
s@DeploymentStrategy' {} Maybe Natural
a -> DeploymentStrategy
s {$sel:finalBakeTimeInMinutes:DeploymentStrategy' :: Maybe Natural
finalBakeTimeInMinutes = Maybe Natural
a} :: DeploymentStrategy)

-- | The percentage of targets that received a deployed configuration during
-- each interval.
deploymentStrategy_growthFactor :: Lens.Lens' DeploymentStrategy (Prelude.Maybe Prelude.Double)
deploymentStrategy_growthFactor :: Lens' DeploymentStrategy (Maybe Double)
deploymentStrategy_growthFactor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStrategy' {Maybe Double
growthFactor :: Maybe Double
$sel:growthFactor:DeploymentStrategy' :: DeploymentStrategy -> Maybe Double
growthFactor} -> Maybe Double
growthFactor) (\s :: DeploymentStrategy
s@DeploymentStrategy' {} Maybe Double
a -> DeploymentStrategy
s {$sel:growthFactor:DeploymentStrategy' :: Maybe Double
growthFactor = Maybe Double
a} :: DeploymentStrategy)

-- | The algorithm used to define how percentage grew over time.
deploymentStrategy_growthType :: Lens.Lens' DeploymentStrategy (Prelude.Maybe GrowthType)
deploymentStrategy_growthType :: Lens' DeploymentStrategy (Maybe GrowthType)
deploymentStrategy_growthType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStrategy' {Maybe GrowthType
growthType :: Maybe GrowthType
$sel:growthType:DeploymentStrategy' :: DeploymentStrategy -> Maybe GrowthType
growthType} -> Maybe GrowthType
growthType) (\s :: DeploymentStrategy
s@DeploymentStrategy' {} Maybe GrowthType
a -> DeploymentStrategy
s {$sel:growthType:DeploymentStrategy' :: Maybe GrowthType
growthType = Maybe GrowthType
a} :: DeploymentStrategy)

-- | The deployment strategy ID.
deploymentStrategy_id :: Lens.Lens' DeploymentStrategy (Prelude.Maybe Prelude.Text)
deploymentStrategy_id :: Lens' DeploymentStrategy (Maybe Text)
deploymentStrategy_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStrategy' {Maybe Text
id :: Maybe Text
$sel:id:DeploymentStrategy' :: DeploymentStrategy -> Maybe Text
id} -> Maybe Text
id) (\s :: DeploymentStrategy
s@DeploymentStrategy' {} Maybe Text
a -> DeploymentStrategy
s {$sel:id:DeploymentStrategy' :: Maybe Text
id = Maybe Text
a} :: DeploymentStrategy)

-- | The name of the deployment strategy.
deploymentStrategy_name :: Lens.Lens' DeploymentStrategy (Prelude.Maybe Prelude.Text)
deploymentStrategy_name :: Lens' DeploymentStrategy (Maybe Text)
deploymentStrategy_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStrategy' {Maybe Text
name :: Maybe Text
$sel:name:DeploymentStrategy' :: DeploymentStrategy -> Maybe Text
name} -> Maybe Text
name) (\s :: DeploymentStrategy
s@DeploymentStrategy' {} Maybe Text
a -> DeploymentStrategy
s {$sel:name:DeploymentStrategy' :: Maybe Text
name = Maybe Text
a} :: DeploymentStrategy)

-- | Save the deployment strategy to a Systems Manager (SSM) document.
deploymentStrategy_replicateTo :: Lens.Lens' DeploymentStrategy (Prelude.Maybe ReplicateTo)
deploymentStrategy_replicateTo :: Lens' DeploymentStrategy (Maybe ReplicateTo)
deploymentStrategy_replicateTo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeploymentStrategy' {Maybe ReplicateTo
replicateTo :: Maybe ReplicateTo
$sel:replicateTo:DeploymentStrategy' :: DeploymentStrategy -> Maybe ReplicateTo
replicateTo} -> Maybe ReplicateTo
replicateTo) (\s :: DeploymentStrategy
s@DeploymentStrategy' {} Maybe ReplicateTo
a -> DeploymentStrategy
s {$sel:replicateTo:DeploymentStrategy' :: Maybe ReplicateTo
replicateTo = Maybe ReplicateTo
a} :: DeploymentStrategy)

instance Data.FromJSON DeploymentStrategy where
  parseJSON :: Value -> Parser DeploymentStrategy
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DeploymentStrategy"
      ( \Object
x ->
          Maybe Natural
-> Maybe Text
-> Maybe Natural
-> Maybe Double
-> Maybe GrowthType
-> Maybe Text
-> Maybe Text
-> Maybe ReplicateTo
-> DeploymentStrategy
DeploymentStrategy'
            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
"DeploymentDurationInMinutes")
            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
"Description")
            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
"FinalBakeTimeInMinutes")
            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
"GrowthFactor")
            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
"GrowthType")
            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
"Id")
            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
"Name")
            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
"ReplicateTo")
      )

instance Prelude.Hashable DeploymentStrategy where
  hashWithSalt :: Int -> DeploymentStrategy -> Int
hashWithSalt Int
_salt DeploymentStrategy' {Maybe Double
Maybe Natural
Maybe Text
Maybe GrowthType
Maybe ReplicateTo
replicateTo :: Maybe ReplicateTo
name :: Maybe Text
id :: Maybe Text
growthType :: Maybe GrowthType
growthFactor :: Maybe Double
finalBakeTimeInMinutes :: Maybe Natural
description :: Maybe Text
deploymentDurationInMinutes :: Maybe Natural
$sel:replicateTo:DeploymentStrategy' :: DeploymentStrategy -> Maybe ReplicateTo
$sel:name:DeploymentStrategy' :: DeploymentStrategy -> Maybe Text
$sel:id:DeploymentStrategy' :: DeploymentStrategy -> Maybe Text
$sel:growthType:DeploymentStrategy' :: DeploymentStrategy -> Maybe GrowthType
$sel:growthFactor:DeploymentStrategy' :: DeploymentStrategy -> Maybe Double
$sel:finalBakeTimeInMinutes:DeploymentStrategy' :: DeploymentStrategy -> Maybe Natural
$sel:description:DeploymentStrategy' :: DeploymentStrategy -> Maybe Text
$sel:deploymentDurationInMinutes:DeploymentStrategy' :: DeploymentStrategy -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
deploymentDurationInMinutes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
finalBakeTimeInMinutes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
growthFactor
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GrowthType
growthType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReplicateTo
replicateTo

instance Prelude.NFData DeploymentStrategy where
  rnf :: DeploymentStrategy -> ()
rnf DeploymentStrategy' {Maybe Double
Maybe Natural
Maybe Text
Maybe GrowthType
Maybe ReplicateTo
replicateTo :: Maybe ReplicateTo
name :: Maybe Text
id :: Maybe Text
growthType :: Maybe GrowthType
growthFactor :: Maybe Double
finalBakeTimeInMinutes :: Maybe Natural
description :: Maybe Text
deploymentDurationInMinutes :: Maybe Natural
$sel:replicateTo:DeploymentStrategy' :: DeploymentStrategy -> Maybe ReplicateTo
$sel:name:DeploymentStrategy' :: DeploymentStrategy -> Maybe Text
$sel:id:DeploymentStrategy' :: DeploymentStrategy -> Maybe Text
$sel:growthType:DeploymentStrategy' :: DeploymentStrategy -> Maybe GrowthType
$sel:growthFactor:DeploymentStrategy' :: DeploymentStrategy -> Maybe Double
$sel:finalBakeTimeInMinutes:DeploymentStrategy' :: DeploymentStrategy -> Maybe Natural
$sel:description:DeploymentStrategy' :: DeploymentStrategy -> Maybe Text
$sel:deploymentDurationInMinutes:DeploymentStrategy' :: DeploymentStrategy -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
deploymentDurationInMinutes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
finalBakeTimeInMinutes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
growthFactor
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GrowthType
growthType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ReplicateTo
replicateTo