Skip to content

delete_product async

delete_product(
    id: Id,
    *,
    config_overrides: Optional[AsyncServiceCatalogClientConfig] = None,
    accept_language: Optional[AcceptLanguage] = None,
) -> DeleteProductOutput

Deletes the specified product.

You cannot delete a product if it was shared with you or is associated with a portfolio.

A delegated admin is authorized to invoke this command.

Parameters:

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

    The language code.

    • jp - Japanese

    • zh - Chinese

  • id (Id) –

    The product identifier.

Raises:

  • InvalidParametersException –

    One or more parameters provided to the operation are not valid.

  • ResourceInUseException –

    A resource that is currently in use. Ensure that the resource is not in use and retry the operation.

  • ResourceNotFoundException –

    The specified resource was not found.

  • TagOptionNotMigratedException –

    An operation requiring TagOptions failed because the TagOptions migration process has not been performed for this account. Use the Amazon Web Services Management Console to perform the migration process before retrying the operation.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_service_catalog/_services/async_service_catalog.py
async def delete_product(
    self,
    id: "capo_service_catalog.types.id.Id",
    *,
    config_overrides: Optional[AsyncServiceCatalogClientConfig] = None,
    accept_language: Optional[
        "capo_service_catalog.types.accept_language.AcceptLanguage"
    ] = None,
) -> "capo_service_catalog.types.delete_product_output.DeleteProductOutput":
    """<p>Deletes the specified product.</p> <p>You cannot delete a product if it was shared with you or is associated with a portfolio.</p> <p>A delegated admin is authorized to invoke this command.</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>
        id: <p>The product identifier.</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_in_use_exception.ResourceInUseException: <p>A resource that is currently in use. Ensure that the resource is not in use and retry the operation.</p>
        capo_service_catalog.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_service_catalog.errors.tag_option_not_migrated_exception.TagOptionNotMigratedException: <p>An operation requiring TagOptions failed because the TagOptions migration process has not been performed for this account. Use the Amazon Web Services Management Console to perform the migration process before retrying the operation.</p>
        capo_service_catalog.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_service_catalog.types.delete_product_input.DeleteProductInput]",
    ) -> AsyncOperationResponse[
        "capo_service_catalog.types.delete_product_output.DeleteProductOutput"
    ]:
        import capo_service_catalog._operations.aws242_service_catalog_service.delete_product

        (
            output,
            http_response,
        ) = await capo_service_catalog._operations.aws242_service_catalog_service.delete_product.async_delete_product(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteProduct")
    )
    input_: capo_service_catalog.types.delete_product_input.DeleteProductInput = {
        "id": id
    }
    if accept_language is not None:
        input_["accept_language"] = accept_language

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output