distributeImage method
Distributes an existing AMI to target Regions and accounts without running the full image build process. This operation only runs the distribution phase on an image that has already been built.
May throw AccessDeniedException.
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 ServiceQuotaExceededException.
May throw ServiceUnavailableException.
May throw TooManyRequestsException.
Parameter distributionConfigurationArn :
The Amazon Resource Name (ARN) of the distribution configuration. The
configuration defines target Regions, accounts, and AMI settings. The
distribution configuration must be in the same Region as this operation.
Parameter executionRole :
The name or Amazon Resource Name (ARN) of the IAM role that Image Builder
assumes to distribute the image.
Parameter sourceImage :
The source image to distribute. Specify an AMI identifier, SSM parameter
path, or Image Builder image Amazon Resource Name (ARN). When you specify
an Image Builder image Amazon Resource Name (ARN), the image must be in
the AVAILABLE state.
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 loggingConfiguration :
The logging configuration for the distribution.
Parameter tags :
The tags to apply to the distributed image.
Implementation
Future<DistributeImageResponse> distributeImage({
required String distributionConfigurationArn,
required String executionRole,
required String sourceImage,
String? clientToken,
ImageLoggingConfiguration? loggingConfiguration,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'distributionConfigurationArn': distributionConfigurationArn,
'executionRole': executionRole,
'sourceImage': sourceImage,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (loggingConfiguration != null)
'loggingConfiguration': loggingConfiguration,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/DistributeImage',
exceptionFnMap: _exceptionFns,
);
return DistributeImageResponse.fromJson(response);
}