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