google-cloud-network-security 0.9.17__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 (51) hide show
  1. google/cloud/network_security/__init__.py +91 -0
  2. google/cloud/network_security/gapic_version.py +16 -0
  3. google/cloud/network_security/py.typed +2 -0
  4. google/cloud/network_security_v1/__init__.py +86 -0
  5. google/cloud/network_security_v1/gapic_metadata.json +253 -0
  6. google/cloud/network_security_v1/gapic_version.py +16 -0
  7. google/cloud/network_security_v1/py.typed +2 -0
  8. google/cloud/network_security_v1/services/__init__.py +15 -0
  9. google/cloud/network_security_v1/services/network_security/__init__.py +22 -0
  10. google/cloud/network_security_v1/services/network_security/async_client.py +3074 -0
  11. google/cloud/network_security_v1/services/network_security/client.py +3525 -0
  12. google/cloud/network_security_v1/services/network_security/pagers.py +525 -0
  13. google/cloud/network_security_v1/services/network_security/transports/__init__.py +36 -0
  14. google/cloud/network_security_v1/services/network_security/transports/base.py +524 -0
  15. google/cloud/network_security_v1/services/network_security/transports/grpc.py +993 -0
  16. google/cloud/network_security_v1/services/network_security/transports/grpc_asyncio.py +1138 -0
  17. google/cloud/network_security_v1/services/network_security/transports/rest.py +5057 -0
  18. google/cloud/network_security_v1/services/network_security/transports/rest_base.py +1156 -0
  19. google/cloud/network_security_v1/types/__init__.py +78 -0
  20. google/cloud/network_security_v1/types/authorization_policy.py +430 -0
  21. google/cloud/network_security_v1/types/client_tls_policy.py +270 -0
  22. google/cloud/network_security_v1/types/common.py +93 -0
  23. google/cloud/network_security_v1/types/network_security.py +24 -0
  24. google/cloud/network_security_v1/types/server_tls_policy.py +295 -0
  25. google/cloud/network_security_v1/types/tls.py +153 -0
  26. google/cloud/network_security_v1beta1/__init__.py +86 -0
  27. google/cloud/network_security_v1beta1/gapic_metadata.json +173 -0
  28. google/cloud/network_security_v1beta1/gapic_version.py +16 -0
  29. google/cloud/network_security_v1beta1/py.typed +2 -0
  30. google/cloud/network_security_v1beta1/services/__init__.py +15 -0
  31. google/cloud/network_security_v1beta1/services/network_security/__init__.py +22 -0
  32. google/cloud/network_security_v1beta1/services/network_security/async_client.py +3074 -0
  33. google/cloud/network_security_v1beta1/services/network_security/client.py +3523 -0
  34. google/cloud/network_security_v1beta1/services/network_security/pagers.py +525 -0
  35. google/cloud/network_security_v1beta1/services/network_security/transports/__init__.py +32 -0
  36. google/cloud/network_security_v1beta1/services/network_security/transports/base.py +524 -0
  37. google/cloud/network_security_v1beta1/services/network_security/transports/grpc.py +993 -0
  38. google/cloud/network_security_v1beta1/services/network_security/transports/grpc_asyncio.py +1138 -0
  39. google/cloud/network_security_v1beta1/services/network_security/transports/rest.py +3195 -0
  40. google/cloud/network_security_v1beta1/types/__init__.py +78 -0
  41. google/cloud/network_security_v1beta1/types/authorization_policy.py +430 -0
  42. google/cloud/network_security_v1beta1/types/client_tls_policy.py +270 -0
  43. google/cloud/network_security_v1beta1/types/common.py +93 -0
  44. google/cloud/network_security_v1beta1/types/network_security.py +24 -0
  45. google/cloud/network_security_v1beta1/types/server_tls_policy.py +295 -0
  46. google/cloud/network_security_v1beta1/types/tls.py +153 -0
  47. google_cloud_network_security-0.9.17.dist-info/LICENSE +202 -0
  48. google_cloud_network_security-0.9.17.dist-info/METADATA +229 -0
  49. google_cloud_network_security-0.9.17.dist-info/RECORD +51 -0
  50. google_cloud_network_security-0.9.17.dist-info/WHEEL +5 -0
  51. google_cloud_network_security-0.9.17.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1156 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2024 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json # type: ignore
17
+ import re
18
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
19
+
20
+ from google.api_core import gapic_v1, path_template
21
+ from google.cloud.location import locations_pb2 # type: ignore
22
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
23
+ from google.iam.v1 import policy_pb2 # type: ignore
24
+ from google.longrunning import operations_pb2 # type: ignore
25
+ from google.protobuf import json_format
26
+
27
+ from google.cloud.network_security_v1.types import (
28
+ authorization_policy as gcn_authorization_policy,
29
+ )
30
+ from google.cloud.network_security_v1.types import (
31
+ client_tls_policy as gcn_client_tls_policy,
32
+ )
33
+ from google.cloud.network_security_v1.types import (
34
+ server_tls_policy as gcn_server_tls_policy,
35
+ )
36
+ from google.cloud.network_security_v1.types import authorization_policy
37
+ from google.cloud.network_security_v1.types import client_tls_policy
38
+ from google.cloud.network_security_v1.types import server_tls_policy
39
+
40
+ from .base import DEFAULT_CLIENT_INFO, NetworkSecurityTransport
41
+
42
+
43
+ class _BaseNetworkSecurityRestTransport(NetworkSecurityTransport):
44
+ """Base REST backend transport for NetworkSecurity.
45
+
46
+ Note: This class is not meant to be used directly. Use its sync and
47
+ async sub-classes instead.
48
+
49
+ This class defines the same methods as the primary client, so the
50
+ primary client can load the underlying transport implementation
51
+ and call it.
52
+
53
+ It sends JSON representations of protocol buffers over HTTP/1.1
54
+ """
55
+
56
+ def __init__(
57
+ self,
58
+ *,
59
+ host: str = "networksecurity.googleapis.com",
60
+ credentials: Optional[Any] = None,
61
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
62
+ always_use_jwt_access: Optional[bool] = False,
63
+ url_scheme: str = "https",
64
+ api_audience: Optional[str] = None,
65
+ ) -> None:
66
+ """Instantiate the transport.
67
+ Args:
68
+ host (Optional[str]):
69
+ The hostname to connect to (default: 'networksecurity.googleapis.com').
70
+ credentials (Optional[Any]): The
71
+ authorization credentials to attach to requests. These
72
+ credentials identify the application to the service; if none
73
+ are specified, the client will attempt to ascertain the
74
+ credentials from the environment.
75
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
76
+ The client info used to send a user-agent string along with
77
+ API requests. If ``None``, then default info will be used.
78
+ Generally, you only need to set this if you are developing
79
+ your own client library.
80
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
81
+ be used for service account credentials.
82
+ url_scheme: the protocol scheme for the API endpoint. Normally
83
+ "https", but for testing or local servers,
84
+ "http" can be specified.
85
+ """
86
+ # Run the base constructor
87
+ maybe_url_match = re.match("^(?P<scheme>http(?:s)?://)?(?P<host>.*)$", host)
88
+ if maybe_url_match is None:
89
+ raise ValueError(
90
+ f"Unexpected hostname structure: {host}"
91
+ ) # pragma: NO COVER
92
+
93
+ url_match_items = maybe_url_match.groupdict()
94
+
95
+ host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host
96
+
97
+ super().__init__(
98
+ host=host,
99
+ credentials=credentials,
100
+ client_info=client_info,
101
+ always_use_jwt_access=always_use_jwt_access,
102
+ api_audience=api_audience,
103
+ )
104
+
105
+ class _BaseCreateAuthorizationPolicy:
106
+ def __hash__(self): # pragma: NO COVER
107
+ return NotImplementedError("__hash__ must be implemented.")
108
+
109
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
110
+ "authorizationPolicyId": "",
111
+ }
112
+
113
+ @classmethod
114
+ def _get_unset_required_fields(cls, message_dict):
115
+ return {
116
+ k: v
117
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
118
+ if k not in message_dict
119
+ }
120
+
121
+ @staticmethod
122
+ def _get_http_options():
123
+ http_options: List[Dict[str, str]] = [
124
+ {
125
+ "method": "post",
126
+ "uri": "/v1/{parent=projects/*/locations/*}/authorizationPolicies",
127
+ "body": "authorization_policy",
128
+ },
129
+ ]
130
+ return http_options
131
+
132
+ @staticmethod
133
+ def _get_transcoded_request(http_options, request):
134
+ pb_request = gcn_authorization_policy.CreateAuthorizationPolicyRequest.pb(
135
+ request
136
+ )
137
+ transcoded_request = path_template.transcode(http_options, pb_request)
138
+ return transcoded_request
139
+
140
+ @staticmethod
141
+ def _get_request_body_json(transcoded_request):
142
+ # Jsonify the request body
143
+
144
+ body = json_format.MessageToJson(
145
+ transcoded_request["body"], use_integers_for_enums=True
146
+ )
147
+ return body
148
+
149
+ @staticmethod
150
+ def _get_query_params_json(transcoded_request):
151
+ query_params = json.loads(
152
+ json_format.MessageToJson(
153
+ transcoded_request["query_params"],
154
+ use_integers_for_enums=True,
155
+ )
156
+ )
157
+ query_params.update(
158
+ _BaseNetworkSecurityRestTransport._BaseCreateAuthorizationPolicy._get_unset_required_fields(
159
+ query_params
160
+ )
161
+ )
162
+
163
+ query_params["$alt"] = "json;enum-encoding=int"
164
+ return query_params
165
+
166
+ class _BaseCreateClientTlsPolicy:
167
+ def __hash__(self): # pragma: NO COVER
168
+ return NotImplementedError("__hash__ must be implemented.")
169
+
170
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
171
+ "clientTlsPolicyId": "",
172
+ }
173
+
174
+ @classmethod
175
+ def _get_unset_required_fields(cls, message_dict):
176
+ return {
177
+ k: v
178
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
179
+ if k not in message_dict
180
+ }
181
+
182
+ @staticmethod
183
+ def _get_http_options():
184
+ http_options: List[Dict[str, str]] = [
185
+ {
186
+ "method": "post",
187
+ "uri": "/v1/{parent=projects/*/locations/*}/clientTlsPolicies",
188
+ "body": "client_tls_policy",
189
+ },
190
+ ]
191
+ return http_options
192
+
193
+ @staticmethod
194
+ def _get_transcoded_request(http_options, request):
195
+ pb_request = gcn_client_tls_policy.CreateClientTlsPolicyRequest.pb(request)
196
+ transcoded_request = path_template.transcode(http_options, pb_request)
197
+ return transcoded_request
198
+
199
+ @staticmethod
200
+ def _get_request_body_json(transcoded_request):
201
+ # Jsonify the request body
202
+
203
+ body = json_format.MessageToJson(
204
+ transcoded_request["body"], use_integers_for_enums=True
205
+ )
206
+ return body
207
+
208
+ @staticmethod
209
+ def _get_query_params_json(transcoded_request):
210
+ query_params = json.loads(
211
+ json_format.MessageToJson(
212
+ transcoded_request["query_params"],
213
+ use_integers_for_enums=True,
214
+ )
215
+ )
216
+ query_params.update(
217
+ _BaseNetworkSecurityRestTransport._BaseCreateClientTlsPolicy._get_unset_required_fields(
218
+ query_params
219
+ )
220
+ )
221
+
222
+ query_params["$alt"] = "json;enum-encoding=int"
223
+ return query_params
224
+
225
+ class _BaseCreateServerTlsPolicy:
226
+ def __hash__(self): # pragma: NO COVER
227
+ return NotImplementedError("__hash__ must be implemented.")
228
+
229
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
230
+ "serverTlsPolicyId": "",
231
+ }
232
+
233
+ @classmethod
234
+ def _get_unset_required_fields(cls, message_dict):
235
+ return {
236
+ k: v
237
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
238
+ if k not in message_dict
239
+ }
240
+
241
+ @staticmethod
242
+ def _get_http_options():
243
+ http_options: List[Dict[str, str]] = [
244
+ {
245
+ "method": "post",
246
+ "uri": "/v1/{parent=projects/*/locations/*}/serverTlsPolicies",
247
+ "body": "server_tls_policy",
248
+ },
249
+ ]
250
+ return http_options
251
+
252
+ @staticmethod
253
+ def _get_transcoded_request(http_options, request):
254
+ pb_request = gcn_server_tls_policy.CreateServerTlsPolicyRequest.pb(request)
255
+ transcoded_request = path_template.transcode(http_options, pb_request)
256
+ return transcoded_request
257
+
258
+ @staticmethod
259
+ def _get_request_body_json(transcoded_request):
260
+ # Jsonify the request body
261
+
262
+ body = json_format.MessageToJson(
263
+ transcoded_request["body"], use_integers_for_enums=True
264
+ )
265
+ return body
266
+
267
+ @staticmethod
268
+ def _get_query_params_json(transcoded_request):
269
+ query_params = json.loads(
270
+ json_format.MessageToJson(
271
+ transcoded_request["query_params"],
272
+ use_integers_for_enums=True,
273
+ )
274
+ )
275
+ query_params.update(
276
+ _BaseNetworkSecurityRestTransport._BaseCreateServerTlsPolicy._get_unset_required_fields(
277
+ query_params
278
+ )
279
+ )
280
+
281
+ query_params["$alt"] = "json;enum-encoding=int"
282
+ return query_params
283
+
284
+ class _BaseDeleteAuthorizationPolicy:
285
+ def __hash__(self): # pragma: NO COVER
286
+ return NotImplementedError("__hash__ must be implemented.")
287
+
288
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
289
+
290
+ @classmethod
291
+ def _get_unset_required_fields(cls, message_dict):
292
+ return {
293
+ k: v
294
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
295
+ if k not in message_dict
296
+ }
297
+
298
+ @staticmethod
299
+ def _get_http_options():
300
+ http_options: List[Dict[str, str]] = [
301
+ {
302
+ "method": "delete",
303
+ "uri": "/v1/{name=projects/*/locations/*/authorizationPolicies/*}",
304
+ },
305
+ ]
306
+ return http_options
307
+
308
+ @staticmethod
309
+ def _get_transcoded_request(http_options, request):
310
+ pb_request = authorization_policy.DeleteAuthorizationPolicyRequest.pb(
311
+ request
312
+ )
313
+ transcoded_request = path_template.transcode(http_options, pb_request)
314
+ return transcoded_request
315
+
316
+ @staticmethod
317
+ def _get_query_params_json(transcoded_request):
318
+ query_params = json.loads(
319
+ json_format.MessageToJson(
320
+ transcoded_request["query_params"],
321
+ use_integers_for_enums=True,
322
+ )
323
+ )
324
+ query_params.update(
325
+ _BaseNetworkSecurityRestTransport._BaseDeleteAuthorizationPolicy._get_unset_required_fields(
326
+ query_params
327
+ )
328
+ )
329
+
330
+ query_params["$alt"] = "json;enum-encoding=int"
331
+ return query_params
332
+
333
+ class _BaseDeleteClientTlsPolicy:
334
+ def __hash__(self): # pragma: NO COVER
335
+ return NotImplementedError("__hash__ must be implemented.")
336
+
337
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
338
+
339
+ @classmethod
340
+ def _get_unset_required_fields(cls, message_dict):
341
+ return {
342
+ k: v
343
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
344
+ if k not in message_dict
345
+ }
346
+
347
+ @staticmethod
348
+ def _get_http_options():
349
+ http_options: List[Dict[str, str]] = [
350
+ {
351
+ "method": "delete",
352
+ "uri": "/v1/{name=projects/*/locations/*/clientTlsPolicies/*}",
353
+ },
354
+ ]
355
+ return http_options
356
+
357
+ @staticmethod
358
+ def _get_transcoded_request(http_options, request):
359
+ pb_request = client_tls_policy.DeleteClientTlsPolicyRequest.pb(request)
360
+ transcoded_request = path_template.transcode(http_options, pb_request)
361
+ return transcoded_request
362
+
363
+ @staticmethod
364
+ def _get_query_params_json(transcoded_request):
365
+ query_params = json.loads(
366
+ json_format.MessageToJson(
367
+ transcoded_request["query_params"],
368
+ use_integers_for_enums=True,
369
+ )
370
+ )
371
+ query_params.update(
372
+ _BaseNetworkSecurityRestTransport._BaseDeleteClientTlsPolicy._get_unset_required_fields(
373
+ query_params
374
+ )
375
+ )
376
+
377
+ query_params["$alt"] = "json;enum-encoding=int"
378
+ return query_params
379
+
380
+ class _BaseDeleteServerTlsPolicy:
381
+ def __hash__(self): # pragma: NO COVER
382
+ return NotImplementedError("__hash__ must be implemented.")
383
+
384
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
385
+
386
+ @classmethod
387
+ def _get_unset_required_fields(cls, message_dict):
388
+ return {
389
+ k: v
390
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
391
+ if k not in message_dict
392
+ }
393
+
394
+ @staticmethod
395
+ def _get_http_options():
396
+ http_options: List[Dict[str, str]] = [
397
+ {
398
+ "method": "delete",
399
+ "uri": "/v1/{name=projects/*/locations/*/serverTlsPolicies/*}",
400
+ },
401
+ ]
402
+ return http_options
403
+
404
+ @staticmethod
405
+ def _get_transcoded_request(http_options, request):
406
+ pb_request = server_tls_policy.DeleteServerTlsPolicyRequest.pb(request)
407
+ transcoded_request = path_template.transcode(http_options, pb_request)
408
+ return transcoded_request
409
+
410
+ @staticmethod
411
+ def _get_query_params_json(transcoded_request):
412
+ query_params = json.loads(
413
+ json_format.MessageToJson(
414
+ transcoded_request["query_params"],
415
+ use_integers_for_enums=True,
416
+ )
417
+ )
418
+ query_params.update(
419
+ _BaseNetworkSecurityRestTransport._BaseDeleteServerTlsPolicy._get_unset_required_fields(
420
+ query_params
421
+ )
422
+ )
423
+
424
+ query_params["$alt"] = "json;enum-encoding=int"
425
+ return query_params
426
+
427
+ class _BaseGetAuthorizationPolicy:
428
+ def __hash__(self): # pragma: NO COVER
429
+ return NotImplementedError("__hash__ must be implemented.")
430
+
431
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
432
+
433
+ @classmethod
434
+ def _get_unset_required_fields(cls, message_dict):
435
+ return {
436
+ k: v
437
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
438
+ if k not in message_dict
439
+ }
440
+
441
+ @staticmethod
442
+ def _get_http_options():
443
+ http_options: List[Dict[str, str]] = [
444
+ {
445
+ "method": "get",
446
+ "uri": "/v1/{name=projects/*/locations/*/authorizationPolicies/*}",
447
+ },
448
+ ]
449
+ return http_options
450
+
451
+ @staticmethod
452
+ def _get_transcoded_request(http_options, request):
453
+ pb_request = authorization_policy.GetAuthorizationPolicyRequest.pb(request)
454
+ transcoded_request = path_template.transcode(http_options, pb_request)
455
+ return transcoded_request
456
+
457
+ @staticmethod
458
+ def _get_query_params_json(transcoded_request):
459
+ query_params = json.loads(
460
+ json_format.MessageToJson(
461
+ transcoded_request["query_params"],
462
+ use_integers_for_enums=True,
463
+ )
464
+ )
465
+ query_params.update(
466
+ _BaseNetworkSecurityRestTransport._BaseGetAuthorizationPolicy._get_unset_required_fields(
467
+ query_params
468
+ )
469
+ )
470
+
471
+ query_params["$alt"] = "json;enum-encoding=int"
472
+ return query_params
473
+
474
+ class _BaseGetClientTlsPolicy:
475
+ def __hash__(self): # pragma: NO COVER
476
+ return NotImplementedError("__hash__ must be implemented.")
477
+
478
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
479
+
480
+ @classmethod
481
+ def _get_unset_required_fields(cls, message_dict):
482
+ return {
483
+ k: v
484
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
485
+ if k not in message_dict
486
+ }
487
+
488
+ @staticmethod
489
+ def _get_http_options():
490
+ http_options: List[Dict[str, str]] = [
491
+ {
492
+ "method": "get",
493
+ "uri": "/v1/{name=projects/*/locations/*/clientTlsPolicies/*}",
494
+ },
495
+ ]
496
+ return http_options
497
+
498
+ @staticmethod
499
+ def _get_transcoded_request(http_options, request):
500
+ pb_request = client_tls_policy.GetClientTlsPolicyRequest.pb(request)
501
+ transcoded_request = path_template.transcode(http_options, pb_request)
502
+ return transcoded_request
503
+
504
+ @staticmethod
505
+ def _get_query_params_json(transcoded_request):
506
+ query_params = json.loads(
507
+ json_format.MessageToJson(
508
+ transcoded_request["query_params"],
509
+ use_integers_for_enums=True,
510
+ )
511
+ )
512
+ query_params.update(
513
+ _BaseNetworkSecurityRestTransport._BaseGetClientTlsPolicy._get_unset_required_fields(
514
+ query_params
515
+ )
516
+ )
517
+
518
+ query_params["$alt"] = "json;enum-encoding=int"
519
+ return query_params
520
+
521
+ class _BaseGetServerTlsPolicy:
522
+ def __hash__(self): # pragma: NO COVER
523
+ return NotImplementedError("__hash__ must be implemented.")
524
+
525
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
526
+
527
+ @classmethod
528
+ def _get_unset_required_fields(cls, message_dict):
529
+ return {
530
+ k: v
531
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
532
+ if k not in message_dict
533
+ }
534
+
535
+ @staticmethod
536
+ def _get_http_options():
537
+ http_options: List[Dict[str, str]] = [
538
+ {
539
+ "method": "get",
540
+ "uri": "/v1/{name=projects/*/locations/*/serverTlsPolicies/*}",
541
+ },
542
+ ]
543
+ return http_options
544
+
545
+ @staticmethod
546
+ def _get_transcoded_request(http_options, request):
547
+ pb_request = server_tls_policy.GetServerTlsPolicyRequest.pb(request)
548
+ transcoded_request = path_template.transcode(http_options, pb_request)
549
+ return transcoded_request
550
+
551
+ @staticmethod
552
+ def _get_query_params_json(transcoded_request):
553
+ query_params = json.loads(
554
+ json_format.MessageToJson(
555
+ transcoded_request["query_params"],
556
+ use_integers_for_enums=True,
557
+ )
558
+ )
559
+ query_params.update(
560
+ _BaseNetworkSecurityRestTransport._BaseGetServerTlsPolicy._get_unset_required_fields(
561
+ query_params
562
+ )
563
+ )
564
+
565
+ query_params["$alt"] = "json;enum-encoding=int"
566
+ return query_params
567
+
568
+ class _BaseListAuthorizationPolicies:
569
+ def __hash__(self): # pragma: NO COVER
570
+ return NotImplementedError("__hash__ must be implemented.")
571
+
572
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
573
+
574
+ @classmethod
575
+ def _get_unset_required_fields(cls, message_dict):
576
+ return {
577
+ k: v
578
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
579
+ if k not in message_dict
580
+ }
581
+
582
+ @staticmethod
583
+ def _get_http_options():
584
+ http_options: List[Dict[str, str]] = [
585
+ {
586
+ "method": "get",
587
+ "uri": "/v1/{parent=projects/*/locations/*}/authorizationPolicies",
588
+ },
589
+ ]
590
+ return http_options
591
+
592
+ @staticmethod
593
+ def _get_transcoded_request(http_options, request):
594
+ pb_request = authorization_policy.ListAuthorizationPoliciesRequest.pb(
595
+ request
596
+ )
597
+ transcoded_request = path_template.transcode(http_options, pb_request)
598
+ return transcoded_request
599
+
600
+ @staticmethod
601
+ def _get_query_params_json(transcoded_request):
602
+ query_params = json.loads(
603
+ json_format.MessageToJson(
604
+ transcoded_request["query_params"],
605
+ use_integers_for_enums=True,
606
+ )
607
+ )
608
+ query_params.update(
609
+ _BaseNetworkSecurityRestTransport._BaseListAuthorizationPolicies._get_unset_required_fields(
610
+ query_params
611
+ )
612
+ )
613
+
614
+ query_params["$alt"] = "json;enum-encoding=int"
615
+ return query_params
616
+
617
+ class _BaseListClientTlsPolicies:
618
+ def __hash__(self): # pragma: NO COVER
619
+ return NotImplementedError("__hash__ must be implemented.")
620
+
621
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
622
+
623
+ @classmethod
624
+ def _get_unset_required_fields(cls, message_dict):
625
+ return {
626
+ k: v
627
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
628
+ if k not in message_dict
629
+ }
630
+
631
+ @staticmethod
632
+ def _get_http_options():
633
+ http_options: List[Dict[str, str]] = [
634
+ {
635
+ "method": "get",
636
+ "uri": "/v1/{parent=projects/*/locations/*}/clientTlsPolicies",
637
+ },
638
+ ]
639
+ return http_options
640
+
641
+ @staticmethod
642
+ def _get_transcoded_request(http_options, request):
643
+ pb_request = client_tls_policy.ListClientTlsPoliciesRequest.pb(request)
644
+ transcoded_request = path_template.transcode(http_options, pb_request)
645
+ return transcoded_request
646
+
647
+ @staticmethod
648
+ def _get_query_params_json(transcoded_request):
649
+ query_params = json.loads(
650
+ json_format.MessageToJson(
651
+ transcoded_request["query_params"],
652
+ use_integers_for_enums=True,
653
+ )
654
+ )
655
+ query_params.update(
656
+ _BaseNetworkSecurityRestTransport._BaseListClientTlsPolicies._get_unset_required_fields(
657
+ query_params
658
+ )
659
+ )
660
+
661
+ query_params["$alt"] = "json;enum-encoding=int"
662
+ return query_params
663
+
664
+ class _BaseListServerTlsPolicies:
665
+ def __hash__(self): # pragma: NO COVER
666
+ return NotImplementedError("__hash__ must be implemented.")
667
+
668
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
669
+
670
+ @classmethod
671
+ def _get_unset_required_fields(cls, message_dict):
672
+ return {
673
+ k: v
674
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
675
+ if k not in message_dict
676
+ }
677
+
678
+ @staticmethod
679
+ def _get_http_options():
680
+ http_options: List[Dict[str, str]] = [
681
+ {
682
+ "method": "get",
683
+ "uri": "/v1/{parent=projects/*/locations/*}/serverTlsPolicies",
684
+ },
685
+ ]
686
+ return http_options
687
+
688
+ @staticmethod
689
+ def _get_transcoded_request(http_options, request):
690
+ pb_request = server_tls_policy.ListServerTlsPoliciesRequest.pb(request)
691
+ transcoded_request = path_template.transcode(http_options, pb_request)
692
+ return transcoded_request
693
+
694
+ @staticmethod
695
+ def _get_query_params_json(transcoded_request):
696
+ query_params = json.loads(
697
+ json_format.MessageToJson(
698
+ transcoded_request["query_params"],
699
+ use_integers_for_enums=True,
700
+ )
701
+ )
702
+ query_params.update(
703
+ _BaseNetworkSecurityRestTransport._BaseListServerTlsPolicies._get_unset_required_fields(
704
+ query_params
705
+ )
706
+ )
707
+
708
+ query_params["$alt"] = "json;enum-encoding=int"
709
+ return query_params
710
+
711
+ class _BaseUpdateAuthorizationPolicy:
712
+ def __hash__(self): # pragma: NO COVER
713
+ return NotImplementedError("__hash__ must be implemented.")
714
+
715
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
716
+
717
+ @classmethod
718
+ def _get_unset_required_fields(cls, message_dict):
719
+ return {
720
+ k: v
721
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
722
+ if k not in message_dict
723
+ }
724
+
725
+ @staticmethod
726
+ def _get_http_options():
727
+ http_options: List[Dict[str, str]] = [
728
+ {
729
+ "method": "patch",
730
+ "uri": "/v1/{authorization_policy.name=projects/*/locations/*/authorizationPolicies/*}",
731
+ "body": "authorization_policy",
732
+ },
733
+ ]
734
+ return http_options
735
+
736
+ @staticmethod
737
+ def _get_transcoded_request(http_options, request):
738
+ pb_request = gcn_authorization_policy.UpdateAuthorizationPolicyRequest.pb(
739
+ request
740
+ )
741
+ transcoded_request = path_template.transcode(http_options, pb_request)
742
+ return transcoded_request
743
+
744
+ @staticmethod
745
+ def _get_request_body_json(transcoded_request):
746
+ # Jsonify the request body
747
+
748
+ body = json_format.MessageToJson(
749
+ transcoded_request["body"], use_integers_for_enums=True
750
+ )
751
+ return body
752
+
753
+ @staticmethod
754
+ def _get_query_params_json(transcoded_request):
755
+ query_params = json.loads(
756
+ json_format.MessageToJson(
757
+ transcoded_request["query_params"],
758
+ use_integers_for_enums=True,
759
+ )
760
+ )
761
+ query_params.update(
762
+ _BaseNetworkSecurityRestTransport._BaseUpdateAuthorizationPolicy._get_unset_required_fields(
763
+ query_params
764
+ )
765
+ )
766
+
767
+ query_params["$alt"] = "json;enum-encoding=int"
768
+ return query_params
769
+
770
+ class _BaseUpdateClientTlsPolicy:
771
+ def __hash__(self): # pragma: NO COVER
772
+ return NotImplementedError("__hash__ must be implemented.")
773
+
774
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
775
+
776
+ @classmethod
777
+ def _get_unset_required_fields(cls, message_dict):
778
+ return {
779
+ k: v
780
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
781
+ if k not in message_dict
782
+ }
783
+
784
+ @staticmethod
785
+ def _get_http_options():
786
+ http_options: List[Dict[str, str]] = [
787
+ {
788
+ "method": "patch",
789
+ "uri": "/v1/{client_tls_policy.name=projects/*/locations/*/clientTlsPolicies/*}",
790
+ "body": "client_tls_policy",
791
+ },
792
+ ]
793
+ return http_options
794
+
795
+ @staticmethod
796
+ def _get_transcoded_request(http_options, request):
797
+ pb_request = gcn_client_tls_policy.UpdateClientTlsPolicyRequest.pb(request)
798
+ transcoded_request = path_template.transcode(http_options, pb_request)
799
+ return transcoded_request
800
+
801
+ @staticmethod
802
+ def _get_request_body_json(transcoded_request):
803
+ # Jsonify the request body
804
+
805
+ body = json_format.MessageToJson(
806
+ transcoded_request["body"], use_integers_for_enums=True
807
+ )
808
+ return body
809
+
810
+ @staticmethod
811
+ def _get_query_params_json(transcoded_request):
812
+ query_params = json.loads(
813
+ json_format.MessageToJson(
814
+ transcoded_request["query_params"],
815
+ use_integers_for_enums=True,
816
+ )
817
+ )
818
+ query_params.update(
819
+ _BaseNetworkSecurityRestTransport._BaseUpdateClientTlsPolicy._get_unset_required_fields(
820
+ query_params
821
+ )
822
+ )
823
+
824
+ query_params["$alt"] = "json;enum-encoding=int"
825
+ return query_params
826
+
827
+ class _BaseUpdateServerTlsPolicy:
828
+ def __hash__(self): # pragma: NO COVER
829
+ return NotImplementedError("__hash__ must be implemented.")
830
+
831
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
832
+
833
+ @classmethod
834
+ def _get_unset_required_fields(cls, message_dict):
835
+ return {
836
+ k: v
837
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
838
+ if k not in message_dict
839
+ }
840
+
841
+ @staticmethod
842
+ def _get_http_options():
843
+ http_options: List[Dict[str, str]] = [
844
+ {
845
+ "method": "patch",
846
+ "uri": "/v1/{server_tls_policy.name=projects/*/locations/*/serverTlsPolicies/*}",
847
+ "body": "server_tls_policy",
848
+ },
849
+ ]
850
+ return http_options
851
+
852
+ @staticmethod
853
+ def _get_transcoded_request(http_options, request):
854
+ pb_request = gcn_server_tls_policy.UpdateServerTlsPolicyRequest.pb(request)
855
+ transcoded_request = path_template.transcode(http_options, pb_request)
856
+ return transcoded_request
857
+
858
+ @staticmethod
859
+ def _get_request_body_json(transcoded_request):
860
+ # Jsonify the request body
861
+
862
+ body = json_format.MessageToJson(
863
+ transcoded_request["body"], use_integers_for_enums=True
864
+ )
865
+ return body
866
+
867
+ @staticmethod
868
+ def _get_query_params_json(transcoded_request):
869
+ query_params = json.loads(
870
+ json_format.MessageToJson(
871
+ transcoded_request["query_params"],
872
+ use_integers_for_enums=True,
873
+ )
874
+ )
875
+ query_params.update(
876
+ _BaseNetworkSecurityRestTransport._BaseUpdateServerTlsPolicy._get_unset_required_fields(
877
+ query_params
878
+ )
879
+ )
880
+
881
+ query_params["$alt"] = "json;enum-encoding=int"
882
+ return query_params
883
+
884
+ class _BaseGetLocation:
885
+ def __hash__(self): # pragma: NO COVER
886
+ return NotImplementedError("__hash__ must be implemented.")
887
+
888
+ @staticmethod
889
+ def _get_http_options():
890
+ http_options: List[Dict[str, str]] = [
891
+ {
892
+ "method": "get",
893
+ "uri": "/v1/{name=projects/*/locations/*}",
894
+ },
895
+ ]
896
+ return http_options
897
+
898
+ @staticmethod
899
+ def _get_transcoded_request(http_options, request):
900
+ request_kwargs = json_format.MessageToDict(request)
901
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
902
+ return transcoded_request
903
+
904
+ @staticmethod
905
+ def _get_query_params_json(transcoded_request):
906
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
907
+ return query_params
908
+
909
+ class _BaseListLocations:
910
+ def __hash__(self): # pragma: NO COVER
911
+ return NotImplementedError("__hash__ must be implemented.")
912
+
913
+ @staticmethod
914
+ def _get_http_options():
915
+ http_options: List[Dict[str, str]] = [
916
+ {
917
+ "method": "get",
918
+ "uri": "/v1/{name=projects/*}/locations",
919
+ },
920
+ ]
921
+ return http_options
922
+
923
+ @staticmethod
924
+ def _get_transcoded_request(http_options, request):
925
+ request_kwargs = json_format.MessageToDict(request)
926
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
927
+ return transcoded_request
928
+
929
+ @staticmethod
930
+ def _get_query_params_json(transcoded_request):
931
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
932
+ return query_params
933
+
934
+ class _BaseGetIamPolicy:
935
+ def __hash__(self): # pragma: NO COVER
936
+ return NotImplementedError("__hash__ must be implemented.")
937
+
938
+ @staticmethod
939
+ def _get_http_options():
940
+ http_options: List[Dict[str, str]] = [
941
+ {
942
+ "method": "get",
943
+ "uri": "/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:getIamPolicy",
944
+ },
945
+ {
946
+ "method": "get",
947
+ "uri": "/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:getIamPolicy",
948
+ },
949
+ {
950
+ "method": "get",
951
+ "uri": "/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:getIamPolicy",
952
+ },
953
+ ]
954
+ return http_options
955
+
956
+ @staticmethod
957
+ def _get_transcoded_request(http_options, request):
958
+ request_kwargs = json_format.MessageToDict(request)
959
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
960
+ return transcoded_request
961
+
962
+ @staticmethod
963
+ def _get_query_params_json(transcoded_request):
964
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
965
+ return query_params
966
+
967
+ class _BaseSetIamPolicy:
968
+ def __hash__(self): # pragma: NO COVER
969
+ return NotImplementedError("__hash__ must be implemented.")
970
+
971
+ @staticmethod
972
+ def _get_http_options():
973
+ http_options: List[Dict[str, str]] = [
974
+ {
975
+ "method": "post",
976
+ "uri": "/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:setIamPolicy",
977
+ "body": "*",
978
+ },
979
+ {
980
+ "method": "post",
981
+ "uri": "/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:setIamPolicy",
982
+ "body": "*",
983
+ },
984
+ {
985
+ "method": "post",
986
+ "uri": "/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:setIamPolicy",
987
+ "body": "*",
988
+ },
989
+ ]
990
+ return http_options
991
+
992
+ @staticmethod
993
+ def _get_transcoded_request(http_options, request):
994
+ request_kwargs = json_format.MessageToDict(request)
995
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
996
+ return transcoded_request
997
+
998
+ @staticmethod
999
+ def _get_request_body_json(transcoded_request):
1000
+ body = json.dumps(transcoded_request["body"])
1001
+ return body
1002
+
1003
+ @staticmethod
1004
+ def _get_query_params_json(transcoded_request):
1005
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1006
+ return query_params
1007
+
1008
+ class _BaseTestIamPermissions:
1009
+ def __hash__(self): # pragma: NO COVER
1010
+ return NotImplementedError("__hash__ must be implemented.")
1011
+
1012
+ @staticmethod
1013
+ def _get_http_options():
1014
+ http_options: List[Dict[str, str]] = [
1015
+ {
1016
+ "method": "post",
1017
+ "uri": "/v1/{resource=projects/*/locations/*/authorizationPolicies/*}:testIamPermissions",
1018
+ "body": "*",
1019
+ },
1020
+ {
1021
+ "method": "post",
1022
+ "uri": "/v1/{resource=projects/*/locations/*/serverTlsPolicies/*}:testIamPermissions",
1023
+ "body": "*",
1024
+ },
1025
+ {
1026
+ "method": "post",
1027
+ "uri": "/v1/{resource=projects/*/locations/*/clientTlsPolicies/*}:testIamPermissions",
1028
+ "body": "*",
1029
+ },
1030
+ ]
1031
+ return http_options
1032
+
1033
+ @staticmethod
1034
+ def _get_transcoded_request(http_options, request):
1035
+ request_kwargs = json_format.MessageToDict(request)
1036
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1037
+ return transcoded_request
1038
+
1039
+ @staticmethod
1040
+ def _get_request_body_json(transcoded_request):
1041
+ body = json.dumps(transcoded_request["body"])
1042
+ return body
1043
+
1044
+ @staticmethod
1045
+ def _get_query_params_json(transcoded_request):
1046
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1047
+ return query_params
1048
+
1049
+ class _BaseCancelOperation:
1050
+ def __hash__(self): # pragma: NO COVER
1051
+ return NotImplementedError("__hash__ must be implemented.")
1052
+
1053
+ @staticmethod
1054
+ def _get_http_options():
1055
+ http_options: List[Dict[str, str]] = [
1056
+ {
1057
+ "method": "post",
1058
+ "uri": "/v1/{name=projects/*/locations/*/operations/*}:cancel",
1059
+ "body": "*",
1060
+ },
1061
+ ]
1062
+ return http_options
1063
+
1064
+ @staticmethod
1065
+ def _get_transcoded_request(http_options, request):
1066
+ request_kwargs = json_format.MessageToDict(request)
1067
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1068
+ return transcoded_request
1069
+
1070
+ @staticmethod
1071
+ def _get_request_body_json(transcoded_request):
1072
+ body = json.dumps(transcoded_request["body"])
1073
+ return body
1074
+
1075
+ @staticmethod
1076
+ def _get_query_params_json(transcoded_request):
1077
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1078
+ return query_params
1079
+
1080
+ class _BaseDeleteOperation:
1081
+ def __hash__(self): # pragma: NO COVER
1082
+ return NotImplementedError("__hash__ must be implemented.")
1083
+
1084
+ @staticmethod
1085
+ def _get_http_options():
1086
+ http_options: List[Dict[str, str]] = [
1087
+ {
1088
+ "method": "delete",
1089
+ "uri": "/v1/{name=projects/*/locations/*/operations/*}",
1090
+ },
1091
+ ]
1092
+ return http_options
1093
+
1094
+ @staticmethod
1095
+ def _get_transcoded_request(http_options, request):
1096
+ request_kwargs = json_format.MessageToDict(request)
1097
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1098
+ return transcoded_request
1099
+
1100
+ @staticmethod
1101
+ def _get_query_params_json(transcoded_request):
1102
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1103
+ return query_params
1104
+
1105
+ class _BaseGetOperation:
1106
+ def __hash__(self): # pragma: NO COVER
1107
+ return NotImplementedError("__hash__ must be implemented.")
1108
+
1109
+ @staticmethod
1110
+ def _get_http_options():
1111
+ http_options: List[Dict[str, str]] = [
1112
+ {
1113
+ "method": "get",
1114
+ "uri": "/v1/{name=projects/*/locations/*/operations/*}",
1115
+ },
1116
+ ]
1117
+ return http_options
1118
+
1119
+ @staticmethod
1120
+ def _get_transcoded_request(http_options, request):
1121
+ request_kwargs = json_format.MessageToDict(request)
1122
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1123
+ return transcoded_request
1124
+
1125
+ @staticmethod
1126
+ def _get_query_params_json(transcoded_request):
1127
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1128
+ return query_params
1129
+
1130
+ class _BaseListOperations:
1131
+ def __hash__(self): # pragma: NO COVER
1132
+ return NotImplementedError("__hash__ must be implemented.")
1133
+
1134
+ @staticmethod
1135
+ def _get_http_options():
1136
+ http_options: List[Dict[str, str]] = [
1137
+ {
1138
+ "method": "get",
1139
+ "uri": "/v1/{name=projects/*/locations/*}/operations",
1140
+ },
1141
+ ]
1142
+ return http_options
1143
+
1144
+ @staticmethod
1145
+ def _get_transcoded_request(http_options, request):
1146
+ request_kwargs = json_format.MessageToDict(request)
1147
+ transcoded_request = path_template.transcode(http_options, **request_kwargs)
1148
+ return transcoded_request
1149
+
1150
+ @staticmethod
1151
+ def _get_query_params_json(transcoded_request):
1152
+ query_params = json.loads(json.dumps(transcoded_request["query_params"]))
1153
+ return query_params
1154
+
1155
+
1156
+ __all__ = ("_BaseNetworkSecurityRestTransport",)