{-# 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.ECS.UpdateService
-- 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)
--
-- Updating the task placement strategies and constraints on an Amazon ECS
-- service remains in preview and is a Beta Service as defined by and
-- subject to the Beta Service Participation Service Terms located at
-- <https://aws.amazon.com/service-terms> (\"Beta Terms\"). These Beta
-- Terms apply to your participation in this preview.
--
-- Modifies the parameters of a service.
--
-- For services using the rolling update (@ECS@) deployment controller, the
-- desired count, deployment configuration, network configuration, task
-- placement constraints and strategies, or task definition used can be
-- updated.
--
-- For services using the blue\/green (@CODE_DEPLOY@) deployment
-- controller, only the desired count, deployment configuration, task
-- placement constraints and strategies, and health check grace period can
-- be updated using this API. If the network configuration, platform
-- version, or task definition need to be updated, a new CodeDeploy
-- deployment should be created. For more information, see
-- <https://docs.aws.amazon.com/codedeploy/latest/APIReference/API_CreateDeployment.html CreateDeployment>
-- in the /CodeDeploy API Reference/.
--
-- For services using an external deployment controller, you can update
-- only the desired count, task placement constraints and strategies, and
-- health check grace period using this API. If the launch type, load
-- balancer, network configuration, platform version, or task definition
-- need to be updated, you should create a new task set. For more
-- information, see CreateTaskSet.
--
-- You can add to or subtract from the number of instantiations of a task
-- definition in a service by specifying the cluster that the service is
-- running in and a new @desiredCount@ parameter.
--
-- If you have updated the Docker image of your application, you can create
-- a new task definition with that image and deploy it to your service. The
-- service scheduler uses the minimum healthy percent and maximum percent
-- parameters (in the service\'s deployment configuration) to determine the
-- deployment strategy.
--
-- If your updated Docker image uses the same tag as what is in the
-- existing task definition for your service (for example,
-- @my_image:latest@), you do not need to create a new revision of your
-- task definition. You can update the service using the
-- @forceNewDeployment@ option. The new tasks launched by the deployment
-- pull the current image\/tag combination from your repository when they
-- start.
--
-- You can also update the deployment configuration of a service. When a
-- deployment is triggered by updating the task definition of a service,
-- the service scheduler uses the deployment configuration parameters,
-- @minimumHealthyPercent@ and @maximumPercent@, to determine the
-- deployment strategy.
--
-- -   If @minimumHealthyPercent@ is below 100%, the scheduler can ignore
--     @desiredCount@ temporarily during a deployment. For example, if
--     @desiredCount@ is four tasks, a minimum of 50% allows the scheduler
--     to stop two existing tasks 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 use a load
--     balancer are considered healthy if they are in the @RUNNING@ state
--     and the container instance they are hosted on is reported as healthy
--     by the load balancer.
--
-- -   The @maximumPercent@ parameter represents an upper limit on the
--     number of running tasks during a deployment, which enables you to
--     define the deployment batch size. For example, if @desiredCount@ is
--     four tasks, a maximum of 200% starts four new tasks before stopping
--     the four older tasks (provided that the cluster resources required
--     to do this are available).
--
-- When UpdateService stops a task during a deployment, the equivalent of
-- @docker stop@ is issued to the containers running in the task. This
-- results in a @SIGTERM@ and a 30-second timeout, after which @SIGKILL@ is
-- sent and the containers are forcibly stopped. If the container handles
-- the @SIGTERM@ gracefully and exits within 30 seconds from receiving it,
-- no @SIGKILL@ is sent.
--
-- When the service scheduler launches new tasks, it determines task
-- placement in your cluster with the following logic:
--
-- -   Determine which of the container instances in your cluster can
--     support your service\'s task definition (for example, they have the
--     required CPU, memory, ports, and container instance attributes).
--
-- -   By default, the service scheduler attempts to balance tasks across
--     Availability Zones in this manner (although you can choose a
--     different placement strategy):
--
--     -   Sort the valid container instances by the fewest number of
--         running tasks for this service in the same Availability Zone as
--         the instance. For example, if zone A has one running service
--         task and zones B and C each have zero, valid container instances
--         in either zone B or C are considered optimal for placement.
--
--     -   Place the new service task on a valid container instance in an
--         optimal Availability Zone (based on the previous steps),
--         favoring container instances with the fewest number of running
--         tasks for this service.
--
-- When the service scheduler stops running tasks, it attempts to maintain
-- balance across the Availability Zones in your cluster using the
-- following logic:
--
-- -   Sort the container instances by the largest number of running tasks
--     for this service in the same Availability Zone as the instance. For
--     example, if zone A has one running service task and zones B and C
--     each have two, container instances in either zone B or C are
--     considered optimal for termination.
--
-- -   Stop the task on a container instance in an optimal Availability
--     Zone (based on the previous steps), favoring container instances
--     with the largest number of running tasks for this service.
module Amazonka.ECS.UpdateService
  ( -- * Creating a Request
    UpdateService (..),
    newUpdateService,

    -- * Request Lenses
    updateService_cluster,
    updateService_platformVersion,
    updateService_desiredCount,
    updateService_placementConstraints,
    updateService_placementStrategy,
    updateService_forceNewDeployment,
    updateService_taskDefinition,
    updateService_healthCheckGracePeriodSeconds,
    updateService_networkConfiguration,
    updateService_capacityProviderStrategy,
    updateService_enableExecuteCommand,
    updateService_deploymentConfiguration,
    updateService_service,

    -- * Destructuring the Response
    UpdateServiceResponse (..),
    newUpdateServiceResponse,

    -- * Response Lenses
    updateServiceResponse_service,
    updateServiceResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ECS.Types
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:/ 'newUpdateService' smart constructor.
data UpdateService = UpdateService'
  { -- | The short name or full Amazon Resource Name (ARN) of the cluster that
    -- your service is running on. If you do not specify a cluster, the default
    -- cluster is assumed.
    UpdateService -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
    -- | The platform version on which your tasks in the service are running. A
    -- platform version is only specified for tasks using the Fargate launch
    -- type. If a platform version is not specified, the @LATEST@ platform
    -- version is used by default. For more information, see
    -- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html Fargate Platform Versions>
    -- in the /Amazon Elastic Container Service Developer Guide/.
    UpdateService -> Maybe Text
platformVersion :: Prelude.Maybe Prelude.Text,
    -- | The number of instantiations of the task to place and keep running in
    -- your service.
    UpdateService -> Maybe Int
desiredCount :: Prelude.Maybe Prelude.Int,
    -- | An array of task placement constraint objects to update the service to
    -- use. If no value is specified, the existing placement constraints for
    -- the service will remain unchanged. If this value is specified, it will
    -- override any existing placement constraints defined for the service. To
    -- remove all existing placement constraints, specify an empty array.
    --
    -- You can specify a maximum of 10 constraints per task (this limit
    -- includes constraints in the task definition and those specified at
    -- runtime).
    UpdateService -> Maybe [PlacementConstraint]
placementConstraints :: Prelude.Maybe [PlacementConstraint],
    -- | The task placement strategy objects to update the service to use. If no
    -- value is specified, the existing placement strategy for the service will
    -- remain unchanged. If this value is specified, it will override the
    -- existing placement strategy defined for the service. To remove an
    -- existing placement strategy, specify an empty object.
    --
    -- You can specify a maximum of five strategy rules per service.
    UpdateService -> Maybe [PlacementStrategy]
placementStrategy :: Prelude.Maybe [PlacementStrategy],
    -- | Whether to force a new deployment of the service. Deployments are not
    -- forced by default. You can use this option to trigger a new deployment
    -- with no service definition changes. For example, you can update a
    -- service\'s tasks to use a newer Docker image with the same image\/tag
    -- combination (@my_image:latest@) or to roll Fargate tasks onto a newer
    -- platform version.
    UpdateService -> Maybe Bool
forceNewDeployment :: Prelude.Maybe Prelude.Bool,
    -- | The @family@ and @revision@ (@family:revision@) or full ARN of the task
    -- definition to run in your service. If a @revision@ is not specified, the
    -- latest @ACTIVE@ revision is used. If you modify the task definition with
    -- @UpdateService@, Amazon ECS spawns a task with the new version of the
    -- task definition and then stops an old task after the new version is
    -- running.
    UpdateService -> Maybe Text
taskDefinition :: Prelude.Maybe Prelude.Text,
    -- | The period of time, in seconds, that the Amazon ECS service scheduler
    -- should ignore unhealthy Elastic Load Balancing target health checks
    -- after a task has first started. This is only valid if your service is
    -- configured to use a load balancer. If your service\'s tasks take a while
    -- to start and respond to Elastic Load Balancing health checks, you can
    -- specify a health check grace period of up to 2,147,483,647 seconds.
    -- During that time, the Amazon ECS service scheduler ignores the Elastic
    -- Load Balancing health check status. This grace period can prevent the
    -- ECS service scheduler from marking tasks as unhealthy and stopping them
    -- before they have time to come up.
    UpdateService -> Maybe Int
healthCheckGracePeriodSeconds :: Prelude.Maybe Prelude.Int,
    -- | An object representing the network configuration for the service.
    UpdateService -> Maybe NetworkConfiguration
networkConfiguration :: Prelude.Maybe NetworkConfiguration,
    -- | The capacity provider strategy to update the service to use.
    --
    -- If the service is using the default capacity provider strategy for the
    -- cluster, the service can be updated to use one or more capacity
    -- providers as opposed to the default capacity provider strategy. However,
    -- when a service is using a capacity provider strategy that is not the
    -- default capacity provider strategy, the service cannot be updated to use
    -- the cluster\'s default capacity provider strategy.
    --
    -- A capacity provider strategy consists of one or more capacity providers
    -- along with the @base@ and @weight@ to assign to them. A capacity
    -- provider must be associated with the cluster to be used in a capacity
    -- provider strategy. The PutClusterCapacityProviders API is used to
    -- associate a capacity provider with a cluster. Only capacity providers
    -- with an @ACTIVE@ or @UPDATING@ status can be used.
    --
    -- If specifying a capacity provider that uses an Auto Scaling group, the
    -- capacity provider must already be created. New capacity providers can be
    -- created with the CreateCapacityProvider API operation.
    --
    -- To use a Fargate capacity provider, specify either the @FARGATE@ or
    -- @FARGATE_SPOT@ capacity providers. The Fargate capacity providers are
    -- available to all accounts and only need to be associated with a cluster
    -- to be used.
    --
    -- The PutClusterCapacityProviders API operation is used to update the list
    -- of available capacity providers for a cluster after the cluster is
    -- created.
    UpdateService -> Maybe [CapacityProviderStrategyItem]
capacityProviderStrategy :: Prelude.Maybe [CapacityProviderStrategyItem],
    -- | If @true@, this enables execute command functionality on all task
    -- containers.
    --
    -- If you do not want to override the value that was set when the service
    -- was created, you can set this to @null@ when performing this action.
    UpdateService -> Maybe Bool
enableExecuteCommand :: Prelude.Maybe Prelude.Bool,
    -- | Optional deployment parameters that control how many tasks run during
    -- the deployment and the ordering of stopping and starting tasks.
    UpdateService -> Maybe DeploymentConfiguration
deploymentConfiguration :: Prelude.Maybe DeploymentConfiguration,
    -- | The name of the service to update.
    UpdateService -> Text
service :: Prelude.Text
  }
  deriving (UpdateService -> UpdateService -> Bool
(UpdateService -> UpdateService -> Bool)
-> (UpdateService -> UpdateService -> Bool) -> Eq UpdateService
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateService -> UpdateService -> Bool
$c/= :: UpdateService -> UpdateService -> Bool
== :: UpdateService -> UpdateService -> Bool
$c== :: UpdateService -> UpdateService -> Bool
Prelude.Eq, ReadPrec [UpdateService]
ReadPrec UpdateService
Int -> ReadS UpdateService
ReadS [UpdateService]
(Int -> ReadS UpdateService)
-> ReadS [UpdateService]
-> ReadPrec UpdateService
-> ReadPrec [UpdateService]
-> Read UpdateService
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateService]
$creadListPrec :: ReadPrec [UpdateService]
readPrec :: ReadPrec UpdateService
$creadPrec :: ReadPrec UpdateService
readList :: ReadS [UpdateService]
$creadList :: ReadS [UpdateService]
readsPrec :: Int -> ReadS UpdateService
$creadsPrec :: Int -> ReadS UpdateService
Prelude.Read, Int -> UpdateService -> ShowS
[UpdateService] -> ShowS
UpdateService -> String
(Int -> UpdateService -> ShowS)
-> (UpdateService -> String)
-> ([UpdateService] -> ShowS)
-> Show UpdateService
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateService] -> ShowS
$cshowList :: [UpdateService] -> ShowS
show :: UpdateService -> String
$cshow :: UpdateService -> String
showsPrec :: Int -> UpdateService -> ShowS
$cshowsPrec :: Int -> UpdateService -> ShowS
Prelude.Show, (forall x. UpdateService -> Rep UpdateService x)
-> (forall x. Rep UpdateService x -> UpdateService)
-> Generic UpdateService
forall x. Rep UpdateService x -> UpdateService
forall x. UpdateService -> Rep UpdateService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateService x -> UpdateService
$cfrom :: forall x. UpdateService -> Rep UpdateService x
Prelude.Generic)

-- |
-- Create a value of 'UpdateService' 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:
--
-- 'cluster', 'updateService_cluster' - The short name or full Amazon Resource Name (ARN) of the cluster that
-- your service is running on. If you do not specify a cluster, the default
-- cluster is assumed.
--
-- 'platformVersion', 'updateService_platformVersion' - The platform version on which your tasks in the service are running. A
-- platform version is only specified for tasks using the Fargate launch
-- type. If a platform version is not specified, the @LATEST@ platform
-- version is used by default. For more information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html Fargate Platform Versions>
-- in the /Amazon Elastic Container Service Developer Guide/.
--
-- 'desiredCount', 'updateService_desiredCount' - The number of instantiations of the task to place and keep running in
-- your service.
--
-- 'placementConstraints', 'updateService_placementConstraints' - An array of task placement constraint objects to update the service to
-- use. If no value is specified, the existing placement constraints for
-- the service will remain unchanged. If this value is specified, it will
-- override any existing placement constraints defined for the service. To
-- remove all existing placement constraints, specify an empty array.
--
-- You can specify a maximum of 10 constraints per task (this limit
-- includes constraints in the task definition and those specified at
-- runtime).
--
-- 'placementStrategy', 'updateService_placementStrategy' - The task placement strategy objects to update the service to use. If no
-- value is specified, the existing placement strategy for the service will
-- remain unchanged. If this value is specified, it will override the
-- existing placement strategy defined for the service. To remove an
-- existing placement strategy, specify an empty object.
--
-- You can specify a maximum of five strategy rules per service.
--
-- 'forceNewDeployment', 'updateService_forceNewDeployment' - Whether to force a new deployment of the service. Deployments are not
-- forced by default. You can use this option to trigger a new deployment
-- with no service definition changes. For example, you can update a
-- service\'s tasks to use a newer Docker image with the same image\/tag
-- combination (@my_image:latest@) or to roll Fargate tasks onto a newer
-- platform version.
--
-- 'taskDefinition', 'updateService_taskDefinition' - The @family@ and @revision@ (@family:revision@) or full ARN of the task
-- definition to run in your service. If a @revision@ is not specified, the
-- latest @ACTIVE@ revision is used. If you modify the task definition with
-- @UpdateService@, Amazon ECS spawns a task with the new version of the
-- task definition and then stops an old task after the new version is
-- running.
--
-- 'healthCheckGracePeriodSeconds', 'updateService_healthCheckGracePeriodSeconds' - The period of time, in seconds, that the Amazon ECS service scheduler
-- should ignore unhealthy Elastic Load Balancing target health checks
-- after a task has first started. This is only valid if your service is
-- configured to use a load balancer. If your service\'s tasks take a while
-- to start and respond to Elastic Load Balancing health checks, you can
-- specify a health check grace period of up to 2,147,483,647 seconds.
-- During that time, the Amazon ECS service scheduler ignores the Elastic
-- Load Balancing health check status. This grace period can prevent the
-- ECS service scheduler from marking tasks as unhealthy and stopping them
-- before they have time to come up.
--
-- 'networkConfiguration', 'updateService_networkConfiguration' - An object representing the network configuration for the service.
--
-- 'capacityProviderStrategy', 'updateService_capacityProviderStrategy' - The capacity provider strategy to update the service to use.
--
-- If the service is using the default capacity provider strategy for the
-- cluster, the service can be updated to use one or more capacity
-- providers as opposed to the default capacity provider strategy. However,
-- when a service is using a capacity provider strategy that is not the
-- default capacity provider strategy, the service cannot be updated to use
-- the cluster\'s default capacity provider strategy.
--
-- A capacity provider strategy consists of one or more capacity providers
-- along with the @base@ and @weight@ to assign to them. A capacity
-- provider must be associated with the cluster to be used in a capacity
-- provider strategy. The PutClusterCapacityProviders API is used to
-- associate a capacity provider with a cluster. Only capacity providers
-- with an @ACTIVE@ or @UPDATING@ status can be used.
--
-- If specifying a capacity provider that uses an Auto Scaling group, the
-- capacity provider must already be created. New capacity providers can be
-- created with the CreateCapacityProvider API operation.
--
-- To use a Fargate capacity provider, specify either the @FARGATE@ or
-- @FARGATE_SPOT@ capacity providers. The Fargate capacity providers are
-- available to all accounts and only need to be associated with a cluster
-- to be used.
--
-- The PutClusterCapacityProviders API operation is used to update the list
-- of available capacity providers for a cluster after the cluster is
-- created.
--
-- 'enableExecuteCommand', 'updateService_enableExecuteCommand' - If @true@, this enables execute command functionality on all task
-- containers.
--
-- If you do not want to override the value that was set when the service
-- was created, you can set this to @null@ when performing this action.
--
-- 'deploymentConfiguration', 'updateService_deploymentConfiguration' - Optional deployment parameters that control how many tasks run during
-- the deployment and the ordering of stopping and starting tasks.
--
-- 'service', 'updateService_service' - The name of the service to update.
newUpdateService ::
  -- | 'service'
  Prelude.Text ->
  UpdateService
newUpdateService :: Text -> UpdateService
newUpdateService Text
pService_ =
  UpdateService' :: Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe [PlacementConstraint]
-> Maybe [PlacementStrategy]
-> Maybe Bool
-> Maybe Text
-> Maybe Int
-> Maybe NetworkConfiguration
-> Maybe [CapacityProviderStrategyItem]
-> Maybe Bool
-> Maybe DeploymentConfiguration
-> Text
-> UpdateService
UpdateService'
    { $sel:cluster:UpdateService' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:platformVersion:UpdateService' :: Maybe Text
platformVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:desiredCount:UpdateService' :: Maybe Int
desiredCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:placementConstraints:UpdateService' :: Maybe [PlacementConstraint]
placementConstraints = Maybe [PlacementConstraint]
forall a. Maybe a
Prelude.Nothing,
      $sel:placementStrategy:UpdateService' :: Maybe [PlacementStrategy]
placementStrategy = Maybe [PlacementStrategy]
forall a. Maybe a
Prelude.Nothing,
      $sel:forceNewDeployment:UpdateService' :: Maybe Bool
forceNewDeployment = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:taskDefinition:UpdateService' :: Maybe Text
taskDefinition = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckGracePeriodSeconds:UpdateService' :: Maybe Int
healthCheckGracePeriodSeconds = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:networkConfiguration:UpdateService' :: Maybe NetworkConfiguration
networkConfiguration = Maybe NetworkConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:capacityProviderStrategy:UpdateService' :: Maybe [CapacityProviderStrategyItem]
capacityProviderStrategy = Maybe [CapacityProviderStrategyItem]
forall a. Maybe a
Prelude.Nothing,
      $sel:enableExecuteCommand:UpdateService' :: Maybe Bool
enableExecuteCommand = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentConfiguration:UpdateService' :: Maybe DeploymentConfiguration
deploymentConfiguration = Maybe DeploymentConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:service:UpdateService' :: Text
service = Text
pService_
    }

-- | The short name or full Amazon Resource Name (ARN) of the cluster that
-- your service is running on. If you do not specify a cluster, the default
-- cluster is assumed.
updateService_cluster :: Lens.Lens' UpdateService (Prelude.Maybe Prelude.Text)
updateService_cluster :: (Maybe Text -> f (Maybe Text)) -> UpdateService -> f UpdateService
updateService_cluster = (UpdateService -> Maybe Text)
-> (UpdateService -> Maybe Text -> UpdateService)
-> Lens UpdateService UpdateService (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe Text
cluster :: Maybe Text
$sel:cluster:UpdateService' :: UpdateService -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: UpdateService
s@UpdateService' {} Maybe Text
a -> UpdateService
s {$sel:cluster:UpdateService' :: Maybe Text
cluster = Maybe Text
a} :: UpdateService)

-- | The platform version on which your tasks in the service are running. A
-- platform version is only specified for tasks using the Fargate launch
-- type. If a platform version is not specified, the @LATEST@ platform
-- version is used by default. For more information, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html Fargate Platform Versions>
-- in the /Amazon Elastic Container Service Developer Guide/.
updateService_platformVersion :: Lens.Lens' UpdateService (Prelude.Maybe Prelude.Text)
updateService_platformVersion :: (Maybe Text -> f (Maybe Text)) -> UpdateService -> f UpdateService
updateService_platformVersion = (UpdateService -> Maybe Text)
-> (UpdateService -> Maybe Text -> UpdateService)
-> Lens UpdateService UpdateService (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe Text
platformVersion :: Maybe Text
$sel:platformVersion:UpdateService' :: UpdateService -> Maybe Text
platformVersion} -> Maybe Text
platformVersion) (\s :: UpdateService
s@UpdateService' {} Maybe Text
a -> UpdateService
s {$sel:platformVersion:UpdateService' :: Maybe Text
platformVersion = Maybe Text
a} :: UpdateService)

-- | The number of instantiations of the task to place and keep running in
-- your service.
updateService_desiredCount :: Lens.Lens' UpdateService (Prelude.Maybe Prelude.Int)
updateService_desiredCount :: (Maybe Int -> f (Maybe Int)) -> UpdateService -> f UpdateService
updateService_desiredCount = (UpdateService -> Maybe Int)
-> (UpdateService -> Maybe Int -> UpdateService)
-> Lens UpdateService UpdateService (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe Int
desiredCount :: Maybe Int
$sel:desiredCount:UpdateService' :: UpdateService -> Maybe Int
desiredCount} -> Maybe Int
desiredCount) (\s :: UpdateService
s@UpdateService' {} Maybe Int
a -> UpdateService
s {$sel:desiredCount:UpdateService' :: Maybe Int
desiredCount = Maybe Int
a} :: UpdateService)

-- | An array of task placement constraint objects to update the service to
-- use. If no value is specified, the existing placement constraints for
-- the service will remain unchanged. If this value is specified, it will
-- override any existing placement constraints defined for the service. To
-- remove all existing placement constraints, specify an empty array.
--
-- You can specify a maximum of 10 constraints per task (this limit
-- includes constraints in the task definition and those specified at
-- runtime).
updateService_placementConstraints :: Lens.Lens' UpdateService (Prelude.Maybe [PlacementConstraint])
updateService_placementConstraints :: (Maybe [PlacementConstraint] -> f (Maybe [PlacementConstraint]))
-> UpdateService -> f UpdateService
updateService_placementConstraints = (UpdateService -> Maybe [PlacementConstraint])
-> (UpdateService -> Maybe [PlacementConstraint] -> UpdateService)
-> Lens
     UpdateService
     UpdateService
     (Maybe [PlacementConstraint])
     (Maybe [PlacementConstraint])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe [PlacementConstraint]
placementConstraints :: Maybe [PlacementConstraint]
$sel:placementConstraints:UpdateService' :: UpdateService -> Maybe [PlacementConstraint]
placementConstraints} -> Maybe [PlacementConstraint]
placementConstraints) (\s :: UpdateService
s@UpdateService' {} Maybe [PlacementConstraint]
a -> UpdateService
s {$sel:placementConstraints:UpdateService' :: Maybe [PlacementConstraint]
placementConstraints = Maybe [PlacementConstraint]
a} :: UpdateService) ((Maybe [PlacementConstraint] -> f (Maybe [PlacementConstraint]))
 -> UpdateService -> f UpdateService)
-> ((Maybe [PlacementConstraint]
     -> f (Maybe [PlacementConstraint]))
    -> Maybe [PlacementConstraint] -> f (Maybe [PlacementConstraint]))
-> (Maybe [PlacementConstraint] -> f (Maybe [PlacementConstraint]))
-> UpdateService
-> f UpdateService
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PlacementConstraint]
  [PlacementConstraint]
  [PlacementConstraint]
  [PlacementConstraint]
-> Iso
     (Maybe [PlacementConstraint])
     (Maybe [PlacementConstraint])
     (Maybe [PlacementConstraint])
     (Maybe [PlacementConstraint])
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
  [PlacementConstraint]
  [PlacementConstraint]
  [PlacementConstraint]
  [PlacementConstraint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The task placement strategy objects to update the service to use. If no
-- value is specified, the existing placement strategy for the service will
-- remain unchanged. If this value is specified, it will override the
-- existing placement strategy defined for the service. To remove an
-- existing placement strategy, specify an empty object.
--
-- You can specify a maximum of five strategy rules per service.
updateService_placementStrategy :: Lens.Lens' UpdateService (Prelude.Maybe [PlacementStrategy])
updateService_placementStrategy :: (Maybe [PlacementStrategy] -> f (Maybe [PlacementStrategy]))
-> UpdateService -> f UpdateService
updateService_placementStrategy = (UpdateService -> Maybe [PlacementStrategy])
-> (UpdateService -> Maybe [PlacementStrategy] -> UpdateService)
-> Lens
     UpdateService
     UpdateService
     (Maybe [PlacementStrategy])
     (Maybe [PlacementStrategy])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe [PlacementStrategy]
placementStrategy :: Maybe [PlacementStrategy]
$sel:placementStrategy:UpdateService' :: UpdateService -> Maybe [PlacementStrategy]
placementStrategy} -> Maybe [PlacementStrategy]
placementStrategy) (\s :: UpdateService
s@UpdateService' {} Maybe [PlacementStrategy]
a -> UpdateService
s {$sel:placementStrategy:UpdateService' :: Maybe [PlacementStrategy]
placementStrategy = Maybe [PlacementStrategy]
a} :: UpdateService) ((Maybe [PlacementStrategy] -> f (Maybe [PlacementStrategy]))
 -> UpdateService -> f UpdateService)
-> ((Maybe [PlacementStrategy] -> f (Maybe [PlacementStrategy]))
    -> Maybe [PlacementStrategy] -> f (Maybe [PlacementStrategy]))
-> (Maybe [PlacementStrategy] -> f (Maybe [PlacementStrategy]))
-> UpdateService
-> f UpdateService
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PlacementStrategy]
  [PlacementStrategy]
  [PlacementStrategy]
  [PlacementStrategy]
-> Iso
     (Maybe [PlacementStrategy])
     (Maybe [PlacementStrategy])
     (Maybe [PlacementStrategy])
     (Maybe [PlacementStrategy])
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
  [PlacementStrategy]
  [PlacementStrategy]
  [PlacementStrategy]
  [PlacementStrategy]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Whether to force a new deployment of the service. Deployments are not
-- forced by default. You can use this option to trigger a new deployment
-- with no service definition changes. For example, you can update a
-- service\'s tasks to use a newer Docker image with the same image\/tag
-- combination (@my_image:latest@) or to roll Fargate tasks onto a newer
-- platform version.
updateService_forceNewDeployment :: Lens.Lens' UpdateService (Prelude.Maybe Prelude.Bool)
updateService_forceNewDeployment :: (Maybe Bool -> f (Maybe Bool)) -> UpdateService -> f UpdateService
updateService_forceNewDeployment = (UpdateService -> Maybe Bool)
-> (UpdateService -> Maybe Bool -> UpdateService)
-> Lens UpdateService UpdateService (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe Bool
forceNewDeployment :: Maybe Bool
$sel:forceNewDeployment:UpdateService' :: UpdateService -> Maybe Bool
forceNewDeployment} -> Maybe Bool
forceNewDeployment) (\s :: UpdateService
s@UpdateService' {} Maybe Bool
a -> UpdateService
s {$sel:forceNewDeployment:UpdateService' :: Maybe Bool
forceNewDeployment = Maybe Bool
a} :: UpdateService)

-- | The @family@ and @revision@ (@family:revision@) or full ARN of the task
-- definition to run in your service. If a @revision@ is not specified, the
-- latest @ACTIVE@ revision is used. If you modify the task definition with
-- @UpdateService@, Amazon ECS spawns a task with the new version of the
-- task definition and then stops an old task after the new version is
-- running.
updateService_taskDefinition :: Lens.Lens' UpdateService (Prelude.Maybe Prelude.Text)
updateService_taskDefinition :: (Maybe Text -> f (Maybe Text)) -> UpdateService -> f UpdateService
updateService_taskDefinition = (UpdateService -> Maybe Text)
-> (UpdateService -> Maybe Text -> UpdateService)
-> Lens UpdateService UpdateService (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe Text
taskDefinition :: Maybe Text
$sel:taskDefinition:UpdateService' :: UpdateService -> Maybe Text
taskDefinition} -> Maybe Text
taskDefinition) (\s :: UpdateService
s@UpdateService' {} Maybe Text
a -> UpdateService
s {$sel:taskDefinition:UpdateService' :: Maybe Text
taskDefinition = Maybe Text
a} :: UpdateService)

-- | The period of time, in seconds, that the Amazon ECS service scheduler
-- should ignore unhealthy Elastic Load Balancing target health checks
-- after a task has first started. This is only valid if your service is
-- configured to use a load balancer. If your service\'s tasks take a while
-- to start and respond to Elastic Load Balancing health checks, you can
-- specify a health check grace period of up to 2,147,483,647 seconds.
-- During that time, the Amazon ECS service scheduler ignores the Elastic
-- Load Balancing health check status. This grace period can prevent the
-- ECS service scheduler from marking tasks as unhealthy and stopping them
-- before they have time to come up.
updateService_healthCheckGracePeriodSeconds :: Lens.Lens' UpdateService (Prelude.Maybe Prelude.Int)
updateService_healthCheckGracePeriodSeconds :: (Maybe Int -> f (Maybe Int)) -> UpdateService -> f UpdateService
updateService_healthCheckGracePeriodSeconds = (UpdateService -> Maybe Int)
-> (UpdateService -> Maybe Int -> UpdateService)
-> Lens UpdateService UpdateService (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe Int
healthCheckGracePeriodSeconds :: Maybe Int
$sel:healthCheckGracePeriodSeconds:UpdateService' :: UpdateService -> Maybe Int
healthCheckGracePeriodSeconds} -> Maybe Int
healthCheckGracePeriodSeconds) (\s :: UpdateService
s@UpdateService' {} Maybe Int
a -> UpdateService
s {$sel:healthCheckGracePeriodSeconds:UpdateService' :: Maybe Int
healthCheckGracePeriodSeconds = Maybe Int
a} :: UpdateService)

-- | An object representing the network configuration for the service.
updateService_networkConfiguration :: Lens.Lens' UpdateService (Prelude.Maybe NetworkConfiguration)
updateService_networkConfiguration :: (Maybe NetworkConfiguration -> f (Maybe NetworkConfiguration))
-> UpdateService -> f UpdateService
updateService_networkConfiguration = (UpdateService -> Maybe NetworkConfiguration)
-> (UpdateService -> Maybe NetworkConfiguration -> UpdateService)
-> Lens
     UpdateService
     UpdateService
     (Maybe NetworkConfiguration)
     (Maybe NetworkConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe NetworkConfiguration
networkConfiguration :: Maybe NetworkConfiguration
$sel:networkConfiguration:UpdateService' :: UpdateService -> Maybe NetworkConfiguration
networkConfiguration} -> Maybe NetworkConfiguration
networkConfiguration) (\s :: UpdateService
s@UpdateService' {} Maybe NetworkConfiguration
a -> UpdateService
s {$sel:networkConfiguration:UpdateService' :: Maybe NetworkConfiguration
networkConfiguration = Maybe NetworkConfiguration
a} :: UpdateService)

-- | The capacity provider strategy to update the service to use.
--
-- If the service is using the default capacity provider strategy for the
-- cluster, the service can be updated to use one or more capacity
-- providers as opposed to the default capacity provider strategy. However,
-- when a service is using a capacity provider strategy that is not the
-- default capacity provider strategy, the service cannot be updated to use
-- the cluster\'s default capacity provider strategy.
--
-- A capacity provider strategy consists of one or more capacity providers
-- along with the @base@ and @weight@ to assign to them. A capacity
-- provider must be associated with the cluster to be used in a capacity
-- provider strategy. The PutClusterCapacityProviders API is used to
-- associate a capacity provider with a cluster. Only capacity providers
-- with an @ACTIVE@ or @UPDATING@ status can be used.
--
-- If specifying a capacity provider that uses an Auto Scaling group, the
-- capacity provider must already be created. New capacity providers can be
-- created with the CreateCapacityProvider API operation.
--
-- To use a Fargate capacity provider, specify either the @FARGATE@ or
-- @FARGATE_SPOT@ capacity providers. The Fargate capacity providers are
-- available to all accounts and only need to be associated with a cluster
-- to be used.
--
-- The PutClusterCapacityProviders API operation is used to update the list
-- of available capacity providers for a cluster after the cluster is
-- created.
updateService_capacityProviderStrategy :: Lens.Lens' UpdateService (Prelude.Maybe [CapacityProviderStrategyItem])
updateService_capacityProviderStrategy :: (Maybe [CapacityProviderStrategyItem]
 -> f (Maybe [CapacityProviderStrategyItem]))
-> UpdateService -> f UpdateService
updateService_capacityProviderStrategy = (UpdateService -> Maybe [CapacityProviderStrategyItem])
-> (UpdateService
    -> Maybe [CapacityProviderStrategyItem] -> UpdateService)
-> Lens
     UpdateService
     UpdateService
     (Maybe [CapacityProviderStrategyItem])
     (Maybe [CapacityProviderStrategyItem])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe [CapacityProviderStrategyItem]
capacityProviderStrategy :: Maybe [CapacityProviderStrategyItem]
$sel:capacityProviderStrategy:UpdateService' :: UpdateService -> Maybe [CapacityProviderStrategyItem]
capacityProviderStrategy} -> Maybe [CapacityProviderStrategyItem]
capacityProviderStrategy) (\s :: UpdateService
s@UpdateService' {} Maybe [CapacityProviderStrategyItem]
a -> UpdateService
s {$sel:capacityProviderStrategy:UpdateService' :: Maybe [CapacityProviderStrategyItem]
capacityProviderStrategy = Maybe [CapacityProviderStrategyItem]
a} :: UpdateService) ((Maybe [CapacityProviderStrategyItem]
  -> f (Maybe [CapacityProviderStrategyItem]))
 -> UpdateService -> f UpdateService)
-> ((Maybe [CapacityProviderStrategyItem]
     -> f (Maybe [CapacityProviderStrategyItem]))
    -> Maybe [CapacityProviderStrategyItem]
    -> f (Maybe [CapacityProviderStrategyItem]))
-> (Maybe [CapacityProviderStrategyItem]
    -> f (Maybe [CapacityProviderStrategyItem]))
-> UpdateService
-> f UpdateService
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CapacityProviderStrategyItem]
  [CapacityProviderStrategyItem]
  [CapacityProviderStrategyItem]
  [CapacityProviderStrategyItem]
-> Iso
     (Maybe [CapacityProviderStrategyItem])
     (Maybe [CapacityProviderStrategyItem])
     (Maybe [CapacityProviderStrategyItem])
     (Maybe [CapacityProviderStrategyItem])
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
  [CapacityProviderStrategyItem]
  [CapacityProviderStrategyItem]
  [CapacityProviderStrategyItem]
  [CapacityProviderStrategyItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If @true@, this enables execute command functionality on all task
-- containers.
--
-- If you do not want to override the value that was set when the service
-- was created, you can set this to @null@ when performing this action.
updateService_enableExecuteCommand :: Lens.Lens' UpdateService (Prelude.Maybe Prelude.Bool)
updateService_enableExecuteCommand :: (Maybe Bool -> f (Maybe Bool)) -> UpdateService -> f UpdateService
updateService_enableExecuteCommand = (UpdateService -> Maybe Bool)
-> (UpdateService -> Maybe Bool -> UpdateService)
-> Lens UpdateService UpdateService (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe Bool
enableExecuteCommand :: Maybe Bool
$sel:enableExecuteCommand:UpdateService' :: UpdateService -> Maybe Bool
enableExecuteCommand} -> Maybe Bool
enableExecuteCommand) (\s :: UpdateService
s@UpdateService' {} Maybe Bool
a -> UpdateService
s {$sel:enableExecuteCommand:UpdateService' :: Maybe Bool
enableExecuteCommand = Maybe Bool
a} :: UpdateService)

-- | Optional deployment parameters that control how many tasks run during
-- the deployment and the ordering of stopping and starting tasks.
updateService_deploymentConfiguration :: Lens.Lens' UpdateService (Prelude.Maybe DeploymentConfiguration)
updateService_deploymentConfiguration :: (Maybe DeploymentConfiguration
 -> f (Maybe DeploymentConfiguration))
-> UpdateService -> f UpdateService
updateService_deploymentConfiguration = (UpdateService -> Maybe DeploymentConfiguration)
-> (UpdateService
    -> Maybe DeploymentConfiguration -> UpdateService)
-> Lens
     UpdateService
     UpdateService
     (Maybe DeploymentConfiguration)
     (Maybe DeploymentConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe DeploymentConfiguration
deploymentConfiguration :: Maybe DeploymentConfiguration
$sel:deploymentConfiguration:UpdateService' :: UpdateService -> Maybe DeploymentConfiguration
deploymentConfiguration} -> Maybe DeploymentConfiguration
deploymentConfiguration) (\s :: UpdateService
s@UpdateService' {} Maybe DeploymentConfiguration
a -> UpdateService
s {$sel:deploymentConfiguration:UpdateService' :: Maybe DeploymentConfiguration
deploymentConfiguration = Maybe DeploymentConfiguration
a} :: UpdateService)

-- | The name of the service to update.
updateService_service :: Lens.Lens' UpdateService Prelude.Text
updateService_service :: (Text -> f Text) -> UpdateService -> f UpdateService
updateService_service = (UpdateService -> Text)
-> (UpdateService -> Text -> UpdateService)
-> Lens UpdateService UpdateService Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Text
service :: Text
$sel:service:UpdateService' :: UpdateService -> Text
service} -> Text
service) (\s :: UpdateService
s@UpdateService' {} Text
a -> UpdateService
s {$sel:service:UpdateService' :: Text
service = Text
a} :: UpdateService)

instance Core.AWSRequest UpdateService where
  type
    AWSResponse UpdateService =
      UpdateServiceResponse
  request :: UpdateService -> Request UpdateService
request = Service -> UpdateService -> Request UpdateService
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateService
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateService)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateService))
-> Logger
-> Service
-> Proxy UpdateService
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateService)))
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 ->
          Maybe ContainerService -> Int -> UpdateServiceResponse
UpdateServiceResponse'
            (Maybe ContainerService -> Int -> UpdateServiceResponse)
-> Either String (Maybe ContainerService)
-> Either String (Int -> UpdateServiceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ContainerService)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"service")
            Either String (Int -> UpdateServiceResponse)
-> Either String Int -> Either String UpdateServiceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateService

instance Prelude.NFData UpdateService

instance Core.ToHeaders UpdateService where
  toHeaders :: UpdateService -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateService -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonEC2ContainerServiceV20141113.UpdateService" ::
                          Prelude.ByteString
                      ),
            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 UpdateService where
  toJSON :: UpdateService -> Value
toJSON UpdateService' {Maybe Bool
Maybe Int
Maybe [CapacityProviderStrategyItem]
Maybe [PlacementConstraint]
Maybe [PlacementStrategy]
Maybe Text
Maybe DeploymentConfiguration
Maybe NetworkConfiguration
Text
service :: Text
deploymentConfiguration :: Maybe DeploymentConfiguration
enableExecuteCommand :: Maybe Bool
capacityProviderStrategy :: Maybe [CapacityProviderStrategyItem]
networkConfiguration :: Maybe NetworkConfiguration
healthCheckGracePeriodSeconds :: Maybe Int
taskDefinition :: Maybe Text
forceNewDeployment :: Maybe Bool
placementStrategy :: Maybe [PlacementStrategy]
placementConstraints :: Maybe [PlacementConstraint]
desiredCount :: Maybe Int
platformVersion :: Maybe Text
cluster :: Maybe Text
$sel:service:UpdateService' :: UpdateService -> Text
$sel:deploymentConfiguration:UpdateService' :: UpdateService -> Maybe DeploymentConfiguration
$sel:enableExecuteCommand:UpdateService' :: UpdateService -> Maybe Bool
$sel:capacityProviderStrategy:UpdateService' :: UpdateService -> Maybe [CapacityProviderStrategyItem]
$sel:networkConfiguration:UpdateService' :: UpdateService -> Maybe NetworkConfiguration
$sel:healthCheckGracePeriodSeconds:UpdateService' :: UpdateService -> Maybe Int
$sel:taskDefinition:UpdateService' :: UpdateService -> Maybe Text
$sel:forceNewDeployment:UpdateService' :: UpdateService -> Maybe Bool
$sel:placementStrategy:UpdateService' :: UpdateService -> Maybe [PlacementStrategy]
$sel:placementConstraints:UpdateService' :: UpdateService -> Maybe [PlacementConstraint]
$sel:desiredCount:UpdateService' :: UpdateService -> Maybe Int
$sel:platformVersion:UpdateService' :: UpdateService -> Maybe Text
$sel:cluster:UpdateService' :: UpdateService -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"cluster" 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
cluster,
            (Text
"platformVersion" 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
platformVersion,
            (Text
"desiredCount" 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
desiredCount,
            (Text
"placementConstraints" Text -> [PlacementConstraint] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([PlacementConstraint] -> Pair)
-> Maybe [PlacementConstraint] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PlacementConstraint]
placementConstraints,
            (Text
"placementStrategy" Text -> [PlacementStrategy] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([PlacementStrategy] -> Pair)
-> Maybe [PlacementStrategy] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PlacementStrategy]
placementStrategy,
            (Text
"forceNewDeployment" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
forceNewDeployment,
            (Text
"taskDefinition" 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
taskDefinition,
            (Text
"healthCheckGracePeriodSeconds" 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
healthCheckGracePeriodSeconds,
            (Text
"networkConfiguration" Text -> NetworkConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NetworkConfiguration -> Pair)
-> Maybe NetworkConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NetworkConfiguration
networkConfiguration,
            (Text
"capacityProviderStrategy" Text -> [CapacityProviderStrategyItem] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([CapacityProviderStrategyItem] -> Pair)
-> Maybe [CapacityProviderStrategyItem] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CapacityProviderStrategyItem]
capacityProviderStrategy,
            (Text
"enableExecuteCommand" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableExecuteCommand,
            (Text
"deploymentConfiguration" Text -> DeploymentConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DeploymentConfiguration -> Pair)
-> Maybe DeploymentConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DeploymentConfiguration
deploymentConfiguration,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"service" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
service)
          ]
      )

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

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

-- | /See:/ 'newUpdateServiceResponse' smart constructor.
data UpdateServiceResponse = UpdateServiceResponse'
  { -- | The full description of your service following the update call.
    UpdateServiceResponse -> Maybe ContainerService
service :: Prelude.Maybe ContainerService,
    -- | The response's http status code.
    UpdateServiceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateServiceResponse -> UpdateServiceResponse -> Bool
(UpdateServiceResponse -> UpdateServiceResponse -> Bool)
-> (UpdateServiceResponse -> UpdateServiceResponse -> Bool)
-> Eq UpdateServiceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateServiceResponse -> UpdateServiceResponse -> Bool
$c/= :: UpdateServiceResponse -> UpdateServiceResponse -> Bool
== :: UpdateServiceResponse -> UpdateServiceResponse -> Bool
$c== :: UpdateServiceResponse -> UpdateServiceResponse -> Bool
Prelude.Eq, ReadPrec [UpdateServiceResponse]
ReadPrec UpdateServiceResponse
Int -> ReadS UpdateServiceResponse
ReadS [UpdateServiceResponse]
(Int -> ReadS UpdateServiceResponse)
-> ReadS [UpdateServiceResponse]
-> ReadPrec UpdateServiceResponse
-> ReadPrec [UpdateServiceResponse]
-> Read UpdateServiceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateServiceResponse]
$creadListPrec :: ReadPrec [UpdateServiceResponse]
readPrec :: ReadPrec UpdateServiceResponse
$creadPrec :: ReadPrec UpdateServiceResponse
readList :: ReadS [UpdateServiceResponse]
$creadList :: ReadS [UpdateServiceResponse]
readsPrec :: Int -> ReadS UpdateServiceResponse
$creadsPrec :: Int -> ReadS UpdateServiceResponse
Prelude.Read, Int -> UpdateServiceResponse -> ShowS
[UpdateServiceResponse] -> ShowS
UpdateServiceResponse -> String
(Int -> UpdateServiceResponse -> ShowS)
-> (UpdateServiceResponse -> String)
-> ([UpdateServiceResponse] -> ShowS)
-> Show UpdateServiceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateServiceResponse] -> ShowS
$cshowList :: [UpdateServiceResponse] -> ShowS
show :: UpdateServiceResponse -> String
$cshow :: UpdateServiceResponse -> String
showsPrec :: Int -> UpdateServiceResponse -> ShowS
$cshowsPrec :: Int -> UpdateServiceResponse -> ShowS
Prelude.Show, (forall x. UpdateServiceResponse -> Rep UpdateServiceResponse x)
-> (forall x. Rep UpdateServiceResponse x -> UpdateServiceResponse)
-> Generic UpdateServiceResponse
forall x. Rep UpdateServiceResponse x -> UpdateServiceResponse
forall x. UpdateServiceResponse -> Rep UpdateServiceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateServiceResponse x -> UpdateServiceResponse
$cfrom :: forall x. UpdateServiceResponse -> Rep UpdateServiceResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateServiceResponse' 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:
--
-- 'service', 'updateServiceResponse_service' - The full description of your service following the update call.
--
-- 'httpStatus', 'updateServiceResponse_httpStatus' - The response's http status code.
newUpdateServiceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateServiceResponse
newUpdateServiceResponse :: Int -> UpdateServiceResponse
newUpdateServiceResponse Int
pHttpStatus_ =
  UpdateServiceResponse' :: Maybe ContainerService -> Int -> UpdateServiceResponse
UpdateServiceResponse'
    { $sel:service:UpdateServiceResponse' :: Maybe ContainerService
service = Maybe ContainerService
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateServiceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The full description of your service following the update call.
updateServiceResponse_service :: Lens.Lens' UpdateServiceResponse (Prelude.Maybe ContainerService)
updateServiceResponse_service :: (Maybe ContainerService -> f (Maybe ContainerService))
-> UpdateServiceResponse -> f UpdateServiceResponse
updateServiceResponse_service = (UpdateServiceResponse -> Maybe ContainerService)
-> (UpdateServiceResponse
    -> Maybe ContainerService -> UpdateServiceResponse)
-> Lens
     UpdateServiceResponse
     UpdateServiceResponse
     (Maybe ContainerService)
     (Maybe ContainerService)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceResponse' {Maybe ContainerService
service :: Maybe ContainerService
$sel:service:UpdateServiceResponse' :: UpdateServiceResponse -> Maybe ContainerService
service} -> Maybe ContainerService
service) (\s :: UpdateServiceResponse
s@UpdateServiceResponse' {} Maybe ContainerService
a -> UpdateServiceResponse
s {$sel:service:UpdateServiceResponse' :: Maybe ContainerService
service = Maybe ContainerService
a} :: UpdateServiceResponse)

-- | The response's http status code.
updateServiceResponse_httpStatus :: Lens.Lens' UpdateServiceResponse Prelude.Int
updateServiceResponse_httpStatus :: (Int -> f Int) -> UpdateServiceResponse -> f UpdateServiceResponse
updateServiceResponse_httpStatus = (UpdateServiceResponse -> Int)
-> (UpdateServiceResponse -> Int -> UpdateServiceResponse)
-> Lens UpdateServiceResponse UpdateServiceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateServiceResponse' :: UpdateServiceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateServiceResponse
s@UpdateServiceResponse' {} Int
a -> UpdateServiceResponse
s {$sel:httpStatus:UpdateServiceResponse' :: Int
httpStatus = Int
a} :: UpdateServiceResponse)

instance Prelude.NFData UpdateServiceResponse