Skip to content

copy_product

copy_product(
    source_product_arn: ProductArn,
    idempotency_token: IdempotencyToken,
    *,
    config_overrides: Optional[ServiceCatalogClientConfig] = None,
    accept_language: Optional[AcceptLanguage] = None,
    target_product_id: Optional[Id] = None,
    target_product_name: Optional[ProductViewName] = None,
    source_provisioning_artifact_identifiers: Optional[
        SourceProvisioningArtifactProperties
    ] = None,
    copy_options: Optional[CopyOptions] = None,
) -> CopyProductOutput

Copies the specified source product to the specified target product or a new product.

You can copy a product to the same account or another account. You can copy a product to the same Region or another Region. If you copy a product to another account, you must first share the product in a portfolio using CreatePortfolioShare.

This operation is performed asynchronously. To track the progress of the operation, use DescribeCopyProductStatus.

Parameters:

  • accept_language (Optional[AcceptLanguage], default: None ) –

    The language code.

    • jp - Japanese

    • zh - Chinese

  • source_product_arn (ProductArn) –

    The Amazon Resource Name (ARN) of the source product.

  • target_product_id (Optional[Id], default: None ) –

    The identifier of the target product. By default, a new product is created.

  • target_product_name (Optional[ProductViewName], default: None ) –

    A name for the target product. The default is the name of the source product.

  • source_provisioning_artifact_identifiers (Optional[SourceProvisioningArtifactProperties], default: None ) –

    The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default, all provisioning artifacts are copied.

  • copy_options (Optional[CopyOptions], default: None ) –

    The copy options. If the value is CopyTags, the tags from the source product are copied to the target product.

  • idempotency_token (IdempotencyToken) –

    A unique identifier that you provide to ensure idempotency. If multiple requests differ only by the idempotency token, the same response is returned for each repeated request.

Raises:

Source code in docs_src/capo_service_catalog/_services/service_catalog.py
def copy_product(
    self,
    source_product_arn: "capo_service_catalog.types.product_arn.ProductArn",
    idempotency_token: "capo_service_catalog.types.idempotency_token.IdempotencyToken",
    *,
    config_overrides: Optional[ServiceCatalogClientConfig] = None,
    accept_language: Optional[
        "capo_service_catalog.types.accept_language.AcceptLanguage"
    ] = None,
    target_product_id: Optional["capo_service_catalog.types.id.Id"] = None,
    target_product_name: Optional[
        "capo_service_catalog.types.product_view_name.ProductViewName"
    ] = None,
    source_provisioning_artifact_identifiers: Optional[
        "capo_service_catalog.types.source_provisioning_artifact_properties.SourceProvisioningArtifactProperties"
    ] = None,
    copy_options: Optional[
        "capo_service_catalog.types.copy_options.CopyOptions"
    ] = None,
) -> "capo_service_catalog.types.copy_product_output.CopyProductOutput":
    """<p>Copies the specified source product to the specified target product or a new product.</p> <p>You can copy a product to the same account or another account. You can copy a product to the same Region or another Region. If you copy a product to another account, you must first share the product in a portfolio using <a>CreatePortfolioShare</a>.</p> <p>This operation is performed asynchronously. To track the progress of the operation, use <a>DescribeCopyProductStatus</a>.</p>

    Args:
        accept_language: <p>The language code.</p> <ul> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - Chinese</p> </li> </ul>
        source_product_arn: <p>The Amazon Resource Name (ARN) of the source product.</p>
        target_product_id: <p>The identifier of the target product. By default, a new product is created.</p>
        target_product_name: <p>A name for the target product. The default is the name of the source product.</p>
        source_provisioning_artifact_identifiers: <p>The identifiers of the provisioning artifacts (also known as versions) of the product to copy. By default, all provisioning artifacts are copied.</p>
        copy_options: <p>The copy options. If the value is <code>CopyTags</code>, the tags from the source product are copied to the target product.</p>
        idempotency_token: <p> A unique identifier that you provide to ensure idempotency. If multiple requests differ only by the idempotency token, the same response is returned for each repeated request. </p>

    Raises:
        capo_service_catalog.errors.invalid_parameters_exception.InvalidParametersException: <p>One or more parameters provided to the operation are not valid.</p>
        capo_service_catalog.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_service_catalog.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_service_catalog.types.copy_product_input.CopyProductInput]",
    ) -> OperationResponse[
        "capo_service_catalog.types.copy_product_output.CopyProductOutput"
    ]:
        import capo_service_catalog._operations.aws242_service_catalog_service.copy_product

        output, http_response = (
            capo_service_catalog._operations.aws242_service_catalog_service.copy_product.copy_product(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CopyProduct")
    )
    input_: capo_service_catalog.types.copy_product_input.CopyProductInput = {
        "source_product_arn": source_product_arn,
        "idempotency_token": idempotency_token,
    }
    if accept_language is not None:
        input_["accept_language"] = accept_language
    if target_product_id is not None:
        input_["target_product_id"] = target_product_id
    if target_product_name is not None:
        input_["target_product_name"] = target_product_name
    if source_provisioning_artifact_identifiers is not None:
        input_["source_provisioning_artifact_identifiers"] = (
            source_provisioning_artifact_identifiers
        )
    if copy_options is not None:
        input_["copy_options"] = copy_options

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