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,1253 @@
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_v1 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_v1.services.cloud_controls_partner_core import (
48
+ pagers,
49
+ )
50
+ from google.cloud.cloudcontrolspartner_v1.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_v1
320
+
321
+ async def sample_get_workload():
322
+ # Create a client
323
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreAsyncClient()
324
+
325
+ # Initialize request argument(s)
326
+ request = cloudcontrolspartner_v1.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_v1.types.GetWorkloadRequest, dict]]):
338
+ The request object. Message for getting a customer
339
+ workload.
340
+ name (:class:`str`):
341
+ Required. Format:
342
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}``
343
+
344
+ This corresponds to the ``name`` field
345
+ on the ``request`` instance; if ``request`` is provided, this
346
+ should not be set.
347
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
348
+ should be retried.
349
+ timeout (float): The timeout for this request.
350
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
351
+ sent along with the request as metadata.
352
+
353
+ Returns:
354
+ google.cloud.cloudcontrolspartner_v1.types.Workload:
355
+ Contains metadata around the [Workload
356
+ resource](\ https://cloud.google.com/assured-workloads/docs/reference/rest/Shared.Types/Workload)
357
+ in the Assured Workloads API.
358
+
359
+ """
360
+ # Create or coerce a protobuf request object.
361
+ # Quick check: If we got a request object, we should *not* have
362
+ # gotten any keyword arguments that map to the request.
363
+ has_flattened_params = any([name])
364
+ if request is not None and has_flattened_params:
365
+ raise ValueError(
366
+ "If the `request` argument is set, then none of "
367
+ "the individual field arguments should be set."
368
+ )
369
+
370
+ request = customer_workloads.GetWorkloadRequest(request)
371
+
372
+ # If we have keyword arguments corresponding to fields on the
373
+ # request, apply these.
374
+ if name is not None:
375
+ request.name = name
376
+
377
+ # Wrap the RPC method; this adds retry and timeout information,
378
+ # and friendly error handling.
379
+ rpc = gapic_v1.method_async.wrap_method(
380
+ self._client._transport.get_workload,
381
+ default_retry=retries.AsyncRetry(
382
+ initial=1.0,
383
+ maximum=10.0,
384
+ multiplier=1.3,
385
+ predicate=retries.if_exception_type(
386
+ core_exceptions.ServiceUnavailable,
387
+ ),
388
+ deadline=60.0,
389
+ ),
390
+ default_timeout=60.0,
391
+ client_info=DEFAULT_CLIENT_INFO,
392
+ )
393
+
394
+ # Certain fields should be provided within the metadata header;
395
+ # add these here.
396
+ metadata = tuple(metadata) + (
397
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
398
+ )
399
+
400
+ # Validate the universe domain.
401
+ self._client._validate_universe_domain()
402
+
403
+ # Send the request.
404
+ response = await rpc(
405
+ request,
406
+ retry=retry,
407
+ timeout=timeout,
408
+ metadata=metadata,
409
+ )
410
+
411
+ # Done; return the response.
412
+ return response
413
+
414
+ async def list_workloads(
415
+ self,
416
+ request: Optional[Union[customer_workloads.ListWorkloadsRequest, dict]] = None,
417
+ *,
418
+ parent: Optional[str] = None,
419
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
420
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
421
+ metadata: Sequence[Tuple[str, str]] = (),
422
+ ) -> pagers.ListWorkloadsAsyncPager:
423
+ r"""Lists customer workloads for a given customer org id
424
+
425
+ .. code-block:: python
426
+
427
+ # This snippet has been automatically generated and should be regarded as a
428
+ # code template only.
429
+ # It will require modifications to work:
430
+ # - It may require correct/in-range values for request initialization.
431
+ # - It may require specifying regional endpoints when creating the service
432
+ # client as shown in:
433
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
434
+ from google.cloud import cloudcontrolspartner_v1
435
+
436
+ async def sample_list_workloads():
437
+ # Create a client
438
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreAsyncClient()
439
+
440
+ # Initialize request argument(s)
441
+ request = cloudcontrolspartner_v1.ListWorkloadsRequest(
442
+ parent="parent_value",
443
+ )
444
+
445
+ # Make the request
446
+ page_result = client.list_workloads(request=request)
447
+
448
+ # Handle the response
449
+ async for response in page_result:
450
+ print(response)
451
+
452
+ Args:
453
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1.types.ListWorkloadsRequest, dict]]):
454
+ The request object. Request to list customer workloads.
455
+ parent (:class:`str`):
456
+ Required. Parent resource Format:
457
+ ``organizations/{organization}/locations/{location}/customers/{customer}``
458
+
459
+ This corresponds to the ``parent`` field
460
+ on the ``request`` instance; if ``request`` is provided, this
461
+ should not be set.
462
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
463
+ should be retried.
464
+ timeout (float): The timeout for this request.
465
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
466
+ sent along with the request as metadata.
467
+
468
+ Returns:
469
+ google.cloud.cloudcontrolspartner_v1.services.cloud_controls_partner_core.pagers.ListWorkloadsAsyncPager:
470
+ Response message for list customer
471
+ workloads requests.
472
+ Iterating over this object will yield
473
+ results and resolve additional pages
474
+ automatically.
475
+
476
+ """
477
+ # Create or coerce a protobuf request object.
478
+ # Quick check: If we got a request object, we should *not* have
479
+ # gotten any keyword arguments that map to the request.
480
+ has_flattened_params = any([parent])
481
+ if request is not None and has_flattened_params:
482
+ raise ValueError(
483
+ "If the `request` argument is set, then none of "
484
+ "the individual field arguments should be set."
485
+ )
486
+
487
+ request = customer_workloads.ListWorkloadsRequest(request)
488
+
489
+ # If we have keyword arguments corresponding to fields on the
490
+ # request, apply these.
491
+ if parent is not None:
492
+ request.parent = parent
493
+
494
+ # Wrap the RPC method; this adds retry and timeout information,
495
+ # and friendly error handling.
496
+ rpc = gapic_v1.method_async.wrap_method(
497
+ self._client._transport.list_workloads,
498
+ default_retry=retries.AsyncRetry(
499
+ initial=1.0,
500
+ maximum=10.0,
501
+ multiplier=1.3,
502
+ predicate=retries.if_exception_type(
503
+ core_exceptions.ServiceUnavailable,
504
+ ),
505
+ deadline=60.0,
506
+ ),
507
+ default_timeout=60.0,
508
+ client_info=DEFAULT_CLIENT_INFO,
509
+ )
510
+
511
+ # Certain fields should be provided within the metadata header;
512
+ # add these here.
513
+ metadata = tuple(metadata) + (
514
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
515
+ )
516
+
517
+ # Validate the universe domain.
518
+ self._client._validate_universe_domain()
519
+
520
+ # Send the request.
521
+ response = await rpc(
522
+ request,
523
+ retry=retry,
524
+ timeout=timeout,
525
+ metadata=metadata,
526
+ )
527
+
528
+ # This method is paged; wrap the response in a pager, which provides
529
+ # an `__aiter__` convenience method.
530
+ response = pagers.ListWorkloadsAsyncPager(
531
+ method=rpc,
532
+ request=request,
533
+ response=response,
534
+ metadata=metadata,
535
+ )
536
+
537
+ # Done; return the response.
538
+ return response
539
+
540
+ async def get_customer(
541
+ self,
542
+ request: Optional[Union[customers.GetCustomerRequest, dict]] = None,
543
+ *,
544
+ name: Optional[str] = None,
545
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
546
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
547
+ metadata: Sequence[Tuple[str, str]] = (),
548
+ ) -> customers.Customer:
549
+ r"""Gets details of a single customer
550
+
551
+ .. code-block:: python
552
+
553
+ # This snippet has been automatically generated and should be regarded as a
554
+ # code template only.
555
+ # It will require modifications to work:
556
+ # - It may require correct/in-range values for request initialization.
557
+ # - It may require specifying regional endpoints when creating the service
558
+ # client as shown in:
559
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
560
+ from google.cloud import cloudcontrolspartner_v1
561
+
562
+ async def sample_get_customer():
563
+ # Create a client
564
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreAsyncClient()
565
+
566
+ # Initialize request argument(s)
567
+ request = cloudcontrolspartner_v1.GetCustomerRequest(
568
+ name="name_value",
569
+ )
570
+
571
+ # Make the request
572
+ response = await client.get_customer(request=request)
573
+
574
+ # Handle the response
575
+ print(response)
576
+
577
+ Args:
578
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1.types.GetCustomerRequest, dict]]):
579
+ The request object. Message for getting a customer
580
+ name (:class:`str`):
581
+ Required. Format:
582
+ ``organizations/{organization}/locations/{location}/customers/{customer}``
583
+
584
+ This corresponds to the ``name`` field
585
+ on the ``request`` instance; if ``request`` is provided, this
586
+ should not be set.
587
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
588
+ should be retried.
589
+ timeout (float): The timeout for this request.
590
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
591
+ sent along with the request as metadata.
592
+
593
+ Returns:
594
+ google.cloud.cloudcontrolspartner_v1.types.Customer:
595
+ Contains metadata around a Cloud
596
+ Controls Partner Customer
597
+
598
+ """
599
+ # Create or coerce a protobuf request object.
600
+ # Quick check: If we got a request object, we should *not* have
601
+ # gotten any keyword arguments that map to the request.
602
+ has_flattened_params = any([name])
603
+ if request is not None and has_flattened_params:
604
+ raise ValueError(
605
+ "If the `request` argument is set, then none of "
606
+ "the individual field arguments should be set."
607
+ )
608
+
609
+ request = customers.GetCustomerRequest(request)
610
+
611
+ # If we have keyword arguments corresponding to fields on the
612
+ # request, apply these.
613
+ if name is not None:
614
+ request.name = name
615
+
616
+ # Wrap the RPC method; this adds retry and timeout information,
617
+ # and friendly error handling.
618
+ rpc = gapic_v1.method_async.wrap_method(
619
+ self._client._transport.get_customer,
620
+ default_retry=retries.AsyncRetry(
621
+ initial=1.0,
622
+ maximum=10.0,
623
+ multiplier=1.3,
624
+ predicate=retries.if_exception_type(
625
+ core_exceptions.ServiceUnavailable,
626
+ ),
627
+ deadline=60.0,
628
+ ),
629
+ default_timeout=60.0,
630
+ client_info=DEFAULT_CLIENT_INFO,
631
+ )
632
+
633
+ # Certain fields should be provided within the metadata header;
634
+ # add these here.
635
+ metadata = tuple(metadata) + (
636
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
637
+ )
638
+
639
+ # Validate the universe domain.
640
+ self._client._validate_universe_domain()
641
+
642
+ # Send the request.
643
+ response = await rpc(
644
+ request,
645
+ retry=retry,
646
+ timeout=timeout,
647
+ metadata=metadata,
648
+ )
649
+
650
+ # Done; return the response.
651
+ return response
652
+
653
+ async def list_customers(
654
+ self,
655
+ request: Optional[Union[customers.ListCustomersRequest, dict]] = None,
656
+ *,
657
+ parent: Optional[str] = None,
658
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
659
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
660
+ metadata: Sequence[Tuple[str, str]] = (),
661
+ ) -> pagers.ListCustomersAsyncPager:
662
+ r"""Lists customers of a partner identified by its Google
663
+ Cloud organization ID
664
+
665
+ .. code-block:: python
666
+
667
+ # This snippet has been automatically generated and should be regarded as a
668
+ # code template only.
669
+ # It will require modifications to work:
670
+ # - It may require correct/in-range values for request initialization.
671
+ # - It may require specifying regional endpoints when creating the service
672
+ # client as shown in:
673
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
674
+ from google.cloud import cloudcontrolspartner_v1
675
+
676
+ async def sample_list_customers():
677
+ # Create a client
678
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreAsyncClient()
679
+
680
+ # Initialize request argument(s)
681
+ request = cloudcontrolspartner_v1.ListCustomersRequest(
682
+ parent="parent_value",
683
+ )
684
+
685
+ # Make the request
686
+ page_result = client.list_customers(request=request)
687
+
688
+ # Handle the response
689
+ async for response in page_result:
690
+ print(response)
691
+
692
+ Args:
693
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1.types.ListCustomersRequest, dict]]):
694
+ The request object. Request to list customers
695
+ parent (:class:`str`):
696
+ Required. Parent resource Format:
697
+ ``organizations/{organization}/locations/{location}``
698
+
699
+ This corresponds to the ``parent`` field
700
+ on the ``request`` instance; if ``request`` is provided, this
701
+ should not be set.
702
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
703
+ should be retried.
704
+ timeout (float): The timeout for this request.
705
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
706
+ sent along with the request as metadata.
707
+
708
+ Returns:
709
+ google.cloud.cloudcontrolspartner_v1.services.cloud_controls_partner_core.pagers.ListCustomersAsyncPager:
710
+ Response message for list customer
711
+ Customers requests
712
+ Iterating over this object will yield
713
+ results and resolve additional pages
714
+ automatically.
715
+
716
+ """
717
+ # Create or coerce a protobuf request object.
718
+ # Quick check: If we got a request object, we should *not* have
719
+ # gotten any keyword arguments that map to the request.
720
+ has_flattened_params = any([parent])
721
+ if request is not None and has_flattened_params:
722
+ raise ValueError(
723
+ "If the `request` argument is set, then none of "
724
+ "the individual field arguments should be set."
725
+ )
726
+
727
+ request = customers.ListCustomersRequest(request)
728
+
729
+ # If we have keyword arguments corresponding to fields on the
730
+ # request, apply these.
731
+ if parent is not None:
732
+ request.parent = parent
733
+
734
+ # Wrap the RPC method; this adds retry and timeout information,
735
+ # and friendly error handling.
736
+ rpc = gapic_v1.method_async.wrap_method(
737
+ self._client._transport.list_customers,
738
+ default_retry=retries.AsyncRetry(
739
+ initial=1.0,
740
+ maximum=10.0,
741
+ multiplier=1.3,
742
+ predicate=retries.if_exception_type(
743
+ core_exceptions.ServiceUnavailable,
744
+ ),
745
+ deadline=60.0,
746
+ ),
747
+ default_timeout=60.0,
748
+ client_info=DEFAULT_CLIENT_INFO,
749
+ )
750
+
751
+ # Certain fields should be provided within the metadata header;
752
+ # add these here.
753
+ metadata = tuple(metadata) + (
754
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
755
+ )
756
+
757
+ # Validate the universe domain.
758
+ self._client._validate_universe_domain()
759
+
760
+ # Send the request.
761
+ response = await rpc(
762
+ request,
763
+ retry=retry,
764
+ timeout=timeout,
765
+ metadata=metadata,
766
+ )
767
+
768
+ # This method is paged; wrap the response in a pager, which provides
769
+ # an `__aiter__` convenience method.
770
+ response = pagers.ListCustomersAsyncPager(
771
+ method=rpc,
772
+ request=request,
773
+ response=response,
774
+ metadata=metadata,
775
+ )
776
+
777
+ # Done; return the response.
778
+ return response
779
+
780
+ async def get_ekm_connections(
781
+ self,
782
+ request: Optional[Union[ekm_connections.GetEkmConnectionsRequest, dict]] = None,
783
+ *,
784
+ name: Optional[str] = None,
785
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
786
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
787
+ metadata: Sequence[Tuple[str, str]] = (),
788
+ ) -> ekm_connections.EkmConnections:
789
+ r"""Gets the EKM connections associated with a workload
790
+
791
+ .. code-block:: python
792
+
793
+ # This snippet has been automatically generated and should be regarded as a
794
+ # code template only.
795
+ # It will require modifications to work:
796
+ # - It may require correct/in-range values for request initialization.
797
+ # - It may require specifying regional endpoints when creating the service
798
+ # client as shown in:
799
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
800
+ from google.cloud import cloudcontrolspartner_v1
801
+
802
+ async def sample_get_ekm_connections():
803
+ # Create a client
804
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreAsyncClient()
805
+
806
+ # Initialize request argument(s)
807
+ request = cloudcontrolspartner_v1.GetEkmConnectionsRequest(
808
+ name="name_value",
809
+ )
810
+
811
+ # Make the request
812
+ response = await client.get_ekm_connections(request=request)
813
+
814
+ # Handle the response
815
+ print(response)
816
+
817
+ Args:
818
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1.types.GetEkmConnectionsRequest, dict]]):
819
+ The request object. Request for getting the EKM
820
+ connections associated with a workload
821
+ name (:class:`str`):
822
+ Required. Format:
823
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/ekmConnections``
824
+
825
+ This corresponds to the ``name`` field
826
+ on the ``request`` instance; if ``request`` is provided, this
827
+ should not be set.
828
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
829
+ should be retried.
830
+ timeout (float): The timeout for this request.
831
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
832
+ sent along with the request as metadata.
833
+
834
+ Returns:
835
+ google.cloud.cloudcontrolspartner_v1.types.EkmConnections:
836
+ The EKM connections associated with a
837
+ workload
838
+
839
+ """
840
+ # Create or coerce a protobuf request object.
841
+ # Quick check: If we got a request object, we should *not* have
842
+ # gotten any keyword arguments that map to the request.
843
+ has_flattened_params = any([name])
844
+ if request is not None and has_flattened_params:
845
+ raise ValueError(
846
+ "If the `request` argument is set, then none of "
847
+ "the individual field arguments should be set."
848
+ )
849
+
850
+ request = ekm_connections.GetEkmConnectionsRequest(request)
851
+
852
+ # If we have keyword arguments corresponding to fields on the
853
+ # request, apply these.
854
+ if name is not None:
855
+ request.name = name
856
+
857
+ # Wrap the RPC method; this adds retry and timeout information,
858
+ # and friendly error handling.
859
+ rpc = gapic_v1.method_async.wrap_method(
860
+ self._client._transport.get_ekm_connections,
861
+ default_retry=retries.AsyncRetry(
862
+ initial=1.0,
863
+ maximum=10.0,
864
+ multiplier=1.3,
865
+ predicate=retries.if_exception_type(
866
+ core_exceptions.ServiceUnavailable,
867
+ ),
868
+ deadline=60.0,
869
+ ),
870
+ default_timeout=60.0,
871
+ client_info=DEFAULT_CLIENT_INFO,
872
+ )
873
+
874
+ # Certain fields should be provided within the metadata header;
875
+ # add these here.
876
+ metadata = tuple(metadata) + (
877
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
878
+ )
879
+
880
+ # Validate the universe domain.
881
+ self._client._validate_universe_domain()
882
+
883
+ # Send the request.
884
+ response = await rpc(
885
+ request,
886
+ retry=retry,
887
+ timeout=timeout,
888
+ metadata=metadata,
889
+ )
890
+
891
+ # Done; return the response.
892
+ return response
893
+
894
+ async def get_partner_permissions(
895
+ self,
896
+ request: Optional[
897
+ Union[partner_permissions.GetPartnerPermissionsRequest, dict]
898
+ ] = None,
899
+ *,
900
+ name: Optional[str] = None,
901
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
902
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
903
+ metadata: Sequence[Tuple[str, str]] = (),
904
+ ) -> partner_permissions.PartnerPermissions:
905
+ r"""Gets the partner permissions granted for a workload
906
+
907
+ .. code-block:: python
908
+
909
+ # This snippet has been automatically generated and should be regarded as a
910
+ # code template only.
911
+ # It will require modifications to work:
912
+ # - It may require correct/in-range values for request initialization.
913
+ # - It may require specifying regional endpoints when creating the service
914
+ # client as shown in:
915
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
916
+ from google.cloud import cloudcontrolspartner_v1
917
+
918
+ async def sample_get_partner_permissions():
919
+ # Create a client
920
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreAsyncClient()
921
+
922
+ # Initialize request argument(s)
923
+ request = cloudcontrolspartner_v1.GetPartnerPermissionsRequest(
924
+ name="name_value",
925
+ )
926
+
927
+ # Make the request
928
+ response = await client.get_partner_permissions(request=request)
929
+
930
+ # Handle the response
931
+ print(response)
932
+
933
+ Args:
934
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1.types.GetPartnerPermissionsRequest, dict]]):
935
+ The request object. Request for getting the partner
936
+ permissions granted for a workload
937
+ name (:class:`str`):
938
+ Required. Name of the resource to get in the format:
939
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/partnerPermissions``
940
+
941
+ This corresponds to the ``name`` field
942
+ on the ``request`` instance; if ``request`` is provided, this
943
+ should not be set.
944
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
945
+ should be retried.
946
+ timeout (float): The timeout for this request.
947
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
948
+ sent along with the request as metadata.
949
+
950
+ Returns:
951
+ google.cloud.cloudcontrolspartner_v1.types.PartnerPermissions:
952
+ The permissions granted to the
953
+ partner for a workload
954
+
955
+ """
956
+ # Create or coerce a protobuf request object.
957
+ # Quick check: If we got a request object, we should *not* have
958
+ # gotten any keyword arguments that map to the request.
959
+ has_flattened_params = any([name])
960
+ if request is not None and has_flattened_params:
961
+ raise ValueError(
962
+ "If the `request` argument is set, then none of "
963
+ "the individual field arguments should be set."
964
+ )
965
+
966
+ request = partner_permissions.GetPartnerPermissionsRequest(request)
967
+
968
+ # If we have keyword arguments corresponding to fields on the
969
+ # request, apply these.
970
+ if name is not None:
971
+ request.name = name
972
+
973
+ # Wrap the RPC method; this adds retry and timeout information,
974
+ # and friendly error handling.
975
+ rpc = gapic_v1.method_async.wrap_method(
976
+ self._client._transport.get_partner_permissions,
977
+ default_retry=retries.AsyncRetry(
978
+ initial=1.0,
979
+ maximum=10.0,
980
+ multiplier=1.3,
981
+ predicate=retries.if_exception_type(
982
+ core_exceptions.ServiceUnavailable,
983
+ ),
984
+ deadline=60.0,
985
+ ),
986
+ default_timeout=60.0,
987
+ client_info=DEFAULT_CLIENT_INFO,
988
+ )
989
+
990
+ # Certain fields should be provided within the metadata header;
991
+ # add these here.
992
+ metadata = tuple(metadata) + (
993
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
994
+ )
995
+
996
+ # Validate the universe domain.
997
+ self._client._validate_universe_domain()
998
+
999
+ # Send the request.
1000
+ response = await rpc(
1001
+ request,
1002
+ retry=retry,
1003
+ timeout=timeout,
1004
+ metadata=metadata,
1005
+ )
1006
+
1007
+ # Done; return the response.
1008
+ return response
1009
+
1010
+ async def list_access_approval_requests(
1011
+ self,
1012
+ request: Optional[
1013
+ Union[access_approval_requests.ListAccessApprovalRequestsRequest, dict]
1014
+ ] = None,
1015
+ *,
1016
+ parent: Optional[str] = None,
1017
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1018
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1019
+ metadata: Sequence[Tuple[str, str]] = (),
1020
+ ) -> pagers.ListAccessApprovalRequestsAsyncPager:
1021
+ r"""Lists access requests associated with a workload
1022
+
1023
+ .. code-block:: python
1024
+
1025
+ # This snippet has been automatically generated and should be regarded as a
1026
+ # code template only.
1027
+ # It will require modifications to work:
1028
+ # - It may require correct/in-range values for request initialization.
1029
+ # - It may require specifying regional endpoints when creating the service
1030
+ # client as shown in:
1031
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1032
+ from google.cloud import cloudcontrolspartner_v1
1033
+
1034
+ async def sample_list_access_approval_requests():
1035
+ # Create a client
1036
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreAsyncClient()
1037
+
1038
+ # Initialize request argument(s)
1039
+ request = cloudcontrolspartner_v1.ListAccessApprovalRequestsRequest(
1040
+ parent="parent_value",
1041
+ )
1042
+
1043
+ # Make the request
1044
+ page_result = client.list_access_approval_requests(request=request)
1045
+
1046
+ # Handle the response
1047
+ async for response in page_result:
1048
+ print(response)
1049
+
1050
+ Args:
1051
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1.types.ListAccessApprovalRequestsRequest, dict]]):
1052
+ The request object. Request for getting the access
1053
+ requests associated with a workload.
1054
+ parent (:class:`str`):
1055
+ Required. Parent resource Format:
1056
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}``
1057
+
1058
+ This corresponds to the ``parent`` field
1059
+ on the ``request`` instance; if ``request`` is provided, this
1060
+ should not be set.
1061
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1062
+ should be retried.
1063
+ timeout (float): The timeout for this request.
1064
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1065
+ sent along with the request as metadata.
1066
+
1067
+ Returns:
1068
+ google.cloud.cloudcontrolspartner_v1.services.cloud_controls_partner_core.pagers.ListAccessApprovalRequestsAsyncPager:
1069
+ Response message for list access
1070
+ requests.
1071
+ Iterating over this object will yield
1072
+ results and resolve additional pages
1073
+ automatically.
1074
+
1075
+ """
1076
+ # Create or coerce a protobuf request object.
1077
+ # Quick check: If we got a request object, we should *not* have
1078
+ # gotten any keyword arguments that map to the request.
1079
+ has_flattened_params = any([parent])
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
+ request = access_approval_requests.ListAccessApprovalRequestsRequest(request)
1087
+
1088
+ # If we have keyword arguments corresponding to fields on the
1089
+ # request, apply these.
1090
+ if parent is not None:
1091
+ request.parent = parent
1092
+
1093
+ # Wrap the RPC method; this adds retry and timeout information,
1094
+ # and friendly error handling.
1095
+ rpc = gapic_v1.method_async.wrap_method(
1096
+ self._client._transport.list_access_approval_requests,
1097
+ default_retry=retries.AsyncRetry(
1098
+ initial=1.0,
1099
+ maximum=10.0,
1100
+ multiplier=1.3,
1101
+ predicate=retries.if_exception_type(
1102
+ core_exceptions.ServiceUnavailable,
1103
+ ),
1104
+ deadline=60.0,
1105
+ ),
1106
+ default_timeout=60.0,
1107
+ client_info=DEFAULT_CLIENT_INFO,
1108
+ )
1109
+
1110
+ # Certain fields should be provided within the metadata header;
1111
+ # add these here.
1112
+ metadata = tuple(metadata) + (
1113
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1114
+ )
1115
+
1116
+ # Validate the universe domain.
1117
+ self._client._validate_universe_domain()
1118
+
1119
+ # Send the request.
1120
+ response = await rpc(
1121
+ request,
1122
+ retry=retry,
1123
+ timeout=timeout,
1124
+ metadata=metadata,
1125
+ )
1126
+
1127
+ # This method is paged; wrap the response in a pager, which provides
1128
+ # an `__aiter__` convenience method.
1129
+ response = pagers.ListAccessApprovalRequestsAsyncPager(
1130
+ method=rpc,
1131
+ request=request,
1132
+ response=response,
1133
+ metadata=metadata,
1134
+ )
1135
+
1136
+ # Done; return the response.
1137
+ return response
1138
+
1139
+ async def get_partner(
1140
+ self,
1141
+ request: Optional[Union[partners.GetPartnerRequest, dict]] = None,
1142
+ *,
1143
+ name: Optional[str] = None,
1144
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1145
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1146
+ metadata: Sequence[Tuple[str, str]] = (),
1147
+ ) -> partners.Partner:
1148
+ r"""Get details of a Partner.
1149
+
1150
+ .. code-block:: python
1151
+
1152
+ # This snippet has been automatically generated and should be regarded as a
1153
+ # code template only.
1154
+ # It will require modifications to work:
1155
+ # - It may require correct/in-range values for request initialization.
1156
+ # - It may require specifying regional endpoints when creating the service
1157
+ # client as shown in:
1158
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1159
+ from google.cloud import cloudcontrolspartner_v1
1160
+
1161
+ async def sample_get_partner():
1162
+ # Create a client
1163
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreAsyncClient()
1164
+
1165
+ # Initialize request argument(s)
1166
+ request = cloudcontrolspartner_v1.GetPartnerRequest(
1167
+ name="name_value",
1168
+ )
1169
+
1170
+ # Make the request
1171
+ response = await client.get_partner(request=request)
1172
+
1173
+ # Handle the response
1174
+ print(response)
1175
+
1176
+ Args:
1177
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1.types.GetPartnerRequest, dict]]):
1178
+ The request object. Message for getting a Partner
1179
+ name (:class:`str`):
1180
+ Required. Format:
1181
+ ``organizations/{organization}/locations/{location}/partner``
1182
+
1183
+ This corresponds to the ``name`` field
1184
+ on the ``request`` instance; if ``request`` is provided, this
1185
+ should not be set.
1186
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1187
+ should be retried.
1188
+ timeout (float): The timeout for this request.
1189
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1190
+ sent along with the request as metadata.
1191
+
1192
+ Returns:
1193
+ google.cloud.cloudcontrolspartner_v1.types.Partner:
1194
+ Message describing Partner resource
1195
+ """
1196
+ # Create or coerce a protobuf request object.
1197
+ # Quick check: If we got a request object, we should *not* have
1198
+ # gotten any keyword arguments that map to the request.
1199
+ has_flattened_params = any([name])
1200
+ if request is not None and has_flattened_params:
1201
+ raise ValueError(
1202
+ "If the `request` argument is set, then none of "
1203
+ "the individual field arguments should be set."
1204
+ )
1205
+
1206
+ request = partners.GetPartnerRequest(request)
1207
+
1208
+ # If we have keyword arguments corresponding to fields on the
1209
+ # request, apply these.
1210
+ if name is not None:
1211
+ request.name = name
1212
+
1213
+ # Wrap the RPC method; this adds retry and timeout information,
1214
+ # and friendly error handling.
1215
+ rpc = gapic_v1.method_async.wrap_method(
1216
+ self._client._transport.get_partner,
1217
+ default_timeout=None,
1218
+ client_info=DEFAULT_CLIENT_INFO,
1219
+ )
1220
+
1221
+ # Certain fields should be provided within the metadata header;
1222
+ # add these here.
1223
+ metadata = tuple(metadata) + (
1224
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1225
+ )
1226
+
1227
+ # Validate the universe domain.
1228
+ self._client._validate_universe_domain()
1229
+
1230
+ # Send the request.
1231
+ response = await rpc(
1232
+ request,
1233
+ retry=retry,
1234
+ timeout=timeout,
1235
+ metadata=metadata,
1236
+ )
1237
+
1238
+ # Done; return the response.
1239
+ return response
1240
+
1241
+ async def __aenter__(self) -> "CloudControlsPartnerCoreAsyncClient":
1242
+ return self
1243
+
1244
+ async def __aexit__(self, exc_type, exc, tb):
1245
+ await self.transport.close()
1246
+
1247
+
1248
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1249
+ gapic_version=package_version.__version__
1250
+ )
1251
+
1252
+
1253
+ __all__ = ("CloudControlsPartnerCoreAsyncClient",)