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,1705 @@
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 os
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
+ cast,
30
+ )
31
+ import warnings
32
+
33
+ from google.api_core import client_options as client_options_lib
34
+ from google.api_core import exceptions as core_exceptions
35
+ from google.api_core import gapic_v1
36
+ from google.api_core import retry as retries
37
+ from google.auth import credentials as ga_credentials # type: ignore
38
+ from google.auth.exceptions import MutualTLSChannelError # type: ignore
39
+ from google.auth.transport import mtls # type: ignore
40
+ from google.auth.transport.grpc import SslCredentials # type: ignore
41
+ from google.oauth2 import service_account # type: ignore
42
+
43
+ from google.cloud.cloudcontrolspartner_v1 import gapic_version as package_version
44
+
45
+ try:
46
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
47
+ except AttributeError: # pragma: NO COVER
48
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
49
+
50
+ from google.protobuf import timestamp_pb2 # type: ignore
51
+
52
+ from google.cloud.cloudcontrolspartner_v1.services.cloud_controls_partner_core import (
53
+ pagers,
54
+ )
55
+ from google.cloud.cloudcontrolspartner_v1.types import (
56
+ access_approval_requests,
57
+ customer_workloads,
58
+ customers,
59
+ ekm_connections,
60
+ partner_permissions,
61
+ partners,
62
+ )
63
+
64
+ from .transports.base import DEFAULT_CLIENT_INFO, CloudControlsPartnerCoreTransport
65
+ from .transports.grpc import CloudControlsPartnerCoreGrpcTransport
66
+ from .transports.grpc_asyncio import CloudControlsPartnerCoreGrpcAsyncIOTransport
67
+ from .transports.rest import CloudControlsPartnerCoreRestTransport
68
+
69
+
70
+ class CloudControlsPartnerCoreClientMeta(type):
71
+ """Metaclass for the CloudControlsPartnerCore client.
72
+
73
+ This provides class-level methods for building and retrieving
74
+ support objects (e.g. transport) without polluting the client instance
75
+ objects.
76
+ """
77
+
78
+ _transport_registry = (
79
+ OrderedDict()
80
+ ) # type: Dict[str, Type[CloudControlsPartnerCoreTransport]]
81
+ _transport_registry["grpc"] = CloudControlsPartnerCoreGrpcTransport
82
+ _transport_registry["grpc_asyncio"] = CloudControlsPartnerCoreGrpcAsyncIOTransport
83
+ _transport_registry["rest"] = CloudControlsPartnerCoreRestTransport
84
+
85
+ def get_transport_class(
86
+ cls,
87
+ label: Optional[str] = None,
88
+ ) -> Type[CloudControlsPartnerCoreTransport]:
89
+ """Returns an appropriate transport class.
90
+
91
+ Args:
92
+ label: The name of the desired transport. If none is
93
+ provided, then the first transport in the registry is used.
94
+
95
+ Returns:
96
+ The transport class to use.
97
+ """
98
+ # If a specific transport is requested, return that one.
99
+ if label:
100
+ return cls._transport_registry[label]
101
+
102
+ # No transport is requested; return the default (that is, the first one
103
+ # in the dictionary).
104
+ return next(iter(cls._transport_registry.values()))
105
+
106
+
107
+ class CloudControlsPartnerCoreClient(metaclass=CloudControlsPartnerCoreClientMeta):
108
+ """Service describing handlers for resources"""
109
+
110
+ @staticmethod
111
+ def _get_default_mtls_endpoint(api_endpoint):
112
+ """Converts api endpoint to mTLS endpoint.
113
+
114
+ Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
115
+ "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
116
+ Args:
117
+ api_endpoint (Optional[str]): the api endpoint to convert.
118
+ Returns:
119
+ str: converted mTLS api endpoint.
120
+ """
121
+ if not api_endpoint:
122
+ return api_endpoint
123
+
124
+ mtls_endpoint_re = re.compile(
125
+ r"(?P<name>[^.]+)(?P<mtls>\.mtls)?(?P<sandbox>\.sandbox)?(?P<googledomain>\.googleapis\.com)?"
126
+ )
127
+
128
+ m = mtls_endpoint_re.match(api_endpoint)
129
+ name, mtls, sandbox, googledomain = m.groups()
130
+ if mtls or not googledomain:
131
+ return api_endpoint
132
+
133
+ if sandbox:
134
+ return api_endpoint.replace(
135
+ "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
136
+ )
137
+
138
+ return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
139
+
140
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
141
+ DEFAULT_ENDPOINT = "cloudcontrolspartner.googleapis.com"
142
+ DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
143
+ DEFAULT_ENDPOINT
144
+ )
145
+
146
+ _DEFAULT_ENDPOINT_TEMPLATE = "cloudcontrolspartner.{UNIVERSE_DOMAIN}"
147
+ _DEFAULT_UNIVERSE = "googleapis.com"
148
+
149
+ @classmethod
150
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
151
+ """Creates an instance of this client using the provided credentials
152
+ info.
153
+
154
+ Args:
155
+ info (dict): The service account private key info.
156
+ args: Additional arguments to pass to the constructor.
157
+ kwargs: Additional arguments to pass to the constructor.
158
+
159
+ Returns:
160
+ CloudControlsPartnerCoreClient: The constructed client.
161
+ """
162
+ credentials = service_account.Credentials.from_service_account_info(info)
163
+ kwargs["credentials"] = credentials
164
+ return cls(*args, **kwargs)
165
+
166
+ @classmethod
167
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
168
+ """Creates an instance of this client using the provided credentials
169
+ file.
170
+
171
+ Args:
172
+ filename (str): The path to the service account private key json
173
+ file.
174
+ args: Additional arguments to pass to the constructor.
175
+ kwargs: Additional arguments to pass to the constructor.
176
+
177
+ Returns:
178
+ CloudControlsPartnerCoreClient: The constructed client.
179
+ """
180
+ credentials = service_account.Credentials.from_service_account_file(filename)
181
+ kwargs["credentials"] = credentials
182
+ return cls(*args, **kwargs)
183
+
184
+ from_service_account_json = from_service_account_file
185
+
186
+ @property
187
+ def transport(self) -> CloudControlsPartnerCoreTransport:
188
+ """Returns the transport used by the client instance.
189
+
190
+ Returns:
191
+ CloudControlsPartnerCoreTransport: The transport used by the client
192
+ instance.
193
+ """
194
+ return self._transport
195
+
196
+ @staticmethod
197
+ def access_approval_request_path(
198
+ organization: str,
199
+ location: str,
200
+ customer: str,
201
+ workload: str,
202
+ access_approval_request: str,
203
+ ) -> str:
204
+ """Returns a fully-qualified access_approval_request string."""
205
+ return "organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/accessApprovalRequests/{access_approval_request}".format(
206
+ organization=organization,
207
+ location=location,
208
+ customer=customer,
209
+ workload=workload,
210
+ access_approval_request=access_approval_request,
211
+ )
212
+
213
+ @staticmethod
214
+ def parse_access_approval_request_path(path: str) -> Dict[str, str]:
215
+ """Parses a access_approval_request path into its component segments."""
216
+ m = re.match(
217
+ r"^organizations/(?P<organization>.+?)/locations/(?P<location>.+?)/customers/(?P<customer>.+?)/workloads/(?P<workload>.+?)/accessApprovalRequests/(?P<access_approval_request>.+?)$",
218
+ path,
219
+ )
220
+ return m.groupdict() if m else {}
221
+
222
+ @staticmethod
223
+ def customer_path(
224
+ organization: str,
225
+ location: str,
226
+ customer: str,
227
+ ) -> str:
228
+ """Returns a fully-qualified customer string."""
229
+ return "organizations/{organization}/locations/{location}/customers/{customer}".format(
230
+ organization=organization,
231
+ location=location,
232
+ customer=customer,
233
+ )
234
+
235
+ @staticmethod
236
+ def parse_customer_path(path: str) -> Dict[str, str]:
237
+ """Parses a customer path into its component segments."""
238
+ m = re.match(
239
+ r"^organizations/(?P<organization>.+?)/locations/(?P<location>.+?)/customers/(?P<customer>.+?)$",
240
+ path,
241
+ )
242
+ return m.groupdict() if m else {}
243
+
244
+ @staticmethod
245
+ def ekm_connections_path(
246
+ organization: str,
247
+ location: str,
248
+ customer: str,
249
+ workload: str,
250
+ ) -> str:
251
+ """Returns a fully-qualified ekm_connections string."""
252
+ return "organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/ekmConnections".format(
253
+ organization=organization,
254
+ location=location,
255
+ customer=customer,
256
+ workload=workload,
257
+ )
258
+
259
+ @staticmethod
260
+ def parse_ekm_connections_path(path: str) -> Dict[str, str]:
261
+ """Parses a ekm_connections path into its component segments."""
262
+ m = re.match(
263
+ r"^organizations/(?P<organization>.+?)/locations/(?P<location>.+?)/customers/(?P<customer>.+?)/workloads/(?P<workload>.+?)/ekmConnections$",
264
+ path,
265
+ )
266
+ return m.groupdict() if m else {}
267
+
268
+ @staticmethod
269
+ def partner_path(
270
+ organization: str,
271
+ location: str,
272
+ ) -> str:
273
+ """Returns a fully-qualified partner string."""
274
+ return "organizations/{organization}/locations/{location}/partner".format(
275
+ organization=organization,
276
+ location=location,
277
+ )
278
+
279
+ @staticmethod
280
+ def parse_partner_path(path: str) -> Dict[str, str]:
281
+ """Parses a partner path into its component segments."""
282
+ m = re.match(
283
+ r"^organizations/(?P<organization>.+?)/locations/(?P<location>.+?)/partner$",
284
+ path,
285
+ )
286
+ return m.groupdict() if m else {}
287
+
288
+ @staticmethod
289
+ def partner_permissions_path(
290
+ organization: str,
291
+ location: str,
292
+ customer: str,
293
+ workload: str,
294
+ ) -> str:
295
+ """Returns a fully-qualified partner_permissions string."""
296
+ return "organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/partnerPermissions".format(
297
+ organization=organization,
298
+ location=location,
299
+ customer=customer,
300
+ workload=workload,
301
+ )
302
+
303
+ @staticmethod
304
+ def parse_partner_permissions_path(path: str) -> Dict[str, str]:
305
+ """Parses a partner_permissions path into its component segments."""
306
+ m = re.match(
307
+ r"^organizations/(?P<organization>.+?)/locations/(?P<location>.+?)/customers/(?P<customer>.+?)/workloads/(?P<workload>.+?)/partnerPermissions$",
308
+ path,
309
+ )
310
+ return m.groupdict() if m else {}
311
+
312
+ @staticmethod
313
+ def workload_path(
314
+ organization: str,
315
+ location: str,
316
+ customer: str,
317
+ workload: str,
318
+ ) -> str:
319
+ """Returns a fully-qualified workload string."""
320
+ return "organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}".format(
321
+ organization=organization,
322
+ location=location,
323
+ customer=customer,
324
+ workload=workload,
325
+ )
326
+
327
+ @staticmethod
328
+ def parse_workload_path(path: str) -> Dict[str, str]:
329
+ """Parses a workload path into its component segments."""
330
+ m = re.match(
331
+ r"^organizations/(?P<organization>.+?)/locations/(?P<location>.+?)/customers/(?P<customer>.+?)/workloads/(?P<workload>.+?)$",
332
+ path,
333
+ )
334
+ return m.groupdict() if m else {}
335
+
336
+ @staticmethod
337
+ def common_billing_account_path(
338
+ billing_account: str,
339
+ ) -> str:
340
+ """Returns a fully-qualified billing_account string."""
341
+ return "billingAccounts/{billing_account}".format(
342
+ billing_account=billing_account,
343
+ )
344
+
345
+ @staticmethod
346
+ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
347
+ """Parse a billing_account path into its component segments."""
348
+ m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path)
349
+ return m.groupdict() if m else {}
350
+
351
+ @staticmethod
352
+ def common_folder_path(
353
+ folder: str,
354
+ ) -> str:
355
+ """Returns a fully-qualified folder string."""
356
+ return "folders/{folder}".format(
357
+ folder=folder,
358
+ )
359
+
360
+ @staticmethod
361
+ def parse_common_folder_path(path: str) -> Dict[str, str]:
362
+ """Parse a folder path into its component segments."""
363
+ m = re.match(r"^folders/(?P<folder>.+?)$", path)
364
+ return m.groupdict() if m else {}
365
+
366
+ @staticmethod
367
+ def common_organization_path(
368
+ organization: str,
369
+ ) -> str:
370
+ """Returns a fully-qualified organization string."""
371
+ return "organizations/{organization}".format(
372
+ organization=organization,
373
+ )
374
+
375
+ @staticmethod
376
+ def parse_common_organization_path(path: str) -> Dict[str, str]:
377
+ """Parse a organization path into its component segments."""
378
+ m = re.match(r"^organizations/(?P<organization>.+?)$", path)
379
+ return m.groupdict() if m else {}
380
+
381
+ @staticmethod
382
+ def common_project_path(
383
+ project: str,
384
+ ) -> str:
385
+ """Returns a fully-qualified project string."""
386
+ return "projects/{project}".format(
387
+ project=project,
388
+ )
389
+
390
+ @staticmethod
391
+ def parse_common_project_path(path: str) -> Dict[str, str]:
392
+ """Parse a project path into its component segments."""
393
+ m = re.match(r"^projects/(?P<project>.+?)$", path)
394
+ return m.groupdict() if m else {}
395
+
396
+ @staticmethod
397
+ def common_location_path(
398
+ project: str,
399
+ location: str,
400
+ ) -> str:
401
+ """Returns a fully-qualified location string."""
402
+ return "projects/{project}/locations/{location}".format(
403
+ project=project,
404
+ location=location,
405
+ )
406
+
407
+ @staticmethod
408
+ def parse_common_location_path(path: str) -> Dict[str, str]:
409
+ """Parse a location path into its component segments."""
410
+ m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path)
411
+ return m.groupdict() if m else {}
412
+
413
+ @classmethod
414
+ def get_mtls_endpoint_and_cert_source(
415
+ cls, client_options: Optional[client_options_lib.ClientOptions] = None
416
+ ):
417
+ """Deprecated. Return the API endpoint and client cert source for mutual TLS.
418
+
419
+ The client cert source is determined in the following order:
420
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
421
+ client cert source is None.
422
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
423
+ default client cert source exists, use the default one; otherwise the client cert
424
+ source is None.
425
+
426
+ The API endpoint is determined in the following order:
427
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
428
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
429
+ default mTLS endpoint; if the environment variable is "never", use the default API
430
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
431
+ use the default API endpoint.
432
+
433
+ More details can be found at https://google.aip.dev/auth/4114.
434
+
435
+ Args:
436
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
437
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
438
+ in this method.
439
+
440
+ Returns:
441
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
442
+ client cert source to use.
443
+
444
+ Raises:
445
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
446
+ """
447
+
448
+ warnings.warn(
449
+ "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.",
450
+ DeprecationWarning,
451
+ )
452
+ if client_options is None:
453
+ client_options = client_options_lib.ClientOptions()
454
+ use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")
455
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
456
+ if use_client_cert not in ("true", "false"):
457
+ raise ValueError(
458
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
459
+ )
460
+ if use_mtls_endpoint not in ("auto", "never", "always"):
461
+ raise MutualTLSChannelError(
462
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
463
+ )
464
+
465
+ # Figure out the client cert source to use.
466
+ client_cert_source = None
467
+ if use_client_cert == "true":
468
+ if client_options.client_cert_source:
469
+ client_cert_source = client_options.client_cert_source
470
+ elif mtls.has_default_client_cert_source():
471
+ client_cert_source = mtls.default_client_cert_source()
472
+
473
+ # Figure out which api endpoint to use.
474
+ if client_options.api_endpoint is not None:
475
+ api_endpoint = client_options.api_endpoint
476
+ elif use_mtls_endpoint == "always" or (
477
+ use_mtls_endpoint == "auto" and client_cert_source
478
+ ):
479
+ api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
480
+ else:
481
+ api_endpoint = cls.DEFAULT_ENDPOINT
482
+
483
+ return api_endpoint, client_cert_source
484
+
485
+ @staticmethod
486
+ def _read_environment_variables():
487
+ """Returns the environment variables used by the client.
488
+
489
+ Returns:
490
+ Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
491
+ GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.
492
+
493
+ Raises:
494
+ ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
495
+ any of ["true", "false"].
496
+ google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
497
+ is not any of ["auto", "never", "always"].
498
+ """
499
+ use_client_cert = os.getenv(
500
+ "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
501
+ ).lower()
502
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
503
+ universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
504
+ if use_client_cert not in ("true", "false"):
505
+ raise ValueError(
506
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
507
+ )
508
+ if use_mtls_endpoint not in ("auto", "never", "always"):
509
+ raise MutualTLSChannelError(
510
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
511
+ )
512
+ return use_client_cert == "true", use_mtls_endpoint, universe_domain_env
513
+
514
+ @staticmethod
515
+ def _get_client_cert_source(provided_cert_source, use_cert_flag):
516
+ """Return the client cert source to be used by the client.
517
+
518
+ Args:
519
+ provided_cert_source (bytes): The client certificate source provided.
520
+ use_cert_flag (bool): A flag indicating whether to use the client certificate.
521
+
522
+ Returns:
523
+ bytes or None: The client cert source to be used by the client.
524
+ """
525
+ client_cert_source = None
526
+ if use_cert_flag:
527
+ if provided_cert_source:
528
+ client_cert_source = provided_cert_source
529
+ elif mtls.has_default_client_cert_source():
530
+ client_cert_source = mtls.default_client_cert_source()
531
+ return client_cert_source
532
+
533
+ @staticmethod
534
+ def _get_api_endpoint(
535
+ api_override, client_cert_source, universe_domain, use_mtls_endpoint
536
+ ):
537
+ """Return the API endpoint used by the client.
538
+
539
+ Args:
540
+ api_override (str): The API endpoint override. If specified, this is always
541
+ the return value of this function and the other arguments are not used.
542
+ client_cert_source (bytes): The client certificate source used by the client.
543
+ universe_domain (str): The universe domain used by the client.
544
+ use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
545
+ Possible values are "always", "auto", or "never".
546
+
547
+ Returns:
548
+ str: The API endpoint to be used by the client.
549
+ """
550
+ if api_override is not None:
551
+ api_endpoint = api_override
552
+ elif use_mtls_endpoint == "always" or (
553
+ use_mtls_endpoint == "auto" and client_cert_source
554
+ ):
555
+ _default_universe = CloudControlsPartnerCoreClient._DEFAULT_UNIVERSE
556
+ if universe_domain != _default_universe:
557
+ raise MutualTLSChannelError(
558
+ f"mTLS is not supported in any universe other than {_default_universe}."
559
+ )
560
+ api_endpoint = CloudControlsPartnerCoreClient.DEFAULT_MTLS_ENDPOINT
561
+ else:
562
+ api_endpoint = (
563
+ CloudControlsPartnerCoreClient._DEFAULT_ENDPOINT_TEMPLATE.format(
564
+ UNIVERSE_DOMAIN=universe_domain
565
+ )
566
+ )
567
+ return api_endpoint
568
+
569
+ @staticmethod
570
+ def _get_universe_domain(
571
+ client_universe_domain: Optional[str], universe_domain_env: Optional[str]
572
+ ) -> str:
573
+ """Return the universe domain used by the client.
574
+
575
+ Args:
576
+ client_universe_domain (Optional[str]): The universe domain configured via the client options.
577
+ universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
578
+
579
+ Returns:
580
+ str: The universe domain to be used by the client.
581
+
582
+ Raises:
583
+ ValueError: If the universe domain is an empty string.
584
+ """
585
+ universe_domain = CloudControlsPartnerCoreClient._DEFAULT_UNIVERSE
586
+ if client_universe_domain is not None:
587
+ universe_domain = client_universe_domain
588
+ elif universe_domain_env is not None:
589
+ universe_domain = universe_domain_env
590
+ if len(universe_domain.strip()) == 0:
591
+ raise ValueError("Universe Domain cannot be an empty string.")
592
+ return universe_domain
593
+
594
+ @staticmethod
595
+ def _compare_universes(
596
+ client_universe: str, credentials: ga_credentials.Credentials
597
+ ) -> bool:
598
+ """Returns True iff the universe domains used by the client and credentials match.
599
+
600
+ Args:
601
+ client_universe (str): The universe domain configured via the client options.
602
+ credentials (ga_credentials.Credentials): The credentials being used in the client.
603
+
604
+ Returns:
605
+ bool: True iff client_universe matches the universe in credentials.
606
+
607
+ Raises:
608
+ ValueError: when client_universe does not match the universe in credentials.
609
+ """
610
+
611
+ default_universe = CloudControlsPartnerCoreClient._DEFAULT_UNIVERSE
612
+ credentials_universe = getattr(credentials, "universe_domain", default_universe)
613
+
614
+ if client_universe != credentials_universe:
615
+ raise ValueError(
616
+ "The configured universe domain "
617
+ f"({client_universe}) does not match the universe domain "
618
+ f"found in the credentials ({credentials_universe}). "
619
+ "If you haven't configured the universe domain explicitly, "
620
+ f"`{default_universe}` is the default."
621
+ )
622
+ return True
623
+
624
+ def _validate_universe_domain(self):
625
+ """Validates client's and credentials' universe domains are consistent.
626
+
627
+ Returns:
628
+ bool: True iff the configured universe domain is valid.
629
+
630
+ Raises:
631
+ ValueError: If the configured universe domain is not valid.
632
+ """
633
+ self._is_universe_domain_valid = (
634
+ self._is_universe_domain_valid
635
+ or CloudControlsPartnerCoreClient._compare_universes(
636
+ self.universe_domain, self.transport._credentials
637
+ )
638
+ )
639
+ return self._is_universe_domain_valid
640
+
641
+ @property
642
+ def api_endpoint(self):
643
+ """Return the API endpoint used by the client instance.
644
+
645
+ Returns:
646
+ str: The API endpoint used by the client instance.
647
+ """
648
+ return self._api_endpoint
649
+
650
+ @property
651
+ def universe_domain(self) -> str:
652
+ """Return the universe domain used by the client instance.
653
+
654
+ Returns:
655
+ str: The universe domain used by the client instance.
656
+ """
657
+ return self._universe_domain
658
+
659
+ def __init__(
660
+ self,
661
+ *,
662
+ credentials: Optional[ga_credentials.Credentials] = None,
663
+ transport: Optional[Union[str, CloudControlsPartnerCoreTransport]] = None,
664
+ client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
665
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
666
+ ) -> None:
667
+ """Instantiates the cloud controls partner core client.
668
+
669
+ Args:
670
+ credentials (Optional[google.auth.credentials.Credentials]): The
671
+ authorization credentials to attach to requests. These
672
+ credentials identify the application to the service; if none
673
+ are specified, the client will attempt to ascertain the
674
+ credentials from the environment.
675
+ transport (Union[str, CloudControlsPartnerCoreTransport]): The
676
+ transport to use. If set to None, a transport is chosen
677
+ automatically.
678
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
679
+ Custom options for the client.
680
+
681
+ 1. The ``api_endpoint`` property can be used to override the
682
+ default endpoint provided by the client when ``transport`` is
683
+ not explicitly provided. Only if this property is not set and
684
+ ``transport`` was not explicitly provided, the endpoint is
685
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
686
+ variable, which have one of the following values:
687
+ "always" (always use the default mTLS endpoint), "never" (always
688
+ use the default regular endpoint) and "auto" (auto-switch to the
689
+ default mTLS endpoint if client certificate is present; this is
690
+ the default value).
691
+
692
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
693
+ is "true", then the ``client_cert_source`` property can be used
694
+ to provide a client certificate for mTLS transport. If
695
+ not provided, the default SSL client certificate will be used if
696
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
697
+ set, no client certificate will be used.
698
+
699
+ 3. The ``universe_domain`` property can be used to override the
700
+ default "googleapis.com" universe. Note that the ``api_endpoint``
701
+ property still takes precedence; and ``universe_domain`` is
702
+ currently not supported for mTLS.
703
+
704
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
705
+ The client info used to send a user-agent string along with
706
+ API requests. If ``None``, then default info will be used.
707
+ Generally, you only need to set this if you're developing
708
+ your own client library.
709
+
710
+ Raises:
711
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
712
+ creation failed for any reason.
713
+ """
714
+ self._client_options = client_options
715
+ if isinstance(self._client_options, dict):
716
+ self._client_options = client_options_lib.from_dict(self._client_options)
717
+ if self._client_options is None:
718
+ self._client_options = client_options_lib.ClientOptions()
719
+ self._client_options = cast(
720
+ client_options_lib.ClientOptions, self._client_options
721
+ )
722
+
723
+ universe_domain_opt = getattr(self._client_options, "universe_domain", None)
724
+
725
+ (
726
+ self._use_client_cert,
727
+ self._use_mtls_endpoint,
728
+ self._universe_domain_env,
729
+ ) = CloudControlsPartnerCoreClient._read_environment_variables()
730
+ self._client_cert_source = (
731
+ CloudControlsPartnerCoreClient._get_client_cert_source(
732
+ self._client_options.client_cert_source, self._use_client_cert
733
+ )
734
+ )
735
+ self._universe_domain = CloudControlsPartnerCoreClient._get_universe_domain(
736
+ universe_domain_opt, self._universe_domain_env
737
+ )
738
+ self._api_endpoint = None # updated below, depending on `transport`
739
+
740
+ # Initialize the universe domain validation.
741
+ self._is_universe_domain_valid = False
742
+
743
+ api_key_value = getattr(self._client_options, "api_key", None)
744
+ if api_key_value and credentials:
745
+ raise ValueError(
746
+ "client_options.api_key and credentials are mutually exclusive"
747
+ )
748
+
749
+ # Save or instantiate the transport.
750
+ # Ordinarily, we provide the transport, but allowing a custom transport
751
+ # instance provides an extensibility point for unusual situations.
752
+ transport_provided = isinstance(transport, CloudControlsPartnerCoreTransport)
753
+ if transport_provided:
754
+ # transport is a CloudControlsPartnerCoreTransport instance.
755
+ if credentials or self._client_options.credentials_file or api_key_value:
756
+ raise ValueError(
757
+ "When providing a transport instance, "
758
+ "provide its credentials directly."
759
+ )
760
+ if self._client_options.scopes:
761
+ raise ValueError(
762
+ "When providing a transport instance, provide its scopes "
763
+ "directly."
764
+ )
765
+ self._transport = cast(CloudControlsPartnerCoreTransport, transport)
766
+ self._api_endpoint = self._transport.host
767
+
768
+ self._api_endpoint = (
769
+ self._api_endpoint
770
+ or CloudControlsPartnerCoreClient._get_api_endpoint(
771
+ self._client_options.api_endpoint,
772
+ self._client_cert_source,
773
+ self._universe_domain,
774
+ self._use_mtls_endpoint,
775
+ )
776
+ )
777
+
778
+ if not transport_provided:
779
+ import google.auth._default # type: ignore
780
+
781
+ if api_key_value and hasattr(
782
+ google.auth._default, "get_api_key_credentials"
783
+ ):
784
+ credentials = google.auth._default.get_api_key_credentials(
785
+ api_key_value
786
+ )
787
+
788
+ Transport = type(self).get_transport_class(cast(str, transport))
789
+ self._transport = Transport(
790
+ credentials=credentials,
791
+ credentials_file=self._client_options.credentials_file,
792
+ host=self._api_endpoint,
793
+ scopes=self._client_options.scopes,
794
+ client_cert_source_for_mtls=self._client_cert_source,
795
+ quota_project_id=self._client_options.quota_project_id,
796
+ client_info=client_info,
797
+ always_use_jwt_access=True,
798
+ api_audience=self._client_options.api_audience,
799
+ )
800
+
801
+ def get_workload(
802
+ self,
803
+ request: Optional[Union[customer_workloads.GetWorkloadRequest, dict]] = None,
804
+ *,
805
+ name: Optional[str] = None,
806
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
807
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
808
+ metadata: Sequence[Tuple[str, str]] = (),
809
+ ) -> customer_workloads.Workload:
810
+ r"""Gets details of a single workload
811
+
812
+ .. code-block:: python
813
+
814
+ # This snippet has been automatically generated and should be regarded as a
815
+ # code template only.
816
+ # It will require modifications to work:
817
+ # - It may require correct/in-range values for request initialization.
818
+ # - It may require specifying regional endpoints when creating the service
819
+ # client as shown in:
820
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
821
+ from google.cloud import cloudcontrolspartner_v1
822
+
823
+ def sample_get_workload():
824
+ # Create a client
825
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreClient()
826
+
827
+ # Initialize request argument(s)
828
+ request = cloudcontrolspartner_v1.GetWorkloadRequest(
829
+ name="name_value",
830
+ )
831
+
832
+ # Make the request
833
+ response = client.get_workload(request=request)
834
+
835
+ # Handle the response
836
+ print(response)
837
+
838
+ Args:
839
+ request (Union[google.cloud.cloudcontrolspartner_v1.types.GetWorkloadRequest, dict]):
840
+ The request object. Message for getting a customer
841
+ workload.
842
+ name (str):
843
+ Required. Format:
844
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}``
845
+
846
+ This corresponds to the ``name`` field
847
+ on the ``request`` instance; if ``request`` is provided, this
848
+ should not be set.
849
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
850
+ should be retried.
851
+ timeout (float): The timeout for this request.
852
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
853
+ sent along with the request as metadata.
854
+
855
+ Returns:
856
+ google.cloud.cloudcontrolspartner_v1.types.Workload:
857
+ Contains metadata around the [Workload
858
+ resource](\ https://cloud.google.com/assured-workloads/docs/reference/rest/Shared.Types/Workload)
859
+ in the Assured Workloads API.
860
+
861
+ """
862
+ # Create or coerce a protobuf request object.
863
+ # Quick check: If we got a request object, we should *not* have
864
+ # gotten any keyword arguments that map to the request.
865
+ has_flattened_params = any([name])
866
+ if request is not None and has_flattened_params:
867
+ raise ValueError(
868
+ "If the `request` argument is set, then none of "
869
+ "the individual field arguments should be set."
870
+ )
871
+
872
+ # Minor optimization to avoid making a copy if the user passes
873
+ # in a customer_workloads.GetWorkloadRequest.
874
+ # There's no risk of modifying the input as we've already verified
875
+ # there are no flattened fields.
876
+ if not isinstance(request, customer_workloads.GetWorkloadRequest):
877
+ request = customer_workloads.GetWorkloadRequest(request)
878
+ # If we have keyword arguments corresponding to fields on the
879
+ # request, apply these.
880
+ if name is not None:
881
+ request.name = name
882
+
883
+ # Wrap the RPC method; this adds retry and timeout information,
884
+ # and friendly error handling.
885
+ rpc = self._transport._wrapped_methods[self._transport.get_workload]
886
+
887
+ # Certain fields should be provided within the metadata header;
888
+ # add these here.
889
+ metadata = tuple(metadata) + (
890
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
891
+ )
892
+
893
+ # Validate the universe domain.
894
+ self._validate_universe_domain()
895
+
896
+ # Send the request.
897
+ response = rpc(
898
+ request,
899
+ retry=retry,
900
+ timeout=timeout,
901
+ metadata=metadata,
902
+ )
903
+
904
+ # Done; return the response.
905
+ return response
906
+
907
+ def list_workloads(
908
+ self,
909
+ request: Optional[Union[customer_workloads.ListWorkloadsRequest, dict]] = None,
910
+ *,
911
+ parent: Optional[str] = None,
912
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
913
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
914
+ metadata: Sequence[Tuple[str, str]] = (),
915
+ ) -> pagers.ListWorkloadsPager:
916
+ r"""Lists customer workloads for a given customer org id
917
+
918
+ .. code-block:: python
919
+
920
+ # This snippet has been automatically generated and should be regarded as a
921
+ # code template only.
922
+ # It will require modifications to work:
923
+ # - It may require correct/in-range values for request initialization.
924
+ # - It may require specifying regional endpoints when creating the service
925
+ # client as shown in:
926
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
927
+ from google.cloud import cloudcontrolspartner_v1
928
+
929
+ def sample_list_workloads():
930
+ # Create a client
931
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreClient()
932
+
933
+ # Initialize request argument(s)
934
+ request = cloudcontrolspartner_v1.ListWorkloadsRequest(
935
+ parent="parent_value",
936
+ )
937
+
938
+ # Make the request
939
+ page_result = client.list_workloads(request=request)
940
+
941
+ # Handle the response
942
+ for response in page_result:
943
+ print(response)
944
+
945
+ Args:
946
+ request (Union[google.cloud.cloudcontrolspartner_v1.types.ListWorkloadsRequest, dict]):
947
+ The request object. Request to list customer workloads.
948
+ parent (str):
949
+ Required. Parent resource Format:
950
+ ``organizations/{organization}/locations/{location}/customers/{customer}``
951
+
952
+ This corresponds to the ``parent`` field
953
+ on the ``request`` instance; if ``request`` is provided, this
954
+ should not be set.
955
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
956
+ should be retried.
957
+ timeout (float): The timeout for this request.
958
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
959
+ sent along with the request as metadata.
960
+
961
+ Returns:
962
+ google.cloud.cloudcontrolspartner_v1.services.cloud_controls_partner_core.pagers.ListWorkloadsPager:
963
+ Response message for list customer
964
+ workloads requests.
965
+ Iterating over this object will yield
966
+ results and resolve additional pages
967
+ automatically.
968
+
969
+ """
970
+ # Create or coerce a protobuf request object.
971
+ # Quick check: If we got a request object, we should *not* have
972
+ # gotten any keyword arguments that map to the request.
973
+ has_flattened_params = any([parent])
974
+ if request is not None and has_flattened_params:
975
+ raise ValueError(
976
+ "If the `request` argument is set, then none of "
977
+ "the individual field arguments should be set."
978
+ )
979
+
980
+ # Minor optimization to avoid making a copy if the user passes
981
+ # in a customer_workloads.ListWorkloadsRequest.
982
+ # There's no risk of modifying the input as we've already verified
983
+ # there are no flattened fields.
984
+ if not isinstance(request, customer_workloads.ListWorkloadsRequest):
985
+ request = customer_workloads.ListWorkloadsRequest(request)
986
+ # If we have keyword arguments corresponding to fields on the
987
+ # request, apply these.
988
+ if parent is not None:
989
+ request.parent = parent
990
+
991
+ # Wrap the RPC method; this adds retry and timeout information,
992
+ # and friendly error handling.
993
+ rpc = self._transport._wrapped_methods[self._transport.list_workloads]
994
+
995
+ # Certain fields should be provided within the metadata header;
996
+ # add these here.
997
+ metadata = tuple(metadata) + (
998
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
999
+ )
1000
+
1001
+ # Validate the universe domain.
1002
+ self._validate_universe_domain()
1003
+
1004
+ # Send the request.
1005
+ response = rpc(
1006
+ request,
1007
+ retry=retry,
1008
+ timeout=timeout,
1009
+ metadata=metadata,
1010
+ )
1011
+
1012
+ # This method is paged; wrap the response in a pager, which provides
1013
+ # an `__iter__` convenience method.
1014
+ response = pagers.ListWorkloadsPager(
1015
+ method=rpc,
1016
+ request=request,
1017
+ response=response,
1018
+ metadata=metadata,
1019
+ )
1020
+
1021
+ # Done; return the response.
1022
+ return response
1023
+
1024
+ def get_customer(
1025
+ self,
1026
+ request: Optional[Union[customers.GetCustomerRequest, dict]] = None,
1027
+ *,
1028
+ name: Optional[str] = None,
1029
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1030
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1031
+ metadata: Sequence[Tuple[str, str]] = (),
1032
+ ) -> customers.Customer:
1033
+ r"""Gets details of a single customer
1034
+
1035
+ .. code-block:: python
1036
+
1037
+ # This snippet has been automatically generated and should be regarded as a
1038
+ # code template only.
1039
+ # It will require modifications to work:
1040
+ # - It may require correct/in-range values for request initialization.
1041
+ # - It may require specifying regional endpoints when creating the service
1042
+ # client as shown in:
1043
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1044
+ from google.cloud import cloudcontrolspartner_v1
1045
+
1046
+ def sample_get_customer():
1047
+ # Create a client
1048
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreClient()
1049
+
1050
+ # Initialize request argument(s)
1051
+ request = cloudcontrolspartner_v1.GetCustomerRequest(
1052
+ name="name_value",
1053
+ )
1054
+
1055
+ # Make the request
1056
+ response = client.get_customer(request=request)
1057
+
1058
+ # Handle the response
1059
+ print(response)
1060
+
1061
+ Args:
1062
+ request (Union[google.cloud.cloudcontrolspartner_v1.types.GetCustomerRequest, dict]):
1063
+ The request object. Message for getting a customer
1064
+ name (str):
1065
+ Required. Format:
1066
+ ``organizations/{organization}/locations/{location}/customers/{customer}``
1067
+
1068
+ This corresponds to the ``name`` field
1069
+ on the ``request`` instance; if ``request`` is provided, this
1070
+ should not be set.
1071
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1072
+ should be retried.
1073
+ timeout (float): The timeout for this request.
1074
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1075
+ sent along with the request as metadata.
1076
+
1077
+ Returns:
1078
+ google.cloud.cloudcontrolspartner_v1.types.Customer:
1079
+ Contains metadata around a Cloud
1080
+ Controls Partner Customer
1081
+
1082
+ """
1083
+ # Create or coerce a protobuf request object.
1084
+ # Quick check: If we got a request object, we should *not* have
1085
+ # gotten any keyword arguments that map to the request.
1086
+ has_flattened_params = any([name])
1087
+ if request is not None and has_flattened_params:
1088
+ raise ValueError(
1089
+ "If the `request` argument is set, then none of "
1090
+ "the individual field arguments should be set."
1091
+ )
1092
+
1093
+ # Minor optimization to avoid making a copy if the user passes
1094
+ # in a customers.GetCustomerRequest.
1095
+ # There's no risk of modifying the input as we've already verified
1096
+ # there are no flattened fields.
1097
+ if not isinstance(request, customers.GetCustomerRequest):
1098
+ request = customers.GetCustomerRequest(request)
1099
+ # If we have keyword arguments corresponding to fields on the
1100
+ # request, apply these.
1101
+ if name is not None:
1102
+ request.name = name
1103
+
1104
+ # Wrap the RPC method; this adds retry and timeout information,
1105
+ # and friendly error handling.
1106
+ rpc = self._transport._wrapped_methods[self._transport.get_customer]
1107
+
1108
+ # Certain fields should be provided within the metadata header;
1109
+ # add these here.
1110
+ metadata = tuple(metadata) + (
1111
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1112
+ )
1113
+
1114
+ # Validate the universe domain.
1115
+ self._validate_universe_domain()
1116
+
1117
+ # Send the request.
1118
+ response = rpc(
1119
+ request,
1120
+ retry=retry,
1121
+ timeout=timeout,
1122
+ metadata=metadata,
1123
+ )
1124
+
1125
+ # Done; return the response.
1126
+ return response
1127
+
1128
+ def list_customers(
1129
+ self,
1130
+ request: Optional[Union[customers.ListCustomersRequest, dict]] = None,
1131
+ *,
1132
+ parent: Optional[str] = None,
1133
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1134
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1135
+ metadata: Sequence[Tuple[str, str]] = (),
1136
+ ) -> pagers.ListCustomersPager:
1137
+ r"""Lists customers of a partner identified by its Google
1138
+ Cloud organization ID
1139
+
1140
+ .. code-block:: python
1141
+
1142
+ # This snippet has been automatically generated and should be regarded as a
1143
+ # code template only.
1144
+ # It will require modifications to work:
1145
+ # - It may require correct/in-range values for request initialization.
1146
+ # - It may require specifying regional endpoints when creating the service
1147
+ # client as shown in:
1148
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1149
+ from google.cloud import cloudcontrolspartner_v1
1150
+
1151
+ def sample_list_customers():
1152
+ # Create a client
1153
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreClient()
1154
+
1155
+ # Initialize request argument(s)
1156
+ request = cloudcontrolspartner_v1.ListCustomersRequest(
1157
+ parent="parent_value",
1158
+ )
1159
+
1160
+ # Make the request
1161
+ page_result = client.list_customers(request=request)
1162
+
1163
+ # Handle the response
1164
+ for response in page_result:
1165
+ print(response)
1166
+
1167
+ Args:
1168
+ request (Union[google.cloud.cloudcontrolspartner_v1.types.ListCustomersRequest, dict]):
1169
+ The request object. Request to list customers
1170
+ parent (str):
1171
+ Required. Parent resource Format:
1172
+ ``organizations/{organization}/locations/{location}``
1173
+
1174
+ This corresponds to the ``parent`` field
1175
+ on the ``request`` instance; if ``request`` is provided, this
1176
+ should not be set.
1177
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1178
+ should be retried.
1179
+ timeout (float): The timeout for this request.
1180
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1181
+ sent along with the request as metadata.
1182
+
1183
+ Returns:
1184
+ google.cloud.cloudcontrolspartner_v1.services.cloud_controls_partner_core.pagers.ListCustomersPager:
1185
+ Response message for list customer
1186
+ Customers requests
1187
+ Iterating over this object will yield
1188
+ results and resolve additional pages
1189
+ automatically.
1190
+
1191
+ """
1192
+ # Create or coerce a protobuf request object.
1193
+ # Quick check: If we got a request object, we should *not* have
1194
+ # gotten any keyword arguments that map to the request.
1195
+ has_flattened_params = any([parent])
1196
+ if request is not None and has_flattened_params:
1197
+ raise ValueError(
1198
+ "If the `request` argument is set, then none of "
1199
+ "the individual field arguments should be set."
1200
+ )
1201
+
1202
+ # Minor optimization to avoid making a copy if the user passes
1203
+ # in a customers.ListCustomersRequest.
1204
+ # There's no risk of modifying the input as we've already verified
1205
+ # there are no flattened fields.
1206
+ if not isinstance(request, customers.ListCustomersRequest):
1207
+ request = customers.ListCustomersRequest(request)
1208
+ # If we have keyword arguments corresponding to fields on the
1209
+ # request, apply these.
1210
+ if parent is not None:
1211
+ request.parent = parent
1212
+
1213
+ # Wrap the RPC method; this adds retry and timeout information,
1214
+ # and friendly error handling.
1215
+ rpc = self._transport._wrapped_methods[self._transport.list_customers]
1216
+
1217
+ # Certain fields should be provided within the metadata header;
1218
+ # add these here.
1219
+ metadata = tuple(metadata) + (
1220
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1221
+ )
1222
+
1223
+ # Validate the universe domain.
1224
+ self._validate_universe_domain()
1225
+
1226
+ # Send the request.
1227
+ response = rpc(
1228
+ request,
1229
+ retry=retry,
1230
+ timeout=timeout,
1231
+ metadata=metadata,
1232
+ )
1233
+
1234
+ # This method is paged; wrap the response in a pager, which provides
1235
+ # an `__iter__` convenience method.
1236
+ response = pagers.ListCustomersPager(
1237
+ method=rpc,
1238
+ request=request,
1239
+ response=response,
1240
+ metadata=metadata,
1241
+ )
1242
+
1243
+ # Done; return the response.
1244
+ return response
1245
+
1246
+ def get_ekm_connections(
1247
+ self,
1248
+ request: Optional[Union[ekm_connections.GetEkmConnectionsRequest, dict]] = None,
1249
+ *,
1250
+ name: Optional[str] = None,
1251
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1252
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1253
+ metadata: Sequence[Tuple[str, str]] = (),
1254
+ ) -> ekm_connections.EkmConnections:
1255
+ r"""Gets the EKM connections associated with a workload
1256
+
1257
+ .. code-block:: python
1258
+
1259
+ # This snippet has been automatically generated and should be regarded as a
1260
+ # code template only.
1261
+ # It will require modifications to work:
1262
+ # - It may require correct/in-range values for request initialization.
1263
+ # - It may require specifying regional endpoints when creating the service
1264
+ # client as shown in:
1265
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1266
+ from google.cloud import cloudcontrolspartner_v1
1267
+
1268
+ def sample_get_ekm_connections():
1269
+ # Create a client
1270
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreClient()
1271
+
1272
+ # Initialize request argument(s)
1273
+ request = cloudcontrolspartner_v1.GetEkmConnectionsRequest(
1274
+ name="name_value",
1275
+ )
1276
+
1277
+ # Make the request
1278
+ response = client.get_ekm_connections(request=request)
1279
+
1280
+ # Handle the response
1281
+ print(response)
1282
+
1283
+ Args:
1284
+ request (Union[google.cloud.cloudcontrolspartner_v1.types.GetEkmConnectionsRequest, dict]):
1285
+ The request object. Request for getting the EKM
1286
+ connections associated with a workload
1287
+ name (str):
1288
+ Required. Format:
1289
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/ekmConnections``
1290
+
1291
+ This corresponds to the ``name`` field
1292
+ on the ``request`` instance; if ``request`` is provided, this
1293
+ should not be set.
1294
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1295
+ should be retried.
1296
+ timeout (float): The timeout for this request.
1297
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1298
+ sent along with the request as metadata.
1299
+
1300
+ Returns:
1301
+ google.cloud.cloudcontrolspartner_v1.types.EkmConnections:
1302
+ The EKM connections associated with a
1303
+ workload
1304
+
1305
+ """
1306
+ # Create or coerce a protobuf request object.
1307
+ # Quick check: If we got a request object, we should *not* have
1308
+ # gotten any keyword arguments that map to the request.
1309
+ has_flattened_params = any([name])
1310
+ if request is not None and has_flattened_params:
1311
+ raise ValueError(
1312
+ "If the `request` argument is set, then none of "
1313
+ "the individual field arguments should be set."
1314
+ )
1315
+
1316
+ # Minor optimization to avoid making a copy if the user passes
1317
+ # in a ekm_connections.GetEkmConnectionsRequest.
1318
+ # There's no risk of modifying the input as we've already verified
1319
+ # there are no flattened fields.
1320
+ if not isinstance(request, ekm_connections.GetEkmConnectionsRequest):
1321
+ request = ekm_connections.GetEkmConnectionsRequest(request)
1322
+ # If we have keyword arguments corresponding to fields on the
1323
+ # request, apply these.
1324
+ if name is not None:
1325
+ request.name = name
1326
+
1327
+ # Wrap the RPC method; this adds retry and timeout information,
1328
+ # and friendly error handling.
1329
+ rpc = self._transport._wrapped_methods[self._transport.get_ekm_connections]
1330
+
1331
+ # Certain fields should be provided within the metadata header;
1332
+ # add these here.
1333
+ metadata = tuple(metadata) + (
1334
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1335
+ )
1336
+
1337
+ # Validate the universe domain.
1338
+ self._validate_universe_domain()
1339
+
1340
+ # Send the request.
1341
+ response = rpc(
1342
+ request,
1343
+ retry=retry,
1344
+ timeout=timeout,
1345
+ metadata=metadata,
1346
+ )
1347
+
1348
+ # Done; return the response.
1349
+ return response
1350
+
1351
+ def get_partner_permissions(
1352
+ self,
1353
+ request: Optional[
1354
+ Union[partner_permissions.GetPartnerPermissionsRequest, dict]
1355
+ ] = None,
1356
+ *,
1357
+ name: Optional[str] = None,
1358
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1359
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1360
+ metadata: Sequence[Tuple[str, str]] = (),
1361
+ ) -> partner_permissions.PartnerPermissions:
1362
+ r"""Gets the partner permissions granted for a workload
1363
+
1364
+ .. code-block:: python
1365
+
1366
+ # This snippet has been automatically generated and should be regarded as a
1367
+ # code template only.
1368
+ # It will require modifications to work:
1369
+ # - It may require correct/in-range values for request initialization.
1370
+ # - It may require specifying regional endpoints when creating the service
1371
+ # client as shown in:
1372
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1373
+ from google.cloud import cloudcontrolspartner_v1
1374
+
1375
+ def sample_get_partner_permissions():
1376
+ # Create a client
1377
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreClient()
1378
+
1379
+ # Initialize request argument(s)
1380
+ request = cloudcontrolspartner_v1.GetPartnerPermissionsRequest(
1381
+ name="name_value",
1382
+ )
1383
+
1384
+ # Make the request
1385
+ response = client.get_partner_permissions(request=request)
1386
+
1387
+ # Handle the response
1388
+ print(response)
1389
+
1390
+ Args:
1391
+ request (Union[google.cloud.cloudcontrolspartner_v1.types.GetPartnerPermissionsRequest, dict]):
1392
+ The request object. Request for getting the partner
1393
+ permissions granted for a workload
1394
+ name (str):
1395
+ Required. Name of the resource to get in the format:
1396
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/partnerPermissions``
1397
+
1398
+ This corresponds to the ``name`` field
1399
+ on the ``request`` instance; if ``request`` is provided, this
1400
+ should not be set.
1401
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1402
+ should be retried.
1403
+ timeout (float): The timeout for this request.
1404
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1405
+ sent along with the request as metadata.
1406
+
1407
+ Returns:
1408
+ google.cloud.cloudcontrolspartner_v1.types.PartnerPermissions:
1409
+ The permissions granted to the
1410
+ partner for a workload
1411
+
1412
+ """
1413
+ # Create or coerce a protobuf request object.
1414
+ # Quick check: If we got a request object, we should *not* have
1415
+ # gotten any keyword arguments that map to the request.
1416
+ has_flattened_params = any([name])
1417
+ if request is not None and has_flattened_params:
1418
+ raise ValueError(
1419
+ "If the `request` argument is set, then none of "
1420
+ "the individual field arguments should be set."
1421
+ )
1422
+
1423
+ # Minor optimization to avoid making a copy if the user passes
1424
+ # in a partner_permissions.GetPartnerPermissionsRequest.
1425
+ # There's no risk of modifying the input as we've already verified
1426
+ # there are no flattened fields.
1427
+ if not isinstance(request, partner_permissions.GetPartnerPermissionsRequest):
1428
+ request = partner_permissions.GetPartnerPermissionsRequest(request)
1429
+ # If we have keyword arguments corresponding to fields on the
1430
+ # request, apply these.
1431
+ if name is not None:
1432
+ request.name = name
1433
+
1434
+ # Wrap the RPC method; this adds retry and timeout information,
1435
+ # and friendly error handling.
1436
+ rpc = self._transport._wrapped_methods[self._transport.get_partner_permissions]
1437
+
1438
+ # Certain fields should be provided within the metadata header;
1439
+ # add these here.
1440
+ metadata = tuple(metadata) + (
1441
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1442
+ )
1443
+
1444
+ # Validate the universe domain.
1445
+ self._validate_universe_domain()
1446
+
1447
+ # Send the request.
1448
+ response = rpc(
1449
+ request,
1450
+ retry=retry,
1451
+ timeout=timeout,
1452
+ metadata=metadata,
1453
+ )
1454
+
1455
+ # Done; return the response.
1456
+ return response
1457
+
1458
+ def list_access_approval_requests(
1459
+ self,
1460
+ request: Optional[
1461
+ Union[access_approval_requests.ListAccessApprovalRequestsRequest, dict]
1462
+ ] = None,
1463
+ *,
1464
+ parent: Optional[str] = None,
1465
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1466
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1467
+ metadata: Sequence[Tuple[str, str]] = (),
1468
+ ) -> pagers.ListAccessApprovalRequestsPager:
1469
+ r"""Lists access requests associated with a workload
1470
+
1471
+ .. code-block:: python
1472
+
1473
+ # This snippet has been automatically generated and should be regarded as a
1474
+ # code template only.
1475
+ # It will require modifications to work:
1476
+ # - It may require correct/in-range values for request initialization.
1477
+ # - It may require specifying regional endpoints when creating the service
1478
+ # client as shown in:
1479
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1480
+ from google.cloud import cloudcontrolspartner_v1
1481
+
1482
+ def sample_list_access_approval_requests():
1483
+ # Create a client
1484
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreClient()
1485
+
1486
+ # Initialize request argument(s)
1487
+ request = cloudcontrolspartner_v1.ListAccessApprovalRequestsRequest(
1488
+ parent="parent_value",
1489
+ )
1490
+
1491
+ # Make the request
1492
+ page_result = client.list_access_approval_requests(request=request)
1493
+
1494
+ # Handle the response
1495
+ for response in page_result:
1496
+ print(response)
1497
+
1498
+ Args:
1499
+ request (Union[google.cloud.cloudcontrolspartner_v1.types.ListAccessApprovalRequestsRequest, dict]):
1500
+ The request object. Request for getting the access
1501
+ requests associated with a workload.
1502
+ parent (str):
1503
+ Required. Parent resource Format:
1504
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}``
1505
+
1506
+ This corresponds to the ``parent`` field
1507
+ on the ``request`` instance; if ``request`` is provided, this
1508
+ should not be set.
1509
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1510
+ should be retried.
1511
+ timeout (float): The timeout for this request.
1512
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1513
+ sent along with the request as metadata.
1514
+
1515
+ Returns:
1516
+ google.cloud.cloudcontrolspartner_v1.services.cloud_controls_partner_core.pagers.ListAccessApprovalRequestsPager:
1517
+ Response message for list access
1518
+ requests.
1519
+ Iterating over this object will yield
1520
+ results and resolve additional pages
1521
+ automatically.
1522
+
1523
+ """
1524
+ # Create or coerce a protobuf request object.
1525
+ # Quick check: If we got a request object, we should *not* have
1526
+ # gotten any keyword arguments that map to the request.
1527
+ has_flattened_params = any([parent])
1528
+ if request is not None and has_flattened_params:
1529
+ raise ValueError(
1530
+ "If the `request` argument is set, then none of "
1531
+ "the individual field arguments should be set."
1532
+ )
1533
+
1534
+ # Minor optimization to avoid making a copy if the user passes
1535
+ # in a access_approval_requests.ListAccessApprovalRequestsRequest.
1536
+ # There's no risk of modifying the input as we've already verified
1537
+ # there are no flattened fields.
1538
+ if not isinstance(
1539
+ request, access_approval_requests.ListAccessApprovalRequestsRequest
1540
+ ):
1541
+ request = access_approval_requests.ListAccessApprovalRequestsRequest(
1542
+ request
1543
+ )
1544
+ # If we have keyword arguments corresponding to fields on the
1545
+ # request, apply these.
1546
+ if parent is not None:
1547
+ request.parent = parent
1548
+
1549
+ # Wrap the RPC method; this adds retry and timeout information,
1550
+ # and friendly error handling.
1551
+ rpc = self._transport._wrapped_methods[
1552
+ self._transport.list_access_approval_requests
1553
+ ]
1554
+
1555
+ # Certain fields should be provided within the metadata header;
1556
+ # add these here.
1557
+ metadata = tuple(metadata) + (
1558
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
1559
+ )
1560
+
1561
+ # Validate the universe domain.
1562
+ self._validate_universe_domain()
1563
+
1564
+ # Send the request.
1565
+ response = rpc(
1566
+ request,
1567
+ retry=retry,
1568
+ timeout=timeout,
1569
+ metadata=metadata,
1570
+ )
1571
+
1572
+ # This method is paged; wrap the response in a pager, which provides
1573
+ # an `__iter__` convenience method.
1574
+ response = pagers.ListAccessApprovalRequestsPager(
1575
+ method=rpc,
1576
+ request=request,
1577
+ response=response,
1578
+ metadata=metadata,
1579
+ )
1580
+
1581
+ # Done; return the response.
1582
+ return response
1583
+
1584
+ def get_partner(
1585
+ self,
1586
+ request: Optional[Union[partners.GetPartnerRequest, dict]] = None,
1587
+ *,
1588
+ name: Optional[str] = None,
1589
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1590
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1591
+ metadata: Sequence[Tuple[str, str]] = (),
1592
+ ) -> partners.Partner:
1593
+ r"""Get details of a Partner.
1594
+
1595
+ .. code-block:: python
1596
+
1597
+ # This snippet has been automatically generated and should be regarded as a
1598
+ # code template only.
1599
+ # It will require modifications to work:
1600
+ # - It may require correct/in-range values for request initialization.
1601
+ # - It may require specifying regional endpoints when creating the service
1602
+ # client as shown in:
1603
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1604
+ from google.cloud import cloudcontrolspartner_v1
1605
+
1606
+ def sample_get_partner():
1607
+ # Create a client
1608
+ client = cloudcontrolspartner_v1.CloudControlsPartnerCoreClient()
1609
+
1610
+ # Initialize request argument(s)
1611
+ request = cloudcontrolspartner_v1.GetPartnerRequest(
1612
+ name="name_value",
1613
+ )
1614
+
1615
+ # Make the request
1616
+ response = client.get_partner(request=request)
1617
+
1618
+ # Handle the response
1619
+ print(response)
1620
+
1621
+ Args:
1622
+ request (Union[google.cloud.cloudcontrolspartner_v1.types.GetPartnerRequest, dict]):
1623
+ The request object. Message for getting a Partner
1624
+ name (str):
1625
+ Required. Format:
1626
+ ``organizations/{organization}/locations/{location}/partner``
1627
+
1628
+ This corresponds to the ``name`` field
1629
+ on the ``request`` instance; if ``request`` is provided, this
1630
+ should not be set.
1631
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1632
+ should be retried.
1633
+ timeout (float): The timeout for this request.
1634
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1635
+ sent along with the request as metadata.
1636
+
1637
+ Returns:
1638
+ google.cloud.cloudcontrolspartner_v1.types.Partner:
1639
+ Message describing Partner resource
1640
+ """
1641
+ # Create or coerce a protobuf request object.
1642
+ # Quick check: If we got a request object, we should *not* have
1643
+ # gotten any keyword arguments that map to the request.
1644
+ has_flattened_params = any([name])
1645
+ if request is not None and has_flattened_params:
1646
+ raise ValueError(
1647
+ "If the `request` argument is set, then none of "
1648
+ "the individual field arguments should be set."
1649
+ )
1650
+
1651
+ # Minor optimization to avoid making a copy if the user passes
1652
+ # in a partners.GetPartnerRequest.
1653
+ # There's no risk of modifying the input as we've already verified
1654
+ # there are no flattened fields.
1655
+ if not isinstance(request, partners.GetPartnerRequest):
1656
+ request = partners.GetPartnerRequest(request)
1657
+ # If we have keyword arguments corresponding to fields on the
1658
+ # request, apply these.
1659
+ if name is not None:
1660
+ request.name = name
1661
+
1662
+ # Wrap the RPC method; this adds retry and timeout information,
1663
+ # and friendly error handling.
1664
+ rpc = self._transport._wrapped_methods[self._transport.get_partner]
1665
+
1666
+ # Certain fields should be provided within the metadata header;
1667
+ # add these here.
1668
+ metadata = tuple(metadata) + (
1669
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1670
+ )
1671
+
1672
+ # Validate the universe domain.
1673
+ self._validate_universe_domain()
1674
+
1675
+ # Send the request.
1676
+ response = rpc(
1677
+ request,
1678
+ retry=retry,
1679
+ timeout=timeout,
1680
+ metadata=metadata,
1681
+ )
1682
+
1683
+ # Done; return the response.
1684
+ return response
1685
+
1686
+ def __enter__(self) -> "CloudControlsPartnerCoreClient":
1687
+ return self
1688
+
1689
+ def __exit__(self, type, value, traceback):
1690
+ """Releases underlying transport's resources.
1691
+
1692
+ .. warning::
1693
+ ONLY use as a context manager if the transport is NOT shared
1694
+ with other clients! Exiting the with block will CLOSE the transport
1695
+ and may cause errors in other clients!
1696
+ """
1697
+ self.transport.close()
1698
+
1699
+
1700
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1701
+ gapic_version=package_version.__version__
1702
+ )
1703
+
1704
+
1705
+ __all__ = ("CloudControlsPartnerCoreClient",)