stackit-albwaf 0.0.1__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.
Files changed (55) hide show
  1. src/stackit/albwaf/__init__.py +164 -0
  2. src/stackit/albwaf/api/__init__.py +4 -0
  3. src/stackit/albwaf/api/default_api.py +4611 -0
  4. src/stackit/albwaf/api_client.py +649 -0
  5. src/stackit/albwaf/api_response.py +22 -0
  6. src/stackit/albwaf/configuration.py +162 -0
  7. src/stackit/albwaf/exceptions.py +217 -0
  8. src/stackit/albwaf/models/__init__.py +75 -0
  9. src/stackit/albwaf/models/action.py +37 -0
  10. src/stackit/albwaf/models/behavior.py +99 -0
  11. src/stackit/albwaf/models/condition.py +102 -0
  12. src/stackit/albwaf/models/condition_operator.py +87 -0
  13. src/stackit/albwaf/models/condition_variable.py +87 -0
  14. src/stackit/albwaf/models/create_custom_rule.py +109 -0
  15. src/stackit/albwaf/models/create_custom_rule_group_payload.py +154 -0
  16. src/stackit/albwaf/models/create_managed_rule_set_payload.py +141 -0
  17. src/stackit/albwaf/models/create_waf_payload.py +183 -0
  18. src/stackit/albwaf/models/crg_config_quota.py +87 -0
  19. src/stackit/albwaf/models/crg_usage.py +87 -0
  20. src/stackit/albwaf/models/get_behavior.py +107 -0
  21. src/stackit/albwaf/models/get_custom_rule.py +111 -0
  22. src/stackit/albwaf/models/get_custom_rule_group_response.py +118 -0
  23. src/stackit/albwaf/models/get_limited_managed_rule_set_response.py +119 -0
  24. src/stackit/albwaf/models/get_managed_rule_set_response.py +136 -0
  25. src/stackit/albwaf/models/get_quota_response.py +132 -0
  26. src/stackit/albwaf/models/get_waf_response.py +143 -0
  27. src/stackit/albwaf/models/google_protobuf_any.py +98 -0
  28. src/stackit/albwaf/models/list_custom_rule_group_response.py +121 -0
  29. src/stackit/albwaf/models/list_managed_rule_set_response.py +121 -0
  30. src/stackit/albwaf/models/list_waf_response.py +117 -0
  31. src/stackit/albwaf/models/mode.py +37 -0
  32. src/stackit/albwaf/models/mrs_config_quota.py +88 -0
  33. src/stackit/albwaf/models/mrs_rule.py +99 -0
  34. src/stackit/albwaf/models/mrs_rule_group.py +116 -0
  35. src/stackit/albwaf/models/mrs_usage.py +83 -0
  36. src/stackit/albwaf/models/operator.py +50 -0
  37. src/stackit/albwaf/models/patch_managed_rule_set_payload.py +161 -0
  38. src/stackit/albwaf/models/patch_mrs_rule.py +84 -0
  39. src/stackit/albwaf/models/patch_mrs_rule_group.py +99 -0
  40. src/stackit/albwaf/models/quotas.py +111 -0
  41. src/stackit/albwaf/models/severity.py +42 -0
  42. src/stackit/albwaf/models/status.py +112 -0
  43. src/stackit/albwaf/models/transformation.py +40 -0
  44. src/stackit/albwaf/models/type.py +35 -0
  45. src/stackit/albwaf/models/update_custom_rule_group_payload.py +158 -0
  46. src/stackit/albwaf/models/update_waf_payload.py +185 -0
  47. src/stackit/albwaf/models/variable.py +56 -0
  48. src/stackit/albwaf/models/waf_config_quota.py +88 -0
  49. src/stackit/albwaf/models/waf_usage.py +102 -0
  50. src/stackit/albwaf/models/waf_usage_item.py +91 -0
  51. src/stackit/albwaf/py.typed +0 -0
  52. src/stackit/albwaf/rest.py +163 -0
  53. stackit_albwaf-0.0.1.dist-info/METADATA +45 -0
  54. stackit_albwaf-0.0.1.dist-info/RECORD +55 -0
  55. stackit_albwaf-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,4611 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Application Load Balancer Web Application Firewall API
5
+
6
+ Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have Managed Rule Set (MRS) and in addition can have Custom Rule Group (CRG). To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted.
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ from typing import Any, Dict, List, Optional, Tuple, Union
15
+
16
+ from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
17
+ from stackit.core.configuration import Configuration
18
+ from typing_extensions import Annotated
19
+
20
+ from stackit.albwaf.api_client import ApiClient, RequestSerialized
21
+ from stackit.albwaf.api_response import ApiResponse
22
+ from stackit.albwaf.models.create_custom_rule_group_payload import (
23
+ CreateCustomRuleGroupPayload,
24
+ )
25
+ from stackit.albwaf.models.create_managed_rule_set_payload import (
26
+ CreateManagedRuleSetPayload,
27
+ )
28
+ from stackit.albwaf.models.create_waf_payload import CreateWAFPayload
29
+ from stackit.albwaf.models.get_custom_rule_group_response import (
30
+ GetCustomRuleGroupResponse,
31
+ )
32
+ from stackit.albwaf.models.get_managed_rule_set_response import (
33
+ GetManagedRuleSetResponse,
34
+ )
35
+ from stackit.albwaf.models.get_quota_response import GetQuotaResponse
36
+ from stackit.albwaf.models.get_waf_response import GetWAFResponse
37
+ from stackit.albwaf.models.list_custom_rule_group_response import (
38
+ ListCustomRuleGroupResponse,
39
+ )
40
+ from stackit.albwaf.models.list_managed_rule_set_response import (
41
+ ListManagedRuleSetResponse,
42
+ )
43
+ from stackit.albwaf.models.list_waf_response import ListWAFResponse
44
+ from stackit.albwaf.models.patch_managed_rule_set_payload import (
45
+ PatchManagedRuleSetPayload,
46
+ )
47
+ from stackit.albwaf.models.update_custom_rule_group_payload import (
48
+ UpdateCustomRuleGroupPayload,
49
+ )
50
+ from stackit.albwaf.models.update_waf_payload import UpdateWAFPayload
51
+ from stackit.albwaf.rest import RESTResponseType
52
+
53
+
54
+ class DefaultApi:
55
+ """NOTE: This class is auto generated by OpenAPI Generator
56
+ Ref: https://openapi-generator.tech
57
+
58
+ Do not edit the class manually.
59
+ """
60
+
61
+ def __init__(self, configuration: Configuration = None) -> None:
62
+ if configuration is None:
63
+ configuration = Configuration()
64
+ self.configuration = configuration
65
+ self.api_client = ApiClient(self.configuration)
66
+
67
+ @validate_call
68
+ def create_custom_rule_group(
69
+ self,
70
+ project_id: StrictStr,
71
+ region: StrictStr,
72
+ create_custom_rule_group_payload: CreateCustomRuleGroupPayload,
73
+ _request_timeout: Union[
74
+ None,
75
+ Annotated[StrictFloat, Field(gt=0)],
76
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
77
+ ] = None,
78
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
79
+ _content_type: Optional[StrictStr] = None,
80
+ _headers: Optional[Dict[StrictStr, Any]] = None,
81
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
82
+ ) -> GetCustomRuleGroupResponse:
83
+ """Create a CRG configuration
84
+
85
+ Creates a structured rule configuration using the abstract CRG. It can be referenced by any number of WAF configurations in the same project.
86
+
87
+ :param project_id: (required)
88
+ :type project_id: str
89
+ :param region: (required)
90
+ :type region: str
91
+ :param create_custom_rule_group_payload: (required)
92
+ :type create_custom_rule_group_payload: CreateCustomRuleGroupPayload
93
+ :param _request_timeout: timeout setting for this request. If one
94
+ number provided, it will be total request
95
+ timeout. It can also be a pair (tuple) of
96
+ (connection, read) timeouts.
97
+ :type _request_timeout: int, tuple(int, int), optional
98
+ :param _request_auth: set to override the auth_settings for an a single
99
+ request; this effectively ignores the
100
+ authentication in the spec for a single request.
101
+ :type _request_auth: dict, optional
102
+ :param _content_type: force content-type for the request.
103
+ :type _content_type: str, Optional
104
+ :param _headers: set to override the headers for a single
105
+ request; this effectively ignores the headers
106
+ in the spec for a single request.
107
+ :type _headers: dict, optional
108
+ :param _host_index: set to override the host_index for a single
109
+ request; this effectively ignores the host_index
110
+ in the spec for a single request.
111
+ :type _host_index: int, optional
112
+ :return: Returns the result object.
113
+ """ # noqa: E501
114
+
115
+ _param = self._create_custom_rule_group_serialize(
116
+ project_id=project_id,
117
+ region=region,
118
+ create_custom_rule_group_payload=create_custom_rule_group_payload,
119
+ _request_auth=_request_auth,
120
+ _content_type=_content_type,
121
+ _headers=_headers,
122
+ _host_index=_host_index,
123
+ )
124
+
125
+ _response_types_map: Dict[str, Optional[str]] = {
126
+ "200": "GetCustomRuleGroupResponse",
127
+ "400": None,
128
+ "401": "Status",
129
+ "403": None,
130
+ "429": None,
131
+ "500": None,
132
+ }
133
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
134
+ response_data.read()
135
+ return self.api_client.response_deserialize(
136
+ response_data=response_data,
137
+ response_types_map=_response_types_map,
138
+ ).data
139
+
140
+ @validate_call
141
+ def create_custom_rule_group_with_http_info(
142
+ self,
143
+ project_id: StrictStr,
144
+ region: StrictStr,
145
+ create_custom_rule_group_payload: CreateCustomRuleGroupPayload,
146
+ _request_timeout: Union[
147
+ None,
148
+ Annotated[StrictFloat, Field(gt=0)],
149
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
150
+ ] = None,
151
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
152
+ _content_type: Optional[StrictStr] = None,
153
+ _headers: Optional[Dict[StrictStr, Any]] = None,
154
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
155
+ ) -> ApiResponse[GetCustomRuleGroupResponse]:
156
+ """Create a CRG configuration
157
+
158
+ Creates a structured rule configuration using the abstract CRG. It can be referenced by any number of WAF configurations in the same project.
159
+
160
+ :param project_id: (required)
161
+ :type project_id: str
162
+ :param region: (required)
163
+ :type region: str
164
+ :param create_custom_rule_group_payload: (required)
165
+ :type create_custom_rule_group_payload: CreateCustomRuleGroupPayload
166
+ :param _request_timeout: timeout setting for this request. If one
167
+ number provided, it will be total request
168
+ timeout. It can also be a pair (tuple) of
169
+ (connection, read) timeouts.
170
+ :type _request_timeout: int, tuple(int, int), optional
171
+ :param _request_auth: set to override the auth_settings for an a single
172
+ request; this effectively ignores the
173
+ authentication in the spec for a single request.
174
+ :type _request_auth: dict, optional
175
+ :param _content_type: force content-type for the request.
176
+ :type _content_type: str, Optional
177
+ :param _headers: set to override the headers for a single
178
+ request; this effectively ignores the headers
179
+ in the spec for a single request.
180
+ :type _headers: dict, optional
181
+ :param _host_index: set to override the host_index for a single
182
+ request; this effectively ignores the host_index
183
+ in the spec for a single request.
184
+ :type _host_index: int, optional
185
+ :return: Returns the result object.
186
+ """ # noqa: E501
187
+
188
+ _param = self._create_custom_rule_group_serialize(
189
+ project_id=project_id,
190
+ region=region,
191
+ create_custom_rule_group_payload=create_custom_rule_group_payload,
192
+ _request_auth=_request_auth,
193
+ _content_type=_content_type,
194
+ _headers=_headers,
195
+ _host_index=_host_index,
196
+ )
197
+
198
+ _response_types_map: Dict[str, Optional[str]] = {
199
+ "200": "GetCustomRuleGroupResponse",
200
+ "400": None,
201
+ "401": "Status",
202
+ "403": None,
203
+ "429": None,
204
+ "500": None,
205
+ }
206
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
207
+ response_data.read()
208
+ return self.api_client.response_deserialize(
209
+ response_data=response_data,
210
+ response_types_map=_response_types_map,
211
+ )
212
+
213
+ @validate_call
214
+ def create_custom_rule_group_without_preload_content(
215
+ self,
216
+ project_id: StrictStr,
217
+ region: StrictStr,
218
+ create_custom_rule_group_payload: CreateCustomRuleGroupPayload,
219
+ _request_timeout: Union[
220
+ None,
221
+ Annotated[StrictFloat, Field(gt=0)],
222
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
223
+ ] = None,
224
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
225
+ _content_type: Optional[StrictStr] = None,
226
+ _headers: Optional[Dict[StrictStr, Any]] = None,
227
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
228
+ ) -> RESTResponseType:
229
+ """Create a CRG configuration
230
+
231
+ Creates a structured rule configuration using the abstract CRG. It can be referenced by any number of WAF configurations in the same project.
232
+
233
+ :param project_id: (required)
234
+ :type project_id: str
235
+ :param region: (required)
236
+ :type region: str
237
+ :param create_custom_rule_group_payload: (required)
238
+ :type create_custom_rule_group_payload: CreateCustomRuleGroupPayload
239
+ :param _request_timeout: timeout setting for this request. If one
240
+ number provided, it will be total request
241
+ timeout. It can also be a pair (tuple) of
242
+ (connection, read) timeouts.
243
+ :type _request_timeout: int, tuple(int, int), optional
244
+ :param _request_auth: set to override the auth_settings for an a single
245
+ request; this effectively ignores the
246
+ authentication in the spec for a single request.
247
+ :type _request_auth: dict, optional
248
+ :param _content_type: force content-type for the request.
249
+ :type _content_type: str, Optional
250
+ :param _headers: set to override the headers for a single
251
+ request; this effectively ignores the headers
252
+ in the spec for a single request.
253
+ :type _headers: dict, optional
254
+ :param _host_index: set to override the host_index for a single
255
+ request; this effectively ignores the host_index
256
+ in the spec for a single request.
257
+ :type _host_index: int, optional
258
+ :return: Returns the result object.
259
+ """ # noqa: E501
260
+
261
+ _param = self._create_custom_rule_group_serialize(
262
+ project_id=project_id,
263
+ region=region,
264
+ create_custom_rule_group_payload=create_custom_rule_group_payload,
265
+ _request_auth=_request_auth,
266
+ _content_type=_content_type,
267
+ _headers=_headers,
268
+ _host_index=_host_index,
269
+ )
270
+
271
+ _response_types_map: Dict[str, Optional[str]] = {
272
+ "200": "GetCustomRuleGroupResponse",
273
+ "400": None,
274
+ "401": "Status",
275
+ "403": None,
276
+ "429": None,
277
+ "500": None,
278
+ }
279
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
280
+ return response_data.response
281
+
282
+ def _create_custom_rule_group_serialize(
283
+ self,
284
+ project_id,
285
+ region,
286
+ create_custom_rule_group_payload,
287
+ _request_auth,
288
+ _content_type,
289
+ _headers,
290
+ _host_index,
291
+ ) -> RequestSerialized:
292
+
293
+ _host = None
294
+
295
+ _collection_formats: Dict[str, str] = {}
296
+
297
+ _path_params: Dict[str, str] = {}
298
+ _query_params: List[Tuple[str, str]] = []
299
+ _header_params: Dict[str, Optional[str]] = _headers or {}
300
+ _form_params: List[Tuple[str, str]] = []
301
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
302
+ _body_params: Optional[bytes] = None
303
+
304
+ # process the path parameters
305
+ if project_id is not None:
306
+ _path_params["projectId"] = project_id
307
+ if region is not None:
308
+ _path_params["region"] = region
309
+ # process the query parameters
310
+ # process the header parameters
311
+ # process the form parameters
312
+ # process the body parameter
313
+ if create_custom_rule_group_payload is not None:
314
+ _body_params = create_custom_rule_group_payload
315
+
316
+ # set the HTTP header `Accept`
317
+ if "Accept" not in _header_params:
318
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
319
+
320
+ # set the HTTP header `Content-Type`
321
+ if _content_type:
322
+ _header_params["Content-Type"] = _content_type
323
+ else:
324
+ _default_content_type = self.api_client.select_header_content_type(["application/json"])
325
+ if _default_content_type is not None:
326
+ _header_params["Content-Type"] = _default_content_type
327
+
328
+ # authentication setting
329
+ _auth_settings: List[str] = []
330
+
331
+ return self.api_client.param_serialize(
332
+ method="POST",
333
+ resource_path="/v1/projects/{projectId}/regions/{region}/custom-rule-groups",
334
+ path_params=_path_params,
335
+ query_params=_query_params,
336
+ header_params=_header_params,
337
+ body=_body_params,
338
+ post_params=_form_params,
339
+ files=_files,
340
+ auth_settings=_auth_settings,
341
+ collection_formats=_collection_formats,
342
+ _host=_host,
343
+ _request_auth=_request_auth,
344
+ )
345
+
346
+ @validate_call
347
+ def create_managed_rule_set(
348
+ self,
349
+ project_id: StrictStr,
350
+ region: StrictStr,
351
+ create_managed_rule_set_payload: CreateManagedRuleSetPayload,
352
+ _request_timeout: Union[
353
+ None,
354
+ Annotated[StrictFloat, Field(gt=0)],
355
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
356
+ ] = None,
357
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
358
+ _content_type: Optional[StrictStr] = None,
359
+ _headers: Optional[Dict[StrictStr, Any]] = None,
360
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
361
+ ) -> GetManagedRuleSetResponse:
362
+ """Create a MRS configuration
363
+
364
+ With this endpoint a managed rule set (MRS) configuration is created and stored in this project. Currently it is only possible to enable it. This rule configuration is supposed to be referenced by a WAF configuration. It can be referenced by any number of WAF configurations in the same project.
365
+
366
+ :param project_id: (required)
367
+ :type project_id: str
368
+ :param region: (required)
369
+ :type region: str
370
+ :param create_managed_rule_set_payload: (required)
371
+ :type create_managed_rule_set_payload: CreateManagedRuleSetPayload
372
+ :param _request_timeout: timeout setting for this request. If one
373
+ number provided, it will be total request
374
+ timeout. It can also be a pair (tuple) of
375
+ (connection, read) timeouts.
376
+ :type _request_timeout: int, tuple(int, int), optional
377
+ :param _request_auth: set to override the auth_settings for an a single
378
+ request; this effectively ignores the
379
+ authentication in the spec for a single request.
380
+ :type _request_auth: dict, optional
381
+ :param _content_type: force content-type for the request.
382
+ :type _content_type: str, Optional
383
+ :param _headers: set to override the headers for a single
384
+ request; this effectively ignores the headers
385
+ in the spec for a single request.
386
+ :type _headers: dict, optional
387
+ :param _host_index: set to override the host_index for a single
388
+ request; this effectively ignores the host_index
389
+ in the spec for a single request.
390
+ :type _host_index: int, optional
391
+ :return: Returns the result object.
392
+ """ # noqa: E501
393
+
394
+ _param = self._create_managed_rule_set_serialize(
395
+ project_id=project_id,
396
+ region=region,
397
+ create_managed_rule_set_payload=create_managed_rule_set_payload,
398
+ _request_auth=_request_auth,
399
+ _content_type=_content_type,
400
+ _headers=_headers,
401
+ _host_index=_host_index,
402
+ )
403
+
404
+ _response_types_map: Dict[str, Optional[str]] = {
405
+ "200": "GetManagedRuleSetResponse",
406
+ "400": None,
407
+ "401": "Status",
408
+ "403": None,
409
+ "429": None,
410
+ "500": None,
411
+ }
412
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
413
+ response_data.read()
414
+ return self.api_client.response_deserialize(
415
+ response_data=response_data,
416
+ response_types_map=_response_types_map,
417
+ ).data
418
+
419
+ @validate_call
420
+ def create_managed_rule_set_with_http_info(
421
+ self,
422
+ project_id: StrictStr,
423
+ region: StrictStr,
424
+ create_managed_rule_set_payload: CreateManagedRuleSetPayload,
425
+ _request_timeout: Union[
426
+ None,
427
+ Annotated[StrictFloat, Field(gt=0)],
428
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
429
+ ] = None,
430
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
431
+ _content_type: Optional[StrictStr] = None,
432
+ _headers: Optional[Dict[StrictStr, Any]] = None,
433
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
434
+ ) -> ApiResponse[GetManagedRuleSetResponse]:
435
+ """Create a MRS configuration
436
+
437
+ With this endpoint a managed rule set (MRS) configuration is created and stored in this project. Currently it is only possible to enable it. This rule configuration is supposed to be referenced by a WAF configuration. It can be referenced by any number of WAF configurations in the same project.
438
+
439
+ :param project_id: (required)
440
+ :type project_id: str
441
+ :param region: (required)
442
+ :type region: str
443
+ :param create_managed_rule_set_payload: (required)
444
+ :type create_managed_rule_set_payload: CreateManagedRuleSetPayload
445
+ :param _request_timeout: timeout setting for this request. If one
446
+ number provided, it will be total request
447
+ timeout. It can also be a pair (tuple) of
448
+ (connection, read) timeouts.
449
+ :type _request_timeout: int, tuple(int, int), optional
450
+ :param _request_auth: set to override the auth_settings for an a single
451
+ request; this effectively ignores the
452
+ authentication in the spec for a single request.
453
+ :type _request_auth: dict, optional
454
+ :param _content_type: force content-type for the request.
455
+ :type _content_type: str, Optional
456
+ :param _headers: set to override the headers for a single
457
+ request; this effectively ignores the headers
458
+ in the spec for a single request.
459
+ :type _headers: dict, optional
460
+ :param _host_index: set to override the host_index for a single
461
+ request; this effectively ignores the host_index
462
+ in the spec for a single request.
463
+ :type _host_index: int, optional
464
+ :return: Returns the result object.
465
+ """ # noqa: E501
466
+
467
+ _param = self._create_managed_rule_set_serialize(
468
+ project_id=project_id,
469
+ region=region,
470
+ create_managed_rule_set_payload=create_managed_rule_set_payload,
471
+ _request_auth=_request_auth,
472
+ _content_type=_content_type,
473
+ _headers=_headers,
474
+ _host_index=_host_index,
475
+ )
476
+
477
+ _response_types_map: Dict[str, Optional[str]] = {
478
+ "200": "GetManagedRuleSetResponse",
479
+ "400": None,
480
+ "401": "Status",
481
+ "403": None,
482
+ "429": None,
483
+ "500": None,
484
+ }
485
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
486
+ response_data.read()
487
+ return self.api_client.response_deserialize(
488
+ response_data=response_data,
489
+ response_types_map=_response_types_map,
490
+ )
491
+
492
+ @validate_call
493
+ def create_managed_rule_set_without_preload_content(
494
+ self,
495
+ project_id: StrictStr,
496
+ region: StrictStr,
497
+ create_managed_rule_set_payload: CreateManagedRuleSetPayload,
498
+ _request_timeout: Union[
499
+ None,
500
+ Annotated[StrictFloat, Field(gt=0)],
501
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
502
+ ] = None,
503
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
504
+ _content_type: Optional[StrictStr] = None,
505
+ _headers: Optional[Dict[StrictStr, Any]] = None,
506
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
507
+ ) -> RESTResponseType:
508
+ """Create a MRS configuration
509
+
510
+ With this endpoint a managed rule set (MRS) configuration is created and stored in this project. Currently it is only possible to enable it. This rule configuration is supposed to be referenced by a WAF configuration. It can be referenced by any number of WAF configurations in the same project.
511
+
512
+ :param project_id: (required)
513
+ :type project_id: str
514
+ :param region: (required)
515
+ :type region: str
516
+ :param create_managed_rule_set_payload: (required)
517
+ :type create_managed_rule_set_payload: CreateManagedRuleSetPayload
518
+ :param _request_timeout: timeout setting for this request. If one
519
+ number provided, it will be total request
520
+ timeout. It can also be a pair (tuple) of
521
+ (connection, read) timeouts.
522
+ :type _request_timeout: int, tuple(int, int), optional
523
+ :param _request_auth: set to override the auth_settings for an a single
524
+ request; this effectively ignores the
525
+ authentication in the spec for a single request.
526
+ :type _request_auth: dict, optional
527
+ :param _content_type: force content-type for the request.
528
+ :type _content_type: str, Optional
529
+ :param _headers: set to override the headers for a single
530
+ request; this effectively ignores the headers
531
+ in the spec for a single request.
532
+ :type _headers: dict, optional
533
+ :param _host_index: set to override the host_index for a single
534
+ request; this effectively ignores the host_index
535
+ in the spec for a single request.
536
+ :type _host_index: int, optional
537
+ :return: Returns the result object.
538
+ """ # noqa: E501
539
+
540
+ _param = self._create_managed_rule_set_serialize(
541
+ project_id=project_id,
542
+ region=region,
543
+ create_managed_rule_set_payload=create_managed_rule_set_payload,
544
+ _request_auth=_request_auth,
545
+ _content_type=_content_type,
546
+ _headers=_headers,
547
+ _host_index=_host_index,
548
+ )
549
+
550
+ _response_types_map: Dict[str, Optional[str]] = {
551
+ "200": "GetManagedRuleSetResponse",
552
+ "400": None,
553
+ "401": "Status",
554
+ "403": None,
555
+ "429": None,
556
+ "500": None,
557
+ }
558
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
559
+ return response_data.response
560
+
561
+ def _create_managed_rule_set_serialize(
562
+ self,
563
+ project_id,
564
+ region,
565
+ create_managed_rule_set_payload,
566
+ _request_auth,
567
+ _content_type,
568
+ _headers,
569
+ _host_index,
570
+ ) -> RequestSerialized:
571
+
572
+ _host = None
573
+
574
+ _collection_formats: Dict[str, str] = {}
575
+
576
+ _path_params: Dict[str, str] = {}
577
+ _query_params: List[Tuple[str, str]] = []
578
+ _header_params: Dict[str, Optional[str]] = _headers or {}
579
+ _form_params: List[Tuple[str, str]] = []
580
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
581
+ _body_params: Optional[bytes] = None
582
+
583
+ # process the path parameters
584
+ if project_id is not None:
585
+ _path_params["projectId"] = project_id
586
+ if region is not None:
587
+ _path_params["region"] = region
588
+ # process the query parameters
589
+ # process the header parameters
590
+ # process the form parameters
591
+ # process the body parameter
592
+ if create_managed_rule_set_payload is not None:
593
+ _body_params = create_managed_rule_set_payload
594
+
595
+ # set the HTTP header `Accept`
596
+ if "Accept" not in _header_params:
597
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
598
+
599
+ # set the HTTP header `Content-Type`
600
+ if _content_type:
601
+ _header_params["Content-Type"] = _content_type
602
+ else:
603
+ _default_content_type = self.api_client.select_header_content_type(["application/json"])
604
+ if _default_content_type is not None:
605
+ _header_params["Content-Type"] = _default_content_type
606
+
607
+ # authentication setting
608
+ _auth_settings: List[str] = []
609
+
610
+ return self.api_client.param_serialize(
611
+ method="POST",
612
+ resource_path="/v1/projects/{projectId}/regions/{region}/managed-rule-sets",
613
+ path_params=_path_params,
614
+ query_params=_query_params,
615
+ header_params=_header_params,
616
+ body=_body_params,
617
+ post_params=_form_params,
618
+ files=_files,
619
+ auth_settings=_auth_settings,
620
+ collection_formats=_collection_formats,
621
+ _host=_host,
622
+ _request_auth=_request_auth,
623
+ )
624
+
625
+ @validate_call
626
+ def create_waf(
627
+ self,
628
+ project_id: StrictStr,
629
+ region: StrictStr,
630
+ create_waf_payload: CreateWAFPayload,
631
+ _request_timeout: Union[
632
+ None,
633
+ Annotated[StrictFloat, Field(gt=0)],
634
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
635
+ ] = None,
636
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
637
+ _content_type: Optional[StrictStr] = None,
638
+ _headers: Optional[Dict[StrictStr, Any]] = None,
639
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
640
+ ) -> GetWAFResponse:
641
+ """Create a WAF configuration
642
+
643
+ This endpoint will create and store a WAF configuration in a project. The name of this WAF configuration is supposed to be used in the listener of an Application Load Balancer, which will activate this configuration and in addition it is possible to enable the managed rule set. This WAF configuration can be used by any number of Application Load Balancers in the same project. The configuration has a reference to a rule configuration. This rule configuration has to exist when trying to create a WAF configuration. Later other configuration references will be added to this object.
644
+
645
+ :param project_id: (required)
646
+ :type project_id: str
647
+ :param region: (required)
648
+ :type region: str
649
+ :param create_waf_payload: (required)
650
+ :type create_waf_payload: CreateWAFPayload
651
+ :param _request_timeout: timeout setting for this request. If one
652
+ number provided, it will be total request
653
+ timeout. It can also be a pair (tuple) of
654
+ (connection, read) timeouts.
655
+ :type _request_timeout: int, tuple(int, int), optional
656
+ :param _request_auth: set to override the auth_settings for an a single
657
+ request; this effectively ignores the
658
+ authentication in the spec for a single request.
659
+ :type _request_auth: dict, optional
660
+ :param _content_type: force content-type for the request.
661
+ :type _content_type: str, Optional
662
+ :param _headers: set to override the headers for a single
663
+ request; this effectively ignores the headers
664
+ in the spec for a single request.
665
+ :type _headers: dict, optional
666
+ :param _host_index: set to override the host_index for a single
667
+ request; this effectively ignores the host_index
668
+ in the spec for a single request.
669
+ :type _host_index: int, optional
670
+ :return: Returns the result object.
671
+ """ # noqa: E501
672
+
673
+ _param = self._create_waf_serialize(
674
+ project_id=project_id,
675
+ region=region,
676
+ create_waf_payload=create_waf_payload,
677
+ _request_auth=_request_auth,
678
+ _content_type=_content_type,
679
+ _headers=_headers,
680
+ _host_index=_host_index,
681
+ )
682
+
683
+ _response_types_map: Dict[str, Optional[str]] = {
684
+ "200": "GetWAFResponse",
685
+ "400": None,
686
+ "401": "Status",
687
+ "403": None,
688
+ "429": None,
689
+ "500": None,
690
+ }
691
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
692
+ response_data.read()
693
+ return self.api_client.response_deserialize(
694
+ response_data=response_data,
695
+ response_types_map=_response_types_map,
696
+ ).data
697
+
698
+ @validate_call
699
+ def create_waf_with_http_info(
700
+ self,
701
+ project_id: StrictStr,
702
+ region: StrictStr,
703
+ create_waf_payload: CreateWAFPayload,
704
+ _request_timeout: Union[
705
+ None,
706
+ Annotated[StrictFloat, Field(gt=0)],
707
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
708
+ ] = None,
709
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
710
+ _content_type: Optional[StrictStr] = None,
711
+ _headers: Optional[Dict[StrictStr, Any]] = None,
712
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
713
+ ) -> ApiResponse[GetWAFResponse]:
714
+ """Create a WAF configuration
715
+
716
+ This endpoint will create and store a WAF configuration in a project. The name of this WAF configuration is supposed to be used in the listener of an Application Load Balancer, which will activate this configuration and in addition it is possible to enable the managed rule set. This WAF configuration can be used by any number of Application Load Balancers in the same project. The configuration has a reference to a rule configuration. This rule configuration has to exist when trying to create a WAF configuration. Later other configuration references will be added to this object.
717
+
718
+ :param project_id: (required)
719
+ :type project_id: str
720
+ :param region: (required)
721
+ :type region: str
722
+ :param create_waf_payload: (required)
723
+ :type create_waf_payload: CreateWAFPayload
724
+ :param _request_timeout: timeout setting for this request. If one
725
+ number provided, it will be total request
726
+ timeout. It can also be a pair (tuple) of
727
+ (connection, read) timeouts.
728
+ :type _request_timeout: int, tuple(int, int), optional
729
+ :param _request_auth: set to override the auth_settings for an a single
730
+ request; this effectively ignores the
731
+ authentication in the spec for a single request.
732
+ :type _request_auth: dict, optional
733
+ :param _content_type: force content-type for the request.
734
+ :type _content_type: str, Optional
735
+ :param _headers: set to override the headers for a single
736
+ request; this effectively ignores the headers
737
+ in the spec for a single request.
738
+ :type _headers: dict, optional
739
+ :param _host_index: set to override the host_index for a single
740
+ request; this effectively ignores the host_index
741
+ in the spec for a single request.
742
+ :type _host_index: int, optional
743
+ :return: Returns the result object.
744
+ """ # noqa: E501
745
+
746
+ _param = self._create_waf_serialize(
747
+ project_id=project_id,
748
+ region=region,
749
+ create_waf_payload=create_waf_payload,
750
+ _request_auth=_request_auth,
751
+ _content_type=_content_type,
752
+ _headers=_headers,
753
+ _host_index=_host_index,
754
+ )
755
+
756
+ _response_types_map: Dict[str, Optional[str]] = {
757
+ "200": "GetWAFResponse",
758
+ "400": None,
759
+ "401": "Status",
760
+ "403": None,
761
+ "429": None,
762
+ "500": None,
763
+ }
764
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
765
+ response_data.read()
766
+ return self.api_client.response_deserialize(
767
+ response_data=response_data,
768
+ response_types_map=_response_types_map,
769
+ )
770
+
771
+ @validate_call
772
+ def create_waf_without_preload_content(
773
+ self,
774
+ project_id: StrictStr,
775
+ region: StrictStr,
776
+ create_waf_payload: CreateWAFPayload,
777
+ _request_timeout: Union[
778
+ None,
779
+ Annotated[StrictFloat, Field(gt=0)],
780
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
781
+ ] = None,
782
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
783
+ _content_type: Optional[StrictStr] = None,
784
+ _headers: Optional[Dict[StrictStr, Any]] = None,
785
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
786
+ ) -> RESTResponseType:
787
+ """Create a WAF configuration
788
+
789
+ This endpoint will create and store a WAF configuration in a project. The name of this WAF configuration is supposed to be used in the listener of an Application Load Balancer, which will activate this configuration and in addition it is possible to enable the managed rule set. This WAF configuration can be used by any number of Application Load Balancers in the same project. The configuration has a reference to a rule configuration. This rule configuration has to exist when trying to create a WAF configuration. Later other configuration references will be added to this object.
790
+
791
+ :param project_id: (required)
792
+ :type project_id: str
793
+ :param region: (required)
794
+ :type region: str
795
+ :param create_waf_payload: (required)
796
+ :type create_waf_payload: CreateWAFPayload
797
+ :param _request_timeout: timeout setting for this request. If one
798
+ number provided, it will be total request
799
+ timeout. It can also be a pair (tuple) of
800
+ (connection, read) timeouts.
801
+ :type _request_timeout: int, tuple(int, int), optional
802
+ :param _request_auth: set to override the auth_settings for an a single
803
+ request; this effectively ignores the
804
+ authentication in the spec for a single request.
805
+ :type _request_auth: dict, optional
806
+ :param _content_type: force content-type for the request.
807
+ :type _content_type: str, Optional
808
+ :param _headers: set to override the headers for a single
809
+ request; this effectively ignores the headers
810
+ in the spec for a single request.
811
+ :type _headers: dict, optional
812
+ :param _host_index: set to override the host_index for a single
813
+ request; this effectively ignores the host_index
814
+ in the spec for a single request.
815
+ :type _host_index: int, optional
816
+ :return: Returns the result object.
817
+ """ # noqa: E501
818
+
819
+ _param = self._create_waf_serialize(
820
+ project_id=project_id,
821
+ region=region,
822
+ create_waf_payload=create_waf_payload,
823
+ _request_auth=_request_auth,
824
+ _content_type=_content_type,
825
+ _headers=_headers,
826
+ _host_index=_host_index,
827
+ )
828
+
829
+ _response_types_map: Dict[str, Optional[str]] = {
830
+ "200": "GetWAFResponse",
831
+ "400": None,
832
+ "401": "Status",
833
+ "403": None,
834
+ "429": None,
835
+ "500": None,
836
+ }
837
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
838
+ return response_data.response
839
+
840
+ def _create_waf_serialize(
841
+ self,
842
+ project_id,
843
+ region,
844
+ create_waf_payload,
845
+ _request_auth,
846
+ _content_type,
847
+ _headers,
848
+ _host_index,
849
+ ) -> RequestSerialized:
850
+
851
+ _host = None
852
+
853
+ _collection_formats: Dict[str, str] = {}
854
+
855
+ _path_params: Dict[str, str] = {}
856
+ _query_params: List[Tuple[str, str]] = []
857
+ _header_params: Dict[str, Optional[str]] = _headers or {}
858
+ _form_params: List[Tuple[str, str]] = []
859
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
860
+ _body_params: Optional[bytes] = None
861
+
862
+ # process the path parameters
863
+ if project_id is not None:
864
+ _path_params["projectId"] = project_id
865
+ if region is not None:
866
+ _path_params["region"] = region
867
+ # process the query parameters
868
+ # process the header parameters
869
+ # process the form parameters
870
+ # process the body parameter
871
+ if create_waf_payload is not None:
872
+ _body_params = create_waf_payload
873
+
874
+ # set the HTTP header `Accept`
875
+ if "Accept" not in _header_params:
876
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
877
+
878
+ # set the HTTP header `Content-Type`
879
+ if _content_type:
880
+ _header_params["Content-Type"] = _content_type
881
+ else:
882
+ _default_content_type = self.api_client.select_header_content_type(["application/json"])
883
+ if _default_content_type is not None:
884
+ _header_params["Content-Type"] = _default_content_type
885
+
886
+ # authentication setting
887
+ _auth_settings: List[str] = []
888
+
889
+ return self.api_client.param_serialize(
890
+ method="POST",
891
+ resource_path="/v1/projects/{projectId}/regions/{region}/wafs",
892
+ path_params=_path_params,
893
+ query_params=_query_params,
894
+ header_params=_header_params,
895
+ body=_body_params,
896
+ post_params=_form_params,
897
+ files=_files,
898
+ auth_settings=_auth_settings,
899
+ collection_formats=_collection_formats,
900
+ _host=_host,
901
+ _request_auth=_request_auth,
902
+ )
903
+
904
+ @validate_call
905
+ def delete_custom_rule_group(
906
+ self,
907
+ project_id: StrictStr,
908
+ region: StrictStr,
909
+ name: StrictStr,
910
+ _request_timeout: Union[
911
+ None,
912
+ Annotated[StrictFloat, Field(gt=0)],
913
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
914
+ ] = None,
915
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
916
+ _content_type: Optional[StrictStr] = None,
917
+ _headers: Optional[Dict[StrictStr, Any]] = None,
918
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
919
+ ) -> object:
920
+ """Delete a CRG configuration
921
+
922
+ To delete a custom rule group configuration this endpoint is used, but it is only possible to delete it if no WAF configuration is referencing it.
923
+
924
+ :param project_id: (required)
925
+ :type project_id: str
926
+ :param region: (required)
927
+ :type region: str
928
+ :param name: (required)
929
+ :type name: str
930
+ :param _request_timeout: timeout setting for this request. If one
931
+ number provided, it will be total request
932
+ timeout. It can also be a pair (tuple) of
933
+ (connection, read) timeouts.
934
+ :type _request_timeout: int, tuple(int, int), optional
935
+ :param _request_auth: set to override the auth_settings for an a single
936
+ request; this effectively ignores the
937
+ authentication in the spec for a single request.
938
+ :type _request_auth: dict, optional
939
+ :param _content_type: force content-type for the request.
940
+ :type _content_type: str, Optional
941
+ :param _headers: set to override the headers for a single
942
+ request; this effectively ignores the headers
943
+ in the spec for a single request.
944
+ :type _headers: dict, optional
945
+ :param _host_index: set to override the host_index for a single
946
+ request; this effectively ignores the host_index
947
+ in the spec for a single request.
948
+ :type _host_index: int, optional
949
+ :return: Returns the result object.
950
+ """ # noqa: E501
951
+
952
+ _param = self._delete_custom_rule_group_serialize(
953
+ project_id=project_id,
954
+ region=region,
955
+ name=name,
956
+ _request_auth=_request_auth,
957
+ _content_type=_content_type,
958
+ _headers=_headers,
959
+ _host_index=_host_index,
960
+ )
961
+
962
+ _response_types_map: Dict[str, Optional[str]] = {
963
+ "200": "object",
964
+ "400": None,
965
+ "401": "Status",
966
+ "403": None,
967
+ "500": None,
968
+ }
969
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
970
+ response_data.read()
971
+ return self.api_client.response_deserialize(
972
+ response_data=response_data,
973
+ response_types_map=_response_types_map,
974
+ ).data
975
+
976
+ @validate_call
977
+ def delete_custom_rule_group_with_http_info(
978
+ self,
979
+ project_id: StrictStr,
980
+ region: StrictStr,
981
+ name: StrictStr,
982
+ _request_timeout: Union[
983
+ None,
984
+ Annotated[StrictFloat, Field(gt=0)],
985
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
986
+ ] = None,
987
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
988
+ _content_type: Optional[StrictStr] = None,
989
+ _headers: Optional[Dict[StrictStr, Any]] = None,
990
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
991
+ ) -> ApiResponse[object]:
992
+ """Delete a CRG configuration
993
+
994
+ To delete a custom rule group configuration this endpoint is used, but it is only possible to delete it if no WAF configuration is referencing it.
995
+
996
+ :param project_id: (required)
997
+ :type project_id: str
998
+ :param region: (required)
999
+ :type region: str
1000
+ :param name: (required)
1001
+ :type name: str
1002
+ :param _request_timeout: timeout setting for this request. If one
1003
+ number provided, it will be total request
1004
+ timeout. It can also be a pair (tuple) of
1005
+ (connection, read) timeouts.
1006
+ :type _request_timeout: int, tuple(int, int), optional
1007
+ :param _request_auth: set to override the auth_settings for an a single
1008
+ request; this effectively ignores the
1009
+ authentication in the spec for a single request.
1010
+ :type _request_auth: dict, optional
1011
+ :param _content_type: force content-type for the request.
1012
+ :type _content_type: str, Optional
1013
+ :param _headers: set to override the headers for a single
1014
+ request; this effectively ignores the headers
1015
+ in the spec for a single request.
1016
+ :type _headers: dict, optional
1017
+ :param _host_index: set to override the host_index for a single
1018
+ request; this effectively ignores the host_index
1019
+ in the spec for a single request.
1020
+ :type _host_index: int, optional
1021
+ :return: Returns the result object.
1022
+ """ # noqa: E501
1023
+
1024
+ _param = self._delete_custom_rule_group_serialize(
1025
+ project_id=project_id,
1026
+ region=region,
1027
+ name=name,
1028
+ _request_auth=_request_auth,
1029
+ _content_type=_content_type,
1030
+ _headers=_headers,
1031
+ _host_index=_host_index,
1032
+ )
1033
+
1034
+ _response_types_map: Dict[str, Optional[str]] = {
1035
+ "200": "object",
1036
+ "400": None,
1037
+ "401": "Status",
1038
+ "403": None,
1039
+ "500": None,
1040
+ }
1041
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1042
+ response_data.read()
1043
+ return self.api_client.response_deserialize(
1044
+ response_data=response_data,
1045
+ response_types_map=_response_types_map,
1046
+ )
1047
+
1048
+ @validate_call
1049
+ def delete_custom_rule_group_without_preload_content(
1050
+ self,
1051
+ project_id: StrictStr,
1052
+ region: StrictStr,
1053
+ name: StrictStr,
1054
+ _request_timeout: Union[
1055
+ None,
1056
+ Annotated[StrictFloat, Field(gt=0)],
1057
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1058
+ ] = None,
1059
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1060
+ _content_type: Optional[StrictStr] = None,
1061
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1062
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1063
+ ) -> RESTResponseType:
1064
+ """Delete a CRG configuration
1065
+
1066
+ To delete a custom rule group configuration this endpoint is used, but it is only possible to delete it if no WAF configuration is referencing it.
1067
+
1068
+ :param project_id: (required)
1069
+ :type project_id: str
1070
+ :param region: (required)
1071
+ :type region: str
1072
+ :param name: (required)
1073
+ :type name: str
1074
+ :param _request_timeout: timeout setting for this request. If one
1075
+ number provided, it will be total request
1076
+ timeout. It can also be a pair (tuple) of
1077
+ (connection, read) timeouts.
1078
+ :type _request_timeout: int, tuple(int, int), optional
1079
+ :param _request_auth: set to override the auth_settings for an a single
1080
+ request; this effectively ignores the
1081
+ authentication in the spec for a single request.
1082
+ :type _request_auth: dict, optional
1083
+ :param _content_type: force content-type for the request.
1084
+ :type _content_type: str, Optional
1085
+ :param _headers: set to override the headers for a single
1086
+ request; this effectively ignores the headers
1087
+ in the spec for a single request.
1088
+ :type _headers: dict, optional
1089
+ :param _host_index: set to override the host_index for a single
1090
+ request; this effectively ignores the host_index
1091
+ in the spec for a single request.
1092
+ :type _host_index: int, optional
1093
+ :return: Returns the result object.
1094
+ """ # noqa: E501
1095
+
1096
+ _param = self._delete_custom_rule_group_serialize(
1097
+ project_id=project_id,
1098
+ region=region,
1099
+ name=name,
1100
+ _request_auth=_request_auth,
1101
+ _content_type=_content_type,
1102
+ _headers=_headers,
1103
+ _host_index=_host_index,
1104
+ )
1105
+
1106
+ _response_types_map: Dict[str, Optional[str]] = {
1107
+ "200": "object",
1108
+ "400": None,
1109
+ "401": "Status",
1110
+ "403": None,
1111
+ "500": None,
1112
+ }
1113
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1114
+ return response_data.response
1115
+
1116
+ def _delete_custom_rule_group_serialize(
1117
+ self,
1118
+ project_id,
1119
+ region,
1120
+ name,
1121
+ _request_auth,
1122
+ _content_type,
1123
+ _headers,
1124
+ _host_index,
1125
+ ) -> RequestSerialized:
1126
+
1127
+ _host = None
1128
+
1129
+ _collection_formats: Dict[str, str] = {}
1130
+
1131
+ _path_params: Dict[str, str] = {}
1132
+ _query_params: List[Tuple[str, str]] = []
1133
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1134
+ _form_params: List[Tuple[str, str]] = []
1135
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
1136
+ _body_params: Optional[bytes] = None
1137
+
1138
+ # process the path parameters
1139
+ if project_id is not None:
1140
+ _path_params["projectId"] = project_id
1141
+ if region is not None:
1142
+ _path_params["region"] = region
1143
+ if name is not None:
1144
+ _path_params["name"] = name
1145
+ # process the query parameters
1146
+ # process the header parameters
1147
+ # process the form parameters
1148
+ # process the body parameter
1149
+
1150
+ # set the HTTP header `Accept`
1151
+ if "Accept" not in _header_params:
1152
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
1153
+
1154
+ # authentication setting
1155
+ _auth_settings: List[str] = []
1156
+
1157
+ return self.api_client.param_serialize(
1158
+ method="DELETE",
1159
+ resource_path="/v1/projects/{projectId}/regions/{region}/custom-rule-groups/{name}",
1160
+ path_params=_path_params,
1161
+ query_params=_query_params,
1162
+ header_params=_header_params,
1163
+ body=_body_params,
1164
+ post_params=_form_params,
1165
+ files=_files,
1166
+ auth_settings=_auth_settings,
1167
+ collection_formats=_collection_formats,
1168
+ _host=_host,
1169
+ _request_auth=_request_auth,
1170
+ )
1171
+
1172
+ @validate_call
1173
+ def delete_managed_rule_set(
1174
+ self,
1175
+ project_id: StrictStr,
1176
+ region: StrictStr,
1177
+ name: StrictStr,
1178
+ _request_timeout: Union[
1179
+ None,
1180
+ Annotated[StrictFloat, Field(gt=0)],
1181
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1182
+ ] = None,
1183
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1184
+ _content_type: Optional[StrictStr] = None,
1185
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1186
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1187
+ ) -> object:
1188
+ """Delete a MRS configuration
1189
+
1190
+ To delete a managed rule set (MRS) configuration this endpoint is used, but it is only possible to delete it if no WAF configuration is referencing it.
1191
+
1192
+ :param project_id: (required)
1193
+ :type project_id: str
1194
+ :param region: (required)
1195
+ :type region: str
1196
+ :param name: (required)
1197
+ :type name: str
1198
+ :param _request_timeout: timeout setting for this request. If one
1199
+ number provided, it will be total request
1200
+ timeout. It can also be a pair (tuple) of
1201
+ (connection, read) timeouts.
1202
+ :type _request_timeout: int, tuple(int, int), optional
1203
+ :param _request_auth: set to override the auth_settings for an a single
1204
+ request; this effectively ignores the
1205
+ authentication in the spec for a single request.
1206
+ :type _request_auth: dict, optional
1207
+ :param _content_type: force content-type for the request.
1208
+ :type _content_type: str, Optional
1209
+ :param _headers: set to override the headers for a single
1210
+ request; this effectively ignores the headers
1211
+ in the spec for a single request.
1212
+ :type _headers: dict, optional
1213
+ :param _host_index: set to override the host_index for a single
1214
+ request; this effectively ignores the host_index
1215
+ in the spec for a single request.
1216
+ :type _host_index: int, optional
1217
+ :return: Returns the result object.
1218
+ """ # noqa: E501
1219
+
1220
+ _param = self._delete_managed_rule_set_serialize(
1221
+ project_id=project_id,
1222
+ region=region,
1223
+ name=name,
1224
+ _request_auth=_request_auth,
1225
+ _content_type=_content_type,
1226
+ _headers=_headers,
1227
+ _host_index=_host_index,
1228
+ )
1229
+
1230
+ _response_types_map: Dict[str, Optional[str]] = {
1231
+ "200": "object",
1232
+ "400": None,
1233
+ "401": "Status",
1234
+ "403": None,
1235
+ "500": None,
1236
+ }
1237
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1238
+ response_data.read()
1239
+ return self.api_client.response_deserialize(
1240
+ response_data=response_data,
1241
+ response_types_map=_response_types_map,
1242
+ ).data
1243
+
1244
+ @validate_call
1245
+ def delete_managed_rule_set_with_http_info(
1246
+ self,
1247
+ project_id: StrictStr,
1248
+ region: StrictStr,
1249
+ name: StrictStr,
1250
+ _request_timeout: Union[
1251
+ None,
1252
+ Annotated[StrictFloat, Field(gt=0)],
1253
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1254
+ ] = None,
1255
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1256
+ _content_type: Optional[StrictStr] = None,
1257
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1258
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1259
+ ) -> ApiResponse[object]:
1260
+ """Delete a MRS configuration
1261
+
1262
+ To delete a managed rule set (MRS) configuration this endpoint is used, but it is only possible to delete it if no WAF configuration is referencing it.
1263
+
1264
+ :param project_id: (required)
1265
+ :type project_id: str
1266
+ :param region: (required)
1267
+ :type region: str
1268
+ :param name: (required)
1269
+ :type name: str
1270
+ :param _request_timeout: timeout setting for this request. If one
1271
+ number provided, it will be total request
1272
+ timeout. It can also be a pair (tuple) of
1273
+ (connection, read) timeouts.
1274
+ :type _request_timeout: int, tuple(int, int), optional
1275
+ :param _request_auth: set to override the auth_settings for an a single
1276
+ request; this effectively ignores the
1277
+ authentication in the spec for a single request.
1278
+ :type _request_auth: dict, optional
1279
+ :param _content_type: force content-type for the request.
1280
+ :type _content_type: str, Optional
1281
+ :param _headers: set to override the headers for a single
1282
+ request; this effectively ignores the headers
1283
+ in the spec for a single request.
1284
+ :type _headers: dict, optional
1285
+ :param _host_index: set to override the host_index for a single
1286
+ request; this effectively ignores the host_index
1287
+ in the spec for a single request.
1288
+ :type _host_index: int, optional
1289
+ :return: Returns the result object.
1290
+ """ # noqa: E501
1291
+
1292
+ _param = self._delete_managed_rule_set_serialize(
1293
+ project_id=project_id,
1294
+ region=region,
1295
+ name=name,
1296
+ _request_auth=_request_auth,
1297
+ _content_type=_content_type,
1298
+ _headers=_headers,
1299
+ _host_index=_host_index,
1300
+ )
1301
+
1302
+ _response_types_map: Dict[str, Optional[str]] = {
1303
+ "200": "object",
1304
+ "400": None,
1305
+ "401": "Status",
1306
+ "403": None,
1307
+ "500": None,
1308
+ }
1309
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1310
+ response_data.read()
1311
+ return self.api_client.response_deserialize(
1312
+ response_data=response_data,
1313
+ response_types_map=_response_types_map,
1314
+ )
1315
+
1316
+ @validate_call
1317
+ def delete_managed_rule_set_without_preload_content(
1318
+ self,
1319
+ project_id: StrictStr,
1320
+ region: StrictStr,
1321
+ name: StrictStr,
1322
+ _request_timeout: Union[
1323
+ None,
1324
+ Annotated[StrictFloat, Field(gt=0)],
1325
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1326
+ ] = None,
1327
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1328
+ _content_type: Optional[StrictStr] = None,
1329
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1330
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1331
+ ) -> RESTResponseType:
1332
+ """Delete a MRS configuration
1333
+
1334
+ To delete a managed rule set (MRS) configuration this endpoint is used, but it is only possible to delete it if no WAF configuration is referencing it.
1335
+
1336
+ :param project_id: (required)
1337
+ :type project_id: str
1338
+ :param region: (required)
1339
+ :type region: str
1340
+ :param name: (required)
1341
+ :type name: str
1342
+ :param _request_timeout: timeout setting for this request. If one
1343
+ number provided, it will be total request
1344
+ timeout. It can also be a pair (tuple) of
1345
+ (connection, read) timeouts.
1346
+ :type _request_timeout: int, tuple(int, int), optional
1347
+ :param _request_auth: set to override the auth_settings for an a single
1348
+ request; this effectively ignores the
1349
+ authentication in the spec for a single request.
1350
+ :type _request_auth: dict, optional
1351
+ :param _content_type: force content-type for the request.
1352
+ :type _content_type: str, Optional
1353
+ :param _headers: set to override the headers for a single
1354
+ request; this effectively ignores the headers
1355
+ in the spec for a single request.
1356
+ :type _headers: dict, optional
1357
+ :param _host_index: set to override the host_index for a single
1358
+ request; this effectively ignores the host_index
1359
+ in the spec for a single request.
1360
+ :type _host_index: int, optional
1361
+ :return: Returns the result object.
1362
+ """ # noqa: E501
1363
+
1364
+ _param = self._delete_managed_rule_set_serialize(
1365
+ project_id=project_id,
1366
+ region=region,
1367
+ name=name,
1368
+ _request_auth=_request_auth,
1369
+ _content_type=_content_type,
1370
+ _headers=_headers,
1371
+ _host_index=_host_index,
1372
+ )
1373
+
1374
+ _response_types_map: Dict[str, Optional[str]] = {
1375
+ "200": "object",
1376
+ "400": None,
1377
+ "401": "Status",
1378
+ "403": None,
1379
+ "500": None,
1380
+ }
1381
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1382
+ return response_data.response
1383
+
1384
+ def _delete_managed_rule_set_serialize(
1385
+ self,
1386
+ project_id,
1387
+ region,
1388
+ name,
1389
+ _request_auth,
1390
+ _content_type,
1391
+ _headers,
1392
+ _host_index,
1393
+ ) -> RequestSerialized:
1394
+
1395
+ _host = None
1396
+
1397
+ _collection_formats: Dict[str, str] = {}
1398
+
1399
+ _path_params: Dict[str, str] = {}
1400
+ _query_params: List[Tuple[str, str]] = []
1401
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1402
+ _form_params: List[Tuple[str, str]] = []
1403
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
1404
+ _body_params: Optional[bytes] = None
1405
+
1406
+ # process the path parameters
1407
+ if project_id is not None:
1408
+ _path_params["projectId"] = project_id
1409
+ if region is not None:
1410
+ _path_params["region"] = region
1411
+ if name is not None:
1412
+ _path_params["name"] = name
1413
+ # process the query parameters
1414
+ # process the header parameters
1415
+ # process the form parameters
1416
+ # process the body parameter
1417
+
1418
+ # set the HTTP header `Accept`
1419
+ if "Accept" not in _header_params:
1420
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
1421
+
1422
+ # authentication setting
1423
+ _auth_settings: List[str] = []
1424
+
1425
+ return self.api_client.param_serialize(
1426
+ method="DELETE",
1427
+ resource_path="/v1/projects/{projectId}/regions/{region}/managed-rule-sets/{name}",
1428
+ path_params=_path_params,
1429
+ query_params=_query_params,
1430
+ header_params=_header_params,
1431
+ body=_body_params,
1432
+ post_params=_form_params,
1433
+ files=_files,
1434
+ auth_settings=_auth_settings,
1435
+ collection_formats=_collection_formats,
1436
+ _host=_host,
1437
+ _request_auth=_request_auth,
1438
+ )
1439
+
1440
+ @validate_call
1441
+ def delete_waf(
1442
+ self,
1443
+ project_id: StrictStr,
1444
+ region: StrictStr,
1445
+ name: StrictStr,
1446
+ _request_timeout: Union[
1447
+ None,
1448
+ Annotated[StrictFloat, Field(gt=0)],
1449
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1450
+ ] = None,
1451
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1452
+ _content_type: Optional[StrictStr] = None,
1453
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1454
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1455
+ ) -> object:
1456
+ """Delete a WAF configuration
1457
+
1458
+ This will delete the specified WAF configuration, but only if it is not used by any Application Load Balancer in the project.
1459
+
1460
+ :param project_id: (required)
1461
+ :type project_id: str
1462
+ :param region: (required)
1463
+ :type region: str
1464
+ :param name: (required)
1465
+ :type name: str
1466
+ :param _request_timeout: timeout setting for this request. If one
1467
+ number provided, it will be total request
1468
+ timeout. It can also be a pair (tuple) of
1469
+ (connection, read) timeouts.
1470
+ :type _request_timeout: int, tuple(int, int), optional
1471
+ :param _request_auth: set to override the auth_settings for an a single
1472
+ request; this effectively ignores the
1473
+ authentication in the spec for a single request.
1474
+ :type _request_auth: dict, optional
1475
+ :param _content_type: force content-type for the request.
1476
+ :type _content_type: str, Optional
1477
+ :param _headers: set to override the headers for a single
1478
+ request; this effectively ignores the headers
1479
+ in the spec for a single request.
1480
+ :type _headers: dict, optional
1481
+ :param _host_index: set to override the host_index for a single
1482
+ request; this effectively ignores the host_index
1483
+ in the spec for a single request.
1484
+ :type _host_index: int, optional
1485
+ :return: Returns the result object.
1486
+ """ # noqa: E501
1487
+
1488
+ _param = self._delete_waf_serialize(
1489
+ project_id=project_id,
1490
+ region=region,
1491
+ name=name,
1492
+ _request_auth=_request_auth,
1493
+ _content_type=_content_type,
1494
+ _headers=_headers,
1495
+ _host_index=_host_index,
1496
+ )
1497
+
1498
+ _response_types_map: Dict[str, Optional[str]] = {
1499
+ "200": "object",
1500
+ "400": None,
1501
+ "401": "Status",
1502
+ "403": None,
1503
+ "500": None,
1504
+ }
1505
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1506
+ response_data.read()
1507
+ return self.api_client.response_deserialize(
1508
+ response_data=response_data,
1509
+ response_types_map=_response_types_map,
1510
+ ).data
1511
+
1512
+ @validate_call
1513
+ def delete_waf_with_http_info(
1514
+ self,
1515
+ project_id: StrictStr,
1516
+ region: StrictStr,
1517
+ name: StrictStr,
1518
+ _request_timeout: Union[
1519
+ None,
1520
+ Annotated[StrictFloat, Field(gt=0)],
1521
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1522
+ ] = None,
1523
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1524
+ _content_type: Optional[StrictStr] = None,
1525
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1526
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1527
+ ) -> ApiResponse[object]:
1528
+ """Delete a WAF configuration
1529
+
1530
+ This will delete the specified WAF configuration, but only if it is not used by any Application Load Balancer in the project.
1531
+
1532
+ :param project_id: (required)
1533
+ :type project_id: str
1534
+ :param region: (required)
1535
+ :type region: str
1536
+ :param name: (required)
1537
+ :type name: str
1538
+ :param _request_timeout: timeout setting for this request. If one
1539
+ number provided, it will be total request
1540
+ timeout. It can also be a pair (tuple) of
1541
+ (connection, read) timeouts.
1542
+ :type _request_timeout: int, tuple(int, int), optional
1543
+ :param _request_auth: set to override the auth_settings for an a single
1544
+ request; this effectively ignores the
1545
+ authentication in the spec for a single request.
1546
+ :type _request_auth: dict, optional
1547
+ :param _content_type: force content-type for the request.
1548
+ :type _content_type: str, Optional
1549
+ :param _headers: set to override the headers for a single
1550
+ request; this effectively ignores the headers
1551
+ in the spec for a single request.
1552
+ :type _headers: dict, optional
1553
+ :param _host_index: set to override the host_index for a single
1554
+ request; this effectively ignores the host_index
1555
+ in the spec for a single request.
1556
+ :type _host_index: int, optional
1557
+ :return: Returns the result object.
1558
+ """ # noqa: E501
1559
+
1560
+ _param = self._delete_waf_serialize(
1561
+ project_id=project_id,
1562
+ region=region,
1563
+ name=name,
1564
+ _request_auth=_request_auth,
1565
+ _content_type=_content_type,
1566
+ _headers=_headers,
1567
+ _host_index=_host_index,
1568
+ )
1569
+
1570
+ _response_types_map: Dict[str, Optional[str]] = {
1571
+ "200": "object",
1572
+ "400": None,
1573
+ "401": "Status",
1574
+ "403": None,
1575
+ "500": None,
1576
+ }
1577
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1578
+ response_data.read()
1579
+ return self.api_client.response_deserialize(
1580
+ response_data=response_data,
1581
+ response_types_map=_response_types_map,
1582
+ )
1583
+
1584
+ @validate_call
1585
+ def delete_waf_without_preload_content(
1586
+ self,
1587
+ project_id: StrictStr,
1588
+ region: StrictStr,
1589
+ name: StrictStr,
1590
+ _request_timeout: Union[
1591
+ None,
1592
+ Annotated[StrictFloat, Field(gt=0)],
1593
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1594
+ ] = None,
1595
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1596
+ _content_type: Optional[StrictStr] = None,
1597
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1598
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1599
+ ) -> RESTResponseType:
1600
+ """Delete a WAF configuration
1601
+
1602
+ This will delete the specified WAF configuration, but only if it is not used by any Application Load Balancer in the project.
1603
+
1604
+ :param project_id: (required)
1605
+ :type project_id: str
1606
+ :param region: (required)
1607
+ :type region: str
1608
+ :param name: (required)
1609
+ :type name: str
1610
+ :param _request_timeout: timeout setting for this request. If one
1611
+ number provided, it will be total request
1612
+ timeout. It can also be a pair (tuple) of
1613
+ (connection, read) timeouts.
1614
+ :type _request_timeout: int, tuple(int, int), optional
1615
+ :param _request_auth: set to override the auth_settings for an a single
1616
+ request; this effectively ignores the
1617
+ authentication in the spec for a single request.
1618
+ :type _request_auth: dict, optional
1619
+ :param _content_type: force content-type for the request.
1620
+ :type _content_type: str, Optional
1621
+ :param _headers: set to override the headers for a single
1622
+ request; this effectively ignores the headers
1623
+ in the spec for a single request.
1624
+ :type _headers: dict, optional
1625
+ :param _host_index: set to override the host_index for a single
1626
+ request; this effectively ignores the host_index
1627
+ in the spec for a single request.
1628
+ :type _host_index: int, optional
1629
+ :return: Returns the result object.
1630
+ """ # noqa: E501
1631
+
1632
+ _param = self._delete_waf_serialize(
1633
+ project_id=project_id,
1634
+ region=region,
1635
+ name=name,
1636
+ _request_auth=_request_auth,
1637
+ _content_type=_content_type,
1638
+ _headers=_headers,
1639
+ _host_index=_host_index,
1640
+ )
1641
+
1642
+ _response_types_map: Dict[str, Optional[str]] = {
1643
+ "200": "object",
1644
+ "400": None,
1645
+ "401": "Status",
1646
+ "403": None,
1647
+ "500": None,
1648
+ }
1649
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1650
+ return response_data.response
1651
+
1652
+ def _delete_waf_serialize(
1653
+ self,
1654
+ project_id,
1655
+ region,
1656
+ name,
1657
+ _request_auth,
1658
+ _content_type,
1659
+ _headers,
1660
+ _host_index,
1661
+ ) -> RequestSerialized:
1662
+
1663
+ _host = None
1664
+
1665
+ _collection_formats: Dict[str, str] = {}
1666
+
1667
+ _path_params: Dict[str, str] = {}
1668
+ _query_params: List[Tuple[str, str]] = []
1669
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1670
+ _form_params: List[Tuple[str, str]] = []
1671
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
1672
+ _body_params: Optional[bytes] = None
1673
+
1674
+ # process the path parameters
1675
+ if project_id is not None:
1676
+ _path_params["projectId"] = project_id
1677
+ if region is not None:
1678
+ _path_params["region"] = region
1679
+ if name is not None:
1680
+ _path_params["name"] = name
1681
+ # process the query parameters
1682
+ # process the header parameters
1683
+ # process the form parameters
1684
+ # process the body parameter
1685
+
1686
+ # set the HTTP header `Accept`
1687
+ if "Accept" not in _header_params:
1688
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
1689
+
1690
+ # authentication setting
1691
+ _auth_settings: List[str] = []
1692
+
1693
+ return self.api_client.param_serialize(
1694
+ method="DELETE",
1695
+ resource_path="/v1/projects/{projectId}/regions/{region}/wafs/{name}",
1696
+ path_params=_path_params,
1697
+ query_params=_query_params,
1698
+ header_params=_header_params,
1699
+ body=_body_params,
1700
+ post_params=_form_params,
1701
+ files=_files,
1702
+ auth_settings=_auth_settings,
1703
+ collection_formats=_collection_formats,
1704
+ _host=_host,
1705
+ _request_auth=_request_auth,
1706
+ )
1707
+
1708
+ @validate_call
1709
+ def get_custom_rule_group(
1710
+ self,
1711
+ project_id: StrictStr,
1712
+ region: StrictStr,
1713
+ name: StrictStr,
1714
+ _request_timeout: Union[
1715
+ None,
1716
+ Annotated[StrictFloat, Field(gt=0)],
1717
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1718
+ ] = None,
1719
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1720
+ _content_type: Optional[StrictStr] = None,
1721
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1722
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1723
+ ) -> GetCustomRuleGroupResponse:
1724
+ """Retrieve a CRG configuration
1725
+
1726
+ Retrieves the specified SecLang custom rule configuration (CRG) structure.
1727
+
1728
+ :param project_id: (required)
1729
+ :type project_id: str
1730
+ :param region: (required)
1731
+ :type region: str
1732
+ :param name: (required)
1733
+ :type name: str
1734
+ :param _request_timeout: timeout setting for this request. If one
1735
+ number provided, it will be total request
1736
+ timeout. It can also be a pair (tuple) of
1737
+ (connection, read) timeouts.
1738
+ :type _request_timeout: int, tuple(int, int), optional
1739
+ :param _request_auth: set to override the auth_settings for an a single
1740
+ request; this effectively ignores the
1741
+ authentication in the spec for a single request.
1742
+ :type _request_auth: dict, optional
1743
+ :param _content_type: force content-type for the request.
1744
+ :type _content_type: str, Optional
1745
+ :param _headers: set to override the headers for a single
1746
+ request; this effectively ignores the headers
1747
+ in the spec for a single request.
1748
+ :type _headers: dict, optional
1749
+ :param _host_index: set to override the host_index for a single
1750
+ request; this effectively ignores the host_index
1751
+ in the spec for a single request.
1752
+ :type _host_index: int, optional
1753
+ :return: Returns the result object.
1754
+ """ # noqa: E501
1755
+
1756
+ _param = self._get_custom_rule_group_serialize(
1757
+ project_id=project_id,
1758
+ region=region,
1759
+ name=name,
1760
+ _request_auth=_request_auth,
1761
+ _content_type=_content_type,
1762
+ _headers=_headers,
1763
+ _host_index=_host_index,
1764
+ )
1765
+
1766
+ _response_types_map: Dict[str, Optional[str]] = {
1767
+ "200": "GetCustomRuleGroupResponse",
1768
+ "400": None,
1769
+ "401": "Status",
1770
+ "403": None,
1771
+ "404": None,
1772
+ "500": None,
1773
+ }
1774
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1775
+ response_data.read()
1776
+ return self.api_client.response_deserialize(
1777
+ response_data=response_data,
1778
+ response_types_map=_response_types_map,
1779
+ ).data
1780
+
1781
+ @validate_call
1782
+ def get_custom_rule_group_with_http_info(
1783
+ self,
1784
+ project_id: StrictStr,
1785
+ region: StrictStr,
1786
+ name: StrictStr,
1787
+ _request_timeout: Union[
1788
+ None,
1789
+ Annotated[StrictFloat, Field(gt=0)],
1790
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1791
+ ] = None,
1792
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1793
+ _content_type: Optional[StrictStr] = None,
1794
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1795
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1796
+ ) -> ApiResponse[GetCustomRuleGroupResponse]:
1797
+ """Retrieve a CRG configuration
1798
+
1799
+ Retrieves the specified SecLang custom rule configuration (CRG) structure.
1800
+
1801
+ :param project_id: (required)
1802
+ :type project_id: str
1803
+ :param region: (required)
1804
+ :type region: str
1805
+ :param name: (required)
1806
+ :type name: str
1807
+ :param _request_timeout: timeout setting for this request. If one
1808
+ number provided, it will be total request
1809
+ timeout. It can also be a pair (tuple) of
1810
+ (connection, read) timeouts.
1811
+ :type _request_timeout: int, tuple(int, int), optional
1812
+ :param _request_auth: set to override the auth_settings for an a single
1813
+ request; this effectively ignores the
1814
+ authentication in the spec for a single request.
1815
+ :type _request_auth: dict, optional
1816
+ :param _content_type: force content-type for the request.
1817
+ :type _content_type: str, Optional
1818
+ :param _headers: set to override the headers for a single
1819
+ request; this effectively ignores the headers
1820
+ in the spec for a single request.
1821
+ :type _headers: dict, optional
1822
+ :param _host_index: set to override the host_index for a single
1823
+ request; this effectively ignores the host_index
1824
+ in the spec for a single request.
1825
+ :type _host_index: int, optional
1826
+ :return: Returns the result object.
1827
+ """ # noqa: E501
1828
+
1829
+ _param = self._get_custom_rule_group_serialize(
1830
+ project_id=project_id,
1831
+ region=region,
1832
+ name=name,
1833
+ _request_auth=_request_auth,
1834
+ _content_type=_content_type,
1835
+ _headers=_headers,
1836
+ _host_index=_host_index,
1837
+ )
1838
+
1839
+ _response_types_map: Dict[str, Optional[str]] = {
1840
+ "200": "GetCustomRuleGroupResponse",
1841
+ "400": None,
1842
+ "401": "Status",
1843
+ "403": None,
1844
+ "404": None,
1845
+ "500": None,
1846
+ }
1847
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1848
+ response_data.read()
1849
+ return self.api_client.response_deserialize(
1850
+ response_data=response_data,
1851
+ response_types_map=_response_types_map,
1852
+ )
1853
+
1854
+ @validate_call
1855
+ def get_custom_rule_group_without_preload_content(
1856
+ self,
1857
+ project_id: StrictStr,
1858
+ region: StrictStr,
1859
+ name: StrictStr,
1860
+ _request_timeout: Union[
1861
+ None,
1862
+ Annotated[StrictFloat, Field(gt=0)],
1863
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1864
+ ] = None,
1865
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1866
+ _content_type: Optional[StrictStr] = None,
1867
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1868
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1869
+ ) -> RESTResponseType:
1870
+ """Retrieve a CRG configuration
1871
+
1872
+ Retrieves the specified SecLang custom rule configuration (CRG) structure.
1873
+
1874
+ :param project_id: (required)
1875
+ :type project_id: str
1876
+ :param region: (required)
1877
+ :type region: str
1878
+ :param name: (required)
1879
+ :type name: str
1880
+ :param _request_timeout: timeout setting for this request. If one
1881
+ number provided, it will be total request
1882
+ timeout. It can also be a pair (tuple) of
1883
+ (connection, read) timeouts.
1884
+ :type _request_timeout: int, tuple(int, int), optional
1885
+ :param _request_auth: set to override the auth_settings for an a single
1886
+ request; this effectively ignores the
1887
+ authentication in the spec for a single request.
1888
+ :type _request_auth: dict, optional
1889
+ :param _content_type: force content-type for the request.
1890
+ :type _content_type: str, Optional
1891
+ :param _headers: set to override the headers for a single
1892
+ request; this effectively ignores the headers
1893
+ in the spec for a single request.
1894
+ :type _headers: dict, optional
1895
+ :param _host_index: set to override the host_index for a single
1896
+ request; this effectively ignores the host_index
1897
+ in the spec for a single request.
1898
+ :type _host_index: int, optional
1899
+ :return: Returns the result object.
1900
+ """ # noqa: E501
1901
+
1902
+ _param = self._get_custom_rule_group_serialize(
1903
+ project_id=project_id,
1904
+ region=region,
1905
+ name=name,
1906
+ _request_auth=_request_auth,
1907
+ _content_type=_content_type,
1908
+ _headers=_headers,
1909
+ _host_index=_host_index,
1910
+ )
1911
+
1912
+ _response_types_map: Dict[str, Optional[str]] = {
1913
+ "200": "GetCustomRuleGroupResponse",
1914
+ "400": None,
1915
+ "401": "Status",
1916
+ "403": None,
1917
+ "404": None,
1918
+ "500": None,
1919
+ }
1920
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1921
+ return response_data.response
1922
+
1923
+ def _get_custom_rule_group_serialize(
1924
+ self,
1925
+ project_id,
1926
+ region,
1927
+ name,
1928
+ _request_auth,
1929
+ _content_type,
1930
+ _headers,
1931
+ _host_index,
1932
+ ) -> RequestSerialized:
1933
+
1934
+ _host = None
1935
+
1936
+ _collection_formats: Dict[str, str] = {}
1937
+
1938
+ _path_params: Dict[str, str] = {}
1939
+ _query_params: List[Tuple[str, str]] = []
1940
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1941
+ _form_params: List[Tuple[str, str]] = []
1942
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
1943
+ _body_params: Optional[bytes] = None
1944
+
1945
+ # process the path parameters
1946
+ if project_id is not None:
1947
+ _path_params["projectId"] = project_id
1948
+ if region is not None:
1949
+ _path_params["region"] = region
1950
+ if name is not None:
1951
+ _path_params["name"] = name
1952
+ # process the query parameters
1953
+ # process the header parameters
1954
+ # process the form parameters
1955
+ # process the body parameter
1956
+
1957
+ # set the HTTP header `Accept`
1958
+ if "Accept" not in _header_params:
1959
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
1960
+
1961
+ # authentication setting
1962
+ _auth_settings: List[str] = []
1963
+
1964
+ return self.api_client.param_serialize(
1965
+ method="GET",
1966
+ resource_path="/v1/projects/{projectId}/regions/{region}/custom-rule-groups/{name}",
1967
+ path_params=_path_params,
1968
+ query_params=_query_params,
1969
+ header_params=_header_params,
1970
+ body=_body_params,
1971
+ post_params=_form_params,
1972
+ files=_files,
1973
+ auth_settings=_auth_settings,
1974
+ collection_formats=_collection_formats,
1975
+ _host=_host,
1976
+ _request_auth=_request_auth,
1977
+ )
1978
+
1979
+ @validate_call
1980
+ def get_managed_rule_set(
1981
+ self,
1982
+ project_id: StrictStr,
1983
+ region: StrictStr,
1984
+ name: StrictStr,
1985
+ _request_timeout: Union[
1986
+ None,
1987
+ Annotated[StrictFloat, Field(gt=0)],
1988
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1989
+ ] = None,
1990
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1991
+ _content_type: Optional[StrictStr] = None,
1992
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1993
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1994
+ ) -> GetManagedRuleSetResponse:
1995
+ """Retrieve a MRS configuration
1996
+
1997
+ To retrieve an existing managed rule set (MRS) configuration this endpoint can be used.
1998
+
1999
+ :param project_id: (required)
2000
+ :type project_id: str
2001
+ :param region: (required)
2002
+ :type region: str
2003
+ :param name: (required)
2004
+ :type name: str
2005
+ :param _request_timeout: timeout setting for this request. If one
2006
+ number provided, it will be total request
2007
+ timeout. It can also be a pair (tuple) of
2008
+ (connection, read) timeouts.
2009
+ :type _request_timeout: int, tuple(int, int), optional
2010
+ :param _request_auth: set to override the auth_settings for an a single
2011
+ request; this effectively ignores the
2012
+ authentication in the spec for a single request.
2013
+ :type _request_auth: dict, optional
2014
+ :param _content_type: force content-type for the request.
2015
+ :type _content_type: str, Optional
2016
+ :param _headers: set to override the headers for a single
2017
+ request; this effectively ignores the headers
2018
+ in the spec for a single request.
2019
+ :type _headers: dict, optional
2020
+ :param _host_index: set to override the host_index for a single
2021
+ request; this effectively ignores the host_index
2022
+ in the spec for a single request.
2023
+ :type _host_index: int, optional
2024
+ :return: Returns the result object.
2025
+ """ # noqa: E501
2026
+
2027
+ _param = self._get_managed_rule_set_serialize(
2028
+ project_id=project_id,
2029
+ region=region,
2030
+ name=name,
2031
+ _request_auth=_request_auth,
2032
+ _content_type=_content_type,
2033
+ _headers=_headers,
2034
+ _host_index=_host_index,
2035
+ )
2036
+
2037
+ _response_types_map: Dict[str, Optional[str]] = {
2038
+ "200": "GetManagedRuleSetResponse",
2039
+ "400": None,
2040
+ "401": "Status",
2041
+ "403": None,
2042
+ "404": None,
2043
+ "500": None,
2044
+ }
2045
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2046
+ response_data.read()
2047
+ return self.api_client.response_deserialize(
2048
+ response_data=response_data,
2049
+ response_types_map=_response_types_map,
2050
+ ).data
2051
+
2052
+ @validate_call
2053
+ def get_managed_rule_set_with_http_info(
2054
+ self,
2055
+ project_id: StrictStr,
2056
+ region: StrictStr,
2057
+ name: StrictStr,
2058
+ _request_timeout: Union[
2059
+ None,
2060
+ Annotated[StrictFloat, Field(gt=0)],
2061
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2062
+ ] = None,
2063
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2064
+ _content_type: Optional[StrictStr] = None,
2065
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2066
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2067
+ ) -> ApiResponse[GetManagedRuleSetResponse]:
2068
+ """Retrieve a MRS configuration
2069
+
2070
+ To retrieve an existing managed rule set (MRS) configuration this endpoint can be used.
2071
+
2072
+ :param project_id: (required)
2073
+ :type project_id: str
2074
+ :param region: (required)
2075
+ :type region: str
2076
+ :param name: (required)
2077
+ :type name: str
2078
+ :param _request_timeout: timeout setting for this request. If one
2079
+ number provided, it will be total request
2080
+ timeout. It can also be a pair (tuple) of
2081
+ (connection, read) timeouts.
2082
+ :type _request_timeout: int, tuple(int, int), optional
2083
+ :param _request_auth: set to override the auth_settings for an a single
2084
+ request; this effectively ignores the
2085
+ authentication in the spec for a single request.
2086
+ :type _request_auth: dict, optional
2087
+ :param _content_type: force content-type for the request.
2088
+ :type _content_type: str, Optional
2089
+ :param _headers: set to override the headers for a single
2090
+ request; this effectively ignores the headers
2091
+ in the spec for a single request.
2092
+ :type _headers: dict, optional
2093
+ :param _host_index: set to override the host_index for a single
2094
+ request; this effectively ignores the host_index
2095
+ in the spec for a single request.
2096
+ :type _host_index: int, optional
2097
+ :return: Returns the result object.
2098
+ """ # noqa: E501
2099
+
2100
+ _param = self._get_managed_rule_set_serialize(
2101
+ project_id=project_id,
2102
+ region=region,
2103
+ name=name,
2104
+ _request_auth=_request_auth,
2105
+ _content_type=_content_type,
2106
+ _headers=_headers,
2107
+ _host_index=_host_index,
2108
+ )
2109
+
2110
+ _response_types_map: Dict[str, Optional[str]] = {
2111
+ "200": "GetManagedRuleSetResponse",
2112
+ "400": None,
2113
+ "401": "Status",
2114
+ "403": None,
2115
+ "404": None,
2116
+ "500": None,
2117
+ }
2118
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2119
+ response_data.read()
2120
+ return self.api_client.response_deserialize(
2121
+ response_data=response_data,
2122
+ response_types_map=_response_types_map,
2123
+ )
2124
+
2125
+ @validate_call
2126
+ def get_managed_rule_set_without_preload_content(
2127
+ self,
2128
+ project_id: StrictStr,
2129
+ region: StrictStr,
2130
+ name: StrictStr,
2131
+ _request_timeout: Union[
2132
+ None,
2133
+ Annotated[StrictFloat, Field(gt=0)],
2134
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2135
+ ] = None,
2136
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2137
+ _content_type: Optional[StrictStr] = None,
2138
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2139
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2140
+ ) -> RESTResponseType:
2141
+ """Retrieve a MRS configuration
2142
+
2143
+ To retrieve an existing managed rule set (MRS) configuration this endpoint can be used.
2144
+
2145
+ :param project_id: (required)
2146
+ :type project_id: str
2147
+ :param region: (required)
2148
+ :type region: str
2149
+ :param name: (required)
2150
+ :type name: str
2151
+ :param _request_timeout: timeout setting for this request. If one
2152
+ number provided, it will be total request
2153
+ timeout. It can also be a pair (tuple) of
2154
+ (connection, read) timeouts.
2155
+ :type _request_timeout: int, tuple(int, int), optional
2156
+ :param _request_auth: set to override the auth_settings for an a single
2157
+ request; this effectively ignores the
2158
+ authentication in the spec for a single request.
2159
+ :type _request_auth: dict, optional
2160
+ :param _content_type: force content-type for the request.
2161
+ :type _content_type: str, Optional
2162
+ :param _headers: set to override the headers for a single
2163
+ request; this effectively ignores the headers
2164
+ in the spec for a single request.
2165
+ :type _headers: dict, optional
2166
+ :param _host_index: set to override the host_index for a single
2167
+ request; this effectively ignores the host_index
2168
+ in the spec for a single request.
2169
+ :type _host_index: int, optional
2170
+ :return: Returns the result object.
2171
+ """ # noqa: E501
2172
+
2173
+ _param = self._get_managed_rule_set_serialize(
2174
+ project_id=project_id,
2175
+ region=region,
2176
+ name=name,
2177
+ _request_auth=_request_auth,
2178
+ _content_type=_content_type,
2179
+ _headers=_headers,
2180
+ _host_index=_host_index,
2181
+ )
2182
+
2183
+ _response_types_map: Dict[str, Optional[str]] = {
2184
+ "200": "GetManagedRuleSetResponse",
2185
+ "400": None,
2186
+ "401": "Status",
2187
+ "403": None,
2188
+ "404": None,
2189
+ "500": None,
2190
+ }
2191
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2192
+ return response_data.response
2193
+
2194
+ def _get_managed_rule_set_serialize(
2195
+ self,
2196
+ project_id,
2197
+ region,
2198
+ name,
2199
+ _request_auth,
2200
+ _content_type,
2201
+ _headers,
2202
+ _host_index,
2203
+ ) -> RequestSerialized:
2204
+
2205
+ _host = None
2206
+
2207
+ _collection_formats: Dict[str, str] = {}
2208
+
2209
+ _path_params: Dict[str, str] = {}
2210
+ _query_params: List[Tuple[str, str]] = []
2211
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2212
+ _form_params: List[Tuple[str, str]] = []
2213
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
2214
+ _body_params: Optional[bytes] = None
2215
+
2216
+ # process the path parameters
2217
+ if project_id is not None:
2218
+ _path_params["projectId"] = project_id
2219
+ if region is not None:
2220
+ _path_params["region"] = region
2221
+ if name is not None:
2222
+ _path_params["name"] = name
2223
+ # process the query parameters
2224
+ # process the header parameters
2225
+ # process the form parameters
2226
+ # process the body parameter
2227
+
2228
+ # set the HTTP header `Accept`
2229
+ if "Accept" not in _header_params:
2230
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
2231
+
2232
+ # authentication setting
2233
+ _auth_settings: List[str] = []
2234
+
2235
+ return self.api_client.param_serialize(
2236
+ method="GET",
2237
+ resource_path="/v1/projects/{projectId}/regions/{region}/managed-rule-sets/{name}",
2238
+ path_params=_path_params,
2239
+ query_params=_query_params,
2240
+ header_params=_header_params,
2241
+ body=_body_params,
2242
+ post_params=_form_params,
2243
+ files=_files,
2244
+ auth_settings=_auth_settings,
2245
+ collection_formats=_collection_formats,
2246
+ _host=_host,
2247
+ _request_auth=_request_auth,
2248
+ )
2249
+
2250
+ @validate_call
2251
+ def get_quota(
2252
+ self,
2253
+ project_id: StrictStr,
2254
+ region: StrictStr,
2255
+ _request_timeout: Union[
2256
+ None,
2257
+ Annotated[StrictFloat, Field(gt=0)],
2258
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2259
+ ] = None,
2260
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2261
+ _content_type: Optional[StrictStr] = None,
2262
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2263
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2264
+ ) -> GetQuotaResponse:
2265
+ """Get the quota for WAF resources in a project.
2266
+
2267
+ Retrieves the configured WAF resource quotas for the project. Limit can be changed via service request.
2268
+
2269
+ :param project_id: (required)
2270
+ :type project_id: str
2271
+ :param region: (required)
2272
+ :type region: str
2273
+ :param _request_timeout: timeout setting for this request. If one
2274
+ number provided, it will be total request
2275
+ timeout. It can also be a pair (tuple) of
2276
+ (connection, read) timeouts.
2277
+ :type _request_timeout: int, tuple(int, int), optional
2278
+ :param _request_auth: set to override the auth_settings for an a single
2279
+ request; this effectively ignores the
2280
+ authentication in the spec for a single request.
2281
+ :type _request_auth: dict, optional
2282
+ :param _content_type: force content-type for the request.
2283
+ :type _content_type: str, Optional
2284
+ :param _headers: set to override the headers for a single
2285
+ request; this effectively ignores the headers
2286
+ in the spec for a single request.
2287
+ :type _headers: dict, optional
2288
+ :param _host_index: set to override the host_index for a single
2289
+ request; this effectively ignores the host_index
2290
+ in the spec for a single request.
2291
+ :type _host_index: int, optional
2292
+ :return: Returns the result object.
2293
+ """ # noqa: E501
2294
+
2295
+ _param = self._get_quota_serialize(
2296
+ project_id=project_id,
2297
+ region=region,
2298
+ _request_auth=_request_auth,
2299
+ _content_type=_content_type,
2300
+ _headers=_headers,
2301
+ _host_index=_host_index,
2302
+ )
2303
+
2304
+ _response_types_map: Dict[str, Optional[str]] = {
2305
+ "200": "GetQuotaResponse",
2306
+ "400": None,
2307
+ "401": "str",
2308
+ "403": None,
2309
+ "500": None,
2310
+ }
2311
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2312
+ response_data.read()
2313
+ return self.api_client.response_deserialize(
2314
+ response_data=response_data,
2315
+ response_types_map=_response_types_map,
2316
+ ).data
2317
+
2318
+ @validate_call
2319
+ def get_quota_with_http_info(
2320
+ self,
2321
+ project_id: StrictStr,
2322
+ region: StrictStr,
2323
+ _request_timeout: Union[
2324
+ None,
2325
+ Annotated[StrictFloat, Field(gt=0)],
2326
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2327
+ ] = None,
2328
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2329
+ _content_type: Optional[StrictStr] = None,
2330
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2331
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2332
+ ) -> ApiResponse[GetQuotaResponse]:
2333
+ """Get the quota for WAF resources in a project.
2334
+
2335
+ Retrieves the configured WAF resource quotas for the project. Limit can be changed via service request.
2336
+
2337
+ :param project_id: (required)
2338
+ :type project_id: str
2339
+ :param region: (required)
2340
+ :type region: str
2341
+ :param _request_timeout: timeout setting for this request. If one
2342
+ number provided, it will be total request
2343
+ timeout. It can also be a pair (tuple) of
2344
+ (connection, read) timeouts.
2345
+ :type _request_timeout: int, tuple(int, int), optional
2346
+ :param _request_auth: set to override the auth_settings for an a single
2347
+ request; this effectively ignores the
2348
+ authentication in the spec for a single request.
2349
+ :type _request_auth: dict, optional
2350
+ :param _content_type: force content-type for the request.
2351
+ :type _content_type: str, Optional
2352
+ :param _headers: set to override the headers for a single
2353
+ request; this effectively ignores the headers
2354
+ in the spec for a single request.
2355
+ :type _headers: dict, optional
2356
+ :param _host_index: set to override the host_index for a single
2357
+ request; this effectively ignores the host_index
2358
+ in the spec for a single request.
2359
+ :type _host_index: int, optional
2360
+ :return: Returns the result object.
2361
+ """ # noqa: E501
2362
+
2363
+ _param = self._get_quota_serialize(
2364
+ project_id=project_id,
2365
+ region=region,
2366
+ _request_auth=_request_auth,
2367
+ _content_type=_content_type,
2368
+ _headers=_headers,
2369
+ _host_index=_host_index,
2370
+ )
2371
+
2372
+ _response_types_map: Dict[str, Optional[str]] = {
2373
+ "200": "GetQuotaResponse",
2374
+ "400": None,
2375
+ "401": "str",
2376
+ "403": None,
2377
+ "500": None,
2378
+ }
2379
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2380
+ response_data.read()
2381
+ return self.api_client.response_deserialize(
2382
+ response_data=response_data,
2383
+ response_types_map=_response_types_map,
2384
+ )
2385
+
2386
+ @validate_call
2387
+ def get_quota_without_preload_content(
2388
+ self,
2389
+ project_id: StrictStr,
2390
+ region: StrictStr,
2391
+ _request_timeout: Union[
2392
+ None,
2393
+ Annotated[StrictFloat, Field(gt=0)],
2394
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2395
+ ] = None,
2396
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2397
+ _content_type: Optional[StrictStr] = None,
2398
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2399
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2400
+ ) -> RESTResponseType:
2401
+ """Get the quota for WAF resources in a project.
2402
+
2403
+ Retrieves the configured WAF resource quotas for the project. Limit can be changed via service request.
2404
+
2405
+ :param project_id: (required)
2406
+ :type project_id: str
2407
+ :param region: (required)
2408
+ :type region: str
2409
+ :param _request_timeout: timeout setting for this request. If one
2410
+ number provided, it will be total request
2411
+ timeout. It can also be a pair (tuple) of
2412
+ (connection, read) timeouts.
2413
+ :type _request_timeout: int, tuple(int, int), optional
2414
+ :param _request_auth: set to override the auth_settings for an a single
2415
+ request; this effectively ignores the
2416
+ authentication in the spec for a single request.
2417
+ :type _request_auth: dict, optional
2418
+ :param _content_type: force content-type for the request.
2419
+ :type _content_type: str, Optional
2420
+ :param _headers: set to override the headers for a single
2421
+ request; this effectively ignores the headers
2422
+ in the spec for a single request.
2423
+ :type _headers: dict, optional
2424
+ :param _host_index: set to override the host_index for a single
2425
+ request; this effectively ignores the host_index
2426
+ in the spec for a single request.
2427
+ :type _host_index: int, optional
2428
+ :return: Returns the result object.
2429
+ """ # noqa: E501
2430
+
2431
+ _param = self._get_quota_serialize(
2432
+ project_id=project_id,
2433
+ region=region,
2434
+ _request_auth=_request_auth,
2435
+ _content_type=_content_type,
2436
+ _headers=_headers,
2437
+ _host_index=_host_index,
2438
+ )
2439
+
2440
+ _response_types_map: Dict[str, Optional[str]] = {
2441
+ "200": "GetQuotaResponse",
2442
+ "400": None,
2443
+ "401": "str",
2444
+ "403": None,
2445
+ "500": None,
2446
+ }
2447
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2448
+ return response_data.response
2449
+
2450
+ def _get_quota_serialize(
2451
+ self,
2452
+ project_id,
2453
+ region,
2454
+ _request_auth,
2455
+ _content_type,
2456
+ _headers,
2457
+ _host_index,
2458
+ ) -> RequestSerialized:
2459
+
2460
+ _host = None
2461
+
2462
+ _collection_formats: Dict[str, str] = {}
2463
+
2464
+ _path_params: Dict[str, str] = {}
2465
+ _query_params: List[Tuple[str, str]] = []
2466
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2467
+ _form_params: List[Tuple[str, str]] = []
2468
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
2469
+ _body_params: Optional[bytes] = None
2470
+
2471
+ # process the path parameters
2472
+ if project_id is not None:
2473
+ _path_params["projectId"] = project_id
2474
+ if region is not None:
2475
+ _path_params["region"] = region
2476
+ # process the query parameters
2477
+ # process the header parameters
2478
+ # process the form parameters
2479
+ # process the body parameter
2480
+
2481
+ # set the HTTP header `Accept`
2482
+ if "Accept" not in _header_params:
2483
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "text/plain"])
2484
+
2485
+ # authentication setting
2486
+ _auth_settings: List[str] = []
2487
+
2488
+ return self.api_client.param_serialize(
2489
+ method="GET",
2490
+ resource_path="/v1/projects/{projectId}/regions/{region}/quotas",
2491
+ path_params=_path_params,
2492
+ query_params=_query_params,
2493
+ header_params=_header_params,
2494
+ body=_body_params,
2495
+ post_params=_form_params,
2496
+ files=_files,
2497
+ auth_settings=_auth_settings,
2498
+ collection_formats=_collection_formats,
2499
+ _host=_host,
2500
+ _request_auth=_request_auth,
2501
+ )
2502
+
2503
+ @validate_call
2504
+ def get_waf(
2505
+ self,
2506
+ project_id: StrictStr,
2507
+ region: StrictStr,
2508
+ name: StrictStr,
2509
+ _request_timeout: Union[
2510
+ None,
2511
+ Annotated[StrictFloat, Field(gt=0)],
2512
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2513
+ ] = None,
2514
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2515
+ _content_type: Optional[StrictStr] = None,
2516
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2517
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2518
+ ) -> GetWAFResponse:
2519
+ """Retrieve a WAF configuration
2520
+
2521
+ This endpoint will return the specified WAF configuration.
2522
+
2523
+ :param project_id: (required)
2524
+ :type project_id: str
2525
+ :param region: (required)
2526
+ :type region: str
2527
+ :param name: (required)
2528
+ :type name: str
2529
+ :param _request_timeout: timeout setting for this request. If one
2530
+ number provided, it will be total request
2531
+ timeout. It can also be a pair (tuple) of
2532
+ (connection, read) timeouts.
2533
+ :type _request_timeout: int, tuple(int, int), optional
2534
+ :param _request_auth: set to override the auth_settings for an a single
2535
+ request; this effectively ignores the
2536
+ authentication in the spec for a single request.
2537
+ :type _request_auth: dict, optional
2538
+ :param _content_type: force content-type for the request.
2539
+ :type _content_type: str, Optional
2540
+ :param _headers: set to override the headers for a single
2541
+ request; this effectively ignores the headers
2542
+ in the spec for a single request.
2543
+ :type _headers: dict, optional
2544
+ :param _host_index: set to override the host_index for a single
2545
+ request; this effectively ignores the host_index
2546
+ in the spec for a single request.
2547
+ :type _host_index: int, optional
2548
+ :return: Returns the result object.
2549
+ """ # noqa: E501
2550
+
2551
+ _param = self._get_waf_serialize(
2552
+ project_id=project_id,
2553
+ region=region,
2554
+ name=name,
2555
+ _request_auth=_request_auth,
2556
+ _content_type=_content_type,
2557
+ _headers=_headers,
2558
+ _host_index=_host_index,
2559
+ )
2560
+
2561
+ _response_types_map: Dict[str, Optional[str]] = {
2562
+ "200": "GetWAFResponse",
2563
+ "400": None,
2564
+ "401": "Status",
2565
+ "403": None,
2566
+ "404": None,
2567
+ "500": None,
2568
+ }
2569
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2570
+ response_data.read()
2571
+ return self.api_client.response_deserialize(
2572
+ response_data=response_data,
2573
+ response_types_map=_response_types_map,
2574
+ ).data
2575
+
2576
+ @validate_call
2577
+ def get_waf_with_http_info(
2578
+ self,
2579
+ project_id: StrictStr,
2580
+ region: StrictStr,
2581
+ name: StrictStr,
2582
+ _request_timeout: Union[
2583
+ None,
2584
+ Annotated[StrictFloat, Field(gt=0)],
2585
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2586
+ ] = None,
2587
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2588
+ _content_type: Optional[StrictStr] = None,
2589
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2590
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2591
+ ) -> ApiResponse[GetWAFResponse]:
2592
+ """Retrieve a WAF configuration
2593
+
2594
+ This endpoint will return the specified WAF configuration.
2595
+
2596
+ :param project_id: (required)
2597
+ :type project_id: str
2598
+ :param region: (required)
2599
+ :type region: str
2600
+ :param name: (required)
2601
+ :type name: str
2602
+ :param _request_timeout: timeout setting for this request. If one
2603
+ number provided, it will be total request
2604
+ timeout. It can also be a pair (tuple) of
2605
+ (connection, read) timeouts.
2606
+ :type _request_timeout: int, tuple(int, int), optional
2607
+ :param _request_auth: set to override the auth_settings for an a single
2608
+ request; this effectively ignores the
2609
+ authentication in the spec for a single request.
2610
+ :type _request_auth: dict, optional
2611
+ :param _content_type: force content-type for the request.
2612
+ :type _content_type: str, Optional
2613
+ :param _headers: set to override the headers for a single
2614
+ request; this effectively ignores the headers
2615
+ in the spec for a single request.
2616
+ :type _headers: dict, optional
2617
+ :param _host_index: set to override the host_index for a single
2618
+ request; this effectively ignores the host_index
2619
+ in the spec for a single request.
2620
+ :type _host_index: int, optional
2621
+ :return: Returns the result object.
2622
+ """ # noqa: E501
2623
+
2624
+ _param = self._get_waf_serialize(
2625
+ project_id=project_id,
2626
+ region=region,
2627
+ name=name,
2628
+ _request_auth=_request_auth,
2629
+ _content_type=_content_type,
2630
+ _headers=_headers,
2631
+ _host_index=_host_index,
2632
+ )
2633
+
2634
+ _response_types_map: Dict[str, Optional[str]] = {
2635
+ "200": "GetWAFResponse",
2636
+ "400": None,
2637
+ "401": "Status",
2638
+ "403": None,
2639
+ "404": None,
2640
+ "500": None,
2641
+ }
2642
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2643
+ response_data.read()
2644
+ return self.api_client.response_deserialize(
2645
+ response_data=response_data,
2646
+ response_types_map=_response_types_map,
2647
+ )
2648
+
2649
+ @validate_call
2650
+ def get_waf_without_preload_content(
2651
+ self,
2652
+ project_id: StrictStr,
2653
+ region: StrictStr,
2654
+ name: StrictStr,
2655
+ _request_timeout: Union[
2656
+ None,
2657
+ Annotated[StrictFloat, Field(gt=0)],
2658
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2659
+ ] = None,
2660
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2661
+ _content_type: Optional[StrictStr] = None,
2662
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2663
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2664
+ ) -> RESTResponseType:
2665
+ """Retrieve a WAF configuration
2666
+
2667
+ This endpoint will return the specified WAF configuration.
2668
+
2669
+ :param project_id: (required)
2670
+ :type project_id: str
2671
+ :param region: (required)
2672
+ :type region: str
2673
+ :param name: (required)
2674
+ :type name: str
2675
+ :param _request_timeout: timeout setting for this request. If one
2676
+ number provided, it will be total request
2677
+ timeout. It can also be a pair (tuple) of
2678
+ (connection, read) timeouts.
2679
+ :type _request_timeout: int, tuple(int, int), optional
2680
+ :param _request_auth: set to override the auth_settings for an a single
2681
+ request; this effectively ignores the
2682
+ authentication in the spec for a single request.
2683
+ :type _request_auth: dict, optional
2684
+ :param _content_type: force content-type for the request.
2685
+ :type _content_type: str, Optional
2686
+ :param _headers: set to override the headers for a single
2687
+ request; this effectively ignores the headers
2688
+ in the spec for a single request.
2689
+ :type _headers: dict, optional
2690
+ :param _host_index: set to override the host_index for a single
2691
+ request; this effectively ignores the host_index
2692
+ in the spec for a single request.
2693
+ :type _host_index: int, optional
2694
+ :return: Returns the result object.
2695
+ """ # noqa: E501
2696
+
2697
+ _param = self._get_waf_serialize(
2698
+ project_id=project_id,
2699
+ region=region,
2700
+ name=name,
2701
+ _request_auth=_request_auth,
2702
+ _content_type=_content_type,
2703
+ _headers=_headers,
2704
+ _host_index=_host_index,
2705
+ )
2706
+
2707
+ _response_types_map: Dict[str, Optional[str]] = {
2708
+ "200": "GetWAFResponse",
2709
+ "400": None,
2710
+ "401": "Status",
2711
+ "403": None,
2712
+ "404": None,
2713
+ "500": None,
2714
+ }
2715
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2716
+ return response_data.response
2717
+
2718
+ def _get_waf_serialize(
2719
+ self,
2720
+ project_id,
2721
+ region,
2722
+ name,
2723
+ _request_auth,
2724
+ _content_type,
2725
+ _headers,
2726
+ _host_index,
2727
+ ) -> RequestSerialized:
2728
+
2729
+ _host = None
2730
+
2731
+ _collection_formats: Dict[str, str] = {}
2732
+
2733
+ _path_params: Dict[str, str] = {}
2734
+ _query_params: List[Tuple[str, str]] = []
2735
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2736
+ _form_params: List[Tuple[str, str]] = []
2737
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
2738
+ _body_params: Optional[bytes] = None
2739
+
2740
+ # process the path parameters
2741
+ if project_id is not None:
2742
+ _path_params["projectId"] = project_id
2743
+ if region is not None:
2744
+ _path_params["region"] = region
2745
+ if name is not None:
2746
+ _path_params["name"] = name
2747
+ # process the query parameters
2748
+ # process the header parameters
2749
+ # process the form parameters
2750
+ # process the body parameter
2751
+
2752
+ # set the HTTP header `Accept`
2753
+ if "Accept" not in _header_params:
2754
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
2755
+
2756
+ # authentication setting
2757
+ _auth_settings: List[str] = []
2758
+
2759
+ return self.api_client.param_serialize(
2760
+ method="GET",
2761
+ resource_path="/v1/projects/{projectId}/regions/{region}/wafs/{name}",
2762
+ path_params=_path_params,
2763
+ query_params=_query_params,
2764
+ header_params=_header_params,
2765
+ body=_body_params,
2766
+ post_params=_form_params,
2767
+ files=_files,
2768
+ auth_settings=_auth_settings,
2769
+ collection_formats=_collection_formats,
2770
+ _host=_host,
2771
+ _request_auth=_request_auth,
2772
+ )
2773
+
2774
+ @validate_call
2775
+ def list_custom_rule_group(
2776
+ self,
2777
+ project_id: StrictStr,
2778
+ region: StrictStr,
2779
+ page_size: Annotated[
2780
+ Optional[StrictStr],
2781
+ Field(
2782
+ description="page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000"
2783
+ ),
2784
+ ] = None,
2785
+ page_id: Annotated[
2786
+ Optional[StrictStr],
2787
+ Field(
2788
+ description="page_id is a page identifier returned by the previous response and is used to request the next page"
2789
+ ),
2790
+ ] = None,
2791
+ _request_timeout: Union[
2792
+ None,
2793
+ Annotated[StrictFloat, Field(gt=0)],
2794
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2795
+ ] = None,
2796
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2797
+ _content_type: Optional[StrictStr] = None,
2798
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2799
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2800
+ ) -> ListCustomRuleGroupResponse:
2801
+ """List of CRG configurations
2802
+
2803
+ List all existing Custom Rule Groups that are stored in the project.
2804
+
2805
+ :param project_id: (required)
2806
+ :type project_id: str
2807
+ :param region: (required)
2808
+ :type region: str
2809
+ :param page_size: page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000
2810
+ :type page_size: str
2811
+ :param page_id: page_id is a page identifier returned by the previous response and is used to request the next page
2812
+ :type page_id: str
2813
+ :param _request_timeout: timeout setting for this request. If one
2814
+ number provided, it will be total request
2815
+ timeout. It can also be a pair (tuple) of
2816
+ (connection, read) timeouts.
2817
+ :type _request_timeout: int, tuple(int, int), optional
2818
+ :param _request_auth: set to override the auth_settings for an a single
2819
+ request; this effectively ignores the
2820
+ authentication in the spec for a single request.
2821
+ :type _request_auth: dict, optional
2822
+ :param _content_type: force content-type for the request.
2823
+ :type _content_type: str, Optional
2824
+ :param _headers: set to override the headers for a single
2825
+ request; this effectively ignores the headers
2826
+ in the spec for a single request.
2827
+ :type _headers: dict, optional
2828
+ :param _host_index: set to override the host_index for a single
2829
+ request; this effectively ignores the host_index
2830
+ in the spec for a single request.
2831
+ :type _host_index: int, optional
2832
+ :return: Returns the result object.
2833
+ """ # noqa: E501
2834
+
2835
+ _param = self._list_custom_rule_group_serialize(
2836
+ project_id=project_id,
2837
+ region=region,
2838
+ page_size=page_size,
2839
+ page_id=page_id,
2840
+ _request_auth=_request_auth,
2841
+ _content_type=_content_type,
2842
+ _headers=_headers,
2843
+ _host_index=_host_index,
2844
+ )
2845
+
2846
+ _response_types_map: Dict[str, Optional[str]] = {
2847
+ "200": "ListCustomRuleGroupResponse",
2848
+ "400": None,
2849
+ "401": "Status",
2850
+ "403": None,
2851
+ "410": None,
2852
+ "500": None,
2853
+ }
2854
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2855
+ response_data.read()
2856
+ return self.api_client.response_deserialize(
2857
+ response_data=response_data,
2858
+ response_types_map=_response_types_map,
2859
+ ).data
2860
+
2861
+ @validate_call
2862
+ def list_custom_rule_group_with_http_info(
2863
+ self,
2864
+ project_id: StrictStr,
2865
+ region: StrictStr,
2866
+ page_size: Annotated[
2867
+ Optional[StrictStr],
2868
+ Field(
2869
+ description="page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000"
2870
+ ),
2871
+ ] = None,
2872
+ page_id: Annotated[
2873
+ Optional[StrictStr],
2874
+ Field(
2875
+ description="page_id is a page identifier returned by the previous response and is used to request the next page"
2876
+ ),
2877
+ ] = None,
2878
+ _request_timeout: Union[
2879
+ None,
2880
+ Annotated[StrictFloat, Field(gt=0)],
2881
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2882
+ ] = None,
2883
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2884
+ _content_type: Optional[StrictStr] = None,
2885
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2886
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2887
+ ) -> ApiResponse[ListCustomRuleGroupResponse]:
2888
+ """List of CRG configurations
2889
+
2890
+ List all existing Custom Rule Groups that are stored in the project.
2891
+
2892
+ :param project_id: (required)
2893
+ :type project_id: str
2894
+ :param region: (required)
2895
+ :type region: str
2896
+ :param page_size: page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000
2897
+ :type page_size: str
2898
+ :param page_id: page_id is a page identifier returned by the previous response and is used to request the next page
2899
+ :type page_id: str
2900
+ :param _request_timeout: timeout setting for this request. If one
2901
+ number provided, it will be total request
2902
+ timeout. It can also be a pair (tuple) of
2903
+ (connection, read) timeouts.
2904
+ :type _request_timeout: int, tuple(int, int), optional
2905
+ :param _request_auth: set to override the auth_settings for an a single
2906
+ request; this effectively ignores the
2907
+ authentication in the spec for a single request.
2908
+ :type _request_auth: dict, optional
2909
+ :param _content_type: force content-type for the request.
2910
+ :type _content_type: str, Optional
2911
+ :param _headers: set to override the headers for a single
2912
+ request; this effectively ignores the headers
2913
+ in the spec for a single request.
2914
+ :type _headers: dict, optional
2915
+ :param _host_index: set to override the host_index for a single
2916
+ request; this effectively ignores the host_index
2917
+ in the spec for a single request.
2918
+ :type _host_index: int, optional
2919
+ :return: Returns the result object.
2920
+ """ # noqa: E501
2921
+
2922
+ _param = self._list_custom_rule_group_serialize(
2923
+ project_id=project_id,
2924
+ region=region,
2925
+ page_size=page_size,
2926
+ page_id=page_id,
2927
+ _request_auth=_request_auth,
2928
+ _content_type=_content_type,
2929
+ _headers=_headers,
2930
+ _host_index=_host_index,
2931
+ )
2932
+
2933
+ _response_types_map: Dict[str, Optional[str]] = {
2934
+ "200": "ListCustomRuleGroupResponse",
2935
+ "400": None,
2936
+ "401": "Status",
2937
+ "403": None,
2938
+ "410": None,
2939
+ "500": None,
2940
+ }
2941
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2942
+ response_data.read()
2943
+ return self.api_client.response_deserialize(
2944
+ response_data=response_data,
2945
+ response_types_map=_response_types_map,
2946
+ )
2947
+
2948
+ @validate_call
2949
+ def list_custom_rule_group_without_preload_content(
2950
+ self,
2951
+ project_id: StrictStr,
2952
+ region: StrictStr,
2953
+ page_size: Annotated[
2954
+ Optional[StrictStr],
2955
+ Field(
2956
+ description="page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000"
2957
+ ),
2958
+ ] = None,
2959
+ page_id: Annotated[
2960
+ Optional[StrictStr],
2961
+ Field(
2962
+ description="page_id is a page identifier returned by the previous response and is used to request the next page"
2963
+ ),
2964
+ ] = None,
2965
+ _request_timeout: Union[
2966
+ None,
2967
+ Annotated[StrictFloat, Field(gt=0)],
2968
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2969
+ ] = None,
2970
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2971
+ _content_type: Optional[StrictStr] = None,
2972
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2973
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2974
+ ) -> RESTResponseType:
2975
+ """List of CRG configurations
2976
+
2977
+ List all existing Custom Rule Groups that are stored in the project.
2978
+
2979
+ :param project_id: (required)
2980
+ :type project_id: str
2981
+ :param region: (required)
2982
+ :type region: str
2983
+ :param page_size: page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000
2984
+ :type page_size: str
2985
+ :param page_id: page_id is a page identifier returned by the previous response and is used to request the next page
2986
+ :type page_id: str
2987
+ :param _request_timeout: timeout setting for this request. If one
2988
+ number provided, it will be total request
2989
+ timeout. It can also be a pair (tuple) of
2990
+ (connection, read) timeouts.
2991
+ :type _request_timeout: int, tuple(int, int), optional
2992
+ :param _request_auth: set to override the auth_settings for an a single
2993
+ request; this effectively ignores the
2994
+ authentication in the spec for a single request.
2995
+ :type _request_auth: dict, optional
2996
+ :param _content_type: force content-type for the request.
2997
+ :type _content_type: str, Optional
2998
+ :param _headers: set to override the headers for a single
2999
+ request; this effectively ignores the headers
3000
+ in the spec for a single request.
3001
+ :type _headers: dict, optional
3002
+ :param _host_index: set to override the host_index for a single
3003
+ request; this effectively ignores the host_index
3004
+ in the spec for a single request.
3005
+ :type _host_index: int, optional
3006
+ :return: Returns the result object.
3007
+ """ # noqa: E501
3008
+
3009
+ _param = self._list_custom_rule_group_serialize(
3010
+ project_id=project_id,
3011
+ region=region,
3012
+ page_size=page_size,
3013
+ page_id=page_id,
3014
+ _request_auth=_request_auth,
3015
+ _content_type=_content_type,
3016
+ _headers=_headers,
3017
+ _host_index=_host_index,
3018
+ )
3019
+
3020
+ _response_types_map: Dict[str, Optional[str]] = {
3021
+ "200": "ListCustomRuleGroupResponse",
3022
+ "400": None,
3023
+ "401": "Status",
3024
+ "403": None,
3025
+ "410": None,
3026
+ "500": None,
3027
+ }
3028
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3029
+ return response_data.response
3030
+
3031
+ def _list_custom_rule_group_serialize(
3032
+ self,
3033
+ project_id,
3034
+ region,
3035
+ page_size,
3036
+ page_id,
3037
+ _request_auth,
3038
+ _content_type,
3039
+ _headers,
3040
+ _host_index,
3041
+ ) -> RequestSerialized:
3042
+
3043
+ _host = None
3044
+
3045
+ _collection_formats: Dict[str, str] = {}
3046
+
3047
+ _path_params: Dict[str, str] = {}
3048
+ _query_params: List[Tuple[str, str]] = []
3049
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3050
+ _form_params: List[Tuple[str, str]] = []
3051
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
3052
+ _body_params: Optional[bytes] = None
3053
+
3054
+ # process the path parameters
3055
+ if project_id is not None:
3056
+ _path_params["projectId"] = project_id
3057
+ if region is not None:
3058
+ _path_params["region"] = region
3059
+ # process the query parameters
3060
+ if page_size is not None:
3061
+
3062
+ _query_params.append(("pageSize", page_size))
3063
+
3064
+ if page_id is not None:
3065
+
3066
+ _query_params.append(("pageId", page_id))
3067
+
3068
+ # process the header parameters
3069
+ # process the form parameters
3070
+ # process the body parameter
3071
+
3072
+ # set the HTTP header `Accept`
3073
+ if "Accept" not in _header_params:
3074
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
3075
+
3076
+ # authentication setting
3077
+ _auth_settings: List[str] = []
3078
+
3079
+ return self.api_client.param_serialize(
3080
+ method="GET",
3081
+ resource_path="/v1/projects/{projectId}/regions/{region}/custom-rule-groups",
3082
+ path_params=_path_params,
3083
+ query_params=_query_params,
3084
+ header_params=_header_params,
3085
+ body=_body_params,
3086
+ post_params=_form_params,
3087
+ files=_files,
3088
+ auth_settings=_auth_settings,
3089
+ collection_formats=_collection_formats,
3090
+ _host=_host,
3091
+ _request_auth=_request_auth,
3092
+ )
3093
+
3094
+ @validate_call
3095
+ def list_managed_rule_sets(
3096
+ self,
3097
+ project_id: StrictStr,
3098
+ region: StrictStr,
3099
+ page_size: Annotated[
3100
+ Optional[StrictStr],
3101
+ Field(
3102
+ description="page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000"
3103
+ ),
3104
+ ] = None,
3105
+ page_id: Annotated[
3106
+ Optional[StrictStr],
3107
+ Field(
3108
+ description="page_id is a page identifier returned by the previous response and is used to request the next page"
3109
+ ),
3110
+ ] = None,
3111
+ _request_timeout: Union[
3112
+ None,
3113
+ Annotated[StrictFloat, Field(gt=0)],
3114
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3115
+ ] = None,
3116
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3117
+ _content_type: Optional[StrictStr] = None,
3118
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3119
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3120
+ ) -> ListManagedRuleSetResponse:
3121
+ """List of MRS configurations
3122
+
3123
+ List all existing managed rule set (MRS) configurations that are stored in the project.
3124
+
3125
+ :param project_id: (required)
3126
+ :type project_id: str
3127
+ :param region: (required)
3128
+ :type region: str
3129
+ :param page_size: page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000
3130
+ :type page_size: str
3131
+ :param page_id: page_id is a page identifier returned by the previous response and is used to request the next page
3132
+ :type page_id: str
3133
+ :param _request_timeout: timeout setting for this request. If one
3134
+ number provided, it will be total request
3135
+ timeout. It can also be a pair (tuple) of
3136
+ (connection, read) timeouts.
3137
+ :type _request_timeout: int, tuple(int, int), optional
3138
+ :param _request_auth: set to override the auth_settings for an a single
3139
+ request; this effectively ignores the
3140
+ authentication in the spec for a single request.
3141
+ :type _request_auth: dict, optional
3142
+ :param _content_type: force content-type for the request.
3143
+ :type _content_type: str, Optional
3144
+ :param _headers: set to override the headers for a single
3145
+ request; this effectively ignores the headers
3146
+ in the spec for a single request.
3147
+ :type _headers: dict, optional
3148
+ :param _host_index: set to override the host_index for a single
3149
+ request; this effectively ignores the host_index
3150
+ in the spec for a single request.
3151
+ :type _host_index: int, optional
3152
+ :return: Returns the result object.
3153
+ """ # noqa: E501
3154
+
3155
+ _param = self._list_managed_rule_sets_serialize(
3156
+ project_id=project_id,
3157
+ region=region,
3158
+ page_size=page_size,
3159
+ page_id=page_id,
3160
+ _request_auth=_request_auth,
3161
+ _content_type=_content_type,
3162
+ _headers=_headers,
3163
+ _host_index=_host_index,
3164
+ )
3165
+
3166
+ _response_types_map: Dict[str, Optional[str]] = {
3167
+ "200": "ListManagedRuleSetResponse",
3168
+ "400": None,
3169
+ "401": "Status",
3170
+ "403": None,
3171
+ "410": None,
3172
+ "500": None,
3173
+ }
3174
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3175
+ response_data.read()
3176
+ return self.api_client.response_deserialize(
3177
+ response_data=response_data,
3178
+ response_types_map=_response_types_map,
3179
+ ).data
3180
+
3181
+ @validate_call
3182
+ def list_managed_rule_sets_with_http_info(
3183
+ self,
3184
+ project_id: StrictStr,
3185
+ region: StrictStr,
3186
+ page_size: Annotated[
3187
+ Optional[StrictStr],
3188
+ Field(
3189
+ description="page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000"
3190
+ ),
3191
+ ] = None,
3192
+ page_id: Annotated[
3193
+ Optional[StrictStr],
3194
+ Field(
3195
+ description="page_id is a page identifier returned by the previous response and is used to request the next page"
3196
+ ),
3197
+ ] = None,
3198
+ _request_timeout: Union[
3199
+ None,
3200
+ Annotated[StrictFloat, Field(gt=0)],
3201
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3202
+ ] = None,
3203
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3204
+ _content_type: Optional[StrictStr] = None,
3205
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3206
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3207
+ ) -> ApiResponse[ListManagedRuleSetResponse]:
3208
+ """List of MRS configurations
3209
+
3210
+ List all existing managed rule set (MRS) configurations that are stored in the project.
3211
+
3212
+ :param project_id: (required)
3213
+ :type project_id: str
3214
+ :param region: (required)
3215
+ :type region: str
3216
+ :param page_size: page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000
3217
+ :type page_size: str
3218
+ :param page_id: page_id is a page identifier returned by the previous response and is used to request the next page
3219
+ :type page_id: str
3220
+ :param _request_timeout: timeout setting for this request. If one
3221
+ number provided, it will be total request
3222
+ timeout. It can also be a pair (tuple) of
3223
+ (connection, read) timeouts.
3224
+ :type _request_timeout: int, tuple(int, int), optional
3225
+ :param _request_auth: set to override the auth_settings for an a single
3226
+ request; this effectively ignores the
3227
+ authentication in the spec for a single request.
3228
+ :type _request_auth: dict, optional
3229
+ :param _content_type: force content-type for the request.
3230
+ :type _content_type: str, Optional
3231
+ :param _headers: set to override the headers for a single
3232
+ request; this effectively ignores the headers
3233
+ in the spec for a single request.
3234
+ :type _headers: dict, optional
3235
+ :param _host_index: set to override the host_index for a single
3236
+ request; this effectively ignores the host_index
3237
+ in the spec for a single request.
3238
+ :type _host_index: int, optional
3239
+ :return: Returns the result object.
3240
+ """ # noqa: E501
3241
+
3242
+ _param = self._list_managed_rule_sets_serialize(
3243
+ project_id=project_id,
3244
+ region=region,
3245
+ page_size=page_size,
3246
+ page_id=page_id,
3247
+ _request_auth=_request_auth,
3248
+ _content_type=_content_type,
3249
+ _headers=_headers,
3250
+ _host_index=_host_index,
3251
+ )
3252
+
3253
+ _response_types_map: Dict[str, Optional[str]] = {
3254
+ "200": "ListManagedRuleSetResponse",
3255
+ "400": None,
3256
+ "401": "Status",
3257
+ "403": None,
3258
+ "410": None,
3259
+ "500": None,
3260
+ }
3261
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3262
+ response_data.read()
3263
+ return self.api_client.response_deserialize(
3264
+ response_data=response_data,
3265
+ response_types_map=_response_types_map,
3266
+ )
3267
+
3268
+ @validate_call
3269
+ def list_managed_rule_sets_without_preload_content(
3270
+ self,
3271
+ project_id: StrictStr,
3272
+ region: StrictStr,
3273
+ page_size: Annotated[
3274
+ Optional[StrictStr],
3275
+ Field(
3276
+ description="page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000"
3277
+ ),
3278
+ ] = None,
3279
+ page_id: Annotated[
3280
+ Optional[StrictStr],
3281
+ Field(
3282
+ description="page_id is a page identifier returned by the previous response and is used to request the next page"
3283
+ ),
3284
+ ] = None,
3285
+ _request_timeout: Union[
3286
+ None,
3287
+ Annotated[StrictFloat, Field(gt=0)],
3288
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3289
+ ] = None,
3290
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3291
+ _content_type: Optional[StrictStr] = None,
3292
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3293
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3294
+ ) -> RESTResponseType:
3295
+ """List of MRS configurations
3296
+
3297
+ List all existing managed rule set (MRS) configurations that are stored in the project.
3298
+
3299
+ :param project_id: (required)
3300
+ :type project_id: str
3301
+ :param region: (required)
3302
+ :type region: str
3303
+ :param page_size: page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000
3304
+ :type page_size: str
3305
+ :param page_id: page_id is a page identifier returned by the previous response and is used to request the next page
3306
+ :type page_id: str
3307
+ :param _request_timeout: timeout setting for this request. If one
3308
+ number provided, it will be total request
3309
+ timeout. It can also be a pair (tuple) of
3310
+ (connection, read) timeouts.
3311
+ :type _request_timeout: int, tuple(int, int), optional
3312
+ :param _request_auth: set to override the auth_settings for an a single
3313
+ request; this effectively ignores the
3314
+ authentication in the spec for a single request.
3315
+ :type _request_auth: dict, optional
3316
+ :param _content_type: force content-type for the request.
3317
+ :type _content_type: str, Optional
3318
+ :param _headers: set to override the headers for a single
3319
+ request; this effectively ignores the headers
3320
+ in the spec for a single request.
3321
+ :type _headers: dict, optional
3322
+ :param _host_index: set to override the host_index for a single
3323
+ request; this effectively ignores the host_index
3324
+ in the spec for a single request.
3325
+ :type _host_index: int, optional
3326
+ :return: Returns the result object.
3327
+ """ # noqa: E501
3328
+
3329
+ _param = self._list_managed_rule_sets_serialize(
3330
+ project_id=project_id,
3331
+ region=region,
3332
+ page_size=page_size,
3333
+ page_id=page_id,
3334
+ _request_auth=_request_auth,
3335
+ _content_type=_content_type,
3336
+ _headers=_headers,
3337
+ _host_index=_host_index,
3338
+ )
3339
+
3340
+ _response_types_map: Dict[str, Optional[str]] = {
3341
+ "200": "ListManagedRuleSetResponse",
3342
+ "400": None,
3343
+ "401": "Status",
3344
+ "403": None,
3345
+ "410": None,
3346
+ "500": None,
3347
+ }
3348
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3349
+ return response_data.response
3350
+
3351
+ def _list_managed_rule_sets_serialize(
3352
+ self,
3353
+ project_id,
3354
+ region,
3355
+ page_size,
3356
+ page_id,
3357
+ _request_auth,
3358
+ _content_type,
3359
+ _headers,
3360
+ _host_index,
3361
+ ) -> RequestSerialized:
3362
+
3363
+ _host = None
3364
+
3365
+ _collection_formats: Dict[str, str] = {}
3366
+
3367
+ _path_params: Dict[str, str] = {}
3368
+ _query_params: List[Tuple[str, str]] = []
3369
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3370
+ _form_params: List[Tuple[str, str]] = []
3371
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
3372
+ _body_params: Optional[bytes] = None
3373
+
3374
+ # process the path parameters
3375
+ if project_id is not None:
3376
+ _path_params["projectId"] = project_id
3377
+ if region is not None:
3378
+ _path_params["region"] = region
3379
+ # process the query parameters
3380
+ if page_size is not None:
3381
+
3382
+ _query_params.append(("pageSize", page_size))
3383
+
3384
+ if page_id is not None:
3385
+
3386
+ _query_params.append(("pageId", page_id))
3387
+
3388
+ # process the header parameters
3389
+ # process the form parameters
3390
+ # process the body parameter
3391
+
3392
+ # set the HTTP header `Accept`
3393
+ if "Accept" not in _header_params:
3394
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
3395
+
3396
+ # authentication setting
3397
+ _auth_settings: List[str] = []
3398
+
3399
+ return self.api_client.param_serialize(
3400
+ method="GET",
3401
+ resource_path="/v1/projects/{projectId}/regions/{region}/managed-rule-sets",
3402
+ path_params=_path_params,
3403
+ query_params=_query_params,
3404
+ header_params=_header_params,
3405
+ body=_body_params,
3406
+ post_params=_form_params,
3407
+ files=_files,
3408
+ auth_settings=_auth_settings,
3409
+ collection_formats=_collection_formats,
3410
+ _host=_host,
3411
+ _request_auth=_request_auth,
3412
+ )
3413
+
3414
+ @validate_call
3415
+ def list_waf(
3416
+ self,
3417
+ project_id: StrictStr,
3418
+ region: StrictStr,
3419
+ page_size: Annotated[
3420
+ Optional[StrictStr],
3421
+ Field(
3422
+ description="page_size specifies how many WAFs should be returned on this page. Must be a positive number <= 1000"
3423
+ ),
3424
+ ] = None,
3425
+ page_id: Annotated[
3426
+ Optional[StrictStr],
3427
+ Field(
3428
+ description="page_id is a page identifier returned by the previous response and is used to request the next page"
3429
+ ),
3430
+ ] = None,
3431
+ _request_timeout: Union[
3432
+ None,
3433
+ Annotated[StrictFloat, Field(gt=0)],
3434
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3435
+ ] = None,
3436
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3437
+ _content_type: Optional[StrictStr] = None,
3438
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3439
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3440
+ ) -> ListWAFResponse:
3441
+ """List of WAF configurations
3442
+
3443
+ To list all WAF configurations stored in a project, use this endpoint.
3444
+
3445
+ :param project_id: (required)
3446
+ :type project_id: str
3447
+ :param region: (required)
3448
+ :type region: str
3449
+ :param page_size: page_size specifies how many WAFs should be returned on this page. Must be a positive number <= 1000
3450
+ :type page_size: str
3451
+ :param page_id: page_id is a page identifier returned by the previous response and is used to request the next page
3452
+ :type page_id: str
3453
+ :param _request_timeout: timeout setting for this request. If one
3454
+ number provided, it will be total request
3455
+ timeout. It can also be a pair (tuple) of
3456
+ (connection, read) timeouts.
3457
+ :type _request_timeout: int, tuple(int, int), optional
3458
+ :param _request_auth: set to override the auth_settings for an a single
3459
+ request; this effectively ignores the
3460
+ authentication in the spec for a single request.
3461
+ :type _request_auth: dict, optional
3462
+ :param _content_type: force content-type for the request.
3463
+ :type _content_type: str, Optional
3464
+ :param _headers: set to override the headers for a single
3465
+ request; this effectively ignores the headers
3466
+ in the spec for a single request.
3467
+ :type _headers: dict, optional
3468
+ :param _host_index: set to override the host_index for a single
3469
+ request; this effectively ignores the host_index
3470
+ in the spec for a single request.
3471
+ :type _host_index: int, optional
3472
+ :return: Returns the result object.
3473
+ """ # noqa: E501
3474
+
3475
+ _param = self._list_waf_serialize(
3476
+ project_id=project_id,
3477
+ region=region,
3478
+ page_size=page_size,
3479
+ page_id=page_id,
3480
+ _request_auth=_request_auth,
3481
+ _content_type=_content_type,
3482
+ _headers=_headers,
3483
+ _host_index=_host_index,
3484
+ )
3485
+
3486
+ _response_types_map: Dict[str, Optional[str]] = {
3487
+ "200": "ListWAFResponse",
3488
+ "400": None,
3489
+ "401": "Status",
3490
+ "403": None,
3491
+ "410": None,
3492
+ "500": None,
3493
+ }
3494
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3495
+ response_data.read()
3496
+ return self.api_client.response_deserialize(
3497
+ response_data=response_data,
3498
+ response_types_map=_response_types_map,
3499
+ ).data
3500
+
3501
+ @validate_call
3502
+ def list_waf_with_http_info(
3503
+ self,
3504
+ project_id: StrictStr,
3505
+ region: StrictStr,
3506
+ page_size: Annotated[
3507
+ Optional[StrictStr],
3508
+ Field(
3509
+ description="page_size specifies how many WAFs should be returned on this page. Must be a positive number <= 1000"
3510
+ ),
3511
+ ] = None,
3512
+ page_id: Annotated[
3513
+ Optional[StrictStr],
3514
+ Field(
3515
+ description="page_id is a page identifier returned by the previous response and is used to request the next page"
3516
+ ),
3517
+ ] = None,
3518
+ _request_timeout: Union[
3519
+ None,
3520
+ Annotated[StrictFloat, Field(gt=0)],
3521
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3522
+ ] = None,
3523
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3524
+ _content_type: Optional[StrictStr] = None,
3525
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3526
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3527
+ ) -> ApiResponse[ListWAFResponse]:
3528
+ """List of WAF configurations
3529
+
3530
+ To list all WAF configurations stored in a project, use this endpoint.
3531
+
3532
+ :param project_id: (required)
3533
+ :type project_id: str
3534
+ :param region: (required)
3535
+ :type region: str
3536
+ :param page_size: page_size specifies how many WAFs should be returned on this page. Must be a positive number <= 1000
3537
+ :type page_size: str
3538
+ :param page_id: page_id is a page identifier returned by the previous response and is used to request the next page
3539
+ :type page_id: str
3540
+ :param _request_timeout: timeout setting for this request. If one
3541
+ number provided, it will be total request
3542
+ timeout. It can also be a pair (tuple) of
3543
+ (connection, read) timeouts.
3544
+ :type _request_timeout: int, tuple(int, int), optional
3545
+ :param _request_auth: set to override the auth_settings for an a single
3546
+ request; this effectively ignores the
3547
+ authentication in the spec for a single request.
3548
+ :type _request_auth: dict, optional
3549
+ :param _content_type: force content-type for the request.
3550
+ :type _content_type: str, Optional
3551
+ :param _headers: set to override the headers for a single
3552
+ request; this effectively ignores the headers
3553
+ in the spec for a single request.
3554
+ :type _headers: dict, optional
3555
+ :param _host_index: set to override the host_index for a single
3556
+ request; this effectively ignores the host_index
3557
+ in the spec for a single request.
3558
+ :type _host_index: int, optional
3559
+ :return: Returns the result object.
3560
+ """ # noqa: E501
3561
+
3562
+ _param = self._list_waf_serialize(
3563
+ project_id=project_id,
3564
+ region=region,
3565
+ page_size=page_size,
3566
+ page_id=page_id,
3567
+ _request_auth=_request_auth,
3568
+ _content_type=_content_type,
3569
+ _headers=_headers,
3570
+ _host_index=_host_index,
3571
+ )
3572
+
3573
+ _response_types_map: Dict[str, Optional[str]] = {
3574
+ "200": "ListWAFResponse",
3575
+ "400": None,
3576
+ "401": "Status",
3577
+ "403": None,
3578
+ "410": None,
3579
+ "500": None,
3580
+ }
3581
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3582
+ response_data.read()
3583
+ return self.api_client.response_deserialize(
3584
+ response_data=response_data,
3585
+ response_types_map=_response_types_map,
3586
+ )
3587
+
3588
+ @validate_call
3589
+ def list_waf_without_preload_content(
3590
+ self,
3591
+ project_id: StrictStr,
3592
+ region: StrictStr,
3593
+ page_size: Annotated[
3594
+ Optional[StrictStr],
3595
+ Field(
3596
+ description="page_size specifies how many WAFs should be returned on this page. Must be a positive number <= 1000"
3597
+ ),
3598
+ ] = None,
3599
+ page_id: Annotated[
3600
+ Optional[StrictStr],
3601
+ Field(
3602
+ description="page_id is a page identifier returned by the previous response and is used to request the next page"
3603
+ ),
3604
+ ] = None,
3605
+ _request_timeout: Union[
3606
+ None,
3607
+ Annotated[StrictFloat, Field(gt=0)],
3608
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3609
+ ] = None,
3610
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3611
+ _content_type: Optional[StrictStr] = None,
3612
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3613
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3614
+ ) -> RESTResponseType:
3615
+ """List of WAF configurations
3616
+
3617
+ To list all WAF configurations stored in a project, use this endpoint.
3618
+
3619
+ :param project_id: (required)
3620
+ :type project_id: str
3621
+ :param region: (required)
3622
+ :type region: str
3623
+ :param page_size: page_size specifies how many WAFs should be returned on this page. Must be a positive number <= 1000
3624
+ :type page_size: str
3625
+ :param page_id: page_id is a page identifier returned by the previous response and is used to request the next page
3626
+ :type page_id: str
3627
+ :param _request_timeout: timeout setting for this request. If one
3628
+ number provided, it will be total request
3629
+ timeout. It can also be a pair (tuple) of
3630
+ (connection, read) timeouts.
3631
+ :type _request_timeout: int, tuple(int, int), optional
3632
+ :param _request_auth: set to override the auth_settings for an a single
3633
+ request; this effectively ignores the
3634
+ authentication in the spec for a single request.
3635
+ :type _request_auth: dict, optional
3636
+ :param _content_type: force content-type for the request.
3637
+ :type _content_type: str, Optional
3638
+ :param _headers: set to override the headers for a single
3639
+ request; this effectively ignores the headers
3640
+ in the spec for a single request.
3641
+ :type _headers: dict, optional
3642
+ :param _host_index: set to override the host_index for a single
3643
+ request; this effectively ignores the host_index
3644
+ in the spec for a single request.
3645
+ :type _host_index: int, optional
3646
+ :return: Returns the result object.
3647
+ """ # noqa: E501
3648
+
3649
+ _param = self._list_waf_serialize(
3650
+ project_id=project_id,
3651
+ region=region,
3652
+ page_size=page_size,
3653
+ page_id=page_id,
3654
+ _request_auth=_request_auth,
3655
+ _content_type=_content_type,
3656
+ _headers=_headers,
3657
+ _host_index=_host_index,
3658
+ )
3659
+
3660
+ _response_types_map: Dict[str, Optional[str]] = {
3661
+ "200": "ListWAFResponse",
3662
+ "400": None,
3663
+ "401": "Status",
3664
+ "403": None,
3665
+ "410": None,
3666
+ "500": None,
3667
+ }
3668
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3669
+ return response_data.response
3670
+
3671
+ def _list_waf_serialize(
3672
+ self,
3673
+ project_id,
3674
+ region,
3675
+ page_size,
3676
+ page_id,
3677
+ _request_auth,
3678
+ _content_type,
3679
+ _headers,
3680
+ _host_index,
3681
+ ) -> RequestSerialized:
3682
+
3683
+ _host = None
3684
+
3685
+ _collection_formats: Dict[str, str] = {}
3686
+
3687
+ _path_params: Dict[str, str] = {}
3688
+ _query_params: List[Tuple[str, str]] = []
3689
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3690
+ _form_params: List[Tuple[str, str]] = []
3691
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
3692
+ _body_params: Optional[bytes] = None
3693
+
3694
+ # process the path parameters
3695
+ if project_id is not None:
3696
+ _path_params["projectId"] = project_id
3697
+ if region is not None:
3698
+ _path_params["region"] = region
3699
+ # process the query parameters
3700
+ if page_size is not None:
3701
+
3702
+ _query_params.append(("pageSize", page_size))
3703
+
3704
+ if page_id is not None:
3705
+
3706
+ _query_params.append(("pageId", page_id))
3707
+
3708
+ # process the header parameters
3709
+ # process the form parameters
3710
+ # process the body parameter
3711
+
3712
+ # set the HTTP header `Accept`
3713
+ if "Accept" not in _header_params:
3714
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
3715
+
3716
+ # authentication setting
3717
+ _auth_settings: List[str] = []
3718
+
3719
+ return self.api_client.param_serialize(
3720
+ method="GET",
3721
+ resource_path="/v1/projects/{projectId}/regions/{region}/wafs",
3722
+ path_params=_path_params,
3723
+ query_params=_query_params,
3724
+ header_params=_header_params,
3725
+ body=_body_params,
3726
+ post_params=_form_params,
3727
+ files=_files,
3728
+ auth_settings=_auth_settings,
3729
+ collection_formats=_collection_formats,
3730
+ _host=_host,
3731
+ _request_auth=_request_auth,
3732
+ )
3733
+
3734
+ @validate_call
3735
+ def patch_managed_rule_set(
3736
+ self,
3737
+ project_id: StrictStr,
3738
+ region: StrictStr,
3739
+ name: StrictStr,
3740
+ patch_managed_rule_set_payload: PatchManagedRuleSetPayload,
3741
+ _request_timeout: Union[
3742
+ None,
3743
+ Annotated[StrictFloat, Field(gt=0)],
3744
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3745
+ ] = None,
3746
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3747
+ _content_type: Optional[StrictStr] = None,
3748
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3749
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3750
+ ) -> GetManagedRuleSetResponse:
3751
+ """Granularly update a MRS configuration
3752
+
3753
+ Accepts the same structure as the GET response. Only fields provided with values will be updated.
3754
+
3755
+ :param project_id: (required)
3756
+ :type project_id: str
3757
+ :param region: (required)
3758
+ :type region: str
3759
+ :param name: (required)
3760
+ :type name: str
3761
+ :param patch_managed_rule_set_payload: (required)
3762
+ :type patch_managed_rule_set_payload: PatchManagedRuleSetPayload
3763
+ :param _request_timeout: timeout setting for this request. If one
3764
+ number provided, it will be total request
3765
+ timeout. It can also be a pair (tuple) of
3766
+ (connection, read) timeouts.
3767
+ :type _request_timeout: int, tuple(int, int), optional
3768
+ :param _request_auth: set to override the auth_settings for an a single
3769
+ request; this effectively ignores the
3770
+ authentication in the spec for a single request.
3771
+ :type _request_auth: dict, optional
3772
+ :param _content_type: force content-type for the request.
3773
+ :type _content_type: str, Optional
3774
+ :param _headers: set to override the headers for a single
3775
+ request; this effectively ignores the headers
3776
+ in the spec for a single request.
3777
+ :type _headers: dict, optional
3778
+ :param _host_index: set to override the host_index for a single
3779
+ request; this effectively ignores the host_index
3780
+ in the spec for a single request.
3781
+ :type _host_index: int, optional
3782
+ :return: Returns the result object.
3783
+ """ # noqa: E501
3784
+
3785
+ _param = self._patch_managed_rule_set_serialize(
3786
+ project_id=project_id,
3787
+ region=region,
3788
+ name=name,
3789
+ patch_managed_rule_set_payload=patch_managed_rule_set_payload,
3790
+ _request_auth=_request_auth,
3791
+ _content_type=_content_type,
3792
+ _headers=_headers,
3793
+ _host_index=_host_index,
3794
+ )
3795
+
3796
+ _response_types_map: Dict[str, Optional[str]] = {
3797
+ "200": "GetManagedRuleSetResponse",
3798
+ "400": None,
3799
+ "401": "Status",
3800
+ "403": None,
3801
+ "404": None,
3802
+ "500": None,
3803
+ }
3804
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3805
+ response_data.read()
3806
+ return self.api_client.response_deserialize(
3807
+ response_data=response_data,
3808
+ response_types_map=_response_types_map,
3809
+ ).data
3810
+
3811
+ @validate_call
3812
+ def patch_managed_rule_set_with_http_info(
3813
+ self,
3814
+ project_id: StrictStr,
3815
+ region: StrictStr,
3816
+ name: StrictStr,
3817
+ patch_managed_rule_set_payload: PatchManagedRuleSetPayload,
3818
+ _request_timeout: Union[
3819
+ None,
3820
+ Annotated[StrictFloat, Field(gt=0)],
3821
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3822
+ ] = None,
3823
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3824
+ _content_type: Optional[StrictStr] = None,
3825
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3826
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3827
+ ) -> ApiResponse[GetManagedRuleSetResponse]:
3828
+ """Granularly update a MRS configuration
3829
+
3830
+ Accepts the same structure as the GET response. Only fields provided with values will be updated.
3831
+
3832
+ :param project_id: (required)
3833
+ :type project_id: str
3834
+ :param region: (required)
3835
+ :type region: str
3836
+ :param name: (required)
3837
+ :type name: str
3838
+ :param patch_managed_rule_set_payload: (required)
3839
+ :type patch_managed_rule_set_payload: PatchManagedRuleSetPayload
3840
+ :param _request_timeout: timeout setting for this request. If one
3841
+ number provided, it will be total request
3842
+ timeout. It can also be a pair (tuple) of
3843
+ (connection, read) timeouts.
3844
+ :type _request_timeout: int, tuple(int, int), optional
3845
+ :param _request_auth: set to override the auth_settings for an a single
3846
+ request; this effectively ignores the
3847
+ authentication in the spec for a single request.
3848
+ :type _request_auth: dict, optional
3849
+ :param _content_type: force content-type for the request.
3850
+ :type _content_type: str, Optional
3851
+ :param _headers: set to override the headers for a single
3852
+ request; this effectively ignores the headers
3853
+ in the spec for a single request.
3854
+ :type _headers: dict, optional
3855
+ :param _host_index: set to override the host_index for a single
3856
+ request; this effectively ignores the host_index
3857
+ in the spec for a single request.
3858
+ :type _host_index: int, optional
3859
+ :return: Returns the result object.
3860
+ """ # noqa: E501
3861
+
3862
+ _param = self._patch_managed_rule_set_serialize(
3863
+ project_id=project_id,
3864
+ region=region,
3865
+ name=name,
3866
+ patch_managed_rule_set_payload=patch_managed_rule_set_payload,
3867
+ _request_auth=_request_auth,
3868
+ _content_type=_content_type,
3869
+ _headers=_headers,
3870
+ _host_index=_host_index,
3871
+ )
3872
+
3873
+ _response_types_map: Dict[str, Optional[str]] = {
3874
+ "200": "GetManagedRuleSetResponse",
3875
+ "400": None,
3876
+ "401": "Status",
3877
+ "403": None,
3878
+ "404": None,
3879
+ "500": None,
3880
+ }
3881
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3882
+ response_data.read()
3883
+ return self.api_client.response_deserialize(
3884
+ response_data=response_data,
3885
+ response_types_map=_response_types_map,
3886
+ )
3887
+
3888
+ @validate_call
3889
+ def patch_managed_rule_set_without_preload_content(
3890
+ self,
3891
+ project_id: StrictStr,
3892
+ region: StrictStr,
3893
+ name: StrictStr,
3894
+ patch_managed_rule_set_payload: PatchManagedRuleSetPayload,
3895
+ _request_timeout: Union[
3896
+ None,
3897
+ Annotated[StrictFloat, Field(gt=0)],
3898
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3899
+ ] = None,
3900
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3901
+ _content_type: Optional[StrictStr] = None,
3902
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3903
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3904
+ ) -> RESTResponseType:
3905
+ """Granularly update a MRS configuration
3906
+
3907
+ Accepts the same structure as the GET response. Only fields provided with values will be updated.
3908
+
3909
+ :param project_id: (required)
3910
+ :type project_id: str
3911
+ :param region: (required)
3912
+ :type region: str
3913
+ :param name: (required)
3914
+ :type name: str
3915
+ :param patch_managed_rule_set_payload: (required)
3916
+ :type patch_managed_rule_set_payload: PatchManagedRuleSetPayload
3917
+ :param _request_timeout: timeout setting for this request. If one
3918
+ number provided, it will be total request
3919
+ timeout. It can also be a pair (tuple) of
3920
+ (connection, read) timeouts.
3921
+ :type _request_timeout: int, tuple(int, int), optional
3922
+ :param _request_auth: set to override the auth_settings for an a single
3923
+ request; this effectively ignores the
3924
+ authentication in the spec for a single request.
3925
+ :type _request_auth: dict, optional
3926
+ :param _content_type: force content-type for the request.
3927
+ :type _content_type: str, Optional
3928
+ :param _headers: set to override the headers for a single
3929
+ request; this effectively ignores the headers
3930
+ in the spec for a single request.
3931
+ :type _headers: dict, optional
3932
+ :param _host_index: set to override the host_index for a single
3933
+ request; this effectively ignores the host_index
3934
+ in the spec for a single request.
3935
+ :type _host_index: int, optional
3936
+ :return: Returns the result object.
3937
+ """ # noqa: E501
3938
+
3939
+ _param = self._patch_managed_rule_set_serialize(
3940
+ project_id=project_id,
3941
+ region=region,
3942
+ name=name,
3943
+ patch_managed_rule_set_payload=patch_managed_rule_set_payload,
3944
+ _request_auth=_request_auth,
3945
+ _content_type=_content_type,
3946
+ _headers=_headers,
3947
+ _host_index=_host_index,
3948
+ )
3949
+
3950
+ _response_types_map: Dict[str, Optional[str]] = {
3951
+ "200": "GetManagedRuleSetResponse",
3952
+ "400": None,
3953
+ "401": "Status",
3954
+ "403": None,
3955
+ "404": None,
3956
+ "500": None,
3957
+ }
3958
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3959
+ return response_data.response
3960
+
3961
+ def _patch_managed_rule_set_serialize(
3962
+ self,
3963
+ project_id,
3964
+ region,
3965
+ name,
3966
+ patch_managed_rule_set_payload,
3967
+ _request_auth,
3968
+ _content_type,
3969
+ _headers,
3970
+ _host_index,
3971
+ ) -> RequestSerialized:
3972
+
3973
+ _host = None
3974
+
3975
+ _collection_formats: Dict[str, str] = {}
3976
+
3977
+ _path_params: Dict[str, str] = {}
3978
+ _query_params: List[Tuple[str, str]] = []
3979
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3980
+ _form_params: List[Tuple[str, str]] = []
3981
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
3982
+ _body_params: Optional[bytes] = None
3983
+
3984
+ # process the path parameters
3985
+ if project_id is not None:
3986
+ _path_params["projectId"] = project_id
3987
+ if region is not None:
3988
+ _path_params["region"] = region
3989
+ if name is not None:
3990
+ _path_params["name"] = name
3991
+ # process the query parameters
3992
+ # process the header parameters
3993
+ # process the form parameters
3994
+ # process the body parameter
3995
+ if patch_managed_rule_set_payload is not None:
3996
+ _body_params = patch_managed_rule_set_payload
3997
+
3998
+ # set the HTTP header `Accept`
3999
+ if "Accept" not in _header_params:
4000
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
4001
+
4002
+ # set the HTTP header `Content-Type`
4003
+ if _content_type:
4004
+ _header_params["Content-Type"] = _content_type
4005
+ else:
4006
+ _default_content_type = self.api_client.select_header_content_type(["application/json"])
4007
+ if _default_content_type is not None:
4008
+ _header_params["Content-Type"] = _default_content_type
4009
+
4010
+ # authentication setting
4011
+ _auth_settings: List[str] = []
4012
+
4013
+ return self.api_client.param_serialize(
4014
+ method="PATCH",
4015
+ resource_path="/v1/projects/{projectId}/regions/{region}/managed-rule-sets/{name}",
4016
+ path_params=_path_params,
4017
+ query_params=_query_params,
4018
+ header_params=_header_params,
4019
+ body=_body_params,
4020
+ post_params=_form_params,
4021
+ files=_files,
4022
+ auth_settings=_auth_settings,
4023
+ collection_formats=_collection_formats,
4024
+ _host=_host,
4025
+ _request_auth=_request_auth,
4026
+ )
4027
+
4028
+ @validate_call
4029
+ def update_custom_rule_group(
4030
+ self,
4031
+ project_id: StrictStr,
4032
+ region: StrictStr,
4033
+ name: StrictStr,
4034
+ update_custom_rule_group_payload: UpdateCustomRuleGroupPayload,
4035
+ _request_timeout: Union[
4036
+ None,
4037
+ Annotated[StrictFloat, Field(gt=0)],
4038
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
4039
+ ] = None,
4040
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4041
+ _content_type: Optional[StrictStr] = None,
4042
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4043
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4044
+ ) -> GetCustomRuleGroupResponse:
4045
+ """Update a CRG configuration
4046
+
4047
+ Replaces the rules array of an existing CRG. The CRG name is immutable and used as the resource key. Send the complete desired rule set; per-rule partial merge is not supported.
4048
+
4049
+ :param project_id: (required)
4050
+ :type project_id: str
4051
+ :param region: (required)
4052
+ :type region: str
4053
+ :param name: (required)
4054
+ :type name: str
4055
+ :param update_custom_rule_group_payload: (required)
4056
+ :type update_custom_rule_group_payload: UpdateCustomRuleGroupPayload
4057
+ :param _request_timeout: timeout setting for this request. If one
4058
+ number provided, it will be total request
4059
+ timeout. It can also be a pair (tuple) of
4060
+ (connection, read) timeouts.
4061
+ :type _request_timeout: int, tuple(int, int), optional
4062
+ :param _request_auth: set to override the auth_settings for an a single
4063
+ request; this effectively ignores the
4064
+ authentication in the spec for a single request.
4065
+ :type _request_auth: dict, optional
4066
+ :param _content_type: force content-type for the request.
4067
+ :type _content_type: str, Optional
4068
+ :param _headers: set to override the headers for a single
4069
+ request; this effectively ignores the headers
4070
+ in the spec for a single request.
4071
+ :type _headers: dict, optional
4072
+ :param _host_index: set to override the host_index for a single
4073
+ request; this effectively ignores the host_index
4074
+ in the spec for a single request.
4075
+ :type _host_index: int, optional
4076
+ :return: Returns the result object.
4077
+ """ # noqa: E501
4078
+
4079
+ _param = self._update_custom_rule_group_serialize(
4080
+ project_id=project_id,
4081
+ region=region,
4082
+ name=name,
4083
+ update_custom_rule_group_payload=update_custom_rule_group_payload,
4084
+ _request_auth=_request_auth,
4085
+ _content_type=_content_type,
4086
+ _headers=_headers,
4087
+ _host_index=_host_index,
4088
+ )
4089
+
4090
+ _response_types_map: Dict[str, Optional[str]] = {
4091
+ "200": "GetCustomRuleGroupResponse",
4092
+ "400": None,
4093
+ "401": "Status",
4094
+ "403": None,
4095
+ "500": None,
4096
+ }
4097
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
4098
+ response_data.read()
4099
+ return self.api_client.response_deserialize(
4100
+ response_data=response_data,
4101
+ response_types_map=_response_types_map,
4102
+ ).data
4103
+
4104
+ @validate_call
4105
+ def update_custom_rule_group_with_http_info(
4106
+ self,
4107
+ project_id: StrictStr,
4108
+ region: StrictStr,
4109
+ name: StrictStr,
4110
+ update_custom_rule_group_payload: UpdateCustomRuleGroupPayload,
4111
+ _request_timeout: Union[
4112
+ None,
4113
+ Annotated[StrictFloat, Field(gt=0)],
4114
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
4115
+ ] = None,
4116
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4117
+ _content_type: Optional[StrictStr] = None,
4118
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4119
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4120
+ ) -> ApiResponse[GetCustomRuleGroupResponse]:
4121
+ """Update a CRG configuration
4122
+
4123
+ Replaces the rules array of an existing CRG. The CRG name is immutable and used as the resource key. Send the complete desired rule set; per-rule partial merge is not supported.
4124
+
4125
+ :param project_id: (required)
4126
+ :type project_id: str
4127
+ :param region: (required)
4128
+ :type region: str
4129
+ :param name: (required)
4130
+ :type name: str
4131
+ :param update_custom_rule_group_payload: (required)
4132
+ :type update_custom_rule_group_payload: UpdateCustomRuleGroupPayload
4133
+ :param _request_timeout: timeout setting for this request. If one
4134
+ number provided, it will be total request
4135
+ timeout. It can also be a pair (tuple) of
4136
+ (connection, read) timeouts.
4137
+ :type _request_timeout: int, tuple(int, int), optional
4138
+ :param _request_auth: set to override the auth_settings for an a single
4139
+ request; this effectively ignores the
4140
+ authentication in the spec for a single request.
4141
+ :type _request_auth: dict, optional
4142
+ :param _content_type: force content-type for the request.
4143
+ :type _content_type: str, Optional
4144
+ :param _headers: set to override the headers for a single
4145
+ request; this effectively ignores the headers
4146
+ in the spec for a single request.
4147
+ :type _headers: dict, optional
4148
+ :param _host_index: set to override the host_index for a single
4149
+ request; this effectively ignores the host_index
4150
+ in the spec for a single request.
4151
+ :type _host_index: int, optional
4152
+ :return: Returns the result object.
4153
+ """ # noqa: E501
4154
+
4155
+ _param = self._update_custom_rule_group_serialize(
4156
+ project_id=project_id,
4157
+ region=region,
4158
+ name=name,
4159
+ update_custom_rule_group_payload=update_custom_rule_group_payload,
4160
+ _request_auth=_request_auth,
4161
+ _content_type=_content_type,
4162
+ _headers=_headers,
4163
+ _host_index=_host_index,
4164
+ )
4165
+
4166
+ _response_types_map: Dict[str, Optional[str]] = {
4167
+ "200": "GetCustomRuleGroupResponse",
4168
+ "400": None,
4169
+ "401": "Status",
4170
+ "403": None,
4171
+ "500": None,
4172
+ }
4173
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
4174
+ response_data.read()
4175
+ return self.api_client.response_deserialize(
4176
+ response_data=response_data,
4177
+ response_types_map=_response_types_map,
4178
+ )
4179
+
4180
+ @validate_call
4181
+ def update_custom_rule_group_without_preload_content(
4182
+ self,
4183
+ project_id: StrictStr,
4184
+ region: StrictStr,
4185
+ name: StrictStr,
4186
+ update_custom_rule_group_payload: UpdateCustomRuleGroupPayload,
4187
+ _request_timeout: Union[
4188
+ None,
4189
+ Annotated[StrictFloat, Field(gt=0)],
4190
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
4191
+ ] = None,
4192
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4193
+ _content_type: Optional[StrictStr] = None,
4194
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4195
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4196
+ ) -> RESTResponseType:
4197
+ """Update a CRG configuration
4198
+
4199
+ Replaces the rules array of an existing CRG. The CRG name is immutable and used as the resource key. Send the complete desired rule set; per-rule partial merge is not supported.
4200
+
4201
+ :param project_id: (required)
4202
+ :type project_id: str
4203
+ :param region: (required)
4204
+ :type region: str
4205
+ :param name: (required)
4206
+ :type name: str
4207
+ :param update_custom_rule_group_payload: (required)
4208
+ :type update_custom_rule_group_payload: UpdateCustomRuleGroupPayload
4209
+ :param _request_timeout: timeout setting for this request. If one
4210
+ number provided, it will be total request
4211
+ timeout. It can also be a pair (tuple) of
4212
+ (connection, read) timeouts.
4213
+ :type _request_timeout: int, tuple(int, int), optional
4214
+ :param _request_auth: set to override the auth_settings for an a single
4215
+ request; this effectively ignores the
4216
+ authentication in the spec for a single request.
4217
+ :type _request_auth: dict, optional
4218
+ :param _content_type: force content-type for the request.
4219
+ :type _content_type: str, Optional
4220
+ :param _headers: set to override the headers for a single
4221
+ request; this effectively ignores the headers
4222
+ in the spec for a single request.
4223
+ :type _headers: dict, optional
4224
+ :param _host_index: set to override the host_index for a single
4225
+ request; this effectively ignores the host_index
4226
+ in the spec for a single request.
4227
+ :type _host_index: int, optional
4228
+ :return: Returns the result object.
4229
+ """ # noqa: E501
4230
+
4231
+ _param = self._update_custom_rule_group_serialize(
4232
+ project_id=project_id,
4233
+ region=region,
4234
+ name=name,
4235
+ update_custom_rule_group_payload=update_custom_rule_group_payload,
4236
+ _request_auth=_request_auth,
4237
+ _content_type=_content_type,
4238
+ _headers=_headers,
4239
+ _host_index=_host_index,
4240
+ )
4241
+
4242
+ _response_types_map: Dict[str, Optional[str]] = {
4243
+ "200": "GetCustomRuleGroupResponse",
4244
+ "400": None,
4245
+ "401": "Status",
4246
+ "403": None,
4247
+ "500": None,
4248
+ }
4249
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
4250
+ return response_data.response
4251
+
4252
+ def _update_custom_rule_group_serialize(
4253
+ self,
4254
+ project_id,
4255
+ region,
4256
+ name,
4257
+ update_custom_rule_group_payload,
4258
+ _request_auth,
4259
+ _content_type,
4260
+ _headers,
4261
+ _host_index,
4262
+ ) -> RequestSerialized:
4263
+
4264
+ _host = None
4265
+
4266
+ _collection_formats: Dict[str, str] = {}
4267
+
4268
+ _path_params: Dict[str, str] = {}
4269
+ _query_params: List[Tuple[str, str]] = []
4270
+ _header_params: Dict[str, Optional[str]] = _headers or {}
4271
+ _form_params: List[Tuple[str, str]] = []
4272
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
4273
+ _body_params: Optional[bytes] = None
4274
+
4275
+ # process the path parameters
4276
+ if project_id is not None:
4277
+ _path_params["projectId"] = project_id
4278
+ if region is not None:
4279
+ _path_params["region"] = region
4280
+ if name is not None:
4281
+ _path_params["name"] = name
4282
+ # process the query parameters
4283
+ # process the header parameters
4284
+ # process the form parameters
4285
+ # process the body parameter
4286
+ if update_custom_rule_group_payload is not None:
4287
+ _body_params = update_custom_rule_group_payload
4288
+
4289
+ # set the HTTP header `Accept`
4290
+ if "Accept" not in _header_params:
4291
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
4292
+
4293
+ # set the HTTP header `Content-Type`
4294
+ if _content_type:
4295
+ _header_params["Content-Type"] = _content_type
4296
+ else:
4297
+ _default_content_type = self.api_client.select_header_content_type(["application/json"])
4298
+ if _default_content_type is not None:
4299
+ _header_params["Content-Type"] = _default_content_type
4300
+
4301
+ # authentication setting
4302
+ _auth_settings: List[str] = []
4303
+
4304
+ return self.api_client.param_serialize(
4305
+ method="PUT",
4306
+ resource_path="/v1/projects/{projectId}/regions/{region}/custom-rule-groups/{name}",
4307
+ path_params=_path_params,
4308
+ query_params=_query_params,
4309
+ header_params=_header_params,
4310
+ body=_body_params,
4311
+ post_params=_form_params,
4312
+ files=_files,
4313
+ auth_settings=_auth_settings,
4314
+ collection_formats=_collection_formats,
4315
+ _host=_host,
4316
+ _request_auth=_request_auth,
4317
+ )
4318
+
4319
+ @validate_call
4320
+ def update_waf(
4321
+ self,
4322
+ project_id: StrictStr,
4323
+ region: StrictStr,
4324
+ name: StrictStr,
4325
+ update_waf_payload: UpdateWAFPayload,
4326
+ _request_timeout: Union[
4327
+ None,
4328
+ Annotated[StrictFloat, Field(gt=0)],
4329
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
4330
+ ] = None,
4331
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4332
+ _content_type: Optional[StrictStr] = None,
4333
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4334
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4335
+ ) -> GetWAFResponse:
4336
+ """Update a WAF configuration
4337
+
4338
+ The update endpoint will update a stored WAF configuration in project and not yet but later will also update the Load Balancers that reference it.
4339
+
4340
+ :param project_id: (required)
4341
+ :type project_id: str
4342
+ :param region: (required)
4343
+ :type region: str
4344
+ :param name: (required)
4345
+ :type name: str
4346
+ :param update_waf_payload: (required)
4347
+ :type update_waf_payload: UpdateWAFPayload
4348
+ :param _request_timeout: timeout setting for this request. If one
4349
+ number provided, it will be total request
4350
+ timeout. It can also be a pair (tuple) of
4351
+ (connection, read) timeouts.
4352
+ :type _request_timeout: int, tuple(int, int), optional
4353
+ :param _request_auth: set to override the auth_settings for an a single
4354
+ request; this effectively ignores the
4355
+ authentication in the spec for a single request.
4356
+ :type _request_auth: dict, optional
4357
+ :param _content_type: force content-type for the request.
4358
+ :type _content_type: str, Optional
4359
+ :param _headers: set to override the headers for a single
4360
+ request; this effectively ignores the headers
4361
+ in the spec for a single request.
4362
+ :type _headers: dict, optional
4363
+ :param _host_index: set to override the host_index for a single
4364
+ request; this effectively ignores the host_index
4365
+ in the spec for a single request.
4366
+ :type _host_index: int, optional
4367
+ :return: Returns the result object.
4368
+ """ # noqa: E501
4369
+
4370
+ _param = self._update_waf_serialize(
4371
+ project_id=project_id,
4372
+ region=region,
4373
+ name=name,
4374
+ update_waf_payload=update_waf_payload,
4375
+ _request_auth=_request_auth,
4376
+ _content_type=_content_type,
4377
+ _headers=_headers,
4378
+ _host_index=_host_index,
4379
+ )
4380
+
4381
+ _response_types_map: Dict[str, Optional[str]] = {
4382
+ "200": "GetWAFResponse",
4383
+ "400": None,
4384
+ "401": "Status",
4385
+ "403": None,
4386
+ "409": None,
4387
+ "500": None,
4388
+ }
4389
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
4390
+ response_data.read()
4391
+ return self.api_client.response_deserialize(
4392
+ response_data=response_data,
4393
+ response_types_map=_response_types_map,
4394
+ ).data
4395
+
4396
+ @validate_call
4397
+ def update_waf_with_http_info(
4398
+ self,
4399
+ project_id: StrictStr,
4400
+ region: StrictStr,
4401
+ name: StrictStr,
4402
+ update_waf_payload: UpdateWAFPayload,
4403
+ _request_timeout: Union[
4404
+ None,
4405
+ Annotated[StrictFloat, Field(gt=0)],
4406
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
4407
+ ] = None,
4408
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4409
+ _content_type: Optional[StrictStr] = None,
4410
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4411
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4412
+ ) -> ApiResponse[GetWAFResponse]:
4413
+ """Update a WAF configuration
4414
+
4415
+ The update endpoint will update a stored WAF configuration in project and not yet but later will also update the Load Balancers that reference it.
4416
+
4417
+ :param project_id: (required)
4418
+ :type project_id: str
4419
+ :param region: (required)
4420
+ :type region: str
4421
+ :param name: (required)
4422
+ :type name: str
4423
+ :param update_waf_payload: (required)
4424
+ :type update_waf_payload: UpdateWAFPayload
4425
+ :param _request_timeout: timeout setting for this request. If one
4426
+ number provided, it will be total request
4427
+ timeout. It can also be a pair (tuple) of
4428
+ (connection, read) timeouts.
4429
+ :type _request_timeout: int, tuple(int, int), optional
4430
+ :param _request_auth: set to override the auth_settings for an a single
4431
+ request; this effectively ignores the
4432
+ authentication in the spec for a single request.
4433
+ :type _request_auth: dict, optional
4434
+ :param _content_type: force content-type for the request.
4435
+ :type _content_type: str, Optional
4436
+ :param _headers: set to override the headers for a single
4437
+ request; this effectively ignores the headers
4438
+ in the spec for a single request.
4439
+ :type _headers: dict, optional
4440
+ :param _host_index: set to override the host_index for a single
4441
+ request; this effectively ignores the host_index
4442
+ in the spec for a single request.
4443
+ :type _host_index: int, optional
4444
+ :return: Returns the result object.
4445
+ """ # noqa: E501
4446
+
4447
+ _param = self._update_waf_serialize(
4448
+ project_id=project_id,
4449
+ region=region,
4450
+ name=name,
4451
+ update_waf_payload=update_waf_payload,
4452
+ _request_auth=_request_auth,
4453
+ _content_type=_content_type,
4454
+ _headers=_headers,
4455
+ _host_index=_host_index,
4456
+ )
4457
+
4458
+ _response_types_map: Dict[str, Optional[str]] = {
4459
+ "200": "GetWAFResponse",
4460
+ "400": None,
4461
+ "401": "Status",
4462
+ "403": None,
4463
+ "409": None,
4464
+ "500": None,
4465
+ }
4466
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
4467
+ response_data.read()
4468
+ return self.api_client.response_deserialize(
4469
+ response_data=response_data,
4470
+ response_types_map=_response_types_map,
4471
+ )
4472
+
4473
+ @validate_call
4474
+ def update_waf_without_preload_content(
4475
+ self,
4476
+ project_id: StrictStr,
4477
+ region: StrictStr,
4478
+ name: StrictStr,
4479
+ update_waf_payload: UpdateWAFPayload,
4480
+ _request_timeout: Union[
4481
+ None,
4482
+ Annotated[StrictFloat, Field(gt=0)],
4483
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
4484
+ ] = None,
4485
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4486
+ _content_type: Optional[StrictStr] = None,
4487
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4488
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4489
+ ) -> RESTResponseType:
4490
+ """Update a WAF configuration
4491
+
4492
+ The update endpoint will update a stored WAF configuration in project and not yet but later will also update the Load Balancers that reference it.
4493
+
4494
+ :param project_id: (required)
4495
+ :type project_id: str
4496
+ :param region: (required)
4497
+ :type region: str
4498
+ :param name: (required)
4499
+ :type name: str
4500
+ :param update_waf_payload: (required)
4501
+ :type update_waf_payload: UpdateWAFPayload
4502
+ :param _request_timeout: timeout setting for this request. If one
4503
+ number provided, it will be total request
4504
+ timeout. It can also be a pair (tuple) of
4505
+ (connection, read) timeouts.
4506
+ :type _request_timeout: int, tuple(int, int), optional
4507
+ :param _request_auth: set to override the auth_settings for an a single
4508
+ request; this effectively ignores the
4509
+ authentication in the spec for a single request.
4510
+ :type _request_auth: dict, optional
4511
+ :param _content_type: force content-type for the request.
4512
+ :type _content_type: str, Optional
4513
+ :param _headers: set to override the headers for a single
4514
+ request; this effectively ignores the headers
4515
+ in the spec for a single request.
4516
+ :type _headers: dict, optional
4517
+ :param _host_index: set to override the host_index for a single
4518
+ request; this effectively ignores the host_index
4519
+ in the spec for a single request.
4520
+ :type _host_index: int, optional
4521
+ :return: Returns the result object.
4522
+ """ # noqa: E501
4523
+
4524
+ _param = self._update_waf_serialize(
4525
+ project_id=project_id,
4526
+ region=region,
4527
+ name=name,
4528
+ update_waf_payload=update_waf_payload,
4529
+ _request_auth=_request_auth,
4530
+ _content_type=_content_type,
4531
+ _headers=_headers,
4532
+ _host_index=_host_index,
4533
+ )
4534
+
4535
+ _response_types_map: Dict[str, Optional[str]] = {
4536
+ "200": "GetWAFResponse",
4537
+ "400": None,
4538
+ "401": "Status",
4539
+ "403": None,
4540
+ "409": None,
4541
+ "500": None,
4542
+ }
4543
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
4544
+ return response_data.response
4545
+
4546
+ def _update_waf_serialize(
4547
+ self,
4548
+ project_id,
4549
+ region,
4550
+ name,
4551
+ update_waf_payload,
4552
+ _request_auth,
4553
+ _content_type,
4554
+ _headers,
4555
+ _host_index,
4556
+ ) -> RequestSerialized:
4557
+
4558
+ _host = None
4559
+
4560
+ _collection_formats: Dict[str, str] = {}
4561
+
4562
+ _path_params: Dict[str, str] = {}
4563
+ _query_params: List[Tuple[str, str]] = []
4564
+ _header_params: Dict[str, Optional[str]] = _headers or {}
4565
+ _form_params: List[Tuple[str, str]] = []
4566
+ _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {}
4567
+ _body_params: Optional[bytes] = None
4568
+
4569
+ # process the path parameters
4570
+ if project_id is not None:
4571
+ _path_params["projectId"] = project_id
4572
+ if region is not None:
4573
+ _path_params["region"] = region
4574
+ if name is not None:
4575
+ _path_params["name"] = name
4576
+ # process the query parameters
4577
+ # process the header parameters
4578
+ # process the form parameters
4579
+ # process the body parameter
4580
+ if update_waf_payload is not None:
4581
+ _body_params = update_waf_payload
4582
+
4583
+ # set the HTTP header `Accept`
4584
+ if "Accept" not in _header_params:
4585
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json", "*/*"])
4586
+
4587
+ # set the HTTP header `Content-Type`
4588
+ if _content_type:
4589
+ _header_params["Content-Type"] = _content_type
4590
+ else:
4591
+ _default_content_type = self.api_client.select_header_content_type(["application/json"])
4592
+ if _default_content_type is not None:
4593
+ _header_params["Content-Type"] = _default_content_type
4594
+
4595
+ # authentication setting
4596
+ _auth_settings: List[str] = []
4597
+
4598
+ return self.api_client.param_serialize(
4599
+ method="PUT",
4600
+ resource_path="/v1/projects/{projectId}/regions/{region}/wafs/{name}",
4601
+ path_params=_path_params,
4602
+ query_params=_query_params,
4603
+ header_params=_header_params,
4604
+ body=_body_params,
4605
+ post_params=_form_params,
4606
+ files=_files,
4607
+ auth_settings=_auth_settings,
4608
+ collection_formats=_collection_formats,
4609
+ _host=_host,
4610
+ _request_auth=_request_auth,
4611
+ )