Skip to content

copy_image

copy_image(
    *,
    config_overrides: Optional[AppStreamClientConfig] = None,
    source_image_name: Optional[Name] = None,
    destination_image_name: Optional[Name] = None,
    destination_region: Optional[RegionName] = None,
    destination_image_description: Optional[Description] = None,
) -> CopyImageResponse

Copies the image within the same region or to a new region within the same AWS account. Note that any tags you added to the image will not be copied.

Parameters:

  • source_image_name (Optional[Name], default: None ) –

    The name of the image to copy.

  • destination_image_name (Optional[Name], default: None ) –

    The name that the image will have when it is copied to the destination.

  • destination_region (Optional[RegionName], default: None ) –

    The destination region to which the image will be copied. This parameter is required, even if you are copying an image within the same region.

  • destination_image_description (Optional[Description], default: None ) –

    The description that the image will have when it is copied to the destination.

Raises:

Source code in docs_src/capo_appstream/_services/app_stream.py
def copy_image(
    self,
    *,
    config_overrides: Optional[AppStreamClientConfig] = None,
    source_image_name: Optional["capo_appstream.types.name.Name"] = None,
    destination_image_name: Optional["capo_appstream.types.name.Name"] = None,
    destination_region: Optional[
        "capo_appstream.types.region_name.RegionName"
    ] = None,
    destination_image_description: Optional[
        "capo_appstream.types.description.Description"
    ] = None,
) -> "capo_appstream.types.copy_image_response.CopyImageResponse":
    """<p>Copies the image within the same region or to a new region within the same AWS account. Note that any tags you added to the image will not be copied.</p>

    Args:
        source_image_name: <p>The name of the image to copy.</p>
        destination_image_name: <p>The name that the image will have when it is copied to the destination.</p>
        destination_region: <p>The destination region to which the image will be copied. This parameter is required, even if you are copying an image within the same region.</p>
        destination_image_description: <p>The description that the image will have when it is copied to the destination.</p>

    Raises:
        capo_appstream.errors.incompatible_image_exception.IncompatibleImageException: <p>The image can't be updated because it's not compatible for updates.</p>
        capo_appstream.errors.invalid_account_status_exception.InvalidAccountStatusException: <p>The resource cannot be created because your AWS account is suspended. For assistance, contact AWS Support. </p>
        capo_appstream.errors.limit_exceeded_exception.LimitExceededException: <p>The requested limit exceeds the permitted limit for an account.</p>
        capo_appstream.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The specified resource already exists.</p>
        capo_appstream.errors.resource_not_available_exception.ResourceNotAvailableException: <p>The specified resource exists and is not in use, but isn't available.</p>
        capo_appstream.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_appstream.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_appstream.types.copy_image_request.CopyImageRequest]",
    ) -> OperationResponse[
        "capo_appstream.types.copy_image_response.CopyImageResponse"
    ]:
        import capo_appstream._operations.photon_admin_proxy_service.copy_image

        output, http_response = (
            capo_appstream._operations.photon_admin_proxy_service.copy_image.copy_image(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CopyImage")
    )
    input_: capo_appstream.types.copy_image_request.CopyImageRequest = {}
    if source_image_name is not None:
        input_["source_image_name"] = source_image_name
    if destination_image_name is not None:
        input_["destination_image_name"] = destination_image_name
    if destination_region is not None:
        input_["destination_region"] = destination_region
    if destination_image_description is not None:
        input_["destination_image_description"] = destination_image_description

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output