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,524 @@
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 abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ import google.api_core
20
+ from google.api_core import exceptions as core_exceptions
21
+ from google.api_core import gapic_v1, operations_v1
22
+ from google.api_core import retry as retries
23
+ import google.auth # type: ignore
24
+ from google.auth import credentials as ga_credentials # type: ignore
25
+ from google.cloud.location import locations_pb2 # type: ignore
26
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
27
+ from google.iam.v1 import policy_pb2 # type: ignore
28
+ from google.longrunning import operations_pb2 # type: ignore
29
+ from google.oauth2 import service_account # type: ignore
30
+
31
+ from google.cloud.network_security_v1 import gapic_version as package_version
32
+ from google.cloud.network_security_v1.types import (
33
+ authorization_policy as gcn_authorization_policy,
34
+ )
35
+ from google.cloud.network_security_v1.types import (
36
+ client_tls_policy as gcn_client_tls_policy,
37
+ )
38
+ from google.cloud.network_security_v1.types import (
39
+ server_tls_policy as gcn_server_tls_policy,
40
+ )
41
+ from google.cloud.network_security_v1.types import authorization_policy
42
+ from google.cloud.network_security_v1.types import client_tls_policy
43
+ from google.cloud.network_security_v1.types import server_tls_policy
44
+
45
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
46
+ gapic_version=package_version.__version__
47
+ )
48
+
49
+
50
+ class NetworkSecurityTransport(abc.ABC):
51
+ """Abstract transport class for NetworkSecurity."""
52
+
53
+ AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
54
+
55
+ DEFAULT_HOST: str = "networksecurity.googleapis.com"
56
+
57
+ def __init__(
58
+ self,
59
+ *,
60
+ host: str = DEFAULT_HOST,
61
+ credentials: Optional[ga_credentials.Credentials] = None,
62
+ credentials_file: Optional[str] = None,
63
+ scopes: Optional[Sequence[str]] = None,
64
+ quota_project_id: Optional[str] = None,
65
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
66
+ always_use_jwt_access: Optional[bool] = False,
67
+ api_audience: Optional[str] = None,
68
+ **kwargs,
69
+ ) -> None:
70
+ """Instantiate the transport.
71
+
72
+ Args:
73
+ host (Optional[str]):
74
+ The hostname to connect to (default: 'networksecurity.googleapis.com').
75
+ credentials (Optional[google.auth.credentials.Credentials]): The
76
+ authorization credentials to attach to requests. These
77
+ credentials identify the application to the service; if none
78
+ are specified, the client will attempt to ascertain the
79
+ credentials from the environment.
80
+ credentials_file (Optional[str]): A file with credentials that can
81
+ be loaded with :func:`google.auth.load_credentials_from_file`.
82
+ This argument is mutually exclusive with credentials.
83
+ scopes (Optional[Sequence[str]]): A list of scopes.
84
+ quota_project_id (Optional[str]): An optional project to use for billing
85
+ and quota.
86
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
87
+ The client info used to send a user-agent string along with
88
+ API requests. If ``None``, then default info will be used.
89
+ Generally, you only need to set this if you're developing
90
+ your own client library.
91
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
92
+ be used for service account credentials.
93
+ """
94
+
95
+ scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
96
+
97
+ # Save the scopes.
98
+ self._scopes = scopes
99
+ if not hasattr(self, "_ignore_credentials"):
100
+ self._ignore_credentials: bool = False
101
+
102
+ # If no credentials are provided, then determine the appropriate
103
+ # defaults.
104
+ if credentials and credentials_file:
105
+ raise core_exceptions.DuplicateCredentialArgs(
106
+ "'credentials_file' and 'credentials' are mutually exclusive"
107
+ )
108
+
109
+ if credentials_file is not None:
110
+ credentials, _ = google.auth.load_credentials_from_file(
111
+ credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
112
+ )
113
+ elif credentials is None and not self._ignore_credentials:
114
+ credentials, _ = google.auth.default(
115
+ **scopes_kwargs, quota_project_id=quota_project_id
116
+ )
117
+ # Don't apply audience if the credentials file passed from user.
118
+ if hasattr(credentials, "with_gdch_audience"):
119
+ credentials = credentials.with_gdch_audience(
120
+ api_audience if api_audience else host
121
+ )
122
+
123
+ # If the credentials are service account credentials, then always try to use self signed JWT.
124
+ if (
125
+ always_use_jwt_access
126
+ and isinstance(credentials, service_account.Credentials)
127
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
128
+ ):
129
+ credentials = credentials.with_always_use_jwt_access(True)
130
+
131
+ # Save the credentials.
132
+ self._credentials = credentials
133
+
134
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
135
+ if ":" not in host:
136
+ host += ":443"
137
+ self._host = host
138
+
139
+ @property
140
+ def host(self):
141
+ return self._host
142
+
143
+ def _prep_wrapped_messages(self, client_info):
144
+ # Precompute the wrapped methods.
145
+ self._wrapped_methods = {
146
+ self.list_authorization_policies: gapic_v1.method.wrap_method(
147
+ self.list_authorization_policies,
148
+ default_timeout=None,
149
+ client_info=client_info,
150
+ ),
151
+ self.get_authorization_policy: gapic_v1.method.wrap_method(
152
+ self.get_authorization_policy,
153
+ default_timeout=None,
154
+ client_info=client_info,
155
+ ),
156
+ self.create_authorization_policy: gapic_v1.method.wrap_method(
157
+ self.create_authorization_policy,
158
+ default_timeout=None,
159
+ client_info=client_info,
160
+ ),
161
+ self.update_authorization_policy: gapic_v1.method.wrap_method(
162
+ self.update_authorization_policy,
163
+ default_timeout=None,
164
+ client_info=client_info,
165
+ ),
166
+ self.delete_authorization_policy: gapic_v1.method.wrap_method(
167
+ self.delete_authorization_policy,
168
+ default_timeout=None,
169
+ client_info=client_info,
170
+ ),
171
+ self.list_server_tls_policies: gapic_v1.method.wrap_method(
172
+ self.list_server_tls_policies,
173
+ default_timeout=None,
174
+ client_info=client_info,
175
+ ),
176
+ self.get_server_tls_policy: gapic_v1.method.wrap_method(
177
+ self.get_server_tls_policy,
178
+ default_timeout=None,
179
+ client_info=client_info,
180
+ ),
181
+ self.create_server_tls_policy: gapic_v1.method.wrap_method(
182
+ self.create_server_tls_policy,
183
+ default_timeout=None,
184
+ client_info=client_info,
185
+ ),
186
+ self.update_server_tls_policy: gapic_v1.method.wrap_method(
187
+ self.update_server_tls_policy,
188
+ default_timeout=None,
189
+ client_info=client_info,
190
+ ),
191
+ self.delete_server_tls_policy: gapic_v1.method.wrap_method(
192
+ self.delete_server_tls_policy,
193
+ default_timeout=None,
194
+ client_info=client_info,
195
+ ),
196
+ self.list_client_tls_policies: gapic_v1.method.wrap_method(
197
+ self.list_client_tls_policies,
198
+ default_timeout=None,
199
+ client_info=client_info,
200
+ ),
201
+ self.get_client_tls_policy: gapic_v1.method.wrap_method(
202
+ self.get_client_tls_policy,
203
+ default_timeout=None,
204
+ client_info=client_info,
205
+ ),
206
+ self.create_client_tls_policy: gapic_v1.method.wrap_method(
207
+ self.create_client_tls_policy,
208
+ default_timeout=None,
209
+ client_info=client_info,
210
+ ),
211
+ self.update_client_tls_policy: gapic_v1.method.wrap_method(
212
+ self.update_client_tls_policy,
213
+ default_timeout=None,
214
+ client_info=client_info,
215
+ ),
216
+ self.delete_client_tls_policy: gapic_v1.method.wrap_method(
217
+ self.delete_client_tls_policy,
218
+ default_timeout=None,
219
+ client_info=client_info,
220
+ ),
221
+ self.get_location: gapic_v1.method.wrap_method(
222
+ self.get_location,
223
+ default_timeout=None,
224
+ client_info=client_info,
225
+ ),
226
+ self.list_locations: gapic_v1.method.wrap_method(
227
+ self.list_locations,
228
+ default_timeout=None,
229
+ client_info=client_info,
230
+ ),
231
+ self.get_iam_policy: gapic_v1.method.wrap_method(
232
+ self.get_iam_policy,
233
+ default_timeout=None,
234
+ client_info=client_info,
235
+ ),
236
+ self.set_iam_policy: gapic_v1.method.wrap_method(
237
+ self.set_iam_policy,
238
+ default_timeout=None,
239
+ client_info=client_info,
240
+ ),
241
+ self.test_iam_permissions: gapic_v1.method.wrap_method(
242
+ self.test_iam_permissions,
243
+ default_timeout=None,
244
+ client_info=client_info,
245
+ ),
246
+ self.cancel_operation: gapic_v1.method.wrap_method(
247
+ self.cancel_operation,
248
+ default_timeout=None,
249
+ client_info=client_info,
250
+ ),
251
+ self.delete_operation: gapic_v1.method.wrap_method(
252
+ self.delete_operation,
253
+ default_timeout=None,
254
+ client_info=client_info,
255
+ ),
256
+ self.get_operation: gapic_v1.method.wrap_method(
257
+ self.get_operation,
258
+ default_timeout=None,
259
+ client_info=client_info,
260
+ ),
261
+ self.list_operations: gapic_v1.method.wrap_method(
262
+ self.list_operations,
263
+ default_timeout=None,
264
+ client_info=client_info,
265
+ ),
266
+ }
267
+
268
+ def close(self):
269
+ """Closes resources associated with the transport.
270
+
271
+ .. warning::
272
+ Only call this method if the transport is NOT shared
273
+ with other clients - this may cause errors in other clients!
274
+ """
275
+ raise NotImplementedError()
276
+
277
+ @property
278
+ def operations_client(self):
279
+ """Return the client designed to process long-running operations."""
280
+ raise NotImplementedError()
281
+
282
+ @property
283
+ def list_authorization_policies(
284
+ self,
285
+ ) -> Callable[
286
+ [authorization_policy.ListAuthorizationPoliciesRequest],
287
+ Union[
288
+ authorization_policy.ListAuthorizationPoliciesResponse,
289
+ Awaitable[authorization_policy.ListAuthorizationPoliciesResponse],
290
+ ],
291
+ ]:
292
+ raise NotImplementedError()
293
+
294
+ @property
295
+ def get_authorization_policy(
296
+ self,
297
+ ) -> Callable[
298
+ [authorization_policy.GetAuthorizationPolicyRequest],
299
+ Union[
300
+ authorization_policy.AuthorizationPolicy,
301
+ Awaitable[authorization_policy.AuthorizationPolicy],
302
+ ],
303
+ ]:
304
+ raise NotImplementedError()
305
+
306
+ @property
307
+ def create_authorization_policy(
308
+ self,
309
+ ) -> Callable[
310
+ [gcn_authorization_policy.CreateAuthorizationPolicyRequest],
311
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
312
+ ]:
313
+ raise NotImplementedError()
314
+
315
+ @property
316
+ def update_authorization_policy(
317
+ self,
318
+ ) -> Callable[
319
+ [gcn_authorization_policy.UpdateAuthorizationPolicyRequest],
320
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
321
+ ]:
322
+ raise NotImplementedError()
323
+
324
+ @property
325
+ def delete_authorization_policy(
326
+ self,
327
+ ) -> Callable[
328
+ [authorization_policy.DeleteAuthorizationPolicyRequest],
329
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
330
+ ]:
331
+ raise NotImplementedError()
332
+
333
+ @property
334
+ def list_server_tls_policies(
335
+ self,
336
+ ) -> Callable[
337
+ [server_tls_policy.ListServerTlsPoliciesRequest],
338
+ Union[
339
+ server_tls_policy.ListServerTlsPoliciesResponse,
340
+ Awaitable[server_tls_policy.ListServerTlsPoliciesResponse],
341
+ ],
342
+ ]:
343
+ raise NotImplementedError()
344
+
345
+ @property
346
+ def get_server_tls_policy(
347
+ self,
348
+ ) -> Callable[
349
+ [server_tls_policy.GetServerTlsPolicyRequest],
350
+ Union[
351
+ server_tls_policy.ServerTlsPolicy,
352
+ Awaitable[server_tls_policy.ServerTlsPolicy],
353
+ ],
354
+ ]:
355
+ raise NotImplementedError()
356
+
357
+ @property
358
+ def create_server_tls_policy(
359
+ self,
360
+ ) -> Callable[
361
+ [gcn_server_tls_policy.CreateServerTlsPolicyRequest],
362
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
363
+ ]:
364
+ raise NotImplementedError()
365
+
366
+ @property
367
+ def update_server_tls_policy(
368
+ self,
369
+ ) -> Callable[
370
+ [gcn_server_tls_policy.UpdateServerTlsPolicyRequest],
371
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
372
+ ]:
373
+ raise NotImplementedError()
374
+
375
+ @property
376
+ def delete_server_tls_policy(
377
+ self,
378
+ ) -> Callable[
379
+ [server_tls_policy.DeleteServerTlsPolicyRequest],
380
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
381
+ ]:
382
+ raise NotImplementedError()
383
+
384
+ @property
385
+ def list_client_tls_policies(
386
+ self,
387
+ ) -> Callable[
388
+ [client_tls_policy.ListClientTlsPoliciesRequest],
389
+ Union[
390
+ client_tls_policy.ListClientTlsPoliciesResponse,
391
+ Awaitable[client_tls_policy.ListClientTlsPoliciesResponse],
392
+ ],
393
+ ]:
394
+ raise NotImplementedError()
395
+
396
+ @property
397
+ def get_client_tls_policy(
398
+ self,
399
+ ) -> Callable[
400
+ [client_tls_policy.GetClientTlsPolicyRequest],
401
+ Union[
402
+ client_tls_policy.ClientTlsPolicy,
403
+ Awaitable[client_tls_policy.ClientTlsPolicy],
404
+ ],
405
+ ]:
406
+ raise NotImplementedError()
407
+
408
+ @property
409
+ def create_client_tls_policy(
410
+ self,
411
+ ) -> Callable[
412
+ [gcn_client_tls_policy.CreateClientTlsPolicyRequest],
413
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
414
+ ]:
415
+ raise NotImplementedError()
416
+
417
+ @property
418
+ def update_client_tls_policy(
419
+ self,
420
+ ) -> Callable[
421
+ [gcn_client_tls_policy.UpdateClientTlsPolicyRequest],
422
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
423
+ ]:
424
+ raise NotImplementedError()
425
+
426
+ @property
427
+ def delete_client_tls_policy(
428
+ self,
429
+ ) -> Callable[
430
+ [client_tls_policy.DeleteClientTlsPolicyRequest],
431
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
432
+ ]:
433
+ raise NotImplementedError()
434
+
435
+ @property
436
+ def list_operations(
437
+ self,
438
+ ) -> Callable[
439
+ [operations_pb2.ListOperationsRequest],
440
+ Union[
441
+ operations_pb2.ListOperationsResponse,
442
+ Awaitable[operations_pb2.ListOperationsResponse],
443
+ ],
444
+ ]:
445
+ raise NotImplementedError()
446
+
447
+ @property
448
+ def get_operation(
449
+ self,
450
+ ) -> Callable[
451
+ [operations_pb2.GetOperationRequest],
452
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
453
+ ]:
454
+ raise NotImplementedError()
455
+
456
+ @property
457
+ def cancel_operation(
458
+ self,
459
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None,]:
460
+ raise NotImplementedError()
461
+
462
+ @property
463
+ def delete_operation(
464
+ self,
465
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None,]:
466
+ raise NotImplementedError()
467
+
468
+ @property
469
+ def set_iam_policy(
470
+ self,
471
+ ) -> Callable[
472
+ [iam_policy_pb2.SetIamPolicyRequest],
473
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
474
+ ]:
475
+ raise NotImplementedError()
476
+
477
+ @property
478
+ def get_iam_policy(
479
+ self,
480
+ ) -> Callable[
481
+ [iam_policy_pb2.GetIamPolicyRequest],
482
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
483
+ ]:
484
+ raise NotImplementedError()
485
+
486
+ @property
487
+ def test_iam_permissions(
488
+ self,
489
+ ) -> Callable[
490
+ [iam_policy_pb2.TestIamPermissionsRequest],
491
+ Union[
492
+ iam_policy_pb2.TestIamPermissionsResponse,
493
+ Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
494
+ ],
495
+ ]:
496
+ raise NotImplementedError()
497
+
498
+ @property
499
+ def get_location(
500
+ self,
501
+ ) -> Callable[
502
+ [locations_pb2.GetLocationRequest],
503
+ Union[locations_pb2.Location, Awaitable[locations_pb2.Location]],
504
+ ]:
505
+ raise NotImplementedError()
506
+
507
+ @property
508
+ def list_locations(
509
+ self,
510
+ ) -> Callable[
511
+ [locations_pb2.ListLocationsRequest],
512
+ Union[
513
+ locations_pb2.ListLocationsResponse,
514
+ Awaitable[locations_pb2.ListLocationsResponse],
515
+ ],
516
+ ]:
517
+ raise NotImplementedError()
518
+
519
+ @property
520
+ def kind(self) -> str:
521
+ raise NotImplementedError()
522
+
523
+
524
+ __all__ = ("NetworkSecurityTransport",)