{-# 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.ECS.Types.DeploymentConfiguration -- 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.ECS.Types.DeploymentConfiguration where import qualified Amazonka.Core as Core import Amazonka.ECS.Types.DeploymentCircuitBreaker import qualified Amazonka.Lens as Lens import qualified Amazonka.Prelude as Prelude -- | Optional deployment parameters that control how many tasks run during a -- deployment and the ordering of stopping and starting tasks. -- -- /See:/ 'newDeploymentConfiguration' smart constructor. data DeploymentConfiguration = DeploymentConfiguration' { -- | If a service is using the rolling update (@ECS@) deployment type, the -- __minimum healthy percent__ represents a lower limit on the number of -- tasks in a service that must remain in the @RUNNING@ state during a -- deployment, as a percentage of the desired number of tasks (rounded up -- to the nearest integer), and while any container instances are in the -- @DRAINING@ state if the service contains tasks using the EC2 launch -- type. This parameter enables you to deploy without using additional -- cluster capacity. For example, if your service has a desired number of -- four tasks and a minimum healthy percent of 50%, the scheduler may stop -- two existing tasks to free up cluster capacity before starting two new -- tasks. Tasks for services that /do not/ use a load balancer are -- considered healthy if they are in the @RUNNING@ state; tasks for -- services that /do/ use a load balancer are considered healthy if they -- are in the @RUNNING@ state and they are reported as healthy by the load -- balancer. The default value for minimum healthy percent is 100%. -- -- If a service is using the blue\/green (@CODE_DEPLOY@) or @EXTERNAL@ -- deployment types and tasks that use the EC2 launch type, the __minimum -- healthy percent__ value is set to the default value and is used to -- define the lower limit on the number of the tasks in the service that -- remain in the @RUNNING@ state while the container instances are in the -- @DRAINING@ state. If the tasks in the service use the Fargate launch -- type, the minimum healthy percent value is not used, although it is -- returned when describing your service. DeploymentConfiguration -> Maybe Int minimumHealthyPercent :: Prelude.Maybe Prelude.Int, -- | If a service is using the rolling update (@ECS@) deployment type, the -- __maximum percent__ parameter represents an upper limit on the number of -- tasks in a service that are allowed in the @RUNNING@ or @PENDING@ state -- during a deployment, as a percentage of the desired number of tasks -- (rounded down to the nearest integer), and while any container instances -- are in the @DRAINING@ state if the service contains tasks using the EC2 -- launch type. This parameter enables you to define the deployment batch -- size. For example, if your service has a desired number of four tasks -- and a maximum percent value of 200%, the scheduler may start four new -- tasks before stopping the four older tasks (provided that the cluster -- resources required to do this are available). The default value for -- maximum percent is 200%. -- -- If a service is using the blue\/green (@CODE_DEPLOY@) or @EXTERNAL@ -- deployment types and tasks that use the EC2 launch type, the __maximum -- percent__ value is set to the default value and is used to define the -- upper limit on the number of the tasks in the service that remain in the -- @RUNNING@ state while the container instances are in the @DRAINING@ -- state. If the tasks in the service use the Fargate launch type, the -- maximum percent value is not used, although it is returned when -- describing your service. DeploymentConfiguration -> Maybe Int maximumPercent :: Prelude.Maybe Prelude.Int, -- | The deployment circuit breaker can only be used for services using the -- rolling update (@ECS@) deployment type. -- -- The __deployment circuit breaker__ determines whether a service -- deployment will fail if the service can\'t reach a steady state. If -- deployment circuit breaker is enabled, a service deployment will -- transition to a failed state and stop launching new tasks. If rollback -- is enabled, when a service deployment fails, the service is rolled back -- to the last deployment that completed successfully. DeploymentConfiguration -> Maybe DeploymentCircuitBreaker deploymentCircuitBreaker :: Prelude.Maybe DeploymentCircuitBreaker } deriving (DeploymentConfiguration -> DeploymentConfiguration -> Bool (DeploymentConfiguration -> DeploymentConfiguration -> Bool) -> (DeploymentConfiguration -> DeploymentConfiguration -> Bool) -> Eq DeploymentConfiguration forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: DeploymentConfiguration -> DeploymentConfiguration -> Bool $c/= :: DeploymentConfiguration -> DeploymentConfiguration -> Bool == :: DeploymentConfiguration -> DeploymentConfiguration -> Bool $c== :: DeploymentConfiguration -> DeploymentConfiguration -> Bool Prelude.Eq, ReadPrec [DeploymentConfiguration] ReadPrec DeploymentConfiguration Int -> ReadS DeploymentConfiguration ReadS [DeploymentConfiguration] (Int -> ReadS DeploymentConfiguration) -> ReadS [DeploymentConfiguration] -> ReadPrec DeploymentConfiguration -> ReadPrec [DeploymentConfiguration] -> Read DeploymentConfiguration forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [DeploymentConfiguration] $creadListPrec :: ReadPrec [DeploymentConfiguration] readPrec :: ReadPrec DeploymentConfiguration $creadPrec :: ReadPrec DeploymentConfiguration readList :: ReadS [DeploymentConfiguration] $creadList :: ReadS [DeploymentConfiguration] readsPrec :: Int -> ReadS DeploymentConfiguration $creadsPrec :: Int -> ReadS DeploymentConfiguration Prelude.Read, Int -> DeploymentConfiguration -> ShowS [DeploymentConfiguration] -> ShowS DeploymentConfiguration -> String (Int -> DeploymentConfiguration -> ShowS) -> (DeploymentConfiguration -> String) -> ([DeploymentConfiguration] -> ShowS) -> Show DeploymentConfiguration forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [DeploymentConfiguration] -> ShowS $cshowList :: [DeploymentConfiguration] -> ShowS show :: DeploymentConfiguration -> String $cshow :: DeploymentConfiguration -> String showsPrec :: Int -> DeploymentConfiguration -> ShowS $cshowsPrec :: Int -> DeploymentConfiguration -> ShowS Prelude.Show, (forall x. DeploymentConfiguration -> Rep DeploymentConfiguration x) -> (forall x. Rep DeploymentConfiguration x -> DeploymentConfiguration) -> Generic DeploymentConfiguration forall x. Rep DeploymentConfiguration x -> DeploymentConfiguration forall x. DeploymentConfiguration -> Rep DeploymentConfiguration x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cto :: forall x. Rep DeploymentConfiguration x -> DeploymentConfiguration $cfrom :: forall x. DeploymentConfiguration -> Rep DeploymentConfiguration x Prelude.Generic) -- | -- Create a value of 'DeploymentConfiguration' 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: -- -- 'minimumHealthyPercent', 'deploymentConfiguration_minimumHealthyPercent' - If a service is using the rolling update (@ECS@) deployment type, the -- __minimum healthy percent__ represents a lower limit on the number of -- tasks in a service that must remain in the @RUNNING@ state during a -- deployment, as a percentage of the desired number of tasks (rounded up -- to the nearest integer), and while any container instances are in the -- @DRAINING@ state if the service contains tasks using the EC2 launch -- type. This parameter enables you to deploy without using additional -- cluster capacity. For example, if your service has a desired number of -- four tasks and a minimum healthy percent of 50%, the scheduler may stop -- two existing tasks to free up cluster capacity before starting two new -- tasks. Tasks for services that /do not/ use a load balancer are -- considered healthy if they are in the @RUNNING@ state; tasks for -- services that /do/ use a load balancer are considered healthy if they -- are in the @RUNNING@ state and they are reported as healthy by the load -- balancer. The default value for minimum healthy percent is 100%. -- -- If a service is using the blue\/green (@CODE_DEPLOY@) or @EXTERNAL@ -- deployment types and tasks that use the EC2 launch type, the __minimum -- healthy percent__ value is set to the default value and is used to -- define the lower limit on the number of the tasks in the service that -- remain in the @RUNNING@ state while the container instances are in the -- @DRAINING@ state. If the tasks in the service use the Fargate launch -- type, the minimum healthy percent value is not used, although it is -- returned when describing your service. -- -- 'maximumPercent', 'deploymentConfiguration_maximumPercent' - If a service is using the rolling update (@ECS@) deployment type, the -- __maximum percent__ parameter represents an upper limit on the number of -- tasks in a service that are allowed in the @RUNNING@ or @PENDING@ state -- during a deployment, as a percentage of the desired number of tasks -- (rounded down to the nearest integer), and while any container instances -- are in the @DRAINING@ state if the service contains tasks using the EC2 -- launch type. This parameter enables you to define the deployment batch -- size. For example, if your service has a desired number of four tasks -- and a maximum percent value of 200%, the scheduler may start four new -- tasks before stopping the four older tasks (provided that the cluster -- resources required to do this are available). The default value for -- maximum percent is 200%. -- -- If a service is using the blue\/green (@CODE_DEPLOY@) or @EXTERNAL@ -- deployment types and tasks that use the EC2 launch type, the __maximum -- percent__ value is set to the default value and is used to define the -- upper limit on the number of the tasks in the service that remain in the -- @RUNNING@ state while the container instances are in the @DRAINING@ -- state. If the tasks in the service use the Fargate launch type, the -- maximum percent value is not used, although it is returned when -- describing your service. -- -- 'deploymentCircuitBreaker', 'deploymentConfiguration_deploymentCircuitBreaker' - The deployment circuit breaker can only be used for services using the -- rolling update (@ECS@) deployment type. -- -- The __deployment circuit breaker__ determines whether a service -- deployment will fail if the service can\'t reach a steady state. If -- deployment circuit breaker is enabled, a service deployment will -- transition to a failed state and stop launching new tasks. If rollback -- is enabled, when a service deployment fails, the service is rolled back -- to the last deployment that completed successfully. newDeploymentConfiguration :: DeploymentConfiguration newDeploymentConfiguration :: DeploymentConfiguration newDeploymentConfiguration = DeploymentConfiguration' :: Maybe Int -> Maybe Int -> Maybe DeploymentCircuitBreaker -> DeploymentConfiguration DeploymentConfiguration' { $sel:minimumHealthyPercent:DeploymentConfiguration' :: Maybe Int minimumHealthyPercent = Maybe Int forall a. Maybe a Prelude.Nothing, $sel:maximumPercent:DeploymentConfiguration' :: Maybe Int maximumPercent = Maybe Int forall a. Maybe a Prelude.Nothing, $sel:deploymentCircuitBreaker:DeploymentConfiguration' :: Maybe DeploymentCircuitBreaker deploymentCircuitBreaker = Maybe DeploymentCircuitBreaker forall a. Maybe a Prelude.Nothing } -- | If a service is using the rolling update (@ECS@) deployment type, the -- __minimum healthy percent__ represents a lower limit on the number of -- tasks in a service that must remain in the @RUNNING@ state during a -- deployment, as a percentage of the desired number of tasks (rounded up -- to the nearest integer), and while any container instances are in the -- @DRAINING@ state if the service contains tasks using the EC2 launch -- type. This parameter enables you to deploy without using additional -- cluster capacity. For example, if your service has a desired number of -- four tasks and a minimum healthy percent of 50%, the scheduler may stop -- two existing tasks to free up cluster capacity before starting two new -- tasks. Tasks for services that /do not/ use a load balancer are -- considered healthy if they are in the @RUNNING@ state; tasks for -- services that /do/ use a load balancer are considered healthy if they -- are in the @RUNNING@ state and they are reported as healthy by the load -- balancer. The default value for minimum healthy percent is 100%. -- -- If a service is using the blue\/green (@CODE_DEPLOY@) or @EXTERNAL@ -- deployment types and tasks that use the EC2 launch type, the __minimum -- healthy percent__ value is set to the default value and is used to -- define the lower limit on the number of the tasks in the service that -- remain in the @RUNNING@ state while the container instances are in the -- @DRAINING@ state. If the tasks in the service use the Fargate launch -- type, the minimum healthy percent value is not used, although it is -- returned when describing your service. deploymentConfiguration_minimumHealthyPercent :: Lens.Lens' DeploymentConfiguration (Prelude.Maybe Prelude.Int) deploymentConfiguration_minimumHealthyPercent :: (Maybe Int -> f (Maybe Int)) -> DeploymentConfiguration -> f DeploymentConfiguration deploymentConfiguration_minimumHealthyPercent = (DeploymentConfiguration -> Maybe Int) -> (DeploymentConfiguration -> Maybe Int -> DeploymentConfiguration) -> Lens DeploymentConfiguration DeploymentConfiguration (Maybe Int) (Maybe Int) forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\DeploymentConfiguration' {Maybe Int minimumHealthyPercent :: Maybe Int $sel:minimumHealthyPercent:DeploymentConfiguration' :: DeploymentConfiguration -> Maybe Int minimumHealthyPercent} -> Maybe Int minimumHealthyPercent) (\s :: DeploymentConfiguration s@DeploymentConfiguration' {} Maybe Int a -> DeploymentConfiguration s {$sel:minimumHealthyPercent:DeploymentConfiguration' :: Maybe Int minimumHealthyPercent = Maybe Int a} :: DeploymentConfiguration) -- | If a service is using the rolling update (@ECS@) deployment type, the -- __maximum percent__ parameter represents an upper limit on the number of -- tasks in a service that are allowed in the @RUNNING@ or @PENDING@ state -- during a deployment, as a percentage of the desired number of tasks -- (rounded down to the nearest integer), and while any container instances -- are in the @DRAINING@ state if the service contains tasks using the EC2 -- launch type. This parameter enables you to define the deployment batch -- size. For example, if your service has a desired number of four tasks -- and a maximum percent value of 200%, the scheduler may start four new -- tasks before stopping the four older tasks (provided that the cluster -- resources required to do this are available). The default value for -- maximum percent is 200%. -- -- If a service is using the blue\/green (@CODE_DEPLOY@) or @EXTERNAL@ -- deployment types and tasks that use the EC2 launch type, the __maximum -- percent__ value is set to the default value and is used to define the -- upper limit on the number of the tasks in the service that remain in the -- @RUNNING@ state while the container instances are in the @DRAINING@ -- state. If the tasks in the service use the Fargate launch type, the -- maximum percent value is not used, although it is returned when -- describing your service. deploymentConfiguration_maximumPercent :: Lens.Lens' DeploymentConfiguration (Prelude.Maybe Prelude.Int) deploymentConfiguration_maximumPercent :: (Maybe Int -> f (Maybe Int)) -> DeploymentConfiguration -> f DeploymentConfiguration deploymentConfiguration_maximumPercent = (DeploymentConfiguration -> Maybe Int) -> (DeploymentConfiguration -> Maybe Int -> DeploymentConfiguration) -> Lens DeploymentConfiguration DeploymentConfiguration (Maybe Int) (Maybe Int) forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\DeploymentConfiguration' {Maybe Int maximumPercent :: Maybe Int $sel:maximumPercent:DeploymentConfiguration' :: DeploymentConfiguration -> Maybe Int maximumPercent} -> Maybe Int maximumPercent) (\s :: DeploymentConfiguration s@DeploymentConfiguration' {} Maybe Int a -> DeploymentConfiguration s {$sel:maximumPercent:DeploymentConfiguration' :: Maybe Int maximumPercent = Maybe Int a} :: DeploymentConfiguration) -- | The deployment circuit breaker can only be used for services using the -- rolling update (@ECS@) deployment type. -- -- The __deployment circuit breaker__ determines whether a service -- deployment will fail if the service can\'t reach a steady state. If -- deployment circuit breaker is enabled, a service deployment will -- transition to a failed state and stop launching new tasks. If rollback -- is enabled, when a service deployment fails, the service is rolled back -- to the last deployment that completed successfully. deploymentConfiguration_deploymentCircuitBreaker :: Lens.Lens' DeploymentConfiguration (Prelude.Maybe DeploymentCircuitBreaker) deploymentConfiguration_deploymentCircuitBreaker :: (Maybe DeploymentCircuitBreaker -> f (Maybe DeploymentCircuitBreaker)) -> DeploymentConfiguration -> f DeploymentConfiguration deploymentConfiguration_deploymentCircuitBreaker = (DeploymentConfiguration -> Maybe DeploymentCircuitBreaker) -> (DeploymentConfiguration -> Maybe DeploymentCircuitBreaker -> DeploymentConfiguration) -> Lens DeploymentConfiguration DeploymentConfiguration (Maybe DeploymentCircuitBreaker) (Maybe DeploymentCircuitBreaker) forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\DeploymentConfiguration' {Maybe DeploymentCircuitBreaker deploymentCircuitBreaker :: Maybe DeploymentCircuitBreaker $sel:deploymentCircuitBreaker:DeploymentConfiguration' :: DeploymentConfiguration -> Maybe DeploymentCircuitBreaker deploymentCircuitBreaker} -> Maybe DeploymentCircuitBreaker deploymentCircuitBreaker) (\s :: DeploymentConfiguration s@DeploymentConfiguration' {} Maybe DeploymentCircuitBreaker a -> DeploymentConfiguration s {$sel:deploymentCircuitBreaker:DeploymentConfiguration' :: Maybe DeploymentCircuitBreaker deploymentCircuitBreaker = Maybe DeploymentCircuitBreaker a} :: DeploymentConfiguration) instance Core.FromJSON DeploymentConfiguration where parseJSON :: Value -> Parser DeploymentConfiguration parseJSON = String -> (Object -> Parser DeploymentConfiguration) -> Value -> Parser DeploymentConfiguration forall a. String -> (Object -> Parser a) -> Value -> Parser a Core.withObject String "DeploymentConfiguration" ( \Object x -> Maybe Int -> Maybe Int -> Maybe DeploymentCircuitBreaker -> DeploymentConfiguration DeploymentConfiguration' (Maybe Int -> Maybe Int -> Maybe DeploymentCircuitBreaker -> DeploymentConfiguration) -> Parser (Maybe Int) -> Parser (Maybe Int -> Maybe DeploymentCircuitBreaker -> DeploymentConfiguration) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b Prelude.<$> (Object x Object -> Text -> Parser (Maybe Int) forall a. FromJSON a => Object -> Text -> Parser (Maybe a) Core..:? Text "minimumHealthyPercent") Parser (Maybe Int -> Maybe DeploymentCircuitBreaker -> DeploymentConfiguration) -> Parser (Maybe Int) -> Parser (Maybe DeploymentCircuitBreaker -> DeploymentConfiguration) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x Object -> Text -> Parser (Maybe Int) forall a. FromJSON a => Object -> Text -> Parser (Maybe a) Core..:? Text "maximumPercent") Parser (Maybe DeploymentCircuitBreaker -> DeploymentConfiguration) -> Parser (Maybe DeploymentCircuitBreaker) -> Parser DeploymentConfiguration forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b Prelude.<*> (Object x Object -> Text -> Parser (Maybe DeploymentCircuitBreaker) forall a. FromJSON a => Object -> Text -> Parser (Maybe a) Core..:? Text "deploymentCircuitBreaker") ) instance Prelude.Hashable DeploymentConfiguration instance Prelude.NFData DeploymentConfiguration instance Core.ToJSON DeploymentConfiguration where toJSON :: DeploymentConfiguration -> Value toJSON DeploymentConfiguration' {Maybe Int Maybe DeploymentCircuitBreaker deploymentCircuitBreaker :: Maybe DeploymentCircuitBreaker maximumPercent :: Maybe Int minimumHealthyPercent :: Maybe Int $sel:deploymentCircuitBreaker:DeploymentConfiguration' :: DeploymentConfiguration -> Maybe DeploymentCircuitBreaker $sel:maximumPercent:DeploymentConfiguration' :: DeploymentConfiguration -> Maybe Int $sel:minimumHealthyPercent:DeploymentConfiguration' :: DeploymentConfiguration -> Maybe Int ..} = [Pair] -> Value Core.object ( [Maybe Pair] -> [Pair] forall a. [Maybe a] -> [a] Prelude.catMaybes [ (Text "minimumHealthyPercent" Text -> Int -> Pair forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b Prelude.<$> Maybe Int minimumHealthyPercent, (Text "maximumPercent" Text -> Int -> Pair forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b Prelude.<$> Maybe Int maximumPercent, (Text "deploymentCircuitBreaker" Text -> DeploymentCircuitBreaker -> Pair forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv Core..=) (DeploymentCircuitBreaker -> Pair) -> Maybe DeploymentCircuitBreaker -> Maybe Pair forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b Prelude.<$> Maybe DeploymentCircuitBreaker deploymentCircuitBreaker ] )