google-cloud-cloudcontrolspartner 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 (76) hide show
  1. google/cloud/cloudcontrolspartner/__init__.py +115 -0
  2. google/cloud/cloudcontrolspartner/gapic_version.py +16 -0
  3. google/cloud/cloudcontrolspartner/py.typed +2 -0
  4. google/cloud/cloudcontrolspartner_v1/__init__.py +103 -0
  5. google/cloud/cloudcontrolspartner_v1/gapic_metadata.json +197 -0
  6. google/cloud/cloudcontrolspartner_v1/gapic_version.py +16 -0
  7. google/cloud/cloudcontrolspartner_v1/py.typed +2 -0
  8. google/cloud/cloudcontrolspartner_v1/services/__init__.py +15 -0
  9. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_core/__init__.py +22 -0
  10. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_core/async_client.py +1253 -0
  11. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_core/client.py +1705 -0
  12. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_core/pagers.py +429 -0
  13. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_core/transports/__init__.py +41 -0
  14. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_core/transports/base.py +340 -0
  15. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_core/transports/grpc.py +466 -0
  16. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_core/transports/grpc_asyncio.py +472 -0
  17. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_core/transports/rest.py +1212 -0
  18. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_monitoring/__init__.py +22 -0
  19. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_monitoring/async_client.py +528 -0
  20. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_monitoring/client.py +935 -0
  21. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_monitoring/pagers.py +155 -0
  22. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_monitoring/transports/__init__.py +41 -0
  23. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_monitoring/transports/base.py +194 -0
  24. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_monitoring/transports/grpc.py +300 -0
  25. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_monitoring/transports/grpc_asyncio.py +299 -0
  26. google/cloud/cloudcontrolspartner_v1/services/cloud_controls_partner_monitoring/transports/rest.py +434 -0
  27. google/cloud/cloudcontrolspartner_v1/types/__init__.py +82 -0
  28. google/cloud/cloudcontrolspartner_v1/types/access_approval_requests.py +228 -0
  29. google/cloud/cloudcontrolspartner_v1/types/completion_state.py +53 -0
  30. google/cloud/cloudcontrolspartner_v1/types/core.py +93 -0
  31. google/cloud/cloudcontrolspartner_v1/types/customer_workloads.py +300 -0
  32. google/cloud/cloudcontrolspartner_v1/types/customers.py +233 -0
  33. google/cloud/cloudcontrolspartner_v1/types/ekm_connections.py +141 -0
  34. google/cloud/cloudcontrolspartner_v1/types/monitoring.py +24 -0
  35. google/cloud/cloudcontrolspartner_v1/types/partner_permissions.py +94 -0
  36. google/cloud/cloudcontrolspartner_v1/types/partners.py +188 -0
  37. google/cloud/cloudcontrolspartner_v1/types/violations.py +388 -0
  38. google/cloud/cloudcontrolspartner_v1beta/__init__.py +103 -0
  39. google/cloud/cloudcontrolspartner_v1beta/gapic_metadata.json +197 -0
  40. google/cloud/cloudcontrolspartner_v1beta/gapic_version.py +16 -0
  41. google/cloud/cloudcontrolspartner_v1beta/py.typed +2 -0
  42. google/cloud/cloudcontrolspartner_v1beta/services/__init__.py +15 -0
  43. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_core/__init__.py +22 -0
  44. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_core/async_client.py +1262 -0
  45. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_core/client.py +1714 -0
  46. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_core/pagers.py +429 -0
  47. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_core/transports/__init__.py +41 -0
  48. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_core/transports/base.py +340 -0
  49. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_core/transports/grpc.py +466 -0
  50. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_core/transports/grpc_asyncio.py +472 -0
  51. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_core/transports/rest.py +1212 -0
  52. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_monitoring/__init__.py +22 -0
  53. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_monitoring/async_client.py +530 -0
  54. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_monitoring/client.py +937 -0
  55. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_monitoring/pagers.py +155 -0
  56. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_monitoring/transports/__init__.py +41 -0
  57. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_monitoring/transports/base.py +194 -0
  58. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_monitoring/transports/grpc.py +300 -0
  59. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_monitoring/transports/grpc_asyncio.py +299 -0
  60. google/cloud/cloudcontrolspartner_v1beta/services/cloud_controls_partner_monitoring/transports/rest.py +434 -0
  61. google/cloud/cloudcontrolspartner_v1beta/types/__init__.py +82 -0
  62. google/cloud/cloudcontrolspartner_v1beta/types/access_approval_requests.py +230 -0
  63. google/cloud/cloudcontrolspartner_v1beta/types/completion_state.py +53 -0
  64. google/cloud/cloudcontrolspartner_v1beta/types/core.py +93 -0
  65. google/cloud/cloudcontrolspartner_v1beta/types/customer_workloads.py +304 -0
  66. google/cloud/cloudcontrolspartner_v1beta/types/customers.py +236 -0
  67. google/cloud/cloudcontrolspartner_v1beta/types/ekm_connections.py +143 -0
  68. google/cloud/cloudcontrolspartner_v1beta/types/monitoring.py +24 -0
  69. google/cloud/cloudcontrolspartner_v1beta/types/partner_permissions.py +96 -0
  70. google/cloud/cloudcontrolspartner_v1beta/types/partners.py +189 -0
  71. google/cloud/cloudcontrolspartner_v1beta/types/violations.py +391 -0
  72. google_cloud_cloudcontrolspartner-0.1.0.dist-info/LICENSE +202 -0
  73. google_cloud_cloudcontrolspartner-0.1.0.dist-info/METADATA +137 -0
  74. google_cloud_cloudcontrolspartner-0.1.0.dist-info/RECORD +76 -0
  75. google_cloud_cloudcontrolspartner-0.1.0.dist-info/WHEEL +5 -0
  76. google_cloud_cloudcontrolspartner-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1262 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2023 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 functools
18
+ import re
19
+ from typing import (
20
+ Dict,
21
+ Mapping,
22
+ MutableMapping,
23
+ MutableSequence,
24
+ Optional,
25
+ Sequence,
26
+ Tuple,
27
+ Type,
28
+ Union,
29
+ )
30
+
31
+ from google.api_core import exceptions as core_exceptions
32
+ from google.api_core import gapic_v1
33
+ from google.api_core import retry_async as retries
34
+ from google.api_core.client_options import ClientOptions
35
+ from google.auth import credentials as ga_credentials # type: ignore
36
+ from google.oauth2 import service_account # type: ignore
37
+
38
+ from google.cloud.cloudcontrolspartner_v1beta import gapic_version as package_version
39
+
40
+ try:
41
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
42
+ except AttributeError: # pragma: NO COVER
43
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
44
+
45
+ from google.protobuf import timestamp_pb2 # type: ignore
46
+
47
+ from google.cloud.cloudcontrolspartner_v1beta.services.cloud_controls_partner_core import (
48
+ pagers,
49
+ )
50
+ from google.cloud.cloudcontrolspartner_v1beta.types import (
51
+ access_approval_requests,
52
+ customer_workloads,
53
+ customers,
54
+ ekm_connections,
55
+ partner_permissions,
56
+ partners,
57
+ )
58
+
59
+ from .client import CloudControlsPartnerCoreClient
60
+ from .transports.base import DEFAULT_CLIENT_INFO, CloudControlsPartnerCoreTransport
61
+ from .transports.grpc_asyncio import CloudControlsPartnerCoreGrpcAsyncIOTransport
62
+
63
+
64
+ class CloudControlsPartnerCoreAsyncClient:
65
+ """Service describing handlers for resources"""
66
+
67
+ _client: CloudControlsPartnerCoreClient
68
+
69
+ # Copy defaults from the synchronous client for use here.
70
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
71
+ DEFAULT_ENDPOINT = CloudControlsPartnerCoreClient.DEFAULT_ENDPOINT
72
+ DEFAULT_MTLS_ENDPOINT = CloudControlsPartnerCoreClient.DEFAULT_MTLS_ENDPOINT
73
+ _DEFAULT_ENDPOINT_TEMPLATE = (
74
+ CloudControlsPartnerCoreClient._DEFAULT_ENDPOINT_TEMPLATE
75
+ )
76
+ _DEFAULT_UNIVERSE = CloudControlsPartnerCoreClient._DEFAULT_UNIVERSE
77
+
78
+ access_approval_request_path = staticmethod(
79
+ CloudControlsPartnerCoreClient.access_approval_request_path
80
+ )
81
+ parse_access_approval_request_path = staticmethod(
82
+ CloudControlsPartnerCoreClient.parse_access_approval_request_path
83
+ )
84
+ customer_path = staticmethod(CloudControlsPartnerCoreClient.customer_path)
85
+ parse_customer_path = staticmethod(
86
+ CloudControlsPartnerCoreClient.parse_customer_path
87
+ )
88
+ ekm_connections_path = staticmethod(
89
+ CloudControlsPartnerCoreClient.ekm_connections_path
90
+ )
91
+ parse_ekm_connections_path = staticmethod(
92
+ CloudControlsPartnerCoreClient.parse_ekm_connections_path
93
+ )
94
+ partner_path = staticmethod(CloudControlsPartnerCoreClient.partner_path)
95
+ parse_partner_path = staticmethod(CloudControlsPartnerCoreClient.parse_partner_path)
96
+ partner_permissions_path = staticmethod(
97
+ CloudControlsPartnerCoreClient.partner_permissions_path
98
+ )
99
+ parse_partner_permissions_path = staticmethod(
100
+ CloudControlsPartnerCoreClient.parse_partner_permissions_path
101
+ )
102
+ workload_path = staticmethod(CloudControlsPartnerCoreClient.workload_path)
103
+ parse_workload_path = staticmethod(
104
+ CloudControlsPartnerCoreClient.parse_workload_path
105
+ )
106
+ common_billing_account_path = staticmethod(
107
+ CloudControlsPartnerCoreClient.common_billing_account_path
108
+ )
109
+ parse_common_billing_account_path = staticmethod(
110
+ CloudControlsPartnerCoreClient.parse_common_billing_account_path
111
+ )
112
+ common_folder_path = staticmethod(CloudControlsPartnerCoreClient.common_folder_path)
113
+ parse_common_folder_path = staticmethod(
114
+ CloudControlsPartnerCoreClient.parse_common_folder_path
115
+ )
116
+ common_organization_path = staticmethod(
117
+ CloudControlsPartnerCoreClient.common_organization_path
118
+ )
119
+ parse_common_organization_path = staticmethod(
120
+ CloudControlsPartnerCoreClient.parse_common_organization_path
121
+ )
122
+ common_project_path = staticmethod(
123
+ CloudControlsPartnerCoreClient.common_project_path
124
+ )
125
+ parse_common_project_path = staticmethod(
126
+ CloudControlsPartnerCoreClient.parse_common_project_path
127
+ )
128
+ common_location_path = staticmethod(
129
+ CloudControlsPartnerCoreClient.common_location_path
130
+ )
131
+ parse_common_location_path = staticmethod(
132
+ CloudControlsPartnerCoreClient.parse_common_location_path
133
+ )
134
+
135
+ @classmethod
136
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
137
+ """Creates an instance of this client using the provided credentials
138
+ info.
139
+
140
+ Args:
141
+ info (dict): The service account private key info.
142
+ args: Additional arguments to pass to the constructor.
143
+ kwargs: Additional arguments to pass to the constructor.
144
+
145
+ Returns:
146
+ CloudControlsPartnerCoreAsyncClient: The constructed client.
147
+ """
148
+ return CloudControlsPartnerCoreClient.from_service_account_info.__func__(CloudControlsPartnerCoreAsyncClient, info, *args, **kwargs) # type: ignore
149
+
150
+ @classmethod
151
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
152
+ """Creates an instance of this client using the provided credentials
153
+ file.
154
+
155
+ Args:
156
+ filename (str): The path to the service account private key json
157
+ file.
158
+ args: Additional arguments to pass to the constructor.
159
+ kwargs: Additional arguments to pass to the constructor.
160
+
161
+ Returns:
162
+ CloudControlsPartnerCoreAsyncClient: The constructed client.
163
+ """
164
+ return CloudControlsPartnerCoreClient.from_service_account_file.__func__(CloudControlsPartnerCoreAsyncClient, filename, *args, **kwargs) # type: ignore
165
+
166
+ from_service_account_json = from_service_account_file
167
+
168
+ @classmethod
169
+ def get_mtls_endpoint_and_cert_source(
170
+ cls, client_options: Optional[ClientOptions] = None
171
+ ):
172
+ """Return the API endpoint and client cert source for mutual TLS.
173
+
174
+ The client cert source is determined in the following order:
175
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
176
+ client cert source is None.
177
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
178
+ default client cert source exists, use the default one; otherwise the client cert
179
+ source is None.
180
+
181
+ The API endpoint is determined in the following order:
182
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
183
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
184
+ default mTLS endpoint; if the environment variable is "never", use the default API
185
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
186
+ use the default API endpoint.
187
+
188
+ More details can be found at https://google.aip.dev/auth/4114.
189
+
190
+ Args:
191
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
192
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
193
+ in this method.
194
+
195
+ Returns:
196
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
197
+ client cert source to use.
198
+
199
+ Raises:
200
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
201
+ """
202
+ return CloudControlsPartnerCoreClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
203
+
204
+ @property
205
+ def transport(self) -> CloudControlsPartnerCoreTransport:
206
+ """Returns the transport used by the client instance.
207
+
208
+ Returns:
209
+ CloudControlsPartnerCoreTransport: The transport used by the client instance.
210
+ """
211
+ return self._client.transport
212
+
213
+ @property
214
+ def api_endpoint(self):
215
+ """Return the API endpoint used by the client instance.
216
+
217
+ Returns:
218
+ str: The API endpoint used by the client instance.
219
+ """
220
+ return self._client._api_endpoint
221
+
222
+ @property
223
+ def universe_domain(self) -> str:
224
+ """Return the universe domain used by the client instance.
225
+
226
+ Returns:
227
+ str: The universe domain used
228
+ by the client instance.
229
+ """
230
+ return self._client._universe_domain
231
+
232
+ get_transport_class = functools.partial(
233
+ type(CloudControlsPartnerCoreClient).get_transport_class,
234
+ type(CloudControlsPartnerCoreClient),
235
+ )
236
+
237
+ def __init__(
238
+ self,
239
+ *,
240
+ credentials: Optional[ga_credentials.Credentials] = None,
241
+ transport: Union[str, CloudControlsPartnerCoreTransport] = "grpc_asyncio",
242
+ client_options: Optional[ClientOptions] = None,
243
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
244
+ ) -> None:
245
+ """Instantiates the cloud controls partner core async client.
246
+
247
+ Args:
248
+ credentials (Optional[google.auth.credentials.Credentials]): The
249
+ authorization credentials to attach to requests. These
250
+ credentials identify the application to the service; if none
251
+ are specified, the client will attempt to ascertain the
252
+ credentials from the environment.
253
+ transport (Union[str, ~.CloudControlsPartnerCoreTransport]): The
254
+ transport to use. If set to None, a transport is chosen
255
+ automatically.
256
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
257
+ Custom options for the client.
258
+
259
+ 1. The ``api_endpoint`` property can be used to override the
260
+ default endpoint provided by the client when ``transport`` is
261
+ not explicitly provided. Only if this property is not set and
262
+ ``transport`` was not explicitly provided, the endpoint is
263
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
264
+ variable, which have one of the following values:
265
+ "always" (always use the default mTLS endpoint), "never" (always
266
+ use the default regular endpoint) and "auto" (auto-switch to the
267
+ default mTLS endpoint if client certificate is present; this is
268
+ the default value).
269
+
270
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
271
+ is "true", then the ``client_cert_source`` property can be used
272
+ to provide a client certificate for mTLS transport. If
273
+ not provided, the default SSL client certificate will be used if
274
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
275
+ set, no client certificate will be used.
276
+
277
+ 3. The ``universe_domain`` property can be used to override the
278
+ default "googleapis.com" universe. Note that ``api_endpoint``
279
+ property still takes precedence; and ``universe_domain`` is
280
+ currently not supported for mTLS.
281
+
282
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
283
+ The client info used to send a user-agent string along with
284
+ API requests. If ``None``, then default info will be used.
285
+ Generally, you only need to set this if you're developing
286
+ your own client library.
287
+
288
+ Raises:
289
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
290
+ creation failed for any reason.
291
+ """
292
+ self._client = CloudControlsPartnerCoreClient(
293
+ credentials=credentials,
294
+ transport=transport,
295
+ client_options=client_options,
296
+ client_info=client_info,
297
+ )
298
+
299
+ async def get_workload(
300
+ self,
301
+ request: Optional[Union[customer_workloads.GetWorkloadRequest, dict]] = None,
302
+ *,
303
+ name: Optional[str] = None,
304
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
305
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
306
+ metadata: Sequence[Tuple[str, str]] = (),
307
+ ) -> customer_workloads.Workload:
308
+ r"""Gets details of a single workload
309
+
310
+ .. code-block:: python
311
+
312
+ # This snippet has been automatically generated and should be regarded as a
313
+ # code template only.
314
+ # It will require modifications to work:
315
+ # - It may require correct/in-range values for request initialization.
316
+ # - It may require specifying regional endpoints when creating the service
317
+ # client as shown in:
318
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
319
+ from google.cloud import cloudcontrolspartner_v1beta
320
+
321
+ async def sample_get_workload():
322
+ # Create a client
323
+ client = cloudcontrolspartner_v1beta.CloudControlsPartnerCoreAsyncClient()
324
+
325
+ # Initialize request argument(s)
326
+ request = cloudcontrolspartner_v1beta.GetWorkloadRequest(
327
+ name="name_value",
328
+ )
329
+
330
+ # Make the request
331
+ response = await client.get_workload(request=request)
332
+
333
+ # Handle the response
334
+ print(response)
335
+
336
+ Args:
337
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1beta.types.GetWorkloadRequest, dict]]):
338
+ The request object. Message for getting a customer
339
+ workload.
340
+ name (:class:`str`):
341
+ Required. Format:
342
+
343
+ organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}
344
+
345
+ This corresponds to the ``name`` field
346
+ on the ``request`` instance; if ``request`` is provided, this
347
+ should not be set.
348
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
349
+ should be retried.
350
+ timeout (float): The timeout for this request.
351
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
352
+ sent along with the request as metadata.
353
+
354
+ Returns:
355
+ google.cloud.cloudcontrolspartner_v1beta.types.Workload:
356
+ Contains metadata around the [Workload
357
+ resource](\ https://cloud.google.com/assured-workloads/docs/reference/rest/Shared.Types/Workload)
358
+ in the Assured Workloads API.
359
+
360
+ """
361
+ # Create or coerce a protobuf request object.
362
+ # Quick check: If we got a request object, we should *not* have
363
+ # gotten any keyword arguments that map to the request.
364
+ has_flattened_params = any([name])
365
+ if request is not None and has_flattened_params:
366
+ raise ValueError(
367
+ "If the `request` argument is set, then none of "
368
+ "the individual field arguments should be set."
369
+ )
370
+
371
+ request = customer_workloads.GetWorkloadRequest(request)
372
+
373
+ # If we have keyword arguments corresponding to fields on the
374
+ # request, apply these.
375
+ if name is not None:
376
+ request.name = name
377
+
378
+ # Wrap the RPC method; this adds retry and timeout information,
379
+ # and friendly error handling.
380
+ rpc = gapic_v1.method_async.wrap_method(
381
+ self._client._transport.get_workload,
382
+ default_retry=retries.AsyncRetry(
383
+ initial=1.0,
384
+ maximum=10.0,
385
+ multiplier=1.3,
386
+ predicate=retries.if_exception_type(
387
+ core_exceptions.ServiceUnavailable,
388
+ ),
389
+ deadline=60.0,
390
+ ),
391
+ default_timeout=60.0,
392
+ client_info=DEFAULT_CLIENT_INFO,
393
+ )
394
+
395
+ # Certain fields should be provided within the metadata header;
396
+ # add these here.
397
+ metadata = tuple(metadata) + (
398
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
399
+ )
400
+
401
+ # Validate the universe domain.
402
+ self._client._validate_universe_domain()
403
+
404
+ # Send the request.
405
+ response = await rpc(
406
+ request,
407
+ retry=retry,
408
+ timeout=timeout,
409
+ metadata=metadata,
410
+ )
411
+
412
+ # Done; return the response.
413
+ return response
414
+
415
+ async def list_workloads(
416
+ self,
417
+ request: Optional[Union[customer_workloads.ListWorkloadsRequest, dict]] = None,
418
+ *,
419
+ parent: Optional[str] = None,
420
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
421
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
422
+ metadata: Sequence[Tuple[str, str]] = (),
423
+ ) -> pagers.ListWorkloadsAsyncPager:
424
+ r"""Lists customer workloads for a given customer org id
425
+
426
+ .. code-block:: python
427
+
428
+ # This snippet has been automatically generated and should be regarded as a
429
+ # code template only.
430
+ # It will require modifications to work:
431
+ # - It may require correct/in-range values for request initialization.
432
+ # - It may require specifying regional endpoints when creating the service
433
+ # client as shown in:
434
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
435
+ from google.cloud import cloudcontrolspartner_v1beta
436
+
437
+ async def sample_list_workloads():
438
+ # Create a client
439
+ client = cloudcontrolspartner_v1beta.CloudControlsPartnerCoreAsyncClient()
440
+
441
+ # Initialize request argument(s)
442
+ request = cloudcontrolspartner_v1beta.ListWorkloadsRequest(
443
+ parent="parent_value",
444
+ )
445
+
446
+ # Make the request
447
+ page_result = client.list_workloads(request=request)
448
+
449
+ # Handle the response
450
+ async for response in page_result:
451
+ print(response)
452
+
453
+ Args:
454
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1beta.types.ListWorkloadsRequest, dict]]):
455
+ The request object. Request to list customer workloads.
456
+ parent (:class:`str`):
457
+ Required. Parent resource
458
+ Format:
459
+
460
+ organizations/{organization}/locations/{location}/customers/{customer}
461
+
462
+ This corresponds to the ``parent`` field
463
+ on the ``request`` instance; if ``request`` is provided, this
464
+ should not be set.
465
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
466
+ should be retried.
467
+ timeout (float): The timeout for this request.
468
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
469
+ sent along with the request as metadata.
470
+
471
+ Returns:
472
+ google.cloud.cloudcontrolspartner_v1beta.services.cloud_controls_partner_core.pagers.ListWorkloadsAsyncPager:
473
+ Response message for list customer
474
+ workloads requests.
475
+ Iterating over this object will yield
476
+ results and resolve additional pages
477
+ automatically.
478
+
479
+ """
480
+ # Create or coerce a protobuf request object.
481
+ # Quick check: If we got a request object, we should *not* have
482
+ # gotten any keyword arguments that map to the request.
483
+ has_flattened_params = any([parent])
484
+ if request is not None and has_flattened_params:
485
+ raise ValueError(
486
+ "If the `request` argument is set, then none of "
487
+ "the individual field arguments should be set."
488
+ )
489
+
490
+ request = customer_workloads.ListWorkloadsRequest(request)
491
+
492
+ # If we have keyword arguments corresponding to fields on the
493
+ # request, apply these.
494
+ if parent is not None:
495
+ request.parent = parent
496
+
497
+ # Wrap the RPC method; this adds retry and timeout information,
498
+ # and friendly error handling.
499
+ rpc = gapic_v1.method_async.wrap_method(
500
+ self._client._transport.list_workloads,
501
+ default_retry=retries.AsyncRetry(
502
+ initial=1.0,
503
+ maximum=10.0,
504
+ multiplier=1.3,
505
+ predicate=retries.if_exception_type(
506
+ core_exceptions.ServiceUnavailable,
507
+ ),
508
+ deadline=60.0,
509
+ ),
510
+ default_timeout=60.0,
511
+ client_info=DEFAULT_CLIENT_INFO,
512
+ )
513
+
514
+ # Certain fields should be provided within the metadata header;
515
+ # add these here.
516
+ metadata = tuple(metadata) + (
517
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
518
+ )
519
+
520
+ # Validate the universe domain.
521
+ self._client._validate_universe_domain()
522
+
523
+ # Send the request.
524
+ response = await rpc(
525
+ request,
526
+ retry=retry,
527
+ timeout=timeout,
528
+ metadata=metadata,
529
+ )
530
+
531
+ # This method is paged; wrap the response in a pager, which provides
532
+ # an `__aiter__` convenience method.
533
+ response = pagers.ListWorkloadsAsyncPager(
534
+ method=rpc,
535
+ request=request,
536
+ response=response,
537
+ metadata=metadata,
538
+ )
539
+
540
+ # Done; return the response.
541
+ return response
542
+
543
+ async def get_customer(
544
+ self,
545
+ request: Optional[Union[customers.GetCustomerRequest, dict]] = None,
546
+ *,
547
+ name: Optional[str] = None,
548
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
549
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
550
+ metadata: Sequence[Tuple[str, str]] = (),
551
+ ) -> customers.Customer:
552
+ r"""Gets details of a single customer
553
+
554
+ .. code-block:: python
555
+
556
+ # This snippet has been automatically generated and should be regarded as a
557
+ # code template only.
558
+ # It will require modifications to work:
559
+ # - It may require correct/in-range values for request initialization.
560
+ # - It may require specifying regional endpoints when creating the service
561
+ # client as shown in:
562
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
563
+ from google.cloud import cloudcontrolspartner_v1beta
564
+
565
+ async def sample_get_customer():
566
+ # Create a client
567
+ client = cloudcontrolspartner_v1beta.CloudControlsPartnerCoreAsyncClient()
568
+
569
+ # Initialize request argument(s)
570
+ request = cloudcontrolspartner_v1beta.GetCustomerRequest(
571
+ name="name_value",
572
+ )
573
+
574
+ # Make the request
575
+ response = await client.get_customer(request=request)
576
+
577
+ # Handle the response
578
+ print(response)
579
+
580
+ Args:
581
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1beta.types.GetCustomerRequest, dict]]):
582
+ The request object. Message for getting a customer
583
+ name (:class:`str`):
584
+ Required. Format:
585
+
586
+ organizations/{organization}/locations/{location}/customers/{customer}
587
+
588
+ This corresponds to the ``name`` field
589
+ on the ``request`` instance; if ``request`` is provided, this
590
+ should not be set.
591
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
592
+ should be retried.
593
+ timeout (float): The timeout for this request.
594
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
595
+ sent along with the request as metadata.
596
+
597
+ Returns:
598
+ google.cloud.cloudcontrolspartner_v1beta.types.Customer:
599
+ Contains metadata around a Cloud
600
+ Controls Partner Customer
601
+
602
+ """
603
+ # Create or coerce a protobuf request object.
604
+ # Quick check: If we got a request object, we should *not* have
605
+ # gotten any keyword arguments that map to the request.
606
+ has_flattened_params = any([name])
607
+ if request is not None and has_flattened_params:
608
+ raise ValueError(
609
+ "If the `request` argument is set, then none of "
610
+ "the individual field arguments should be set."
611
+ )
612
+
613
+ request = customers.GetCustomerRequest(request)
614
+
615
+ # If we have keyword arguments corresponding to fields on the
616
+ # request, apply these.
617
+ if name is not None:
618
+ request.name = name
619
+
620
+ # Wrap the RPC method; this adds retry and timeout information,
621
+ # and friendly error handling.
622
+ rpc = gapic_v1.method_async.wrap_method(
623
+ self._client._transport.get_customer,
624
+ default_retry=retries.AsyncRetry(
625
+ initial=1.0,
626
+ maximum=10.0,
627
+ multiplier=1.3,
628
+ predicate=retries.if_exception_type(
629
+ core_exceptions.ServiceUnavailable,
630
+ ),
631
+ deadline=60.0,
632
+ ),
633
+ default_timeout=60.0,
634
+ client_info=DEFAULT_CLIENT_INFO,
635
+ )
636
+
637
+ # Certain fields should be provided within the metadata header;
638
+ # add these here.
639
+ metadata = tuple(metadata) + (
640
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
641
+ )
642
+
643
+ # Validate the universe domain.
644
+ self._client._validate_universe_domain()
645
+
646
+ # Send the request.
647
+ response = await rpc(
648
+ request,
649
+ retry=retry,
650
+ timeout=timeout,
651
+ metadata=metadata,
652
+ )
653
+
654
+ # Done; return the response.
655
+ return response
656
+
657
+ async def list_customers(
658
+ self,
659
+ request: Optional[Union[customers.ListCustomersRequest, dict]] = None,
660
+ *,
661
+ parent: Optional[str] = None,
662
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
663
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
664
+ metadata: Sequence[Tuple[str, str]] = (),
665
+ ) -> pagers.ListCustomersAsyncPager:
666
+ r"""Lists customers of a partner identified by its Google
667
+ Cloud organization ID
668
+
669
+ .. code-block:: python
670
+
671
+ # This snippet has been automatically generated and should be regarded as a
672
+ # code template only.
673
+ # It will require modifications to work:
674
+ # - It may require correct/in-range values for request initialization.
675
+ # - It may require specifying regional endpoints when creating the service
676
+ # client as shown in:
677
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
678
+ from google.cloud import cloudcontrolspartner_v1beta
679
+
680
+ async def sample_list_customers():
681
+ # Create a client
682
+ client = cloudcontrolspartner_v1beta.CloudControlsPartnerCoreAsyncClient()
683
+
684
+ # Initialize request argument(s)
685
+ request = cloudcontrolspartner_v1beta.ListCustomersRequest(
686
+ parent="parent_value",
687
+ )
688
+
689
+ # Make the request
690
+ page_result = client.list_customers(request=request)
691
+
692
+ # Handle the response
693
+ async for response in page_result:
694
+ print(response)
695
+
696
+ Args:
697
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1beta.types.ListCustomersRequest, dict]]):
698
+ The request object. Request to list customers
699
+ parent (:class:`str`):
700
+ Required. Parent resource
701
+ Format:
702
+ organizations/{organization}/locations/{location}
703
+
704
+ This corresponds to the ``parent`` field
705
+ on the ``request`` instance; if ``request`` is provided, this
706
+ should not be set.
707
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
708
+ should be retried.
709
+ timeout (float): The timeout for this request.
710
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
711
+ sent along with the request as metadata.
712
+
713
+ Returns:
714
+ google.cloud.cloudcontrolspartner_v1beta.services.cloud_controls_partner_core.pagers.ListCustomersAsyncPager:
715
+ Response message for list customer
716
+ Customers requests
717
+ Iterating over this object will yield
718
+ results and resolve additional pages
719
+ automatically.
720
+
721
+ """
722
+ # Create or coerce a protobuf request object.
723
+ # Quick check: If we got a request object, we should *not* have
724
+ # gotten any keyword arguments that map to the request.
725
+ has_flattened_params = any([parent])
726
+ if request is not None and has_flattened_params:
727
+ raise ValueError(
728
+ "If the `request` argument is set, then none of "
729
+ "the individual field arguments should be set."
730
+ )
731
+
732
+ request = customers.ListCustomersRequest(request)
733
+
734
+ # If we have keyword arguments corresponding to fields on the
735
+ # request, apply these.
736
+ if parent is not None:
737
+ request.parent = parent
738
+
739
+ # Wrap the RPC method; this adds retry and timeout information,
740
+ # and friendly error handling.
741
+ rpc = gapic_v1.method_async.wrap_method(
742
+ self._client._transport.list_customers,
743
+ default_retry=retries.AsyncRetry(
744
+ initial=1.0,
745
+ maximum=10.0,
746
+ multiplier=1.3,
747
+ predicate=retries.if_exception_type(
748
+ core_exceptions.ServiceUnavailable,
749
+ ),
750
+ deadline=60.0,
751
+ ),
752
+ default_timeout=60.0,
753
+ client_info=DEFAULT_CLIENT_INFO,
754
+ )
755
+
756
+ # Certain fields should be provided within the metadata header;
757
+ # add these here.
758
+ metadata = tuple(metadata) + (
759
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
760
+ )
761
+
762
+ # Validate the universe domain.
763
+ self._client._validate_universe_domain()
764
+
765
+ # Send the request.
766
+ response = await rpc(
767
+ request,
768
+ retry=retry,
769
+ timeout=timeout,
770
+ metadata=metadata,
771
+ )
772
+
773
+ # This method is paged; wrap the response in a pager, which provides
774
+ # an `__aiter__` convenience method.
775
+ response = pagers.ListCustomersAsyncPager(
776
+ method=rpc,
777
+ request=request,
778
+ response=response,
779
+ metadata=metadata,
780
+ )
781
+
782
+ # Done; return the response.
783
+ return response
784
+
785
+ async def get_ekm_connections(
786
+ self,
787
+ request: Optional[Union[ekm_connections.GetEkmConnectionsRequest, dict]] = None,
788
+ *,
789
+ name: Optional[str] = None,
790
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
791
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
792
+ metadata: Sequence[Tuple[str, str]] = (),
793
+ ) -> ekm_connections.EkmConnections:
794
+ r"""Gets the EKM connections associated with a workload
795
+
796
+ .. code-block:: python
797
+
798
+ # This snippet has been automatically generated and should be regarded as a
799
+ # code template only.
800
+ # It will require modifications to work:
801
+ # - It may require correct/in-range values for request initialization.
802
+ # - It may require specifying regional endpoints when creating the service
803
+ # client as shown in:
804
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
805
+ from google.cloud import cloudcontrolspartner_v1beta
806
+
807
+ async def sample_get_ekm_connections():
808
+ # Create a client
809
+ client = cloudcontrolspartner_v1beta.CloudControlsPartnerCoreAsyncClient()
810
+
811
+ # Initialize request argument(s)
812
+ request = cloudcontrolspartner_v1beta.GetEkmConnectionsRequest(
813
+ name="name_value",
814
+ )
815
+
816
+ # Make the request
817
+ response = await client.get_ekm_connections(request=request)
818
+
819
+ # Handle the response
820
+ print(response)
821
+
822
+ Args:
823
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1beta.types.GetEkmConnectionsRequest, dict]]):
824
+ The request object. Request for getting the EKM
825
+ connections associated with a workload
826
+ name (:class:`str`):
827
+ Required. Format:
828
+
829
+ organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/ekmConnections
830
+
831
+ This corresponds to the ``name`` field
832
+ on the ``request`` instance; if ``request`` is provided, this
833
+ should not be set.
834
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
835
+ should be retried.
836
+ timeout (float): The timeout for this request.
837
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
838
+ sent along with the request as metadata.
839
+
840
+ Returns:
841
+ google.cloud.cloudcontrolspartner_v1beta.types.EkmConnections:
842
+ The EKM connections associated with a
843
+ workload
844
+
845
+ """
846
+ # Create or coerce a protobuf request object.
847
+ # Quick check: If we got a request object, we should *not* have
848
+ # gotten any keyword arguments that map to the request.
849
+ has_flattened_params = any([name])
850
+ if request is not None and has_flattened_params:
851
+ raise ValueError(
852
+ "If the `request` argument is set, then none of "
853
+ "the individual field arguments should be set."
854
+ )
855
+
856
+ request = ekm_connections.GetEkmConnectionsRequest(request)
857
+
858
+ # If we have keyword arguments corresponding to fields on the
859
+ # request, apply these.
860
+ if name is not None:
861
+ request.name = name
862
+
863
+ # Wrap the RPC method; this adds retry and timeout information,
864
+ # and friendly error handling.
865
+ rpc = gapic_v1.method_async.wrap_method(
866
+ self._client._transport.get_ekm_connections,
867
+ default_retry=retries.AsyncRetry(
868
+ initial=1.0,
869
+ maximum=10.0,
870
+ multiplier=1.3,
871
+ predicate=retries.if_exception_type(
872
+ core_exceptions.ServiceUnavailable,
873
+ ),
874
+ deadline=60.0,
875
+ ),
876
+ default_timeout=60.0,
877
+ client_info=DEFAULT_CLIENT_INFO,
878
+ )
879
+
880
+ # Certain fields should be provided within the metadata header;
881
+ # add these here.
882
+ metadata = tuple(metadata) + (
883
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
884
+ )
885
+
886
+ # Validate the universe domain.
887
+ self._client._validate_universe_domain()
888
+
889
+ # Send the request.
890
+ response = await rpc(
891
+ request,
892
+ retry=retry,
893
+ timeout=timeout,
894
+ metadata=metadata,
895
+ )
896
+
897
+ # Done; return the response.
898
+ return response
899
+
900
+ async def get_partner_permissions(
901
+ self,
902
+ request: Optional[
903
+ Union[partner_permissions.GetPartnerPermissionsRequest, dict]
904
+ ] = None,
905
+ *,
906
+ name: Optional[str] = None,
907
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
908
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
909
+ metadata: Sequence[Tuple[str, str]] = (),
910
+ ) -> partner_permissions.PartnerPermissions:
911
+ r"""Gets the partner permissions granted for a workload
912
+
913
+ .. code-block:: python
914
+
915
+ # This snippet has been automatically generated and should be regarded as a
916
+ # code template only.
917
+ # It will require modifications to work:
918
+ # - It may require correct/in-range values for request initialization.
919
+ # - It may require specifying regional endpoints when creating the service
920
+ # client as shown in:
921
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
922
+ from google.cloud import cloudcontrolspartner_v1beta
923
+
924
+ async def sample_get_partner_permissions():
925
+ # Create a client
926
+ client = cloudcontrolspartner_v1beta.CloudControlsPartnerCoreAsyncClient()
927
+
928
+ # Initialize request argument(s)
929
+ request = cloudcontrolspartner_v1beta.GetPartnerPermissionsRequest(
930
+ name="name_value",
931
+ )
932
+
933
+ # Make the request
934
+ response = await client.get_partner_permissions(request=request)
935
+
936
+ # Handle the response
937
+ print(response)
938
+
939
+ Args:
940
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1beta.types.GetPartnerPermissionsRequest, dict]]):
941
+ The request object. Request for getting the partner
942
+ permissions granted for a workload
943
+ name (:class:`str`):
944
+ Required. Name of the resource to get
945
+ in the format:
946
+ organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/partnerPermissions
947
+
948
+ This corresponds to the ``name`` field
949
+ on the ``request`` instance; if ``request`` is provided, this
950
+ should not be set.
951
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
952
+ should be retried.
953
+ timeout (float): The timeout for this request.
954
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
955
+ sent along with the request as metadata.
956
+
957
+ Returns:
958
+ google.cloud.cloudcontrolspartner_v1beta.types.PartnerPermissions:
959
+ The permissions granted to the
960
+ partner for a workload
961
+
962
+ """
963
+ # Create or coerce a protobuf request object.
964
+ # Quick check: If we got a request object, we should *not* have
965
+ # gotten any keyword arguments that map to the request.
966
+ has_flattened_params = any([name])
967
+ if request is not None and has_flattened_params:
968
+ raise ValueError(
969
+ "If the `request` argument is set, then none of "
970
+ "the individual field arguments should be set."
971
+ )
972
+
973
+ request = partner_permissions.GetPartnerPermissionsRequest(request)
974
+
975
+ # If we have keyword arguments corresponding to fields on the
976
+ # request, apply these.
977
+ if name is not None:
978
+ request.name = name
979
+
980
+ # Wrap the RPC method; this adds retry and timeout information,
981
+ # and friendly error handling.
982
+ rpc = gapic_v1.method_async.wrap_method(
983
+ self._client._transport.get_partner_permissions,
984
+ default_retry=retries.AsyncRetry(
985
+ initial=1.0,
986
+ maximum=10.0,
987
+ multiplier=1.3,
988
+ predicate=retries.if_exception_type(
989
+ core_exceptions.ServiceUnavailable,
990
+ ),
991
+ deadline=60.0,
992
+ ),
993
+ default_timeout=60.0,
994
+ client_info=DEFAULT_CLIENT_INFO,
995
+ )
996
+
997
+ # Certain fields should be provided within the metadata header;
998
+ # add these here.
999
+ metadata = tuple(metadata) + (
1000
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1001
+ )
1002
+
1003
+ # Validate the universe domain.
1004
+ self._client._validate_universe_domain()
1005
+
1006
+ # Send the request.
1007
+ response = await rpc(
1008
+ request,
1009
+ retry=retry,
1010
+ timeout=timeout,
1011
+ metadata=metadata,
1012
+ )
1013
+
1014
+ # Done; return the response.
1015
+ return response
1016
+
1017
+ async def list_access_approval_requests(
1018
+ self,
1019
+ request: Optional[
1020
+ Union[access_approval_requests.ListAccessApprovalRequestsRequest, dict]
1021
+ ] = None,
1022
+ *,
1023
+ parent: Optional[str] = None,
1024
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1025
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1026
+ metadata: Sequence[Tuple[str, str]] = (),
1027
+ ) -> pagers.ListAccessApprovalRequestsAsyncPager:
1028
+ r"""Lists access requests associated with a workload
1029
+
1030
+ .. code-block:: python
1031
+
1032
+ # This snippet has been automatically generated and should be regarded as a
1033
+ # code template only.
1034
+ # It will require modifications to work:
1035
+ # - It may require correct/in-range values for request initialization.
1036
+ # - It may require specifying regional endpoints when creating the service
1037
+ # client as shown in:
1038
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1039
+ from google.cloud import cloudcontrolspartner_v1beta
1040
+
1041
+ async def sample_list_access_approval_requests():
1042
+ # Create a client
1043
+ client = cloudcontrolspartner_v1beta.CloudControlsPartnerCoreAsyncClient()
1044
+
1045
+ # Initialize request argument(s)
1046
+ request = cloudcontrolspartner_v1beta.ListAccessApprovalRequestsRequest(
1047
+ parent="parent_value",
1048
+ )
1049
+
1050
+ # Make the request
1051
+ page_result = client.list_access_approval_requests(request=request)
1052
+
1053
+ # Handle the response
1054
+ async for response in page_result:
1055
+ print(response)
1056
+
1057
+ Args:
1058
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1beta.types.ListAccessApprovalRequestsRequest, dict]]):
1059
+ The request object. Request for getting the access
1060
+ requests associated with a workload.
1061
+ parent (:class:`str`):
1062
+ Required. Parent resource
1063
+ Format:
1064
+
1065
+ organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}
1066
+
1067
+ This corresponds to the ``parent`` field
1068
+ on the ``request`` instance; if ``request`` is provided, this
1069
+ should not be set.
1070
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1071
+ should be retried.
1072
+ timeout (float): The timeout for this request.
1073
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1074
+ sent along with the request as metadata.
1075
+
1076
+ Returns:
1077
+ google.cloud.cloudcontrolspartner_v1beta.services.cloud_controls_partner_core.pagers.ListAccessApprovalRequestsAsyncPager:
1078
+ Response message for list access
1079
+ requests.
1080
+ Iterating over this object will yield
1081
+ results and resolve additional pages
1082
+ automatically.
1083
+
1084
+ """
1085
+ # Create or coerce a protobuf request object.
1086
+ # Quick check: If we got a request object, we should *not* have
1087
+ # gotten any keyword arguments that map to the request.
1088
+ has_flattened_params = any([parent])
1089
+ if request is not None and has_flattened_params:
1090
+ raise ValueError(
1091
+ "If the `request` argument is set, then none of "
1092
+ "the individual field arguments should be set."
1093
+ )
1094
+
1095
+ request = access_approval_requests.ListAccessApprovalRequestsRequest(request)
1096
+
1097
+ # If we have keyword arguments corresponding to fields on the
1098
+ # request, apply these.
1099
+ if parent is not None:
1100
+ request.parent = parent
1101
+
1102
+ # Wrap the RPC method; this adds retry and timeout information,
1103
+ # and friendly error handling.
1104
+ rpc = gapic_v1.method_async.wrap_method(
1105
+ self._client._transport.list_access_approval_requests,
1106
+ default_retry=retries.AsyncRetry(
1107
+ initial=1.0,
1108
+ maximum=10.0,
1109
+ multiplier=1.3,
1110
+ predicate=retries.if_exception_type(
1111
+ core_exceptions.ServiceUnavailable,
1112
+ ),
1113
+ deadline=60.0,
1114
+ ),
1115
+ default_timeout=60.0,
1116
+ client_info=DEFAULT_CLIENT_INFO,
1117
+ )
1118
+
1119
+ # Certain fields should be provided within the metadata header;
1120
+ # add these here.
1121
+ metadata = tuple(metadata) + (
1122
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1123
+ )
1124
+
1125
+ # Validate the universe domain.
1126
+ self._client._validate_universe_domain()
1127
+
1128
+ # Send the request.
1129
+ response = await rpc(
1130
+ request,
1131
+ retry=retry,
1132
+ timeout=timeout,
1133
+ metadata=metadata,
1134
+ )
1135
+
1136
+ # This method is paged; wrap the response in a pager, which provides
1137
+ # an `__aiter__` convenience method.
1138
+ response = pagers.ListAccessApprovalRequestsAsyncPager(
1139
+ method=rpc,
1140
+ request=request,
1141
+ response=response,
1142
+ metadata=metadata,
1143
+ )
1144
+
1145
+ # Done; return the response.
1146
+ return response
1147
+
1148
+ async def get_partner(
1149
+ self,
1150
+ request: Optional[Union[partners.GetPartnerRequest, dict]] = None,
1151
+ *,
1152
+ name: Optional[str] = None,
1153
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1154
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1155
+ metadata: Sequence[Tuple[str, str]] = (),
1156
+ ) -> partners.Partner:
1157
+ r"""Get details of a Partner.
1158
+
1159
+ .. code-block:: python
1160
+
1161
+ # This snippet has been automatically generated and should be regarded as a
1162
+ # code template only.
1163
+ # It will require modifications to work:
1164
+ # - It may require correct/in-range values for request initialization.
1165
+ # - It may require specifying regional endpoints when creating the service
1166
+ # client as shown in:
1167
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1168
+ from google.cloud import cloudcontrolspartner_v1beta
1169
+
1170
+ async def sample_get_partner():
1171
+ # Create a client
1172
+ client = cloudcontrolspartner_v1beta.CloudControlsPartnerCoreAsyncClient()
1173
+
1174
+ # Initialize request argument(s)
1175
+ request = cloudcontrolspartner_v1beta.GetPartnerRequest(
1176
+ name="name_value",
1177
+ )
1178
+
1179
+ # Make the request
1180
+ response = await client.get_partner(request=request)
1181
+
1182
+ # Handle the response
1183
+ print(response)
1184
+
1185
+ Args:
1186
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1beta.types.GetPartnerRequest, dict]]):
1187
+ The request object. Message for getting a Partner
1188
+ name (:class:`str`):
1189
+ Required. Format:
1190
+ organizations/{organization}/locations/{location}/partner
1191
+
1192
+ This corresponds to the ``name`` field
1193
+ on the ``request`` instance; if ``request`` is provided, this
1194
+ should not be set.
1195
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1196
+ should be retried.
1197
+ timeout (float): The timeout for this request.
1198
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1199
+ sent along with the request as metadata.
1200
+
1201
+ Returns:
1202
+ google.cloud.cloudcontrolspartner_v1beta.types.Partner:
1203
+ Message describing Partner resource
1204
+ """
1205
+ # Create or coerce a protobuf request object.
1206
+ # Quick check: If we got a request object, we should *not* have
1207
+ # gotten any keyword arguments that map to the request.
1208
+ has_flattened_params = any([name])
1209
+ if request is not None and has_flattened_params:
1210
+ raise ValueError(
1211
+ "If the `request` argument is set, then none of "
1212
+ "the individual field arguments should be set."
1213
+ )
1214
+
1215
+ request = partners.GetPartnerRequest(request)
1216
+
1217
+ # If we have keyword arguments corresponding to fields on the
1218
+ # request, apply these.
1219
+ if name is not None:
1220
+ request.name = name
1221
+
1222
+ # Wrap the RPC method; this adds retry and timeout information,
1223
+ # and friendly error handling.
1224
+ rpc = gapic_v1.method_async.wrap_method(
1225
+ self._client._transport.get_partner,
1226
+ default_timeout=None,
1227
+ client_info=DEFAULT_CLIENT_INFO,
1228
+ )
1229
+
1230
+ # Certain fields should be provided within the metadata header;
1231
+ # add these here.
1232
+ metadata = tuple(metadata) + (
1233
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1234
+ )
1235
+
1236
+ # Validate the universe domain.
1237
+ self._client._validate_universe_domain()
1238
+
1239
+ # Send the request.
1240
+ response = await rpc(
1241
+ request,
1242
+ retry=retry,
1243
+ timeout=timeout,
1244
+ metadata=metadata,
1245
+ )
1246
+
1247
+ # Done; return the response.
1248
+ return response
1249
+
1250
+ async def __aenter__(self) -> "CloudControlsPartnerCoreAsyncClient":
1251
+ return self
1252
+
1253
+ async def __aexit__(self, exc_type, exc, tb):
1254
+ await self.transport.close()
1255
+
1256
+
1257
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1258
+ gapic_version=package_version.__version__
1259
+ )
1260
+
1261
+
1262
+ __all__ = ("CloudControlsPartnerCoreAsyncClient",)