Skip to content

list_managed_api_events

list_managed_api_events(
    managed_api_id: ManagedApiId,
    *,
    config_overrides: Optional[APIPortalClientConfig] = None,
    started_after: Optional[datetime] = None,
    started_before: Optional[datetime] = None,
    max_results: Optional[ManagedApiEventMaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListManagedApiEventsResponse

Lists API-security events for a single managed API, most recent first. Returns up to 20 of the most recent events (not paginated).

Parameters:

  • managed_api_id (ManagedApiId) –

    The identifier of the Managed API.

  • started_after (Optional[datetime], default: None ) –

    Inclusive lower bound on each event's start time; only events that started at or after this time are returned. Optional; defaults to 30 days before the current time.

  • started_before (Optional[datetime], default: None ) –

    Exclusive upper bound on each event's start time; only events that started before this time are returned. Optional; defaults to the current time.

  • max_results (Optional[ManagedApiEventMaxResults], default: None ) –

    The maximum number of results to return in one page, from 1 to 20.

  • next_token (Optional[NextToken], default: None ) –

    The pagination token returned by a previous call. Omit it to get the first page.

Raises:

Source code in docs_src/capo_apiportal/_services/api_portal.py
def list_managed_api_events(
    self,
    managed_api_id: "capo_apiportal.types.managed_api_id.ManagedApiId",
    *,
    config_overrides: Optional[APIPortalClientConfig] = None,
    started_after: Optional[datetime.datetime] = None,
    started_before: Optional[datetime.datetime] = None,
    max_results: Optional[
        "capo_apiportal.types.managed_api_event_max_results.ManagedApiEventMaxResults"
    ] = None,
    next_token: Optional["capo_apiportal.types.next_token.NextToken"] = None,
) -> "capo_apiportal.types.list_managed_api_events_response.ListManagedApiEventsResponse":
    """Lists API-security events for a single managed API, most recent first. Returns up to 20 of the most recent events (not paginated).

    Args:
        managed_api_id: The identifier of the Managed API.
        started_after: Inclusive lower bound on each event's start time; only events that started at or after this time are returned. Optional; defaults to 30 days before the current time.
        started_before: Exclusive upper bound on each event's start time; only events that started before this time are returned. Optional; defaults to the current time.
        max_results: The maximum number of results to return in one page, from 1 to 20.
        next_token: The pagination token returned by a previous call. Omit it to get the first page.

    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.internal_server_exception.InternalServerException: The service encountered an internal error. Try the request again.
        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.list_managed_api_events_request.ListManagedApiEventsRequest]",
    ) -> OperationResponse[
        "capo_apiportal.types.list_managed_api_events_response.ListManagedApiEventsResponse"
    ]:
        import capo_apiportal._operations.api_portal_control_service.list_managed_api_events

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListManagedApiEvents")
    )
    input_: capo_apiportal.types.list_managed_api_events_request.ListManagedApiEventsRequest = {
        "managed_api_id": managed_api_id
    }
    if started_after is not None:
        input_["started_after"] = started_after
    if started_before is not None:
        input_["started_before"] = started_before
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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