submitTaskStateChange method

Future<SubmitTaskStateChangeResponse> submitTaskStateChange({
  1. List<AttachmentStateChange>? attachments,
  2. String? cluster,
  3. List<ContainerStateChange>? containers,
  4. DateTime? executionStoppedAt,
  5. DateTime? pullStartedAt,
  6. DateTime? pullStoppedAt,
  7. String? reason,
  8. String? status,
  9. String? task,
})
Sent to acknowledge that a task changed states.

May throw ServerException. May throw ClientException. May throw AccessDeniedException. May throw InvalidParameterException.

Parameter attachments : Any attachments associated with the state change request.

Parameter cluster : The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task.

Parameter containers : Any containers associated with the state change request.

Parameter executionStoppedAt : The Unix timestamp for when the task execution stopped.

Parameter pullStartedAt : The Unix timestamp for when the container image pull began.

Parameter pullStoppedAt : The Unix timestamp for when the container image pull completed.

Parameter reason : The reason for the state change request.

Parameter status : The status of the state change request.

Parameter task : The task ID or full ARN of the task in the state change request.

Implementation

Future<SubmitTaskStateChangeResponse> submitTaskStateChange({
  List<AttachmentStateChange>? attachments,
  String? cluster,
  List<ContainerStateChange>? containers,
  DateTime? executionStoppedAt,
  DateTime? pullStartedAt,
  DateTime? pullStoppedAt,
  String? reason,
  String? status,
  String? task,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonEC2ContainerServiceV20141113.SubmitTaskStateChange'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (attachments != null) 'attachments': attachments,
      if (cluster != null) 'cluster': cluster,
      if (containers != null) 'containers': containers,
      if (executionStoppedAt != null)
        'executionStoppedAt': unixTimestampToJson(executionStoppedAt),
      if (pullStartedAt != null)
        'pullStartedAt': unixTimestampToJson(pullStartedAt),
      if (pullStoppedAt != null)
        'pullStoppedAt': unixTimestampToJson(pullStoppedAt),
      if (reason != null) 'reason': reason,
      if (status != null) 'status': status,
      if (task != null) 'task': task,
    },
  );

  return SubmitTaskStateChangeResponse.fromJson(jsonResponse.body);
}