google-cloud-beyondcorp-clientgateways 0.4.16__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 (25) hide show
  1. google/cloud/beyondcorp_clientgateways/__init__.py +47 -0
  2. google/cloud/beyondcorp_clientgateways/gapic_version.py +16 -0
  3. google/cloud/beyondcorp_clientgateways/py.typed +2 -0
  4. google/cloud/beyondcorp_clientgateways_v1/__init__.py +45 -0
  5. google/cloud/beyondcorp_clientgateways_v1/gapic_metadata.json +88 -0
  6. google/cloud/beyondcorp_clientgateways_v1/gapic_version.py +16 -0
  7. google/cloud/beyondcorp_clientgateways_v1/py.typed +2 -0
  8. google/cloud/beyondcorp_clientgateways_v1/services/__init__.py +15 -0
  9. google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/__init__.py +22 -0
  10. google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/async_client.py +1489 -0
  11. google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/client.py +1932 -0
  12. google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/pagers.py +201 -0
  13. google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/__init__.py +41 -0
  14. google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/base.py +347 -0
  15. google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/grpc.py +663 -0
  16. google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/grpc_asyncio.py +747 -0
  17. google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/rest.py +2591 -0
  18. google/cloud/beyondcorp_clientgateways_v1/services/client_gateways_service/transports/rest_base.py +592 -0
  19. google/cloud/beyondcorp_clientgateways_v1/types/__init__.py +34 -0
  20. google/cloud/beyondcorp_clientgateways_v1/types/client_gateways_service.py +381 -0
  21. google_cloud_beyondcorp_clientgateways-0.4.16.dist-info/LICENSE +202 -0
  22. google_cloud_beyondcorp_clientgateways-0.4.16.dist-info/METADATA +229 -0
  23. google_cloud_beyondcorp_clientgateways-0.4.16.dist-info/RECORD +25 -0
  24. google_cloud_beyondcorp_clientgateways-0.4.16.dist-info/WHEEL +5 -0
  25. google_cloud_beyondcorp_clientgateways-0.4.16.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1489 @@
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
+ from collections import OrderedDict
17
+ import logging as std_logging
18
+ import re
19
+ from typing import (
20
+ Callable,
21
+ Dict,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ from google.api_core import exceptions as core_exceptions
33
+ from google.api_core import gapic_v1
34
+ from google.api_core import retry_async as retries
35
+ from google.api_core.client_options import ClientOptions
36
+ from google.auth import credentials as ga_credentials # type: ignore
37
+ from google.oauth2 import service_account # type: ignore
38
+
39
+ from google.cloud.beyondcorp_clientgateways_v1 import gapic_version as package_version
40
+
41
+ try:
42
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
43
+ except AttributeError: # pragma: NO COVER
44
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
45
+
46
+ from google.api_core import operation # type: ignore
47
+ from google.api_core import operation_async # type: ignore
48
+ from google.cloud.location import locations_pb2 # type: ignore
49
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
50
+ from google.iam.v1 import policy_pb2 # type: ignore
51
+ from google.longrunning import operations_pb2 # type: ignore
52
+ from google.protobuf import empty_pb2 # type: ignore
53
+ from google.protobuf import timestamp_pb2 # type: ignore
54
+
55
+ from google.cloud.beyondcorp_clientgateways_v1.services.client_gateways_service import (
56
+ pagers,
57
+ )
58
+ from google.cloud.beyondcorp_clientgateways_v1.types import client_gateways_service
59
+
60
+ from .client import ClientGatewaysServiceClient
61
+ from .transports.base import DEFAULT_CLIENT_INFO, ClientGatewaysServiceTransport
62
+ from .transports.grpc_asyncio import ClientGatewaysServiceGrpcAsyncIOTransport
63
+
64
+ try:
65
+ from google.api_core import client_logging # type: ignore
66
+
67
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
68
+ except ImportError: # pragma: NO COVER
69
+ CLIENT_LOGGING_SUPPORTED = False
70
+
71
+ _LOGGER = std_logging.getLogger(__name__)
72
+
73
+
74
+ class ClientGatewaysServiceAsyncClient:
75
+ """API Overview:
76
+
77
+ The ``beyondcorp.googleapis.com`` service implements the Google
78
+ Cloud BeyondCorp API.
79
+
80
+ Data Model:
81
+
82
+ The ClientGatewaysService exposes the following resources:
83
+
84
+ - Client Gateways, named as follows:
85
+ ``projects/{project_id}/locations/{location_id}/clientGateways/{client_gateway_id}``.
86
+ """
87
+
88
+ _client: ClientGatewaysServiceClient
89
+
90
+ # Copy defaults from the synchronous client for use here.
91
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
92
+ DEFAULT_ENDPOINT = ClientGatewaysServiceClient.DEFAULT_ENDPOINT
93
+ DEFAULT_MTLS_ENDPOINT = ClientGatewaysServiceClient.DEFAULT_MTLS_ENDPOINT
94
+ _DEFAULT_ENDPOINT_TEMPLATE = ClientGatewaysServiceClient._DEFAULT_ENDPOINT_TEMPLATE
95
+ _DEFAULT_UNIVERSE = ClientGatewaysServiceClient._DEFAULT_UNIVERSE
96
+
97
+ client_gateway_path = staticmethod(ClientGatewaysServiceClient.client_gateway_path)
98
+ parse_client_gateway_path = staticmethod(
99
+ ClientGatewaysServiceClient.parse_client_gateway_path
100
+ )
101
+ common_billing_account_path = staticmethod(
102
+ ClientGatewaysServiceClient.common_billing_account_path
103
+ )
104
+ parse_common_billing_account_path = staticmethod(
105
+ ClientGatewaysServiceClient.parse_common_billing_account_path
106
+ )
107
+ common_folder_path = staticmethod(ClientGatewaysServiceClient.common_folder_path)
108
+ parse_common_folder_path = staticmethod(
109
+ ClientGatewaysServiceClient.parse_common_folder_path
110
+ )
111
+ common_organization_path = staticmethod(
112
+ ClientGatewaysServiceClient.common_organization_path
113
+ )
114
+ parse_common_organization_path = staticmethod(
115
+ ClientGatewaysServiceClient.parse_common_organization_path
116
+ )
117
+ common_project_path = staticmethod(ClientGatewaysServiceClient.common_project_path)
118
+ parse_common_project_path = staticmethod(
119
+ ClientGatewaysServiceClient.parse_common_project_path
120
+ )
121
+ common_location_path = staticmethod(
122
+ ClientGatewaysServiceClient.common_location_path
123
+ )
124
+ parse_common_location_path = staticmethod(
125
+ ClientGatewaysServiceClient.parse_common_location_path
126
+ )
127
+
128
+ @classmethod
129
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
130
+ """Creates an instance of this client using the provided credentials
131
+ info.
132
+
133
+ Args:
134
+ info (dict): The service account private key info.
135
+ args: Additional arguments to pass to the constructor.
136
+ kwargs: Additional arguments to pass to the constructor.
137
+
138
+ Returns:
139
+ ClientGatewaysServiceAsyncClient: The constructed client.
140
+ """
141
+ return ClientGatewaysServiceClient.from_service_account_info.__func__(ClientGatewaysServiceAsyncClient, info, *args, **kwargs) # type: ignore
142
+
143
+ @classmethod
144
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
145
+ """Creates an instance of this client using the provided credentials
146
+ file.
147
+
148
+ Args:
149
+ filename (str): The path to the service account private key json
150
+ file.
151
+ args: Additional arguments to pass to the constructor.
152
+ kwargs: Additional arguments to pass to the constructor.
153
+
154
+ Returns:
155
+ ClientGatewaysServiceAsyncClient: The constructed client.
156
+ """
157
+ return ClientGatewaysServiceClient.from_service_account_file.__func__(ClientGatewaysServiceAsyncClient, filename, *args, **kwargs) # type: ignore
158
+
159
+ from_service_account_json = from_service_account_file
160
+
161
+ @classmethod
162
+ def get_mtls_endpoint_and_cert_source(
163
+ cls, client_options: Optional[ClientOptions] = None
164
+ ):
165
+ """Return the API endpoint and client cert source for mutual TLS.
166
+
167
+ The client cert source is determined in the following order:
168
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
169
+ client cert source is None.
170
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
171
+ default client cert source exists, use the default one; otherwise the client cert
172
+ source is None.
173
+
174
+ The API endpoint is determined in the following order:
175
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
176
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
177
+ default mTLS endpoint; if the environment variable is "never", use the default API
178
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
179
+ use the default API endpoint.
180
+
181
+ More details can be found at https://google.aip.dev/auth/4114.
182
+
183
+ Args:
184
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
185
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
186
+ in this method.
187
+
188
+ Returns:
189
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
190
+ client cert source to use.
191
+
192
+ Raises:
193
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
194
+ """
195
+ return ClientGatewaysServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
196
+
197
+ @property
198
+ def transport(self) -> ClientGatewaysServiceTransport:
199
+ """Returns the transport used by the client instance.
200
+
201
+ Returns:
202
+ ClientGatewaysServiceTransport: The transport used by the client instance.
203
+ """
204
+ return self._client.transport
205
+
206
+ @property
207
+ def api_endpoint(self):
208
+ """Return the API endpoint used by the client instance.
209
+
210
+ Returns:
211
+ str: The API endpoint used by the client instance.
212
+ """
213
+ return self._client._api_endpoint
214
+
215
+ @property
216
+ def universe_domain(self) -> str:
217
+ """Return the universe domain used by the client instance.
218
+
219
+ Returns:
220
+ str: The universe domain used
221
+ by the client instance.
222
+ """
223
+ return self._client._universe_domain
224
+
225
+ get_transport_class = ClientGatewaysServiceClient.get_transport_class
226
+
227
+ def __init__(
228
+ self,
229
+ *,
230
+ credentials: Optional[ga_credentials.Credentials] = None,
231
+ transport: Optional[
232
+ Union[
233
+ str,
234
+ ClientGatewaysServiceTransport,
235
+ Callable[..., ClientGatewaysServiceTransport],
236
+ ]
237
+ ] = "grpc_asyncio",
238
+ client_options: Optional[ClientOptions] = None,
239
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
240
+ ) -> None:
241
+ """Instantiates the client gateways service async client.
242
+
243
+ Args:
244
+ credentials (Optional[google.auth.credentials.Credentials]): The
245
+ authorization credentials to attach to requests. These
246
+ credentials identify the application to the service; if none
247
+ are specified, the client will attempt to ascertain the
248
+ credentials from the environment.
249
+ transport (Optional[Union[str,ClientGatewaysServiceTransport,Callable[..., ClientGatewaysServiceTransport]]]):
250
+ The transport to use, or a Callable that constructs and returns a new transport to use.
251
+ If a Callable is given, it will be called with the same set of initialization
252
+ arguments as used in the ClientGatewaysServiceTransport constructor.
253
+ If set to None, a transport is chosen automatically.
254
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
255
+ Custom options for the client.
256
+
257
+ 1. The ``api_endpoint`` property can be used to override the
258
+ default endpoint provided by the client when ``transport`` is
259
+ not explicitly provided. Only if this property is not set and
260
+ ``transport`` was not explicitly provided, the endpoint is
261
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
262
+ variable, which have one of the following values:
263
+ "always" (always use the default mTLS endpoint), "never" (always
264
+ use the default regular endpoint) and "auto" (auto-switch to the
265
+ default mTLS endpoint if client certificate is present; this is
266
+ the default value).
267
+
268
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
269
+ is "true", then the ``client_cert_source`` property can be used
270
+ to provide a client certificate for mTLS transport. If
271
+ not provided, the default SSL client certificate will be used if
272
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
273
+ set, no client certificate will be used.
274
+
275
+ 3. The ``universe_domain`` property can be used to override the
276
+ default "googleapis.com" universe. Note that ``api_endpoint``
277
+ property still takes precedence; and ``universe_domain`` is
278
+ currently not supported for mTLS.
279
+
280
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
281
+ The client info used to send a user-agent string along with
282
+ API requests. If ``None``, then default info will be used.
283
+ Generally, you only need to set this if you're developing
284
+ your own client library.
285
+
286
+ Raises:
287
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
288
+ creation failed for any reason.
289
+ """
290
+ self._client = ClientGatewaysServiceClient(
291
+ credentials=credentials,
292
+ transport=transport,
293
+ client_options=client_options,
294
+ client_info=client_info,
295
+ )
296
+
297
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
298
+ std_logging.DEBUG
299
+ ): # pragma: NO COVER
300
+ _LOGGER.debug(
301
+ "Created client `google.cloud.beyondcorp.clientgateways_v1.ClientGatewaysServiceAsyncClient`.",
302
+ extra={
303
+ "serviceName": "google.cloud.beyondcorp.clientgateways.v1.ClientGatewaysService",
304
+ "universeDomain": getattr(
305
+ self._client._transport._credentials, "universe_domain", ""
306
+ ),
307
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
308
+ "credentialsInfo": getattr(
309
+ self.transport._credentials, "get_cred_info", lambda: None
310
+ )(),
311
+ }
312
+ if hasattr(self._client._transport, "_credentials")
313
+ else {
314
+ "serviceName": "google.cloud.beyondcorp.clientgateways.v1.ClientGatewaysService",
315
+ "credentialsType": None,
316
+ },
317
+ )
318
+
319
+ async def list_client_gateways(
320
+ self,
321
+ request: Optional[
322
+ Union[client_gateways_service.ListClientGatewaysRequest, dict]
323
+ ] = None,
324
+ *,
325
+ parent: Optional[str] = None,
326
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
327
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
328
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
329
+ ) -> pagers.ListClientGatewaysAsyncPager:
330
+ r"""Lists ClientGateways in a given project and location.
331
+
332
+ .. code-block:: python
333
+
334
+ # This snippet has been automatically generated and should be regarded as a
335
+ # code template only.
336
+ # It will require modifications to work:
337
+ # - It may require correct/in-range values for request initialization.
338
+ # - It may require specifying regional endpoints when creating the service
339
+ # client as shown in:
340
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
341
+ from google.cloud import beyondcorp_clientgateways_v1
342
+
343
+ async def sample_list_client_gateways():
344
+ # Create a client
345
+ client = beyondcorp_clientgateways_v1.ClientGatewaysServiceAsyncClient()
346
+
347
+ # Initialize request argument(s)
348
+ request = beyondcorp_clientgateways_v1.ListClientGatewaysRequest(
349
+ parent="parent_value",
350
+ )
351
+
352
+ # Make the request
353
+ page_result = client.list_client_gateways(request=request)
354
+
355
+ # Handle the response
356
+ async for response in page_result:
357
+ print(response)
358
+
359
+ Args:
360
+ request (Optional[Union[google.cloud.beyondcorp_clientgateways_v1.types.ListClientGatewaysRequest, dict]]):
361
+ The request object. Message for requesting list of
362
+ ClientGateways.
363
+ parent (:class:`str`):
364
+ Required. Parent value for
365
+ ListClientGatewaysRequest.
366
+
367
+ This corresponds to the ``parent`` field
368
+ on the ``request`` instance; if ``request`` is provided, this
369
+ should not be set.
370
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
371
+ should be retried.
372
+ timeout (float): The timeout for this request.
373
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
374
+ sent along with the request as metadata. Normally, each value must be of type `str`,
375
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
376
+ be of type `bytes`.
377
+
378
+ Returns:
379
+ google.cloud.beyondcorp_clientgateways_v1.services.client_gateways_service.pagers.ListClientGatewaysAsyncPager:
380
+ Message for response to listing
381
+ ClientGateways.
382
+ Iterating over this object will yield
383
+ results and resolve additional pages
384
+ automatically.
385
+
386
+ """
387
+ # Create or coerce a protobuf request object.
388
+ # - Quick check: If we got a request object, we should *not* have
389
+ # gotten any keyword arguments that map to the request.
390
+ flattened_params = [parent]
391
+ has_flattened_params = (
392
+ len([param for param in flattened_params if param is not None]) > 0
393
+ )
394
+ if request is not None and has_flattened_params:
395
+ raise ValueError(
396
+ "If the `request` argument is set, then none of "
397
+ "the individual field arguments should be set."
398
+ )
399
+
400
+ # - Use the request object if provided (there's no risk of modifying the input as
401
+ # there are no flattened fields), or create one.
402
+ if not isinstance(request, client_gateways_service.ListClientGatewaysRequest):
403
+ request = client_gateways_service.ListClientGatewaysRequest(request)
404
+
405
+ # If we have keyword arguments corresponding to fields on the
406
+ # request, apply these.
407
+ if parent is not None:
408
+ request.parent = parent
409
+
410
+ # Wrap the RPC method; this adds retry and timeout information,
411
+ # and friendly error handling.
412
+ rpc = self._client._transport._wrapped_methods[
413
+ self._client._transport.list_client_gateways
414
+ ]
415
+
416
+ # Certain fields should be provided within the metadata header;
417
+ # add these here.
418
+ metadata = tuple(metadata) + (
419
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
420
+ )
421
+
422
+ # Validate the universe domain.
423
+ self._client._validate_universe_domain()
424
+
425
+ # Send the request.
426
+ response = await rpc(
427
+ request,
428
+ retry=retry,
429
+ timeout=timeout,
430
+ metadata=metadata,
431
+ )
432
+
433
+ # This method is paged; wrap the response in a pager, which provides
434
+ # an `__aiter__` convenience method.
435
+ response = pagers.ListClientGatewaysAsyncPager(
436
+ method=rpc,
437
+ request=request,
438
+ response=response,
439
+ retry=retry,
440
+ timeout=timeout,
441
+ metadata=metadata,
442
+ )
443
+
444
+ # Done; return the response.
445
+ return response
446
+
447
+ async def get_client_gateway(
448
+ self,
449
+ request: Optional[
450
+ Union[client_gateways_service.GetClientGatewayRequest, dict]
451
+ ] = None,
452
+ *,
453
+ name: Optional[str] = None,
454
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
455
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
456
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
457
+ ) -> client_gateways_service.ClientGateway:
458
+ r"""Gets details of a single ClientGateway.
459
+
460
+ .. code-block:: python
461
+
462
+ # This snippet has been automatically generated and should be regarded as a
463
+ # code template only.
464
+ # It will require modifications to work:
465
+ # - It may require correct/in-range values for request initialization.
466
+ # - It may require specifying regional endpoints when creating the service
467
+ # client as shown in:
468
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
469
+ from google.cloud import beyondcorp_clientgateways_v1
470
+
471
+ async def sample_get_client_gateway():
472
+ # Create a client
473
+ client = beyondcorp_clientgateways_v1.ClientGatewaysServiceAsyncClient()
474
+
475
+ # Initialize request argument(s)
476
+ request = beyondcorp_clientgateways_v1.GetClientGatewayRequest(
477
+ name="name_value",
478
+ )
479
+
480
+ # Make the request
481
+ response = await client.get_client_gateway(request=request)
482
+
483
+ # Handle the response
484
+ print(response)
485
+
486
+ Args:
487
+ request (Optional[Union[google.cloud.beyondcorp_clientgateways_v1.types.GetClientGatewayRequest, dict]]):
488
+ The request object. Message for getting a ClientGateway.
489
+ name (:class:`str`):
490
+ Required. Name of the resource
491
+ This corresponds to the ``name`` field
492
+ on the ``request`` instance; if ``request`` is provided, this
493
+ should not be set.
494
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
495
+ should be retried.
496
+ timeout (float): The timeout for this request.
497
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
498
+ sent along with the request as metadata. Normally, each value must be of type `str`,
499
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
500
+ be of type `bytes`.
501
+
502
+ Returns:
503
+ google.cloud.beyondcorp_clientgateways_v1.types.ClientGateway:
504
+ Message describing ClientGateway
505
+ object.
506
+
507
+ """
508
+ # Create or coerce a protobuf request object.
509
+ # - Quick check: If we got a request object, we should *not* have
510
+ # gotten any keyword arguments that map to the request.
511
+ flattened_params = [name]
512
+ has_flattened_params = (
513
+ len([param for param in flattened_params if param is not None]) > 0
514
+ )
515
+ if request is not None and has_flattened_params:
516
+ raise ValueError(
517
+ "If the `request` argument is set, then none of "
518
+ "the individual field arguments should be set."
519
+ )
520
+
521
+ # - Use the request object if provided (there's no risk of modifying the input as
522
+ # there are no flattened fields), or create one.
523
+ if not isinstance(request, client_gateways_service.GetClientGatewayRequest):
524
+ request = client_gateways_service.GetClientGatewayRequest(request)
525
+
526
+ # If we have keyword arguments corresponding to fields on the
527
+ # request, apply these.
528
+ if name is not None:
529
+ request.name = name
530
+
531
+ # Wrap the RPC method; this adds retry and timeout information,
532
+ # and friendly error handling.
533
+ rpc = self._client._transport._wrapped_methods[
534
+ self._client._transport.get_client_gateway
535
+ ]
536
+
537
+ # Certain fields should be provided within the metadata header;
538
+ # add these here.
539
+ metadata = tuple(metadata) + (
540
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
541
+ )
542
+
543
+ # Validate the universe domain.
544
+ self._client._validate_universe_domain()
545
+
546
+ # Send the request.
547
+ response = await rpc(
548
+ request,
549
+ retry=retry,
550
+ timeout=timeout,
551
+ metadata=metadata,
552
+ )
553
+
554
+ # Done; return the response.
555
+ return response
556
+
557
+ async def create_client_gateway(
558
+ self,
559
+ request: Optional[
560
+ Union[client_gateways_service.CreateClientGatewayRequest, dict]
561
+ ] = None,
562
+ *,
563
+ parent: Optional[str] = None,
564
+ client_gateway: Optional[client_gateways_service.ClientGateway] = None,
565
+ client_gateway_id: Optional[str] = None,
566
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
567
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
568
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
569
+ ) -> operation_async.AsyncOperation:
570
+ r"""Creates a new ClientGateway in a given project and
571
+ location.
572
+
573
+ .. code-block:: python
574
+
575
+ # This snippet has been automatically generated and should be regarded as a
576
+ # code template only.
577
+ # It will require modifications to work:
578
+ # - It may require correct/in-range values for request initialization.
579
+ # - It may require specifying regional endpoints when creating the service
580
+ # client as shown in:
581
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
582
+ from google.cloud import beyondcorp_clientgateways_v1
583
+
584
+ async def sample_create_client_gateway():
585
+ # Create a client
586
+ client = beyondcorp_clientgateways_v1.ClientGatewaysServiceAsyncClient()
587
+
588
+ # Initialize request argument(s)
589
+ client_gateway = beyondcorp_clientgateways_v1.ClientGateway()
590
+ client_gateway.name = "name_value"
591
+
592
+ request = beyondcorp_clientgateways_v1.CreateClientGatewayRequest(
593
+ parent="parent_value",
594
+ client_gateway=client_gateway,
595
+ )
596
+
597
+ # Make the request
598
+ operation = client.create_client_gateway(request=request)
599
+
600
+ print("Waiting for operation to complete...")
601
+
602
+ response = (await operation).result()
603
+
604
+ # Handle the response
605
+ print(response)
606
+
607
+ Args:
608
+ request (Optional[Union[google.cloud.beyondcorp_clientgateways_v1.types.CreateClientGatewayRequest, dict]]):
609
+ The request object. Message for creating a ClientGateway.
610
+ parent (:class:`str`):
611
+ Required. Value for parent.
612
+ This corresponds to the ``parent`` field
613
+ on the ``request`` instance; if ``request`` is provided, this
614
+ should not be set.
615
+ client_gateway (:class:`google.cloud.beyondcorp_clientgateways_v1.types.ClientGateway`):
616
+ Required. The resource being created.
617
+ This corresponds to the ``client_gateway`` field
618
+ on the ``request`` instance; if ``request`` is provided, this
619
+ should not be set.
620
+ client_gateway_id (:class:`str`):
621
+ Optional. User-settable client gateway resource ID.
622
+
623
+ - Must start with a letter.
624
+ - Must contain between 4-63 characters from
625
+ ``/[a-z][0-9]-/``.
626
+ - Must end with a number or a letter.
627
+
628
+ This corresponds to the ``client_gateway_id`` field
629
+ on the ``request`` instance; if ``request`` is provided, this
630
+ should not be set.
631
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
632
+ should be retried.
633
+ timeout (float): The timeout for this request.
634
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
635
+ sent along with the request as metadata. Normally, each value must be of type `str`,
636
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
637
+ be of type `bytes`.
638
+
639
+ Returns:
640
+ google.api_core.operation_async.AsyncOperation:
641
+ An object representing a long-running operation.
642
+
643
+ The result type for the operation will be
644
+ :class:`google.cloud.beyondcorp_clientgateways_v1.types.ClientGateway`
645
+ Message describing ClientGateway object.
646
+
647
+ """
648
+ # Create or coerce a protobuf request object.
649
+ # - Quick check: If we got a request object, we should *not* have
650
+ # gotten any keyword arguments that map to the request.
651
+ flattened_params = [parent, client_gateway, client_gateway_id]
652
+ has_flattened_params = (
653
+ len([param for param in flattened_params if param is not None]) > 0
654
+ )
655
+ if request is not None and has_flattened_params:
656
+ raise ValueError(
657
+ "If the `request` argument is set, then none of "
658
+ "the individual field arguments should be set."
659
+ )
660
+
661
+ # - Use the request object if provided (there's no risk of modifying the input as
662
+ # there are no flattened fields), or create one.
663
+ if not isinstance(request, client_gateways_service.CreateClientGatewayRequest):
664
+ request = client_gateways_service.CreateClientGatewayRequest(request)
665
+
666
+ # If we have keyword arguments corresponding to fields on the
667
+ # request, apply these.
668
+ if parent is not None:
669
+ request.parent = parent
670
+ if client_gateway is not None:
671
+ request.client_gateway = client_gateway
672
+ if client_gateway_id is not None:
673
+ request.client_gateway_id = client_gateway_id
674
+
675
+ # Wrap the RPC method; this adds retry and timeout information,
676
+ # and friendly error handling.
677
+ rpc = self._client._transport._wrapped_methods[
678
+ self._client._transport.create_client_gateway
679
+ ]
680
+
681
+ # Certain fields should be provided within the metadata header;
682
+ # add these here.
683
+ metadata = tuple(metadata) + (
684
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
685
+ )
686
+
687
+ # Validate the universe domain.
688
+ self._client._validate_universe_domain()
689
+
690
+ # Send the request.
691
+ response = await rpc(
692
+ request,
693
+ retry=retry,
694
+ timeout=timeout,
695
+ metadata=metadata,
696
+ )
697
+
698
+ # Wrap the response in an operation future.
699
+ response = operation_async.from_gapic(
700
+ response,
701
+ self._client._transport.operations_client,
702
+ client_gateways_service.ClientGateway,
703
+ metadata_type=client_gateways_service.ClientGatewayOperationMetadata,
704
+ )
705
+
706
+ # Done; return the response.
707
+ return response
708
+
709
+ async def delete_client_gateway(
710
+ self,
711
+ request: Optional[
712
+ Union[client_gateways_service.DeleteClientGatewayRequest, dict]
713
+ ] = None,
714
+ *,
715
+ name: Optional[str] = None,
716
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
717
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
718
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
719
+ ) -> operation_async.AsyncOperation:
720
+ r"""Deletes a single ClientGateway.
721
+
722
+ .. code-block:: python
723
+
724
+ # This snippet has been automatically generated and should be regarded as a
725
+ # code template only.
726
+ # It will require modifications to work:
727
+ # - It may require correct/in-range values for request initialization.
728
+ # - It may require specifying regional endpoints when creating the service
729
+ # client as shown in:
730
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
731
+ from google.cloud import beyondcorp_clientgateways_v1
732
+
733
+ async def sample_delete_client_gateway():
734
+ # Create a client
735
+ client = beyondcorp_clientgateways_v1.ClientGatewaysServiceAsyncClient()
736
+
737
+ # Initialize request argument(s)
738
+ request = beyondcorp_clientgateways_v1.DeleteClientGatewayRequest(
739
+ name="name_value",
740
+ )
741
+
742
+ # Make the request
743
+ operation = client.delete_client_gateway(request=request)
744
+
745
+ print("Waiting for operation to complete...")
746
+
747
+ response = (await operation).result()
748
+
749
+ # Handle the response
750
+ print(response)
751
+
752
+ Args:
753
+ request (Optional[Union[google.cloud.beyondcorp_clientgateways_v1.types.DeleteClientGatewayRequest, dict]]):
754
+ The request object. Message for deleting a ClientGateway
755
+ name (:class:`str`):
756
+ Required. Name of the resource
757
+ This corresponds to the ``name`` field
758
+ on the ``request`` instance; if ``request`` is provided, this
759
+ should not be set.
760
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
761
+ should be retried.
762
+ timeout (float): The timeout for this request.
763
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
764
+ sent along with the request as metadata. Normally, each value must be of type `str`,
765
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
766
+ be of type `bytes`.
767
+
768
+ Returns:
769
+ google.api_core.operation_async.AsyncOperation:
770
+ An object representing a long-running operation.
771
+
772
+ The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated
773
+ empty messages in your APIs. A typical example is to
774
+ use it as the request or the response type of an API
775
+ method. For instance:
776
+
777
+ service Foo {
778
+ rpc Bar(google.protobuf.Empty) returns
779
+ (google.protobuf.Empty);
780
+
781
+ }
782
+
783
+ """
784
+ # Create or coerce a protobuf request object.
785
+ # - Quick check: If we got a request object, we should *not* have
786
+ # gotten any keyword arguments that map to the request.
787
+ flattened_params = [name]
788
+ has_flattened_params = (
789
+ len([param for param in flattened_params if param is not None]) > 0
790
+ )
791
+ if request is not None and has_flattened_params:
792
+ raise ValueError(
793
+ "If the `request` argument is set, then none of "
794
+ "the individual field arguments should be set."
795
+ )
796
+
797
+ # - Use the request object if provided (there's no risk of modifying the input as
798
+ # there are no flattened fields), or create one.
799
+ if not isinstance(request, client_gateways_service.DeleteClientGatewayRequest):
800
+ request = client_gateways_service.DeleteClientGatewayRequest(request)
801
+
802
+ # If we have keyword arguments corresponding to fields on the
803
+ # request, apply these.
804
+ if name is not None:
805
+ request.name = name
806
+
807
+ # Wrap the RPC method; this adds retry and timeout information,
808
+ # and friendly error handling.
809
+ rpc = self._client._transport._wrapped_methods[
810
+ self._client._transport.delete_client_gateway
811
+ ]
812
+
813
+ # Certain fields should be provided within the metadata header;
814
+ # add these here.
815
+ metadata = tuple(metadata) + (
816
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
817
+ )
818
+
819
+ # Validate the universe domain.
820
+ self._client._validate_universe_domain()
821
+
822
+ # Send the request.
823
+ response = await rpc(
824
+ request,
825
+ retry=retry,
826
+ timeout=timeout,
827
+ metadata=metadata,
828
+ )
829
+
830
+ # Wrap the response in an operation future.
831
+ response = operation_async.from_gapic(
832
+ response,
833
+ self._client._transport.operations_client,
834
+ empty_pb2.Empty,
835
+ metadata_type=client_gateways_service.ClientGatewayOperationMetadata,
836
+ )
837
+
838
+ # Done; return the response.
839
+ return response
840
+
841
+ async def list_operations(
842
+ self,
843
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
844
+ *,
845
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
846
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
847
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
848
+ ) -> operations_pb2.ListOperationsResponse:
849
+ r"""Lists operations that match the specified filter in the request.
850
+
851
+ Args:
852
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
853
+ The request object. Request message for
854
+ `ListOperations` method.
855
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
856
+ if any, should be retried.
857
+ timeout (float): The timeout for this request.
858
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
859
+ sent along with the request as metadata. Normally, each value must be of type `str`,
860
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
861
+ be of type `bytes`.
862
+ Returns:
863
+ ~.operations_pb2.ListOperationsResponse:
864
+ Response message for ``ListOperations`` method.
865
+ """
866
+ # Create or coerce a protobuf request object.
867
+ # The request isn't a proto-plus wrapped type,
868
+ # so it must be constructed via keyword expansion.
869
+ if isinstance(request, dict):
870
+ request = operations_pb2.ListOperationsRequest(**request)
871
+
872
+ # Wrap the RPC method; this adds retry and timeout information,
873
+ # and friendly error handling.
874
+ rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
875
+
876
+ # Certain fields should be provided within the metadata header;
877
+ # add these here.
878
+ metadata = tuple(metadata) + (
879
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
880
+ )
881
+
882
+ # Validate the universe domain.
883
+ self._client._validate_universe_domain()
884
+
885
+ # Send the request.
886
+ response = await rpc(
887
+ request,
888
+ retry=retry,
889
+ timeout=timeout,
890
+ metadata=metadata,
891
+ )
892
+
893
+ # Done; return the response.
894
+ return response
895
+
896
+ async def get_operation(
897
+ self,
898
+ request: Optional[operations_pb2.GetOperationRequest] = None,
899
+ *,
900
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
901
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
902
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
903
+ ) -> operations_pb2.Operation:
904
+ r"""Gets the latest state of a long-running operation.
905
+
906
+ Args:
907
+ request (:class:`~.operations_pb2.GetOperationRequest`):
908
+ The request object. Request message for
909
+ `GetOperation` method.
910
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
911
+ if any, should be retried.
912
+ timeout (float): The timeout for this request.
913
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
914
+ sent along with the request as metadata. Normally, each value must be of type `str`,
915
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
916
+ be of type `bytes`.
917
+ Returns:
918
+ ~.operations_pb2.Operation:
919
+ An ``Operation`` object.
920
+ """
921
+ # Create or coerce a protobuf request object.
922
+ # The request isn't a proto-plus wrapped type,
923
+ # so it must be constructed via keyword expansion.
924
+ if isinstance(request, dict):
925
+ request = operations_pb2.GetOperationRequest(**request)
926
+
927
+ # Wrap the RPC method; this adds retry and timeout information,
928
+ # and friendly error handling.
929
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
930
+
931
+ # Certain fields should be provided within the metadata header;
932
+ # add these here.
933
+ metadata = tuple(metadata) + (
934
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
935
+ )
936
+
937
+ # Validate the universe domain.
938
+ self._client._validate_universe_domain()
939
+
940
+ # Send the request.
941
+ response = await rpc(
942
+ request,
943
+ retry=retry,
944
+ timeout=timeout,
945
+ metadata=metadata,
946
+ )
947
+
948
+ # Done; return the response.
949
+ return response
950
+
951
+ async def delete_operation(
952
+ self,
953
+ request: Optional[operations_pb2.DeleteOperationRequest] = None,
954
+ *,
955
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
956
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
957
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
958
+ ) -> None:
959
+ r"""Deletes a long-running operation.
960
+
961
+ This method indicates that the client is no longer interested
962
+ in the operation result. It does not cancel the operation.
963
+ If the server doesn't support this method, it returns
964
+ `google.rpc.Code.UNIMPLEMENTED`.
965
+
966
+ Args:
967
+ request (:class:`~.operations_pb2.DeleteOperationRequest`):
968
+ The request object. Request message for
969
+ `DeleteOperation` method.
970
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
971
+ if any, should be retried.
972
+ timeout (float): The timeout for this request.
973
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
974
+ sent along with the request as metadata. Normally, each value must be of type `str`,
975
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
976
+ be of type `bytes`.
977
+ Returns:
978
+ None
979
+ """
980
+ # Create or coerce a protobuf request object.
981
+ # The request isn't a proto-plus wrapped type,
982
+ # so it must be constructed via keyword expansion.
983
+ if isinstance(request, dict):
984
+ request = operations_pb2.DeleteOperationRequest(**request)
985
+
986
+ # Wrap the RPC method; this adds retry and timeout information,
987
+ # and friendly error handling.
988
+ rpc = self.transport._wrapped_methods[self._client._transport.delete_operation]
989
+
990
+ # Certain fields should be provided within the metadata header;
991
+ # add these here.
992
+ metadata = tuple(metadata) + (
993
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
994
+ )
995
+
996
+ # Validate the universe domain.
997
+ self._client._validate_universe_domain()
998
+
999
+ # Send the request.
1000
+ await rpc(
1001
+ request,
1002
+ retry=retry,
1003
+ timeout=timeout,
1004
+ metadata=metadata,
1005
+ )
1006
+
1007
+ async def cancel_operation(
1008
+ self,
1009
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
1010
+ *,
1011
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1012
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1013
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1014
+ ) -> None:
1015
+ r"""Starts asynchronous cancellation on a long-running operation.
1016
+
1017
+ The server makes a best effort to cancel the operation, but success
1018
+ is not guaranteed. If the server doesn't support this method, it returns
1019
+ `google.rpc.Code.UNIMPLEMENTED`.
1020
+
1021
+ Args:
1022
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
1023
+ The request object. Request message for
1024
+ `CancelOperation` method.
1025
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1026
+ if any, should be retried.
1027
+ timeout (float): The timeout for this request.
1028
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1029
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1030
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1031
+ be of type `bytes`.
1032
+ Returns:
1033
+ None
1034
+ """
1035
+ # Create or coerce a protobuf request object.
1036
+ # The request isn't a proto-plus wrapped type,
1037
+ # so it must be constructed via keyword expansion.
1038
+ if isinstance(request, dict):
1039
+ request = operations_pb2.CancelOperationRequest(**request)
1040
+
1041
+ # Wrap the RPC method; this adds retry and timeout information,
1042
+ # and friendly error handling.
1043
+ rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
1044
+
1045
+ # Certain fields should be provided within the metadata header;
1046
+ # add these here.
1047
+ metadata = tuple(metadata) + (
1048
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1049
+ )
1050
+
1051
+ # Validate the universe domain.
1052
+ self._client._validate_universe_domain()
1053
+
1054
+ # Send the request.
1055
+ await rpc(
1056
+ request,
1057
+ retry=retry,
1058
+ timeout=timeout,
1059
+ metadata=metadata,
1060
+ )
1061
+
1062
+ async def set_iam_policy(
1063
+ self,
1064
+ request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
1065
+ *,
1066
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1067
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1068
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1069
+ ) -> policy_pb2.Policy:
1070
+ r"""Sets the IAM access control policy on the specified function.
1071
+
1072
+ Replaces any existing policy.
1073
+
1074
+ Args:
1075
+ request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`):
1076
+ The request object. Request message for `SetIamPolicy`
1077
+ method.
1078
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1079
+ should be retried.
1080
+ timeout (float): The timeout for this request.
1081
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1082
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1083
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1084
+ be of type `bytes`.
1085
+ Returns:
1086
+ ~.policy_pb2.Policy:
1087
+ Defines an Identity and Access Management (IAM) policy.
1088
+ It is used to specify access control policies for Cloud
1089
+ Platform resources.
1090
+ A ``Policy`` is a collection of ``bindings``. A
1091
+ ``binding`` binds one or more ``members`` to a single
1092
+ ``role``. Members can be user accounts, service
1093
+ accounts, Google groups, and domains (such as G Suite).
1094
+ A ``role`` is a named list of permissions (defined by
1095
+ IAM or configured by users). A ``binding`` can
1096
+ optionally specify a ``condition``, which is a logic
1097
+ expression that further constrains the role binding
1098
+ based on attributes about the request and/or target
1099
+ resource.
1100
+
1101
+ **JSON Example**
1102
+
1103
+ ::
1104
+
1105
+ {
1106
+ "bindings": [
1107
+ {
1108
+ "role": "roles/resourcemanager.organizationAdmin",
1109
+ "members": [
1110
+ "user:mike@example.com",
1111
+ "group:admins@example.com",
1112
+ "domain:google.com",
1113
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
1114
+ ]
1115
+ },
1116
+ {
1117
+ "role": "roles/resourcemanager.organizationViewer",
1118
+ "members": ["user:eve@example.com"],
1119
+ "condition": {
1120
+ "title": "expirable access",
1121
+ "description": "Does not grant access after Sep 2020",
1122
+ "expression": "request.time <
1123
+ timestamp('2020-10-01T00:00:00.000Z')",
1124
+ }
1125
+ }
1126
+ ]
1127
+ }
1128
+
1129
+ **YAML Example**
1130
+
1131
+ ::
1132
+
1133
+ bindings:
1134
+ - members:
1135
+ - user:mike@example.com
1136
+ - group:admins@example.com
1137
+ - domain:google.com
1138
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
1139
+ role: roles/resourcemanager.organizationAdmin
1140
+ - members:
1141
+ - user:eve@example.com
1142
+ role: roles/resourcemanager.organizationViewer
1143
+ condition:
1144
+ title: expirable access
1145
+ description: Does not grant access after Sep 2020
1146
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
1147
+
1148
+ For a description of IAM and its features, see the `IAM
1149
+ developer's
1150
+ guide <https://cloud.google.com/iam/docs>`__.
1151
+ """
1152
+ # Create or coerce a protobuf request object.
1153
+
1154
+ # The request isn't a proto-plus wrapped type,
1155
+ # so it must be constructed via keyword expansion.
1156
+ if isinstance(request, dict):
1157
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
1158
+
1159
+ # Wrap the RPC method; this adds retry and timeout information,
1160
+ # and friendly error handling.
1161
+ rpc = self.transport._wrapped_methods[self._client._transport.set_iam_policy]
1162
+
1163
+ # Certain fields should be provided within the metadata header;
1164
+ # add these here.
1165
+ metadata = tuple(metadata) + (
1166
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1167
+ )
1168
+
1169
+ # Validate the universe domain.
1170
+ self._client._validate_universe_domain()
1171
+
1172
+ # Send the request.
1173
+ response = await rpc(
1174
+ request,
1175
+ retry=retry,
1176
+ timeout=timeout,
1177
+ metadata=metadata,
1178
+ )
1179
+
1180
+ # Done; return the response.
1181
+ return response
1182
+
1183
+ async def get_iam_policy(
1184
+ self,
1185
+ request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
1186
+ *,
1187
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1188
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1189
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1190
+ ) -> policy_pb2.Policy:
1191
+ r"""Gets the IAM access control policy for a function.
1192
+
1193
+ Returns an empty policy if the function exists and does not have a
1194
+ policy set.
1195
+
1196
+ Args:
1197
+ request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
1198
+ The request object. Request message for `GetIamPolicy`
1199
+ method.
1200
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if
1201
+ any, should be retried.
1202
+ timeout (float): The timeout for this request.
1203
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1204
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1205
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1206
+ be of type `bytes`.
1207
+ Returns:
1208
+ ~.policy_pb2.Policy:
1209
+ Defines an Identity and Access Management (IAM) policy.
1210
+ It is used to specify access control policies for Cloud
1211
+ Platform resources.
1212
+ A ``Policy`` is a collection of ``bindings``. A
1213
+ ``binding`` binds one or more ``members`` to a single
1214
+ ``role``. Members can be user accounts, service
1215
+ accounts, Google groups, and domains (such as G Suite).
1216
+ A ``role`` is a named list of permissions (defined by
1217
+ IAM or configured by users). A ``binding`` can
1218
+ optionally specify a ``condition``, which is a logic
1219
+ expression that further constrains the role binding
1220
+ based on attributes about the request and/or target
1221
+ resource.
1222
+
1223
+ **JSON Example**
1224
+
1225
+ ::
1226
+
1227
+ {
1228
+ "bindings": [
1229
+ {
1230
+ "role": "roles/resourcemanager.organizationAdmin",
1231
+ "members": [
1232
+ "user:mike@example.com",
1233
+ "group:admins@example.com",
1234
+ "domain:google.com",
1235
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
1236
+ ]
1237
+ },
1238
+ {
1239
+ "role": "roles/resourcemanager.organizationViewer",
1240
+ "members": ["user:eve@example.com"],
1241
+ "condition": {
1242
+ "title": "expirable access",
1243
+ "description": "Does not grant access after Sep 2020",
1244
+ "expression": "request.time <
1245
+ timestamp('2020-10-01T00:00:00.000Z')",
1246
+ }
1247
+ }
1248
+ ]
1249
+ }
1250
+
1251
+ **YAML Example**
1252
+
1253
+ ::
1254
+
1255
+ bindings:
1256
+ - members:
1257
+ - user:mike@example.com
1258
+ - group:admins@example.com
1259
+ - domain:google.com
1260
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
1261
+ role: roles/resourcemanager.organizationAdmin
1262
+ - members:
1263
+ - user:eve@example.com
1264
+ role: roles/resourcemanager.organizationViewer
1265
+ condition:
1266
+ title: expirable access
1267
+ description: Does not grant access after Sep 2020
1268
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
1269
+
1270
+ For a description of IAM and its features, see the `IAM
1271
+ developer's
1272
+ guide <https://cloud.google.com/iam/docs>`__.
1273
+ """
1274
+ # Create or coerce a protobuf request object.
1275
+
1276
+ # The request isn't a proto-plus wrapped type,
1277
+ # so it must be constructed via keyword expansion.
1278
+ if isinstance(request, dict):
1279
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
1280
+
1281
+ # Wrap the RPC method; this adds retry and timeout information,
1282
+ # and friendly error handling.
1283
+ rpc = self.transport._wrapped_methods[self._client._transport.get_iam_policy]
1284
+
1285
+ # Certain fields should be provided within the metadata header;
1286
+ # add these here.
1287
+ metadata = tuple(metadata) + (
1288
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1289
+ )
1290
+
1291
+ # Validate the universe domain.
1292
+ self._client._validate_universe_domain()
1293
+
1294
+ # Send the request.
1295
+ response = await rpc(
1296
+ request,
1297
+ retry=retry,
1298
+ timeout=timeout,
1299
+ metadata=metadata,
1300
+ )
1301
+
1302
+ # Done; return the response.
1303
+ return response
1304
+
1305
+ async def test_iam_permissions(
1306
+ self,
1307
+ request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
1308
+ *,
1309
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1310
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1311
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1312
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1313
+ r"""Tests the specified IAM permissions against the IAM access control
1314
+ policy for a function.
1315
+
1316
+ If the function does not exist, this will return an empty set
1317
+ of permissions, not a NOT_FOUND error.
1318
+
1319
+ Args:
1320
+ request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
1321
+ The request object. Request message for
1322
+ `TestIamPermissions` method.
1323
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1324
+ if any, should be retried.
1325
+ timeout (float): The timeout for this request.
1326
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1327
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1328
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1329
+ be of type `bytes`.
1330
+ Returns:
1331
+ ~.iam_policy_pb2.TestIamPermissionsResponse:
1332
+ Response message for ``TestIamPermissions`` method.
1333
+ """
1334
+ # Create or coerce a protobuf request object.
1335
+
1336
+ # The request isn't a proto-plus wrapped type,
1337
+ # so it must be constructed via keyword expansion.
1338
+ if isinstance(request, dict):
1339
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
1340
+
1341
+ # Wrap the RPC method; this adds retry and timeout information,
1342
+ # and friendly error handling.
1343
+ rpc = self.transport._wrapped_methods[
1344
+ self._client._transport.test_iam_permissions
1345
+ ]
1346
+
1347
+ # Certain fields should be provided within the metadata header;
1348
+ # add these here.
1349
+ metadata = tuple(metadata) + (
1350
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1351
+ )
1352
+
1353
+ # Validate the universe domain.
1354
+ self._client._validate_universe_domain()
1355
+
1356
+ # Send the request.
1357
+ response = await rpc(
1358
+ request,
1359
+ retry=retry,
1360
+ timeout=timeout,
1361
+ metadata=metadata,
1362
+ )
1363
+
1364
+ # Done; return the response.
1365
+ return response
1366
+
1367
+ async def get_location(
1368
+ self,
1369
+ request: Optional[locations_pb2.GetLocationRequest] = None,
1370
+ *,
1371
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1372
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1373
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1374
+ ) -> locations_pb2.Location:
1375
+ r"""Gets information about a location.
1376
+
1377
+ Args:
1378
+ request (:class:`~.location_pb2.GetLocationRequest`):
1379
+ The request object. Request message for
1380
+ `GetLocation` method.
1381
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1382
+ if any, should be retried.
1383
+ timeout (float): The timeout for this request.
1384
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1385
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1386
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1387
+ be of type `bytes`.
1388
+ Returns:
1389
+ ~.location_pb2.Location:
1390
+ Location object.
1391
+ """
1392
+ # Create or coerce a protobuf request object.
1393
+ # The request isn't a proto-plus wrapped type,
1394
+ # so it must be constructed via keyword expansion.
1395
+ if isinstance(request, dict):
1396
+ request = locations_pb2.GetLocationRequest(**request)
1397
+
1398
+ # Wrap the RPC method; this adds retry and timeout information,
1399
+ # and friendly error handling.
1400
+ rpc = self.transport._wrapped_methods[self._client._transport.get_location]
1401
+
1402
+ # Certain fields should be provided within the metadata header;
1403
+ # add these here.
1404
+ metadata = tuple(metadata) + (
1405
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1406
+ )
1407
+
1408
+ # Validate the universe domain.
1409
+ self._client._validate_universe_domain()
1410
+
1411
+ # Send the request.
1412
+ response = await rpc(
1413
+ request,
1414
+ retry=retry,
1415
+ timeout=timeout,
1416
+ metadata=metadata,
1417
+ )
1418
+
1419
+ # Done; return the response.
1420
+ return response
1421
+
1422
+ async def list_locations(
1423
+ self,
1424
+ request: Optional[locations_pb2.ListLocationsRequest] = None,
1425
+ *,
1426
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1427
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1428
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1429
+ ) -> locations_pb2.ListLocationsResponse:
1430
+ r"""Lists information about the supported locations for this service.
1431
+
1432
+ Args:
1433
+ request (:class:`~.location_pb2.ListLocationsRequest`):
1434
+ The request object. Request message for
1435
+ `ListLocations` method.
1436
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1437
+ if any, should be retried.
1438
+ timeout (float): The timeout for this request.
1439
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1440
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1441
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1442
+ be of type `bytes`.
1443
+ Returns:
1444
+ ~.location_pb2.ListLocationsResponse:
1445
+ Response message for ``ListLocations`` method.
1446
+ """
1447
+ # Create or coerce a protobuf request object.
1448
+ # The request isn't a proto-plus wrapped type,
1449
+ # so it must be constructed via keyword expansion.
1450
+ if isinstance(request, dict):
1451
+ request = locations_pb2.ListLocationsRequest(**request)
1452
+
1453
+ # Wrap the RPC method; this adds retry and timeout information,
1454
+ # and friendly error handling.
1455
+ rpc = self.transport._wrapped_methods[self._client._transport.list_locations]
1456
+
1457
+ # Certain fields should be provided within the metadata header;
1458
+ # add these here.
1459
+ metadata = tuple(metadata) + (
1460
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1461
+ )
1462
+
1463
+ # Validate the universe domain.
1464
+ self._client._validate_universe_domain()
1465
+
1466
+ # Send the request.
1467
+ response = await rpc(
1468
+ request,
1469
+ retry=retry,
1470
+ timeout=timeout,
1471
+ metadata=metadata,
1472
+ )
1473
+
1474
+ # Done; return the response.
1475
+ return response
1476
+
1477
+ async def __aenter__(self) -> "ClientGatewaysServiceAsyncClient":
1478
+ return self
1479
+
1480
+ async def __aexit__(self, exc_type, exc, tb):
1481
+ await self.transport.close()
1482
+
1483
+
1484
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1485
+ gapic_version=package_version.__version__
1486
+ )
1487
+
1488
+
1489
+ __all__ = ("ClientGatewaysServiceAsyncClient",)