Skip to content

associate_managed_apis async

associate_managed_apis(
    product_id: ProductId,
    managed_api_ids: ManagedApiIdList,
    *,
    config_overrides: Optional[AsyncAPIPortalClientConfig] = None,
) -> AssociateManagedApisResponse

Associate one or more Managed APIs with a product. Best-effort — IDs that fail are returned in {@link AssociateManagedApisResponse#failedItems}; IDs that succeed are omitted. Associating an already-associated Managed API is a no-op (not reported as failure).

Parameters:

  • product_id (ProductId) –

    The identifier of the product to associate the Managed APIs with.

Raises:

Source code in docs_src/capo_apiportal/_services/async_api_portal.py
async def associate_managed_apis(
    self,
    product_id: "capo_apiportal.types.product_id.ProductId",
    managed_api_ids: "capo_apiportal.types.managed_api_id_list.ManagedApiIdList",
    *,
    config_overrides: Optional[AsyncAPIPortalClientConfig] = None,
) -> "capo_apiportal.types.associate_managed_apis_response.AssociateManagedApisResponse":
    """Associate one or more Managed APIs with a product. Best-effort — IDs that fail are returned in {@link AssociateManagedApisResponse#failedItems}; IDs that succeed are omitted. Associating an already-associated Managed API is a no-op (not reported as failure).

    Args:
        product_id: The identifier of the product to associate the Managed APIs with.

    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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_apiportal.types.associate_managed_apis_request.AssociateManagedApisRequest]",
    ) -> AsyncOperationResponse[
        "capo_apiportal.types.associate_managed_apis_response.AssociateManagedApisResponse"
    ]:
        import capo_apiportal._operations.api_portal_control_service.associate_managed_apis

        (
            output,
            http_response,
        ) = await capo_apiportal._operations.api_portal_control_service.associate_managed_apis.async_associate_managed_apis(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateManagedApis")
    )
    input_: capo_apiportal.types.associate_managed_apis_request.AssociateManagedApisRequest = {
        "product_id": product_id,
        "managed_api_ids": managed_api_ids,
    }

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