google-cloud-cloudsecuritycompliance 0.1.0__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 (37) hide show
  1. google/cloud/cloudsecuritycompliance/__init__.py +163 -0
  2. google/cloud/cloudsecuritycompliance/gapic_version.py +17 -0
  3. google/cloud/cloudsecuritycompliance/py.typed +2 -0
  4. google/cloud/cloudsecuritycompliance_v1/__init__.py +155 -0
  5. google/cloud/cloudsecuritycompliance_v1/gapic_metadata.json +287 -0
  6. google/cloud/cloudsecuritycompliance_v1/gapic_version.py +17 -0
  7. google/cloud/cloudsecuritycompliance_v1/py.typed +2 -0
  8. google/cloud/cloudsecuritycompliance_v1/services/__init__.py +15 -0
  9. google/cloud/cloudsecuritycompliance_v1/services/config/__init__.py +22 -0
  10. google/cloud/cloudsecuritycompliance_v1/services/config/async_client.py +1836 -0
  11. google/cloud/cloudsecuritycompliance_v1/services/config/client.py +2276 -0
  12. google/cloud/cloudsecuritycompliance_v1/services/config/pagers.py +353 -0
  13. google/cloud/cloudsecuritycompliance_v1/services/config/transports/__init__.py +36 -0
  14. google/cloud/cloudsecuritycompliance_v1/services/config/transports/base.py +417 -0
  15. google/cloud/cloudsecuritycompliance_v1/services/config/transports/grpc.py +697 -0
  16. google/cloud/cloudsecuritycompliance_v1/services/config/transports/grpc_asyncio.py +837 -0
  17. google/cloud/cloudsecuritycompliance_v1/services/config/transports/rest.py +3139 -0
  18. google/cloud/cloudsecuritycompliance_v1/services/config/transports/rest_base.py +764 -0
  19. google/cloud/cloudsecuritycompliance_v1/services/deployment/__init__.py +22 -0
  20. google/cloud/cloudsecuritycompliance_v1/services/deployment/async_client.py +1428 -0
  21. google/cloud/cloudsecuritycompliance_v1/services/deployment/client.py +1900 -0
  22. google/cloud/cloudsecuritycompliance_v1/services/deployment/pagers.py +357 -0
  23. google/cloud/cloudsecuritycompliance_v1/services/deployment/transports/__init__.py +36 -0
  24. google/cloud/cloudsecuritycompliance_v1/services/deployment/transports/base.py +373 -0
  25. google/cloud/cloudsecuritycompliance_v1/services/deployment/transports/grpc.py +637 -0
  26. google/cloud/cloudsecuritycompliance_v1/services/deployment/transports/grpc_asyncio.py +755 -0
  27. google/cloud/cloudsecuritycompliance_v1/services/deployment/transports/rest.py +2515 -0
  28. google/cloud/cloudsecuritycompliance_v1/services/deployment/transports/rest_base.py +541 -0
  29. google/cloud/cloudsecuritycompliance_v1/types/__init__.py +144 -0
  30. google/cloud/cloudsecuritycompliance_v1/types/common.py +1404 -0
  31. google/cloud/cloudsecuritycompliance_v1/types/config.py +368 -0
  32. google/cloud/cloudsecuritycompliance_v1/types/deployment.py +826 -0
  33. google_cloud_cloudsecuritycompliance-0.1.0.dist-info/METADATA +239 -0
  34. google_cloud_cloudsecuritycompliance-0.1.0.dist-info/RECORD +37 -0
  35. google_cloud_cloudsecuritycompliance-0.1.0.dist-info/WHEEL +5 -0
  36. google_cloud_cloudsecuritycompliance-0.1.0.dist-info/licenses/LICENSE +202 -0
  37. google_cloud_cloudsecuritycompliance-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1836 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 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
+ import google.protobuf
39
+
40
+ from google.cloud.cloudsecuritycompliance_v1 import gapic_version as package_version
41
+
42
+ try:
43
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
44
+ except AttributeError: # pragma: NO COVER
45
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
46
+
47
+ from google.cloud.location import locations_pb2 # type: ignore
48
+ from google.longrunning import operations_pb2 # type: ignore
49
+ from google.protobuf import field_mask_pb2 # type: ignore
50
+ from google.protobuf import timestamp_pb2 # type: ignore
51
+
52
+ from google.cloud.cloudsecuritycompliance_v1.services.config import pagers
53
+ from google.cloud.cloudsecuritycompliance_v1.types import common, config
54
+
55
+ from .client import ConfigClient
56
+ from .transports.base import DEFAULT_CLIENT_INFO, ConfigTransport
57
+ from .transports.grpc_asyncio import ConfigGrpcAsyncIOTransport
58
+
59
+ try:
60
+ from google.api_core import client_logging # type: ignore
61
+
62
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
63
+ except ImportError: # pragma: NO COVER
64
+ CLIENT_LOGGING_SUPPORTED = False
65
+
66
+ _LOGGER = std_logging.getLogger(__name__)
67
+
68
+
69
+ class ConfigAsyncClient:
70
+ """Service describing handlers for config resources"""
71
+
72
+ _client: ConfigClient
73
+
74
+ # Copy defaults from the synchronous client for use here.
75
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
76
+ DEFAULT_ENDPOINT = ConfigClient.DEFAULT_ENDPOINT
77
+ DEFAULT_MTLS_ENDPOINT = ConfigClient.DEFAULT_MTLS_ENDPOINT
78
+ _DEFAULT_ENDPOINT_TEMPLATE = ConfigClient._DEFAULT_ENDPOINT_TEMPLATE
79
+ _DEFAULT_UNIVERSE = ConfigClient._DEFAULT_UNIVERSE
80
+
81
+ cloud_control_path = staticmethod(ConfigClient.cloud_control_path)
82
+ parse_cloud_control_path = staticmethod(ConfigClient.parse_cloud_control_path)
83
+ framework_path = staticmethod(ConfigClient.framework_path)
84
+ parse_framework_path = staticmethod(ConfigClient.parse_framework_path)
85
+ common_billing_account_path = staticmethod(ConfigClient.common_billing_account_path)
86
+ parse_common_billing_account_path = staticmethod(
87
+ ConfigClient.parse_common_billing_account_path
88
+ )
89
+ common_folder_path = staticmethod(ConfigClient.common_folder_path)
90
+ parse_common_folder_path = staticmethod(ConfigClient.parse_common_folder_path)
91
+ common_organization_path = staticmethod(ConfigClient.common_organization_path)
92
+ parse_common_organization_path = staticmethod(
93
+ ConfigClient.parse_common_organization_path
94
+ )
95
+ common_project_path = staticmethod(ConfigClient.common_project_path)
96
+ parse_common_project_path = staticmethod(ConfigClient.parse_common_project_path)
97
+ common_location_path = staticmethod(ConfigClient.common_location_path)
98
+ parse_common_location_path = staticmethod(ConfigClient.parse_common_location_path)
99
+
100
+ @classmethod
101
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
102
+ """Creates an instance of this client using the provided credentials
103
+ info.
104
+
105
+ Args:
106
+ info (dict): The service account private key info.
107
+ args: Additional arguments to pass to the constructor.
108
+ kwargs: Additional arguments to pass to the constructor.
109
+
110
+ Returns:
111
+ ConfigAsyncClient: The constructed client.
112
+ """
113
+ return ConfigClient.from_service_account_info.__func__(ConfigAsyncClient, info, *args, **kwargs) # type: ignore
114
+
115
+ @classmethod
116
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
117
+ """Creates an instance of this client using the provided credentials
118
+ file.
119
+
120
+ Args:
121
+ filename (str): The path to the service account private key json
122
+ file.
123
+ args: Additional arguments to pass to the constructor.
124
+ kwargs: Additional arguments to pass to the constructor.
125
+
126
+ Returns:
127
+ ConfigAsyncClient: The constructed client.
128
+ """
129
+ return ConfigClient.from_service_account_file.__func__(ConfigAsyncClient, filename, *args, **kwargs) # type: ignore
130
+
131
+ from_service_account_json = from_service_account_file
132
+
133
+ @classmethod
134
+ def get_mtls_endpoint_and_cert_source(
135
+ cls, client_options: Optional[ClientOptions] = None
136
+ ):
137
+ """Return the API endpoint and client cert source for mutual TLS.
138
+
139
+ The client cert source is determined in the following order:
140
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
141
+ client cert source is None.
142
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
143
+ default client cert source exists, use the default one; otherwise the client cert
144
+ source is None.
145
+
146
+ The API endpoint is determined in the following order:
147
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
148
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
149
+ default mTLS endpoint; if the environment variable is "never", use the default API
150
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
151
+ use the default API endpoint.
152
+
153
+ More details can be found at https://google.aip.dev/auth/4114.
154
+
155
+ Args:
156
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
157
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
158
+ in this method.
159
+
160
+ Returns:
161
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
162
+ client cert source to use.
163
+
164
+ Raises:
165
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
166
+ """
167
+ return ConfigClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
168
+
169
+ @property
170
+ def transport(self) -> ConfigTransport:
171
+ """Returns the transport used by the client instance.
172
+
173
+ Returns:
174
+ ConfigTransport: The transport used by the client instance.
175
+ """
176
+ return self._client.transport
177
+
178
+ @property
179
+ def api_endpoint(self):
180
+ """Return the API endpoint used by the client instance.
181
+
182
+ Returns:
183
+ str: The API endpoint used by the client instance.
184
+ """
185
+ return self._client._api_endpoint
186
+
187
+ @property
188
+ def universe_domain(self) -> str:
189
+ """Return the universe domain used by the client instance.
190
+
191
+ Returns:
192
+ str: The universe domain used
193
+ by the client instance.
194
+ """
195
+ return self._client._universe_domain
196
+
197
+ get_transport_class = ConfigClient.get_transport_class
198
+
199
+ def __init__(
200
+ self,
201
+ *,
202
+ credentials: Optional[ga_credentials.Credentials] = None,
203
+ transport: Optional[
204
+ Union[str, ConfigTransport, Callable[..., ConfigTransport]]
205
+ ] = "grpc_asyncio",
206
+ client_options: Optional[ClientOptions] = None,
207
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
208
+ ) -> None:
209
+ """Instantiates the config async client.
210
+
211
+ Args:
212
+ credentials (Optional[google.auth.credentials.Credentials]): The
213
+ authorization credentials to attach to requests. These
214
+ credentials identify the application to the service; if none
215
+ are specified, the client will attempt to ascertain the
216
+ credentials from the environment.
217
+ transport (Optional[Union[str,ConfigTransport,Callable[..., ConfigTransport]]]):
218
+ The transport to use, or a Callable that constructs and returns a new transport to use.
219
+ If a Callable is given, it will be called with the same set of initialization
220
+ arguments as used in the ConfigTransport constructor.
221
+ If set to None, a transport is chosen automatically.
222
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
223
+ Custom options for the client.
224
+
225
+ 1. The ``api_endpoint`` property can be used to override the
226
+ default endpoint provided by the client when ``transport`` is
227
+ not explicitly provided. Only if this property is not set and
228
+ ``transport`` was not explicitly provided, the endpoint is
229
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
230
+ variable, which have one of the following values:
231
+ "always" (always use the default mTLS endpoint), "never" (always
232
+ use the default regular endpoint) and "auto" (auto-switch to the
233
+ default mTLS endpoint if client certificate is present; this is
234
+ the default value).
235
+
236
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
237
+ is "true", then the ``client_cert_source`` property can be used
238
+ to provide a client certificate for mTLS transport. If
239
+ not provided, the default SSL client certificate will be used if
240
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
241
+ set, no client certificate will be used.
242
+
243
+ 3. The ``universe_domain`` property can be used to override the
244
+ default "googleapis.com" universe. Note that ``api_endpoint``
245
+ property still takes precedence; and ``universe_domain`` is
246
+ currently not supported for mTLS.
247
+
248
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
249
+ The client info used to send a user-agent string along with
250
+ API requests. If ``None``, then default info will be used.
251
+ Generally, you only need to set this if you're developing
252
+ your own client library.
253
+
254
+ Raises:
255
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
256
+ creation failed for any reason.
257
+ """
258
+ self._client = ConfigClient(
259
+ credentials=credentials,
260
+ transport=transport,
261
+ client_options=client_options,
262
+ client_info=client_info,
263
+ )
264
+
265
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
266
+ std_logging.DEBUG
267
+ ): # pragma: NO COVER
268
+ _LOGGER.debug(
269
+ "Created client `google.cloud.cloudsecuritycompliance_v1.ConfigAsyncClient`.",
270
+ extra={
271
+ "serviceName": "google.cloud.cloudsecuritycompliance.v1.Config",
272
+ "universeDomain": getattr(
273
+ self._client._transport._credentials, "universe_domain", ""
274
+ ),
275
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
276
+ "credentialsInfo": getattr(
277
+ self.transport._credentials, "get_cred_info", lambda: None
278
+ )(),
279
+ }
280
+ if hasattr(self._client._transport, "_credentials")
281
+ else {
282
+ "serviceName": "google.cloud.cloudsecuritycompliance.v1.Config",
283
+ "credentialsType": None,
284
+ },
285
+ )
286
+
287
+ async def list_frameworks(
288
+ self,
289
+ request: Optional[Union[config.ListFrameworksRequest, dict]] = None,
290
+ *,
291
+ parent: Optional[str] = None,
292
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
293
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
294
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
295
+ ) -> pagers.ListFrameworksAsyncPager:
296
+ r"""Lists Frameworks in a given organization.
297
+
298
+ .. code-block:: python
299
+
300
+ # This snippet has been automatically generated and should be regarded as a
301
+ # code template only.
302
+ # It will require modifications to work:
303
+ # - It may require correct/in-range values for request initialization.
304
+ # - It may require specifying regional endpoints when creating the service
305
+ # client as shown in:
306
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
307
+ from google.cloud import cloudsecuritycompliance_v1
308
+
309
+ async def sample_list_frameworks():
310
+ # Create a client
311
+ client = cloudsecuritycompliance_v1.ConfigAsyncClient()
312
+
313
+ # Initialize request argument(s)
314
+ request = cloudsecuritycompliance_v1.ListFrameworksRequest(
315
+ parent="parent_value",
316
+ )
317
+
318
+ # Make the request
319
+ page_result = client.list_frameworks(request=request)
320
+
321
+ # Handle the response
322
+ async for response in page_result:
323
+ print(response)
324
+
325
+ Args:
326
+ request (Optional[Union[google.cloud.cloudsecuritycompliance_v1.types.ListFrameworksRequest, dict]]):
327
+ The request object. Request message for [ListFrameworks][].
328
+ parent (:class:`str`):
329
+ Required. The parent resource name, in the format
330
+ ``organizations/{organization}/locations/{location}``.
331
+
332
+ This corresponds to the ``parent`` field
333
+ on the ``request`` instance; if ``request`` is provided, this
334
+ should not be set.
335
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
336
+ should be retried.
337
+ timeout (float): The timeout for this request.
338
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
339
+ sent along with the request as metadata. Normally, each value must be of type `str`,
340
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
341
+ be of type `bytes`.
342
+
343
+ Returns:
344
+ google.cloud.cloudsecuritycompliance_v1.services.config.pagers.ListFrameworksAsyncPager:
345
+ Response message for [ListFrameworks][].
346
+
347
+ Iterating over this object will yield results and
348
+ resolve additional pages automatically.
349
+
350
+ """
351
+ # Create or coerce a protobuf request object.
352
+ # - Quick check: If we got a request object, we should *not* have
353
+ # gotten any keyword arguments that map to the request.
354
+ flattened_params = [parent]
355
+ has_flattened_params = (
356
+ len([param for param in flattened_params if param is not None]) > 0
357
+ )
358
+ if request is not None and has_flattened_params:
359
+ raise ValueError(
360
+ "If the `request` argument is set, then none of "
361
+ "the individual field arguments should be set."
362
+ )
363
+
364
+ # - Use the request object if provided (there's no risk of modifying the input as
365
+ # there are no flattened fields), or create one.
366
+ if not isinstance(request, config.ListFrameworksRequest):
367
+ request = config.ListFrameworksRequest(request)
368
+
369
+ # If we have keyword arguments corresponding to fields on the
370
+ # request, apply these.
371
+ if parent is not None:
372
+ request.parent = parent
373
+
374
+ # Wrap the RPC method; this adds retry and timeout information,
375
+ # and friendly error handling.
376
+ rpc = self._client._transport._wrapped_methods[
377
+ self._client._transport.list_frameworks
378
+ ]
379
+
380
+ # Certain fields should be provided within the metadata header;
381
+ # add these here.
382
+ metadata = tuple(metadata) + (
383
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
384
+ )
385
+
386
+ # Validate the universe domain.
387
+ self._client._validate_universe_domain()
388
+
389
+ # Send the request.
390
+ response = await rpc(
391
+ request,
392
+ retry=retry,
393
+ timeout=timeout,
394
+ metadata=metadata,
395
+ )
396
+
397
+ # This method is paged; wrap the response in a pager, which provides
398
+ # an `__aiter__` convenience method.
399
+ response = pagers.ListFrameworksAsyncPager(
400
+ method=rpc,
401
+ request=request,
402
+ response=response,
403
+ retry=retry,
404
+ timeout=timeout,
405
+ metadata=metadata,
406
+ )
407
+
408
+ # Done; return the response.
409
+ return response
410
+
411
+ async def get_framework(
412
+ self,
413
+ request: Optional[Union[config.GetFrameworkRequest, dict]] = None,
414
+ *,
415
+ name: Optional[str] = None,
416
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
417
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
418
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
419
+ ) -> common.Framework:
420
+ r"""Gets details of a single Framework.
421
+
422
+ .. code-block:: python
423
+
424
+ # This snippet has been automatically generated and should be regarded as a
425
+ # code template only.
426
+ # It will require modifications to work:
427
+ # - It may require correct/in-range values for request initialization.
428
+ # - It may require specifying regional endpoints when creating the service
429
+ # client as shown in:
430
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
431
+ from google.cloud import cloudsecuritycompliance_v1
432
+
433
+ async def sample_get_framework():
434
+ # Create a client
435
+ client = cloudsecuritycompliance_v1.ConfigAsyncClient()
436
+
437
+ # Initialize request argument(s)
438
+ request = cloudsecuritycompliance_v1.GetFrameworkRequest(
439
+ name="name_value",
440
+ )
441
+
442
+ # Make the request
443
+ response = await client.get_framework(request=request)
444
+
445
+ # Handle the response
446
+ print(response)
447
+
448
+ Args:
449
+ request (Optional[Union[google.cloud.cloudsecuritycompliance_v1.types.GetFrameworkRequest, dict]]):
450
+ The request object. Message for getting a Framework.
451
+ name (:class:`str`):
452
+ Required. The name of the framework to retrieve. Format:
453
+ organizations/{organization}/locations/{location}/frameworks/{framework_id}
454
+
455
+ This corresponds to the ``name`` field
456
+ on the ``request`` instance; if ``request`` is provided, this
457
+ should not be set.
458
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
459
+ should be retried.
460
+ timeout (float): The timeout for this request.
461
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
462
+ sent along with the request as metadata. Normally, each value must be of type `str`,
463
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
464
+ be of type `bytes`.
465
+
466
+ Returns:
467
+ google.cloud.cloudsecuritycompliance_v1.types.Framework:
468
+ Framework is a collection of
469
+ CloudControls which represents
470
+ industry/GCP/Customer defined
471
+
472
+ """
473
+ # Create or coerce a protobuf request object.
474
+ # - Quick check: If we got a request object, we should *not* have
475
+ # gotten any keyword arguments that map to the request.
476
+ flattened_params = [name]
477
+ has_flattened_params = (
478
+ len([param for param in flattened_params if param is not None]) > 0
479
+ )
480
+ if request is not None and has_flattened_params:
481
+ raise ValueError(
482
+ "If the `request` argument is set, then none of "
483
+ "the individual field arguments should be set."
484
+ )
485
+
486
+ # - Use the request object if provided (there's no risk of modifying the input as
487
+ # there are no flattened fields), or create one.
488
+ if not isinstance(request, config.GetFrameworkRequest):
489
+ request = config.GetFrameworkRequest(request)
490
+
491
+ # If we have keyword arguments corresponding to fields on the
492
+ # request, apply these.
493
+ if name is not None:
494
+ request.name = name
495
+
496
+ # Wrap the RPC method; this adds retry and timeout information,
497
+ # and friendly error handling.
498
+ rpc = self._client._transport._wrapped_methods[
499
+ self._client._transport.get_framework
500
+ ]
501
+
502
+ # Certain fields should be provided within the metadata header;
503
+ # add these here.
504
+ metadata = tuple(metadata) + (
505
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
506
+ )
507
+
508
+ # Validate the universe domain.
509
+ self._client._validate_universe_domain()
510
+
511
+ # Send the request.
512
+ response = await rpc(
513
+ request,
514
+ retry=retry,
515
+ timeout=timeout,
516
+ metadata=metadata,
517
+ )
518
+
519
+ # Done; return the response.
520
+ return response
521
+
522
+ async def create_framework(
523
+ self,
524
+ request: Optional[Union[config.CreateFrameworkRequest, dict]] = None,
525
+ *,
526
+ parent: Optional[str] = None,
527
+ framework: Optional[common.Framework] = None,
528
+ framework_id: Optional[str] = None,
529
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
530
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
531
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
532
+ ) -> common.Framework:
533
+ r"""Creates a single framework for a given resource.
534
+
535
+ .. code-block:: python
536
+
537
+ # This snippet has been automatically generated and should be regarded as a
538
+ # code template only.
539
+ # It will require modifications to work:
540
+ # - It may require correct/in-range values for request initialization.
541
+ # - It may require specifying regional endpoints when creating the service
542
+ # client as shown in:
543
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
544
+ from google.cloud import cloudsecuritycompliance_v1
545
+
546
+ async def sample_create_framework():
547
+ # Create a client
548
+ client = cloudsecuritycompliance_v1.ConfigAsyncClient()
549
+
550
+ # Initialize request argument(s)
551
+ framework = cloudsecuritycompliance_v1.Framework()
552
+ framework.name = "name_value"
553
+
554
+ request = cloudsecuritycompliance_v1.CreateFrameworkRequest(
555
+ parent="parent_value",
556
+ framework_id="framework_id_value",
557
+ framework=framework,
558
+ )
559
+
560
+ # Make the request
561
+ response = await client.create_framework(request=request)
562
+
563
+ # Handle the response
564
+ print(response)
565
+
566
+ Args:
567
+ request (Optional[Union[google.cloud.cloudsecuritycompliance_v1.types.CreateFrameworkRequest, dict]]):
568
+ The request object. Message for creating a Framework
569
+ parent (:class:`str`):
570
+ Required. The parent resource name, in the format
571
+ ``organizations/{organization}/locations/{location}``.
572
+
573
+ This corresponds to the ``parent`` field
574
+ on the ``request`` instance; if ``request`` is provided, this
575
+ should not be set.
576
+ framework (:class:`google.cloud.cloudsecuritycompliance_v1.types.Framework`):
577
+ Required. The resource being created
578
+ This corresponds to the ``framework`` field
579
+ on the ``request`` instance; if ``request`` is provided, this
580
+ should not be set.
581
+ framework_id (:class:`str`):
582
+ Required. ID of the framework.
583
+ This is not the full name of the
584
+ framework. This is the last part of the
585
+ full name of the framework.
586
+
587
+ This corresponds to the ``framework_id`` field
588
+ on the ``request`` instance; if ``request`` is provided, this
589
+ should not be set.
590
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
591
+ should be retried.
592
+ timeout (float): The timeout for this request.
593
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
594
+ sent along with the request as metadata. Normally, each value must be of type `str`,
595
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
596
+ be of type `bytes`.
597
+
598
+ Returns:
599
+ google.cloud.cloudsecuritycompliance_v1.types.Framework:
600
+ Framework is a collection of
601
+ CloudControls which represents
602
+ industry/GCP/Customer defined
603
+
604
+ """
605
+ # Create or coerce a protobuf request object.
606
+ # - Quick check: If we got a request object, we should *not* have
607
+ # gotten any keyword arguments that map to the request.
608
+ flattened_params = [parent, framework, framework_id]
609
+ has_flattened_params = (
610
+ len([param for param in flattened_params if param is not None]) > 0
611
+ )
612
+ if request is not None and has_flattened_params:
613
+ raise ValueError(
614
+ "If the `request` argument is set, then none of "
615
+ "the individual field arguments should be set."
616
+ )
617
+
618
+ # - Use the request object if provided (there's no risk of modifying the input as
619
+ # there are no flattened fields), or create one.
620
+ if not isinstance(request, config.CreateFrameworkRequest):
621
+ request = config.CreateFrameworkRequest(request)
622
+
623
+ # If we have keyword arguments corresponding to fields on the
624
+ # request, apply these.
625
+ if parent is not None:
626
+ request.parent = parent
627
+ if framework is not None:
628
+ request.framework = framework
629
+ if framework_id is not None:
630
+ request.framework_id = framework_id
631
+
632
+ # Wrap the RPC method; this adds retry and timeout information,
633
+ # and friendly error handling.
634
+ rpc = self._client._transport._wrapped_methods[
635
+ self._client._transport.create_framework
636
+ ]
637
+
638
+ # Certain fields should be provided within the metadata header;
639
+ # add these here.
640
+ metadata = tuple(metadata) + (
641
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
642
+ )
643
+
644
+ # Validate the universe domain.
645
+ self._client._validate_universe_domain()
646
+
647
+ # Send the request.
648
+ response = await rpc(
649
+ request,
650
+ retry=retry,
651
+ timeout=timeout,
652
+ metadata=metadata,
653
+ )
654
+
655
+ # Done; return the response.
656
+ return response
657
+
658
+ async def update_framework(
659
+ self,
660
+ request: Optional[Union[config.UpdateFrameworkRequest, dict]] = None,
661
+ *,
662
+ framework: Optional[common.Framework] = None,
663
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
664
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
665
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
666
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
667
+ ) -> common.Framework:
668
+ r"""Updates a single Framework.
669
+
670
+ .. code-block:: python
671
+
672
+ # This snippet has been automatically generated and should be regarded as a
673
+ # code template only.
674
+ # It will require modifications to work:
675
+ # - It may require correct/in-range values for request initialization.
676
+ # - It may require specifying regional endpoints when creating the service
677
+ # client as shown in:
678
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
679
+ from google.cloud import cloudsecuritycompliance_v1
680
+
681
+ async def sample_update_framework():
682
+ # Create a client
683
+ client = cloudsecuritycompliance_v1.ConfigAsyncClient()
684
+
685
+ # Initialize request argument(s)
686
+ framework = cloudsecuritycompliance_v1.Framework()
687
+ framework.name = "name_value"
688
+
689
+ request = cloudsecuritycompliance_v1.UpdateFrameworkRequest(
690
+ framework=framework,
691
+ )
692
+
693
+ # Make the request
694
+ response = await client.update_framework(request=request)
695
+
696
+ # Handle the response
697
+ print(response)
698
+
699
+ Args:
700
+ request (Optional[Union[google.cloud.cloudsecuritycompliance_v1.types.UpdateFrameworkRequest, dict]]):
701
+ The request object. Message for updating a Framework
702
+ framework (:class:`google.cloud.cloudsecuritycompliance_v1.types.Framework`):
703
+ Required. The resource being updated
704
+ This corresponds to the ``framework`` field
705
+ on the ``request`` instance; if ``request`` is provided, this
706
+ should not be set.
707
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
708
+ Optional. Field mask is used to specify the fields to be
709
+ overwritten in the Framework resource by the update. The
710
+ fields specified in the update_mask are relative to the
711
+ resource, not the full request. A field will be
712
+ overwritten if it is in the mask. If the user does not
713
+ provide a mask then all fields present in the request
714
+ will be overwritten.
715
+
716
+ This corresponds to the ``update_mask`` field
717
+ on the ``request`` instance; if ``request`` is provided, this
718
+ should not be set.
719
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
720
+ should be retried.
721
+ timeout (float): The timeout for this request.
722
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
723
+ sent along with the request as metadata. Normally, each value must be of type `str`,
724
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
725
+ be of type `bytes`.
726
+
727
+ Returns:
728
+ google.cloud.cloudsecuritycompliance_v1.types.Framework:
729
+ Framework is a collection of
730
+ CloudControls which represents
731
+ industry/GCP/Customer defined
732
+
733
+ """
734
+ # Create or coerce a protobuf request object.
735
+ # - Quick check: If we got a request object, we should *not* have
736
+ # gotten any keyword arguments that map to the request.
737
+ flattened_params = [framework, update_mask]
738
+ has_flattened_params = (
739
+ len([param for param in flattened_params if param is not None]) > 0
740
+ )
741
+ if request is not None and has_flattened_params:
742
+ raise ValueError(
743
+ "If the `request` argument is set, then none of "
744
+ "the individual field arguments should be set."
745
+ )
746
+
747
+ # - Use the request object if provided (there's no risk of modifying the input as
748
+ # there are no flattened fields), or create one.
749
+ if not isinstance(request, config.UpdateFrameworkRequest):
750
+ request = config.UpdateFrameworkRequest(request)
751
+
752
+ # If we have keyword arguments corresponding to fields on the
753
+ # request, apply these.
754
+ if framework is not None:
755
+ request.framework = framework
756
+ if update_mask is not None:
757
+ request.update_mask = update_mask
758
+
759
+ # Wrap the RPC method; this adds retry and timeout information,
760
+ # and friendly error handling.
761
+ rpc = self._client._transport._wrapped_methods[
762
+ self._client._transport.update_framework
763
+ ]
764
+
765
+ # Certain fields should be provided within the metadata header;
766
+ # add these here.
767
+ metadata = tuple(metadata) + (
768
+ gapic_v1.routing_header.to_grpc_metadata(
769
+ (("framework.name", request.framework.name),)
770
+ ),
771
+ )
772
+
773
+ # Validate the universe domain.
774
+ self._client._validate_universe_domain()
775
+
776
+ # Send the request.
777
+ response = await rpc(
778
+ request,
779
+ retry=retry,
780
+ timeout=timeout,
781
+ metadata=metadata,
782
+ )
783
+
784
+ # Done; return the response.
785
+ return response
786
+
787
+ async def delete_framework(
788
+ self,
789
+ request: Optional[Union[config.DeleteFrameworkRequest, dict]] = None,
790
+ *,
791
+ name: Optional[str] = None,
792
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
793
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
794
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
795
+ ) -> None:
796
+ r"""Deletes a single Framework.
797
+
798
+ .. code-block:: python
799
+
800
+ # This snippet has been automatically generated and should be regarded as a
801
+ # code template only.
802
+ # It will require modifications to work:
803
+ # - It may require correct/in-range values for request initialization.
804
+ # - It may require specifying regional endpoints when creating the service
805
+ # client as shown in:
806
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
807
+ from google.cloud import cloudsecuritycompliance_v1
808
+
809
+ async def sample_delete_framework():
810
+ # Create a client
811
+ client = cloudsecuritycompliance_v1.ConfigAsyncClient()
812
+
813
+ # Initialize request argument(s)
814
+ request = cloudsecuritycompliance_v1.DeleteFrameworkRequest(
815
+ name="name_value",
816
+ )
817
+
818
+ # Make the request
819
+ await client.delete_framework(request=request)
820
+
821
+ Args:
822
+ request (Optional[Union[google.cloud.cloudsecuritycompliance_v1.types.DeleteFrameworkRequest, dict]]):
823
+ The request object. Message for deleting a Framework
824
+ name (:class:`str`):
825
+ Required. Name of the resource, in the format
826
+ ``organizations/{organization}/locations/{location}/frameworks/{framework}``.
827
+
828
+ This corresponds to the ``name`` field
829
+ on the ``request`` instance; if ``request`` is provided, this
830
+ should not be set.
831
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
832
+ should be retried.
833
+ timeout (float): The timeout for this request.
834
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
835
+ sent along with the request as metadata. Normally, each value must be of type `str`,
836
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
837
+ be of type `bytes`.
838
+ """
839
+ # Create or coerce a protobuf request object.
840
+ # - Quick check: If we got a request object, we should *not* have
841
+ # gotten any keyword arguments that map to the request.
842
+ flattened_params = [name]
843
+ has_flattened_params = (
844
+ len([param for param in flattened_params if param is not None]) > 0
845
+ )
846
+ if request is not None and has_flattened_params:
847
+ raise ValueError(
848
+ "If the `request` argument is set, then none of "
849
+ "the individual field arguments should be set."
850
+ )
851
+
852
+ # - Use the request object if provided (there's no risk of modifying the input as
853
+ # there are no flattened fields), or create one.
854
+ if not isinstance(request, config.DeleteFrameworkRequest):
855
+ request = config.DeleteFrameworkRequest(request)
856
+
857
+ # If we have keyword arguments corresponding to fields on the
858
+ # request, apply these.
859
+ if name is not None:
860
+ request.name = name
861
+
862
+ # Wrap the RPC method; this adds retry and timeout information,
863
+ # and friendly error handling.
864
+ rpc = self._client._transport._wrapped_methods[
865
+ self._client._transport.delete_framework
866
+ ]
867
+
868
+ # Certain fields should be provided within the metadata header;
869
+ # add these here.
870
+ metadata = tuple(metadata) + (
871
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
872
+ )
873
+
874
+ # Validate the universe domain.
875
+ self._client._validate_universe_domain()
876
+
877
+ # Send the request.
878
+ await rpc(
879
+ request,
880
+ retry=retry,
881
+ timeout=timeout,
882
+ metadata=metadata,
883
+ )
884
+
885
+ async def list_cloud_controls(
886
+ self,
887
+ request: Optional[Union[config.ListCloudControlsRequest, dict]] = None,
888
+ *,
889
+ parent: Optional[str] = None,
890
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
891
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
892
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
893
+ ) -> pagers.ListCloudControlsAsyncPager:
894
+ r"""Lists CloudControls in a given organization.
895
+
896
+ .. code-block:: python
897
+
898
+ # This snippet has been automatically generated and should be regarded as a
899
+ # code template only.
900
+ # It will require modifications to work:
901
+ # - It may require correct/in-range values for request initialization.
902
+ # - It may require specifying regional endpoints when creating the service
903
+ # client as shown in:
904
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
905
+ from google.cloud import cloudsecuritycompliance_v1
906
+
907
+ async def sample_list_cloud_controls():
908
+ # Create a client
909
+ client = cloudsecuritycompliance_v1.ConfigAsyncClient()
910
+
911
+ # Initialize request argument(s)
912
+ request = cloudsecuritycompliance_v1.ListCloudControlsRequest(
913
+ parent="parent_value",
914
+ )
915
+
916
+ # Make the request
917
+ page_result = client.list_cloud_controls(request=request)
918
+
919
+ # Handle the response
920
+ async for response in page_result:
921
+ print(response)
922
+
923
+ Args:
924
+ request (Optional[Union[google.cloud.cloudsecuritycompliance_v1.types.ListCloudControlsRequest, dict]]):
925
+ The request object. Request message for [ListCloudControls][].
926
+ parent (:class:`str`):
927
+ Required. The parent resource name, in the format
928
+ ``organizations/{organization}/locations/{location}``.
929
+
930
+ This corresponds to the ``parent`` field
931
+ on the ``request`` instance; if ``request`` is provided, this
932
+ should not be set.
933
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
934
+ should be retried.
935
+ timeout (float): The timeout for this request.
936
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
937
+ sent along with the request as metadata. Normally, each value must be of type `str`,
938
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
939
+ be of type `bytes`.
940
+
941
+ Returns:
942
+ google.cloud.cloudsecuritycompliance_v1.services.config.pagers.ListCloudControlsAsyncPager:
943
+ Response message for
944
+ ListCloudControls.
945
+ Iterating over this object will yield
946
+ results and resolve additional pages
947
+ automatically.
948
+
949
+ """
950
+ # Create or coerce a protobuf request object.
951
+ # - Quick check: If we got a request object, we should *not* have
952
+ # gotten any keyword arguments that map to the request.
953
+ flattened_params = [parent]
954
+ has_flattened_params = (
955
+ len([param for param in flattened_params if param is not None]) > 0
956
+ )
957
+ if request is not None and has_flattened_params:
958
+ raise ValueError(
959
+ "If the `request` argument is set, then none of "
960
+ "the individual field arguments should be set."
961
+ )
962
+
963
+ # - Use the request object if provided (there's no risk of modifying the input as
964
+ # there are no flattened fields), or create one.
965
+ if not isinstance(request, config.ListCloudControlsRequest):
966
+ request = config.ListCloudControlsRequest(request)
967
+
968
+ # If we have keyword arguments corresponding to fields on the
969
+ # request, apply these.
970
+ if parent is not None:
971
+ request.parent = parent
972
+
973
+ # Wrap the RPC method; this adds retry and timeout information,
974
+ # and friendly error handling.
975
+ rpc = self._client._transport._wrapped_methods[
976
+ self._client._transport.list_cloud_controls
977
+ ]
978
+
979
+ # Certain fields should be provided within the metadata header;
980
+ # add these here.
981
+ metadata = tuple(metadata) + (
982
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
983
+ )
984
+
985
+ # Validate the universe domain.
986
+ self._client._validate_universe_domain()
987
+
988
+ # Send the request.
989
+ response = await rpc(
990
+ request,
991
+ retry=retry,
992
+ timeout=timeout,
993
+ metadata=metadata,
994
+ )
995
+
996
+ # This method is paged; wrap the response in a pager, which provides
997
+ # an `__aiter__` convenience method.
998
+ response = pagers.ListCloudControlsAsyncPager(
999
+ method=rpc,
1000
+ request=request,
1001
+ response=response,
1002
+ retry=retry,
1003
+ timeout=timeout,
1004
+ metadata=metadata,
1005
+ )
1006
+
1007
+ # Done; return the response.
1008
+ return response
1009
+
1010
+ async def get_cloud_control(
1011
+ self,
1012
+ request: Optional[Union[config.GetCloudControlRequest, dict]] = None,
1013
+ *,
1014
+ name: Optional[str] = None,
1015
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1016
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1017
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1018
+ ) -> common.CloudControl:
1019
+ r"""Gets details of a single CloudControl.
1020
+
1021
+ .. code-block:: python
1022
+
1023
+ # This snippet has been automatically generated and should be regarded as a
1024
+ # code template only.
1025
+ # It will require modifications to work:
1026
+ # - It may require correct/in-range values for request initialization.
1027
+ # - It may require specifying regional endpoints when creating the service
1028
+ # client as shown in:
1029
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1030
+ from google.cloud import cloudsecuritycompliance_v1
1031
+
1032
+ async def sample_get_cloud_control():
1033
+ # Create a client
1034
+ client = cloudsecuritycompliance_v1.ConfigAsyncClient()
1035
+
1036
+ # Initialize request argument(s)
1037
+ request = cloudsecuritycompliance_v1.GetCloudControlRequest(
1038
+ name="name_value",
1039
+ )
1040
+
1041
+ # Make the request
1042
+ response = await client.get_cloud_control(request=request)
1043
+
1044
+ # Handle the response
1045
+ print(response)
1046
+
1047
+ Args:
1048
+ request (Optional[Union[google.cloud.cloudsecuritycompliance_v1.types.GetCloudControlRequest, dict]]):
1049
+ The request object. Message for getting a CloudControl.
1050
+ name (:class:`str`):
1051
+ Required. The name of the cloudcontrol to retrieve in
1052
+ the format:
1053
+ organizations/{organization}/locations/{location}/cloudControls/{cloud_control}
1054
+
1055
+ This corresponds to the ``name`` field
1056
+ on the ``request`` instance; if ``request`` is provided, this
1057
+ should not be set.
1058
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1059
+ should be retried.
1060
+ timeout (float): The timeout for this request.
1061
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1062
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1063
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1064
+ be of type `bytes`.
1065
+
1066
+ Returns:
1067
+ google.cloud.cloudsecuritycompliance_v1.types.CloudControl:
1068
+ A CloudControl is a GCP-provided
1069
+ parameterized concept which is used to
1070
+ satisfy a Security or Compliance intent.
1071
+
1072
+ """
1073
+ # Create or coerce a protobuf request object.
1074
+ # - Quick check: If we got a request object, we should *not* have
1075
+ # gotten any keyword arguments that map to the request.
1076
+ flattened_params = [name]
1077
+ has_flattened_params = (
1078
+ len([param for param in flattened_params if param is not None]) > 0
1079
+ )
1080
+ if request is not None and has_flattened_params:
1081
+ raise ValueError(
1082
+ "If the `request` argument is set, then none of "
1083
+ "the individual field arguments should be set."
1084
+ )
1085
+
1086
+ # - Use the request object if provided (there's no risk of modifying the input as
1087
+ # there are no flattened fields), or create one.
1088
+ if not isinstance(request, config.GetCloudControlRequest):
1089
+ request = config.GetCloudControlRequest(request)
1090
+
1091
+ # If we have keyword arguments corresponding to fields on the
1092
+ # request, apply these.
1093
+ if name is not None:
1094
+ request.name = name
1095
+
1096
+ # Wrap the RPC method; this adds retry and timeout information,
1097
+ # and friendly error handling.
1098
+ rpc = self._client._transport._wrapped_methods[
1099
+ self._client._transport.get_cloud_control
1100
+ ]
1101
+
1102
+ # Certain fields should be provided within the metadata header;
1103
+ # add these here.
1104
+ metadata = tuple(metadata) + (
1105
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1106
+ )
1107
+
1108
+ # Validate the universe domain.
1109
+ self._client._validate_universe_domain()
1110
+
1111
+ # Send the request.
1112
+ response = await rpc(
1113
+ request,
1114
+ retry=retry,
1115
+ timeout=timeout,
1116
+ metadata=metadata,
1117
+ )
1118
+
1119
+ # Done; return the response.
1120
+ return response
1121
+
1122
+ async def create_cloud_control(
1123
+ self,
1124
+ request: Optional[Union[config.CreateCloudControlRequest, dict]] = None,
1125
+ *,
1126
+ parent: Optional[str] = None,
1127
+ cloud_control: Optional[common.CloudControl] = None,
1128
+ cloud_control_id: Optional[str] = None,
1129
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1130
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1131
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1132
+ ) -> common.CloudControl:
1133
+ r"""Creates a single CloudControl for a given resource.
1134
+
1135
+ .. code-block:: python
1136
+
1137
+ # This snippet has been automatically generated and should be regarded as a
1138
+ # code template only.
1139
+ # It will require modifications to work:
1140
+ # - It may require correct/in-range values for request initialization.
1141
+ # - It may require specifying regional endpoints when creating the service
1142
+ # client as shown in:
1143
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1144
+ from google.cloud import cloudsecuritycompliance_v1
1145
+
1146
+ async def sample_create_cloud_control():
1147
+ # Create a client
1148
+ client = cloudsecuritycompliance_v1.ConfigAsyncClient()
1149
+
1150
+ # Initialize request argument(s)
1151
+ cloud_control = cloudsecuritycompliance_v1.CloudControl()
1152
+ cloud_control.name = "name_value"
1153
+
1154
+ request = cloudsecuritycompliance_v1.CreateCloudControlRequest(
1155
+ parent="parent_value",
1156
+ cloud_control_id="cloud_control_id_value",
1157
+ cloud_control=cloud_control,
1158
+ )
1159
+
1160
+ # Make the request
1161
+ response = await client.create_cloud_control(request=request)
1162
+
1163
+ # Handle the response
1164
+ print(response)
1165
+
1166
+ Args:
1167
+ request (Optional[Union[google.cloud.cloudsecuritycompliance_v1.types.CreateCloudControlRequest, dict]]):
1168
+ The request object. Message for creating a CloudControl
1169
+ parent (:class:`str`):
1170
+ Required. The parent resource name, in the format
1171
+ ``organizations/{organization}/locations/{location}``.
1172
+
1173
+ This corresponds to the ``parent`` field
1174
+ on the ``request`` instance; if ``request`` is provided, this
1175
+ should not be set.
1176
+ cloud_control (:class:`google.cloud.cloudsecuritycompliance_v1.types.CloudControl`):
1177
+ Required. The resource being created
1178
+ This corresponds to the ``cloud_control`` field
1179
+ on the ``request`` instance; if ``request`` is provided, this
1180
+ should not be set.
1181
+ cloud_control_id (:class:`str`):
1182
+ Required. ID of the CloudControl. This is the last
1183
+ segment of the CloudControl resource name. Format:
1184
+ ``^[a-zA-Z][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]$``.
1185
+
1186
+ This corresponds to the ``cloud_control_id`` field
1187
+ on the ``request`` instance; if ``request`` is provided, this
1188
+ should not be set.
1189
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1190
+ should be retried.
1191
+ timeout (float): The timeout for this request.
1192
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1193
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1194
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1195
+ be of type `bytes`.
1196
+
1197
+ Returns:
1198
+ google.cloud.cloudsecuritycompliance_v1.types.CloudControl:
1199
+ A CloudControl is a GCP-provided
1200
+ parameterized concept which is used to
1201
+ satisfy a Security or Compliance intent.
1202
+
1203
+ """
1204
+ # Create or coerce a protobuf request object.
1205
+ # - Quick check: If we got a request object, we should *not* have
1206
+ # gotten any keyword arguments that map to the request.
1207
+ flattened_params = [parent, cloud_control, cloud_control_id]
1208
+ has_flattened_params = (
1209
+ len([param for param in flattened_params if param is not None]) > 0
1210
+ )
1211
+ if request is not None and has_flattened_params:
1212
+ raise ValueError(
1213
+ "If the `request` argument is set, then none of "
1214
+ "the individual field arguments should be set."
1215
+ )
1216
+
1217
+ # - Use the request object if provided (there's no risk of modifying the input as
1218
+ # there are no flattened fields), or create one.
1219
+ if not isinstance(request, config.CreateCloudControlRequest):
1220
+ request = config.CreateCloudControlRequest(request)
1221
+
1222
+ # If we have keyword arguments corresponding to fields on the
1223
+ # request, apply these.
1224
+ if parent is not None:
1225
+ request.parent = parent
1226
+ if cloud_control is not None:
1227
+ request.cloud_control = cloud_control
1228
+ if cloud_control_id is not None:
1229
+ request.cloud_control_id = cloud_control_id
1230
+
1231
+ # Wrap the RPC method; this adds retry and timeout information,
1232
+ # and friendly error handling.
1233
+ rpc = self._client._transport._wrapped_methods[
1234
+ self._client._transport.create_cloud_control
1235
+ ]
1236
+
1237
+ # Certain fields should be provided within the metadata header;
1238
+ # add these here.
1239
+ metadata = tuple(metadata) + (
1240
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1241
+ )
1242
+
1243
+ # Validate the universe domain.
1244
+ self._client._validate_universe_domain()
1245
+
1246
+ # Send the request.
1247
+ response = await rpc(
1248
+ request,
1249
+ retry=retry,
1250
+ timeout=timeout,
1251
+ metadata=metadata,
1252
+ )
1253
+
1254
+ # Done; return the response.
1255
+ return response
1256
+
1257
+ async def update_cloud_control(
1258
+ self,
1259
+ request: Optional[Union[config.UpdateCloudControlRequest, dict]] = None,
1260
+ *,
1261
+ cloud_control: Optional[common.CloudControl] = None,
1262
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
1263
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1264
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1265
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1266
+ ) -> common.CloudControl:
1267
+ r"""Updates a single CloudControl.
1268
+
1269
+ .. code-block:: python
1270
+
1271
+ # This snippet has been automatically generated and should be regarded as a
1272
+ # code template only.
1273
+ # It will require modifications to work:
1274
+ # - It may require correct/in-range values for request initialization.
1275
+ # - It may require specifying regional endpoints when creating the service
1276
+ # client as shown in:
1277
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1278
+ from google.cloud import cloudsecuritycompliance_v1
1279
+
1280
+ async def sample_update_cloud_control():
1281
+ # Create a client
1282
+ client = cloudsecuritycompliance_v1.ConfigAsyncClient()
1283
+
1284
+ # Initialize request argument(s)
1285
+ cloud_control = cloudsecuritycompliance_v1.CloudControl()
1286
+ cloud_control.name = "name_value"
1287
+
1288
+ request = cloudsecuritycompliance_v1.UpdateCloudControlRequest(
1289
+ cloud_control=cloud_control,
1290
+ )
1291
+
1292
+ # Make the request
1293
+ response = await client.update_cloud_control(request=request)
1294
+
1295
+ # Handle the response
1296
+ print(response)
1297
+
1298
+ Args:
1299
+ request (Optional[Union[google.cloud.cloudsecuritycompliance_v1.types.UpdateCloudControlRequest, dict]]):
1300
+ The request object. Message for updating a CloudControl.
1301
+ cloud_control (:class:`google.cloud.cloudsecuritycompliance_v1.types.CloudControl`):
1302
+ Required. The resource being updated
1303
+ This corresponds to the ``cloud_control`` field
1304
+ on the ``request`` instance; if ``request`` is provided, this
1305
+ should not be set.
1306
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
1307
+ Optional. Field mask is used to specify the fields to be
1308
+ overwritten in the CloudControl resource by the update.
1309
+ The fields specified in the update_mask are relative to
1310
+ the resource, not the full request. A field will be
1311
+ overwritten if it is in the mask. If the user does not
1312
+ provide a mask then all fields present in the request
1313
+ will be overwritten. The fields that can be updated are:
1314
+
1315
+ 1. Display_name
1316
+ 2. Description
1317
+ 3. Parameters
1318
+ 4. Rules
1319
+ 5. ParameterSpec.
1320
+
1321
+ This corresponds to the ``update_mask`` field
1322
+ on the ``request`` instance; if ``request`` is provided, this
1323
+ should not be set.
1324
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1325
+ should be retried.
1326
+ timeout (float): The timeout for this request.
1327
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1328
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1329
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1330
+ be of type `bytes`.
1331
+
1332
+ Returns:
1333
+ google.cloud.cloudsecuritycompliance_v1.types.CloudControl:
1334
+ A CloudControl is a GCP-provided
1335
+ parameterized concept which is used to
1336
+ satisfy a Security or Compliance intent.
1337
+
1338
+ """
1339
+ # Create or coerce a protobuf request object.
1340
+ # - Quick check: If we got a request object, we should *not* have
1341
+ # gotten any keyword arguments that map to the request.
1342
+ flattened_params = [cloud_control, update_mask]
1343
+ has_flattened_params = (
1344
+ len([param for param in flattened_params if param is not None]) > 0
1345
+ )
1346
+ if request is not None and has_flattened_params:
1347
+ raise ValueError(
1348
+ "If the `request` argument is set, then none of "
1349
+ "the individual field arguments should be set."
1350
+ )
1351
+
1352
+ # - Use the request object if provided (there's no risk of modifying the input as
1353
+ # there are no flattened fields), or create one.
1354
+ if not isinstance(request, config.UpdateCloudControlRequest):
1355
+ request = config.UpdateCloudControlRequest(request)
1356
+
1357
+ # If we have keyword arguments corresponding to fields on the
1358
+ # request, apply these.
1359
+ if cloud_control is not None:
1360
+ request.cloud_control = cloud_control
1361
+ if update_mask is not None:
1362
+ request.update_mask = update_mask
1363
+
1364
+ # Wrap the RPC method; this adds retry and timeout information,
1365
+ # and friendly error handling.
1366
+ rpc = self._client._transport._wrapped_methods[
1367
+ self._client._transport.update_cloud_control
1368
+ ]
1369
+
1370
+ # Certain fields should be provided within the metadata header;
1371
+ # add these here.
1372
+ metadata = tuple(metadata) + (
1373
+ gapic_v1.routing_header.to_grpc_metadata(
1374
+ (("cloud_control.name", request.cloud_control.name),)
1375
+ ),
1376
+ )
1377
+
1378
+ # Validate the universe domain.
1379
+ self._client._validate_universe_domain()
1380
+
1381
+ # Send the request.
1382
+ response = await rpc(
1383
+ request,
1384
+ retry=retry,
1385
+ timeout=timeout,
1386
+ metadata=metadata,
1387
+ )
1388
+
1389
+ # Done; return the response.
1390
+ return response
1391
+
1392
+ async def delete_cloud_control(
1393
+ self,
1394
+ request: Optional[Union[config.DeleteCloudControlRequest, dict]] = None,
1395
+ *,
1396
+ name: Optional[str] = None,
1397
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1398
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1399
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1400
+ ) -> None:
1401
+ r"""Deletes a single CloudControl.
1402
+
1403
+ .. code-block:: python
1404
+
1405
+ # This snippet has been automatically generated and should be regarded as a
1406
+ # code template only.
1407
+ # It will require modifications to work:
1408
+ # - It may require correct/in-range values for request initialization.
1409
+ # - It may require specifying regional endpoints when creating the service
1410
+ # client as shown in:
1411
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1412
+ from google.cloud import cloudsecuritycompliance_v1
1413
+
1414
+ async def sample_delete_cloud_control():
1415
+ # Create a client
1416
+ client = cloudsecuritycompliance_v1.ConfigAsyncClient()
1417
+
1418
+ # Initialize request argument(s)
1419
+ request = cloudsecuritycompliance_v1.DeleteCloudControlRequest(
1420
+ name="name_value",
1421
+ )
1422
+
1423
+ # Make the request
1424
+ await client.delete_cloud_control(request=request)
1425
+
1426
+ Args:
1427
+ request (Optional[Union[google.cloud.cloudsecuritycompliance_v1.types.DeleteCloudControlRequest, dict]]):
1428
+ The request object. Message for deleting a CloudControl.
1429
+ name (:class:`str`):
1430
+ Required. Name of the resource, in the format
1431
+ ``organizations/{organization}/locations/{location}/CloudControls/{CloudControl}``.
1432
+
1433
+ This corresponds to the ``name`` field
1434
+ on the ``request`` instance; if ``request`` is provided, this
1435
+ should not be set.
1436
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1437
+ 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
+ """
1444
+ # Create or coerce a protobuf request object.
1445
+ # - Quick check: If we got a request object, we should *not* have
1446
+ # gotten any keyword arguments that map to the request.
1447
+ flattened_params = [name]
1448
+ has_flattened_params = (
1449
+ len([param for param in flattened_params if param is not None]) > 0
1450
+ )
1451
+ if request is not None and has_flattened_params:
1452
+ raise ValueError(
1453
+ "If the `request` argument is set, then none of "
1454
+ "the individual field arguments should be set."
1455
+ )
1456
+
1457
+ # - Use the request object if provided (there's no risk of modifying the input as
1458
+ # there are no flattened fields), or create one.
1459
+ if not isinstance(request, config.DeleteCloudControlRequest):
1460
+ request = config.DeleteCloudControlRequest(request)
1461
+
1462
+ # If we have keyword arguments corresponding to fields on the
1463
+ # request, apply these.
1464
+ if name is not None:
1465
+ request.name = name
1466
+
1467
+ # Wrap the RPC method; this adds retry and timeout information,
1468
+ # and friendly error handling.
1469
+ rpc = self._client._transport._wrapped_methods[
1470
+ self._client._transport.delete_cloud_control
1471
+ ]
1472
+
1473
+ # Certain fields should be provided within the metadata header;
1474
+ # add these here.
1475
+ metadata = tuple(metadata) + (
1476
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1477
+ )
1478
+
1479
+ # Validate the universe domain.
1480
+ self._client._validate_universe_domain()
1481
+
1482
+ # Send the request.
1483
+ await rpc(
1484
+ request,
1485
+ retry=retry,
1486
+ timeout=timeout,
1487
+ metadata=metadata,
1488
+ )
1489
+
1490
+ async def list_operations(
1491
+ self,
1492
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
1493
+ *,
1494
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1495
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1496
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1497
+ ) -> operations_pb2.ListOperationsResponse:
1498
+ r"""Lists operations that match the specified filter in the request.
1499
+
1500
+ Args:
1501
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
1502
+ The request object. Request message for
1503
+ `ListOperations` method.
1504
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1505
+ if any, should be retried.
1506
+ timeout (float): The timeout for this request.
1507
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1508
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1509
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1510
+ be of type `bytes`.
1511
+ Returns:
1512
+ ~.operations_pb2.ListOperationsResponse:
1513
+ Response message for ``ListOperations`` method.
1514
+ """
1515
+ # Create or coerce a protobuf request object.
1516
+ # The request isn't a proto-plus wrapped type,
1517
+ # so it must be constructed via keyword expansion.
1518
+ if isinstance(request, dict):
1519
+ request = operations_pb2.ListOperationsRequest(**request)
1520
+
1521
+ # Wrap the RPC method; this adds retry and timeout information,
1522
+ # and friendly error handling.
1523
+ rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
1524
+
1525
+ # Certain fields should be provided within the metadata header;
1526
+ # add these here.
1527
+ metadata = tuple(metadata) + (
1528
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1529
+ )
1530
+
1531
+ # Validate the universe domain.
1532
+ self._client._validate_universe_domain()
1533
+
1534
+ # Send the request.
1535
+ response = await rpc(
1536
+ request,
1537
+ retry=retry,
1538
+ timeout=timeout,
1539
+ metadata=metadata,
1540
+ )
1541
+
1542
+ # Done; return the response.
1543
+ return response
1544
+
1545
+ async def get_operation(
1546
+ self,
1547
+ request: Optional[operations_pb2.GetOperationRequest] = None,
1548
+ *,
1549
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1550
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1551
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1552
+ ) -> operations_pb2.Operation:
1553
+ r"""Gets the latest state of a long-running operation.
1554
+
1555
+ Args:
1556
+ request (:class:`~.operations_pb2.GetOperationRequest`):
1557
+ The request object. Request message for
1558
+ `GetOperation` method.
1559
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1560
+ if any, should be retried.
1561
+ timeout (float): The timeout for this request.
1562
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1563
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1564
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1565
+ be of type `bytes`.
1566
+ Returns:
1567
+ ~.operations_pb2.Operation:
1568
+ An ``Operation`` object.
1569
+ """
1570
+ # Create or coerce a protobuf request object.
1571
+ # The request isn't a proto-plus wrapped type,
1572
+ # so it must be constructed via keyword expansion.
1573
+ if isinstance(request, dict):
1574
+ request = operations_pb2.GetOperationRequest(**request)
1575
+
1576
+ # Wrap the RPC method; this adds retry and timeout information,
1577
+ # and friendly error handling.
1578
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
1579
+
1580
+ # Certain fields should be provided within the metadata header;
1581
+ # add these here.
1582
+ metadata = tuple(metadata) + (
1583
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1584
+ )
1585
+
1586
+ # Validate the universe domain.
1587
+ self._client._validate_universe_domain()
1588
+
1589
+ # Send the request.
1590
+ response = await rpc(
1591
+ request,
1592
+ retry=retry,
1593
+ timeout=timeout,
1594
+ metadata=metadata,
1595
+ )
1596
+
1597
+ # Done; return the response.
1598
+ return response
1599
+
1600
+ async def delete_operation(
1601
+ self,
1602
+ request: Optional[operations_pb2.DeleteOperationRequest] = None,
1603
+ *,
1604
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1605
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1606
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1607
+ ) -> None:
1608
+ r"""Deletes a long-running operation.
1609
+
1610
+ This method indicates that the client is no longer interested
1611
+ in the operation result. It does not cancel the operation.
1612
+ If the server doesn't support this method, it returns
1613
+ `google.rpc.Code.UNIMPLEMENTED`.
1614
+
1615
+ Args:
1616
+ request (:class:`~.operations_pb2.DeleteOperationRequest`):
1617
+ The request object. Request message for
1618
+ `DeleteOperation` method.
1619
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1620
+ if any, should be retried.
1621
+ timeout (float): The timeout for this request.
1622
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1623
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1624
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1625
+ be of type `bytes`.
1626
+ Returns:
1627
+ None
1628
+ """
1629
+ # Create or coerce a protobuf request object.
1630
+ # The request isn't a proto-plus wrapped type,
1631
+ # so it must be constructed via keyword expansion.
1632
+ if isinstance(request, dict):
1633
+ request = operations_pb2.DeleteOperationRequest(**request)
1634
+
1635
+ # Wrap the RPC method; this adds retry and timeout information,
1636
+ # and friendly error handling.
1637
+ rpc = self.transport._wrapped_methods[self._client._transport.delete_operation]
1638
+
1639
+ # Certain fields should be provided within the metadata header;
1640
+ # add these here.
1641
+ metadata = tuple(metadata) + (
1642
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1643
+ )
1644
+
1645
+ # Validate the universe domain.
1646
+ self._client._validate_universe_domain()
1647
+
1648
+ # Send the request.
1649
+ await rpc(
1650
+ request,
1651
+ retry=retry,
1652
+ timeout=timeout,
1653
+ metadata=metadata,
1654
+ )
1655
+
1656
+ async def cancel_operation(
1657
+ self,
1658
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
1659
+ *,
1660
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1661
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1662
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1663
+ ) -> None:
1664
+ r"""Starts asynchronous cancellation on a long-running operation.
1665
+
1666
+ The server makes a best effort to cancel the operation, but success
1667
+ is not guaranteed. If the server doesn't support this method, it returns
1668
+ `google.rpc.Code.UNIMPLEMENTED`.
1669
+
1670
+ Args:
1671
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
1672
+ The request object. Request message for
1673
+ `CancelOperation` method.
1674
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1675
+ if any, should be retried.
1676
+ timeout (float): The timeout for this request.
1677
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1678
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1679
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1680
+ be of type `bytes`.
1681
+ Returns:
1682
+ None
1683
+ """
1684
+ # Create or coerce a protobuf request object.
1685
+ # The request isn't a proto-plus wrapped type,
1686
+ # so it must be constructed via keyword expansion.
1687
+ if isinstance(request, dict):
1688
+ request = operations_pb2.CancelOperationRequest(**request)
1689
+
1690
+ # Wrap the RPC method; this adds retry and timeout information,
1691
+ # and friendly error handling.
1692
+ rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
1693
+
1694
+ # Certain fields should be provided within the metadata header;
1695
+ # add these here.
1696
+ metadata = tuple(metadata) + (
1697
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1698
+ )
1699
+
1700
+ # Validate the universe domain.
1701
+ self._client._validate_universe_domain()
1702
+
1703
+ # Send the request.
1704
+ await rpc(
1705
+ request,
1706
+ retry=retry,
1707
+ timeout=timeout,
1708
+ metadata=metadata,
1709
+ )
1710
+
1711
+ async def get_location(
1712
+ self,
1713
+ request: Optional[locations_pb2.GetLocationRequest] = None,
1714
+ *,
1715
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1716
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1717
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1718
+ ) -> locations_pb2.Location:
1719
+ r"""Gets information about a location.
1720
+
1721
+ Args:
1722
+ request (:class:`~.location_pb2.GetLocationRequest`):
1723
+ The request object. Request message for
1724
+ `GetLocation` method.
1725
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1726
+ if any, should be retried.
1727
+ timeout (float): The timeout for this request.
1728
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1729
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1730
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1731
+ be of type `bytes`.
1732
+ Returns:
1733
+ ~.location_pb2.Location:
1734
+ Location object.
1735
+ """
1736
+ # Create or coerce a protobuf request object.
1737
+ # The request isn't a proto-plus wrapped type,
1738
+ # so it must be constructed via keyword expansion.
1739
+ if isinstance(request, dict):
1740
+ request = locations_pb2.GetLocationRequest(**request)
1741
+
1742
+ # Wrap the RPC method; this adds retry and timeout information,
1743
+ # and friendly error handling.
1744
+ rpc = self.transport._wrapped_methods[self._client._transport.get_location]
1745
+
1746
+ # Certain fields should be provided within the metadata header;
1747
+ # add these here.
1748
+ metadata = tuple(metadata) + (
1749
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1750
+ )
1751
+
1752
+ # Validate the universe domain.
1753
+ self._client._validate_universe_domain()
1754
+
1755
+ # Send the request.
1756
+ response = await rpc(
1757
+ request,
1758
+ retry=retry,
1759
+ timeout=timeout,
1760
+ metadata=metadata,
1761
+ )
1762
+
1763
+ # Done; return the response.
1764
+ return response
1765
+
1766
+ async def list_locations(
1767
+ self,
1768
+ request: Optional[locations_pb2.ListLocationsRequest] = None,
1769
+ *,
1770
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1771
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1772
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1773
+ ) -> locations_pb2.ListLocationsResponse:
1774
+ r"""Lists information about the supported locations for this service.
1775
+
1776
+ Args:
1777
+ request (:class:`~.location_pb2.ListLocationsRequest`):
1778
+ The request object. Request message for
1779
+ `ListLocations` method.
1780
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1781
+ if any, should be retried.
1782
+ timeout (float): The timeout for this request.
1783
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1784
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1785
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1786
+ be of type `bytes`.
1787
+ Returns:
1788
+ ~.location_pb2.ListLocationsResponse:
1789
+ Response message for ``ListLocations`` method.
1790
+ """
1791
+ # Create or coerce a protobuf request object.
1792
+ # The request isn't a proto-plus wrapped type,
1793
+ # so it must be constructed via keyword expansion.
1794
+ if isinstance(request, dict):
1795
+ request = locations_pb2.ListLocationsRequest(**request)
1796
+
1797
+ # Wrap the RPC method; this adds retry and timeout information,
1798
+ # and friendly error handling.
1799
+ rpc = self.transport._wrapped_methods[self._client._transport.list_locations]
1800
+
1801
+ # Certain fields should be provided within the metadata header;
1802
+ # add these here.
1803
+ metadata = tuple(metadata) + (
1804
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1805
+ )
1806
+
1807
+ # Validate the universe domain.
1808
+ self._client._validate_universe_domain()
1809
+
1810
+ # Send the request.
1811
+ response = await rpc(
1812
+ request,
1813
+ retry=retry,
1814
+ timeout=timeout,
1815
+ metadata=metadata,
1816
+ )
1817
+
1818
+ # Done; return the response.
1819
+ return response
1820
+
1821
+ async def __aenter__(self) -> "ConfigAsyncClient":
1822
+ return self
1823
+
1824
+ async def __aexit__(self, exc_type, exc, tb):
1825
+ await self.transport.close()
1826
+
1827
+
1828
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1829
+ gapic_version=package_version.__version__
1830
+ )
1831
+
1832
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1833
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1834
+
1835
+
1836
+ __all__ = ("ConfigAsyncClient",)