scanner-client 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scanner_client/__init__.py +77 -0
- scanner_client/_raw_api/__init__.py +8 -0
- scanner_client/_raw_api/api/__init__.py +1 -0
- scanner_client/_raw_api/api/detection_rule/__init__.py +1 -0
- scanner_client/_raw_api/api/detection_rule/create_detection_rule.py +172 -0
- scanner_client/_raw_api/api/detection_rule/delete_detection_rule.py +155 -0
- scanner_client/_raw_api/api/detection_rule/get_detection_rule.py +155 -0
- scanner_client/_raw_api/api/detection_rule/get_detection_rule_by_sync_key.py +166 -0
- scanner_client/_raw_api/api/detection_rule/list_detection_rules.py +162 -0
- scanner_client/_raw_api/api/detection_rule/update_detection_rule.py +177 -0
- scanner_client/_raw_api/api/detection_rule_yaml/__init__.py +1 -0
- scanner_client/_raw_api/api/detection_rule_yaml/run_detection_rule_yaml_tests.py +159 -0
- scanner_client/_raw_api/api/detection_rule_yaml/upsert_detection_rule_from_yaml_by_push_key.py +184 -0
- scanner_client/_raw_api/api/detection_rule_yaml/validate_detection_rule_yaml.py +159 -0
- scanner_client/_raw_api/api/event_sink/__init__.py +1 -0
- scanner_client/_raw_api/api/event_sink/create_event_sink.py +160 -0
- scanner_client/_raw_api/api/event_sink/delete_event_sink.py +155 -0
- scanner_client/_raw_api/api/event_sink/get_event_sink.py +155 -0
- scanner_client/_raw_api/api/event_sink/list_event_sinks.py +162 -0
- scanner_client/_raw_api/api/event_sink/update_event_sink.py +177 -0
- scanner_client/_raw_api/api/github_repo_sync_source/__init__.py +1 -0
- scanner_client/_raw_api/api/github_repo_sync_source/sync_github_repositories.py +156 -0
- scanner_client/_raw_api/api/github_repo_sync_source/upload_git_repo_zipball.py +225 -0
- scanner_client/_raw_api/api/lookup_table_file/__init__.py +1 -0
- scanner_client/_raw_api/api/lookup_table_file/create_lookup_table_file.py +172 -0
- scanner_client/_raw_api/api/lookup_table_file/delete_lookup_table_file.py +155 -0
- scanner_client/_raw_api/api/lookup_table_file/get_lookup_table_file.py +155 -0
- scanner_client/_raw_api/api/lookup_table_file/list_lookup_table_files.py +157 -0
- scanner_client/_raw_api/api/lookup_table_file/update_lookup_table_file.py +172 -0
- scanner_client/_raw_api/api/query/__init__.py +1 -0
- scanner_client/_raw_api/api/query/cancel_query.py +98 -0
- scanner_client/_raw_api/api/query/query_progress.py +178 -0
- scanner_client/_raw_api/api/query/start_blocking_query.py +176 -0
- scanner_client/_raw_api/api/query/start_query.py +172 -0
- scanner_client/_raw_api/client.py +268 -0
- scanner_client/_raw_api/errors.py +16 -0
- scanner_client/_raw_api/models/__init__.py +347 -0
- scanner_client/_raw_api/models/ad_hoc_query_progress_metadata.py +61 -0
- scanner_client/_raw_api/models/ad_hoc_query_progress_request_data.py +61 -0
- scanner_client/_raw_api/models/ad_hoc_query_progress_response.py +120 -0
- scanner_client/_raw_api/models/ad_hoc_row_item.py +95 -0
- scanner_client/_raw_api/models/ad_hoc_row_item_columns.py +59 -0
- scanner_client/_raw_api/models/ad_hoc_table_result.py +127 -0
- scanner_client/_raw_api/models/ad_hoc_table_result_column_tags.py +53 -0
- scanner_client/_raw_api/models/attached_sync_source_info_type_0.py +50 -0
- scanner_client/_raw_api/models/attached_sync_source_info_type_1.py +50 -0
- scanner_client/_raw_api/models/create_detection_rule_request_data.py +493 -0
- scanner_client/_raw_api/models/create_event_sink_args_type_0.py +48 -0
- scanner_client/_raw_api/models/create_event_sink_args_type_1.py +48 -0
- scanner_client/_raw_api/models/create_event_sink_args_type_2.py +48 -0
- scanner_client/_raw_api/models/create_event_sink_request_data.py +130 -0
- scanner_client/_raw_api/models/create_lookup_table_file_request_data.py +122 -0
- scanner_client/_raw_api/models/create_slack_event_sink_args.py +104 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_detection_rule_api_handler_type_0.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_detection_rule_api_handler_type_1.py +52 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_detection_rule_api_handler_type_2.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_detection_rule_api_handler_type_3.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_detection_rule_api_handler_type_4.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_detection_rule_api_handler_type_5.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_detection_rule_api_handler_type_6.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_detection_rule_api_handler_type_7.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_event_sink_api_handler_type_0.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_event_sink_api_handler_type_1.py +52 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_event_sink_api_handler_type_2.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_event_sink_api_handler_type_3.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_event_sink_api_handler_type_4.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_event_sink_api_handler_type_5.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_event_sink_api_handler_type_6.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_event_sink_api_handler_type_7.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_lookup_table_file_api_handler_type_0.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_lookup_table_file_api_handler_type_1.py +52 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_lookup_table_file_api_handler_type_2.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_lookup_table_file_api_handler_type_3.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_lookup_table_file_api_handler_type_4.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_lookup_table_file_api_handler_type_5.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_lookup_table_file_api_handler_type_6.py +48 -0
- scanner_client/_raw_api/models/crud_api_request_and_response_data_for_lookup_table_file_api_handler_type_7.py +48 -0
- scanner_client/_raw_api/models/delete_detection_rule_request_data.py +62 -0
- scanner_client/_raw_api/models/delete_detection_rule_response_data.py +70 -0
- scanner_client/_raw_api/models/delete_event_sink_request_data.py +62 -0
- scanner_client/_raw_api/models/delete_event_sink_response_data.py +70 -0
- scanner_client/_raw_api/models/delete_lookup_table_file_request_data.py +62 -0
- scanner_client/_raw_api/models/delete_lookup_table_file_response_data.py +70 -0
- scanner_client/_raw_api/models/detection_alert_template.py +103 -0
- scanner_client/_raw_api/models/detection_rule.py +554 -0
- scanner_client/_raw_api/models/detection_rule_sort_order.py +8 -0
- scanner_client/_raw_api/models/detection_rule_state.py +10 -0
- scanner_client/_raw_api/models/detection_rule_summary.py +538 -0
- scanner_client/_raw_api/models/detection_rule_sync_status.py +12 -0
- scanner_client/_raw_api/models/detection_severity_type_0.py +8 -0
- scanner_client/_raw_api/models/detection_severity_type_1.py +8 -0
- scanner_client/_raw_api/models/detection_severity_type_2.py +8 -0
- scanner_client/_raw_api/models/detection_severity_type_3.py +8 -0
- scanner_client/_raw_api/models/detection_severity_type_4.py +8 -0
- scanner_client/_raw_api/models/detection_severity_type_5.py +8 -0
- scanner_client/_raw_api/models/detection_severity_type_6.py +8 -0
- scanner_client/_raw_api/models/detection_severity_type_7.py +8 -0
- scanner_client/_raw_api/models/event_sink.py +222 -0
- scanner_client/_raw_api/models/event_sink_configuration_type_0.py +42 -0
- scanner_client/_raw_api/models/event_sink_configuration_type_1.py +48 -0
- scanner_client/_raw_api/models/event_sink_configuration_type_2.py +48 -0
- scanner_client/_raw_api/models/event_sink_configuration_type_3.py +48 -0
- scanner_client/_raw_api/models/event_sink_type.py +11 -0
- scanner_client/_raw_api/models/geoip_source.py +8 -0
- scanner_client/_raw_api/models/get_detection_rule_by_sync_key_request_data.py +61 -0
- scanner_client/_raw_api/models/get_detection_rule_request_data.py +62 -0
- scanner_client/_raw_api/models/get_detection_rule_response_data.py +67 -0
- scanner_client/_raw_api/models/get_detection_rule_summary_response_data.py +67 -0
- scanner_client/_raw_api/models/get_event_sink_request_data.py +62 -0
- scanner_client/_raw_api/models/get_event_sink_response_data.py +67 -0
- scanner_client/_raw_api/models/get_lookup_table_file_request_data.py +62 -0
- scanner_client/_raw_api/models/get_lookup_table_file_response_data.py +67 -0
- scanner_client/_raw_api/models/indicator_type_type_0.py +8 -0
- scanner_client/_raw_api/models/indicator_type_type_1.py +8 -0
- scanner_client/_raw_api/models/indicator_type_type_2.py +8 -0
- scanner_client/_raw_api/models/indicator_type_type_3.py +8 -0
- scanner_client/_raw_api/models/indicator_type_type_4.py +8 -0
- scanner_client/_raw_api/models/indicator_type_type_5.py +8 -0
- scanner_client/_raw_api/models/indicator_type_type_6.py +8 -0
- scanner_client/_raw_api/models/indicator_type_type_7.py +8 -0
- scanner_client/_raw_api/models/ipinfo_variant.py +8 -0
- scanner_client/_raw_api/models/list_detection_rules_request_data.py +133 -0
- scanner_client/_raw_api/models/list_detection_rules_response_data.py +75 -0
- scanner_client/_raw_api/models/list_event_sinks_request_data.py +62 -0
- scanner_client/_raw_api/models/list_event_sinks_response_data.py +75 -0
- scanner_client/_raw_api/models/list_lookup_table_files_request_data.py +62 -0
- scanner_client/_raw_api/models/list_lookup_table_files_response_data.py +75 -0
- scanner_client/_raw_api/models/list_response_with_pagination_for_list_detection_rules_response_data.py +103 -0
- scanner_client/_raw_api/models/list_response_with_pagination_for_list_event_sinks_response_data.py +103 -0
- scanner_client/_raw_api/models/list_response_with_pagination_for_list_lookup_table_files_response_data.py +103 -0
- scanner_client/_raw_api/models/log_event_id_json.py +69 -0
- scanner_client/_raw_api/models/lookup_table_file.py +247 -0
- scanner_client/_raw_api/models/lookup_table_file_dependency.py +77 -0
- scanner_client/_raw_api/models/lookup_table_file_format.py +9 -0
- scanner_client/_raw_api/models/lookup_table_file_summary.py +196 -0
- scanner_client/_raw_api/models/lookup_table_file_sync_info.py +63 -0
- scanner_client/_raw_api/models/pager_duty_args.py +61 -0
- scanner_client/_raw_api/models/pagination_metadata.py +74 -0
- scanner_client/_raw_api/models/pagination_parameters.py +94 -0
- scanner_client/_raw_api/models/pending_lookup_table_file_creation_info.py +70 -0
- scanner_client/_raw_api/models/perms_by_role_for_rbac_detection_rule_permission_type.py +74 -0
- scanner_client/_raw_api/models/perms_by_role_for_rbac_detection_rule_permission_type_permissions_by_role.py +65 -0
- scanner_client/_raw_api/models/query_execution_mode.py +9 -0
- scanner_client/_raw_api/models/rbac_detection_rule_permission_type.py +11 -0
- scanner_client/_raw_api/models/run_detection_rule_yaml_tests_request_data.py +61 -0
- scanner_client/_raw_api/models/run_detection_rule_yaml_tests_response_data.py +71 -0
- scanner_client/_raw_api/models/run_detection_rule_yaml_tests_response_data_results.py +55 -0
- scanner_client/_raw_api/models/slack_event_sink_configuration.py +69 -0
- scanner_client/_raw_api/models/source_indicator_type.py +188 -0
- scanner_client/_raw_api/models/source_variant.py +77 -0
- scanner_client/_raw_api/models/start_ad_hoc_query_request_data.py +230 -0
- scanner_client/_raw_api/models/start_ad_hoc_query_response.py +62 -0
- scanner_client/_raw_api/models/sync_github_repos_request_data.py +62 -0
- scanner_client/_raw_api/models/sync_github_repos_response_data.py +62 -0
- scanner_client/_raw_api/models/table_ui_state_type.py +10 -0
- scanner_client/_raw_api/models/template_entry.py +69 -0
- scanner_client/_raw_api/models/template_entry_with_dedup.py +80 -0
- scanner_client/_raw_api/models/test_result.py +9 -0
- scanner_client/_raw_api/models/threat_intel_source.py +8 -0
- scanner_client/_raw_api/models/tines_configuration.py +69 -0
- scanner_client/_raw_api/models/update_detection_rule_request_data.py +664 -0
- scanner_client/_raw_api/models/update_event_sink_args_type_0.py +48 -0
- scanner_client/_raw_api/models/update_event_sink_args_type_1.py +48 -0
- scanner_client/_raw_api/models/update_event_sink_args_type_2.py +48 -0
- scanner_client/_raw_api/models/update_event_sink_request_data.py +169 -0
- scanner_client/_raw_api/models/update_lookup_table_file_request_data.py +90 -0
- scanner_client/_raw_api/models/update_slack_event_sink_args.py +93 -0
- scanner_client/_raw_api/models/upload_git_repo_zipball_failure.py +93 -0
- scanner_client/_raw_api/models/upload_git_repo_zipball_request_data.py +81 -0
- scanner_client/_raw_api/models/upload_git_repo_zipball_response_data.py +111 -0
- scanner_client/_raw_api/models/upload_git_repo_zipball_warning.py +78 -0
- scanner_client/_raw_api/models/upsert_detection_rule_from_yaml_request_data.py +72 -0
- scanner_client/_raw_api/models/upsert_detection_rule_from_yaml_response_data.py +76 -0
- scanner_client/_raw_api/models/validate_detection_rule_yaml_request_data.py +61 -0
- scanner_client/_raw_api/models/validate_detection_rule_yaml_response_data.py +103 -0
- scanner_client/_raw_api/models/webhook_args.py +103 -0
- scanner_client/_raw_api/models/webhook_args_headers.py +46 -0
- scanner_client/_raw_api/models/webhook_configuration.py +104 -0
- scanner_client/_raw_api/models/webhook_configuration_headers.py +46 -0
- scanner_client/_raw_api/models/webhook_type.py +9 -0
- scanner_client/_raw_api/py.typed +1 -0
- scanner_client/_raw_api/types.py +54 -0
- scanner_client/detection_rule.py +385 -0
- scanner_client/detection_rule_yaml.py +117 -0
- scanner_client/event_sink.py +229 -0
- scanner_client/example.py +59 -0
- scanner_client/github_sync.py +101 -0
- scanner_client/http_err.py +27 -0
- scanner_client/py.typed +0 -0
- scanner_client/query.py +230 -0
- scanner_client/scanner.py +82 -0
- scanner_client-0.1.0.dist-info/METADATA +145 -0
- scanner_client-0.1.0.dist-info/RECORD +196 -0
- scanner_client-0.1.0.dist-info/WHEEL +4 -0
- scanner_client-0.1.0.dist-info/entry_points.txt +3 -0
- scanner_client-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# "X as X" marks each name as an explicit re-export (PEP 484) so type checkers
|
|
2
|
+
# treat it as part of this module's public API.
|
|
3
|
+
#
|
|
4
|
+
# For renamed re-exports, we import under a private name and declare a TypeAlias,
|
|
5
|
+
# which also creates an explicit public module-level binding.
|
|
6
|
+
# TODO: switch renamed re-exports to `type X = Y` syntax once we target Python 3.12+.
|
|
7
|
+
from typing import TypeAlias
|
|
8
|
+
|
|
9
|
+
from .scanner import Scanner as Scanner, AsyncScanner as AsyncScanner
|
|
10
|
+
from .detection_rule import string_to_detection_severity as string_to_detection_severity, \
|
|
11
|
+
pagination_parameters as pagination_parameters, \
|
|
12
|
+
starting_permissions_for_detection_rule as starting_permissions_for_detection_rule, \
|
|
13
|
+
DetectionSeverity as DetectionSeverity
|
|
14
|
+
from .event_sink import create_pagerduty_event_sink_args as create_pagerduty_event_sink_args, \
|
|
15
|
+
create_slack_event_sink_args as create_slack_event_sink_args, \
|
|
16
|
+
create_webhook_event_sink_args as create_webhook_event_sink_args, \
|
|
17
|
+
update_pagerduty_event_sink_args as update_pagerduty_event_sink_args, \
|
|
18
|
+
update_slack_event_sink_args as update_slack_event_sink_args, \
|
|
19
|
+
update_webhook_event_sink_args as update_webhook_event_sink_args
|
|
20
|
+
from .http_err import NotFound as NotFound
|
|
21
|
+
|
|
22
|
+
# Detection rule types
|
|
23
|
+
from ._raw_api.models import (
|
|
24
|
+
DeleteDetectionRuleResponseData as DeleteDetectionRuleResponseData,
|
|
25
|
+
DetectionAlertTemplate as DetectionAlertTemplate,
|
|
26
|
+
DetectionRule as _DetectionRule,
|
|
27
|
+
DetectionRuleSortOrder as DetectionRuleSortOrder,
|
|
28
|
+
DetectionRuleSummary as DetectionRuleSummary,
|
|
29
|
+
ListDetectionRulesResponseData as ListDetectionRulesResponseData,
|
|
30
|
+
ListResponseWithPaginationForListDetectionRulesResponseData as ListResponseWithPaginationForListDetectionRulesResponseData,
|
|
31
|
+
PaginationMetadata as PaginationMetadata,
|
|
32
|
+
PaginationParameters as PaginationParameters,
|
|
33
|
+
RbacDetectionRulePermissionType as RbacDetectionRulePermissionType,
|
|
34
|
+
TemplateEntry as TemplateEntry,
|
|
35
|
+
)
|
|
36
|
+
DetectionRuleJson: TypeAlias = _DetectionRule
|
|
37
|
+
|
|
38
|
+
# Detection rule YAML types
|
|
39
|
+
from ._raw_api.models import (
|
|
40
|
+
TestResult as _TestResult,
|
|
41
|
+
RunDetectionRuleYamlTestsResponseData as RunDetectionRuleYamlTestsResponseData,
|
|
42
|
+
RunDetectionRuleYamlTestsResponseDataResults as RunDetectionRuleYamlTestsResponseDataResults,
|
|
43
|
+
ValidateDetectionRuleYamlResponseData as ValidateDetectionRuleYamlResponseData,
|
|
44
|
+
)
|
|
45
|
+
DetectionRuleYamlTestResult: TypeAlias = _TestResult
|
|
46
|
+
|
|
47
|
+
# Event sink types
|
|
48
|
+
from ._raw_api.models import (
|
|
49
|
+
DeleteEventSinkResponseData as DeleteEventSinkResponseData,
|
|
50
|
+
EventSink as _EventSink,
|
|
51
|
+
EventSinkType as EventSinkType,
|
|
52
|
+
)
|
|
53
|
+
EventSinkJson: TypeAlias = _EventSink
|
|
54
|
+
|
|
55
|
+
# Adhoc query types
|
|
56
|
+
from ._raw_api.models import (
|
|
57
|
+
AdHocQueryProgressMetadata as AdHocQueryProgressMetadata,
|
|
58
|
+
AdHocQueryProgressResponse as AdHocQueryProgressResponse,
|
|
59
|
+
AdHocRowItem as AdHocRowItem,
|
|
60
|
+
AdHocTableResult as AdHocTableResult,
|
|
61
|
+
LogEventIdJson as _LogEventIdJson,
|
|
62
|
+
StartAdHocQueryResponse as StartAdHocQueryResponse,
|
|
63
|
+
TableUiStateType as TableUiStateType,
|
|
64
|
+
)
|
|
65
|
+
LogEventId: TypeAlias = _LogEventIdJson
|
|
66
|
+
|
|
67
|
+
# GitHub sync types
|
|
68
|
+
from ._raw_api.models import (
|
|
69
|
+
DetectionRuleSyncStatus as DetectionRuleSyncStatus,
|
|
70
|
+
SyncGithubReposResponseData as SyncGithubReposResponseData,
|
|
71
|
+
UploadGitRepoZipballFailure as UploadGitRepoZipballFailure,
|
|
72
|
+
UploadGitRepoZipballResponseData as UploadGitRepoZipballResponseData,
|
|
73
|
+
UploadGitRepoZipballWarning as UploadGitRepoZipballWarning,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# Misc types
|
|
77
|
+
from ._raw_api.types import Unset as Unset, UNSET as UNSET
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.create_detection_rule_request_data import CreateDetectionRuleRequestData
|
|
9
|
+
from ...models.get_detection_rule_response_data import GetDetectionRuleResponseData
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
body: CreateDetectionRuleRequestData,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
headers: dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "post",
|
|
21
|
+
"url": "/v1/detection_rule",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_kwargs["json"] = body.to_dict()
|
|
25
|
+
|
|
26
|
+
headers["Content-Type"] = "application/json"
|
|
27
|
+
|
|
28
|
+
_kwargs["headers"] = headers
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(
|
|
33
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
34
|
+
) -> GetDetectionRuleResponseData | None:
|
|
35
|
+
if response.status_code == 200:
|
|
36
|
+
response_200 = GetDetectionRuleResponseData.from_dict(response.json())
|
|
37
|
+
|
|
38
|
+
return response_200
|
|
39
|
+
|
|
40
|
+
if client.raise_on_unexpected_status:
|
|
41
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
42
|
+
else:
|
|
43
|
+
return None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _build_response(
|
|
47
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
48
|
+
) -> Response[GetDetectionRuleResponseData]:
|
|
49
|
+
return Response(
|
|
50
|
+
status_code=HTTPStatus(response.status_code),
|
|
51
|
+
content=response.content,
|
|
52
|
+
headers=response.headers,
|
|
53
|
+
parsed=_parse_response(client=client, response=response),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def sync_detailed(
|
|
58
|
+
*,
|
|
59
|
+
client: AuthenticatedClient,
|
|
60
|
+
body: CreateDetectionRuleRequestData,
|
|
61
|
+
) -> Response[GetDetectionRuleResponseData]:
|
|
62
|
+
"""Create a new detection rule with the specified data.
|
|
63
|
+
|
|
64
|
+
If the detection rule is active, it will be immediately scheduled for
|
|
65
|
+
backfill and execution.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
body (CreateDetectionRuleRequestData):
|
|
69
|
+
|
|
70
|
+
Raises:
|
|
71
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
72
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Response[GetDetectionRuleResponseData]
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
kwargs = _get_kwargs(
|
|
79
|
+
body=body,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
response = client.get_httpx_client().request(
|
|
83
|
+
**kwargs,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return _build_response(client=client, response=response)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def sync(
|
|
90
|
+
*,
|
|
91
|
+
client: AuthenticatedClient,
|
|
92
|
+
body: CreateDetectionRuleRequestData,
|
|
93
|
+
) -> GetDetectionRuleResponseData | None:
|
|
94
|
+
"""Create a new detection rule with the specified data.
|
|
95
|
+
|
|
96
|
+
If the detection rule is active, it will be immediately scheduled for
|
|
97
|
+
backfill and execution.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
body (CreateDetectionRuleRequestData):
|
|
101
|
+
|
|
102
|
+
Raises:
|
|
103
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
104
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
GetDetectionRuleResponseData
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
return sync_detailed(
|
|
111
|
+
client=client,
|
|
112
|
+
body=body,
|
|
113
|
+
).parsed
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
async def asyncio_detailed(
|
|
117
|
+
*,
|
|
118
|
+
client: AuthenticatedClient,
|
|
119
|
+
body: CreateDetectionRuleRequestData,
|
|
120
|
+
) -> Response[GetDetectionRuleResponseData]:
|
|
121
|
+
"""Create a new detection rule with the specified data.
|
|
122
|
+
|
|
123
|
+
If the detection rule is active, it will be immediately scheduled for
|
|
124
|
+
backfill and execution.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
body (CreateDetectionRuleRequestData):
|
|
128
|
+
|
|
129
|
+
Raises:
|
|
130
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
131
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
Response[GetDetectionRuleResponseData]
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
kwargs = _get_kwargs(
|
|
138
|
+
body=body,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
142
|
+
|
|
143
|
+
return _build_response(client=client, response=response)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
async def asyncio(
|
|
147
|
+
*,
|
|
148
|
+
client: AuthenticatedClient,
|
|
149
|
+
body: CreateDetectionRuleRequestData,
|
|
150
|
+
) -> GetDetectionRuleResponseData | None:
|
|
151
|
+
"""Create a new detection rule with the specified data.
|
|
152
|
+
|
|
153
|
+
If the detection rule is active, it will be immediately scheduled for
|
|
154
|
+
backfill and execution.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
body (CreateDetectionRuleRequestData):
|
|
158
|
+
|
|
159
|
+
Raises:
|
|
160
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
161
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
GetDetectionRuleResponseData
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
await asyncio_detailed(
|
|
169
|
+
client=client,
|
|
170
|
+
body=body,
|
|
171
|
+
)
|
|
172
|
+
).parsed
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
from ... import errors
|
|
9
|
+
from ...client import AuthenticatedClient, Client
|
|
10
|
+
from ...models.delete_detection_rule_response_data import DeleteDetectionRuleResponseData
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
id: UUID,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
_kwargs: dict[str, Any] = {
|
|
18
|
+
"method": "delete",
|
|
19
|
+
"url": "/v1/detection_rule/{id}".format(
|
|
20
|
+
id=quote(str(id), safe=""),
|
|
21
|
+
),
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return _kwargs
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _parse_response(
|
|
28
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
29
|
+
) -> DeleteDetectionRuleResponseData | None:
|
|
30
|
+
if response.status_code == 200:
|
|
31
|
+
response_200 = DeleteDetectionRuleResponseData.from_dict(response.json())
|
|
32
|
+
|
|
33
|
+
return response_200
|
|
34
|
+
|
|
35
|
+
if client.raise_on_unexpected_status:
|
|
36
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
37
|
+
else:
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _build_response(
|
|
42
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
43
|
+
) -> Response[DeleteDetectionRuleResponseData]:
|
|
44
|
+
return Response(
|
|
45
|
+
status_code=HTTPStatus(response.status_code),
|
|
46
|
+
content=response.content,
|
|
47
|
+
headers=response.headers,
|
|
48
|
+
parsed=_parse_response(client=client, response=response),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def sync_detailed(
|
|
53
|
+
id: UUID,
|
|
54
|
+
*,
|
|
55
|
+
client: AuthenticatedClient,
|
|
56
|
+
) -> Response[DeleteDetectionRuleResponseData]:
|
|
57
|
+
"""Delete the detection rule with the given id.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
id (UUID):
|
|
61
|
+
|
|
62
|
+
Raises:
|
|
63
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
64
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Response[DeleteDetectionRuleResponseData]
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
kwargs = _get_kwargs(
|
|
71
|
+
id=id,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
response = client.get_httpx_client().request(
|
|
75
|
+
**kwargs,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return _build_response(client=client, response=response)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def sync(
|
|
82
|
+
id: UUID,
|
|
83
|
+
*,
|
|
84
|
+
client: AuthenticatedClient,
|
|
85
|
+
) -> DeleteDetectionRuleResponseData | None:
|
|
86
|
+
"""Delete the detection rule with the given id.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
id (UUID):
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
DeleteDetectionRuleResponseData
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
return sync_detailed(
|
|
100
|
+
id=id,
|
|
101
|
+
client=client,
|
|
102
|
+
).parsed
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
async def asyncio_detailed(
|
|
106
|
+
id: UUID,
|
|
107
|
+
*,
|
|
108
|
+
client: AuthenticatedClient,
|
|
109
|
+
) -> Response[DeleteDetectionRuleResponseData]:
|
|
110
|
+
"""Delete the detection rule with the given id.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
id (UUID):
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
Response[DeleteDetectionRuleResponseData]
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
kwargs = _get_kwargs(
|
|
124
|
+
id=id,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
128
|
+
|
|
129
|
+
return _build_response(client=client, response=response)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
async def asyncio(
|
|
133
|
+
id: UUID,
|
|
134
|
+
*,
|
|
135
|
+
client: AuthenticatedClient,
|
|
136
|
+
) -> DeleteDetectionRuleResponseData | None:
|
|
137
|
+
"""Delete the detection rule with the given id.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
id (UUID):
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
DeleteDetectionRuleResponseData
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
await asyncio_detailed(
|
|
152
|
+
id=id,
|
|
153
|
+
client=client,
|
|
154
|
+
)
|
|
155
|
+
).parsed
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
from ... import errors
|
|
9
|
+
from ...client import AuthenticatedClient, Client
|
|
10
|
+
from ...models.get_detection_rule_response_data import GetDetectionRuleResponseData
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
id: UUID,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
_kwargs: dict[str, Any] = {
|
|
18
|
+
"method": "get",
|
|
19
|
+
"url": "/v1/detection_rule/{id}".format(
|
|
20
|
+
id=quote(str(id), safe=""),
|
|
21
|
+
),
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return _kwargs
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _parse_response(
|
|
28
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
29
|
+
) -> GetDetectionRuleResponseData | None:
|
|
30
|
+
if response.status_code == 200:
|
|
31
|
+
response_200 = GetDetectionRuleResponseData.from_dict(response.json())
|
|
32
|
+
|
|
33
|
+
return response_200
|
|
34
|
+
|
|
35
|
+
if client.raise_on_unexpected_status:
|
|
36
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
37
|
+
else:
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _build_response(
|
|
42
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
43
|
+
) -> Response[GetDetectionRuleResponseData]:
|
|
44
|
+
return Response(
|
|
45
|
+
status_code=HTTPStatus(response.status_code),
|
|
46
|
+
content=response.content,
|
|
47
|
+
headers=response.headers,
|
|
48
|
+
parsed=_parse_response(client=client, response=response),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def sync_detailed(
|
|
53
|
+
id: UUID,
|
|
54
|
+
*,
|
|
55
|
+
client: AuthenticatedClient,
|
|
56
|
+
) -> Response[GetDetectionRuleResponseData]:
|
|
57
|
+
"""Get the detection rule with the provided id.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
id (UUID):
|
|
61
|
+
|
|
62
|
+
Raises:
|
|
63
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
64
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Response[GetDetectionRuleResponseData]
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
kwargs = _get_kwargs(
|
|
71
|
+
id=id,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
response = client.get_httpx_client().request(
|
|
75
|
+
**kwargs,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return _build_response(client=client, response=response)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def sync(
|
|
82
|
+
id: UUID,
|
|
83
|
+
*,
|
|
84
|
+
client: AuthenticatedClient,
|
|
85
|
+
) -> GetDetectionRuleResponseData | None:
|
|
86
|
+
"""Get the detection rule with the provided id.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
id (UUID):
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
GetDetectionRuleResponseData
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
return sync_detailed(
|
|
100
|
+
id=id,
|
|
101
|
+
client=client,
|
|
102
|
+
).parsed
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
async def asyncio_detailed(
|
|
106
|
+
id: UUID,
|
|
107
|
+
*,
|
|
108
|
+
client: AuthenticatedClient,
|
|
109
|
+
) -> Response[GetDetectionRuleResponseData]:
|
|
110
|
+
"""Get the detection rule with the provided id.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
id (UUID):
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
Response[GetDetectionRuleResponseData]
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
kwargs = _get_kwargs(
|
|
124
|
+
id=id,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
128
|
+
|
|
129
|
+
return _build_response(client=client, response=response)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
async def asyncio(
|
|
133
|
+
id: UUID,
|
|
134
|
+
*,
|
|
135
|
+
client: AuthenticatedClient,
|
|
136
|
+
) -> GetDetectionRuleResponseData | None:
|
|
137
|
+
"""Get the detection rule with the provided id.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
id (UUID):
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
GetDetectionRuleResponseData
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
await asyncio_detailed(
|
|
152
|
+
id=id,
|
|
153
|
+
client=client,
|
|
154
|
+
)
|
|
155
|
+
).parsed
|