Skip to content

Commit ab00567

Browse files
committed
linting
1 parent 9ecd908 commit ab00567

File tree

6 files changed

+45
-158
lines changed

6 files changed

+45
-158
lines changed

detect/v1alpha/bulk_update_alerts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@
117117
args.comment,
118118
args.root_cause,
119119
)
120-
print(json.dumps(a_list, indent=2))
120+
print(json.dumps(a_list, indent=2))

detect/v1alpha/get_retrohunt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ def get_retrohunt(
8787
"""
8888
base_url_with_region = regions.url_always_prepend_region(
8989
CHRONICLE_API_BASE_URL, proj_region)
90+
# pylint: disable=line-too-long
9091
parent = f"projects/{proj_id}/locations/{proj_region}/instances/{proj_instance}"
9192
url = f"{base_url_with_region}/v1alpha/{parent}/rules/{rule_id}/retrohunts/{op_id}"
93+
# pylint: enable=line-too-long
9294

9395
response = http_session.request("GET", url)
9496
if response.status_code >= 400:

detect/v1alpha/get_rule.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,30 @@ def get_rule(
4848
) -> Mapping[str, Any]:
4949
"""Gets a rule using the Get Rule API.
5050
51-
Args:
52-
http_session: Authorized session for HTTP requests.
53-
proj_id: GCP project id or number to which the target instance belongs.
54-
proj_instance: Customer ID (uuid with dashes) for the Chronicle instance.
55-
proj_region: Region where the target project is located.
56-
rule_id: Unique ID of the detection rule to retrieve ("ru_<UUID>" or
57-
"ru_<UUID>@v_<seconds>_<nanoseconds>"). If a version suffix isn't
58-
specified we use the rule's latest version.
59-
60-
Returns:
61-
Dictionary containing the rule's information.
62-
63-
Raises:
64-
requests.exceptions.HTTPError: HTTP request resulted in an error
65-
(response.status_code >= 400).
66-
67-
Requires the following IAM permission on the parent resource:
68-
chronicle.rules.get
69-
"""
51+
Args:
52+
http_session: Authorized session for HTTP requests.
53+
proj_id: GCP project id or number to which the target instance belongs.
54+
proj_instance: Customer ID (uuid w/ dashes) for the Chronicle instance.
55+
proj_region: Region where the target project is located.
56+
rule_id: Unique ID of the detection rule to retrieve ("ru_<UUID>" or
57+
"ru_<UUID>@v_<seconds>_<nanoseconds>"). If a version suffix isn't
58+
specified we use the rule's latest version.
59+
60+
Returns:
61+
Dictionary containing the rule's information.
62+
63+
Raises:
64+
requests.exceptions.HTTPError: HTTP request resulted in an error
65+
(response.status_code >= 400).
66+
67+
Requires the following IAM permission on the parent resource:
68+
chronicle.rules.get
69+
"""
7070
base_url_with_region = regions.url_always_prepend_region(
7171
CHRONICLE_API_BASE_URL, proj_region)
72-
# pylint: disable=line-too-long
72+
# pylint: disable=line-too-long-next
7373
parent = f"projects/{proj_id}/locations/{proj_region}/instances/{proj_instance}"
7474
url = f"{base_url_with_region}/v1alpha/{parent}/rules/{rule_id}"
75-
# pylint: enable=line-too-lon
7675

7776
response = http_session.request("GET", url)
7877
if response.status_code >= 400:

iocs/v1alpha/get_ioc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""Get a single IoC from Chronicle."""
1717

1818
from common import regions
19+
from typing import Any, Mapping
1920
from google.auth.transport import requests
2021

2122
CHRONICLE_API_BASE_URL = "https://chronicle.googleapis.com"

search/v1alpha/asset_events_find.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,27 @@ def find_asset_events(http_session: requests.AuthorizedSession,
5353
max_results: Optional[int] = None) -> None:
5454
"""Find asset events in Chronicle using the Legacy Find Asset Events API.
5555
56-
Args:
57-
http_session: Authorized session for HTTP requests.
58-
proj_id: GCP project id or number to which the target instance belongs.
59-
proj_instance: Customer ID (uuid with dashes) for the instance.
60-
proj_region: region in which the target project is located.
61-
asset_indicator: JSON str containing the asset indicator to search for.
62-
start_time: Start time in RFC3339 format (e.g., "2024-01-01T00:00:00Z").
63-
end_time: End time in RFC3339 format (e.g., "2024-01-02T00:00:00Z").
64-
reference_time: Optional reference time in RFC3339 format for
65-
asset aliasing.
66-
max_results: Optional maximum number of results to return
67-
(default: 10000, max: 250000).
68-
69-
Raises:
70-
requests.exceptions.HTTPError: HTTP request resulted in an error
71-
(response.status_code >= 400).
72-
ValueError: If the time format is invalid.
73-
74-
Requires the following IAM permission on the instance resource:
75-
chronicle.legacies.legacyFindAssetEvents
76-
"""
56+
Args:
57+
http_session: Authorized session for HTTP requests.
58+
proj_id: GCP project id or number to which the target instance belongs.
59+
proj_instance: Customer ID (uuid with dashes) for the instance.
60+
proj_region: region in which the target project is located.
61+
asset_indicator: JSON str containing the asset indicator to search for.
62+
start_time: Start time in RFC3339 format (e.g., "2024-01-01T00:00:00Z").
63+
end_time: End time in RFC3339 format (e.g., "2024-01-02T00:00:00Z").
64+
reference_time: Optional reference time in RFC3339 format for
65+
asset aliasing.
66+
max_results: Optional maximum number of results to return
67+
(default: 10000, max: 250000).
68+
69+
Raises:
70+
requests.exceptions.HTTPError: HTTP request resulted in an error
71+
(response.status_code >= 400).
72+
ValueError: If the time format is invalid.
73+
74+
Requires the following IAM permission on the instance resource:
75+
chronicle.legacies.legacyFindAssetEvents
76+
"""
7777
# Validate and parse the times to ensure they're in RFC3339 format
7878
for time_str in [start_time, end_time, reference_time
7979
] if reference_time else [start_time, end_time]:

search/v1alpha/server.py

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)