aceapi-v2-client 2.0.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.
- aceapi_v2_client/__init__.py +8 -0
- aceapi_v2_client/api/__init__.py +1 -0
- aceapi_v2_client/api/alerts/__init__.py +1 -0
- aceapi_v2_client/api/alerts/bulk_add_observable_alerts_bulk_add_observable_post.py +174 -0
- aceapi_v2_client/api/alerts/download_alert_alerts_alert_uuid_download_get.py +167 -0
- aceapi_v2_client/api/alerts/view_alert_logs_alerts_alert_uuid_logs_get.py +200 -0
- aceapi_v2_client/api/authentication/__init__.py +1 -0
- aceapi_v2_client/api/authentication/login_for_access_token_auth_token_post.py +187 -0
- aceapi_v2_client/api/authentication/refresh_access_token_auth_refresh_post.py +182 -0
- aceapi_v2_client/api/common/__init__.py +1 -0
- aceapi_v2_client/api/common/ping_common_ping_get.py +128 -0
- aceapi_v2_client/api/common/supported_api_version_common_supported_api_version_get.py +128 -0
- aceapi_v2_client/api/common/valid_companies_common_valid_companies_get.py +128 -0
- aceapi_v2_client/api/common/valid_directives_common_valid_directives_get.py +130 -0
- aceapi_v2_client/api/common/valid_observables_common_valid_observables_get.py +130 -0
- aceapi_v2_client/api/events/__init__.py +1 -0
- aceapi_v2_client/api/events/export_events_events_export_get.py +192 -0
- aceapi_v2_client/api/events/open_events_events_open_get.py +128 -0
- aceapi_v2_client/api/events/update_event_status_events_event_id_patch.py +182 -0
- aceapi_v2_client/api/health/__init__.py +1 -0
- aceapi_v2_client/api/health/ping_health_ping_get.py +136 -0
- aceapi_v2_client/api/nodes/__init__.py +1 -0
- aceapi_v2_client/api/nodes/drain_node_nodes_node_id_drain_post.py +173 -0
- aceapi_v2_client/api/nodes/get_node_nodes_node_id_get.py +161 -0
- aceapi_v2_client/api/nodes/list_nodes_nodes_get.py +128 -0
- aceapi_v2_client/api/nodes/resume_node_nodes_node_id_resume_post.py +169 -0
- aceapi_v2_client/api/observables/__init__.py +1 -0
- aceapi_v2_client/api/observables/create_comment_observable_comments_post.py +166 -0
- aceapi_v2_client/api/observables/delete_comment_observable_comments_comment_id_delete.py +159 -0
- aceapi_v2_client/api/observables/list_comments_observable_comments_observable_id_get.py +163 -0
- aceapi_v2_client/api/observables/list_observable_types_observable_types_get.py +144 -0
- aceapi_v2_client/api/observables/set_interesting_observables_interesting_patch.py +191 -0
- aceapi_v2_client/api/observables/update_comment_observable_comments_comment_id_patch.py +182 -0
- aceapi_v2_client/api/threats/__init__.py +1 -0
- aceapi_v2_client/api/threats/create_threat_threats_post.py +166 -0
- aceapi_v2_client/api/threats/create_threat_type_threat_types_post.py +166 -0
- aceapi_v2_client/api/threats/delete_threat_threats_delete.py +179 -0
- aceapi_v2_client/api/threats/delete_threat_type_threat_types_threat_type_id_delete.py +159 -0
- aceapi_v2_client/api/threats/get_threat_type_threat_types_threat_type_id_get.py +161 -0
- aceapi_v2_client/api/threats/list_threat_types_threat_types_get.py +128 -0
- aceapi_v2_client/api/threats/list_threats_threats_get.py +171 -0
- aceapi_v2_client/api/threats/update_threat_type_threat_types_threat_type_id_patch.py +182 -0
- aceapi_v2_client/auth.py +56 -0
- aceapi_v2_client/client.py +282 -0
- aceapi_v2_client/errors.py +16 -0
- aceapi_v2_client/models/__init__.py +87 -0
- aceapi_v2_client/models/body_login_for_access_token_auth_token_post.py +140 -0
- aceapi_v2_client/models/bulk_add_observable_request.py +110 -0
- aceapi_v2_client/models/bulk_add_observable_result.py +107 -0
- aceapi_v2_client/models/bulk_add_observable_result_failed_details.py +47 -0
- aceapi_v2_client/models/collector_status_read.py +86 -0
- aceapi_v2_client/models/company_read.py +69 -0
- aceapi_v2_client/models/event_read.py +84 -0
- aceapi_v2_client/models/export_format.py +8 -0
- aceapi_v2_client/models/health_response.py +62 -0
- aceapi_v2_client/models/http_validation_error.py +79 -0
- aceapi_v2_client/models/list_response_company_read.py +75 -0
- aceapi_v2_client/models/list_response_event_read.py +75 -0
- aceapi_v2_client/models/list_response_named_description_read.py +75 -0
- aceapi_v2_client/models/list_response_node_read.py +75 -0
- aceapi_v2_client/models/list_response_observable_comment_read.py +75 -0
- aceapi_v2_client/models/list_response_observable_type_read.py +75 -0
- aceapi_v2_client/models/list_response_threat_read.py +75 -0
- aceapi_v2_client/models/list_response_threat_type_read.py +75 -0
- aceapi_v2_client/models/named_description_read.py +69 -0
- aceapi_v2_client/models/node_read.py +163 -0
- aceapi_v2_client/models/observable_comment_create.py +77 -0
- aceapi_v2_client/models/observable_comment_read.py +102 -0
- aceapi_v2_client/models/observable_comment_update.py +61 -0
- aceapi_v2_client/models/observable_type_read.py +62 -0
- aceapi_v2_client/models/ping_response.py +61 -0
- aceapi_v2_client/models/refresh_request.py +62 -0
- aceapi_v2_client/models/set_interesting_observables_interesting_patch_response_set_interesting_observables_interesting_patch.py +50 -0
- aceapi_v2_client/models/set_interesting_request.py +77 -0
- aceapi_v2_client/models/status_update.py +62 -0
- aceapi_v2_client/models/supported_api_version_response.py +61 -0
- aceapi_v2_client/models/threat_create.py +69 -0
- aceapi_v2_client/models/threat_read.py +77 -0
- aceapi_v2_client/models/threat_type_create.py +61 -0
- aceapi_v2_client/models/threat_type_read.py +69 -0
- aceapi_v2_client/models/threat_type_update.py +73 -0
- aceapi_v2_client/models/token.py +81 -0
- aceapi_v2_client/models/validation_error.py +123 -0
- aceapi_v2_client/models/validation_error_context.py +47 -0
- aceapi_v2_client/py.typed +0 -0
- aceapi_v2_client/types.py +54 -0
- aceapi_v2_client-2.0.0.dist-info/METADATA +192 -0
- aceapi_v2_client-2.0.0.dist-info/RECORD +90 -0
- aceapi_v2_client-2.0.0.dist-info/WHEEL +4 -0
- aceapi_v2_client-2.0.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import ssl
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
from attrs import define, evolve, field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@define
|
|
9
|
+
class Client:
|
|
10
|
+
"""A class for keeping track of data related to the API
|
|
11
|
+
|
|
12
|
+
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
13
|
+
|
|
14
|
+
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
15
|
+
|
|
16
|
+
``cookies``: A dictionary of cookies to be sent with every request
|
|
17
|
+
|
|
18
|
+
``headers``: A dictionary of headers to be sent with every request
|
|
19
|
+
|
|
20
|
+
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
21
|
+
httpx.TimeoutException if this is exceeded.
|
|
22
|
+
|
|
23
|
+
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
24
|
+
but can be set to False for testing purposes.
|
|
25
|
+
|
|
26
|
+
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
27
|
+
|
|
28
|
+
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Attributes:
|
|
32
|
+
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
33
|
+
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
34
|
+
argument to the constructor.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
38
|
+
_base_url: str = field(alias="base_url")
|
|
39
|
+
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
40
|
+
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
41
|
+
_timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
|
|
42
|
+
_verify_ssl: str | bool | ssl.SSLContext = field(
|
|
43
|
+
default=True, kw_only=True, alias="verify_ssl"
|
|
44
|
+
)
|
|
45
|
+
_follow_redirects: bool = field(
|
|
46
|
+
default=False, kw_only=True, alias="follow_redirects"
|
|
47
|
+
)
|
|
48
|
+
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
49
|
+
_client: httpx.Client | None = field(default=None, init=False)
|
|
50
|
+
_async_client: httpx.AsyncClient | None = field(default=None, init=False)
|
|
51
|
+
|
|
52
|
+
def with_headers(self, headers: dict[str, str]) -> "Client":
|
|
53
|
+
"""Get a new client matching this one with additional headers"""
|
|
54
|
+
if self._client is not None:
|
|
55
|
+
self._client.headers.update(headers)
|
|
56
|
+
if self._async_client is not None:
|
|
57
|
+
self._async_client.headers.update(headers)
|
|
58
|
+
return evolve(self, headers={**self._headers, **headers})
|
|
59
|
+
|
|
60
|
+
def with_cookies(self, cookies: dict[str, str]) -> "Client":
|
|
61
|
+
"""Get a new client matching this one with additional cookies"""
|
|
62
|
+
if self._client is not None:
|
|
63
|
+
self._client.cookies.update(cookies)
|
|
64
|
+
if self._async_client is not None:
|
|
65
|
+
self._async_client.cookies.update(cookies)
|
|
66
|
+
return evolve(self, cookies={**self._cookies, **cookies})
|
|
67
|
+
|
|
68
|
+
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
|
|
69
|
+
"""Get a new client matching this one with a new timeout configuration"""
|
|
70
|
+
if self._client is not None:
|
|
71
|
+
self._client.timeout = timeout
|
|
72
|
+
if self._async_client is not None:
|
|
73
|
+
self._async_client.timeout = timeout
|
|
74
|
+
return evolve(self, timeout=timeout)
|
|
75
|
+
|
|
76
|
+
def set_httpx_client(self, client: httpx.Client) -> "Client":
|
|
77
|
+
"""Manually set the underlying httpx.Client
|
|
78
|
+
|
|
79
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
80
|
+
"""
|
|
81
|
+
self._client = client
|
|
82
|
+
return self
|
|
83
|
+
|
|
84
|
+
def get_httpx_client(self) -> httpx.Client:
|
|
85
|
+
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
86
|
+
if self._client is None:
|
|
87
|
+
self._client = httpx.Client(
|
|
88
|
+
base_url=self._base_url,
|
|
89
|
+
cookies=self._cookies,
|
|
90
|
+
headers=self._headers,
|
|
91
|
+
timeout=self._timeout,
|
|
92
|
+
verify=self._verify_ssl,
|
|
93
|
+
follow_redirects=self._follow_redirects,
|
|
94
|
+
**self._httpx_args,
|
|
95
|
+
)
|
|
96
|
+
return self._client
|
|
97
|
+
|
|
98
|
+
def __enter__(self) -> "Client":
|
|
99
|
+
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
100
|
+
self.get_httpx_client().__enter__()
|
|
101
|
+
return self
|
|
102
|
+
|
|
103
|
+
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
104
|
+
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
105
|
+
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
106
|
+
|
|
107
|
+
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
|
|
108
|
+
"""Manually set the underlying httpx.AsyncClient
|
|
109
|
+
|
|
110
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
111
|
+
"""
|
|
112
|
+
self._async_client = async_client
|
|
113
|
+
return self
|
|
114
|
+
|
|
115
|
+
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
116
|
+
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
117
|
+
if self._async_client is None:
|
|
118
|
+
self._async_client = httpx.AsyncClient(
|
|
119
|
+
base_url=self._base_url,
|
|
120
|
+
cookies=self._cookies,
|
|
121
|
+
headers=self._headers,
|
|
122
|
+
timeout=self._timeout,
|
|
123
|
+
verify=self._verify_ssl,
|
|
124
|
+
follow_redirects=self._follow_redirects,
|
|
125
|
+
**self._httpx_args,
|
|
126
|
+
)
|
|
127
|
+
return self._async_client
|
|
128
|
+
|
|
129
|
+
async def __aenter__(self) -> "Client":
|
|
130
|
+
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
131
|
+
await self.get_async_httpx_client().__aenter__()
|
|
132
|
+
return self
|
|
133
|
+
|
|
134
|
+
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
135
|
+
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
136
|
+
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
@define
|
|
140
|
+
class AuthenticatedClient:
|
|
141
|
+
"""A Client which has been authenticated for use on secured endpoints
|
|
142
|
+
|
|
143
|
+
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
|
144
|
+
|
|
145
|
+
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
|
146
|
+
|
|
147
|
+
``cookies``: A dictionary of cookies to be sent with every request
|
|
148
|
+
|
|
149
|
+
``headers``: A dictionary of headers to be sent with every request
|
|
150
|
+
|
|
151
|
+
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
|
152
|
+
httpx.TimeoutException if this is exceeded.
|
|
153
|
+
|
|
154
|
+
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
|
155
|
+
but can be set to False for testing purposes.
|
|
156
|
+
|
|
157
|
+
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
|
158
|
+
|
|
159
|
+
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
Attributes:
|
|
163
|
+
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
|
164
|
+
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
|
165
|
+
argument to the constructor.
|
|
166
|
+
token: The token to use for authentication
|
|
167
|
+
prefix: The prefix to use for the Authorization header
|
|
168
|
+
auth_header_name: The name of the Authorization header
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
|
172
|
+
_base_url: str = field(alias="base_url")
|
|
173
|
+
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
|
174
|
+
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
|
175
|
+
_timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
|
|
176
|
+
_verify_ssl: str | bool | ssl.SSLContext = field(
|
|
177
|
+
default=True, kw_only=True, alias="verify_ssl"
|
|
178
|
+
)
|
|
179
|
+
_follow_redirects: bool = field(
|
|
180
|
+
default=False, kw_only=True, alias="follow_redirects"
|
|
181
|
+
)
|
|
182
|
+
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
|
183
|
+
_client: httpx.Client | None = field(default=None, init=False)
|
|
184
|
+
_async_client: httpx.AsyncClient | None = field(default=None, init=False)
|
|
185
|
+
|
|
186
|
+
token: str
|
|
187
|
+
prefix: str = "Bearer"
|
|
188
|
+
auth_header_name: str = "Authorization"
|
|
189
|
+
|
|
190
|
+
def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
|
|
191
|
+
"""Get a new client matching this one with additional headers"""
|
|
192
|
+
if self._client is not None:
|
|
193
|
+
self._client.headers.update(headers)
|
|
194
|
+
if self._async_client is not None:
|
|
195
|
+
self._async_client.headers.update(headers)
|
|
196
|
+
return evolve(self, headers={**self._headers, **headers})
|
|
197
|
+
|
|
198
|
+
def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
|
|
199
|
+
"""Get a new client matching this one with additional cookies"""
|
|
200
|
+
if self._client is not None:
|
|
201
|
+
self._client.cookies.update(cookies)
|
|
202
|
+
if self._async_client is not None:
|
|
203
|
+
self._async_client.cookies.update(cookies)
|
|
204
|
+
return evolve(self, cookies={**self._cookies, **cookies})
|
|
205
|
+
|
|
206
|
+
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
|
|
207
|
+
"""Get a new client matching this one with a new timeout configuration"""
|
|
208
|
+
if self._client is not None:
|
|
209
|
+
self._client.timeout = timeout
|
|
210
|
+
if self._async_client is not None:
|
|
211
|
+
self._async_client.timeout = timeout
|
|
212
|
+
return evolve(self, timeout=timeout)
|
|
213
|
+
|
|
214
|
+
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
|
|
215
|
+
"""Manually set the underlying httpx.Client
|
|
216
|
+
|
|
217
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
218
|
+
"""
|
|
219
|
+
self._client = client
|
|
220
|
+
return self
|
|
221
|
+
|
|
222
|
+
def get_httpx_client(self) -> httpx.Client:
|
|
223
|
+
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
|
224
|
+
if self._client is None:
|
|
225
|
+
self._headers[self.auth_header_name] = (
|
|
226
|
+
f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
227
|
+
)
|
|
228
|
+
self._client = httpx.Client(
|
|
229
|
+
base_url=self._base_url,
|
|
230
|
+
cookies=self._cookies,
|
|
231
|
+
headers=self._headers,
|
|
232
|
+
timeout=self._timeout,
|
|
233
|
+
verify=self._verify_ssl,
|
|
234
|
+
follow_redirects=self._follow_redirects,
|
|
235
|
+
**self._httpx_args,
|
|
236
|
+
)
|
|
237
|
+
return self._client
|
|
238
|
+
|
|
239
|
+
def __enter__(self) -> "AuthenticatedClient":
|
|
240
|
+
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
|
241
|
+
self.get_httpx_client().__enter__()
|
|
242
|
+
return self
|
|
243
|
+
|
|
244
|
+
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
|
245
|
+
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
|
246
|
+
self.get_httpx_client().__exit__(*args, **kwargs)
|
|
247
|
+
|
|
248
|
+
def set_async_httpx_client(
|
|
249
|
+
self, async_client: httpx.AsyncClient
|
|
250
|
+
) -> "AuthenticatedClient":
|
|
251
|
+
"""Manually set the underlying httpx.AsyncClient
|
|
252
|
+
|
|
253
|
+
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
|
254
|
+
"""
|
|
255
|
+
self._async_client = async_client
|
|
256
|
+
return self
|
|
257
|
+
|
|
258
|
+
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
|
259
|
+
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
|
260
|
+
if self._async_client is None:
|
|
261
|
+
self._headers[self.auth_header_name] = (
|
|
262
|
+
f"{self.prefix} {self.token}" if self.prefix else self.token
|
|
263
|
+
)
|
|
264
|
+
self._async_client = httpx.AsyncClient(
|
|
265
|
+
base_url=self._base_url,
|
|
266
|
+
cookies=self._cookies,
|
|
267
|
+
headers=self._headers,
|
|
268
|
+
timeout=self._timeout,
|
|
269
|
+
verify=self._verify_ssl,
|
|
270
|
+
follow_redirects=self._follow_redirects,
|
|
271
|
+
**self._httpx_args,
|
|
272
|
+
)
|
|
273
|
+
return self._async_client
|
|
274
|
+
|
|
275
|
+
async def __aenter__(self) -> "AuthenticatedClient":
|
|
276
|
+
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
|
277
|
+
await self.get_async_httpx_client().__aenter__()
|
|
278
|
+
return self
|
|
279
|
+
|
|
280
|
+
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
|
281
|
+
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
|
282
|
+
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Contains shared errors types that can be raised from API functions"""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class UnexpectedStatus(Exception):
|
|
5
|
+
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
|
6
|
+
|
|
7
|
+
def __init__(self, status_code: int, content: bytes):
|
|
8
|
+
self.status_code = status_code
|
|
9
|
+
self.content = content
|
|
10
|
+
|
|
11
|
+
super().__init__(
|
|
12
|
+
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__all__ = ["UnexpectedStatus"]
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""Contains all the data models used in inputs/outputs"""
|
|
2
|
+
|
|
3
|
+
from .body_login_for_access_token_auth_token_post import (
|
|
4
|
+
BodyLoginForAccessTokenAuthTokenPost,
|
|
5
|
+
)
|
|
6
|
+
from .bulk_add_observable_request import BulkAddObservableRequest
|
|
7
|
+
from .bulk_add_observable_result import BulkAddObservableResult
|
|
8
|
+
from .bulk_add_observable_result_failed_details import (
|
|
9
|
+
BulkAddObservableResultFailedDetails,
|
|
10
|
+
)
|
|
11
|
+
from .collector_status_read import CollectorStatusRead
|
|
12
|
+
from .company_read import CompanyRead
|
|
13
|
+
from .event_read import EventRead
|
|
14
|
+
from .export_format import ExportFormat
|
|
15
|
+
from .health_response import HealthResponse
|
|
16
|
+
from .http_validation_error import HTTPValidationError
|
|
17
|
+
from .list_response_company_read import ListResponseCompanyRead
|
|
18
|
+
from .list_response_event_read import ListResponseEventRead
|
|
19
|
+
from .list_response_named_description_read import ListResponseNamedDescriptionRead
|
|
20
|
+
from .list_response_node_read import ListResponseNodeRead
|
|
21
|
+
from .list_response_observable_comment_read import ListResponseObservableCommentRead
|
|
22
|
+
from .list_response_observable_type_read import ListResponseObservableTypeRead
|
|
23
|
+
from .list_response_threat_read import ListResponseThreatRead
|
|
24
|
+
from .list_response_threat_type_read import ListResponseThreatTypeRead
|
|
25
|
+
from .named_description_read import NamedDescriptionRead
|
|
26
|
+
from .node_read import NodeRead
|
|
27
|
+
from .observable_comment_create import ObservableCommentCreate
|
|
28
|
+
from .observable_comment_read import ObservableCommentRead
|
|
29
|
+
from .observable_comment_update import ObservableCommentUpdate
|
|
30
|
+
from .observable_type_read import ObservableTypeRead
|
|
31
|
+
from .ping_response import PingResponse
|
|
32
|
+
from .refresh_request import RefreshRequest
|
|
33
|
+
from .set_interesting_observables_interesting_patch_response_set_interesting_observables_interesting_patch import (
|
|
34
|
+
SetInterestingObservablesInterestingPatchResponseSetInterestingObservablesInterestingPatch,
|
|
35
|
+
)
|
|
36
|
+
from .set_interesting_request import SetInterestingRequest
|
|
37
|
+
from .status_update import StatusUpdate
|
|
38
|
+
from .supported_api_version_response import SupportedApiVersionResponse
|
|
39
|
+
from .threat_create import ThreatCreate
|
|
40
|
+
from .threat_read import ThreatRead
|
|
41
|
+
from .threat_type_create import ThreatTypeCreate
|
|
42
|
+
from .threat_type_read import ThreatTypeRead
|
|
43
|
+
from .threat_type_update import ThreatTypeUpdate
|
|
44
|
+
from .token import Token
|
|
45
|
+
from .validation_error import ValidationError
|
|
46
|
+
from .validation_error_context import ValidationErrorContext
|
|
47
|
+
|
|
48
|
+
__all__ = (
|
|
49
|
+
"BodyLoginForAccessTokenAuthTokenPost",
|
|
50
|
+
"BulkAddObservableRequest",
|
|
51
|
+
"BulkAddObservableResult",
|
|
52
|
+
"BulkAddObservableResultFailedDetails",
|
|
53
|
+
"CollectorStatusRead",
|
|
54
|
+
"CompanyRead",
|
|
55
|
+
"EventRead",
|
|
56
|
+
"ExportFormat",
|
|
57
|
+
"HealthResponse",
|
|
58
|
+
"HTTPValidationError",
|
|
59
|
+
"ListResponseCompanyRead",
|
|
60
|
+
"ListResponseEventRead",
|
|
61
|
+
"ListResponseNamedDescriptionRead",
|
|
62
|
+
"ListResponseNodeRead",
|
|
63
|
+
"ListResponseObservableCommentRead",
|
|
64
|
+
"ListResponseObservableTypeRead",
|
|
65
|
+
"ListResponseThreatRead",
|
|
66
|
+
"ListResponseThreatTypeRead",
|
|
67
|
+
"NamedDescriptionRead",
|
|
68
|
+
"NodeRead",
|
|
69
|
+
"ObservableCommentCreate",
|
|
70
|
+
"ObservableCommentRead",
|
|
71
|
+
"ObservableCommentUpdate",
|
|
72
|
+
"ObservableTypeRead",
|
|
73
|
+
"PingResponse",
|
|
74
|
+
"RefreshRequest",
|
|
75
|
+
"SetInterestingObservablesInterestingPatchResponseSetInterestingObservablesInterestingPatch",
|
|
76
|
+
"SetInterestingRequest",
|
|
77
|
+
"StatusUpdate",
|
|
78
|
+
"SupportedApiVersionResponse",
|
|
79
|
+
"ThreatCreate",
|
|
80
|
+
"ThreatRead",
|
|
81
|
+
"ThreatTypeCreate",
|
|
82
|
+
"ThreatTypeRead",
|
|
83
|
+
"ThreatTypeUpdate",
|
|
84
|
+
"Token",
|
|
85
|
+
"ValidationError",
|
|
86
|
+
"ValidationErrorContext",
|
|
87
|
+
)
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="BodyLoginForAccessTokenAuthTokenPost")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class BodyLoginForAccessTokenAuthTokenPost:
|
|
16
|
+
"""
|
|
17
|
+
Attributes:
|
|
18
|
+
username (str):
|
|
19
|
+
password (str):
|
|
20
|
+
grant_type (None | str | Unset):
|
|
21
|
+
scope (str | Unset): Default: ''.
|
|
22
|
+
client_id (None | str | Unset):
|
|
23
|
+
client_secret (None | str | Unset):
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
username: str
|
|
27
|
+
password: str
|
|
28
|
+
grant_type: None | str | Unset = UNSET
|
|
29
|
+
scope: str | Unset = ""
|
|
30
|
+
client_id: None | str | Unset = UNSET
|
|
31
|
+
client_secret: None | str | Unset = UNSET
|
|
32
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
33
|
+
|
|
34
|
+
def to_dict(self) -> dict[str, Any]:
|
|
35
|
+
username = self.username
|
|
36
|
+
|
|
37
|
+
password = self.password
|
|
38
|
+
|
|
39
|
+
grant_type: None | str | Unset
|
|
40
|
+
if isinstance(self.grant_type, Unset):
|
|
41
|
+
grant_type = UNSET
|
|
42
|
+
else:
|
|
43
|
+
grant_type = self.grant_type
|
|
44
|
+
|
|
45
|
+
scope = self.scope
|
|
46
|
+
|
|
47
|
+
client_id: None | str | Unset
|
|
48
|
+
if isinstance(self.client_id, Unset):
|
|
49
|
+
client_id = UNSET
|
|
50
|
+
else:
|
|
51
|
+
client_id = self.client_id
|
|
52
|
+
|
|
53
|
+
client_secret: None | str | Unset
|
|
54
|
+
if isinstance(self.client_secret, Unset):
|
|
55
|
+
client_secret = UNSET
|
|
56
|
+
else:
|
|
57
|
+
client_secret = self.client_secret
|
|
58
|
+
|
|
59
|
+
field_dict: dict[str, Any] = {}
|
|
60
|
+
field_dict.update(self.additional_properties)
|
|
61
|
+
field_dict.update(
|
|
62
|
+
{
|
|
63
|
+
"username": username,
|
|
64
|
+
"password": password,
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
if grant_type is not UNSET:
|
|
68
|
+
field_dict["grant_type"] = grant_type
|
|
69
|
+
if scope is not UNSET:
|
|
70
|
+
field_dict["scope"] = scope
|
|
71
|
+
if client_id is not UNSET:
|
|
72
|
+
field_dict["client_id"] = client_id
|
|
73
|
+
if client_secret is not UNSET:
|
|
74
|
+
field_dict["client_secret"] = client_secret
|
|
75
|
+
|
|
76
|
+
return field_dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
80
|
+
d = dict(src_dict)
|
|
81
|
+
username = d.pop("username")
|
|
82
|
+
|
|
83
|
+
password = d.pop("password")
|
|
84
|
+
|
|
85
|
+
def _parse_grant_type(data: object) -> None | str | Unset:
|
|
86
|
+
if data is None:
|
|
87
|
+
return data
|
|
88
|
+
if isinstance(data, Unset):
|
|
89
|
+
return data
|
|
90
|
+
return cast(None | str | Unset, data)
|
|
91
|
+
|
|
92
|
+
grant_type = _parse_grant_type(d.pop("grant_type", UNSET))
|
|
93
|
+
|
|
94
|
+
scope = d.pop("scope", UNSET)
|
|
95
|
+
|
|
96
|
+
def _parse_client_id(data: object) -> None | str | Unset:
|
|
97
|
+
if data is None:
|
|
98
|
+
return data
|
|
99
|
+
if isinstance(data, Unset):
|
|
100
|
+
return data
|
|
101
|
+
return cast(None | str | Unset, data)
|
|
102
|
+
|
|
103
|
+
client_id = _parse_client_id(d.pop("client_id", UNSET))
|
|
104
|
+
|
|
105
|
+
def _parse_client_secret(data: object) -> None | str | Unset:
|
|
106
|
+
if data is None:
|
|
107
|
+
return data
|
|
108
|
+
if isinstance(data, Unset):
|
|
109
|
+
return data
|
|
110
|
+
return cast(None | str | Unset, data)
|
|
111
|
+
|
|
112
|
+
client_secret = _parse_client_secret(d.pop("client_secret", UNSET))
|
|
113
|
+
|
|
114
|
+
body_login_for_access_token_auth_token_post = cls(
|
|
115
|
+
username=username,
|
|
116
|
+
password=password,
|
|
117
|
+
grant_type=grant_type,
|
|
118
|
+
scope=scope,
|
|
119
|
+
client_id=client_id,
|
|
120
|
+
client_secret=client_secret,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
body_login_for_access_token_auth_token_post.additional_properties = d
|
|
124
|
+
return body_login_for_access_token_auth_token_post
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def additional_keys(self) -> list[str]:
|
|
128
|
+
return list(self.additional_properties.keys())
|
|
129
|
+
|
|
130
|
+
def __getitem__(self, key: str) -> Any:
|
|
131
|
+
return self.additional_properties[key]
|
|
132
|
+
|
|
133
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
134
|
+
self.additional_properties[key] = value
|
|
135
|
+
|
|
136
|
+
def __delitem__(self, key: str) -> None:
|
|
137
|
+
del self.additional_properties[key]
|
|
138
|
+
|
|
139
|
+
def __contains__(self, key: str) -> bool:
|
|
140
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="BulkAddObservableRequest")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class BulkAddObservableRequest:
|
|
16
|
+
"""
|
|
17
|
+
Attributes:
|
|
18
|
+
alert_uuids (list[str]):
|
|
19
|
+
observable_type (str):
|
|
20
|
+
observable_value (str):
|
|
21
|
+
observable_time (None | str | Unset):
|
|
22
|
+
directives (list[str] | Unset):
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
alert_uuids: list[str]
|
|
26
|
+
observable_type: str
|
|
27
|
+
observable_value: str
|
|
28
|
+
observable_time: None | str | Unset = UNSET
|
|
29
|
+
directives: list[str] | Unset = UNSET
|
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
alert_uuids = self.alert_uuids
|
|
34
|
+
|
|
35
|
+
observable_type = self.observable_type
|
|
36
|
+
|
|
37
|
+
observable_value = self.observable_value
|
|
38
|
+
|
|
39
|
+
observable_time: None | str | Unset
|
|
40
|
+
if isinstance(self.observable_time, Unset):
|
|
41
|
+
observable_time = UNSET
|
|
42
|
+
else:
|
|
43
|
+
observable_time = self.observable_time
|
|
44
|
+
|
|
45
|
+
directives: list[str] | Unset = UNSET
|
|
46
|
+
if not isinstance(self.directives, Unset):
|
|
47
|
+
directives = self.directives
|
|
48
|
+
|
|
49
|
+
field_dict: dict[str, Any] = {}
|
|
50
|
+
field_dict.update(self.additional_properties)
|
|
51
|
+
field_dict.update(
|
|
52
|
+
{
|
|
53
|
+
"alert_uuids": alert_uuids,
|
|
54
|
+
"observable_type": observable_type,
|
|
55
|
+
"observable_value": observable_value,
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
if observable_time is not UNSET:
|
|
59
|
+
field_dict["observable_time"] = observable_time
|
|
60
|
+
if directives is not UNSET:
|
|
61
|
+
field_dict["directives"] = directives
|
|
62
|
+
|
|
63
|
+
return field_dict
|
|
64
|
+
|
|
65
|
+
@classmethod
|
|
66
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
67
|
+
d = dict(src_dict)
|
|
68
|
+
alert_uuids = cast(list[str], d.pop("alert_uuids"))
|
|
69
|
+
|
|
70
|
+
observable_type = d.pop("observable_type")
|
|
71
|
+
|
|
72
|
+
observable_value = d.pop("observable_value")
|
|
73
|
+
|
|
74
|
+
def _parse_observable_time(data: object) -> None | str | Unset:
|
|
75
|
+
if data is None:
|
|
76
|
+
return data
|
|
77
|
+
if isinstance(data, Unset):
|
|
78
|
+
return data
|
|
79
|
+
return cast(None | str | Unset, data)
|
|
80
|
+
|
|
81
|
+
observable_time = _parse_observable_time(d.pop("observable_time", UNSET))
|
|
82
|
+
|
|
83
|
+
directives = cast(list[str], d.pop("directives", UNSET))
|
|
84
|
+
|
|
85
|
+
bulk_add_observable_request = cls(
|
|
86
|
+
alert_uuids=alert_uuids,
|
|
87
|
+
observable_type=observable_type,
|
|
88
|
+
observable_value=observable_value,
|
|
89
|
+
observable_time=observable_time,
|
|
90
|
+
directives=directives,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
bulk_add_observable_request.additional_properties = d
|
|
94
|
+
return bulk_add_observable_request
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def additional_keys(self) -> list[str]:
|
|
98
|
+
return list(self.additional_properties.keys())
|
|
99
|
+
|
|
100
|
+
def __getitem__(self, key: str) -> Any:
|
|
101
|
+
return self.additional_properties[key]
|
|
102
|
+
|
|
103
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
104
|
+
self.additional_properties[key] = value
|
|
105
|
+
|
|
106
|
+
def __delitem__(self, key: str) -> None:
|
|
107
|
+
del self.additional_properties[key]
|
|
108
|
+
|
|
109
|
+
def __contains__(self, key: str) -> bool:
|
|
110
|
+
return key in self.additional_properties
|