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:
|
| 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_rule_versions |
Create a new report from rule versions. |
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 |
get |
Get a Report. |
list_ |
List reports with optional filtering. |
rerun |
Rerun a report. |
unarchive |
Unarchive a report. |
update |
Update a report. |
wait_until_complete |
Wait until the report is complete or the timeout is reached. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
cancel
async
¶
cancel(*, report: str | Report) -> None
Cancel a report.
| PARAMETER | DESCRIPTION |
|---|---|
report
|
The Report or report ID to cancel.
TYPE:
|
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,
) -> Job | 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:
|
organization_id
|
The organization ID.
TYPE:
|
name
|
Optional name for the report.
TYPE:
|
start_time
|
Optional start time to evaluate rules against.
TYPE:
|
end_time
|
Optional end time to evaluate rules against.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Job | None
|
The Job for the pending report, or None if no report was created. |
create_from_rule_versions
async
¶
create_from_rule_versions(
*,
name: str,
run: Run | str | None = None,
organization_id: str | None = None,
rule_versions: list[RuleVersion] | list[str],
) -> Job | None
Create a new report from rule versions.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name of the report.
TYPE:
|
run
|
The run or run ID to associate with the report.
TYPE:
|
organization_id
|
The organization ID.
TYPE:
|
rule_versions
|
List of RuleVersions or rule_version IDs to include in the report.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Job | None
|
The Job for the pending 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],
) -> Job | None
Create a new report from rules.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name of the report.
TYPE:
|
run
|
The run or run ID to associate with the report.
TYPE:
|
organization_id
|
The organization ID.
TYPE:
|
rules
|
List of rules or rule IDs to include in the report.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Job | None
|
The Job for the pending 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,
) -> Job | None
Create a new report from a report template.
| PARAMETER | DESCRIPTION |
|---|---|
report_template_id
|
The ID of the report template to use.
TYPE:
|
run_id
|
The run ID to associate with the report.
TYPE:
|
organization_id
|
The organization ID.
TYPE:
|
name
|
Optional name for the report.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Job | None
|
The Job for the pending 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
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:
|
| 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:
|
name_contains
|
Partial name of the report.
TYPE:
|
name_regex
|
Regular expression string to filter reports by name.
TYPE:
|
names
|
List of report names to filter by.
TYPE:
|
description_contains
|
Partial description of the report.
TYPE:
|
run
|
Run/run ID to filter by.
TYPE:
|
organization_id
|
Organization ID to filter by.
TYPE:
|
report_ids
|
List of report IDs to filter by.
TYPE:
|
report_template_id
|
Report template ID to filter by.
TYPE:
|
metadata
|
Metadata to filter by.
TYPE:
|
tag_names
|
List of tags or tag names to filter by.
TYPE:
|
created_by
|
The user ID of the creator of the reports.
TYPE:
|
modified_by
|
The user ID of the last modifier of the reports.
TYPE:
|
order_by
|
How to order the retrieved reports.
TYPE:
|
limit
|
How many reports to retrieve. If None, retrieves all matches.
TYPE:
|
include_archived
|
Whether to include archived reports.
TYPE:
|
filter_query
|
Explicit CEL query to filter reports.
TYPE:
|
created_after
|
Filter reports created after this datetime.
TYPE:
|
created_before
|
Filter reports created before this datetime.
TYPE:
|
modified_after
|
Filter reports modified after this datetime.
TYPE:
|
modified_before
|
Filter reports modified before this datetime.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[Report]
|
A list of Reports that matches the filter. |
rerun
async
¶
update
async
¶
update(
report: str | Report, update: ReportUpdate | dict
) -> Report
Update a report.
| PARAMETER | DESCRIPTION |
|---|---|
report
|
The Report or report ID to update.
TYPE:
|
update
|
The updates to apply.
TYPE:
|
wait_until_complete
async
¶
wait_until_complete(
*,
report: Report | str | None = None,
job: Job | str | None = None,
polling_interval_secs: int = 5,
timeout_secs: int | None = None,
) -> Report
Wait until the report is complete or the timeout is reached.
Polls the report job status at the given interval until the job is FINISHED, FAILED, or CANCELLED, returning the completed Report.
Either a report or job must be provided. The job must be a rule evaluation job.
| PARAMETER | DESCRIPTION |
|---|---|
report
|
The Report or report ID to wait for.
TYPE:
|
job
|
The pending rule evaluation Job or job ID to wait for.
TYPE:
|
polling_interval_secs
|
Seconds between status polls. Defaults to 5s.
TYPE:
|
timeout_secs
|
Maximum seconds to wait. If None, polls indefinitely. Defaults to None (indefinite).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Report
|
The Report in the completed state. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If both or neither report and job are provided, or if job is not a rule evaluation job. |