sift_client.resources.reports
¶
| CLASS | DESCRIPTION |
|---|---|
ReportsAPIAsync |
High-level API for interacting with reports. |
ReportTemplatesAPIAsync |
High-level API for interacting with report templates. |
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 |
|---|---|
get |
Get a Report. |
list_ |
List reports with optional filtering. |
find |
Find a single report matching the given query. Takes the same arguments as |
create_from_template |
Create a new report from a report template. |
create_from_rules |
Create a new report from rules. |
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. |
rerun |
Rerun a report. |
cancel |
Cancel a report. |
update |
Update a report. |
archive |
Archive a report. |
unarchive |
Unarchive a report. |
wait_until_complete |
Wait until the report is complete or the timeout is reached. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
templates |
Nested Report Templates API. See
TYPE:
|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
templates
instance-attribute
¶
templates: ReportTemplatesAPIAsync = (
ReportTemplatesAPIAsync(sift_client)
)
Nested Report Templates API. See ReportTemplatesAPIAsync.
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,
page_size: 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:
|
page_size
|
Number of results to fetch per request. Lower this if you hit gRPC message size limits on responses. If None, uses the server default.
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. |
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. |
create_from_template
async
¶
create_from_template(
*,
report_template: ReportTemplate | str,
run: Run | str,
organization_id: str | None = None,
name: str | None = None,
) -> Job | None
Create a new report from a report template.
| PARAMETER | DESCRIPTION |
|---|---|
report_template
|
The ReportTemplate or report template ID to use.
TYPE:
|
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:
|
| 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],
start_time: datetime | None = None,
end_time: datetime | None = None,
) -> 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:
|
start_time
|
Start of the time range to evaluate rules over. Ignored unless end_time is also set and a run is provided.
TYPE:
|
end_time
|
End of the time range to evaluate rules over. Ignored unless start_time is also set and a run is provided.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Job | None
|
The Job for the pending report, or None if no report was created. |
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
|
Start of the time range to evaluate rules over. Ignored unless end_time is also set and a run is provided.
TYPE:
|
end_time
|
End of the time range to evaluate rules over. Ignored unless start_time is also set and a run is provided.
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. |
rerun
async
¶
cancel
async
¶
cancel(*, report: str | Report) -> None
Cancel a report.
| PARAMETER | DESCRIPTION |
|---|---|
report
|
The Report or report ID to cancel.
TYPE:
|
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. |
ReportTemplatesAPIAsync
¶
ReportTemplatesAPIAsync(sift_client: SiftClient)
Bases: ResourceBase
High-level API for interacting with report templates.
Accessed as a nested resource of the Reports API via client.reports.templates.
Initialize the ReportTemplatesAPI.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
get |
Get a ReportTemplate. |
list_ |
List report templates with optional filtering. |
find |
Find a single report template matching the given query. Takes the same arguments as |
create |
Create a new report template. |
update |
Update a report template. |
archive |
Archive a report template. |
unarchive |
Unarchive a report template. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
client |
TYPE:
|
grpc_client |
TYPE:
|
rest_client |
TYPE:
|
get
async
¶
get(
*,
report_template_id: str | None = None,
client_key: str | None = None,
organization_id: str | None = None,
) -> ReportTemplate
Get a ReportTemplate.
| PARAMETER | DESCRIPTION |
|---|---|
report_template_id
|
The ID of the report template.
TYPE:
|
client_key
|
The client key of the report template.
TYPE:
|
organization_id
|
The organization ID. Only required when getting by client_key and the user belongs to multiple organizations.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ReportTemplate
|
The ReportTemplate. |
list_
async
¶
list_(
*,
name: str | None = None,
name_contains: str | None = None,
name_regex: str | Pattern | None = None,
names: list[str] | None = None,
report_template_ids: list[str] | None = None,
client_keys: list[str] | None = None,
organization_id: str | None = None,
metadata: dict[str, str | float | bool] | None = None,
tag_names: list[str] | list[Tag] | None = None,
include_archived: bool = False,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
page_size: int | None = None,
) -> list[ReportTemplate]
List report templates with optional filtering.
The report template service only supports filtering on the fields below; time and user based filters are not available for this resource.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Exact name of the report template.
TYPE:
|
name_contains
|
Partial name of the report template.
TYPE:
|
name_regex
|
Regular expression string to filter report templates by name.
TYPE:
|
names
|
List of report template names to filter by.
TYPE:
|
report_template_ids
|
List of report template IDs to filter by.
TYPE:
|
client_keys
|
List of report template client keys to filter by.
TYPE:
|
organization_id
|
Organization ID to filter by.
TYPE:
|
metadata
|
Metadata to filter by.
TYPE:
|
tag_names
|
List of tags or tag names to filter by.
TYPE:
|
include_archived
|
Whether to include archived report templates.
TYPE:
|
filter_query
|
Explicit CEL query to filter report templates.
TYPE:
|
order_by
|
How to order the retrieved report templates.
TYPE:
|
limit
|
How many report templates to retrieve. If None, retrieves all matches.
TYPE:
|
page_size
|
Number of results to fetch per request. Lower this if you hit gRPC message size limits on responses. If None, uses the server default.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[ReportTemplate]
|
A list of ReportTemplates that matches the filter. |
find
async
¶
find(**kwargs) -> ReportTemplate | None
Find a single report template matching the given query. Takes the same arguments as list.
If more than one report template is found, raises an error.
| PARAMETER | DESCRIPTION |
|---|---|
**kwargs
|
Keyword arguments to pass to
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
ReportTemplate | None
|
The ReportTemplate found or None. |
create
async
¶
create(
create: ReportTemplateCreate | dict,
) -> ReportTemplate
Create a new report template.
| PARAMETER | DESCRIPTION |
|---|---|
create
|
A ReportTemplateCreate object or a dictionary with configuration for the new report template.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ReportTemplate
|
The created ReportTemplate. |
update
async
¶
update(
report_template: ReportTemplate | str,
update: ReportTemplateUpdate | dict,
) -> ReportTemplate
Update a report template.
| PARAMETER | DESCRIPTION |
|---|---|
report_template
|
The ReportTemplate or report template ID to update.
TYPE:
|
update
|
The updates to apply.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ReportTemplate
|
The updated ReportTemplate. |
archive
async
¶
archive(
*, report_template: ReportTemplate | str
) -> ReportTemplate
Archive a report template.
unarchive
async
¶
unarchive(
*, report_template: ReportTemplate | str
) -> ReportTemplate
Unarchive a report template.