gcore 0.7.0__py3-none-any.whl → 0.9.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.
- gcore/_base_client.py +4 -1
- gcore/_client.py +9 -0
- gcore/_files.py +4 -4
- gcore/_version.py +1 -1
- gcore/pagination.py +0 -62
- gcore/resources/__init__.py +14 -0
- gcore/resources/cloud/cost_reports.py +24 -0
- gcore/resources/cloud/quotas/requests.py +7 -15
- gcore/resources/fastedge/binaries.py +81 -1
- gcore/resources/iam/users.py +5 -5
- gcore/resources/security/__init__.py +75 -0
- gcore/resources/security/bgp_announces.py +308 -0
- gcore/resources/security/events.py +234 -0
- gcore/resources/security/profile_templates.py +143 -0
- gcore/resources/security/profiles.py +661 -0
- gcore/resources/security/security.py +198 -0
- gcore/types/cloud/cost_report_get_aggregated_monthly_params.py +3 -0
- gcore/types/cloud/cost_report_get_aggregated_params.py +3 -0
- gcore/types/cloud/cost_report_get_detailed_params.py +3 -0
- gcore/types/cloud/floating_ip.py +0 -9
- gcore/types/cloud/floating_ip_detailed.py +0 -9
- gcore/types/cloud/gpu_baremetal_flavor.py +16 -0
- gcore/types/cloud/quotas/request_list_params.py +2 -2
- gcore/types/cloud/region.py +6 -3
- gcore/types/cloud/subnet.py +1 -1
- gcore/types/fastedge/__init__.py +1 -0
- gcore/types/fastedge/binary_create_params.py +11 -0
- gcore/types/security/__init__.py +18 -0
- gcore/types/security/bgp_announce_change_params.py +16 -0
- gcore/types/security/bgp_announce_list_params.py +18 -0
- gcore/types/security/bgp_announce_list_response.py +10 -0
- gcore/types/security/client_announce.py +15 -0
- gcore/types/security/client_profile.py +56 -0
- gcore/types/security/client_profile_template.py +43 -0
- gcore/types/security/client_view.py +29 -0
- gcore/types/security/event_list_params.py +38 -0
- gcore/types/security/profile_create_params.py +24 -0
- gcore/types/security/profile_list_params.py +17 -0
- gcore/types/security/profile_list_response.py +10 -0
- gcore/types/security/profile_recreate_params.py +24 -0
- gcore/types/security/profile_replace_params.py +24 -0
- gcore/types/security/profile_template_list_response.py +10 -0
- {gcore-0.7.0.dist-info → gcore-0.9.0.dist-info}/METADATA +1 -1
- {gcore-0.7.0.dist-info → gcore-0.9.0.dist-info}/RECORD +46 -24
- {gcore-0.7.0.dist-info → gcore-0.9.0.dist-info}/WHEEL +0 -0
- {gcore-0.7.0.dist-info → gcore-0.9.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .events import (
|
|
4
|
+
EventsResource,
|
|
5
|
+
AsyncEventsResource,
|
|
6
|
+
EventsResourceWithRawResponse,
|
|
7
|
+
AsyncEventsResourceWithRawResponse,
|
|
8
|
+
EventsResourceWithStreamingResponse,
|
|
9
|
+
AsyncEventsResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .profiles import (
|
|
12
|
+
ProfilesResource,
|
|
13
|
+
AsyncProfilesResource,
|
|
14
|
+
ProfilesResourceWithRawResponse,
|
|
15
|
+
AsyncProfilesResourceWithRawResponse,
|
|
16
|
+
ProfilesResourceWithStreamingResponse,
|
|
17
|
+
AsyncProfilesResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
from .security import (
|
|
20
|
+
SecurityResource,
|
|
21
|
+
AsyncSecurityResource,
|
|
22
|
+
SecurityResourceWithRawResponse,
|
|
23
|
+
AsyncSecurityResourceWithRawResponse,
|
|
24
|
+
SecurityResourceWithStreamingResponse,
|
|
25
|
+
AsyncSecurityResourceWithStreamingResponse,
|
|
26
|
+
)
|
|
27
|
+
from .bgp_announces import (
|
|
28
|
+
BgpAnnouncesResource,
|
|
29
|
+
AsyncBgpAnnouncesResource,
|
|
30
|
+
BgpAnnouncesResourceWithRawResponse,
|
|
31
|
+
AsyncBgpAnnouncesResourceWithRawResponse,
|
|
32
|
+
BgpAnnouncesResourceWithStreamingResponse,
|
|
33
|
+
AsyncBgpAnnouncesResourceWithStreamingResponse,
|
|
34
|
+
)
|
|
35
|
+
from .profile_templates import (
|
|
36
|
+
ProfileTemplatesResource,
|
|
37
|
+
AsyncProfileTemplatesResource,
|
|
38
|
+
ProfileTemplatesResourceWithRawResponse,
|
|
39
|
+
AsyncProfileTemplatesResourceWithRawResponse,
|
|
40
|
+
ProfileTemplatesResourceWithStreamingResponse,
|
|
41
|
+
AsyncProfileTemplatesResourceWithStreamingResponse,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
"EventsResource",
|
|
46
|
+
"AsyncEventsResource",
|
|
47
|
+
"EventsResourceWithRawResponse",
|
|
48
|
+
"AsyncEventsResourceWithRawResponse",
|
|
49
|
+
"EventsResourceWithStreamingResponse",
|
|
50
|
+
"AsyncEventsResourceWithStreamingResponse",
|
|
51
|
+
"BgpAnnouncesResource",
|
|
52
|
+
"AsyncBgpAnnouncesResource",
|
|
53
|
+
"BgpAnnouncesResourceWithRawResponse",
|
|
54
|
+
"AsyncBgpAnnouncesResourceWithRawResponse",
|
|
55
|
+
"BgpAnnouncesResourceWithStreamingResponse",
|
|
56
|
+
"AsyncBgpAnnouncesResourceWithStreamingResponse",
|
|
57
|
+
"ProfileTemplatesResource",
|
|
58
|
+
"AsyncProfileTemplatesResource",
|
|
59
|
+
"ProfileTemplatesResourceWithRawResponse",
|
|
60
|
+
"AsyncProfileTemplatesResourceWithRawResponse",
|
|
61
|
+
"ProfileTemplatesResourceWithStreamingResponse",
|
|
62
|
+
"AsyncProfileTemplatesResourceWithStreamingResponse",
|
|
63
|
+
"ProfilesResource",
|
|
64
|
+
"AsyncProfilesResource",
|
|
65
|
+
"ProfilesResourceWithRawResponse",
|
|
66
|
+
"AsyncProfilesResourceWithRawResponse",
|
|
67
|
+
"ProfilesResourceWithStreamingResponse",
|
|
68
|
+
"AsyncProfilesResourceWithStreamingResponse",
|
|
69
|
+
"SecurityResource",
|
|
70
|
+
"AsyncSecurityResource",
|
|
71
|
+
"SecurityResourceWithRawResponse",
|
|
72
|
+
"AsyncSecurityResourceWithRawResponse",
|
|
73
|
+
"SecurityResourceWithStreamingResponse",
|
|
74
|
+
"AsyncSecurityResourceWithStreamingResponse",
|
|
75
|
+
]
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
11
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
12
|
+
from ..._compat import cached_property
|
|
13
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
14
|
+
from ..._response import (
|
|
15
|
+
to_raw_response_wrapper,
|
|
16
|
+
to_streamed_response_wrapper,
|
|
17
|
+
async_to_raw_response_wrapper,
|
|
18
|
+
async_to_streamed_response_wrapper,
|
|
19
|
+
)
|
|
20
|
+
from ..._base_client import make_request_options
|
|
21
|
+
from ...types.security import bgp_announce_list_params, bgp_announce_change_params
|
|
22
|
+
from ...types.security.bgp_announce_list_response import BgpAnnounceListResponse
|
|
23
|
+
|
|
24
|
+
__all__ = ["BgpAnnouncesResource", "AsyncBgpAnnouncesResource"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class BgpAnnouncesResource(SyncAPIResource):
|
|
28
|
+
@cached_property
|
|
29
|
+
def with_raw_response(self) -> BgpAnnouncesResourceWithRawResponse:
|
|
30
|
+
"""
|
|
31
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
32
|
+
the raw response object instead of the parsed content.
|
|
33
|
+
|
|
34
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
35
|
+
"""
|
|
36
|
+
return BgpAnnouncesResourceWithRawResponse(self)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_streaming_response(self) -> BgpAnnouncesResourceWithStreamingResponse:
|
|
40
|
+
"""
|
|
41
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
42
|
+
|
|
43
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
44
|
+
"""
|
|
45
|
+
return BgpAnnouncesResourceWithStreamingResponse(self)
|
|
46
|
+
|
|
47
|
+
def list(
|
|
48
|
+
self,
|
|
49
|
+
*,
|
|
50
|
+
announced: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
51
|
+
client_id: Optional[int] | NotGiven = NOT_GIVEN,
|
|
52
|
+
origin: Optional[Literal["STATIC", "DYNAMIC"]] | NotGiven = NOT_GIVEN,
|
|
53
|
+
site: Optional[str] | NotGiven = NOT_GIVEN,
|
|
54
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
55
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
56
|
+
extra_headers: Headers | None = None,
|
|
57
|
+
extra_query: Query | None = None,
|
|
58
|
+
extra_body: Body | None = None,
|
|
59
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
60
|
+
) -> BgpAnnounceListResponse:
|
|
61
|
+
"""Get BGP announces filtered by parameters.
|
|
62
|
+
|
|
63
|
+
Shows announces in active profiles,
|
|
64
|
+
meaning that to get a non-empty response, the client must have at least one
|
|
65
|
+
active profile.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
extra_headers: Send extra headers
|
|
69
|
+
|
|
70
|
+
extra_query: Add additional query parameters to the request
|
|
71
|
+
|
|
72
|
+
extra_body: Add additional JSON properties to the request
|
|
73
|
+
|
|
74
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
75
|
+
"""
|
|
76
|
+
return self._get(
|
|
77
|
+
"/security/sifter/v2/protected_addresses/announces",
|
|
78
|
+
options=make_request_options(
|
|
79
|
+
extra_headers=extra_headers,
|
|
80
|
+
extra_query=extra_query,
|
|
81
|
+
extra_body=extra_body,
|
|
82
|
+
timeout=timeout,
|
|
83
|
+
query=maybe_transform(
|
|
84
|
+
{
|
|
85
|
+
"announced": announced,
|
|
86
|
+
"client_id": client_id,
|
|
87
|
+
"origin": origin,
|
|
88
|
+
"site": site,
|
|
89
|
+
},
|
|
90
|
+
bgp_announce_list_params.BgpAnnounceListParams,
|
|
91
|
+
),
|
|
92
|
+
),
|
|
93
|
+
cast_to=BgpAnnounceListResponse,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
def change(
|
|
97
|
+
self,
|
|
98
|
+
*,
|
|
99
|
+
announce: str,
|
|
100
|
+
enabled: bool,
|
|
101
|
+
client_id: Optional[int] | NotGiven = NOT_GIVEN,
|
|
102
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
103
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
104
|
+
extra_headers: Headers | None = None,
|
|
105
|
+
extra_query: Query | None = None,
|
|
106
|
+
extra_body: Body | None = None,
|
|
107
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
108
|
+
) -> object:
|
|
109
|
+
"""Change BGP announces (it can be enabled or disabled, but not created or
|
|
110
|
+
updated).
|
|
111
|
+
|
|
112
|
+
Can be applied to already existing announces in active profiles,
|
|
113
|
+
meaning that the client must have at least one active profile.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
extra_headers: Send extra headers
|
|
117
|
+
|
|
118
|
+
extra_query: Add additional query parameters to the request
|
|
119
|
+
|
|
120
|
+
extra_body: Add additional JSON properties to the request
|
|
121
|
+
|
|
122
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
123
|
+
"""
|
|
124
|
+
return self._post(
|
|
125
|
+
"/security/sifter/v2/protected_addresses/announces",
|
|
126
|
+
body=maybe_transform(
|
|
127
|
+
{
|
|
128
|
+
"announce": announce,
|
|
129
|
+
"enabled": enabled,
|
|
130
|
+
},
|
|
131
|
+
bgp_announce_change_params.BgpAnnounceChangeParams,
|
|
132
|
+
),
|
|
133
|
+
options=make_request_options(
|
|
134
|
+
extra_headers=extra_headers,
|
|
135
|
+
extra_query=extra_query,
|
|
136
|
+
extra_body=extra_body,
|
|
137
|
+
timeout=timeout,
|
|
138
|
+
query=maybe_transform({"client_id": client_id}, bgp_announce_change_params.BgpAnnounceChangeParams),
|
|
139
|
+
),
|
|
140
|
+
cast_to=object,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class AsyncBgpAnnouncesResource(AsyncAPIResource):
|
|
145
|
+
@cached_property
|
|
146
|
+
def with_raw_response(self) -> AsyncBgpAnnouncesResourceWithRawResponse:
|
|
147
|
+
"""
|
|
148
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
149
|
+
the raw response object instead of the parsed content.
|
|
150
|
+
|
|
151
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
152
|
+
"""
|
|
153
|
+
return AsyncBgpAnnouncesResourceWithRawResponse(self)
|
|
154
|
+
|
|
155
|
+
@cached_property
|
|
156
|
+
def with_streaming_response(self) -> AsyncBgpAnnouncesResourceWithStreamingResponse:
|
|
157
|
+
"""
|
|
158
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
159
|
+
|
|
160
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
161
|
+
"""
|
|
162
|
+
return AsyncBgpAnnouncesResourceWithStreamingResponse(self)
|
|
163
|
+
|
|
164
|
+
async def list(
|
|
165
|
+
self,
|
|
166
|
+
*,
|
|
167
|
+
announced: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
168
|
+
client_id: Optional[int] | NotGiven = NOT_GIVEN,
|
|
169
|
+
origin: Optional[Literal["STATIC", "DYNAMIC"]] | NotGiven = NOT_GIVEN,
|
|
170
|
+
site: Optional[str] | NotGiven = NOT_GIVEN,
|
|
171
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
172
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
173
|
+
extra_headers: Headers | None = None,
|
|
174
|
+
extra_query: Query | None = None,
|
|
175
|
+
extra_body: Body | None = None,
|
|
176
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
177
|
+
) -> BgpAnnounceListResponse:
|
|
178
|
+
"""Get BGP announces filtered by parameters.
|
|
179
|
+
|
|
180
|
+
Shows announces in active profiles,
|
|
181
|
+
meaning that to get a non-empty response, the client must have at least one
|
|
182
|
+
active profile.
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
extra_headers: Send extra headers
|
|
186
|
+
|
|
187
|
+
extra_query: Add additional query parameters to the request
|
|
188
|
+
|
|
189
|
+
extra_body: Add additional JSON properties to the request
|
|
190
|
+
|
|
191
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
192
|
+
"""
|
|
193
|
+
return await self._get(
|
|
194
|
+
"/security/sifter/v2/protected_addresses/announces",
|
|
195
|
+
options=make_request_options(
|
|
196
|
+
extra_headers=extra_headers,
|
|
197
|
+
extra_query=extra_query,
|
|
198
|
+
extra_body=extra_body,
|
|
199
|
+
timeout=timeout,
|
|
200
|
+
query=await async_maybe_transform(
|
|
201
|
+
{
|
|
202
|
+
"announced": announced,
|
|
203
|
+
"client_id": client_id,
|
|
204
|
+
"origin": origin,
|
|
205
|
+
"site": site,
|
|
206
|
+
},
|
|
207
|
+
bgp_announce_list_params.BgpAnnounceListParams,
|
|
208
|
+
),
|
|
209
|
+
),
|
|
210
|
+
cast_to=BgpAnnounceListResponse,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
async def change(
|
|
214
|
+
self,
|
|
215
|
+
*,
|
|
216
|
+
announce: str,
|
|
217
|
+
enabled: bool,
|
|
218
|
+
client_id: Optional[int] | NotGiven = NOT_GIVEN,
|
|
219
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
220
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
221
|
+
extra_headers: Headers | None = None,
|
|
222
|
+
extra_query: Query | None = None,
|
|
223
|
+
extra_body: Body | None = None,
|
|
224
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
225
|
+
) -> object:
|
|
226
|
+
"""Change BGP announces (it can be enabled or disabled, but not created or
|
|
227
|
+
updated).
|
|
228
|
+
|
|
229
|
+
Can be applied to already existing announces in active profiles,
|
|
230
|
+
meaning that the client must have at least one active profile.
|
|
231
|
+
|
|
232
|
+
Args:
|
|
233
|
+
extra_headers: Send extra headers
|
|
234
|
+
|
|
235
|
+
extra_query: Add additional query parameters to the request
|
|
236
|
+
|
|
237
|
+
extra_body: Add additional JSON properties to the request
|
|
238
|
+
|
|
239
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
240
|
+
"""
|
|
241
|
+
return await self._post(
|
|
242
|
+
"/security/sifter/v2/protected_addresses/announces",
|
|
243
|
+
body=await async_maybe_transform(
|
|
244
|
+
{
|
|
245
|
+
"announce": announce,
|
|
246
|
+
"enabled": enabled,
|
|
247
|
+
},
|
|
248
|
+
bgp_announce_change_params.BgpAnnounceChangeParams,
|
|
249
|
+
),
|
|
250
|
+
options=make_request_options(
|
|
251
|
+
extra_headers=extra_headers,
|
|
252
|
+
extra_query=extra_query,
|
|
253
|
+
extra_body=extra_body,
|
|
254
|
+
timeout=timeout,
|
|
255
|
+
query=await async_maybe_transform(
|
|
256
|
+
{"client_id": client_id}, bgp_announce_change_params.BgpAnnounceChangeParams
|
|
257
|
+
),
|
|
258
|
+
),
|
|
259
|
+
cast_to=object,
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
class BgpAnnouncesResourceWithRawResponse:
|
|
264
|
+
def __init__(self, bgp_announces: BgpAnnouncesResource) -> None:
|
|
265
|
+
self._bgp_announces = bgp_announces
|
|
266
|
+
|
|
267
|
+
self.list = to_raw_response_wrapper(
|
|
268
|
+
bgp_announces.list,
|
|
269
|
+
)
|
|
270
|
+
self.change = to_raw_response_wrapper(
|
|
271
|
+
bgp_announces.change,
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class AsyncBgpAnnouncesResourceWithRawResponse:
|
|
276
|
+
def __init__(self, bgp_announces: AsyncBgpAnnouncesResource) -> None:
|
|
277
|
+
self._bgp_announces = bgp_announces
|
|
278
|
+
|
|
279
|
+
self.list = async_to_raw_response_wrapper(
|
|
280
|
+
bgp_announces.list,
|
|
281
|
+
)
|
|
282
|
+
self.change = async_to_raw_response_wrapper(
|
|
283
|
+
bgp_announces.change,
|
|
284
|
+
)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class BgpAnnouncesResourceWithStreamingResponse:
|
|
288
|
+
def __init__(self, bgp_announces: BgpAnnouncesResource) -> None:
|
|
289
|
+
self._bgp_announces = bgp_announces
|
|
290
|
+
|
|
291
|
+
self.list = to_streamed_response_wrapper(
|
|
292
|
+
bgp_announces.list,
|
|
293
|
+
)
|
|
294
|
+
self.change = to_streamed_response_wrapper(
|
|
295
|
+
bgp_announces.change,
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
class AsyncBgpAnnouncesResourceWithStreamingResponse:
|
|
300
|
+
def __init__(self, bgp_announces: AsyncBgpAnnouncesResource) -> None:
|
|
301
|
+
self._bgp_announces = bgp_announces
|
|
302
|
+
|
|
303
|
+
self.list = async_to_streamed_response_wrapper(
|
|
304
|
+
bgp_announces.list,
|
|
305
|
+
)
|
|
306
|
+
self.change = async_to_streamed_response_wrapper(
|
|
307
|
+
bgp_announces.change,
|
|
308
|
+
)
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Union, Optional
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing_extensions import Literal
|
|
8
|
+
|
|
9
|
+
import httpx
|
|
10
|
+
|
|
11
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
12
|
+
from ..._utils import maybe_transform
|
|
13
|
+
from ..._compat import cached_property
|
|
14
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from ..._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from ...pagination import SyncOffsetPage, AsyncOffsetPage
|
|
22
|
+
from ..._base_client import AsyncPaginator, make_request_options
|
|
23
|
+
from ...types.security import event_list_params
|
|
24
|
+
from ...types.security.client_view import ClientView
|
|
25
|
+
|
|
26
|
+
__all__ = ["EventsResource", "AsyncEventsResource"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class EventsResource(SyncAPIResource):
|
|
30
|
+
@cached_property
|
|
31
|
+
def with_raw_response(self) -> EventsResourceWithRawResponse:
|
|
32
|
+
"""
|
|
33
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
34
|
+
the raw response object instead of the parsed content.
|
|
35
|
+
|
|
36
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
37
|
+
"""
|
|
38
|
+
return EventsResourceWithRawResponse(self)
|
|
39
|
+
|
|
40
|
+
@cached_property
|
|
41
|
+
def with_streaming_response(self) -> EventsResourceWithStreamingResponse:
|
|
42
|
+
"""
|
|
43
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
44
|
+
|
|
45
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
46
|
+
"""
|
|
47
|
+
return EventsResourceWithStreamingResponse(self)
|
|
48
|
+
|
|
49
|
+
def list(
|
|
50
|
+
self,
|
|
51
|
+
*,
|
|
52
|
+
alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | NotGiven = NOT_GIVEN,
|
|
53
|
+
date_from: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN,
|
|
54
|
+
date_to: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN,
|
|
55
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
56
|
+
offset: int | NotGiven = NOT_GIVEN,
|
|
57
|
+
ordering: Literal[
|
|
58
|
+
"attack_start_time",
|
|
59
|
+
"-attack_start_time",
|
|
60
|
+
"attack_power_bps",
|
|
61
|
+
"-attack_power_bps",
|
|
62
|
+
"attack_power_pps",
|
|
63
|
+
"-attack_power_pps",
|
|
64
|
+
"number_of_ip_involved_in_attack",
|
|
65
|
+
"-number_of_ip_involved_in_attack",
|
|
66
|
+
"alert_type",
|
|
67
|
+
"-alert_type",
|
|
68
|
+
]
|
|
69
|
+
| NotGiven = NOT_GIVEN,
|
|
70
|
+
targeted_ip_addresses: Optional[str] | NotGiven = NOT_GIVEN,
|
|
71
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
72
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
73
|
+
extra_headers: Headers | None = None,
|
|
74
|
+
extra_query: Query | None = None,
|
|
75
|
+
extra_body: Body | None = None,
|
|
76
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
77
|
+
) -> SyncOffsetPage[ClientView]:
|
|
78
|
+
"""
|
|
79
|
+
Event Logs Clients View
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
extra_headers: Send extra headers
|
|
83
|
+
|
|
84
|
+
extra_query: Add additional query parameters to the request
|
|
85
|
+
|
|
86
|
+
extra_body: Add additional JSON properties to the request
|
|
87
|
+
|
|
88
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
89
|
+
"""
|
|
90
|
+
return self._get_api_list(
|
|
91
|
+
"/security/notifier/v1/event_logs",
|
|
92
|
+
page=SyncOffsetPage[ClientView],
|
|
93
|
+
options=make_request_options(
|
|
94
|
+
extra_headers=extra_headers,
|
|
95
|
+
extra_query=extra_query,
|
|
96
|
+
extra_body=extra_body,
|
|
97
|
+
timeout=timeout,
|
|
98
|
+
query=maybe_transform(
|
|
99
|
+
{
|
|
100
|
+
"alert_type": alert_type,
|
|
101
|
+
"date_from": date_from,
|
|
102
|
+
"date_to": date_to,
|
|
103
|
+
"limit": limit,
|
|
104
|
+
"offset": offset,
|
|
105
|
+
"ordering": ordering,
|
|
106
|
+
"targeted_ip_addresses": targeted_ip_addresses,
|
|
107
|
+
},
|
|
108
|
+
event_list_params.EventListParams,
|
|
109
|
+
),
|
|
110
|
+
),
|
|
111
|
+
model=ClientView,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class AsyncEventsResource(AsyncAPIResource):
|
|
116
|
+
@cached_property
|
|
117
|
+
def with_raw_response(self) -> AsyncEventsResourceWithRawResponse:
|
|
118
|
+
"""
|
|
119
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
120
|
+
the raw response object instead of the parsed content.
|
|
121
|
+
|
|
122
|
+
For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
|
|
123
|
+
"""
|
|
124
|
+
return AsyncEventsResourceWithRawResponse(self)
|
|
125
|
+
|
|
126
|
+
@cached_property
|
|
127
|
+
def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse:
|
|
128
|
+
"""
|
|
129
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
130
|
+
|
|
131
|
+
For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
|
|
132
|
+
"""
|
|
133
|
+
return AsyncEventsResourceWithStreamingResponse(self)
|
|
134
|
+
|
|
135
|
+
def list(
|
|
136
|
+
self,
|
|
137
|
+
*,
|
|
138
|
+
alert_type: Optional[Literal["ddos_alert", "rtbh_alert"]] | NotGiven = NOT_GIVEN,
|
|
139
|
+
date_from: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN,
|
|
140
|
+
date_to: Union[Union[str, datetime], str] | NotGiven = NOT_GIVEN,
|
|
141
|
+
limit: int | NotGiven = NOT_GIVEN,
|
|
142
|
+
offset: int | NotGiven = NOT_GIVEN,
|
|
143
|
+
ordering: Literal[
|
|
144
|
+
"attack_start_time",
|
|
145
|
+
"-attack_start_time",
|
|
146
|
+
"attack_power_bps",
|
|
147
|
+
"-attack_power_bps",
|
|
148
|
+
"attack_power_pps",
|
|
149
|
+
"-attack_power_pps",
|
|
150
|
+
"number_of_ip_involved_in_attack",
|
|
151
|
+
"-number_of_ip_involved_in_attack",
|
|
152
|
+
"alert_type",
|
|
153
|
+
"-alert_type",
|
|
154
|
+
]
|
|
155
|
+
| NotGiven = NOT_GIVEN,
|
|
156
|
+
targeted_ip_addresses: Optional[str] | NotGiven = NOT_GIVEN,
|
|
157
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
158
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
159
|
+
extra_headers: Headers | None = None,
|
|
160
|
+
extra_query: Query | None = None,
|
|
161
|
+
extra_body: Body | None = None,
|
|
162
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
163
|
+
) -> AsyncPaginator[ClientView, AsyncOffsetPage[ClientView]]:
|
|
164
|
+
"""
|
|
165
|
+
Event Logs Clients View
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
extra_headers: Send extra headers
|
|
169
|
+
|
|
170
|
+
extra_query: Add additional query parameters to the request
|
|
171
|
+
|
|
172
|
+
extra_body: Add additional JSON properties to the request
|
|
173
|
+
|
|
174
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
175
|
+
"""
|
|
176
|
+
return self._get_api_list(
|
|
177
|
+
"/security/notifier/v1/event_logs",
|
|
178
|
+
page=AsyncOffsetPage[ClientView],
|
|
179
|
+
options=make_request_options(
|
|
180
|
+
extra_headers=extra_headers,
|
|
181
|
+
extra_query=extra_query,
|
|
182
|
+
extra_body=extra_body,
|
|
183
|
+
timeout=timeout,
|
|
184
|
+
query=maybe_transform(
|
|
185
|
+
{
|
|
186
|
+
"alert_type": alert_type,
|
|
187
|
+
"date_from": date_from,
|
|
188
|
+
"date_to": date_to,
|
|
189
|
+
"limit": limit,
|
|
190
|
+
"offset": offset,
|
|
191
|
+
"ordering": ordering,
|
|
192
|
+
"targeted_ip_addresses": targeted_ip_addresses,
|
|
193
|
+
},
|
|
194
|
+
event_list_params.EventListParams,
|
|
195
|
+
),
|
|
196
|
+
),
|
|
197
|
+
model=ClientView,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class EventsResourceWithRawResponse:
|
|
202
|
+
def __init__(self, events: EventsResource) -> None:
|
|
203
|
+
self._events = events
|
|
204
|
+
|
|
205
|
+
self.list = to_raw_response_wrapper(
|
|
206
|
+
events.list,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
class AsyncEventsResourceWithRawResponse:
|
|
211
|
+
def __init__(self, events: AsyncEventsResource) -> None:
|
|
212
|
+
self._events = events
|
|
213
|
+
|
|
214
|
+
self.list = async_to_raw_response_wrapper(
|
|
215
|
+
events.list,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
class EventsResourceWithStreamingResponse:
|
|
220
|
+
def __init__(self, events: EventsResource) -> None:
|
|
221
|
+
self._events = events
|
|
222
|
+
|
|
223
|
+
self.list = to_streamed_response_wrapper(
|
|
224
|
+
events.list,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
class AsyncEventsResourceWithStreamingResponse:
|
|
229
|
+
def __init__(self, events: AsyncEventsResource) -> None:
|
|
230
|
+
self._events = events
|
|
231
|
+
|
|
232
|
+
self.list = async_to_streamed_response_wrapper(
|
|
233
|
+
events.list,
|
|
234
|
+
)
|