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,993 @@
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
17
+ import logging as std_logging
18
+ import pickle
19
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
20
+ import warnings
21
+
22
+ from google.api_core import gapic_v1, grpc_helpers, operations_v1
23
+ import google.auth # type: ignore
24
+ from google.auth import credentials as ga_credentials # type: ignore
25
+ from google.auth.transport.grpc import SslCredentials # type: ignore
26
+ from google.cloud.location import locations_pb2 # type: ignore
27
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
28
+ from google.iam.v1 import policy_pb2 # type: ignore
29
+ from google.longrunning import operations_pb2 # type: ignore
30
+ from google.protobuf.json_format import MessageToJson
31
+ import google.protobuf.message
32
+ import grpc # type: ignore
33
+ import proto # type: ignore
34
+
35
+ from google.cloud.network_security_v1.types import (
36
+ authorization_policy as gcn_authorization_policy,
37
+ )
38
+ from google.cloud.network_security_v1.types import (
39
+ client_tls_policy as gcn_client_tls_policy,
40
+ )
41
+ from google.cloud.network_security_v1.types import (
42
+ server_tls_policy as gcn_server_tls_policy,
43
+ )
44
+ from google.cloud.network_security_v1.types import authorization_policy
45
+ from google.cloud.network_security_v1.types import client_tls_policy
46
+ from google.cloud.network_security_v1.types import server_tls_policy
47
+
48
+ from .base import DEFAULT_CLIENT_INFO, NetworkSecurityTransport
49
+
50
+ try:
51
+ from google.api_core import client_logging # type: ignore
52
+
53
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
54
+ except ImportError: # pragma: NO COVER
55
+ CLIENT_LOGGING_SUPPORTED = False
56
+
57
+ _LOGGER = std_logging.getLogger(__name__)
58
+
59
+
60
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
61
+ def intercept_unary_unary(self, continuation, client_call_details, request):
62
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
63
+ std_logging.DEBUG
64
+ )
65
+ if logging_enabled: # pragma: NO COVER
66
+ request_metadata = client_call_details.metadata
67
+ if isinstance(request, proto.Message):
68
+ request_payload = type(request).to_json(request)
69
+ elif isinstance(request, google.protobuf.message.Message):
70
+ request_payload = MessageToJson(request)
71
+ else:
72
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
73
+
74
+ request_metadata = {
75
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
76
+ for key, value in request_metadata
77
+ }
78
+ grpc_request = {
79
+ "payload": request_payload,
80
+ "requestMethod": "grpc",
81
+ "metadata": dict(request_metadata),
82
+ }
83
+ _LOGGER.debug(
84
+ f"Sending request for {client_call_details.method}",
85
+ extra={
86
+ "serviceName": "google.cloud.networksecurity.v1.NetworkSecurity",
87
+ "rpcName": client_call_details.method,
88
+ "request": grpc_request,
89
+ "metadata": grpc_request["metadata"],
90
+ },
91
+ )
92
+
93
+ response = continuation(client_call_details, request)
94
+ if logging_enabled: # pragma: NO COVER
95
+ response_metadata = response.trailing_metadata()
96
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
97
+ metadata = (
98
+ dict([(k, str(v)) for k, v in response_metadata])
99
+ if response_metadata
100
+ else None
101
+ )
102
+ result = response.result()
103
+ if isinstance(result, proto.Message):
104
+ response_payload = type(result).to_json(result)
105
+ elif isinstance(result, google.protobuf.message.Message):
106
+ response_payload = MessageToJson(result)
107
+ else:
108
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
109
+ grpc_response = {
110
+ "payload": response_payload,
111
+ "metadata": metadata,
112
+ "status": "OK",
113
+ }
114
+ _LOGGER.debug(
115
+ f"Received response for {client_call_details.method}.",
116
+ extra={
117
+ "serviceName": "google.cloud.networksecurity.v1.NetworkSecurity",
118
+ "rpcName": client_call_details.method,
119
+ "response": grpc_response,
120
+ "metadata": grpc_response["metadata"],
121
+ },
122
+ )
123
+ return response
124
+
125
+
126
+ class NetworkSecurityGrpcTransport(NetworkSecurityTransport):
127
+ """gRPC backend transport for NetworkSecurity.
128
+
129
+ Network Security API provides resources to configure
130
+ authentication and authorization policies. Refer to per API
131
+ resource documentation for more information.
132
+
133
+ This class defines the same methods as the primary client, so the
134
+ primary client can load the underlying transport implementation
135
+ and call it.
136
+
137
+ It sends protocol buffers over the wire using gRPC (which is built on
138
+ top of HTTP/2); the ``grpcio`` package must be installed.
139
+ """
140
+
141
+ _stubs: Dict[str, Callable]
142
+
143
+ def __init__(
144
+ self,
145
+ *,
146
+ host: str = "networksecurity.googleapis.com",
147
+ credentials: Optional[ga_credentials.Credentials] = None,
148
+ credentials_file: Optional[str] = None,
149
+ scopes: Optional[Sequence[str]] = None,
150
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
151
+ api_mtls_endpoint: Optional[str] = None,
152
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
153
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
154
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
155
+ quota_project_id: Optional[str] = None,
156
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
157
+ always_use_jwt_access: Optional[bool] = False,
158
+ api_audience: Optional[str] = None,
159
+ ) -> None:
160
+ """Instantiate the transport.
161
+
162
+ Args:
163
+ host (Optional[str]):
164
+ The hostname to connect to (default: 'networksecurity.googleapis.com').
165
+ credentials (Optional[google.auth.credentials.Credentials]): The
166
+ authorization credentials to attach to requests. These
167
+ credentials identify the application to the service; if none
168
+ are specified, the client will attempt to ascertain the
169
+ credentials from the environment.
170
+ This argument is ignored if a ``channel`` instance is provided.
171
+ credentials_file (Optional[str]): A file with credentials that can
172
+ be loaded with :func:`google.auth.load_credentials_from_file`.
173
+ This argument is ignored if a ``channel`` instance is provided.
174
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
175
+ ignored if a ``channel`` instance is provided.
176
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
177
+ A ``Channel`` instance through which to make calls, or a Callable
178
+ that constructs and returns one. If set to None, ``self.create_channel``
179
+ is used to create the channel. If a Callable is given, it will be called
180
+ with the same arguments as used in ``self.create_channel``.
181
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
182
+ If provided, it overrides the ``host`` argument and tries to create
183
+ a mutual TLS channel with client SSL credentials from
184
+ ``client_cert_source`` or application default SSL credentials.
185
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
186
+ Deprecated. A callback to provide client SSL certificate bytes and
187
+ private key bytes, both in PEM format. It is ignored if
188
+ ``api_mtls_endpoint`` is None.
189
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
190
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
191
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
192
+ A callback to provide client certificate bytes and private key bytes,
193
+ both in PEM format. It is used to configure a mutual TLS channel. It is
194
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
195
+ quota_project_id (Optional[str]): An optional project to use for billing
196
+ and quota.
197
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
198
+ The client info used to send a user-agent string along with
199
+ API requests. If ``None``, then default info will be used.
200
+ Generally, you only need to set this if you're developing
201
+ your own client library.
202
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
203
+ be used for service account credentials.
204
+
205
+ Raises:
206
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
207
+ creation failed for any reason.
208
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
209
+ and ``credentials_file`` are passed.
210
+ """
211
+ self._grpc_channel = None
212
+ self._ssl_channel_credentials = ssl_channel_credentials
213
+ self._stubs: Dict[str, Callable] = {}
214
+ self._operations_client: Optional[operations_v1.OperationsClient] = None
215
+
216
+ if api_mtls_endpoint:
217
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
218
+ if client_cert_source:
219
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
220
+
221
+ if isinstance(channel, grpc.Channel):
222
+ # Ignore credentials if a channel was passed.
223
+ credentials = None
224
+ self._ignore_credentials = True
225
+ # If a channel was explicitly provided, set it.
226
+ self._grpc_channel = channel
227
+ self._ssl_channel_credentials = None
228
+
229
+ else:
230
+ if api_mtls_endpoint:
231
+ host = api_mtls_endpoint
232
+
233
+ # Create SSL credentials with client_cert_source or application
234
+ # default SSL credentials.
235
+ if client_cert_source:
236
+ cert, key = client_cert_source()
237
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
238
+ certificate_chain=cert, private_key=key
239
+ )
240
+ else:
241
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
242
+
243
+ else:
244
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
245
+ cert, key = client_cert_source_for_mtls()
246
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
247
+ certificate_chain=cert, private_key=key
248
+ )
249
+
250
+ # The base transport sets the host, credentials and scopes
251
+ super().__init__(
252
+ host=host,
253
+ credentials=credentials,
254
+ credentials_file=credentials_file,
255
+ scopes=scopes,
256
+ quota_project_id=quota_project_id,
257
+ client_info=client_info,
258
+ always_use_jwt_access=always_use_jwt_access,
259
+ api_audience=api_audience,
260
+ )
261
+
262
+ if not self._grpc_channel:
263
+ # initialize with the provided callable or the default channel
264
+ channel_init = channel or type(self).create_channel
265
+ self._grpc_channel = channel_init(
266
+ self._host,
267
+ # use the credentials which are saved
268
+ credentials=self._credentials,
269
+ # Set ``credentials_file`` to ``None`` here as
270
+ # the credentials that we saved earlier should be used.
271
+ credentials_file=None,
272
+ scopes=self._scopes,
273
+ ssl_credentials=self._ssl_channel_credentials,
274
+ quota_project_id=quota_project_id,
275
+ options=[
276
+ ("grpc.max_send_message_length", -1),
277
+ ("grpc.max_receive_message_length", -1),
278
+ ],
279
+ )
280
+
281
+ self._interceptor = _LoggingClientInterceptor()
282
+ self._logged_channel = grpc.intercept_channel(
283
+ self._grpc_channel, self._interceptor
284
+ )
285
+
286
+ # Wrap messages. This must be done after self._logged_channel exists
287
+ self._prep_wrapped_messages(client_info)
288
+
289
+ @classmethod
290
+ def create_channel(
291
+ cls,
292
+ host: str = "networksecurity.googleapis.com",
293
+ credentials: Optional[ga_credentials.Credentials] = None,
294
+ credentials_file: Optional[str] = None,
295
+ scopes: Optional[Sequence[str]] = None,
296
+ quota_project_id: Optional[str] = None,
297
+ **kwargs,
298
+ ) -> grpc.Channel:
299
+ """Create and return a gRPC channel object.
300
+ Args:
301
+ host (Optional[str]): The host for the channel to use.
302
+ credentials (Optional[~.Credentials]): The
303
+ authorization credentials to attach to requests. These
304
+ credentials identify this application to the service. If
305
+ none are specified, the client will attempt to ascertain
306
+ the credentials from the environment.
307
+ credentials_file (Optional[str]): A file with credentials that can
308
+ be loaded with :func:`google.auth.load_credentials_from_file`.
309
+ This argument is mutually exclusive with credentials.
310
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
311
+ service. These are only used when credentials are not specified and
312
+ are passed to :func:`google.auth.default`.
313
+ quota_project_id (Optional[str]): An optional project to use for billing
314
+ and quota.
315
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
316
+ channel creation.
317
+ Returns:
318
+ grpc.Channel: A gRPC channel object.
319
+
320
+ Raises:
321
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
322
+ and ``credentials_file`` are passed.
323
+ """
324
+
325
+ return grpc_helpers.create_channel(
326
+ host,
327
+ credentials=credentials,
328
+ credentials_file=credentials_file,
329
+ quota_project_id=quota_project_id,
330
+ default_scopes=cls.AUTH_SCOPES,
331
+ scopes=scopes,
332
+ default_host=cls.DEFAULT_HOST,
333
+ **kwargs,
334
+ )
335
+
336
+ @property
337
+ def grpc_channel(self) -> grpc.Channel:
338
+ """Return the channel designed to connect to this service."""
339
+ return self._grpc_channel
340
+
341
+ @property
342
+ def operations_client(self) -> operations_v1.OperationsClient:
343
+ """Create the client designed to process long-running operations.
344
+
345
+ This property caches on the instance; repeated calls return the same
346
+ client.
347
+ """
348
+ # Quick check: Only create a new client if we do not already have one.
349
+ if self._operations_client is None:
350
+ self._operations_client = operations_v1.OperationsClient(
351
+ self._logged_channel
352
+ )
353
+
354
+ # Return the client from cache.
355
+ return self._operations_client
356
+
357
+ @property
358
+ def list_authorization_policies(
359
+ self,
360
+ ) -> Callable[
361
+ [authorization_policy.ListAuthorizationPoliciesRequest],
362
+ authorization_policy.ListAuthorizationPoliciesResponse,
363
+ ]:
364
+ r"""Return a callable for the list authorization policies method over gRPC.
365
+
366
+ Lists AuthorizationPolicies in a given project and
367
+ location.
368
+
369
+ Returns:
370
+ Callable[[~.ListAuthorizationPoliciesRequest],
371
+ ~.ListAuthorizationPoliciesResponse]:
372
+ A function that, when called, will call the underlying RPC
373
+ on the server.
374
+ """
375
+ # Generate a "stub function" on-the-fly which will actually make
376
+ # the request.
377
+ # gRPC handles serialization and deserialization, so we just need
378
+ # to pass in the functions for each.
379
+ if "list_authorization_policies" not in self._stubs:
380
+ self._stubs[
381
+ "list_authorization_policies"
382
+ ] = self._logged_channel.unary_unary(
383
+ "/google.cloud.networksecurity.v1.NetworkSecurity/ListAuthorizationPolicies",
384
+ request_serializer=authorization_policy.ListAuthorizationPoliciesRequest.serialize,
385
+ response_deserializer=authorization_policy.ListAuthorizationPoliciesResponse.deserialize,
386
+ )
387
+ return self._stubs["list_authorization_policies"]
388
+
389
+ @property
390
+ def get_authorization_policy(
391
+ self,
392
+ ) -> Callable[
393
+ [authorization_policy.GetAuthorizationPolicyRequest],
394
+ authorization_policy.AuthorizationPolicy,
395
+ ]:
396
+ r"""Return a callable for the get authorization policy method over gRPC.
397
+
398
+ Gets details of a single AuthorizationPolicy.
399
+
400
+ Returns:
401
+ Callable[[~.GetAuthorizationPolicyRequest],
402
+ ~.AuthorizationPolicy]:
403
+ A function that, when called, will call the underlying RPC
404
+ on the server.
405
+ """
406
+ # Generate a "stub function" on-the-fly which will actually make
407
+ # the request.
408
+ # gRPC handles serialization and deserialization, so we just need
409
+ # to pass in the functions for each.
410
+ if "get_authorization_policy" not in self._stubs:
411
+ self._stubs["get_authorization_policy"] = self._logged_channel.unary_unary(
412
+ "/google.cloud.networksecurity.v1.NetworkSecurity/GetAuthorizationPolicy",
413
+ request_serializer=authorization_policy.GetAuthorizationPolicyRequest.serialize,
414
+ response_deserializer=authorization_policy.AuthorizationPolicy.deserialize,
415
+ )
416
+ return self._stubs["get_authorization_policy"]
417
+
418
+ @property
419
+ def create_authorization_policy(
420
+ self,
421
+ ) -> Callable[
422
+ [gcn_authorization_policy.CreateAuthorizationPolicyRequest],
423
+ operations_pb2.Operation,
424
+ ]:
425
+ r"""Return a callable for the create authorization policy method over gRPC.
426
+
427
+ Creates a new AuthorizationPolicy in a given project
428
+ and location.
429
+
430
+ Returns:
431
+ Callable[[~.CreateAuthorizationPolicyRequest],
432
+ ~.Operation]:
433
+ A function that, when called, will call the underlying RPC
434
+ on the server.
435
+ """
436
+ # Generate a "stub function" on-the-fly which will actually make
437
+ # the request.
438
+ # gRPC handles serialization and deserialization, so we just need
439
+ # to pass in the functions for each.
440
+ if "create_authorization_policy" not in self._stubs:
441
+ self._stubs[
442
+ "create_authorization_policy"
443
+ ] = self._logged_channel.unary_unary(
444
+ "/google.cloud.networksecurity.v1.NetworkSecurity/CreateAuthorizationPolicy",
445
+ request_serializer=gcn_authorization_policy.CreateAuthorizationPolicyRequest.serialize,
446
+ response_deserializer=operations_pb2.Operation.FromString,
447
+ )
448
+ return self._stubs["create_authorization_policy"]
449
+
450
+ @property
451
+ def update_authorization_policy(
452
+ self,
453
+ ) -> Callable[
454
+ [gcn_authorization_policy.UpdateAuthorizationPolicyRequest],
455
+ operations_pb2.Operation,
456
+ ]:
457
+ r"""Return a callable for the update authorization policy method over gRPC.
458
+
459
+ Updates the parameters of a single
460
+ AuthorizationPolicy.
461
+
462
+ Returns:
463
+ Callable[[~.UpdateAuthorizationPolicyRequest],
464
+ ~.Operation]:
465
+ A function that, when called, will call the underlying RPC
466
+ on the server.
467
+ """
468
+ # Generate a "stub function" on-the-fly which will actually make
469
+ # the request.
470
+ # gRPC handles serialization and deserialization, so we just need
471
+ # to pass in the functions for each.
472
+ if "update_authorization_policy" not in self._stubs:
473
+ self._stubs[
474
+ "update_authorization_policy"
475
+ ] = self._logged_channel.unary_unary(
476
+ "/google.cloud.networksecurity.v1.NetworkSecurity/UpdateAuthorizationPolicy",
477
+ request_serializer=gcn_authorization_policy.UpdateAuthorizationPolicyRequest.serialize,
478
+ response_deserializer=operations_pb2.Operation.FromString,
479
+ )
480
+ return self._stubs["update_authorization_policy"]
481
+
482
+ @property
483
+ def delete_authorization_policy(
484
+ self,
485
+ ) -> Callable[
486
+ [authorization_policy.DeleteAuthorizationPolicyRequest],
487
+ operations_pb2.Operation,
488
+ ]:
489
+ r"""Return a callable for the delete authorization policy method over gRPC.
490
+
491
+ Deletes a single AuthorizationPolicy.
492
+
493
+ Returns:
494
+ Callable[[~.DeleteAuthorizationPolicyRequest],
495
+ ~.Operation]:
496
+ A function that, when called, will call the underlying RPC
497
+ on the server.
498
+ """
499
+ # Generate a "stub function" on-the-fly which will actually make
500
+ # the request.
501
+ # gRPC handles serialization and deserialization, so we just need
502
+ # to pass in the functions for each.
503
+ if "delete_authorization_policy" not in self._stubs:
504
+ self._stubs[
505
+ "delete_authorization_policy"
506
+ ] = self._logged_channel.unary_unary(
507
+ "/google.cloud.networksecurity.v1.NetworkSecurity/DeleteAuthorizationPolicy",
508
+ request_serializer=authorization_policy.DeleteAuthorizationPolicyRequest.serialize,
509
+ response_deserializer=operations_pb2.Operation.FromString,
510
+ )
511
+ return self._stubs["delete_authorization_policy"]
512
+
513
+ @property
514
+ def list_server_tls_policies(
515
+ self,
516
+ ) -> Callable[
517
+ [server_tls_policy.ListServerTlsPoliciesRequest],
518
+ server_tls_policy.ListServerTlsPoliciesResponse,
519
+ ]:
520
+ r"""Return a callable for the list server tls policies method over gRPC.
521
+
522
+ Lists ServerTlsPolicies in a given project and
523
+ location.
524
+
525
+ Returns:
526
+ Callable[[~.ListServerTlsPoliciesRequest],
527
+ ~.ListServerTlsPoliciesResponse]:
528
+ A function that, when called, will call the underlying RPC
529
+ on the server.
530
+ """
531
+ # Generate a "stub function" on-the-fly which will actually make
532
+ # the request.
533
+ # gRPC handles serialization and deserialization, so we just need
534
+ # to pass in the functions for each.
535
+ if "list_server_tls_policies" not in self._stubs:
536
+ self._stubs["list_server_tls_policies"] = self._logged_channel.unary_unary(
537
+ "/google.cloud.networksecurity.v1.NetworkSecurity/ListServerTlsPolicies",
538
+ request_serializer=server_tls_policy.ListServerTlsPoliciesRequest.serialize,
539
+ response_deserializer=server_tls_policy.ListServerTlsPoliciesResponse.deserialize,
540
+ )
541
+ return self._stubs["list_server_tls_policies"]
542
+
543
+ @property
544
+ def get_server_tls_policy(
545
+ self,
546
+ ) -> Callable[
547
+ [server_tls_policy.GetServerTlsPolicyRequest], server_tls_policy.ServerTlsPolicy
548
+ ]:
549
+ r"""Return a callable for the get server tls policy method over gRPC.
550
+
551
+ Gets details of a single ServerTlsPolicy.
552
+
553
+ Returns:
554
+ Callable[[~.GetServerTlsPolicyRequest],
555
+ ~.ServerTlsPolicy]:
556
+ A function that, when called, will call the underlying RPC
557
+ on the server.
558
+ """
559
+ # Generate a "stub function" on-the-fly which will actually make
560
+ # the request.
561
+ # gRPC handles serialization and deserialization, so we just need
562
+ # to pass in the functions for each.
563
+ if "get_server_tls_policy" not in self._stubs:
564
+ self._stubs["get_server_tls_policy"] = self._logged_channel.unary_unary(
565
+ "/google.cloud.networksecurity.v1.NetworkSecurity/GetServerTlsPolicy",
566
+ request_serializer=server_tls_policy.GetServerTlsPolicyRequest.serialize,
567
+ response_deserializer=server_tls_policy.ServerTlsPolicy.deserialize,
568
+ )
569
+ return self._stubs["get_server_tls_policy"]
570
+
571
+ @property
572
+ def create_server_tls_policy(
573
+ self,
574
+ ) -> Callable[
575
+ [gcn_server_tls_policy.CreateServerTlsPolicyRequest], operations_pb2.Operation
576
+ ]:
577
+ r"""Return a callable for the create server tls policy method over gRPC.
578
+
579
+ Creates a new ServerTlsPolicy in a given project and
580
+ location.
581
+
582
+ Returns:
583
+ Callable[[~.CreateServerTlsPolicyRequest],
584
+ ~.Operation]:
585
+ A function that, when called, will call the underlying RPC
586
+ on the server.
587
+ """
588
+ # Generate a "stub function" on-the-fly which will actually make
589
+ # the request.
590
+ # gRPC handles serialization and deserialization, so we just need
591
+ # to pass in the functions for each.
592
+ if "create_server_tls_policy" not in self._stubs:
593
+ self._stubs["create_server_tls_policy"] = self._logged_channel.unary_unary(
594
+ "/google.cloud.networksecurity.v1.NetworkSecurity/CreateServerTlsPolicy",
595
+ request_serializer=gcn_server_tls_policy.CreateServerTlsPolicyRequest.serialize,
596
+ response_deserializer=operations_pb2.Operation.FromString,
597
+ )
598
+ return self._stubs["create_server_tls_policy"]
599
+
600
+ @property
601
+ def update_server_tls_policy(
602
+ self,
603
+ ) -> Callable[
604
+ [gcn_server_tls_policy.UpdateServerTlsPolicyRequest], operations_pb2.Operation
605
+ ]:
606
+ r"""Return a callable for the update server tls policy method over gRPC.
607
+
608
+ Updates the parameters of a single ServerTlsPolicy.
609
+
610
+ Returns:
611
+ Callable[[~.UpdateServerTlsPolicyRequest],
612
+ ~.Operation]:
613
+ A function that, when called, will call the underlying RPC
614
+ on the server.
615
+ """
616
+ # Generate a "stub function" on-the-fly which will actually make
617
+ # the request.
618
+ # gRPC handles serialization and deserialization, so we just need
619
+ # to pass in the functions for each.
620
+ if "update_server_tls_policy" not in self._stubs:
621
+ self._stubs["update_server_tls_policy"] = self._logged_channel.unary_unary(
622
+ "/google.cloud.networksecurity.v1.NetworkSecurity/UpdateServerTlsPolicy",
623
+ request_serializer=gcn_server_tls_policy.UpdateServerTlsPolicyRequest.serialize,
624
+ response_deserializer=operations_pb2.Operation.FromString,
625
+ )
626
+ return self._stubs["update_server_tls_policy"]
627
+
628
+ @property
629
+ def delete_server_tls_policy(
630
+ self,
631
+ ) -> Callable[
632
+ [server_tls_policy.DeleteServerTlsPolicyRequest], operations_pb2.Operation
633
+ ]:
634
+ r"""Return a callable for the delete server tls policy method over gRPC.
635
+
636
+ Deletes a single ServerTlsPolicy.
637
+
638
+ Returns:
639
+ Callable[[~.DeleteServerTlsPolicyRequest],
640
+ ~.Operation]:
641
+ A function that, when called, will call the underlying RPC
642
+ on the server.
643
+ """
644
+ # Generate a "stub function" on-the-fly which will actually make
645
+ # the request.
646
+ # gRPC handles serialization and deserialization, so we just need
647
+ # to pass in the functions for each.
648
+ if "delete_server_tls_policy" not in self._stubs:
649
+ self._stubs["delete_server_tls_policy"] = self._logged_channel.unary_unary(
650
+ "/google.cloud.networksecurity.v1.NetworkSecurity/DeleteServerTlsPolicy",
651
+ request_serializer=server_tls_policy.DeleteServerTlsPolicyRequest.serialize,
652
+ response_deserializer=operations_pb2.Operation.FromString,
653
+ )
654
+ return self._stubs["delete_server_tls_policy"]
655
+
656
+ @property
657
+ def list_client_tls_policies(
658
+ self,
659
+ ) -> Callable[
660
+ [client_tls_policy.ListClientTlsPoliciesRequest],
661
+ client_tls_policy.ListClientTlsPoliciesResponse,
662
+ ]:
663
+ r"""Return a callable for the list client tls policies method over gRPC.
664
+
665
+ Lists ClientTlsPolicies in a given project and
666
+ location.
667
+
668
+ Returns:
669
+ Callable[[~.ListClientTlsPoliciesRequest],
670
+ ~.ListClientTlsPoliciesResponse]:
671
+ A function that, when called, will call the underlying RPC
672
+ on the server.
673
+ """
674
+ # Generate a "stub function" on-the-fly which will actually make
675
+ # the request.
676
+ # gRPC handles serialization and deserialization, so we just need
677
+ # to pass in the functions for each.
678
+ if "list_client_tls_policies" not in self._stubs:
679
+ self._stubs["list_client_tls_policies"] = self._logged_channel.unary_unary(
680
+ "/google.cloud.networksecurity.v1.NetworkSecurity/ListClientTlsPolicies",
681
+ request_serializer=client_tls_policy.ListClientTlsPoliciesRequest.serialize,
682
+ response_deserializer=client_tls_policy.ListClientTlsPoliciesResponse.deserialize,
683
+ )
684
+ return self._stubs["list_client_tls_policies"]
685
+
686
+ @property
687
+ def get_client_tls_policy(
688
+ self,
689
+ ) -> Callable[
690
+ [client_tls_policy.GetClientTlsPolicyRequest], client_tls_policy.ClientTlsPolicy
691
+ ]:
692
+ r"""Return a callable for the get client tls policy method over gRPC.
693
+
694
+ Gets details of a single ClientTlsPolicy.
695
+
696
+ Returns:
697
+ Callable[[~.GetClientTlsPolicyRequest],
698
+ ~.ClientTlsPolicy]:
699
+ A function that, when called, will call the underlying RPC
700
+ on the server.
701
+ """
702
+ # Generate a "stub function" on-the-fly which will actually make
703
+ # the request.
704
+ # gRPC handles serialization and deserialization, so we just need
705
+ # to pass in the functions for each.
706
+ if "get_client_tls_policy" not in self._stubs:
707
+ self._stubs["get_client_tls_policy"] = self._logged_channel.unary_unary(
708
+ "/google.cloud.networksecurity.v1.NetworkSecurity/GetClientTlsPolicy",
709
+ request_serializer=client_tls_policy.GetClientTlsPolicyRequest.serialize,
710
+ response_deserializer=client_tls_policy.ClientTlsPolicy.deserialize,
711
+ )
712
+ return self._stubs["get_client_tls_policy"]
713
+
714
+ @property
715
+ def create_client_tls_policy(
716
+ self,
717
+ ) -> Callable[
718
+ [gcn_client_tls_policy.CreateClientTlsPolicyRequest], operations_pb2.Operation
719
+ ]:
720
+ r"""Return a callable for the create client tls policy method over gRPC.
721
+
722
+ Creates a new ClientTlsPolicy in a given project and
723
+ location.
724
+
725
+ Returns:
726
+ Callable[[~.CreateClientTlsPolicyRequest],
727
+ ~.Operation]:
728
+ A function that, when called, will call the underlying RPC
729
+ on the server.
730
+ """
731
+ # Generate a "stub function" on-the-fly which will actually make
732
+ # the request.
733
+ # gRPC handles serialization and deserialization, so we just need
734
+ # to pass in the functions for each.
735
+ if "create_client_tls_policy" not in self._stubs:
736
+ self._stubs["create_client_tls_policy"] = self._logged_channel.unary_unary(
737
+ "/google.cloud.networksecurity.v1.NetworkSecurity/CreateClientTlsPolicy",
738
+ request_serializer=gcn_client_tls_policy.CreateClientTlsPolicyRequest.serialize,
739
+ response_deserializer=operations_pb2.Operation.FromString,
740
+ )
741
+ return self._stubs["create_client_tls_policy"]
742
+
743
+ @property
744
+ def update_client_tls_policy(
745
+ self,
746
+ ) -> Callable[
747
+ [gcn_client_tls_policy.UpdateClientTlsPolicyRequest], operations_pb2.Operation
748
+ ]:
749
+ r"""Return a callable for the update client tls policy method over gRPC.
750
+
751
+ Updates the parameters of a single ClientTlsPolicy.
752
+
753
+ Returns:
754
+ Callable[[~.UpdateClientTlsPolicyRequest],
755
+ ~.Operation]:
756
+ A function that, when called, will call the underlying RPC
757
+ on the server.
758
+ """
759
+ # Generate a "stub function" on-the-fly which will actually make
760
+ # the request.
761
+ # gRPC handles serialization and deserialization, so we just need
762
+ # to pass in the functions for each.
763
+ if "update_client_tls_policy" not in self._stubs:
764
+ self._stubs["update_client_tls_policy"] = self._logged_channel.unary_unary(
765
+ "/google.cloud.networksecurity.v1.NetworkSecurity/UpdateClientTlsPolicy",
766
+ request_serializer=gcn_client_tls_policy.UpdateClientTlsPolicyRequest.serialize,
767
+ response_deserializer=operations_pb2.Operation.FromString,
768
+ )
769
+ return self._stubs["update_client_tls_policy"]
770
+
771
+ @property
772
+ def delete_client_tls_policy(
773
+ self,
774
+ ) -> Callable[
775
+ [client_tls_policy.DeleteClientTlsPolicyRequest], operations_pb2.Operation
776
+ ]:
777
+ r"""Return a callable for the delete client tls policy method over gRPC.
778
+
779
+ Deletes a single ClientTlsPolicy.
780
+
781
+ Returns:
782
+ Callable[[~.DeleteClientTlsPolicyRequest],
783
+ ~.Operation]:
784
+ A function that, when called, will call the underlying RPC
785
+ on the server.
786
+ """
787
+ # Generate a "stub function" on-the-fly which will actually make
788
+ # the request.
789
+ # gRPC handles serialization and deserialization, so we just need
790
+ # to pass in the functions for each.
791
+ if "delete_client_tls_policy" not in self._stubs:
792
+ self._stubs["delete_client_tls_policy"] = self._logged_channel.unary_unary(
793
+ "/google.cloud.networksecurity.v1.NetworkSecurity/DeleteClientTlsPolicy",
794
+ request_serializer=client_tls_policy.DeleteClientTlsPolicyRequest.serialize,
795
+ response_deserializer=operations_pb2.Operation.FromString,
796
+ )
797
+ return self._stubs["delete_client_tls_policy"]
798
+
799
+ def close(self):
800
+ self._logged_channel.close()
801
+
802
+ @property
803
+ def delete_operation(
804
+ self,
805
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
806
+ r"""Return a callable for the delete_operation method over gRPC."""
807
+ # Generate a "stub function" on-the-fly which will actually make
808
+ # the request.
809
+ # gRPC handles serialization and deserialization, so we just need
810
+ # to pass in the functions for each.
811
+ if "delete_operation" not in self._stubs:
812
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
813
+ "/google.longrunning.Operations/DeleteOperation",
814
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
815
+ response_deserializer=None,
816
+ )
817
+ return self._stubs["delete_operation"]
818
+
819
+ @property
820
+ def cancel_operation(
821
+ self,
822
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
823
+ r"""Return a callable for the cancel_operation method over gRPC."""
824
+ # Generate a "stub function" on-the-fly which will actually make
825
+ # the request.
826
+ # gRPC handles serialization and deserialization, so we just need
827
+ # to pass in the functions for each.
828
+ if "cancel_operation" not in self._stubs:
829
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
830
+ "/google.longrunning.Operations/CancelOperation",
831
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
832
+ response_deserializer=None,
833
+ )
834
+ return self._stubs["cancel_operation"]
835
+
836
+ @property
837
+ def get_operation(
838
+ self,
839
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
840
+ r"""Return a callable for the get_operation method over gRPC."""
841
+ # Generate a "stub function" on-the-fly which will actually make
842
+ # the request.
843
+ # gRPC handles serialization and deserialization, so we just need
844
+ # to pass in the functions for each.
845
+ if "get_operation" not in self._stubs:
846
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
847
+ "/google.longrunning.Operations/GetOperation",
848
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
849
+ response_deserializer=operations_pb2.Operation.FromString,
850
+ )
851
+ return self._stubs["get_operation"]
852
+
853
+ @property
854
+ def list_operations(
855
+ self,
856
+ ) -> Callable[
857
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
858
+ ]:
859
+ r"""Return a callable for the list_operations method over gRPC."""
860
+ # Generate a "stub function" on-the-fly which will actually make
861
+ # the request.
862
+ # gRPC handles serialization and deserialization, so we just need
863
+ # to pass in the functions for each.
864
+ if "list_operations" not in self._stubs:
865
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
866
+ "/google.longrunning.Operations/ListOperations",
867
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
868
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
869
+ )
870
+ return self._stubs["list_operations"]
871
+
872
+ @property
873
+ def list_locations(
874
+ self,
875
+ ) -> Callable[
876
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
877
+ ]:
878
+ r"""Return a callable for the list locations method over gRPC."""
879
+ # Generate a "stub function" on-the-fly which will actually make
880
+ # the request.
881
+ # gRPC handles serialization and deserialization, so we just need
882
+ # to pass in the functions for each.
883
+ if "list_locations" not in self._stubs:
884
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
885
+ "/google.cloud.location.Locations/ListLocations",
886
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
887
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
888
+ )
889
+ return self._stubs["list_locations"]
890
+
891
+ @property
892
+ def get_location(
893
+ self,
894
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
895
+ r"""Return a callable for the list locations method over gRPC."""
896
+ # Generate a "stub function" on-the-fly which will actually make
897
+ # the request.
898
+ # gRPC handles serialization and deserialization, so we just need
899
+ # to pass in the functions for each.
900
+ if "get_location" not in self._stubs:
901
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
902
+ "/google.cloud.location.Locations/GetLocation",
903
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
904
+ response_deserializer=locations_pb2.Location.FromString,
905
+ )
906
+ return self._stubs["get_location"]
907
+
908
+ @property
909
+ def set_iam_policy(
910
+ self,
911
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
912
+ r"""Return a callable for the set iam policy method over gRPC.
913
+ Sets the IAM access control policy on the specified
914
+ function. Replaces any existing policy.
915
+ Returns:
916
+ Callable[[~.SetIamPolicyRequest],
917
+ ~.Policy]:
918
+ A function that, when called, will call the underlying RPC
919
+ on the server.
920
+ """
921
+ # Generate a "stub function" on-the-fly which will actually make
922
+ # the request.
923
+ # gRPC handles serialization and deserialization, so we just need
924
+ # to pass in the functions for each.
925
+ if "set_iam_policy" not in self._stubs:
926
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
927
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
928
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
929
+ response_deserializer=policy_pb2.Policy.FromString,
930
+ )
931
+ return self._stubs["set_iam_policy"]
932
+
933
+ @property
934
+ def get_iam_policy(
935
+ self,
936
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
937
+ r"""Return a callable for the get iam policy method over gRPC.
938
+ Gets the IAM access control policy for a function.
939
+ Returns an empty policy if the function exists and does
940
+ not have a policy set.
941
+ Returns:
942
+ Callable[[~.GetIamPolicyRequest],
943
+ ~.Policy]:
944
+ A function that, when called, will call the underlying RPC
945
+ on the server.
946
+ """
947
+ # Generate a "stub function" on-the-fly which will actually make
948
+ # the request.
949
+ # gRPC handles serialization and deserialization, so we just need
950
+ # to pass in the functions for each.
951
+ if "get_iam_policy" not in self._stubs:
952
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
953
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
954
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
955
+ response_deserializer=policy_pb2.Policy.FromString,
956
+ )
957
+ return self._stubs["get_iam_policy"]
958
+
959
+ @property
960
+ def test_iam_permissions(
961
+ self,
962
+ ) -> Callable[
963
+ [iam_policy_pb2.TestIamPermissionsRequest],
964
+ iam_policy_pb2.TestIamPermissionsResponse,
965
+ ]:
966
+ r"""Return a callable for the test iam permissions method over gRPC.
967
+ Tests the specified permissions against the IAM access control
968
+ policy for a function. If the function does not exist, this will
969
+ return an empty set of permissions, not a NOT_FOUND error.
970
+ Returns:
971
+ Callable[[~.TestIamPermissionsRequest],
972
+ ~.TestIamPermissionsResponse]:
973
+ A function that, when called, will call the underlying RPC
974
+ on the server.
975
+ """
976
+ # Generate a "stub function" on-the-fly which will actually make
977
+ # the request.
978
+ # gRPC handles serialization and deserialization, so we just need
979
+ # to pass in the functions for each.
980
+ if "test_iam_permissions" not in self._stubs:
981
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
982
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
983
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
984
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
985
+ )
986
+ return self._stubs["test_iam_permissions"]
987
+
988
+ @property
989
+ def kind(self) -> str:
990
+ return "grpc"
991
+
992
+
993
+ __all__ = ("NetworkSecurityGrpcTransport",)