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,22 @@
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 .async_client import CloudControlsPartnerMonitoringAsyncClient
17
+ from .client import CloudControlsPartnerMonitoringClient
18
+
19
+ __all__ = (
20
+ "CloudControlsPartnerMonitoringClient",
21
+ "CloudControlsPartnerMonitoringAsyncClient",
22
+ )
@@ -0,0 +1,528 @@
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_monitoring import (
48
+ pagers,
49
+ )
50
+ from google.cloud.cloudcontrolspartner_v1.types import violations
51
+
52
+ from .client import CloudControlsPartnerMonitoringClient
53
+ from .transports.base import (
54
+ DEFAULT_CLIENT_INFO,
55
+ CloudControlsPartnerMonitoringTransport,
56
+ )
57
+ from .transports.grpc_asyncio import CloudControlsPartnerMonitoringGrpcAsyncIOTransport
58
+
59
+
60
+ class CloudControlsPartnerMonitoringAsyncClient:
61
+ """Service describing handlers for resources"""
62
+
63
+ _client: CloudControlsPartnerMonitoringClient
64
+
65
+ # Copy defaults from the synchronous client for use here.
66
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
67
+ DEFAULT_ENDPOINT = CloudControlsPartnerMonitoringClient.DEFAULT_ENDPOINT
68
+ DEFAULT_MTLS_ENDPOINT = CloudControlsPartnerMonitoringClient.DEFAULT_MTLS_ENDPOINT
69
+ _DEFAULT_ENDPOINT_TEMPLATE = (
70
+ CloudControlsPartnerMonitoringClient._DEFAULT_ENDPOINT_TEMPLATE
71
+ )
72
+ _DEFAULT_UNIVERSE = CloudControlsPartnerMonitoringClient._DEFAULT_UNIVERSE
73
+
74
+ violation_path = staticmethod(CloudControlsPartnerMonitoringClient.violation_path)
75
+ parse_violation_path = staticmethod(
76
+ CloudControlsPartnerMonitoringClient.parse_violation_path
77
+ )
78
+ common_billing_account_path = staticmethod(
79
+ CloudControlsPartnerMonitoringClient.common_billing_account_path
80
+ )
81
+ parse_common_billing_account_path = staticmethod(
82
+ CloudControlsPartnerMonitoringClient.parse_common_billing_account_path
83
+ )
84
+ common_folder_path = staticmethod(
85
+ CloudControlsPartnerMonitoringClient.common_folder_path
86
+ )
87
+ parse_common_folder_path = staticmethod(
88
+ CloudControlsPartnerMonitoringClient.parse_common_folder_path
89
+ )
90
+ common_organization_path = staticmethod(
91
+ CloudControlsPartnerMonitoringClient.common_organization_path
92
+ )
93
+ parse_common_organization_path = staticmethod(
94
+ CloudControlsPartnerMonitoringClient.parse_common_organization_path
95
+ )
96
+ common_project_path = staticmethod(
97
+ CloudControlsPartnerMonitoringClient.common_project_path
98
+ )
99
+ parse_common_project_path = staticmethod(
100
+ CloudControlsPartnerMonitoringClient.parse_common_project_path
101
+ )
102
+ common_location_path = staticmethod(
103
+ CloudControlsPartnerMonitoringClient.common_location_path
104
+ )
105
+ parse_common_location_path = staticmethod(
106
+ CloudControlsPartnerMonitoringClient.parse_common_location_path
107
+ )
108
+
109
+ @classmethod
110
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
111
+ """Creates an instance of this client using the provided credentials
112
+ info.
113
+
114
+ Args:
115
+ info (dict): The service account private key info.
116
+ args: Additional arguments to pass to the constructor.
117
+ kwargs: Additional arguments to pass to the constructor.
118
+
119
+ Returns:
120
+ CloudControlsPartnerMonitoringAsyncClient: The constructed client.
121
+ """
122
+ return CloudControlsPartnerMonitoringClient.from_service_account_info.__func__(CloudControlsPartnerMonitoringAsyncClient, info, *args, **kwargs) # type: ignore
123
+
124
+ @classmethod
125
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
126
+ """Creates an instance of this client using the provided credentials
127
+ file.
128
+
129
+ Args:
130
+ filename (str): The path to the service account private key json
131
+ file.
132
+ args: Additional arguments to pass to the constructor.
133
+ kwargs: Additional arguments to pass to the constructor.
134
+
135
+ Returns:
136
+ CloudControlsPartnerMonitoringAsyncClient: The constructed client.
137
+ """
138
+ return CloudControlsPartnerMonitoringClient.from_service_account_file.__func__(CloudControlsPartnerMonitoringAsyncClient, filename, *args, **kwargs) # type: ignore
139
+
140
+ from_service_account_json = from_service_account_file
141
+
142
+ @classmethod
143
+ def get_mtls_endpoint_and_cert_source(
144
+ cls, client_options: Optional[ClientOptions] = None
145
+ ):
146
+ """Return the API endpoint and client cert source for mutual TLS.
147
+
148
+ The client cert source is determined in the following order:
149
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
150
+ client cert source is None.
151
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
152
+ default client cert source exists, use the default one; otherwise the client cert
153
+ source is None.
154
+
155
+ The API endpoint is determined in the following order:
156
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
157
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
158
+ default mTLS endpoint; if the environment variable is "never", use the default API
159
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
160
+ use the default API endpoint.
161
+
162
+ More details can be found at https://google.aip.dev/auth/4114.
163
+
164
+ Args:
165
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
166
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
167
+ in this method.
168
+
169
+ Returns:
170
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
171
+ client cert source to use.
172
+
173
+ Raises:
174
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
175
+ """
176
+ return CloudControlsPartnerMonitoringClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
177
+
178
+ @property
179
+ def transport(self) -> CloudControlsPartnerMonitoringTransport:
180
+ """Returns the transport used by the client instance.
181
+
182
+ Returns:
183
+ CloudControlsPartnerMonitoringTransport: The transport used by the client instance.
184
+ """
185
+ return self._client.transport
186
+
187
+ @property
188
+ def api_endpoint(self):
189
+ """Return the API endpoint used by the client instance.
190
+
191
+ Returns:
192
+ str: The API endpoint used by the client instance.
193
+ """
194
+ return self._client._api_endpoint
195
+
196
+ @property
197
+ def universe_domain(self) -> str:
198
+ """Return the universe domain used by the client instance.
199
+
200
+ Returns:
201
+ str: The universe domain used
202
+ by the client instance.
203
+ """
204
+ return self._client._universe_domain
205
+
206
+ get_transport_class = functools.partial(
207
+ type(CloudControlsPartnerMonitoringClient).get_transport_class,
208
+ type(CloudControlsPartnerMonitoringClient),
209
+ )
210
+
211
+ def __init__(
212
+ self,
213
+ *,
214
+ credentials: Optional[ga_credentials.Credentials] = None,
215
+ transport: Union[str, CloudControlsPartnerMonitoringTransport] = "grpc_asyncio",
216
+ client_options: Optional[ClientOptions] = None,
217
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
218
+ ) -> None:
219
+ """Instantiates the cloud controls partner monitoring async client.
220
+
221
+ Args:
222
+ credentials (Optional[google.auth.credentials.Credentials]): The
223
+ authorization credentials to attach to requests. These
224
+ credentials identify the application to the service; if none
225
+ are specified, the client will attempt to ascertain the
226
+ credentials from the environment.
227
+ transport (Union[str, ~.CloudControlsPartnerMonitoringTransport]): The
228
+ transport to use. If set to None, a transport is chosen
229
+ automatically.
230
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
231
+ Custom options for the client.
232
+
233
+ 1. The ``api_endpoint`` property can be used to override the
234
+ default endpoint provided by the client when ``transport`` is
235
+ not explicitly provided. Only if this property is not set and
236
+ ``transport`` was not explicitly provided, the endpoint is
237
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
238
+ variable, which have one of the following values:
239
+ "always" (always use the default mTLS endpoint), "never" (always
240
+ use the default regular endpoint) and "auto" (auto-switch to the
241
+ default mTLS endpoint if client certificate is present; this is
242
+ the default value).
243
+
244
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
245
+ is "true", then the ``client_cert_source`` property can be used
246
+ to provide a client certificate for mTLS transport. If
247
+ not provided, the default SSL client certificate will be used if
248
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
249
+ set, no client certificate will be used.
250
+
251
+ 3. The ``universe_domain`` property can be used to override the
252
+ default "googleapis.com" universe. Note that ``api_endpoint``
253
+ property still takes precedence; and ``universe_domain`` is
254
+ currently not supported for mTLS.
255
+
256
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
257
+ The client info used to send a user-agent string along with
258
+ API requests. If ``None``, then default info will be used.
259
+ Generally, you only need to set this if you're developing
260
+ your own client library.
261
+
262
+ Raises:
263
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
264
+ creation failed for any reason.
265
+ """
266
+ self._client = CloudControlsPartnerMonitoringClient(
267
+ credentials=credentials,
268
+ transport=transport,
269
+ client_options=client_options,
270
+ client_info=client_info,
271
+ )
272
+
273
+ async def list_violations(
274
+ self,
275
+ request: Optional[Union[violations.ListViolationsRequest, dict]] = None,
276
+ *,
277
+ parent: Optional[str] = None,
278
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
279
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
280
+ metadata: Sequence[Tuple[str, str]] = (),
281
+ ) -> pagers.ListViolationsAsyncPager:
282
+ r"""Lists Violations for a workload Callers may also choose to read
283
+ across multiple Customers or for a single customer as per
284
+ `AIP-159 <https://google.aip.dev/159>`__ by using '-' (the
285
+ hyphen or dash character) as a wildcard character instead of
286
+ {customer} & {workload}. Format:
287
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}``
288
+
289
+ .. code-block:: python
290
+
291
+ # This snippet has been automatically generated and should be regarded as a
292
+ # code template only.
293
+ # It will require modifications to work:
294
+ # - It may require correct/in-range values for request initialization.
295
+ # - It may require specifying regional endpoints when creating the service
296
+ # client as shown in:
297
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
298
+ from google.cloud import cloudcontrolspartner_v1
299
+
300
+ async def sample_list_violations():
301
+ # Create a client
302
+ client = cloudcontrolspartner_v1.CloudControlsPartnerMonitoringAsyncClient()
303
+
304
+ # Initialize request argument(s)
305
+ request = cloudcontrolspartner_v1.ListViolationsRequest(
306
+ parent="parent_value",
307
+ )
308
+
309
+ # Make the request
310
+ page_result = client.list_violations(request=request)
311
+
312
+ # Handle the response
313
+ async for response in page_result:
314
+ print(response)
315
+
316
+ Args:
317
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1.types.ListViolationsRequest, dict]]):
318
+ The request object. Message for requesting list of
319
+ Violations
320
+ parent (:class:`str`):
321
+ Required. Parent resource Format
322
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}``
323
+
324
+ This corresponds to the ``parent`` field
325
+ on the ``request`` instance; if ``request`` is provided, this
326
+ should not be set.
327
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
328
+ should be retried.
329
+ timeout (float): The timeout for this request.
330
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
331
+ sent along with the request as metadata.
332
+
333
+ Returns:
334
+ google.cloud.cloudcontrolspartner_v1.services.cloud_controls_partner_monitoring.pagers.ListViolationsAsyncPager:
335
+ Response message for list customer
336
+ violation requests
337
+ Iterating over this object will yield
338
+ results and resolve additional pages
339
+ automatically.
340
+
341
+ """
342
+ # Create or coerce a protobuf request object.
343
+ # Quick check: If we got a request object, we should *not* have
344
+ # gotten any keyword arguments that map to the request.
345
+ has_flattened_params = any([parent])
346
+ if request is not None and has_flattened_params:
347
+ raise ValueError(
348
+ "If the `request` argument is set, then none of "
349
+ "the individual field arguments should be set."
350
+ )
351
+
352
+ request = violations.ListViolationsRequest(request)
353
+
354
+ # If we have keyword arguments corresponding to fields on the
355
+ # request, apply these.
356
+ if parent is not None:
357
+ request.parent = parent
358
+
359
+ # Wrap the RPC method; this adds retry and timeout information,
360
+ # and friendly error handling.
361
+ rpc = gapic_v1.method_async.wrap_method(
362
+ self._client._transport.list_violations,
363
+ default_retry=retries.AsyncRetry(
364
+ initial=1.0,
365
+ maximum=10.0,
366
+ multiplier=1.3,
367
+ predicate=retries.if_exception_type(
368
+ core_exceptions.ServiceUnavailable,
369
+ ),
370
+ deadline=60.0,
371
+ ),
372
+ default_timeout=60.0,
373
+ client_info=DEFAULT_CLIENT_INFO,
374
+ )
375
+
376
+ # Certain fields should be provided within the metadata header;
377
+ # add these here.
378
+ metadata = tuple(metadata) + (
379
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
380
+ )
381
+
382
+ # Validate the universe domain.
383
+ self._client._validate_universe_domain()
384
+
385
+ # Send the request.
386
+ response = await rpc(
387
+ request,
388
+ retry=retry,
389
+ timeout=timeout,
390
+ metadata=metadata,
391
+ )
392
+
393
+ # This method is paged; wrap the response in a pager, which provides
394
+ # an `__aiter__` convenience method.
395
+ response = pagers.ListViolationsAsyncPager(
396
+ method=rpc,
397
+ request=request,
398
+ response=response,
399
+ metadata=metadata,
400
+ )
401
+
402
+ # Done; return the response.
403
+ return response
404
+
405
+ async def get_violation(
406
+ self,
407
+ request: Optional[Union[violations.GetViolationRequest, dict]] = None,
408
+ *,
409
+ name: Optional[str] = None,
410
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
411
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
412
+ metadata: Sequence[Tuple[str, str]] = (),
413
+ ) -> violations.Violation:
414
+ r"""Gets details of a single Violation.
415
+
416
+ .. code-block:: python
417
+
418
+ # This snippet has been automatically generated and should be regarded as a
419
+ # code template only.
420
+ # It will require modifications to work:
421
+ # - It may require correct/in-range values for request initialization.
422
+ # - It may require specifying regional endpoints when creating the service
423
+ # client as shown in:
424
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
425
+ from google.cloud import cloudcontrolspartner_v1
426
+
427
+ async def sample_get_violation():
428
+ # Create a client
429
+ client = cloudcontrolspartner_v1.CloudControlsPartnerMonitoringAsyncClient()
430
+
431
+ # Initialize request argument(s)
432
+ request = cloudcontrolspartner_v1.GetViolationRequest(
433
+ name="name_value",
434
+ )
435
+
436
+ # Make the request
437
+ response = await client.get_violation(request=request)
438
+
439
+ # Handle the response
440
+ print(response)
441
+
442
+ Args:
443
+ request (Optional[Union[google.cloud.cloudcontrolspartner_v1.types.GetViolationRequest, dict]]):
444
+ The request object. Message for getting a Violation
445
+ name (:class:`str`):
446
+ Required. Format:
447
+ ``organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/violations/{violation}``
448
+
449
+ This corresponds to the ``name`` field
450
+ on the ``request`` instance; if ``request`` is provided, this
451
+ should not be set.
452
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
453
+ should be retried.
454
+ timeout (float): The timeout for this request.
455
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
456
+ sent along with the request as metadata.
457
+
458
+ Returns:
459
+ google.cloud.cloudcontrolspartner_v1.types.Violation:
460
+ Details of resource Violation
461
+ """
462
+ # Create or coerce a protobuf request object.
463
+ # Quick check: If we got a request object, we should *not* have
464
+ # gotten any keyword arguments that map to the request.
465
+ has_flattened_params = any([name])
466
+ if request is not None and has_flattened_params:
467
+ raise ValueError(
468
+ "If the `request` argument is set, then none of "
469
+ "the individual field arguments should be set."
470
+ )
471
+
472
+ request = violations.GetViolationRequest(request)
473
+
474
+ # If we have keyword arguments corresponding to fields on the
475
+ # request, apply these.
476
+ if name is not None:
477
+ request.name = name
478
+
479
+ # Wrap the RPC method; this adds retry and timeout information,
480
+ # and friendly error handling.
481
+ rpc = gapic_v1.method_async.wrap_method(
482
+ self._client._transport.get_violation,
483
+ default_retry=retries.AsyncRetry(
484
+ initial=1.0,
485
+ maximum=10.0,
486
+ multiplier=1.3,
487
+ predicate=retries.if_exception_type(
488
+ core_exceptions.ServiceUnavailable,
489
+ ),
490
+ deadline=60.0,
491
+ ),
492
+ default_timeout=60.0,
493
+ client_info=DEFAULT_CLIENT_INFO,
494
+ )
495
+
496
+ # Certain fields should be provided within the metadata header;
497
+ # add these here.
498
+ metadata = tuple(metadata) + (
499
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
500
+ )
501
+
502
+ # Validate the universe domain.
503
+ self._client._validate_universe_domain()
504
+
505
+ # Send the request.
506
+ response = await rpc(
507
+ request,
508
+ retry=retry,
509
+ timeout=timeout,
510
+ metadata=metadata,
511
+ )
512
+
513
+ # Done; return the response.
514
+ return response
515
+
516
+ async def __aenter__(self) -> "CloudControlsPartnerMonitoringAsyncClient":
517
+ return self
518
+
519
+ async def __aexit__(self, exc_type, exc, tb):
520
+ await self.transport.close()
521
+
522
+
523
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
524
+ gapic_version=package_version.__version__
525
+ )
526
+
527
+
528
+ __all__ = ("CloudControlsPartnerMonitoringAsyncClient",)