amazonka-ecs-2.0: Amazon EC2 Container Service SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.ECS.UpdateTaskProtection

Description

Updates the protection status of a task. You can set protectionEnabled to true to protect your task from termination during scale-in events from Service Autoscaling or deployments.

Task-protection, by default, expires after 2 hours at which point Amazon ECS unsets the protectionEnabled property making the task eligible for termination by a subsequent scale-in event.

You can specify a custom expiration period for task protection from 1 minute to up to 2,880 minutes (48 hours). To specify the custom expiration period, set the expiresInMinutes property. The expiresInMinutes property is always reset when you invoke this operation for a task that already has protectionEnabled set to true. You can keep extending the protection expiration period of a task by invoking this operation repeatedly.

To learn more about Amazon ECS task protection, see Task scale-in protection in the /Amazon Elastic Container Service Developer Guide/ .

This operation is only supported for tasks belonging to an Amazon ECS service. Invoking this operation for a standalone task will result in an TASK_NOT_VALID failure. For more information, see API failure reasons.

If you prefer to set task protection from within the container, we recommend using the Task scale-in protection endpoint.

Synopsis

Creating a Request

data UpdateTaskProtection Source #

See: newUpdateTaskProtection smart constructor.

Constructors

UpdateTaskProtection' 

Fields

  • expiresInMinutes :: Maybe Int

    If you set protectionEnabled to true, you can specify the duration for task protection in minutes. You can specify a value from 1 minute to up to 2,880 minutes (48 hours). During this time, your task will not be terminated by scale-in events from Service Auto Scaling or deployments. After this time period lapses, protectionEnabled will be reset to false.

    If you don’t specify the time, then the task is automatically protected for 120 minutes (2 hours).

  • cluster :: Text

    The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task sets exist in.

  • tasks :: [Text]

    A list of up to 10 task IDs or full ARN entries.

  • protectionEnabled :: Bool

    Specify true to mark a task for protection and false to unset protection, making it eligible for termination.

Instances

Instances details
ToJSON UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

ToHeaders UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

ToPath UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

ToQuery UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

AWSRequest UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

Associated Types

type AWSResponse UpdateTaskProtection #

Generic UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

Associated Types

type Rep UpdateTaskProtection :: Type -> Type #

Read UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

Show UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

NFData UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

Methods

rnf :: UpdateTaskProtection -> () #

Eq UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

Hashable UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

type AWSResponse UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

type Rep UpdateTaskProtection Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

type Rep UpdateTaskProtection = D1 ('MetaData "UpdateTaskProtection" "Amazonka.ECS.UpdateTaskProtection" "amazonka-ecs-2.0-3xFxVqi9x5nBZ44jBEC5G8" 'False) (C1 ('MetaCons "UpdateTaskProtection'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "expiresInMinutes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "cluster") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "tasks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Text]) :*: S1 ('MetaSel ('Just "protectionEnabled") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))))

newUpdateTaskProtection Source #

Create a value of UpdateTaskProtection with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:expiresInMinutes:UpdateTaskProtection', updateTaskProtection_expiresInMinutes - If you set protectionEnabled to true, you can specify the duration for task protection in minutes. You can specify a value from 1 minute to up to 2,880 minutes (48 hours). During this time, your task will not be terminated by scale-in events from Service Auto Scaling or deployments. After this time period lapses, protectionEnabled will be reset to false.

If you don’t specify the time, then the task is automatically protected for 120 minutes (2 hours).

$sel:cluster:UpdateTaskProtection', updateTaskProtection_cluster - The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task sets exist in.

$sel:tasks:UpdateTaskProtection', updateTaskProtection_tasks - A list of up to 10 task IDs or full ARN entries.

UpdateTaskProtection, updateTaskProtection_protectionEnabled - Specify true to mark a task for protection and false to unset protection, making it eligible for termination.

Request Lenses

updateTaskProtection_expiresInMinutes :: Lens' UpdateTaskProtection (Maybe Int) Source #

If you set protectionEnabled to true, you can specify the duration for task protection in minutes. You can specify a value from 1 minute to up to 2,880 minutes (48 hours). During this time, your task will not be terminated by scale-in events from Service Auto Scaling or deployments. After this time period lapses, protectionEnabled will be reset to false.

If you don’t specify the time, then the task is automatically protected for 120 minutes (2 hours).

updateTaskProtection_cluster :: Lens' UpdateTaskProtection Text Source #

The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task sets exist in.

updateTaskProtection_tasks :: Lens' UpdateTaskProtection [Text] Source #

A list of up to 10 task IDs or full ARN entries.

updateTaskProtection_protectionEnabled :: Lens' UpdateTaskProtection Bool Source #

Specify true to mark a task for protection and false to unset protection, making it eligible for termination.

Destructuring the Response

data UpdateTaskProtectionResponse Source #

See: newUpdateTaskProtectionResponse smart constructor.

Constructors

UpdateTaskProtectionResponse' 

Fields

  • failures :: Maybe [Failure]

    Any failures associated with the call.

  • protectedTasks :: Maybe [ProtectedTask]

    A list of tasks with the following information.

    • taskArn: The task ARN.
    • protectionEnabled: The protection status of the task. If scale-in protection is enabled for a task, the value is true. Otherwise, it is false.
    • expirationDate: The epoch time when protection for the task will expire.
  • httpStatus :: Int

    The response's http status code.

Instances

Instances details
Generic UpdateTaskProtectionResponse Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

Associated Types

type Rep UpdateTaskProtectionResponse :: Type -> Type #

Read UpdateTaskProtectionResponse Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

Show UpdateTaskProtectionResponse Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

NFData UpdateTaskProtectionResponse Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

Eq UpdateTaskProtectionResponse Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

type Rep UpdateTaskProtectionResponse Source # 
Instance details

Defined in Amazonka.ECS.UpdateTaskProtection

type Rep UpdateTaskProtectionResponse = D1 ('MetaData "UpdateTaskProtectionResponse" "Amazonka.ECS.UpdateTaskProtection" "amazonka-ecs-2.0-3xFxVqi9x5nBZ44jBEC5G8" 'False) (C1 ('MetaCons "UpdateTaskProtectionResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "failures") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [Failure])) :*: (S1 ('MetaSel ('Just "protectedTasks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [ProtectedTask])) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))

newUpdateTaskProtectionResponse Source #

Create a value of UpdateTaskProtectionResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:failures:UpdateTaskProtectionResponse', updateTaskProtectionResponse_failures - Any failures associated with the call.

$sel:protectedTasks:UpdateTaskProtectionResponse', updateTaskProtectionResponse_protectedTasks - A list of tasks with the following information.

  • taskArn: The task ARN.
  • protectionEnabled: The protection status of the task. If scale-in protection is enabled for a task, the value is true. Otherwise, it is false.
  • expirationDate: The epoch time when protection for the task will expire.

$sel:httpStatus:UpdateTaskProtectionResponse', updateTaskProtectionResponse_httpStatus - The response's http status code.

Response Lenses

updateTaskProtectionResponse_protectedTasks :: Lens' UpdateTaskProtectionResponse (Maybe [ProtectedTask]) Source #

A list of tasks with the following information.

  • taskArn: The task ARN.
  • protectionEnabled: The protection status of the task. If scale-in protection is enabled for a task, the value is true. Otherwise, it is false.
  • expirationDate: The epoch time when protection for the task will expire.