{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.CreateDeploymentStrategy
-- 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)
--
-- A deployment strategy defines important criteria for rolling out your
-- configuration to the designated targets. A deployment strategy includes:
-- the overall duration required, a percentage of targets to receive the
-- deployment during each interval, an algorithm that defines how
-- percentage grows, and bake time.
module Amazonka.AppConfig.CreateDeploymentStrategy
  ( -- * Creating a Request
    CreateDeploymentStrategy (..),
    newCreateDeploymentStrategy,

    -- * Request Lenses
    createDeploymentStrategy_finalBakeTimeInMinutes,
    createDeploymentStrategy_description,
    createDeploymentStrategy_growthType,
    createDeploymentStrategy_tags,
    createDeploymentStrategy_name,
    createDeploymentStrategy_deploymentDurationInMinutes,
    createDeploymentStrategy_growthFactor,
    createDeploymentStrategy_replicateTo,

    -- * Destructuring the Response
    DeploymentStrategy (..),
    newDeploymentStrategy,

    -- * Response Lenses
    deploymentStrategy_growthFactor,
    deploymentStrategy_replicateTo,
    deploymentStrategy_name,
    deploymentStrategy_id,
    deploymentStrategy_deploymentDurationInMinutes,
    deploymentStrategy_finalBakeTimeInMinutes,
    deploymentStrategy_description,
    deploymentStrategy_growthType,
  )
where

import Amazonka.AppConfig.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateDeploymentStrategy' smart constructor.
data CreateDeploymentStrategy = CreateDeploymentStrategy'
  { -- | The amount of time AppConfig monitors for alarms before considering the
    -- deployment to be complete and no longer eligible for automatic roll
    -- back.
    CreateDeploymentStrategy -> Maybe Natural
finalBakeTimeInMinutes :: Prelude.Maybe Prelude.Natural,
    -- | A description of the deployment strategy.
    CreateDeploymentStrategy -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The algorithm used to define how percentage grows over time. AWS
    -- AppConfig supports the following growth types:
    --
    -- __Linear__: For this type, AppConfig processes the deployment by
    -- dividing the total number of targets by the value specified for
    -- @Step percentage@. For example, a linear deployment that uses a
    -- @Step percentage@ of 10 deploys the configuration to 10 percent of the
    -- hosts. After those deployments are complete, the system deploys the
    -- configuration to the next 10 percent. This continues until 100% of the
    -- targets have successfully received the configuration.
    --
    -- __Exponential__: For this type, AppConfig processes the deployment
    -- exponentially using the following formula: @G*(2^N)@. In this formula,
    -- @G@ is the growth factor specified by the user and @N@ is the number of
    -- steps until the configuration is deployed to all targets. For example,
    -- if you specify a growth factor of 2, then the system rolls out the
    -- configuration as follows:
    --
    -- @2*(2^0)@
    --
    -- @2*(2^1)@
    --
    -- @2*(2^2)@
    --
    -- Expressed numerically, the deployment rolls out as follows: 2% of the
    -- targets, 4% of the targets, 8% of the targets, and continues until the
    -- configuration has been deployed to all targets.
    CreateDeploymentStrategy -> Maybe GrowthType
growthType :: Prelude.Maybe GrowthType,
    -- | Metadata to assign to the deployment strategy. Tags help organize and
    -- categorize your AppConfig resources. Each tag consists of a key and an
    -- optional value, both of which you define.
    CreateDeploymentStrategy -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A name for the deployment strategy.
    CreateDeploymentStrategy -> Text
name :: Prelude.Text,
    -- | Total amount of time for a deployment to last.
    CreateDeploymentStrategy -> Natural
deploymentDurationInMinutes :: Prelude.Natural,
    -- | The percentage of targets to receive a deployed configuration during
    -- each interval.
    CreateDeploymentStrategy -> Double
growthFactor :: Prelude.Double,
    -- | Save the deployment strategy to a Systems Manager (SSM) document.
    CreateDeploymentStrategy -> ReplicateTo
replicateTo :: ReplicateTo
  }
  deriving (CreateDeploymentStrategy -> CreateDeploymentStrategy -> Bool
(CreateDeploymentStrategy -> CreateDeploymentStrategy -> Bool)
-> (CreateDeploymentStrategy -> CreateDeploymentStrategy -> Bool)
-> Eq CreateDeploymentStrategy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDeploymentStrategy -> CreateDeploymentStrategy -> Bool
$c/= :: CreateDeploymentStrategy -> CreateDeploymentStrategy -> Bool
== :: CreateDeploymentStrategy -> CreateDeploymentStrategy -> Bool
$c== :: CreateDeploymentStrategy -> CreateDeploymentStrategy -> Bool
Prelude.Eq, ReadPrec [CreateDeploymentStrategy]
ReadPrec CreateDeploymentStrategy
Int -> ReadS CreateDeploymentStrategy
ReadS [CreateDeploymentStrategy]
(Int -> ReadS CreateDeploymentStrategy)
-> ReadS [CreateDeploymentStrategy]
-> ReadPrec CreateDeploymentStrategy
-> ReadPrec [CreateDeploymentStrategy]
-> Read CreateDeploymentStrategy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDeploymentStrategy]
$creadListPrec :: ReadPrec [CreateDeploymentStrategy]
readPrec :: ReadPrec CreateDeploymentStrategy
$creadPrec :: ReadPrec CreateDeploymentStrategy
readList :: ReadS [CreateDeploymentStrategy]
$creadList :: ReadS [CreateDeploymentStrategy]
readsPrec :: Int -> ReadS CreateDeploymentStrategy
$creadsPrec :: Int -> ReadS CreateDeploymentStrategy
Prelude.Read, Int -> CreateDeploymentStrategy -> ShowS
[CreateDeploymentStrategy] -> ShowS
CreateDeploymentStrategy -> String
(Int -> CreateDeploymentStrategy -> ShowS)
-> (CreateDeploymentStrategy -> String)
-> ([CreateDeploymentStrategy] -> ShowS)
-> Show CreateDeploymentStrategy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDeploymentStrategy] -> ShowS
$cshowList :: [CreateDeploymentStrategy] -> ShowS
show :: CreateDeploymentStrategy -> String
$cshow :: CreateDeploymentStrategy -> String
showsPrec :: Int -> CreateDeploymentStrategy -> ShowS
$cshowsPrec :: Int -> CreateDeploymentStrategy -> ShowS
Prelude.Show, (forall x.
 CreateDeploymentStrategy -> Rep CreateDeploymentStrategy x)
-> (forall x.
    Rep CreateDeploymentStrategy x -> CreateDeploymentStrategy)
-> Generic CreateDeploymentStrategy
forall x.
Rep CreateDeploymentStrategy x -> CreateDeploymentStrategy
forall x.
CreateDeploymentStrategy -> Rep CreateDeploymentStrategy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDeploymentStrategy x -> CreateDeploymentStrategy
$cfrom :: forall x.
CreateDeploymentStrategy -> Rep CreateDeploymentStrategy x
Prelude.Generic)

-- |
-- Create a value of 'CreateDeploymentStrategy' 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:
--
-- 'finalBakeTimeInMinutes', 'createDeploymentStrategy_finalBakeTimeInMinutes' - The amount of time AppConfig monitors for alarms before considering the
-- deployment to be complete and no longer eligible for automatic roll
-- back.
--
-- 'description', 'createDeploymentStrategy_description' - A description of the deployment strategy.
--
-- 'growthType', 'createDeploymentStrategy_growthType' - The algorithm used to define how percentage grows over time. AWS
-- AppConfig supports the following growth types:
--
-- __Linear__: For this type, AppConfig processes the deployment by
-- dividing the total number of targets by the value specified for
-- @Step percentage@. For example, a linear deployment that uses a
-- @Step percentage@ of 10 deploys the configuration to 10 percent of the
-- hosts. After those deployments are complete, the system deploys the
-- configuration to the next 10 percent. This continues until 100% of the
-- targets have successfully received the configuration.
--
-- __Exponential__: For this type, AppConfig processes the deployment
-- exponentially using the following formula: @G*(2^N)@. In this formula,
-- @G@ is the growth factor specified by the user and @N@ is the number of
-- steps until the configuration is deployed to all targets. For example,
-- if you specify a growth factor of 2, then the system rolls out the
-- configuration as follows:
--
-- @2*(2^0)@
--
-- @2*(2^1)@
--
-- @2*(2^2)@
--
-- Expressed numerically, the deployment rolls out as follows: 2% of the
-- targets, 4% of the targets, 8% of the targets, and continues until the
-- configuration has been deployed to all targets.
--
-- 'tags', 'createDeploymentStrategy_tags' - Metadata to assign to the deployment strategy. Tags help organize and
-- categorize your AppConfig resources. Each tag consists of a key and an
-- optional value, both of which you define.
--
-- 'name', 'createDeploymentStrategy_name' - A name for the deployment strategy.
--
-- 'deploymentDurationInMinutes', 'createDeploymentStrategy_deploymentDurationInMinutes' - Total amount of time for a deployment to last.
--
-- 'growthFactor', 'createDeploymentStrategy_growthFactor' - The percentage of targets to receive a deployed configuration during
-- each interval.
--
-- 'replicateTo', 'createDeploymentStrategy_replicateTo' - Save the deployment strategy to a Systems Manager (SSM) document.
newCreateDeploymentStrategy ::
  -- | 'name'
  Prelude.Text ->
  -- | 'deploymentDurationInMinutes'
  Prelude.Natural ->
  -- | 'growthFactor'
  Prelude.Double ->
  -- | 'replicateTo'
  ReplicateTo ->
  CreateDeploymentStrategy
newCreateDeploymentStrategy :: Text
-> Natural -> Double -> ReplicateTo -> CreateDeploymentStrategy
newCreateDeploymentStrategy
  Text
pName_
  Natural
pDeploymentDurationInMinutes_
  Double
pGrowthFactor_
  ReplicateTo
pReplicateTo_ =
    CreateDeploymentStrategy' :: Maybe Natural
-> Maybe Text
-> Maybe GrowthType
-> Maybe (HashMap Text Text)
-> Text
-> Natural
-> Double
-> ReplicateTo
-> CreateDeploymentStrategy
CreateDeploymentStrategy'
      { $sel:finalBakeTimeInMinutes:CreateDeploymentStrategy' :: Maybe Natural
finalBakeTimeInMinutes =
          Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateDeploymentStrategy' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:growthType:CreateDeploymentStrategy' :: Maybe GrowthType
growthType = Maybe GrowthType
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateDeploymentStrategy' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateDeploymentStrategy' :: Text
name = Text
pName_,
        $sel:deploymentDurationInMinutes:CreateDeploymentStrategy' :: Natural
deploymentDurationInMinutes =
          Natural
pDeploymentDurationInMinutes_,
        $sel:growthFactor:CreateDeploymentStrategy' :: Double
growthFactor = Double
pGrowthFactor_,
        $sel:replicateTo:CreateDeploymentStrategy' :: ReplicateTo
replicateTo = ReplicateTo
pReplicateTo_
      }

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

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

-- | The algorithm used to define how percentage grows over time. AWS
-- AppConfig supports the following growth types:
--
-- __Linear__: For this type, AppConfig processes the deployment by
-- dividing the total number of targets by the value specified for
-- @Step percentage@. For example, a linear deployment that uses a
-- @Step percentage@ of 10 deploys the configuration to 10 percent of the
-- hosts. After those deployments are complete, the system deploys the
-- configuration to the next 10 percent. This continues until 100% of the
-- targets have successfully received the configuration.
--
-- __Exponential__: For this type, AppConfig processes the deployment
-- exponentially using the following formula: @G*(2^N)@. In this formula,
-- @G@ is the growth factor specified by the user and @N@ is the number of
-- steps until the configuration is deployed to all targets. For example,
-- if you specify a growth factor of 2, then the system rolls out the
-- configuration as follows:
--
-- @2*(2^0)@
--
-- @2*(2^1)@
--
-- @2*(2^2)@
--
-- Expressed numerically, the deployment rolls out as follows: 2% of the
-- targets, 4% of the targets, 8% of the targets, and continues until the
-- configuration has been deployed to all targets.
createDeploymentStrategy_growthType :: Lens.Lens' CreateDeploymentStrategy (Prelude.Maybe GrowthType)
createDeploymentStrategy_growthType :: (Maybe GrowthType -> f (Maybe GrowthType))
-> CreateDeploymentStrategy -> f CreateDeploymentStrategy
createDeploymentStrategy_growthType = (CreateDeploymentStrategy -> Maybe GrowthType)
-> (CreateDeploymentStrategy
    -> Maybe GrowthType -> CreateDeploymentStrategy)
-> Lens
     CreateDeploymentStrategy
     CreateDeploymentStrategy
     (Maybe GrowthType)
     (Maybe GrowthType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentStrategy' {Maybe GrowthType
growthType :: Maybe GrowthType
$sel:growthType:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Maybe GrowthType
growthType} -> Maybe GrowthType
growthType) (\s :: CreateDeploymentStrategy
s@CreateDeploymentStrategy' {} Maybe GrowthType
a -> CreateDeploymentStrategy
s {$sel:growthType:CreateDeploymentStrategy' :: Maybe GrowthType
growthType = Maybe GrowthType
a} :: CreateDeploymentStrategy)

-- | Metadata to assign to the deployment strategy. Tags help organize and
-- categorize your AppConfig resources. Each tag consists of a key and an
-- optional value, both of which you define.
createDeploymentStrategy_tags :: Lens.Lens' CreateDeploymentStrategy (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createDeploymentStrategy_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDeploymentStrategy -> f CreateDeploymentStrategy
createDeploymentStrategy_tags = (CreateDeploymentStrategy -> Maybe (HashMap Text Text))
-> (CreateDeploymentStrategy
    -> Maybe (HashMap Text Text) -> CreateDeploymentStrategy)
-> Lens
     CreateDeploymentStrategy
     CreateDeploymentStrategy
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentStrategy' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateDeploymentStrategy
s@CreateDeploymentStrategy' {} Maybe (HashMap Text Text)
a -> CreateDeploymentStrategy
s {$sel:tags:CreateDeploymentStrategy' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateDeploymentStrategy) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateDeploymentStrategy -> f CreateDeploymentStrategy)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateDeploymentStrategy
-> f CreateDeploymentStrategy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A name for the deployment strategy.
createDeploymentStrategy_name :: Lens.Lens' CreateDeploymentStrategy Prelude.Text
createDeploymentStrategy_name :: (Text -> f Text)
-> CreateDeploymentStrategy -> f CreateDeploymentStrategy
createDeploymentStrategy_name = (CreateDeploymentStrategy -> Text)
-> (CreateDeploymentStrategy -> Text -> CreateDeploymentStrategy)
-> Lens CreateDeploymentStrategy CreateDeploymentStrategy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentStrategy' {Text
name :: Text
$sel:name:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Text
name} -> Text
name) (\s :: CreateDeploymentStrategy
s@CreateDeploymentStrategy' {} Text
a -> CreateDeploymentStrategy
s {$sel:name:CreateDeploymentStrategy' :: Text
name = Text
a} :: CreateDeploymentStrategy)

-- | Total amount of time for a deployment to last.
createDeploymentStrategy_deploymentDurationInMinutes :: Lens.Lens' CreateDeploymentStrategy Prelude.Natural
createDeploymentStrategy_deploymentDurationInMinutes :: (Natural -> f Natural)
-> CreateDeploymentStrategy -> f CreateDeploymentStrategy
createDeploymentStrategy_deploymentDurationInMinutes = (CreateDeploymentStrategy -> Natural)
-> (CreateDeploymentStrategy
    -> Natural -> CreateDeploymentStrategy)
-> Lens
     CreateDeploymentStrategy CreateDeploymentStrategy Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentStrategy' {Natural
deploymentDurationInMinutes :: Natural
$sel:deploymentDurationInMinutes:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Natural
deploymentDurationInMinutes} -> Natural
deploymentDurationInMinutes) (\s :: CreateDeploymentStrategy
s@CreateDeploymentStrategy' {} Natural
a -> CreateDeploymentStrategy
s {$sel:deploymentDurationInMinutes:CreateDeploymentStrategy' :: Natural
deploymentDurationInMinutes = Natural
a} :: CreateDeploymentStrategy)

-- | The percentage of targets to receive a deployed configuration during
-- each interval.
createDeploymentStrategy_growthFactor :: Lens.Lens' CreateDeploymentStrategy Prelude.Double
createDeploymentStrategy_growthFactor :: (Double -> f Double)
-> CreateDeploymentStrategy -> f CreateDeploymentStrategy
createDeploymentStrategy_growthFactor = (CreateDeploymentStrategy -> Double)
-> (CreateDeploymentStrategy -> Double -> CreateDeploymentStrategy)
-> Lens
     CreateDeploymentStrategy CreateDeploymentStrategy Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDeploymentStrategy' {Double
growthFactor :: Double
$sel:growthFactor:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Double
growthFactor} -> Double
growthFactor) (\s :: CreateDeploymentStrategy
s@CreateDeploymentStrategy' {} Double
a -> CreateDeploymentStrategy
s {$sel:growthFactor:CreateDeploymentStrategy' :: Double
growthFactor = Double
a} :: CreateDeploymentStrategy)

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

instance Core.AWSRequest CreateDeploymentStrategy where
  type
    AWSResponse CreateDeploymentStrategy =
      DeploymentStrategy
  request :: CreateDeploymentStrategy -> Request CreateDeploymentStrategy
request = Service
-> CreateDeploymentStrategy -> Request CreateDeploymentStrategy
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDeploymentStrategy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDeploymentStrategy)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateDeploymentStrategy))
-> Logger
-> Service
-> Proxy CreateDeploymentStrategy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDeploymentStrategy)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> Object -> Either String DeploymentStrategy
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable CreateDeploymentStrategy

instance Prelude.NFData CreateDeploymentStrategy

instance Core.ToHeaders CreateDeploymentStrategy where
  toHeaders :: CreateDeploymentStrategy -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateDeploymentStrategy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateDeploymentStrategy where
  toJSON :: CreateDeploymentStrategy -> Value
toJSON CreateDeploymentStrategy' {Double
Natural
Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe GrowthType
Text
ReplicateTo
replicateTo :: ReplicateTo
growthFactor :: Double
deploymentDurationInMinutes :: Natural
name :: Text
tags :: Maybe (HashMap Text Text)
growthType :: Maybe GrowthType
description :: Maybe Text
finalBakeTimeInMinutes :: Maybe Natural
$sel:replicateTo:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> ReplicateTo
$sel:growthFactor:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Double
$sel:deploymentDurationInMinutes:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Natural
$sel:name:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Text
$sel:tags:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Maybe (HashMap Text Text)
$sel:growthType:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Maybe GrowthType
$sel:description:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Maybe Text
$sel:finalBakeTimeInMinutes:CreateDeploymentStrategy' :: CreateDeploymentStrategy -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"FinalBakeTimeInMinutes" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
finalBakeTimeInMinutes,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"GrowthType" Text -> GrowthType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (GrowthType -> Pair) -> Maybe GrowthType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GrowthType
growthType,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"DeploymentDurationInMinutes"
                  Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
deploymentDurationInMinutes
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GrowthFactor" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Double
growthFactor),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ReplicateTo" Text -> ReplicateTo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ReplicateTo
replicateTo)
          ]
      )

instance Core.ToPath CreateDeploymentStrategy where
  toPath :: CreateDeploymentStrategy -> ByteString
toPath = ByteString -> CreateDeploymentStrategy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/deploymentstrategies"

instance Core.ToQuery CreateDeploymentStrategy where
  toQuery :: CreateDeploymentStrategy -> QueryString
toQuery = QueryString -> CreateDeploymentStrategy -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty