Skip to content

create_managed_api

create_managed_api(
    api_signature: ApiSignature,
    *,
    config_overrides: Optional[APIPortalClientConfig] = None,
    tags: Optional[Tags] = None,
) -> CreateManagedApiResponse

Promote a discovered API in the API inventory into the managed API list.

Parameters:

  • api_signature (ApiSignature) –

    The resource, method, host, port, and path that identify the API.

Raises:

  • AccessDeniedException –

    You do not have permission to perform this operation.

  • BadRequestException –

    The request is not valid. The message identifies the field or value that failed validation.

  • ConflictException –

    The request conflicts with the current state of the resource, for example because another operation on it is still in progress.

  • LimitExceededException –

    The request rate or a service quota was exceeded. Reduce the request rate or the number of resources and try again.

  • UnknownServiceError –

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

Source code in docs_src/capo_apiportal/_services/api_portal.py
def create_managed_api(
    self,
    api_signature: "capo_apiportal.types.api_signature.ApiSignature",
    *,
    config_overrides: Optional[APIPortalClientConfig] = None,
    tags: Optional["capo_apiportal.types.tags.Tags"] = None,
) -> "capo_apiportal.types.create_managed_api_response.CreateManagedApiResponse":
    """Promote a discovered API in the API inventory into the managed API list.

    Args:
        api_signature: The resource, method, host, port, and path that identify the API.

    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.conflict_exception.ConflictException: The request conflicts with the current state of the resource, for example because another operation on it is still in progress.
        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.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_apiportal.types.create_managed_api_request.CreateManagedApiRequest]",
    ) -> OperationResponse[
        "capo_apiportal.types.create_managed_api_response.CreateManagedApiResponse"
    ]:
        import capo_apiportal._operations.api_portal_control_service.create_managed_api

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateManagedApi")
    )
    input_: capo_apiportal.types.create_managed_api_request.CreateManagedApiRequest = {
        "api_signature": api_signature
    }
    if tags is not None:
        input_["tags"] = tags

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