AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

This is the response object from the UpdateTaskProtection operation.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceResponse
    Amazon.ECS.Model.UpdateTaskProtectionResponse

Namespace: Amazon.ECS.Model
Assembly: AWSSDK.ECS.dll
Version: 3.x.y.z

Syntax

C#
public class UpdateTaskProtectionResponse : AmazonWebServiceResponse

The UpdateTaskProtectionResponse type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property ContentLength System.Int64 Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property Failures System.Collections.Generic.List<Amazon.ECS.Model.Failure>

Gets and sets the property Failures.

Any failures associated with the call.

Public Property HttpStatusCode System.Net.HttpStatusCode Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property ProtectedTasks System.Collections.Generic.List<Amazon.ECS.Model.ProtectedTask>

Gets and sets the property 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 turned on for a task, the value is true. Otherwise, it is false.

  • expirationDate: The epoch time when protection for the task will expire.

Public Property ResponseMetadata Amazon.Runtime.ResponseMetadata Inherited from Amazon.Runtime.AmazonWebServiceResponse.

Examples

This example enables scale-in protection for a task for 60 minutes.

To set task scale-in protection for a task for 60 minutes


var client = new AmazonECSClient();
var response = client.UpdateTaskProtection(new UpdateTaskProtectionRequest 
{
    Cluster = "test-task-protection",
    ExpiresInMinutes = 60,
    ProtectionEnabled = true,
    Tasks = new List<string> {
        "b8b1cf532d0e46ba8d44a40d1de16772"
    }
});

List<Failure> failures = response.Failures;
List<ProtectedTask> protectedTasks = response.ProtectedTasks;

            

This example enables task scale-in protection for a task, without specifying the expiresInMinutes parameter, for the default protection period of 120 minutes.

To set task scale-in protection for the default time period in minutes


var client = new AmazonECSClient();
var response = client.UpdateTaskProtection(new UpdateTaskProtectionRequest 
{
    Cluster = "test-task-protection",
    ProtectionEnabled = true,
    Tasks = new List<string> {
        "b8b1cf532d0e46ba8d44a40d1de16772"
    }
});

List<Failure> failures = response.Failures;
List<ProtectedTask> protectedTasks = response.ProtectedTasks;

            

This example removes scale-in protection for a task.

To remove task scale-in protection


var client = new AmazonECSClient();
var response = client.UpdateTaskProtection(new UpdateTaskProtectionRequest 
{
    Cluster = "test-task-protection",
    ProtectionEnabled = false,
    Tasks = new List<string> {
        "b8b1cf532d0e46ba8d44a40d1de16772"
    }
});

List<Failure> failures = response.Failures;
List<ProtectedTask> protectedTasks = response.ProtectedTasks;

            

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5 and newer, 3.5