startResourceStateUpdate method

Future<StartResourceStateUpdateResponse> startResourceStateUpdate({
  1. required String resourceArn,
  2. required ResourceState state,
  3. String? clientToken,
  4. ResourceStateUpdateExclusionRules? exclusionRules,
  5. String? executionRole,
  6. ResourceStateUpdateIncludeResources? includeResources,
  7. DateTime? updateAt,
})

Begin asynchronous resource state update for lifecycle changes to the specified image resources.

May throw CallRateLimitExceededException. May throw ClientException. May throw ForbiddenException. May throw IdempotentParameterMismatchException. May throw InvalidRequestException. May throw ResourceInUseException. May throw ResourceNotFoundException. May throw ServiceException. May throw ServiceUnavailableException.

Parameter resourceArn : The Amazon Resource Name (ARN) of the image build version to update. The image must be in one of these terminal states: AVAILABLE, DEPRECATED, DISABLED, FAILED, or CANCELLED. Images with FAILED or CANCELLED status can transition only to DELETED.

Parameter state : Specifies the lifecycle action to take for this request. For AMI-based images, valid values are AVAILABLE, DEPRECATED, DISABLED, and DELETED. For container-based images, only DELETED is supported.

Parameter clientToken : Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.

Parameter exclusionRules : Skip action on the image resource and associated resources if specified exclusion rules are met.

Parameter executionRole : The name or Amazon Resource Name (ARN) of the IAM role that’s used to update image state.

Parameter includeResources : Specifies which image resources to include in the state update. When specified, the lifecycle action applies to underlying resources. These resources include AMIs, snapshots, and containers in addition to the Image Builder image resource. Requires executionRole to also be specified. To delete an image and its underlying resources, you must specify includeResources. To delete only the Image Builder image record without affecting underlying resources, use the DeleteImage API instead.

Parameter updateAt : Specifies the timestamp when the state transition takes effect. Use this parameter only when the target status is DEPRECATED. The value must be a future time.

Implementation

Future<StartResourceStateUpdateResponse> startResourceStateUpdate({
  required String resourceArn,
  required ResourceState state,
  String? clientToken,
  ResourceStateUpdateExclusionRules? exclusionRules,
  String? executionRole,
  ResourceStateUpdateIncludeResources? includeResources,
  DateTime? updateAt,
}) async {
  final $payload = <String, dynamic>{
    'resourceArn': resourceArn,
    'state': state,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (exclusionRules != null) 'exclusionRules': exclusionRules,
    if (executionRole != null) 'executionRole': executionRole,
    if (includeResources != null) 'includeResources': includeResources,
    if (updateAt != null) 'updateAt': unixTimestampToJson(updateAt),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/StartResourceStateUpdate',
    exceptionFnMap: _exceptionFns,
  );
  return StartResourceStateUpdateResponse.fromJson(response);
}