Skip to content

sift_client.resources.reports

CLASS DESCRIPTION
ReportsAPIAsync

High-level API for interacting with reports.

ReportsAPIAsync

ReportsAPIAsync(sift_client: SiftClient)

Bases: ResourceBase

High-level API for interacting with reports.

Initialize the ReportsAPI.

PARAMETER DESCRIPTION
sift_client

The Sift client to use.

TYPE: SiftClient

METHOD DESCRIPTION
archive

Archive a report.

cancel

Cancel a report.

create_from_applicable_rules

Create a new report from applicable rules based on a run.

create_from_rules

Create a new report from rules.

create_from_template

Create a new report from a report template.

find

Find a single report matching the given query. Takes the same arguments as list. If more than one report is found,

get

Get a Report.

list_

List reports with optional filtering.

rerun

Rerun a report.

unarchive

Unarchive a report.

update

Update a report.

ATTRIBUTE DESCRIPTION
client

TYPE: SiftClient

grpc_client

TYPE: GrpcClient

rest_client

TYPE: RestClient

client property

client: SiftClient

grpc_client property

grpc_client: GrpcClient

rest_client property

rest_client: RestClient

archive async

archive(*, report: str | Report) -> Report

Archive a report.

cancel async

cancel(*, report: str | Report) -> None

Cancel a report.

PARAMETER DESCRIPTION
report

The Report or report ID to cancel.

TYPE: str | Report

create_from_applicable_rules async

create_from_applicable_rules(
    *,
    run: Run | str | None = None,
    organization_id: str | None = None,
    name: str | None = None,
    start_time: datetime | None = None,
    end_time: datetime | None = None,
) -> Report | None

Create a new report from applicable rules based on a run. If you want to evaluate against assets, use the rules client instead since no report is created in that case.

PARAMETER DESCRIPTION
run

The run or run ID to associate with the report.

TYPE: Run | str | None DEFAULT: None

organization_id

The organization ID.

TYPE: str | None DEFAULT: None

name

Optional name for the report.

TYPE: str | None DEFAULT: None

start_time

Optional start time to evaluate rules against.

TYPE: datetime | None DEFAULT: None

end_time

Optional end time to evaluate rules against.

TYPE: datetime | None DEFAULT: None

RETURNS DESCRIPTION
Report | None

The created Report or None if no report was created.

create_from_rules async

create_from_rules(
    *,
    name: str,
    run: Run | str | None = None,
    organization_id: str | None = None,
    rules: list[Rule] | list[str],
) -> Report | None

Create a new report from rules.

PARAMETER DESCRIPTION
name

The name of the report.

TYPE: str

run

The run or run ID to associate with the report.

TYPE: Run | str | None DEFAULT: None

organization_id

The organization ID.

TYPE: str | None DEFAULT: None

rules

List of rules or rule IDs to include in the report.

TYPE: list[Rule] | list[str]

RETURNS DESCRIPTION
Report | None

The created Report or None if no report was created.

create_from_template async

create_from_template(
    *,
    report_template_id: str,
    run_id: str,
    organization_id: str | None = None,
    name: str | None = None,
) -> Report | None

Create a new report from a report template.

PARAMETER DESCRIPTION
report_template_id

The ID of the report template to use.

TYPE: str

run_id

The run ID to associate with the report.

TYPE: str

organization_id

The organization ID.

TYPE: str | None DEFAULT: None

name

Optional name for the report.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
Report | None

The created Report or None if no report was created.

find async

find(**kwargs) -> Report | None

Find a single report matching the given query. Takes the same arguments as list. If more than one report is found, raises an error.

PARAMETER DESCRIPTION
**kwargs

Keyword arguments to pass to list.

DEFAULT: {}

RETURNS DESCRIPTION
Report | None

The Report found or None.

get async

get(*, report_id: str) -> Report

Get a Report.

PARAMETER DESCRIPTION
report_id

The ID of the report.

TYPE: str

RETURNS DESCRIPTION
Report

The Report.

list_ async

list_(
    *,
    name: str | None = None,
    name_contains: str | None = None,
    name_regex: str | Pattern | None = None,
    names: list[str] | None = None,
    description_contains: str | None = None,
    run: Run | str | None = None,
    organization_id: str | None = None,
    report_ids: list[str] | None = None,
    report_template_id: str | None = None,
    metadata: dict[str, str | float | bool] | None = None,
    tag_names: list[str] | list[Tag] | None = None,
    created_by: str | None = None,
    modified_by: str | None = None,
    order_by: str | None = None,
    limit: int | None = None,
    include_archived: bool = False,
    filter_query: str | None = None,
    created_after: datetime | None = None,
    created_before: datetime | None = None,
    modified_after: datetime | None = None,
    modified_before: datetime | None = None,
) -> list[Report]

List reports with optional filtering.

PARAMETER DESCRIPTION
name

Exact name of the report.

TYPE: str | None DEFAULT: None

name_contains

Partial name of the report.

TYPE: str | None DEFAULT: None

name_regex

Regular expression string to filter reports by name.

TYPE: str | Pattern | None DEFAULT: None

names

List of report names to filter by.

TYPE: list[str] | None DEFAULT: None

description_contains

Partial description of the report.

TYPE: str | None DEFAULT: None

run

Run/run ID to filter by.

TYPE: Run | str | None DEFAULT: None

organization_id

Organization ID to filter by.

TYPE: str | None DEFAULT: None

report_ids

List of report IDs to filter by.

TYPE: list[str] | None DEFAULT: None

report_template_id

Report template ID to filter by.

TYPE: str | None DEFAULT: None

metadata

Metadata to filter by.

TYPE: dict[str, str | float | bool] | None DEFAULT: None

tag_names

List of tags or tag names to filter by.

TYPE: list[str] | list[Tag] | None DEFAULT: None

created_by

The user ID of the creator of the reports.

TYPE: str | None DEFAULT: None

modified_by

The user ID of the last modifier of the reports.

TYPE: str | None DEFAULT: None

order_by

How to order the retrieved reports.

TYPE: str | None DEFAULT: None

limit

How many reports to retrieve. If None, retrieves all matches.

TYPE: int | None DEFAULT: None

include_archived

Whether to include archived reports.

TYPE: bool DEFAULT: False

filter_query

Explicit CEL query to filter reports.

TYPE: str | None DEFAULT: None

created_after

Filter reports created after this datetime.

TYPE: datetime | None DEFAULT: None

created_before

Filter reports created before this datetime.

TYPE: datetime | None DEFAULT: None

modified_after

Filter reports modified after this datetime.

TYPE: datetime | None DEFAULT: None

modified_before

Filter reports modified before this datetime.

TYPE: datetime | None DEFAULT: None

RETURNS DESCRIPTION
list[Report]

A list of Reports that matches the filter.

rerun async

rerun(*, report: str | Report) -> tuple[str, str]

Rerun a report.

PARAMETER DESCRIPTION
report

The Report or report ID to rerun.

TYPE: str | Report

RETURNS DESCRIPTION
tuple[str, str]

A tuple of (job_id, new_report_id).

unarchive async

unarchive(*, report: str | Report) -> Report

Unarchive a report.

update async

update(
    report: str | Report, update: ReportUpdate | dict
) -> Report

Update a report.

PARAMETER DESCRIPTION
report

The Report or report ID to update.

TYPE: str | Report

update

The updates to apply.

TYPE: ReportUpdate | dict