Skip to content

update_product

update_product(
    product_id: ProductId,
    *,
    config_overrides: Optional[APIPortalClientConfig] = None,
    display_name: Optional[ProductName] = None,
    description: Optional[ProductDescription] = None,
    display_order: Optional[DisplayOrder] = None,
    api_selection_configuration: Optional[ApiSelectionConfiguration] = None,
) -> UpdateProductResponse

Updates a product. Only the fields supplied in the request are changed.

Parameters:

  • product_id (ProductId) –

    The identifier of the product.

  • display_name (Optional[ProductName], default: None ) –

    The new name of the product. Omit it to keep the current name.

  • description (Optional[ProductDescription], default: None ) –

    The new description of the product. Omit it to keep the current description.

  • display_order (Optional[DisplayOrder], default: None ) –

    The new page order. Omit it to keep the current order.

  • api_selection_configuration (Optional[ApiSelectionConfiguration], default: None ) –

    The new API selection settings. The selection mode must match the mode the product was created with. Omit it to keep the current settings.

Raises:

Source code in docs_src/capo_apiportal/_services/api_portal.py
def update_product(
    self,
    product_id: "capo_apiportal.types.product_id.ProductId",
    *,
    config_overrides: Optional[APIPortalClientConfig] = None,
    display_name: Optional["capo_apiportal.types.product_name.ProductName"] = None,
    description: Optional[
        "capo_apiportal.types.product_description.ProductDescription"
    ] = None,
    display_order: Optional[
        "capo_apiportal.types.display_order.DisplayOrder"
    ] = None,
    api_selection_configuration: Optional[
        "capo_apiportal.types.api_selection_configuration.ApiSelectionConfiguration"
    ] = None,
) -> "capo_apiportal.types.update_product_response.UpdateProductResponse":
    """Updates a product. Only the fields supplied in the request are changed.

    Args:
        product_id: The identifier of the product.
        display_name: The new name of the product. Omit it to keep the current name.
        description: The new description of the product. Omit it to keep the current description.
        display_order: The new page order. Omit it to keep the current order.
        api_selection_configuration: The new API selection settings. The selection mode must match the mode the product was created with. Omit it to keep the current settings.

    Raises:
        capo_apiportal.errors.access_denied_exception.AccessDeniedException: You do not have permission to perform this operation.
        capo_apiportal.errors.bad_request_exception.BadRequestException: The request is not valid. The message identifies the field or value that failed validation.
        capo_apiportal.errors.limit_exceeded_exception.LimitExceededException: The request rate or a service quota was exceeded. Reduce the request rate or the number of resources and try again.
        capo_apiportal.errors.resource_not_found_exception.ResourceNotFoundException: The requested resource does not exist, or you do not have access to it.
        capo_apiportal.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_apiportal.types.update_product_request.UpdateProductRequest]",
    ) -> OperationResponse[
        "capo_apiportal.types.update_product_response.UpdateProductResponse"
    ]:
        import capo_apiportal._operations.api_portal_control_service.update_product

        output, http_response = (
            capo_apiportal._operations.api_portal_control_service.update_product.update_product(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateProduct")
    )
    input_: capo_apiportal.types.update_product_request.UpdateProductRequest = {
        "product_id": product_id
    }
    if display_name is not None:
        input_["display_name"] = display_name
    if description is not None:
        input_["description"] = description
    if display_order is not None:
        input_["display_order"] = display_order
    if api_selection_configuration is not None:
        input_["api_selection_configuration"] = api_selection_configuration

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