Updates a distribution configuration. Distribution configurations define and configure the outputs for your images, including the target Regions, accounts, and settings for each Region.
This operation doesn't support selective updates. The request replaces the stored configuration, so include every setting that you want to keep.
Parameters:
-
distribution_configuration_arn
(DistributionConfigurationArn)
–
The Amazon Resource Name (ARN) of the distribution configuration that you want to update.
-
description
(Optional[NonEmptyString], default:
None
)
–
The description of the distribution configuration.
-
distributions
(DistributionList)
–
The distribution settings for the configuration. Each entry defines how output images are distributed in one target Amazon Web Services Region. A Region can appear at most once in the list. This list replaces the configuration's existing distributions entirely.
-
client_token
(ClientToken)
–
A unique, case-sensitive identifier you provide to ensure that the operation runs no more than one time. If you retry a request with the same client token, Image Builder returns the original response without running the operation again. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.
Raises:
-
CallRateLimitExceededException
–
You have exceeded the permitted request rate for the Amazon EC2 APIs that Image Builder calls on your behalf. Retry with an increasing or variable delay between requests.
-
ClientException
–
A generic client error. This error usually indicates that the request failed a validation check, such as when a downstream service rejects a configured value.
-
ForbiddenException
–
You are not authorized to perform the requested operation.
-
IdempotentParameterMismatchException
–
You have specified a client token for an operation using parameter values that differ from a previous request that used the same client token.
-
InvalidParameterCombinationException
–
You have specified a combination of parameters that isn't valid. For example, two mutually exclusive parameters, or a parameter without its required companion parameter. Review the error message for details.
-
InvalidRequestException
–
The request is malformed or otherwise invalid. Verify the request and try again.
-
ResourceInUseException
–
The resource that you are trying to operate on is currently in use. Review the message details and retry later.
-
ServiceException
–
An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.
-
ServiceUnavailableException
–
The service is unable to process your request at this time.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
Update a distribution configuration
The following example replaces the distribution settings for the specified configuration with a single distribution that names the output AMI with the build date.
>>> await client.update_distribution_configuration(distribution_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:distribution-configuration/my-example-distribution', distributions=[{'region': 'us-west-2', 'amiDistributionConfiguration': {'name': 'my-example-image-{{ imagebuilder:buildDate }}'}}], client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLEccccc')
Source code in docs_src/capo_imagebuilder/_services/async_imagebuilder.py
| async def update_distribution_configuration(
self,
distribution_configuration_arn: "capo_imagebuilder.types.distribution_configuration_arn.DistributionConfigurationArn",
distributions: "capo_imagebuilder.types.distribution_list.DistributionList",
client_token: "capo_imagebuilder.types.client_token.ClientToken",
*,
config_overrides: Optional[AsyncimagebuilderClientConfig] = None,
description: Optional[
"capo_imagebuilder.types.non_empty_string.NonEmptyString"
] = None,
) -> "capo_imagebuilder.types.update_distribution_configuration_response.UpdateDistributionConfigurationResponse":
"""<p>Updates a distribution configuration. Distribution configurations define and configure the outputs for your images, including the target Regions, accounts, and settings for each Region.</p> <note> <p>This operation doesn't support selective updates. The request replaces the stored configuration, so include every setting that you want to keep.</p> </note>
Args:
distribution_configuration_arn: <p>The Amazon Resource Name (ARN) of the distribution configuration that you want to update.</p>
description: <p>The description of the distribution configuration.</p>
distributions: <p>The distribution settings for the configuration. Each entry defines how output images are distributed in one target Amazon Web Services Region. A Region can appear at most once in the list. This list replaces the configuration's existing distributions entirely.</p>
client_token: <p>A unique, case-sensitive identifier you provide to ensure that the operation runs no more than one time. If you retry a request with the same client token, Image Builder returns the original response without running the operation again. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a> in the <i>Amazon EC2 API Reference</i>.</p>
Raises:
capo_imagebuilder.errors.call_rate_limit_exceeded_exception.CallRateLimitExceededException: <p>You have exceeded the permitted request rate for the Amazon EC2 APIs that Image Builder calls on your behalf. Retry with an increasing or variable delay between requests.</p>
capo_imagebuilder.errors.client_exception.ClientException: <p>A generic client error. This error usually indicates that the request failed a validation check, such as when a downstream service rejects a configured value.</p>
capo_imagebuilder.errors.forbidden_exception.ForbiddenException: <p>You are not authorized to perform the requested operation.</p>
capo_imagebuilder.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>You have specified a client token for an operation using parameter values that differ from a previous request that used the same client token.</p>
capo_imagebuilder.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>You have specified a combination of parameters that isn't valid. For example, two mutually exclusive parameters, or a parameter without its required companion parameter. Review the error message for details.</p>
capo_imagebuilder.errors.invalid_request_exception.InvalidRequestException: <p>The request is malformed or otherwise invalid. Verify the request and try again.</p>
capo_imagebuilder.errors.resource_in_use_exception.ResourceInUseException: <p>The resource that you are trying to operate on is currently in use. Review the message details and retry later.</p>
capo_imagebuilder.errors.service_exception.ServiceException: <p>An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.</p>
capo_imagebuilder.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is unable to process your request at this time.</p>
capo_imagebuilder.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Update a distribution configuration
The following example replaces the distribution settings for the specified configuration with a single distribution that names the output AMI with the build date.
>>> await client.update_distribution_configuration(distribution_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:distribution-configuration/my-example-distribution', distributions=[{'region': 'us-west-2', 'amiDistributionConfiguration': {'name': 'my-example-image-{{ imagebuilder:buildDate }}'}}], client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLEccccc')
"""
async def _handler(
req: "AsyncOperationRequest[capo_imagebuilder.types.update_distribution_configuration_request.UpdateDistributionConfigurationRequest]",
) -> AsyncOperationResponse[
"capo_imagebuilder.types.update_distribution_configuration_response.UpdateDistributionConfigurationResponse"
]:
import capo_imagebuilder._operations.imagebuilder.update_distribution_configuration
(
output,
http_response,
) = await capo_imagebuilder._operations.imagebuilder.update_distribution_configuration.async_update_distribution_configuration(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateDistributionConfiguration")
)
input_: capo_imagebuilder.types.update_distribution_configuration_request.UpdateDistributionConfigurationRequest = {
"distribution_configuration_arn": distribution_configuration_arn,
"distributions": distributions,
"client_token": client_token,
}
if description is not None:
input_["description"] = description
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|