- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
SubmitTaskStateChangeCommand
This action is only used by the Amazon ECS agent, and it is not intended for use outside of the agent.
Sent to acknowledge that a task changed states.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { ECSClient, SubmitTaskStateChangeCommand } from "@aws-sdk/client-ecs"; // ES Modules import
// const { ECSClient, SubmitTaskStateChangeCommand } = require("@aws-sdk/client-ecs"); // CommonJS import
const client = new ECSClient(config);
const input = { // SubmitTaskStateChangeRequest
cluster: "STRING_VALUE",
task: "STRING_VALUE",
status: "STRING_VALUE",
reason: "STRING_VALUE",
containers: [ // ContainerStateChanges
{ // ContainerStateChange
containerName: "STRING_VALUE",
imageDigest: "STRING_VALUE",
runtimeId: "STRING_VALUE",
exitCode: Number("int"),
networkBindings: [ // NetworkBindings
{ // NetworkBinding
bindIP: "STRING_VALUE",
containerPort: Number("int"),
hostPort: Number("int"),
protocol: "tcp" || "udp",
containerPortRange: "STRING_VALUE",
hostPortRange: "STRING_VALUE",
},
],
reason: "STRING_VALUE",
status: "STRING_VALUE",
},
],
attachments: [ // AttachmentStateChanges
{ // AttachmentStateChange
attachmentArn: "STRING_VALUE", // required
status: "STRING_VALUE", // required
},
],
managedAgents: [ // ManagedAgentStateChanges
{ // ManagedAgentStateChange
containerName: "STRING_VALUE", // required
managedAgentName: "ExecuteCommandAgent", // required
status: "STRING_VALUE", // required
reason: "STRING_VALUE",
},
],
pullStartedAt: new Date("TIMESTAMP"),
pullStoppedAt: new Date("TIMESTAMP"),
executionStoppedAt: new Date("TIMESTAMP"),
};
const command = new SubmitTaskStateChangeCommand(input);
const response = await client.send(command);
// { // SubmitTaskStateChangeResponse
// acknowledgment: "STRING_VALUE",
// };
SubmitTaskStateChangeCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
attachments | AttachmentStateChange[] | undefined | Any attachments associated with the state change request. |
cluster | string | undefined | The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task. |
containers | ContainerStateChange[] | undefined | Any containers that's associated with the state change request. |
executionStoppedAt | Date | undefined | The Unix timestamp for the time when the task execution stopped. |
managedAgents | ManagedAgentStateChange[] | undefined | The details for the managed agent that's associated with the task. |
pullStartedAt | Date | undefined | The Unix timestamp for the time when the container image pull started. |
pullStoppedAt | Date | undefined | The Unix timestamp for the time when the container image pull completed. |
reason | string | undefined | The reason for the state change request. |
status | string | undefined | The status of the state change request. |
task | string | undefined | The task ID or full ARN of the task in the state change request. |
SubmitTaskStateChangeCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
acknowledgment | string | undefined | Acknowledgement of the state change. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | You don't have authorization to perform the requested action. |
ClientException | client | These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid. |
InvalidParameterException | client | The specified parameter isn't valid. Review the available parameters for the API request. For more information about service event errors, see Amazon ECS service event messages . |
ServerException | server | These errors are usually caused by a server issue. |
ECSServiceException | Base exception class for all service exceptions from ECS service. |