assassinlike commited on
Commit
3ecaf5c
·
verified ·
1 Parent(s): 76c2bec

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__init__.py +32 -0
  2. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__pycache__/__init__.cpython-311.pyc +0 -0
  3. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__pycache__/base.cpython-311.pyc +0 -0
  4. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__pycache__/grpc.cpython-311.pyc +0 -0
  5. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__pycache__/grpc_asyncio.cpython-311.pyc +0 -0
  6. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/base.py +237 -0
  7. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc.py +460 -0
  8. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc_asyncio.py +524 -0
  9. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/__pycache__/__init__.cpython-311.pyc +0 -0
  10. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/__pycache__/async_client.cpython-311.pyc +0 -0
  11. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/__pycache__/client.cpython-311.pyc +0 -0
  12. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__init__.py +32 -0
  13. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__pycache__/__init__.cpython-311.pyc +0 -0
  14. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__pycache__/base.cpython-311.pyc +0 -0
  15. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__pycache__/grpc.cpython-311.pyc +0 -0
  16. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__pycache__/grpc_asyncio.cpython-311.pyc +0 -0
  17. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/base.py +316 -0
  18. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc.py +542 -0
  19. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc_asyncio.py +652 -0
  20. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/__init__.cpython-311.pyc +0 -0
  21. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/arrow.cpython-311.pyc +0 -0
  22. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/avro.cpython-311.pyc +0 -0
  23. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/protobuf.cpython-311.pyc +0 -0
  24. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/storage.cpython-311.pyc +0 -0
  25. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/stream.cpython-311.pyc +0 -0
  26. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/table.cpython-311.pyc +0 -0
  27. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/__pycache__/__init__.cpython-311.pyc +0 -0
  28. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/__pycache__/gapic_version.cpython-311.pyc +0 -0
  29. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/__init__.py +15 -0
  30. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/__pycache__/__init__.cpython-311.pyc +0 -0
  31. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/folders/__init__.py +22 -0
  32. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/folders/async_client.py +1930 -0
  33. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/folders/client.py +0 -0
  34. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/folders/pagers.py +353 -0
  35. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/organizations/__init__.py +22 -0
  36. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/organizations/async_client.py +1052 -0
  37. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/organizations/client.py +1486 -0
  38. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/organizations/pagers.py +197 -0
  39. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/__init__.py +22 -0
  40. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/__pycache__/__init__.cpython-311.pyc +0 -0
  41. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/__pycache__/async_client.cpython-311.pyc +0 -0
  42. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/async_client.py +1985 -0
  43. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/client.py +0 -0
  44. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/pagers.py +353 -0
  45. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/__init__.py +22 -0
  46. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/__pycache__/__init__.cpython-311.pyc +0 -0
  47. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/__pycache__/async_client.cpython-311.pyc +0 -0
  48. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/__pycache__/client.cpython-311.pyc +0 -0
  49. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/__pycache__/pagers.cpython-311.pyc +0 -0
  50. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/async_client.py +883 -0
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__init__.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from typing import Dict, Type
18
+
19
+ from .base import BigQueryReadTransport
20
+ from .grpc import BigQueryReadGrpcTransport
21
+ from .grpc_asyncio import BigQueryReadGrpcAsyncIOTransport
22
+
23
+ # Compile a registry of transports.
24
+ _transport_registry = OrderedDict() # type: Dict[str, Type[BigQueryReadTransport]]
25
+ _transport_registry["grpc"] = BigQueryReadGrpcTransport
26
+ _transport_registry["grpc_asyncio"] = BigQueryReadGrpcAsyncIOTransport
27
+
28
+ __all__ = (
29
+ "BigQueryReadTransport",
30
+ "BigQueryReadGrpcTransport",
31
+ "BigQueryReadGrpcAsyncIOTransport",
32
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (763 Bytes). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__pycache__/base.cpython-311.pyc ADDED
Binary file (9.3 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__pycache__/grpc.cpython-311.pyc ADDED
Binary file (21.4 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__pycache__/grpc_asyncio.cpython-311.pyc ADDED
Binary file (24.1 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/base.py ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ import google.api_core
20
+ import google.auth # type: ignore
21
+ import google.protobuf
22
+ from google.api_core import exceptions as core_exceptions
23
+ from google.api_core import gapic_v1
24
+ from google.api_core import retry as retries
25
+ from google.auth import credentials as ga_credentials # type: ignore
26
+ from google.oauth2 import service_account # type: ignore
27
+
28
+ from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version
29
+ from google.cloud.bigquery_storage_v1beta2.types import storage, stream
30
+
31
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32
+ gapic_version=package_version.__version__
33
+ )
34
+
35
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
36
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
37
+
38
+
39
+ class BigQueryReadTransport(abc.ABC):
40
+ """Abstract transport class for BigQueryRead."""
41
+
42
+ AUTH_SCOPES = (
43
+ "https://www.googleapis.com/auth/bigquery",
44
+ "https://www.googleapis.com/auth/cloud-platform",
45
+ )
46
+
47
+ DEFAULT_HOST: str = "bigquerystorage.googleapis.com"
48
+
49
+ def __init__(
50
+ self,
51
+ *,
52
+ host: str = DEFAULT_HOST,
53
+ credentials: Optional[ga_credentials.Credentials] = None,
54
+ credentials_file: Optional[str] = None,
55
+ scopes: Optional[Sequence[str]] = None,
56
+ quota_project_id: Optional[str] = None,
57
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
58
+ always_use_jwt_access: Optional[bool] = False,
59
+ api_audience: Optional[str] = None,
60
+ **kwargs,
61
+ ) -> None:
62
+ """Instantiate the transport.
63
+
64
+ Args:
65
+ host (Optional[str]):
66
+ The hostname to connect to (default: 'bigquerystorage.googleapis.com').
67
+ credentials (Optional[google.auth.credentials.Credentials]): The
68
+ authorization credentials to attach to requests. These
69
+ credentials identify the application to the service; if none
70
+ are specified, the client will attempt to ascertain the
71
+ credentials from the environment.
72
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
73
+ be loaded with :func:`google.auth.load_credentials_from_file`.
74
+ This argument is mutually exclusive with credentials. This argument will be
75
+ removed in the next major version of this library.
76
+ scopes (Optional[Sequence[str]]): A list of scopes.
77
+ quota_project_id (Optional[str]): An optional project to use for billing
78
+ and quota.
79
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
80
+ The client info used to send a user-agent string along with
81
+ API requests. If ``None``, then default info will be used.
82
+ Generally, you only need to set this if you're developing
83
+ your own client library.
84
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
85
+ be used for service account credentials.
86
+ api_audience (Optional[str]): The intended audience for the API calls
87
+ to the service that will be set when using certain 3rd party
88
+ authentication flows. Audience is typically a resource identifier.
89
+ If not set, the host value will be used as a default.
90
+ """
91
+
92
+ # Save the scopes.
93
+ self._scopes = scopes
94
+ if not hasattr(self, "_ignore_credentials"):
95
+ self._ignore_credentials: bool = False
96
+
97
+ # If no credentials are provided, then determine the appropriate
98
+ # defaults.
99
+ if credentials and credentials_file:
100
+ raise core_exceptions.DuplicateCredentialArgs(
101
+ "'credentials_file' and 'credentials' are mutually exclusive"
102
+ )
103
+
104
+ if credentials_file is not None:
105
+ credentials, _ = google.auth.load_credentials_from_file(
106
+ credentials_file,
107
+ scopes=scopes,
108
+ quota_project_id=quota_project_id,
109
+ default_scopes=self.AUTH_SCOPES,
110
+ )
111
+ elif credentials is None and not self._ignore_credentials:
112
+ credentials, _ = google.auth.default(
113
+ scopes=scopes,
114
+ quota_project_id=quota_project_id,
115
+ default_scopes=self.AUTH_SCOPES,
116
+ )
117
+ # Don't apply audience if the credentials file passed from user.
118
+ if hasattr(credentials, "with_gdch_audience"):
119
+ credentials = credentials.with_gdch_audience(
120
+ api_audience if api_audience else host
121
+ )
122
+
123
+ # If the credentials are service account credentials, then always try to use self signed JWT.
124
+ if (
125
+ always_use_jwt_access
126
+ and isinstance(credentials, service_account.Credentials)
127
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
128
+ ):
129
+ credentials = credentials.with_always_use_jwt_access(True)
130
+
131
+ # Save the credentials.
132
+ self._credentials = credentials
133
+
134
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
135
+ if ":" not in host:
136
+ host += ":443"
137
+ self._host = host
138
+
139
+ self._wrapped_methods: Dict[Callable, Callable] = {}
140
+
141
+ @property
142
+ def host(self):
143
+ return self._host
144
+
145
+ def _prep_wrapped_messages(self, client_info):
146
+ # Precompute the wrapped methods.
147
+ self._wrapped_methods = {
148
+ self.create_read_session: gapic_v1.method.wrap_method(
149
+ self.create_read_session,
150
+ default_retry=retries.Retry(
151
+ initial=0.1,
152
+ maximum=60.0,
153
+ multiplier=1.3,
154
+ predicate=retries.if_exception_type(
155
+ core_exceptions.DeadlineExceeded,
156
+ core_exceptions.ServiceUnavailable,
157
+ ),
158
+ deadline=600.0,
159
+ ),
160
+ default_timeout=600.0,
161
+ client_info=client_info,
162
+ ),
163
+ self.read_rows: gapic_v1.method.wrap_method(
164
+ self.read_rows,
165
+ default_retry=retries.Retry(
166
+ initial=0.1,
167
+ maximum=60.0,
168
+ multiplier=1.3,
169
+ predicate=retries.if_exception_type(
170
+ core_exceptions.ServiceUnavailable,
171
+ ),
172
+ deadline=86400.0,
173
+ ),
174
+ default_timeout=86400.0,
175
+ client_info=client_info,
176
+ ),
177
+ self.split_read_stream: gapic_v1.method.wrap_method(
178
+ self.split_read_stream,
179
+ default_retry=retries.Retry(
180
+ initial=0.1,
181
+ maximum=60.0,
182
+ multiplier=1.3,
183
+ predicate=retries.if_exception_type(
184
+ core_exceptions.DeadlineExceeded,
185
+ core_exceptions.ServiceUnavailable,
186
+ ),
187
+ deadline=600.0,
188
+ ),
189
+ default_timeout=600.0,
190
+ client_info=client_info,
191
+ ),
192
+ }
193
+
194
+ def close(self):
195
+ """Closes resources associated with the transport.
196
+
197
+ .. warning::
198
+ Only call this method if the transport is NOT shared
199
+ with other clients - this may cause errors in other clients!
200
+ """
201
+ raise NotImplementedError()
202
+
203
+ @property
204
+ def create_read_session(
205
+ self,
206
+ ) -> Callable[
207
+ [storage.CreateReadSessionRequest],
208
+ Union[stream.ReadSession, Awaitable[stream.ReadSession]],
209
+ ]:
210
+ raise NotImplementedError()
211
+
212
+ @property
213
+ def read_rows(
214
+ self,
215
+ ) -> Callable[
216
+ [storage.ReadRowsRequest],
217
+ Union[storage.ReadRowsResponse, Awaitable[storage.ReadRowsResponse]],
218
+ ]:
219
+ raise NotImplementedError()
220
+
221
+ @property
222
+ def split_read_stream(
223
+ self,
224
+ ) -> Callable[
225
+ [storage.SplitReadStreamRequest],
226
+ Union[
227
+ storage.SplitReadStreamResponse, Awaitable[storage.SplitReadStreamResponse]
228
+ ],
229
+ ]:
230
+ raise NotImplementedError()
231
+
232
+ @property
233
+ def kind(self) -> str:
234
+ raise NotImplementedError()
235
+
236
+
237
+ __all__ = ("BigQueryReadTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc.py ADDED
@@ -0,0 +1,460 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json
17
+ import logging as std_logging
18
+ import pickle
19
+ import warnings
20
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
21
+
22
+ import google.auth # type: ignore
23
+ import google.protobuf.message
24
+ import grpc # type: ignore
25
+ import proto # type: ignore
26
+ from google.api_core import gapic_v1, grpc_helpers
27
+ from google.auth import credentials as ga_credentials # type: ignore
28
+ from google.auth.transport.grpc import SslCredentials # type: ignore
29
+ from google.protobuf.json_format import MessageToJson
30
+
31
+ from google.cloud.bigquery_storage_v1beta2.types import storage, stream
32
+
33
+ from .base import DEFAULT_CLIENT_INFO, BigQueryReadTransport
34
+
35
+ try:
36
+ from google.api_core import client_logging # type: ignore
37
+
38
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
39
+ except ImportError: # pragma: NO COVER
40
+ CLIENT_LOGGING_SUPPORTED = False
41
+
42
+ _LOGGER = std_logging.getLogger(__name__)
43
+
44
+
45
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
46
+ def intercept_unary_unary(self, continuation, client_call_details, request):
47
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
48
+ std_logging.DEBUG
49
+ )
50
+ if logging_enabled: # pragma: NO COVER
51
+ request_metadata = client_call_details.metadata
52
+ if isinstance(request, proto.Message):
53
+ request_payload = type(request).to_json(request)
54
+ elif isinstance(request, google.protobuf.message.Message):
55
+ request_payload = MessageToJson(request)
56
+ else:
57
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}"
58
+
59
+ request_metadata = {
60
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
61
+ for key, value in request_metadata
62
+ }
63
+ grpc_request = {
64
+ "payload": request_payload,
65
+ "requestMethod": "grpc",
66
+ "metadata": dict(request_metadata),
67
+ }
68
+ _LOGGER.debug(
69
+ f"Sending request for {client_call_details.method}",
70
+ extra={
71
+ "serviceName": "google.cloud.bigquery.storage.v1beta2.BigQueryRead",
72
+ "rpcName": str(client_call_details.method),
73
+ "request": grpc_request,
74
+ "metadata": grpc_request["metadata"],
75
+ },
76
+ )
77
+ response = continuation(client_call_details, request)
78
+ if logging_enabled: # pragma: NO COVER
79
+ response_metadata = response.trailing_metadata()
80
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
81
+ metadata = (
82
+ dict([(k, str(v)) for k, v in response_metadata])
83
+ if response_metadata
84
+ else None
85
+ )
86
+ result = response.result()
87
+ if isinstance(result, proto.Message):
88
+ response_payload = type(result).to_json(result)
89
+ elif isinstance(result, google.protobuf.message.Message):
90
+ response_payload = MessageToJson(result)
91
+ else:
92
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}"
93
+ grpc_response = {
94
+ "payload": response_payload,
95
+ "metadata": metadata,
96
+ "status": "OK",
97
+ }
98
+ _LOGGER.debug(
99
+ f"Received response for {client_call_details.method}.",
100
+ extra={
101
+ "serviceName": "google.cloud.bigquery.storage.v1beta2.BigQueryRead",
102
+ "rpcName": client_call_details.method,
103
+ "response": grpc_response,
104
+ "metadata": grpc_response["metadata"],
105
+ },
106
+ )
107
+ return response
108
+
109
+
110
+ class BigQueryReadGrpcTransport(BigQueryReadTransport):
111
+ """gRPC backend transport for BigQueryRead.
112
+
113
+ BigQuery Read API.
114
+
115
+ The Read API can be used to read data from BigQuery.
116
+
117
+ New code should use the v1 Read API going forward, if they don't
118
+ use Write API at the same time.
119
+
120
+ This class defines the same methods as the primary client, so the
121
+ primary client can load the underlying transport implementation
122
+ and call it.
123
+
124
+ It sends protocol buffers over the wire using gRPC (which is built on
125
+ top of HTTP/2); the ``grpcio`` package must be installed.
126
+ """
127
+
128
+ _stubs: Dict[str, Callable]
129
+
130
+ def __init__(
131
+ self,
132
+ *,
133
+ host: str = "bigquerystorage.googleapis.com",
134
+ credentials: Optional[ga_credentials.Credentials] = None,
135
+ credentials_file: Optional[str] = None,
136
+ scopes: Optional[Sequence[str]] = None,
137
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
138
+ api_mtls_endpoint: Optional[str] = None,
139
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
140
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
141
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
142
+ quota_project_id: Optional[str] = None,
143
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
144
+ always_use_jwt_access: Optional[bool] = False,
145
+ api_audience: Optional[str] = None,
146
+ ) -> None:
147
+ """Instantiate the transport.
148
+
149
+ Args:
150
+ host (Optional[str]):
151
+ The hostname to connect to (default: 'bigquerystorage.googleapis.com').
152
+ credentials (Optional[google.auth.credentials.Credentials]): The
153
+ authorization credentials to attach to requests. These
154
+ credentials identify the application to the service; if none
155
+ are specified, the client will attempt to ascertain the
156
+ credentials from the environment.
157
+ This argument is ignored if a ``channel`` instance is provided.
158
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
159
+ be loaded with :func:`google.auth.load_credentials_from_file`.
160
+ This argument is ignored if a ``channel`` instance is provided.
161
+ This argument will be removed in the next major version of this library.
162
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
163
+ ignored if a ``channel`` instance is provided.
164
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
165
+ A ``Channel`` instance through which to make calls, or a Callable
166
+ that constructs and returns one. If set to None, ``self.create_channel``
167
+ is used to create the channel. If a Callable is given, it will be called
168
+ with the same arguments as used in ``self.create_channel``.
169
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
170
+ If provided, it overrides the ``host`` argument and tries to create
171
+ a mutual TLS channel with client SSL credentials from
172
+ ``client_cert_source`` or application default SSL credentials.
173
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
174
+ Deprecated. A callback to provide client SSL certificate bytes and
175
+ private key bytes, both in PEM format. It is ignored if
176
+ ``api_mtls_endpoint`` is None.
177
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
178
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
179
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
180
+ A callback to provide client certificate bytes and private key bytes,
181
+ both in PEM format. It is used to configure a mutual TLS channel. It is
182
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
183
+ quota_project_id (Optional[str]): An optional project to use for billing
184
+ and quota.
185
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
186
+ The client info used to send a user-agent string along with
187
+ API requests. If ``None``, then default info will be used.
188
+ Generally, you only need to set this if you're developing
189
+ your own client library.
190
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
191
+ be used for service account credentials.
192
+ api_audience (Optional[str]): The intended audience for the API calls
193
+ to the service that will be set when using certain 3rd party
194
+ authentication flows. Audience is typically a resource identifier.
195
+ If not set, the host value will be used as a default.
196
+
197
+ Raises:
198
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
199
+ creation failed for any reason.
200
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
201
+ and ``credentials_file`` are passed.
202
+ """
203
+ self._grpc_channel = None
204
+ self._ssl_channel_credentials = ssl_channel_credentials
205
+ self._stubs: Dict[str, Callable] = {}
206
+
207
+ if api_mtls_endpoint:
208
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
209
+ if client_cert_source:
210
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
211
+
212
+ if isinstance(channel, grpc.Channel):
213
+ # Ignore credentials if a channel was passed.
214
+ credentials = None
215
+ self._ignore_credentials = True
216
+ # If a channel was explicitly provided, set it.
217
+ self._grpc_channel = channel
218
+ self._ssl_channel_credentials = None
219
+
220
+ else:
221
+ if api_mtls_endpoint:
222
+ host = api_mtls_endpoint
223
+
224
+ # Create SSL credentials with client_cert_source or application
225
+ # default SSL credentials.
226
+ if client_cert_source:
227
+ cert, key = client_cert_source()
228
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
229
+ certificate_chain=cert, private_key=key
230
+ )
231
+ else:
232
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
233
+
234
+ else:
235
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
236
+ cert, key = client_cert_source_for_mtls()
237
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
238
+ certificate_chain=cert, private_key=key
239
+ )
240
+
241
+ # The base transport sets the host, credentials and scopes
242
+ super().__init__(
243
+ host=host,
244
+ credentials=credentials,
245
+ credentials_file=credentials_file,
246
+ scopes=scopes,
247
+ quota_project_id=quota_project_id,
248
+ client_info=client_info,
249
+ always_use_jwt_access=always_use_jwt_access,
250
+ api_audience=api_audience,
251
+ )
252
+
253
+ if not self._grpc_channel:
254
+ # initialize with the provided callable or the default channel
255
+ channel_init = channel or type(self).create_channel
256
+ self._grpc_channel = channel_init(
257
+ self._host,
258
+ # use the credentials which are saved
259
+ credentials=self._credentials,
260
+ # Set ``credentials_file`` to ``None`` here as
261
+ # the credentials that we saved earlier should be used.
262
+ credentials_file=None,
263
+ scopes=self._scopes,
264
+ ssl_credentials=self._ssl_channel_credentials,
265
+ quota_project_id=quota_project_id,
266
+ options=[
267
+ ("grpc.max_send_message_length", -1),
268
+ ("grpc.max_receive_message_length", -1),
269
+ ],
270
+ )
271
+
272
+ self._interceptor = _LoggingClientInterceptor()
273
+ self._logged_channel = grpc.intercept_channel(
274
+ self._grpc_channel, self._interceptor
275
+ )
276
+
277
+ # Wrap messages. This must be done after self._logged_channel exists
278
+ self._prep_wrapped_messages(client_info)
279
+
280
+ @classmethod
281
+ def create_channel(
282
+ cls,
283
+ host: str = "bigquerystorage.googleapis.com",
284
+ credentials: Optional[ga_credentials.Credentials] = None,
285
+ credentials_file: Optional[str] = None,
286
+ scopes: Optional[Sequence[str]] = None,
287
+ quota_project_id: Optional[str] = None,
288
+ **kwargs,
289
+ ) -> grpc.Channel:
290
+ """Create and return a gRPC channel object.
291
+ Args:
292
+ host (Optional[str]): The host for the channel to use.
293
+ credentials (Optional[~.Credentials]): The
294
+ authorization credentials to attach to requests. These
295
+ credentials identify this application to the service. If
296
+ none are specified, the client will attempt to ascertain
297
+ the credentials from the environment.
298
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
299
+ be loaded with :func:`google.auth.load_credentials_from_file`.
300
+ This argument is mutually exclusive with credentials. This argument will be
301
+ removed in the next major version of this library.
302
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
303
+ service. These are only used when credentials are not specified and
304
+ are passed to :func:`google.auth.default`.
305
+ quota_project_id (Optional[str]): An optional project to use for billing
306
+ and quota.
307
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
308
+ channel creation.
309
+ Returns:
310
+ grpc.Channel: A gRPC channel object.
311
+
312
+ Raises:
313
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
314
+ and ``credentials_file`` are passed.
315
+ """
316
+
317
+ return grpc_helpers.create_channel(
318
+ host,
319
+ credentials=credentials,
320
+ credentials_file=credentials_file,
321
+ quota_project_id=quota_project_id,
322
+ default_scopes=cls.AUTH_SCOPES,
323
+ scopes=scopes,
324
+ default_host=cls.DEFAULT_HOST,
325
+ **kwargs,
326
+ )
327
+
328
+ @property
329
+ def grpc_channel(self) -> grpc.Channel:
330
+ """Return the channel designed to connect to this service."""
331
+ return self._grpc_channel
332
+
333
+ @property
334
+ def create_read_session(
335
+ self,
336
+ ) -> Callable[[storage.CreateReadSessionRequest], stream.ReadSession]:
337
+ r"""Return a callable for the create read session method over gRPC.
338
+
339
+ Creates a new read session. A read session divides
340
+ the contents of a BigQuery table into one or more
341
+ streams, which can then be used to read data from the
342
+ table. The read session also specifies properties of the
343
+ data to be read, such as a list of columns or a
344
+ push-down filter describing the rows to be returned.
345
+
346
+ A particular row can be read by at most one stream. When
347
+ the caller has reached the end of each stream in the
348
+ session, then all the data in the table has been read.
349
+
350
+ Data is assigned to each stream such that roughly the
351
+ same number of rows can be read from each stream.
352
+ Because the server-side unit for assigning data is
353
+ collections of rows, the API does not guarantee that
354
+ each stream will return the same number or rows.
355
+ Additionally, the limits are enforced based on the
356
+ number of pre-filtered rows, so some filters can lead to
357
+ lopsided assignments.
358
+
359
+ Read sessions automatically expire 6 hours after they
360
+ are created and do not require manual clean-up by the
361
+ caller.
362
+
363
+ Returns:
364
+ Callable[[~.CreateReadSessionRequest],
365
+ ~.ReadSession]:
366
+ A function that, when called, will call the underlying RPC
367
+ on the server.
368
+ """
369
+ # Generate a "stub function" on-the-fly which will actually make
370
+ # the request.
371
+ # gRPC handles serialization and deserialization, so we just need
372
+ # to pass in the functions for each.
373
+ if "create_read_session" not in self._stubs:
374
+ self._stubs["create_read_session"] = self._logged_channel.unary_unary(
375
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryRead/CreateReadSession",
376
+ request_serializer=storage.CreateReadSessionRequest.serialize,
377
+ response_deserializer=stream.ReadSession.deserialize,
378
+ )
379
+ return self._stubs["create_read_session"]
380
+
381
+ @property
382
+ def read_rows(
383
+ self,
384
+ ) -> Callable[[storage.ReadRowsRequest], storage.ReadRowsResponse]:
385
+ r"""Return a callable for the read rows method over gRPC.
386
+
387
+ Reads rows from the stream in the format prescribed
388
+ by the ReadSession. Each response contains one or more
389
+ table rows, up to a maximum of 100 MiB per response;
390
+ read requests which attempt to read individual rows
391
+ larger than 100 MiB will fail.
392
+
393
+ Each request also returns a set of stream statistics
394
+ reflecting the current state of the stream.
395
+
396
+ Returns:
397
+ Callable[[~.ReadRowsRequest],
398
+ ~.ReadRowsResponse]:
399
+ A function that, when called, will call the underlying RPC
400
+ on the server.
401
+ """
402
+ # Generate a "stub function" on-the-fly which will actually make
403
+ # the request.
404
+ # gRPC handles serialization and deserialization, so we just need
405
+ # to pass in the functions for each.
406
+ if "read_rows" not in self._stubs:
407
+ self._stubs["read_rows"] = self._logged_channel.unary_stream(
408
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryRead/ReadRows",
409
+ request_serializer=storage.ReadRowsRequest.serialize,
410
+ response_deserializer=storage.ReadRowsResponse.deserialize,
411
+ )
412
+ return self._stubs["read_rows"]
413
+
414
+ @property
415
+ def split_read_stream(
416
+ self,
417
+ ) -> Callable[[storage.SplitReadStreamRequest], storage.SplitReadStreamResponse]:
418
+ r"""Return a callable for the split read stream method over gRPC.
419
+
420
+ Splits a given ``ReadStream`` into two ``ReadStream`` objects.
421
+ These ``ReadStream`` objects are referred to as the primary and
422
+ the residual streams of the split. The original ``ReadStream``
423
+ can still be read from in the same manner as before. Both of the
424
+ returned ``ReadStream`` objects can also be read from, and the
425
+ rows returned by both child streams will be the same as the rows
426
+ read from the original stream.
427
+
428
+ Moreover, the two child streams will be allocated back-to-back
429
+ in the original ``ReadStream``. Concretely, it is guaranteed
430
+ that for streams original, primary, and residual, that
431
+ original[0-j] = primary[0-j] and original[j-n] = residual[0-m]
432
+ once the streams have been read to completion.
433
+
434
+ Returns:
435
+ Callable[[~.SplitReadStreamRequest],
436
+ ~.SplitReadStreamResponse]:
437
+ A function that, when called, will call the underlying RPC
438
+ on the server.
439
+ """
440
+ # Generate a "stub function" on-the-fly which will actually make
441
+ # the request.
442
+ # gRPC handles serialization and deserialization, so we just need
443
+ # to pass in the functions for each.
444
+ if "split_read_stream" not in self._stubs:
445
+ self._stubs["split_read_stream"] = self._logged_channel.unary_unary(
446
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryRead/SplitReadStream",
447
+ request_serializer=storage.SplitReadStreamRequest.serialize,
448
+ response_deserializer=storage.SplitReadStreamResponse.deserialize,
449
+ )
450
+ return self._stubs["split_read_stream"]
451
+
452
+ def close(self):
453
+ self._logged_channel.close()
454
+
455
+ @property
456
+ def kind(self) -> str:
457
+ return "grpc"
458
+
459
+
460
+ __all__ = ("BigQueryReadGrpcTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc_asyncio.py ADDED
@@ -0,0 +1,524 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import inspect
17
+ import json
18
+ import logging as std_logging
19
+ import pickle
20
+ import warnings
21
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
22
+
23
+ import google.protobuf.message
24
+ import grpc # type: ignore
25
+ import proto # type: ignore
26
+ from google.api_core import exceptions as core_exceptions
27
+ from google.api_core import gapic_v1, grpc_helpers_async
28
+ from google.api_core import retry_async as retries
29
+ from google.auth import credentials as ga_credentials # type: ignore
30
+ from google.auth.transport.grpc import SslCredentials # type: ignore
31
+ from google.protobuf.json_format import MessageToJson
32
+ from grpc.experimental import aio # type: ignore
33
+
34
+ from google.cloud.bigquery_storage_v1beta2.types import storage, stream
35
+
36
+ from .base import DEFAULT_CLIENT_INFO, BigQueryReadTransport
37
+ from .grpc import BigQueryReadGrpcTransport
38
+
39
+ try:
40
+ from google.api_core import client_logging # type: ignore
41
+
42
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
43
+ except ImportError: # pragma: NO COVER
44
+ CLIENT_LOGGING_SUPPORTED = False
45
+
46
+ _LOGGER = std_logging.getLogger(__name__)
47
+
48
+
49
+ class _LoggingClientAIOInterceptor(
50
+ grpc.aio.UnaryUnaryClientInterceptor
51
+ ): # pragma: NO COVER
52
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
53
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
54
+ std_logging.DEBUG
55
+ )
56
+ if logging_enabled: # pragma: NO COVER
57
+ request_metadata = client_call_details.metadata
58
+ if isinstance(request, proto.Message):
59
+ request_payload = type(request).to_json(request)
60
+ elif isinstance(request, google.protobuf.message.Message):
61
+ request_payload = MessageToJson(request)
62
+ else:
63
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}"
64
+
65
+ request_metadata = {
66
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
67
+ for key, value in request_metadata
68
+ }
69
+ grpc_request = {
70
+ "payload": request_payload,
71
+ "requestMethod": "grpc",
72
+ "metadata": dict(request_metadata),
73
+ }
74
+ _LOGGER.debug(
75
+ f"Sending request for {client_call_details.method}",
76
+ extra={
77
+ "serviceName": "google.cloud.bigquery.storage.v1beta2.BigQueryRead",
78
+ "rpcName": str(client_call_details.method),
79
+ "request": grpc_request,
80
+ "metadata": grpc_request["metadata"],
81
+ },
82
+ )
83
+ response = await continuation(client_call_details, request)
84
+ if logging_enabled: # pragma: NO COVER
85
+ response_metadata = await response.trailing_metadata()
86
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
87
+ metadata = (
88
+ dict([(k, str(v)) for k, v in response_metadata])
89
+ if response_metadata
90
+ else None
91
+ )
92
+ result = await response
93
+ if isinstance(result, proto.Message):
94
+ response_payload = type(result).to_json(result)
95
+ elif isinstance(result, google.protobuf.message.Message):
96
+ response_payload = MessageToJson(result)
97
+ else:
98
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}"
99
+ grpc_response = {
100
+ "payload": response_payload,
101
+ "metadata": metadata,
102
+ "status": "OK",
103
+ }
104
+ _LOGGER.debug(
105
+ f"Received response to rpc {client_call_details.method}.",
106
+ extra={
107
+ "serviceName": "google.cloud.bigquery.storage.v1beta2.BigQueryRead",
108
+ "rpcName": str(client_call_details.method),
109
+ "response": grpc_response,
110
+ "metadata": grpc_response["metadata"],
111
+ },
112
+ )
113
+ return response
114
+
115
+
116
+ class BigQueryReadGrpcAsyncIOTransport(BigQueryReadTransport):
117
+ """gRPC AsyncIO backend transport for BigQueryRead.
118
+
119
+ BigQuery Read API.
120
+
121
+ The Read API can be used to read data from BigQuery.
122
+
123
+ New code should use the v1 Read API going forward, if they don't
124
+ use Write API at the same time.
125
+
126
+ This class defines the same methods as the primary client, so the
127
+ primary client can load the underlying transport implementation
128
+ and call it.
129
+
130
+ It sends protocol buffers over the wire using gRPC (which is built on
131
+ top of HTTP/2); the ``grpcio`` package must be installed.
132
+ """
133
+
134
+ _grpc_channel: aio.Channel
135
+ _stubs: Dict[str, Callable] = {}
136
+
137
+ @classmethod
138
+ def create_channel(
139
+ cls,
140
+ host: str = "bigquerystorage.googleapis.com",
141
+ credentials: Optional[ga_credentials.Credentials] = None,
142
+ credentials_file: Optional[str] = None,
143
+ scopes: Optional[Sequence[str]] = None,
144
+ quota_project_id: Optional[str] = None,
145
+ **kwargs,
146
+ ) -> aio.Channel:
147
+ """Create and return a gRPC AsyncIO channel object.
148
+ Args:
149
+ host (Optional[str]): The host for the channel to use.
150
+ credentials (Optional[~.Credentials]): The
151
+ authorization credentials to attach to requests. These
152
+ credentials identify this application to the service. If
153
+ none are specified, the client will attempt to ascertain
154
+ the credentials from the environment.
155
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
156
+ be loaded with :func:`google.auth.load_credentials_from_file`. This argument will be
157
+ removed in the next major version of this library.
158
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
159
+ service. These are only used when credentials are not specified and
160
+ are passed to :func:`google.auth.default`.
161
+ quota_project_id (Optional[str]): An optional project to use for billing
162
+ and quota.
163
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
164
+ channel creation.
165
+ Returns:
166
+ aio.Channel: A gRPC AsyncIO channel object.
167
+ """
168
+
169
+ return grpc_helpers_async.create_channel(
170
+ host,
171
+ credentials=credentials,
172
+ credentials_file=credentials_file,
173
+ quota_project_id=quota_project_id,
174
+ default_scopes=cls.AUTH_SCOPES,
175
+ scopes=scopes,
176
+ default_host=cls.DEFAULT_HOST,
177
+ **kwargs,
178
+ )
179
+
180
+ def __init__(
181
+ self,
182
+ *,
183
+ host: str = "bigquerystorage.googleapis.com",
184
+ credentials: Optional[ga_credentials.Credentials] = None,
185
+ credentials_file: Optional[str] = None,
186
+ scopes: Optional[Sequence[str]] = None,
187
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
188
+ api_mtls_endpoint: Optional[str] = None,
189
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
190
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
191
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
192
+ quota_project_id: Optional[str] = None,
193
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
194
+ always_use_jwt_access: Optional[bool] = False,
195
+ api_audience: Optional[str] = None,
196
+ ) -> None:
197
+ """Instantiate the transport.
198
+
199
+ Args:
200
+ host (Optional[str]):
201
+ The hostname to connect to (default: 'bigquerystorage.googleapis.com').
202
+ credentials (Optional[google.auth.credentials.Credentials]): The
203
+ authorization credentials to attach to requests. These
204
+ credentials identify the application to the service; if none
205
+ are specified, the client will attempt to ascertain the
206
+ credentials from the environment.
207
+ This argument is ignored if a ``channel`` instance is provided.
208
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
209
+ be loaded with :func:`google.auth.load_credentials_from_file`.
210
+ This argument is ignored if a ``channel`` instance is provided.
211
+ This argument will be removed in the next major version of this library.
212
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
213
+ service. These are only used when credentials are not specified and
214
+ are passed to :func:`google.auth.default`.
215
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
216
+ A ``Channel`` instance through which to make calls, or a Callable
217
+ that constructs and returns one. If set to None, ``self.create_channel``
218
+ is used to create the channel. If a Callable is given, it will be called
219
+ with the same arguments as used in ``self.create_channel``.
220
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
221
+ If provided, it overrides the ``host`` argument and tries to create
222
+ a mutual TLS channel with client SSL credentials from
223
+ ``client_cert_source`` or application default SSL credentials.
224
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
225
+ Deprecated. A callback to provide client SSL certificate bytes and
226
+ private key bytes, both in PEM format. It is ignored if
227
+ ``api_mtls_endpoint`` is None.
228
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
229
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
230
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
231
+ A callback to provide client certificate bytes and private key bytes,
232
+ both in PEM format. It is used to configure a mutual TLS channel. It is
233
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
234
+ quota_project_id (Optional[str]): An optional project to use for billing
235
+ and quota.
236
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
237
+ The client info used to send a user-agent string along with
238
+ API requests. If ``None``, then default info will be used.
239
+ Generally, you only need to set this if you're developing
240
+ your own client library.
241
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
242
+ be used for service account credentials.
243
+ api_audience (Optional[str]): The intended audience for the API calls
244
+ to the service that will be set when using certain 3rd party
245
+ authentication flows. Audience is typically a resource identifier.
246
+ If not set, the host value will be used as a default.
247
+
248
+ Raises:
249
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
250
+ creation failed for any reason.
251
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
252
+ and ``credentials_file`` are passed.
253
+ """
254
+ self._grpc_channel = None
255
+ self._ssl_channel_credentials = ssl_channel_credentials
256
+ self._stubs: Dict[str, Callable] = {}
257
+
258
+ if api_mtls_endpoint:
259
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
260
+ if client_cert_source:
261
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
262
+
263
+ if isinstance(channel, aio.Channel):
264
+ # Ignore credentials if a channel was passed.
265
+ credentials = None
266
+ self._ignore_credentials = True
267
+ # If a channel was explicitly provided, set it.
268
+ self._grpc_channel = channel
269
+ self._ssl_channel_credentials = None
270
+ else:
271
+ if api_mtls_endpoint:
272
+ host = api_mtls_endpoint
273
+
274
+ # Create SSL credentials with client_cert_source or application
275
+ # default SSL credentials.
276
+ if client_cert_source:
277
+ cert, key = client_cert_source()
278
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
279
+ certificate_chain=cert, private_key=key
280
+ )
281
+ else:
282
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
283
+
284
+ else:
285
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
286
+ cert, key = client_cert_source_for_mtls()
287
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
288
+ certificate_chain=cert, private_key=key
289
+ )
290
+
291
+ # The base transport sets the host, credentials and scopes
292
+ super().__init__(
293
+ host=host,
294
+ credentials=credentials,
295
+ credentials_file=credentials_file,
296
+ scopes=scopes,
297
+ quota_project_id=quota_project_id,
298
+ client_info=client_info,
299
+ always_use_jwt_access=always_use_jwt_access,
300
+ api_audience=api_audience,
301
+ )
302
+
303
+ if not self._grpc_channel:
304
+ # initialize with the provided callable or the default channel
305
+ channel_init = channel or type(self).create_channel
306
+ self._grpc_channel = channel_init(
307
+ self._host,
308
+ # use the credentials which are saved
309
+ credentials=self._credentials,
310
+ # Set ``credentials_file`` to ``None`` here as
311
+ # the credentials that we saved earlier should be used.
312
+ credentials_file=None,
313
+ scopes=self._scopes,
314
+ ssl_credentials=self._ssl_channel_credentials,
315
+ quota_project_id=quota_project_id,
316
+ options=[
317
+ ("grpc.max_send_message_length", -1),
318
+ ("grpc.max_receive_message_length", -1),
319
+ ],
320
+ )
321
+
322
+ self._interceptor = _LoggingClientAIOInterceptor()
323
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
324
+ self._logged_channel = self._grpc_channel
325
+ self._wrap_with_kind = (
326
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
327
+ )
328
+ # Wrap messages. This must be done after self._logged_channel exists
329
+ self._prep_wrapped_messages(client_info)
330
+
331
+ @property
332
+ def grpc_channel(self) -> aio.Channel:
333
+ """Create the channel designed to connect to this service.
334
+
335
+ This property caches on the instance; repeated calls return
336
+ the same channel.
337
+ """
338
+ # Return the channel from cache.
339
+ return self._grpc_channel
340
+
341
+ @property
342
+ def create_read_session(
343
+ self,
344
+ ) -> Callable[[storage.CreateReadSessionRequest], Awaitable[stream.ReadSession]]:
345
+ r"""Return a callable for the create read session method over gRPC.
346
+
347
+ Creates a new read session. A read session divides
348
+ the contents of a BigQuery table into one or more
349
+ streams, which can then be used to read data from the
350
+ table. The read session also specifies properties of the
351
+ data to be read, such as a list of columns or a
352
+ push-down filter describing the rows to be returned.
353
+
354
+ A particular row can be read by at most one stream. When
355
+ the caller has reached the end of each stream in the
356
+ session, then all the data in the table has been read.
357
+
358
+ Data is assigned to each stream such that roughly the
359
+ same number of rows can be read from each stream.
360
+ Because the server-side unit for assigning data is
361
+ collections of rows, the API does not guarantee that
362
+ each stream will return the same number or rows.
363
+ Additionally, the limits are enforced based on the
364
+ number of pre-filtered rows, so some filters can lead to
365
+ lopsided assignments.
366
+
367
+ Read sessions automatically expire 6 hours after they
368
+ are created and do not require manual clean-up by the
369
+ caller.
370
+
371
+ Returns:
372
+ Callable[[~.CreateReadSessionRequest],
373
+ Awaitable[~.ReadSession]]:
374
+ A function that, when called, will call the underlying RPC
375
+ on the server.
376
+ """
377
+ # Generate a "stub function" on-the-fly which will actually make
378
+ # the request.
379
+ # gRPC handles serialization and deserialization, so we just need
380
+ # to pass in the functions for each.
381
+ if "create_read_session" not in self._stubs:
382
+ self._stubs["create_read_session"] = self._logged_channel.unary_unary(
383
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryRead/CreateReadSession",
384
+ request_serializer=storage.CreateReadSessionRequest.serialize,
385
+ response_deserializer=stream.ReadSession.deserialize,
386
+ )
387
+ return self._stubs["create_read_session"]
388
+
389
+ @property
390
+ def read_rows(
391
+ self,
392
+ ) -> Callable[[storage.ReadRowsRequest], Awaitable[storage.ReadRowsResponse]]:
393
+ r"""Return a callable for the read rows method over gRPC.
394
+
395
+ Reads rows from the stream in the format prescribed
396
+ by the ReadSession. Each response contains one or more
397
+ table rows, up to a maximum of 100 MiB per response;
398
+ read requests which attempt to read individual rows
399
+ larger than 100 MiB will fail.
400
+
401
+ Each request also returns a set of stream statistics
402
+ reflecting the current state of the stream.
403
+
404
+ Returns:
405
+ Callable[[~.ReadRowsRequest],
406
+ Awaitable[~.ReadRowsResponse]]:
407
+ A function that, when called, will call the underlying RPC
408
+ on the server.
409
+ """
410
+ # Generate a "stub function" on-the-fly which will actually make
411
+ # the request.
412
+ # gRPC handles serialization and deserialization, so we just need
413
+ # to pass in the functions for each.
414
+ if "read_rows" not in self._stubs:
415
+ self._stubs["read_rows"] = self._logged_channel.unary_stream(
416
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryRead/ReadRows",
417
+ request_serializer=storage.ReadRowsRequest.serialize,
418
+ response_deserializer=storage.ReadRowsResponse.deserialize,
419
+ )
420
+ return self._stubs["read_rows"]
421
+
422
+ @property
423
+ def split_read_stream(
424
+ self,
425
+ ) -> Callable[
426
+ [storage.SplitReadStreamRequest], Awaitable[storage.SplitReadStreamResponse]
427
+ ]:
428
+ r"""Return a callable for the split read stream method over gRPC.
429
+
430
+ Splits a given ``ReadStream`` into two ``ReadStream`` objects.
431
+ These ``ReadStream`` objects are referred to as the primary and
432
+ the residual streams of the split. The original ``ReadStream``
433
+ can still be read from in the same manner as before. Both of the
434
+ returned ``ReadStream`` objects can also be read from, and the
435
+ rows returned by both child streams will be the same as the rows
436
+ read from the original stream.
437
+
438
+ Moreover, the two child streams will be allocated back-to-back
439
+ in the original ``ReadStream``. Concretely, it is guaranteed
440
+ that for streams original, primary, and residual, that
441
+ original[0-j] = primary[0-j] and original[j-n] = residual[0-m]
442
+ once the streams have been read to completion.
443
+
444
+ Returns:
445
+ Callable[[~.SplitReadStreamRequest],
446
+ Awaitable[~.SplitReadStreamResponse]]:
447
+ A function that, when called, will call the underlying RPC
448
+ on the server.
449
+ """
450
+ # Generate a "stub function" on-the-fly which will actually make
451
+ # the request.
452
+ # gRPC handles serialization and deserialization, so we just need
453
+ # to pass in the functions for each.
454
+ if "split_read_stream" not in self._stubs:
455
+ self._stubs["split_read_stream"] = self._logged_channel.unary_unary(
456
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryRead/SplitReadStream",
457
+ request_serializer=storage.SplitReadStreamRequest.serialize,
458
+ response_deserializer=storage.SplitReadStreamResponse.deserialize,
459
+ )
460
+ return self._stubs["split_read_stream"]
461
+
462
+ def _prep_wrapped_messages(self, client_info):
463
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
464
+ self._wrapped_methods = {
465
+ self.create_read_session: self._wrap_method(
466
+ self.create_read_session,
467
+ default_retry=retries.AsyncRetry(
468
+ initial=0.1,
469
+ maximum=60.0,
470
+ multiplier=1.3,
471
+ predicate=retries.if_exception_type(
472
+ core_exceptions.DeadlineExceeded,
473
+ core_exceptions.ServiceUnavailable,
474
+ ),
475
+ deadline=600.0,
476
+ ),
477
+ default_timeout=600.0,
478
+ client_info=client_info,
479
+ ),
480
+ self.read_rows: self._wrap_method(
481
+ self.read_rows,
482
+ default_retry=retries.AsyncRetry(
483
+ initial=0.1,
484
+ maximum=60.0,
485
+ multiplier=1.3,
486
+ predicate=retries.if_exception_type(
487
+ core_exceptions.ServiceUnavailable,
488
+ ),
489
+ deadline=86400.0,
490
+ ),
491
+ default_timeout=86400.0,
492
+ client_info=client_info,
493
+ ),
494
+ self.split_read_stream: self._wrap_method(
495
+ self.split_read_stream,
496
+ default_retry=retries.AsyncRetry(
497
+ initial=0.1,
498
+ maximum=60.0,
499
+ multiplier=1.3,
500
+ predicate=retries.if_exception_type(
501
+ core_exceptions.DeadlineExceeded,
502
+ core_exceptions.ServiceUnavailable,
503
+ ),
504
+ deadline=600.0,
505
+ ),
506
+ default_timeout=600.0,
507
+ client_info=client_info,
508
+ ),
509
+ }
510
+
511
+ def _wrap_method(self, func, *args, **kwargs):
512
+ if self._wrap_with_kind: # pragma: NO COVER
513
+ kwargs["kind"] = self.kind
514
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
515
+
516
+ def close(self):
517
+ return self._logged_channel.close()
518
+
519
+ @property
520
+ def kind(self) -> str:
521
+ return "grpc_asyncio"
522
+
523
+
524
+ __all__ = ("BigQueryReadGrpcAsyncIOTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (423 Bytes). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/__pycache__/async_client.cpython-311.pyc ADDED
Binary file (43.4 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/__pycache__/client.cpython-311.pyc ADDED
Binary file (62.3 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__init__.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from collections import OrderedDict
17
+ from typing import Dict, Type
18
+
19
+ from .base import BigQueryWriteTransport
20
+ from .grpc import BigQueryWriteGrpcTransport
21
+ from .grpc_asyncio import BigQueryWriteGrpcAsyncIOTransport
22
+
23
+ # Compile a registry of transports.
24
+ _transport_registry = OrderedDict() # type: Dict[str, Type[BigQueryWriteTransport]]
25
+ _transport_registry["grpc"] = BigQueryWriteGrpcTransport
26
+ _transport_registry["grpc_asyncio"] = BigQueryWriteGrpcAsyncIOTransport
27
+
28
+ __all__ = (
29
+ "BigQueryWriteTransport",
30
+ "BigQueryWriteGrpcTransport",
31
+ "BigQueryWriteGrpcAsyncIOTransport",
32
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (767 Bytes). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__pycache__/base.cpython-311.pyc ADDED
Binary file (11.6 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__pycache__/grpc.cpython-311.pyc ADDED
Binary file (24.7 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__pycache__/grpc_asyncio.cpython-311.pyc ADDED
Binary file (28.4 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/base.py ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import abc
17
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18
+
19
+ import google.api_core
20
+ import google.auth # type: ignore
21
+ import google.protobuf
22
+ from google.api_core import exceptions as core_exceptions
23
+ from google.api_core import gapic_v1
24
+ from google.api_core import retry as retries
25
+ from google.auth import credentials as ga_credentials # type: ignore
26
+ from google.oauth2 import service_account # type: ignore
27
+
28
+ from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version
29
+ from google.cloud.bigquery_storage_v1beta2.types import storage, stream
30
+
31
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32
+ gapic_version=package_version.__version__
33
+ )
34
+
35
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
36
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
37
+
38
+
39
+ class BigQueryWriteTransport(abc.ABC):
40
+ """Abstract transport class for BigQueryWrite."""
41
+
42
+ AUTH_SCOPES = (
43
+ "https://www.googleapis.com/auth/bigquery",
44
+ "https://www.googleapis.com/auth/bigquery.insertdata",
45
+ "https://www.googleapis.com/auth/cloud-platform",
46
+ )
47
+
48
+ DEFAULT_HOST: str = "bigquerystorage.googleapis.com"
49
+
50
+ def __init__(
51
+ self,
52
+ *,
53
+ host: str = DEFAULT_HOST,
54
+ credentials: Optional[ga_credentials.Credentials] = None,
55
+ credentials_file: Optional[str] = None,
56
+ scopes: Optional[Sequence[str]] = None,
57
+ quota_project_id: Optional[str] = None,
58
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
59
+ always_use_jwt_access: Optional[bool] = False,
60
+ api_audience: Optional[str] = None,
61
+ **kwargs,
62
+ ) -> None:
63
+ """Instantiate the transport.
64
+
65
+ Args:
66
+ host (Optional[str]):
67
+ The hostname to connect to (default: 'bigquerystorage.googleapis.com').
68
+ credentials (Optional[google.auth.credentials.Credentials]): The
69
+ authorization credentials to attach to requests. These
70
+ credentials identify the application to the service; if none
71
+ are specified, the client will attempt to ascertain the
72
+ credentials from the environment.
73
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
74
+ be loaded with :func:`google.auth.load_credentials_from_file`.
75
+ This argument is mutually exclusive with credentials. This argument will be
76
+ removed in the next major version of this library.
77
+ scopes (Optional[Sequence[str]]): A list of scopes.
78
+ quota_project_id (Optional[str]): An optional project to use for billing
79
+ and quota.
80
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
81
+ The client info used to send a user-agent string along with
82
+ API requests. If ``None``, then default info will be used.
83
+ Generally, you only need to set this if you're developing
84
+ your own client library.
85
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
86
+ be used for service account credentials.
87
+ api_audience (Optional[str]): The intended audience for the API calls
88
+ to the service that will be set when using certain 3rd party
89
+ authentication flows. Audience is typically a resource identifier.
90
+ If not set, the host value will be used as a default.
91
+ """
92
+
93
+ # Save the scopes.
94
+ self._scopes = scopes
95
+ if not hasattr(self, "_ignore_credentials"):
96
+ self._ignore_credentials: bool = False
97
+
98
+ # If no credentials are provided, then determine the appropriate
99
+ # defaults.
100
+ if credentials and credentials_file:
101
+ raise core_exceptions.DuplicateCredentialArgs(
102
+ "'credentials_file' and 'credentials' are mutually exclusive"
103
+ )
104
+
105
+ if credentials_file is not None:
106
+ credentials, _ = google.auth.load_credentials_from_file(
107
+ credentials_file,
108
+ scopes=scopes,
109
+ quota_project_id=quota_project_id,
110
+ default_scopes=self.AUTH_SCOPES,
111
+ )
112
+ elif credentials is None and not self._ignore_credentials:
113
+ credentials, _ = google.auth.default(
114
+ scopes=scopes,
115
+ quota_project_id=quota_project_id,
116
+ default_scopes=self.AUTH_SCOPES,
117
+ )
118
+ # Don't apply audience if the credentials file passed from user.
119
+ if hasattr(credentials, "with_gdch_audience"):
120
+ credentials = credentials.with_gdch_audience(
121
+ api_audience if api_audience else host
122
+ )
123
+
124
+ # If the credentials are service account credentials, then always try to use self signed JWT.
125
+ if (
126
+ always_use_jwt_access
127
+ and isinstance(credentials, service_account.Credentials)
128
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
129
+ ):
130
+ credentials = credentials.with_always_use_jwt_access(True)
131
+
132
+ # Save the credentials.
133
+ self._credentials = credentials
134
+
135
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
136
+ if ":" not in host:
137
+ host += ":443"
138
+ self._host = host
139
+
140
+ self._wrapped_methods: Dict[Callable, Callable] = {}
141
+
142
+ @property
143
+ def host(self):
144
+ return self._host
145
+
146
+ def _prep_wrapped_messages(self, client_info):
147
+ # Precompute the wrapped methods.
148
+ self._wrapped_methods = {
149
+ self.create_write_stream: gapic_v1.method.wrap_method(
150
+ self.create_write_stream,
151
+ default_retry=retries.Retry(
152
+ initial=0.1,
153
+ maximum=60.0,
154
+ multiplier=1.3,
155
+ predicate=retries.if_exception_type(
156
+ core_exceptions.DeadlineExceeded,
157
+ core_exceptions.ResourceExhausted,
158
+ core_exceptions.ServiceUnavailable,
159
+ ),
160
+ deadline=600.0,
161
+ ),
162
+ default_timeout=600.0,
163
+ client_info=client_info,
164
+ ),
165
+ self.append_rows: gapic_v1.method.wrap_method(
166
+ self.append_rows,
167
+ default_retry=retries.Retry(
168
+ initial=0.1,
169
+ maximum=60.0,
170
+ multiplier=1.3,
171
+ predicate=retries.if_exception_type(
172
+ core_exceptions.ResourceExhausted,
173
+ core_exceptions.ServiceUnavailable,
174
+ ),
175
+ deadline=86400.0,
176
+ ),
177
+ default_timeout=86400.0,
178
+ client_info=client_info,
179
+ ),
180
+ self.get_write_stream: gapic_v1.method.wrap_method(
181
+ self.get_write_stream,
182
+ default_retry=retries.Retry(
183
+ initial=0.1,
184
+ maximum=60.0,
185
+ multiplier=1.3,
186
+ predicate=retries.if_exception_type(
187
+ core_exceptions.DeadlineExceeded,
188
+ core_exceptions.ServiceUnavailable,
189
+ ),
190
+ deadline=600.0,
191
+ ),
192
+ default_timeout=600.0,
193
+ client_info=client_info,
194
+ ),
195
+ self.finalize_write_stream: gapic_v1.method.wrap_method(
196
+ self.finalize_write_stream,
197
+ default_retry=retries.Retry(
198
+ initial=0.1,
199
+ maximum=60.0,
200
+ multiplier=1.3,
201
+ predicate=retries.if_exception_type(
202
+ core_exceptions.DeadlineExceeded,
203
+ core_exceptions.ServiceUnavailable,
204
+ ),
205
+ deadline=600.0,
206
+ ),
207
+ default_timeout=600.0,
208
+ client_info=client_info,
209
+ ),
210
+ self.batch_commit_write_streams: gapic_v1.method.wrap_method(
211
+ self.batch_commit_write_streams,
212
+ default_retry=retries.Retry(
213
+ initial=0.1,
214
+ maximum=60.0,
215
+ multiplier=1.3,
216
+ predicate=retries.if_exception_type(
217
+ core_exceptions.DeadlineExceeded,
218
+ core_exceptions.ServiceUnavailable,
219
+ ),
220
+ deadline=600.0,
221
+ ),
222
+ default_timeout=600.0,
223
+ client_info=client_info,
224
+ ),
225
+ self.flush_rows: gapic_v1.method.wrap_method(
226
+ self.flush_rows,
227
+ default_retry=retries.Retry(
228
+ initial=0.1,
229
+ maximum=60.0,
230
+ multiplier=1.3,
231
+ predicate=retries.if_exception_type(
232
+ core_exceptions.DeadlineExceeded,
233
+ core_exceptions.ServiceUnavailable,
234
+ ),
235
+ deadline=600.0,
236
+ ),
237
+ default_timeout=600.0,
238
+ client_info=client_info,
239
+ ),
240
+ }
241
+
242
+ def close(self):
243
+ """Closes resources associated with the transport.
244
+
245
+ .. warning::
246
+ Only call this method if the transport is NOT shared
247
+ with other clients - this may cause errors in other clients!
248
+ """
249
+ raise NotImplementedError()
250
+
251
+ @property
252
+ def create_write_stream(
253
+ self,
254
+ ) -> Callable[
255
+ [storage.CreateWriteStreamRequest],
256
+ Union[stream.WriteStream, Awaitable[stream.WriteStream]],
257
+ ]:
258
+ raise NotImplementedError()
259
+
260
+ @property
261
+ def append_rows(
262
+ self,
263
+ ) -> Callable[
264
+ [storage.AppendRowsRequest],
265
+ Union[storage.AppendRowsResponse, Awaitable[storage.AppendRowsResponse]],
266
+ ]:
267
+ raise NotImplementedError()
268
+
269
+ @property
270
+ def get_write_stream(
271
+ self,
272
+ ) -> Callable[
273
+ [storage.GetWriteStreamRequest],
274
+ Union[stream.WriteStream, Awaitable[stream.WriteStream]],
275
+ ]:
276
+ raise NotImplementedError()
277
+
278
+ @property
279
+ def finalize_write_stream(
280
+ self,
281
+ ) -> Callable[
282
+ [storage.FinalizeWriteStreamRequest],
283
+ Union[
284
+ storage.FinalizeWriteStreamResponse,
285
+ Awaitable[storage.FinalizeWriteStreamResponse],
286
+ ],
287
+ ]:
288
+ raise NotImplementedError()
289
+
290
+ @property
291
+ def batch_commit_write_streams(
292
+ self,
293
+ ) -> Callable[
294
+ [storage.BatchCommitWriteStreamsRequest],
295
+ Union[
296
+ storage.BatchCommitWriteStreamsResponse,
297
+ Awaitable[storage.BatchCommitWriteStreamsResponse],
298
+ ],
299
+ ]:
300
+ raise NotImplementedError()
301
+
302
+ @property
303
+ def flush_rows(
304
+ self,
305
+ ) -> Callable[
306
+ [storage.FlushRowsRequest],
307
+ Union[storage.FlushRowsResponse, Awaitable[storage.FlushRowsResponse]],
308
+ ]:
309
+ raise NotImplementedError()
310
+
311
+ @property
312
+ def kind(self) -> str:
313
+ raise NotImplementedError()
314
+
315
+
316
+ __all__ = ("BigQueryWriteTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc.py ADDED
@@ -0,0 +1,542 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json
17
+ import logging as std_logging
18
+ import pickle
19
+ import warnings
20
+ from typing import Callable, Dict, Optional, Sequence, Tuple, Union
21
+
22
+ import google.auth # type: ignore
23
+ import google.protobuf.message
24
+ import grpc # type: ignore
25
+ import proto # type: ignore
26
+ from google.api_core import gapic_v1, grpc_helpers
27
+ from google.auth import credentials as ga_credentials # type: ignore
28
+ from google.auth.transport.grpc import SslCredentials # type: ignore
29
+ from google.protobuf.json_format import MessageToJson
30
+
31
+ from google.cloud.bigquery_storage_v1beta2.types import storage, stream
32
+
33
+ from .base import DEFAULT_CLIENT_INFO, BigQueryWriteTransport
34
+
35
+ try:
36
+ from google.api_core import client_logging # type: ignore
37
+
38
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
39
+ except ImportError: # pragma: NO COVER
40
+ CLIENT_LOGGING_SUPPORTED = False
41
+
42
+ _LOGGER = std_logging.getLogger(__name__)
43
+
44
+
45
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
46
+ def intercept_unary_unary(self, continuation, client_call_details, request):
47
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
48
+ std_logging.DEBUG
49
+ )
50
+ if logging_enabled: # pragma: NO COVER
51
+ request_metadata = client_call_details.metadata
52
+ if isinstance(request, proto.Message):
53
+ request_payload = type(request).to_json(request)
54
+ elif isinstance(request, google.protobuf.message.Message):
55
+ request_payload = MessageToJson(request)
56
+ else:
57
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}"
58
+
59
+ request_metadata = {
60
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
61
+ for key, value in request_metadata
62
+ }
63
+ grpc_request = {
64
+ "payload": request_payload,
65
+ "requestMethod": "grpc",
66
+ "metadata": dict(request_metadata),
67
+ }
68
+ _LOGGER.debug(
69
+ f"Sending request for {client_call_details.method}",
70
+ extra={
71
+ "serviceName": "google.cloud.bigquery.storage.v1beta2.BigQueryWrite",
72
+ "rpcName": str(client_call_details.method),
73
+ "request": grpc_request,
74
+ "metadata": grpc_request["metadata"],
75
+ },
76
+ )
77
+ response = continuation(client_call_details, request)
78
+ if logging_enabled: # pragma: NO COVER
79
+ response_metadata = response.trailing_metadata()
80
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
81
+ metadata = (
82
+ dict([(k, str(v)) for k, v in response_metadata])
83
+ if response_metadata
84
+ else None
85
+ )
86
+ result = response.result()
87
+ if isinstance(result, proto.Message):
88
+ response_payload = type(result).to_json(result)
89
+ elif isinstance(result, google.protobuf.message.Message):
90
+ response_payload = MessageToJson(result)
91
+ else:
92
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}"
93
+ grpc_response = {
94
+ "payload": response_payload,
95
+ "metadata": metadata,
96
+ "status": "OK",
97
+ }
98
+ _LOGGER.debug(
99
+ f"Received response for {client_call_details.method}.",
100
+ extra={
101
+ "serviceName": "google.cloud.bigquery.storage.v1beta2.BigQueryWrite",
102
+ "rpcName": client_call_details.method,
103
+ "response": grpc_response,
104
+ "metadata": grpc_response["metadata"],
105
+ },
106
+ )
107
+ return response
108
+
109
+
110
+ class BigQueryWriteGrpcTransport(BigQueryWriteTransport):
111
+ """gRPC backend transport for BigQueryWrite.
112
+
113
+ BigQuery Write API.
114
+
115
+ The Write API can be used to write data to BigQuery.
116
+
117
+ The `google.cloud.bigquery.storage.v1
118
+ API </bigquery/docs/reference/storage/rpc/google.cloud.bigquery.storage.v1>`__
119
+ should be used instead of the v1beta2 API for BigQueryWrite
120
+ operations.
121
+
122
+ This class defines the same methods as the primary client, so the
123
+ primary client can load the underlying transport implementation
124
+ and call it.
125
+
126
+ It sends protocol buffers over the wire using gRPC (which is built on
127
+ top of HTTP/2); the ``grpcio`` package must be installed.
128
+ """
129
+
130
+ _stubs: Dict[str, Callable]
131
+
132
+ def __init__(
133
+ self,
134
+ *,
135
+ host: str = "bigquerystorage.googleapis.com",
136
+ credentials: Optional[ga_credentials.Credentials] = None,
137
+ credentials_file: Optional[str] = None,
138
+ scopes: Optional[Sequence[str]] = None,
139
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
140
+ api_mtls_endpoint: Optional[str] = None,
141
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
142
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
143
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
144
+ quota_project_id: Optional[str] = None,
145
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
146
+ always_use_jwt_access: Optional[bool] = False,
147
+ api_audience: Optional[str] = None,
148
+ ) -> None:
149
+ """Instantiate the transport.
150
+
151
+ Args:
152
+ host (Optional[str]):
153
+ The hostname to connect to (default: 'bigquerystorage.googleapis.com').
154
+ credentials (Optional[google.auth.credentials.Credentials]): The
155
+ authorization credentials to attach to requests. These
156
+ credentials identify the application to the service; if none
157
+ are specified, the client will attempt to ascertain the
158
+ credentials from the environment.
159
+ This argument is ignored if a ``channel`` instance is provided.
160
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
161
+ be loaded with :func:`google.auth.load_credentials_from_file`.
162
+ This argument is ignored if a ``channel`` instance is provided.
163
+ This argument will be removed in the next major version of this library.
164
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
165
+ ignored if a ``channel`` instance is provided.
166
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
167
+ A ``Channel`` instance through which to make calls, or a Callable
168
+ that constructs and returns one. If set to None, ``self.create_channel``
169
+ is used to create the channel. If a Callable is given, it will be called
170
+ with the same arguments as used in ``self.create_channel``.
171
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
172
+ If provided, it overrides the ``host`` argument and tries to create
173
+ a mutual TLS channel with client SSL credentials from
174
+ ``client_cert_source`` or application default SSL credentials.
175
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
176
+ Deprecated. A callback to provide client SSL certificate bytes and
177
+ private key bytes, both in PEM format. It is ignored if
178
+ ``api_mtls_endpoint`` is None.
179
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
180
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
181
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
182
+ A callback to provide client certificate bytes and private key bytes,
183
+ both in PEM format. It is used to configure a mutual TLS channel. It is
184
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
185
+ quota_project_id (Optional[str]): An optional project to use for billing
186
+ and quota.
187
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
188
+ The client info used to send a user-agent string along with
189
+ API requests. If ``None``, then default info will be used.
190
+ Generally, you only need to set this if you're developing
191
+ your own client library.
192
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
193
+ be used for service account credentials.
194
+ api_audience (Optional[str]): The intended audience for the API calls
195
+ to the service that will be set when using certain 3rd party
196
+ authentication flows. Audience is typically a resource identifier.
197
+ If not set, the host value will be used as a default.
198
+
199
+ Raises:
200
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
201
+ creation failed for any reason.
202
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
203
+ and ``credentials_file`` are passed.
204
+ """
205
+ self._grpc_channel = None
206
+ self._ssl_channel_credentials = ssl_channel_credentials
207
+ self._stubs: Dict[str, Callable] = {}
208
+
209
+ if api_mtls_endpoint:
210
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
211
+ if client_cert_source:
212
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
213
+
214
+ if isinstance(channel, grpc.Channel):
215
+ # Ignore credentials if a channel was passed.
216
+ credentials = None
217
+ self._ignore_credentials = True
218
+ # If a channel was explicitly provided, set it.
219
+ self._grpc_channel = channel
220
+ self._ssl_channel_credentials = None
221
+
222
+ else:
223
+ if api_mtls_endpoint:
224
+ host = api_mtls_endpoint
225
+
226
+ # Create SSL credentials with client_cert_source or application
227
+ # default SSL credentials.
228
+ if client_cert_source:
229
+ cert, key = client_cert_source()
230
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
231
+ certificate_chain=cert, private_key=key
232
+ )
233
+ else:
234
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
235
+
236
+ else:
237
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
238
+ cert, key = client_cert_source_for_mtls()
239
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
240
+ certificate_chain=cert, private_key=key
241
+ )
242
+
243
+ # The base transport sets the host, credentials and scopes
244
+ super().__init__(
245
+ host=host,
246
+ credentials=credentials,
247
+ credentials_file=credentials_file,
248
+ scopes=scopes,
249
+ quota_project_id=quota_project_id,
250
+ client_info=client_info,
251
+ always_use_jwt_access=always_use_jwt_access,
252
+ api_audience=api_audience,
253
+ )
254
+
255
+ if not self._grpc_channel:
256
+ # initialize with the provided callable or the default channel
257
+ channel_init = channel or type(self).create_channel
258
+ self._grpc_channel = channel_init(
259
+ self._host,
260
+ # use the credentials which are saved
261
+ credentials=self._credentials,
262
+ # Set ``credentials_file`` to ``None`` here as
263
+ # the credentials that we saved earlier should be used.
264
+ credentials_file=None,
265
+ scopes=self._scopes,
266
+ ssl_credentials=self._ssl_channel_credentials,
267
+ quota_project_id=quota_project_id,
268
+ options=[
269
+ ("grpc.max_send_message_length", -1),
270
+ ("grpc.max_receive_message_length", -1),
271
+ ],
272
+ )
273
+
274
+ self._interceptor = _LoggingClientInterceptor()
275
+ self._logged_channel = grpc.intercept_channel(
276
+ self._grpc_channel, self._interceptor
277
+ )
278
+
279
+ # Wrap messages. This must be done after self._logged_channel exists
280
+ self._prep_wrapped_messages(client_info)
281
+
282
+ @classmethod
283
+ def create_channel(
284
+ cls,
285
+ host: str = "bigquerystorage.googleapis.com",
286
+ credentials: Optional[ga_credentials.Credentials] = None,
287
+ credentials_file: Optional[str] = None,
288
+ scopes: Optional[Sequence[str]] = None,
289
+ quota_project_id: Optional[str] = None,
290
+ **kwargs,
291
+ ) -> grpc.Channel:
292
+ """Create and return a gRPC channel object.
293
+ Args:
294
+ host (Optional[str]): The host for the channel to use.
295
+ credentials (Optional[~.Credentials]): The
296
+ authorization credentials to attach to requests. These
297
+ credentials identify this application to the service. If
298
+ none are specified, the client will attempt to ascertain
299
+ the credentials from the environment.
300
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
301
+ be loaded with :func:`google.auth.load_credentials_from_file`.
302
+ This argument is mutually exclusive with credentials. This argument will be
303
+ removed in the next major version of this library.
304
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
305
+ service. These are only used when credentials are not specified and
306
+ are passed to :func:`google.auth.default`.
307
+ quota_project_id (Optional[str]): An optional project to use for billing
308
+ and quota.
309
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
310
+ channel creation.
311
+ Returns:
312
+ grpc.Channel: A gRPC channel object.
313
+
314
+ Raises:
315
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
316
+ and ``credentials_file`` are passed.
317
+ """
318
+
319
+ return grpc_helpers.create_channel(
320
+ host,
321
+ credentials=credentials,
322
+ credentials_file=credentials_file,
323
+ quota_project_id=quota_project_id,
324
+ default_scopes=cls.AUTH_SCOPES,
325
+ scopes=scopes,
326
+ default_host=cls.DEFAULT_HOST,
327
+ **kwargs,
328
+ )
329
+
330
+ @property
331
+ def grpc_channel(self) -> grpc.Channel:
332
+ """Return the channel designed to connect to this service."""
333
+ return self._grpc_channel
334
+
335
+ @property
336
+ def create_write_stream(
337
+ self,
338
+ ) -> Callable[[storage.CreateWriteStreamRequest], stream.WriteStream]:
339
+ r"""Return a callable for the create write stream method over gRPC.
340
+
341
+ Creates a write stream to the given table. Additionally, every
342
+ table has a special COMMITTED stream named '\_default' to which
343
+ data can be written. This stream doesn't need to be created
344
+ using CreateWriteStream. It is a stream that can be used
345
+ simultaneously by any number of clients. Data written to this
346
+ stream is considered committed as soon as an acknowledgement is
347
+ received.
348
+
349
+ Returns:
350
+ Callable[[~.CreateWriteStreamRequest],
351
+ ~.WriteStream]:
352
+ A function that, when called, will call the underlying RPC
353
+ on the server.
354
+ """
355
+ # Generate a "stub function" on-the-fly which will actually make
356
+ # the request.
357
+ # gRPC handles serialization and deserialization, so we just need
358
+ # to pass in the functions for each.
359
+ if "create_write_stream" not in self._stubs:
360
+ self._stubs["create_write_stream"] = self._logged_channel.unary_unary(
361
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/CreateWriteStream",
362
+ request_serializer=storage.CreateWriteStreamRequest.serialize,
363
+ response_deserializer=stream.WriteStream.deserialize,
364
+ )
365
+ return self._stubs["create_write_stream"]
366
+
367
+ @property
368
+ def append_rows(
369
+ self,
370
+ ) -> Callable[[storage.AppendRowsRequest], storage.AppendRowsResponse]:
371
+ r"""Return a callable for the append rows method over gRPC.
372
+
373
+ Appends data to the given stream.
374
+
375
+ If ``offset`` is specified, the ``offset`` is checked against
376
+ the end of stream. The server returns ``OUT_OF_RANGE`` in
377
+ ``AppendRowsResponse`` if an attempt is made to append to an
378
+ offset beyond the current end of the stream or
379
+ ``ALREADY_EXISTS`` if user provids an ``offset`` that has
380
+ already been written to. User can retry with adjusted offset
381
+ within the same RPC stream. If ``offset`` is not specified,
382
+ append happens at the end of the stream.
383
+
384
+ The response contains the offset at which the append happened.
385
+ Responses are received in the same order in which requests are
386
+ sent. There will be one response for each successful request. If
387
+ the ``offset`` is not set in response, it means append didn't
388
+ happen due to some errors. If one request fails, all the
389
+ subsequent requests will also fail until a success request is
390
+ made again.
391
+
392
+ If the stream is of ``PENDING`` type, data will only be
393
+ available for read operations after the stream is committed.
394
+
395
+ Returns:
396
+ Callable[[~.AppendRowsRequest],
397
+ ~.AppendRowsResponse]:
398
+ A function that, when called, will call the underlying RPC
399
+ on the server.
400
+ """
401
+ # Generate a "stub function" on-the-fly which will actually make
402
+ # the request.
403
+ # gRPC handles serialization and deserialization, so we just need
404
+ # to pass in the functions for each.
405
+ if "append_rows" not in self._stubs:
406
+ self._stubs["append_rows"] = self._logged_channel.stream_stream(
407
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/AppendRows",
408
+ request_serializer=storage.AppendRowsRequest.serialize,
409
+ response_deserializer=storage.AppendRowsResponse.deserialize,
410
+ )
411
+ return self._stubs["append_rows"]
412
+
413
+ @property
414
+ def get_write_stream(
415
+ self,
416
+ ) -> Callable[[storage.GetWriteStreamRequest], stream.WriteStream]:
417
+ r"""Return a callable for the get write stream method over gRPC.
418
+
419
+ Gets a write stream.
420
+
421
+ Returns:
422
+ Callable[[~.GetWriteStreamRequest],
423
+ ~.WriteStream]:
424
+ A function that, when called, will call the underlying RPC
425
+ on the server.
426
+ """
427
+ # Generate a "stub function" on-the-fly which will actually make
428
+ # the request.
429
+ # gRPC handles serialization and deserialization, so we just need
430
+ # to pass in the functions for each.
431
+ if "get_write_stream" not in self._stubs:
432
+ self._stubs["get_write_stream"] = self._logged_channel.unary_unary(
433
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/GetWriteStream",
434
+ request_serializer=storage.GetWriteStreamRequest.serialize,
435
+ response_deserializer=stream.WriteStream.deserialize,
436
+ )
437
+ return self._stubs["get_write_stream"]
438
+
439
+ @property
440
+ def finalize_write_stream(
441
+ self,
442
+ ) -> Callable[
443
+ [storage.FinalizeWriteStreamRequest], storage.FinalizeWriteStreamResponse
444
+ ]:
445
+ r"""Return a callable for the finalize write stream method over gRPC.
446
+
447
+ Finalize a write stream so that no new data can be appended to
448
+ the stream. Finalize is not supported on the '\_default' stream.
449
+
450
+ Returns:
451
+ Callable[[~.FinalizeWriteStreamRequest],
452
+ ~.FinalizeWriteStreamResponse]:
453
+ A function that, when called, will call the underlying RPC
454
+ on the server.
455
+ """
456
+ # Generate a "stub function" on-the-fly which will actually make
457
+ # the request.
458
+ # gRPC handles serialization and deserialization, so we just need
459
+ # to pass in the functions for each.
460
+ if "finalize_write_stream" not in self._stubs:
461
+ self._stubs["finalize_write_stream"] = self._logged_channel.unary_unary(
462
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/FinalizeWriteStream",
463
+ request_serializer=storage.FinalizeWriteStreamRequest.serialize,
464
+ response_deserializer=storage.FinalizeWriteStreamResponse.deserialize,
465
+ )
466
+ return self._stubs["finalize_write_stream"]
467
+
468
+ @property
469
+ def batch_commit_write_streams(
470
+ self,
471
+ ) -> Callable[
472
+ [storage.BatchCommitWriteStreamsRequest],
473
+ storage.BatchCommitWriteStreamsResponse,
474
+ ]:
475
+ r"""Return a callable for the batch commit write streams method over gRPC.
476
+
477
+ Atomically commits a group of ``PENDING`` streams that belong to
478
+ the same ``parent`` table. Streams must be finalized before
479
+ commit and cannot be committed multiple times. Once a stream is
480
+ committed, data in the stream becomes available for read
481
+ operations.
482
+
483
+ Returns:
484
+ Callable[[~.BatchCommitWriteStreamsRequest],
485
+ ~.BatchCommitWriteStreamsResponse]:
486
+ A function that, when called, will call the underlying RPC
487
+ on the server.
488
+ """
489
+ # Generate a "stub function" on-the-fly which will actually make
490
+ # the request.
491
+ # gRPC handles serialization and deserialization, so we just need
492
+ # to pass in the functions for each.
493
+ if "batch_commit_write_streams" not in self._stubs:
494
+ self._stubs["batch_commit_write_streams"] = (
495
+ self._logged_channel.unary_unary(
496
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/BatchCommitWriteStreams",
497
+ request_serializer=storage.BatchCommitWriteStreamsRequest.serialize,
498
+ response_deserializer=storage.BatchCommitWriteStreamsResponse.deserialize,
499
+ )
500
+ )
501
+ return self._stubs["batch_commit_write_streams"]
502
+
503
+ @property
504
+ def flush_rows(
505
+ self,
506
+ ) -> Callable[[storage.FlushRowsRequest], storage.FlushRowsResponse]:
507
+ r"""Return a callable for the flush rows method over gRPC.
508
+
509
+ Flushes rows to a BUFFERED stream. If users are appending rows
510
+ to BUFFERED stream, flush operation is required in order for the
511
+ rows to become available for reading. A Flush operation flushes
512
+ up to any previously flushed offset in a BUFFERED stream, to the
513
+ offset specified in the request. Flush is not supported on the
514
+ \_default stream, since it is not BUFFERED.
515
+
516
+ Returns:
517
+ Callable[[~.FlushRowsRequest],
518
+ ~.FlushRowsResponse]:
519
+ A function that, when called, will call the underlying RPC
520
+ on the server.
521
+ """
522
+ # Generate a "stub function" on-the-fly which will actually make
523
+ # the request.
524
+ # gRPC handles serialization and deserialization, so we just need
525
+ # to pass in the functions for each.
526
+ if "flush_rows" not in self._stubs:
527
+ self._stubs["flush_rows"] = self._logged_channel.unary_unary(
528
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/FlushRows",
529
+ request_serializer=storage.FlushRowsRequest.serialize,
530
+ response_deserializer=storage.FlushRowsResponse.deserialize,
531
+ )
532
+ return self._stubs["flush_rows"]
533
+
534
+ def close(self):
535
+ self._logged_channel.close()
536
+
537
+ @property
538
+ def kind(self) -> str:
539
+ return "grpc"
540
+
541
+
542
+ __all__ = ("BigQueryWriteGrpcTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc_asyncio.py ADDED
@@ -0,0 +1,652 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import inspect
17
+ import json
18
+ import logging as std_logging
19
+ import pickle
20
+ import warnings
21
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
22
+
23
+ import google.protobuf.message
24
+ import grpc # type: ignore
25
+ import proto # type: ignore
26
+ from google.api_core import exceptions as core_exceptions
27
+ from google.api_core import gapic_v1, grpc_helpers_async
28
+ from google.api_core import retry_async as retries
29
+ from google.auth import credentials as ga_credentials # type: ignore
30
+ from google.auth.transport.grpc import SslCredentials # type: ignore
31
+ from google.protobuf.json_format import MessageToJson
32
+ from grpc.experimental import aio # type: ignore
33
+
34
+ from google.cloud.bigquery_storage_v1beta2.types import storage, stream
35
+
36
+ from .base import DEFAULT_CLIENT_INFO, BigQueryWriteTransport
37
+ from .grpc import BigQueryWriteGrpcTransport
38
+
39
+ try:
40
+ from google.api_core import client_logging # type: ignore
41
+
42
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
43
+ except ImportError: # pragma: NO COVER
44
+ CLIENT_LOGGING_SUPPORTED = False
45
+
46
+ _LOGGER = std_logging.getLogger(__name__)
47
+
48
+
49
+ class _LoggingClientAIOInterceptor(
50
+ grpc.aio.UnaryUnaryClientInterceptor
51
+ ): # pragma: NO COVER
52
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
53
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
54
+ std_logging.DEBUG
55
+ )
56
+ if logging_enabled: # pragma: NO COVER
57
+ request_metadata = client_call_details.metadata
58
+ if isinstance(request, proto.Message):
59
+ request_payload = type(request).to_json(request)
60
+ elif isinstance(request, google.protobuf.message.Message):
61
+ request_payload = MessageToJson(request)
62
+ else:
63
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)!r}"
64
+
65
+ request_metadata = {
66
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
67
+ for key, value in request_metadata
68
+ }
69
+ grpc_request = {
70
+ "payload": request_payload,
71
+ "requestMethod": "grpc",
72
+ "metadata": dict(request_metadata),
73
+ }
74
+ _LOGGER.debug(
75
+ f"Sending request for {client_call_details.method}",
76
+ extra={
77
+ "serviceName": "google.cloud.bigquery.storage.v1beta2.BigQueryWrite",
78
+ "rpcName": str(client_call_details.method),
79
+ "request": grpc_request,
80
+ "metadata": grpc_request["metadata"],
81
+ },
82
+ )
83
+ response = await continuation(client_call_details, request)
84
+ if logging_enabled: # pragma: NO COVER
85
+ response_metadata = await response.trailing_metadata()
86
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
87
+ metadata = (
88
+ dict([(k, str(v)) for k, v in response_metadata])
89
+ if response_metadata
90
+ else None
91
+ )
92
+ result = await response
93
+ if isinstance(result, proto.Message):
94
+ response_payload = type(result).to_json(result)
95
+ elif isinstance(result, google.protobuf.message.Message):
96
+ response_payload = MessageToJson(result)
97
+ else:
98
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)!r}"
99
+ grpc_response = {
100
+ "payload": response_payload,
101
+ "metadata": metadata,
102
+ "status": "OK",
103
+ }
104
+ _LOGGER.debug(
105
+ f"Received response to rpc {client_call_details.method}.",
106
+ extra={
107
+ "serviceName": "google.cloud.bigquery.storage.v1beta2.BigQueryWrite",
108
+ "rpcName": str(client_call_details.method),
109
+ "response": grpc_response,
110
+ "metadata": grpc_response["metadata"],
111
+ },
112
+ )
113
+ return response
114
+
115
+
116
+ class BigQueryWriteGrpcAsyncIOTransport(BigQueryWriteTransport):
117
+ """gRPC AsyncIO backend transport for BigQueryWrite.
118
+
119
+ BigQuery Write API.
120
+
121
+ The Write API can be used to write data to BigQuery.
122
+
123
+ The `google.cloud.bigquery.storage.v1
124
+ API </bigquery/docs/reference/storage/rpc/google.cloud.bigquery.storage.v1>`__
125
+ should be used instead of the v1beta2 API for BigQueryWrite
126
+ operations.
127
+
128
+ This class defines the same methods as the primary client, so the
129
+ primary client can load the underlying transport implementation
130
+ and call it.
131
+
132
+ It sends protocol buffers over the wire using gRPC (which is built on
133
+ top of HTTP/2); the ``grpcio`` package must be installed.
134
+ """
135
+
136
+ _grpc_channel: aio.Channel
137
+ _stubs: Dict[str, Callable] = {}
138
+
139
+ @classmethod
140
+ def create_channel(
141
+ cls,
142
+ host: str = "bigquerystorage.googleapis.com",
143
+ credentials: Optional[ga_credentials.Credentials] = None,
144
+ credentials_file: Optional[str] = None,
145
+ scopes: Optional[Sequence[str]] = None,
146
+ quota_project_id: Optional[str] = None,
147
+ **kwargs,
148
+ ) -> aio.Channel:
149
+ """Create and return a gRPC AsyncIO channel object.
150
+ Args:
151
+ host (Optional[str]): The host for the channel to use.
152
+ credentials (Optional[~.Credentials]): The
153
+ authorization credentials to attach to requests. These
154
+ credentials identify this application to the service. If
155
+ none are specified, the client will attempt to ascertain
156
+ the credentials from the environment.
157
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
158
+ be loaded with :func:`google.auth.load_credentials_from_file`. This argument will be
159
+ removed in the next major version of this library.
160
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
161
+ service. These are only used when credentials are not specified and
162
+ are passed to :func:`google.auth.default`.
163
+ quota_project_id (Optional[str]): An optional project to use for billing
164
+ and quota.
165
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
166
+ channel creation.
167
+ Returns:
168
+ aio.Channel: A gRPC AsyncIO channel object.
169
+ """
170
+
171
+ return grpc_helpers_async.create_channel(
172
+ host,
173
+ credentials=credentials,
174
+ credentials_file=credentials_file,
175
+ quota_project_id=quota_project_id,
176
+ default_scopes=cls.AUTH_SCOPES,
177
+ scopes=scopes,
178
+ default_host=cls.DEFAULT_HOST,
179
+ **kwargs,
180
+ )
181
+
182
+ def __init__(
183
+ self,
184
+ *,
185
+ host: str = "bigquerystorage.googleapis.com",
186
+ credentials: Optional[ga_credentials.Credentials] = None,
187
+ credentials_file: Optional[str] = None,
188
+ scopes: Optional[Sequence[str]] = None,
189
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
190
+ api_mtls_endpoint: Optional[str] = None,
191
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
192
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
193
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
194
+ quota_project_id: Optional[str] = None,
195
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
196
+ always_use_jwt_access: Optional[bool] = False,
197
+ api_audience: Optional[str] = None,
198
+ ) -> None:
199
+ """Instantiate the transport.
200
+
201
+ Args:
202
+ host (Optional[str]):
203
+ The hostname to connect to (default: 'bigquerystorage.googleapis.com').
204
+ credentials (Optional[google.auth.credentials.Credentials]): The
205
+ authorization credentials to attach to requests. These
206
+ credentials identify the application to the service; if none
207
+ are specified, the client will attempt to ascertain the
208
+ credentials from the environment.
209
+ This argument is ignored if a ``channel`` instance is provided.
210
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
211
+ be loaded with :func:`google.auth.load_credentials_from_file`.
212
+ This argument is ignored if a ``channel`` instance is provided.
213
+ This argument will be removed in the next major version of this library.
214
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
215
+ service. These are only used when credentials are not specified and
216
+ are passed to :func:`google.auth.default`.
217
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
218
+ A ``Channel`` instance through which to make calls, or a Callable
219
+ that constructs and returns one. If set to None, ``self.create_channel``
220
+ is used to create the channel. If a Callable is given, it will be called
221
+ with the same arguments as used in ``self.create_channel``.
222
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
223
+ If provided, it overrides the ``host`` argument and tries to create
224
+ a mutual TLS channel with client SSL credentials from
225
+ ``client_cert_source`` or application default SSL credentials.
226
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
227
+ Deprecated. A callback to provide client SSL certificate bytes and
228
+ private key bytes, both in PEM format. It is ignored if
229
+ ``api_mtls_endpoint`` is None.
230
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
231
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
232
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
233
+ A callback to provide client certificate bytes and private key bytes,
234
+ both in PEM format. It is used to configure a mutual TLS channel. It is
235
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
236
+ quota_project_id (Optional[str]): An optional project to use for billing
237
+ and quota.
238
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
239
+ The client info used to send a user-agent string along with
240
+ API requests. If ``None``, then default info will be used.
241
+ Generally, you only need to set this if you're developing
242
+ your own client library.
243
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
244
+ be used for service account credentials.
245
+ api_audience (Optional[str]): The intended audience for the API calls
246
+ to the service that will be set when using certain 3rd party
247
+ authentication flows. Audience is typically a resource identifier.
248
+ If not set, the host value will be used as a default.
249
+
250
+ Raises:
251
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
252
+ creation failed for any reason.
253
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
254
+ and ``credentials_file`` are passed.
255
+ """
256
+ self._grpc_channel = None
257
+ self._ssl_channel_credentials = ssl_channel_credentials
258
+ self._stubs: Dict[str, Callable] = {}
259
+
260
+ if api_mtls_endpoint:
261
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
262
+ if client_cert_source:
263
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
264
+
265
+ if isinstance(channel, aio.Channel):
266
+ # Ignore credentials if a channel was passed.
267
+ credentials = None
268
+ self._ignore_credentials = True
269
+ # If a channel was explicitly provided, set it.
270
+ self._grpc_channel = channel
271
+ self._ssl_channel_credentials = None
272
+ else:
273
+ if api_mtls_endpoint:
274
+ host = api_mtls_endpoint
275
+
276
+ # Create SSL credentials with client_cert_source or application
277
+ # default SSL credentials.
278
+ if client_cert_source:
279
+ cert, key = client_cert_source()
280
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
281
+ certificate_chain=cert, private_key=key
282
+ )
283
+ else:
284
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
285
+
286
+ else:
287
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
288
+ cert, key = client_cert_source_for_mtls()
289
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
290
+ certificate_chain=cert, private_key=key
291
+ )
292
+
293
+ # The base transport sets the host, credentials and scopes
294
+ super().__init__(
295
+ host=host,
296
+ credentials=credentials,
297
+ credentials_file=credentials_file,
298
+ scopes=scopes,
299
+ quota_project_id=quota_project_id,
300
+ client_info=client_info,
301
+ always_use_jwt_access=always_use_jwt_access,
302
+ api_audience=api_audience,
303
+ )
304
+
305
+ if not self._grpc_channel:
306
+ # initialize with the provided callable or the default channel
307
+ channel_init = channel or type(self).create_channel
308
+ self._grpc_channel = channel_init(
309
+ self._host,
310
+ # use the credentials which are saved
311
+ credentials=self._credentials,
312
+ # Set ``credentials_file`` to ``None`` here as
313
+ # the credentials that we saved earlier should be used.
314
+ credentials_file=None,
315
+ scopes=self._scopes,
316
+ ssl_credentials=self._ssl_channel_credentials,
317
+ quota_project_id=quota_project_id,
318
+ options=[
319
+ ("grpc.max_send_message_length", -1),
320
+ ("grpc.max_receive_message_length", -1),
321
+ ],
322
+ )
323
+
324
+ self._interceptor = _LoggingClientAIOInterceptor()
325
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
326
+ self._logged_channel = self._grpc_channel
327
+ self._wrap_with_kind = (
328
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
329
+ )
330
+ # Wrap messages. This must be done after self._logged_channel exists
331
+ self._prep_wrapped_messages(client_info)
332
+
333
+ @property
334
+ def grpc_channel(self) -> aio.Channel:
335
+ """Create the channel designed to connect to this service.
336
+
337
+ This property caches on the instance; repeated calls return
338
+ the same channel.
339
+ """
340
+ # Return the channel from cache.
341
+ return self._grpc_channel
342
+
343
+ @property
344
+ def create_write_stream(
345
+ self,
346
+ ) -> Callable[[storage.CreateWriteStreamRequest], Awaitable[stream.WriteStream]]:
347
+ r"""Return a callable for the create write stream method over gRPC.
348
+
349
+ Creates a write stream to the given table. Additionally, every
350
+ table has a special COMMITTED stream named '\_default' to which
351
+ data can be written. This stream doesn't need to be created
352
+ using CreateWriteStream. It is a stream that can be used
353
+ simultaneously by any number of clients. Data written to this
354
+ stream is considered committed as soon as an acknowledgement is
355
+ received.
356
+
357
+ Returns:
358
+ Callable[[~.CreateWriteStreamRequest],
359
+ Awaitable[~.WriteStream]]:
360
+ A function that, when called, will call the underlying RPC
361
+ on the server.
362
+ """
363
+ # Generate a "stub function" on-the-fly which will actually make
364
+ # the request.
365
+ # gRPC handles serialization and deserialization, so we just need
366
+ # to pass in the functions for each.
367
+ if "create_write_stream" not in self._stubs:
368
+ self._stubs["create_write_stream"] = self._logged_channel.unary_unary(
369
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/CreateWriteStream",
370
+ request_serializer=storage.CreateWriteStreamRequest.serialize,
371
+ response_deserializer=stream.WriteStream.deserialize,
372
+ )
373
+ return self._stubs["create_write_stream"]
374
+
375
+ @property
376
+ def append_rows(
377
+ self,
378
+ ) -> Callable[[storage.AppendRowsRequest], Awaitable[storage.AppendRowsResponse]]:
379
+ r"""Return a callable for the append rows method over gRPC.
380
+
381
+ Appends data to the given stream.
382
+
383
+ If ``offset`` is specified, the ``offset`` is checked against
384
+ the end of stream. The server returns ``OUT_OF_RANGE`` in
385
+ ``AppendRowsResponse`` if an attempt is made to append to an
386
+ offset beyond the current end of the stream or
387
+ ``ALREADY_EXISTS`` if user provids an ``offset`` that has
388
+ already been written to. User can retry with adjusted offset
389
+ within the same RPC stream. If ``offset`` is not specified,
390
+ append happens at the end of the stream.
391
+
392
+ The response contains the offset at which the append happened.
393
+ Responses are received in the same order in which requests are
394
+ sent. There will be one response for each successful request. If
395
+ the ``offset`` is not set in response, it means append didn't
396
+ happen due to some errors. If one request fails, all the
397
+ subsequent requests will also fail until a success request is
398
+ made again.
399
+
400
+ If the stream is of ``PENDING`` type, data will only be
401
+ available for read operations after the stream is committed.
402
+
403
+ Returns:
404
+ Callable[[~.AppendRowsRequest],
405
+ Awaitable[~.AppendRowsResponse]]:
406
+ A function that, when called, will call the underlying RPC
407
+ on the server.
408
+ """
409
+ # Generate a "stub function" on-the-fly which will actually make
410
+ # the request.
411
+ # gRPC handles serialization and deserialization, so we just need
412
+ # to pass in the functions for each.
413
+ if "append_rows" not in self._stubs:
414
+ self._stubs["append_rows"] = self._logged_channel.stream_stream(
415
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/AppendRows",
416
+ request_serializer=storage.AppendRowsRequest.serialize,
417
+ response_deserializer=storage.AppendRowsResponse.deserialize,
418
+ )
419
+ return self._stubs["append_rows"]
420
+
421
+ @property
422
+ def get_write_stream(
423
+ self,
424
+ ) -> Callable[[storage.GetWriteStreamRequest], Awaitable[stream.WriteStream]]:
425
+ r"""Return a callable for the get write stream method over gRPC.
426
+
427
+ Gets a write stream.
428
+
429
+ Returns:
430
+ Callable[[~.GetWriteStreamRequest],
431
+ Awaitable[~.WriteStream]]:
432
+ A function that, when called, will call the underlying RPC
433
+ on the server.
434
+ """
435
+ # Generate a "stub function" on-the-fly which will actually make
436
+ # the request.
437
+ # gRPC handles serialization and deserialization, so we just need
438
+ # to pass in the functions for each.
439
+ if "get_write_stream" not in self._stubs:
440
+ self._stubs["get_write_stream"] = self._logged_channel.unary_unary(
441
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/GetWriteStream",
442
+ request_serializer=storage.GetWriteStreamRequest.serialize,
443
+ response_deserializer=stream.WriteStream.deserialize,
444
+ )
445
+ return self._stubs["get_write_stream"]
446
+
447
+ @property
448
+ def finalize_write_stream(
449
+ self,
450
+ ) -> Callable[
451
+ [storage.FinalizeWriteStreamRequest],
452
+ Awaitable[storage.FinalizeWriteStreamResponse],
453
+ ]:
454
+ r"""Return a callable for the finalize write stream method over gRPC.
455
+
456
+ Finalize a write stream so that no new data can be appended to
457
+ the stream. Finalize is not supported on the '\_default' stream.
458
+
459
+ Returns:
460
+ Callable[[~.FinalizeWriteStreamRequest],
461
+ Awaitable[~.FinalizeWriteStreamResponse]]:
462
+ A function that, when called, will call the underlying RPC
463
+ on the server.
464
+ """
465
+ # Generate a "stub function" on-the-fly which will actually make
466
+ # the request.
467
+ # gRPC handles serialization and deserialization, so we just need
468
+ # to pass in the functions for each.
469
+ if "finalize_write_stream" not in self._stubs:
470
+ self._stubs["finalize_write_stream"] = self._logged_channel.unary_unary(
471
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/FinalizeWriteStream",
472
+ request_serializer=storage.FinalizeWriteStreamRequest.serialize,
473
+ response_deserializer=storage.FinalizeWriteStreamResponse.deserialize,
474
+ )
475
+ return self._stubs["finalize_write_stream"]
476
+
477
+ @property
478
+ def batch_commit_write_streams(
479
+ self,
480
+ ) -> Callable[
481
+ [storage.BatchCommitWriteStreamsRequest],
482
+ Awaitable[storage.BatchCommitWriteStreamsResponse],
483
+ ]:
484
+ r"""Return a callable for the batch commit write streams method over gRPC.
485
+
486
+ Atomically commits a group of ``PENDING`` streams that belong to
487
+ the same ``parent`` table. Streams must be finalized before
488
+ commit and cannot be committed multiple times. Once a stream is
489
+ committed, data in the stream becomes available for read
490
+ operations.
491
+
492
+ Returns:
493
+ Callable[[~.BatchCommitWriteStreamsRequest],
494
+ Awaitable[~.BatchCommitWriteStreamsResponse]]:
495
+ A function that, when called, will call the underlying RPC
496
+ on the server.
497
+ """
498
+ # Generate a "stub function" on-the-fly which will actually make
499
+ # the request.
500
+ # gRPC handles serialization and deserialization, so we just need
501
+ # to pass in the functions for each.
502
+ if "batch_commit_write_streams" not in self._stubs:
503
+ self._stubs["batch_commit_write_streams"] = (
504
+ self._logged_channel.unary_unary(
505
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/BatchCommitWriteStreams",
506
+ request_serializer=storage.BatchCommitWriteStreamsRequest.serialize,
507
+ response_deserializer=storage.BatchCommitWriteStreamsResponse.deserialize,
508
+ )
509
+ )
510
+ return self._stubs["batch_commit_write_streams"]
511
+
512
+ @property
513
+ def flush_rows(
514
+ self,
515
+ ) -> Callable[[storage.FlushRowsRequest], Awaitable[storage.FlushRowsResponse]]:
516
+ r"""Return a callable for the flush rows method over gRPC.
517
+
518
+ Flushes rows to a BUFFERED stream. If users are appending rows
519
+ to BUFFERED stream, flush operation is required in order for the
520
+ rows to become available for reading. A Flush operation flushes
521
+ up to any previously flushed offset in a BUFFERED stream, to the
522
+ offset specified in the request. Flush is not supported on the
523
+ \_default stream, since it is not BUFFERED.
524
+
525
+ Returns:
526
+ Callable[[~.FlushRowsRequest],
527
+ Awaitable[~.FlushRowsResponse]]:
528
+ A function that, when called, will call the underlying RPC
529
+ on the server.
530
+ """
531
+ # Generate a "stub function" on-the-fly which will actually make
532
+ # the request.
533
+ # gRPC handles serialization and deserialization, so we just need
534
+ # to pass in the functions for each.
535
+ if "flush_rows" not in self._stubs:
536
+ self._stubs["flush_rows"] = self._logged_channel.unary_unary(
537
+ "/google.cloud.bigquery.storage.v1beta2.BigQueryWrite/FlushRows",
538
+ request_serializer=storage.FlushRowsRequest.serialize,
539
+ response_deserializer=storage.FlushRowsResponse.deserialize,
540
+ )
541
+ return self._stubs["flush_rows"]
542
+
543
+ def _prep_wrapped_messages(self, client_info):
544
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
545
+ self._wrapped_methods = {
546
+ self.create_write_stream: self._wrap_method(
547
+ self.create_write_stream,
548
+ default_retry=retries.AsyncRetry(
549
+ initial=0.1,
550
+ maximum=60.0,
551
+ multiplier=1.3,
552
+ predicate=retries.if_exception_type(
553
+ core_exceptions.DeadlineExceeded,
554
+ core_exceptions.ResourceExhausted,
555
+ core_exceptions.ServiceUnavailable,
556
+ ),
557
+ deadline=600.0,
558
+ ),
559
+ default_timeout=600.0,
560
+ client_info=client_info,
561
+ ),
562
+ self.append_rows: self._wrap_method(
563
+ self.append_rows,
564
+ default_retry=retries.AsyncRetry(
565
+ initial=0.1,
566
+ maximum=60.0,
567
+ multiplier=1.3,
568
+ predicate=retries.if_exception_type(
569
+ core_exceptions.ResourceExhausted,
570
+ core_exceptions.ServiceUnavailable,
571
+ ),
572
+ deadline=86400.0,
573
+ ),
574
+ default_timeout=86400.0,
575
+ client_info=client_info,
576
+ ),
577
+ self.get_write_stream: self._wrap_method(
578
+ self.get_write_stream,
579
+ default_retry=retries.AsyncRetry(
580
+ initial=0.1,
581
+ maximum=60.0,
582
+ multiplier=1.3,
583
+ predicate=retries.if_exception_type(
584
+ core_exceptions.DeadlineExceeded,
585
+ core_exceptions.ServiceUnavailable,
586
+ ),
587
+ deadline=600.0,
588
+ ),
589
+ default_timeout=600.0,
590
+ client_info=client_info,
591
+ ),
592
+ self.finalize_write_stream: self._wrap_method(
593
+ self.finalize_write_stream,
594
+ default_retry=retries.AsyncRetry(
595
+ initial=0.1,
596
+ maximum=60.0,
597
+ multiplier=1.3,
598
+ predicate=retries.if_exception_type(
599
+ core_exceptions.DeadlineExceeded,
600
+ core_exceptions.ServiceUnavailable,
601
+ ),
602
+ deadline=600.0,
603
+ ),
604
+ default_timeout=600.0,
605
+ client_info=client_info,
606
+ ),
607
+ self.batch_commit_write_streams: self._wrap_method(
608
+ self.batch_commit_write_streams,
609
+ default_retry=retries.AsyncRetry(
610
+ initial=0.1,
611
+ maximum=60.0,
612
+ multiplier=1.3,
613
+ predicate=retries.if_exception_type(
614
+ core_exceptions.DeadlineExceeded,
615
+ core_exceptions.ServiceUnavailable,
616
+ ),
617
+ deadline=600.0,
618
+ ),
619
+ default_timeout=600.0,
620
+ client_info=client_info,
621
+ ),
622
+ self.flush_rows: self._wrap_method(
623
+ self.flush_rows,
624
+ default_retry=retries.AsyncRetry(
625
+ initial=0.1,
626
+ maximum=60.0,
627
+ multiplier=1.3,
628
+ predicate=retries.if_exception_type(
629
+ core_exceptions.DeadlineExceeded,
630
+ core_exceptions.ServiceUnavailable,
631
+ ),
632
+ deadline=600.0,
633
+ ),
634
+ default_timeout=600.0,
635
+ client_info=client_info,
636
+ ),
637
+ }
638
+
639
+ def _wrap_method(self, func, *args, **kwargs):
640
+ if self._wrap_with_kind: # pragma: NO COVER
641
+ kwargs["kind"] = self.kind
642
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
643
+
644
+ def close(self):
645
+ return self._logged_channel.close()
646
+
647
+ @property
648
+ def kind(self) -> str:
649
+ return "grpc_asyncio"
650
+
651
+
652
+ __all__ = ("BigQueryWriteGrpcAsyncIOTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (1.8 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/arrow.cpython-311.pyc ADDED
Binary file (3.58 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/avro.cpython-311.pyc ADDED
Binary file (1.85 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/protobuf.cpython-311.pyc ADDED
Binary file (2.56 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/storage.cpython-311.pyc ADDED
Binary file (28.8 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/stream.cpython-311.pyc ADDED
Binary file (12.8 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1beta2/types/__pycache__/table.cpython-311.pyc ADDED
Binary file (5.61 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (9.63 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/__pycache__/gapic_version.cpython-311.pyc ADDED
Binary file (247 Bytes). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/__init__.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (228 Bytes). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/folders/__init__.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from .async_client import FoldersAsyncClient
17
+ from .client import FoldersClient
18
+
19
+ __all__ = (
20
+ "FoldersClient",
21
+ "FoldersAsyncClient",
22
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/folders/async_client.py ADDED
@@ -0,0 +1,1930 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import logging as std_logging
17
+ import re
18
+ from collections import OrderedDict
19
+ from typing import (
20
+ Callable,
21
+ Dict,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ import google.protobuf
33
+ from google.api_core import exceptions as core_exceptions
34
+ from google.api_core import gapic_v1
35
+ from google.api_core import retry_async as retries
36
+ from google.api_core.client_options import ClientOptions
37
+ from google.auth import credentials as ga_credentials # type: ignore
38
+ from google.oauth2 import service_account # type: ignore
39
+
40
+ from google.cloud.resourcemanager_v3 import gapic_version as package_version
41
+
42
+ try:
43
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
44
+ except AttributeError: # pragma: NO COVER
45
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
46
+
47
+ import google.api_core.operation as operation # type: ignore
48
+ import google.api_core.operation_async as operation_async # type: ignore
49
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
50
+ import google.iam.v1.policy_pb2 as policy_pb2 # type: ignore
51
+ import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
52
+ import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
53
+ from google.longrunning import operations_pb2 # type: ignore
54
+
55
+ from google.cloud.resourcemanager_v3.services.folders import pagers
56
+ from google.cloud.resourcemanager_v3.types import folders
57
+
58
+ from .client import FoldersClient
59
+ from .transports.base import DEFAULT_CLIENT_INFO, FoldersTransport
60
+ from .transports.grpc_asyncio import FoldersGrpcAsyncIOTransport
61
+
62
+ try:
63
+ from google.api_core import client_logging # type: ignore
64
+
65
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
66
+ except ImportError: # pragma: NO COVER
67
+ CLIENT_LOGGING_SUPPORTED = False
68
+
69
+ _LOGGER = std_logging.getLogger(__name__)
70
+
71
+
72
+ class FoldersAsyncClient:
73
+ """Manages Cloud Platform folder resources.
74
+ Folders can be used to organize the resources under an
75
+ organization and to control the policies applied to groups of
76
+ resources.
77
+ """
78
+
79
+ _client: FoldersClient
80
+
81
+ # Copy defaults from the synchronous client for use here.
82
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
83
+ DEFAULT_ENDPOINT = FoldersClient.DEFAULT_ENDPOINT
84
+ DEFAULT_MTLS_ENDPOINT = FoldersClient.DEFAULT_MTLS_ENDPOINT
85
+ _DEFAULT_ENDPOINT_TEMPLATE = FoldersClient._DEFAULT_ENDPOINT_TEMPLATE
86
+ _DEFAULT_UNIVERSE = FoldersClient._DEFAULT_UNIVERSE
87
+
88
+ folder_path = staticmethod(FoldersClient.folder_path)
89
+ parse_folder_path = staticmethod(FoldersClient.parse_folder_path)
90
+ common_billing_account_path = staticmethod(
91
+ FoldersClient.common_billing_account_path
92
+ )
93
+ parse_common_billing_account_path = staticmethod(
94
+ FoldersClient.parse_common_billing_account_path
95
+ )
96
+ common_folder_path = staticmethod(FoldersClient.common_folder_path)
97
+ parse_common_folder_path = staticmethod(FoldersClient.parse_common_folder_path)
98
+ common_organization_path = staticmethod(FoldersClient.common_organization_path)
99
+ parse_common_organization_path = staticmethod(
100
+ FoldersClient.parse_common_organization_path
101
+ )
102
+ common_project_path = staticmethod(FoldersClient.common_project_path)
103
+ parse_common_project_path = staticmethod(FoldersClient.parse_common_project_path)
104
+ common_location_path = staticmethod(FoldersClient.common_location_path)
105
+ parse_common_location_path = staticmethod(FoldersClient.parse_common_location_path)
106
+
107
+ @classmethod
108
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
109
+ """Creates an instance of this client using the provided credentials
110
+ info.
111
+
112
+ Args:
113
+ info (dict): The service account private key info.
114
+ args: Additional arguments to pass to the constructor.
115
+ kwargs: Additional arguments to pass to the constructor.
116
+
117
+ Returns:
118
+ FoldersAsyncClient: The constructed client.
119
+ """
120
+ sa_info_func = (
121
+ FoldersClient.from_service_account_info.__func__ # type: ignore
122
+ )
123
+ return sa_info_func(FoldersAsyncClient, info, *args, **kwargs)
124
+
125
+ @classmethod
126
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
127
+ """Creates an instance of this client using the provided credentials
128
+ file.
129
+
130
+ Args:
131
+ filename (str): The path to the service account private key json
132
+ file.
133
+ args: Additional arguments to pass to the constructor.
134
+ kwargs: Additional arguments to pass to the constructor.
135
+
136
+ Returns:
137
+ FoldersAsyncClient: The constructed client.
138
+ """
139
+ sa_file_func = (
140
+ FoldersClient.from_service_account_file.__func__ # type: ignore
141
+ )
142
+ return sa_file_func(FoldersAsyncClient, filename, *args, **kwargs)
143
+
144
+ from_service_account_json = from_service_account_file
145
+
146
+ @classmethod
147
+ def get_mtls_endpoint_and_cert_source(
148
+ cls, client_options: Optional[ClientOptions] = None
149
+ ):
150
+ """Return the API endpoint and client cert source for mutual TLS.
151
+
152
+ The client cert source is determined in the following order:
153
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
154
+ client cert source is None.
155
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
156
+ default client cert source exists, use the default one; otherwise the client cert
157
+ source is None.
158
+
159
+ The API endpoint is determined in the following order:
160
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
161
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
162
+ default mTLS endpoint; if the environment variable is "never", use the default API
163
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
164
+ use the default API endpoint.
165
+
166
+ More details can be found at https://google.aip.dev/auth/4114.
167
+
168
+ Args:
169
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
170
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
171
+ in this method.
172
+
173
+ Returns:
174
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
175
+ client cert source to use.
176
+
177
+ Raises:
178
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
179
+ """
180
+ return FoldersClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
181
+
182
+ @property
183
+ def transport(self) -> FoldersTransport:
184
+ """Returns the transport used by the client instance.
185
+
186
+ Returns:
187
+ FoldersTransport: The transport used by the client instance.
188
+ """
189
+ return self._client.transport
190
+
191
+ @property
192
+ def api_endpoint(self) -> str:
193
+ """Return the API endpoint used by the client instance.
194
+
195
+ Returns:
196
+ str: The API endpoint used by the client instance.
197
+ """
198
+ return self._client._api_endpoint
199
+
200
+ @property
201
+ def universe_domain(self) -> str:
202
+ """Return the universe domain used by the client instance.
203
+
204
+ Returns:
205
+ str: The universe domain used
206
+ by the client instance.
207
+ """
208
+ return self._client._universe_domain
209
+
210
+ get_transport_class = FoldersClient.get_transport_class
211
+
212
+ def __init__(
213
+ self,
214
+ *,
215
+ credentials: Optional[ga_credentials.Credentials] = None,
216
+ transport: Optional[
217
+ Union[str, FoldersTransport, Callable[..., FoldersTransport]]
218
+ ] = "grpc_asyncio",
219
+ client_options: Optional[ClientOptions] = None,
220
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
221
+ ) -> None:
222
+ """Instantiates the folders async client.
223
+
224
+ Args:
225
+ credentials (Optional[google.auth.credentials.Credentials]): The
226
+ authorization credentials to attach to requests. These
227
+ credentials identify the application to the service; if none
228
+ are specified, the client will attempt to ascertain the
229
+ credentials from the environment.
230
+ transport (Optional[Union[str,FoldersTransport,Callable[..., FoldersTransport]]]):
231
+ The transport to use, or a Callable that constructs and returns a new transport to use.
232
+ If a Callable is given, it will be called with the same set of initialization
233
+ arguments as used in the FoldersTransport constructor.
234
+ If set to None, a transport is chosen automatically.
235
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
236
+ Custom options for the client.
237
+
238
+ 1. The ``api_endpoint`` property can be used to override the
239
+ default endpoint provided by the client when ``transport`` is
240
+ not explicitly provided. Only if this property is not set and
241
+ ``transport`` was not explicitly provided, the endpoint is
242
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
243
+ variable, which have one of the following values:
244
+ "always" (always use the default mTLS endpoint), "never" (always
245
+ use the default regular endpoint) and "auto" (auto-switch to the
246
+ default mTLS endpoint if client certificate is present; this is
247
+ the default value).
248
+
249
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
250
+ is "true", then the ``client_cert_source`` property can be used
251
+ to provide a client certificate for mTLS transport. If
252
+ not provided, the default SSL client certificate will be used if
253
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
254
+ set, no client certificate will be used.
255
+
256
+ 3. The ``universe_domain`` property can be used to override the
257
+ default "googleapis.com" universe. Note that ``api_endpoint``
258
+ property still takes precedence; and ``universe_domain`` is
259
+ currently not supported for mTLS.
260
+
261
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
262
+ The client info used to send a user-agent string along with
263
+ API requests. If ``None``, then default info will be used.
264
+ Generally, you only need to set this if you're developing
265
+ your own client library.
266
+
267
+ Raises:
268
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
269
+ creation failed for any reason.
270
+ """
271
+ self._client = FoldersClient(
272
+ credentials=credentials,
273
+ transport=transport,
274
+ client_options=client_options,
275
+ client_info=client_info,
276
+ )
277
+
278
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
279
+ std_logging.DEBUG
280
+ ): # pragma: NO COVER
281
+ _LOGGER.debug(
282
+ "Created client `google.cloud.resourcemanager_v3.FoldersAsyncClient`.",
283
+ extra={
284
+ "serviceName": "google.cloud.resourcemanager.v3.Folders",
285
+ "universeDomain": getattr(
286
+ self._client._transport._credentials, "universe_domain", ""
287
+ ),
288
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
289
+ "credentialsInfo": getattr(
290
+ self.transport._credentials, "get_cred_info", lambda: None
291
+ )(),
292
+ }
293
+ if hasattr(self._client._transport, "_credentials")
294
+ else {
295
+ "serviceName": "google.cloud.resourcemanager.v3.Folders",
296
+ "credentialsType": None,
297
+ },
298
+ )
299
+
300
+ async def get_folder(
301
+ self,
302
+ request: Optional[Union[folders.GetFolderRequest, dict]] = None,
303
+ *,
304
+ name: Optional[str] = None,
305
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
306
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
307
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
308
+ ) -> folders.Folder:
309
+ r"""Retrieves a folder identified by the supplied resource name.
310
+ Valid folder resource names have the format
311
+ ``folders/{folder_id}`` (for example, ``folders/1234``). The
312
+ caller must have ``resourcemanager.folders.get`` permission on
313
+ the identified folder.
314
+
315
+ .. code-block:: python
316
+
317
+ # This snippet has been automatically generated and should be regarded as a
318
+ # code template only.
319
+ # It will require modifications to work:
320
+ # - It may require correct/in-range values for request initialization.
321
+ # - It may require specifying regional endpoints when creating the service
322
+ # client as shown in:
323
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
324
+ from google.cloud import resourcemanager_v3
325
+
326
+ async def sample_get_folder():
327
+ # Create a client
328
+ client = resourcemanager_v3.FoldersAsyncClient()
329
+
330
+ # Initialize request argument(s)
331
+ request = resourcemanager_v3.GetFolderRequest(
332
+ name="name_value",
333
+ )
334
+
335
+ # Make the request
336
+ response = await client.get_folder(request=request)
337
+
338
+ # Handle the response
339
+ print(response)
340
+
341
+ Args:
342
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.GetFolderRequest, dict]]):
343
+ The request object. The GetFolder request message.
344
+ name (:class:`str`):
345
+ Required. The resource name of the folder to retrieve.
346
+ Must be of the form ``folders/{folder_id}``.
347
+
348
+ This corresponds to the ``name`` field
349
+ on the ``request`` instance; if ``request`` is provided, this
350
+ should not be set.
351
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
352
+ should be retried.
353
+ timeout (float): The timeout for this request.
354
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
355
+ sent along with the request as metadata. Normally, each value must be of type `str`,
356
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
357
+ be of type `bytes`.
358
+
359
+ Returns:
360
+ google.cloud.resourcemanager_v3.types.Folder:
361
+ A folder in an organization's
362
+ resource hierarchy, used to organize
363
+ that organization's resources.
364
+
365
+ """
366
+ # Create or coerce a protobuf request object.
367
+ # - Quick check: If we got a request object, we should *not* have
368
+ # gotten any keyword arguments that map to the request.
369
+ flattened_params = [name]
370
+ has_flattened_params = (
371
+ len([param for param in flattened_params if param is not None]) > 0
372
+ )
373
+ if request is not None and has_flattened_params:
374
+ raise ValueError(
375
+ "If the `request` argument is set, then none of "
376
+ "the individual field arguments should be set."
377
+ )
378
+
379
+ # - Use the request object if provided (there's no risk of modifying the input as
380
+ # there are no flattened fields), or create one.
381
+ if not isinstance(request, folders.GetFolderRequest):
382
+ request = folders.GetFolderRequest(request)
383
+
384
+ # If we have keyword arguments corresponding to fields on the
385
+ # request, apply these.
386
+ if name is not None:
387
+ request.name = name
388
+
389
+ # Wrap the RPC method; this adds retry and timeout information,
390
+ # and friendly error handling.
391
+ rpc = self._client._transport._wrapped_methods[
392
+ self._client._transport.get_folder
393
+ ]
394
+
395
+ # Certain fields should be provided within the metadata header;
396
+ # add these here.
397
+ metadata = tuple(metadata) + (
398
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
399
+ )
400
+
401
+ # Validate the universe domain.
402
+ self._client._validate_universe_domain()
403
+
404
+ # Send the request.
405
+ response = await rpc(
406
+ request,
407
+ retry=retry,
408
+ timeout=timeout,
409
+ metadata=metadata,
410
+ )
411
+
412
+ # Done; return the response.
413
+ return response
414
+
415
+ async def list_folders(
416
+ self,
417
+ request: Optional[Union[folders.ListFoldersRequest, dict]] = None,
418
+ *,
419
+ parent: Optional[str] = None,
420
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
421
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
422
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
423
+ ) -> pagers.ListFoldersAsyncPager:
424
+ r"""Lists the folders that are direct descendants of supplied parent
425
+ resource. ``list()`` provides a strongly consistent view of the
426
+ folders underneath the specified parent resource. ``list()``
427
+ returns folders sorted based upon the (ascending) lexical
428
+ ordering of their display_name. The caller must have
429
+ ``resourcemanager.folders.list`` permission on the identified
430
+ parent.
431
+
432
+ .. code-block:: python
433
+
434
+ # This snippet has been automatically generated and should be regarded as a
435
+ # code template only.
436
+ # It will require modifications to work:
437
+ # - It may require correct/in-range values for request initialization.
438
+ # - It may require specifying regional endpoints when creating the service
439
+ # client as shown in:
440
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
441
+ from google.cloud import resourcemanager_v3
442
+
443
+ async def sample_list_folders():
444
+ # Create a client
445
+ client = resourcemanager_v3.FoldersAsyncClient()
446
+
447
+ # Initialize request argument(s)
448
+ request = resourcemanager_v3.ListFoldersRequest(
449
+ parent="parent_value",
450
+ )
451
+
452
+ # Make the request
453
+ page_result = client.list_folders(request=request)
454
+
455
+ # Handle the response
456
+ async for response in page_result:
457
+ print(response)
458
+
459
+ Args:
460
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.ListFoldersRequest, dict]]):
461
+ The request object. The ListFolders request message.
462
+ parent (:class:`str`):
463
+ Required. The name of the parent resource whose folders
464
+ are being listed. Only children of this parent resource
465
+ are listed; descendants are not listed.
466
+
467
+ If the parent is a folder, use the value
468
+ ``folders/{folder_id}``. If the parent is an
469
+ organization, use the value ``organizations/{org_id}``.
470
+
471
+ Access to this method is controlled by checking the
472
+ ``resourcemanager.folders.list`` permission on the
473
+ ``parent``.
474
+
475
+ This corresponds to the ``parent`` field
476
+ on the ``request`` instance; if ``request`` is provided, this
477
+ should not be set.
478
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
479
+ should be retried.
480
+ timeout (float): The timeout for this request.
481
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
482
+ sent along with the request as metadata. Normally, each value must be of type `str`,
483
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
484
+ be of type `bytes`.
485
+
486
+ Returns:
487
+ google.cloud.resourcemanager_v3.services.folders.pagers.ListFoldersAsyncPager:
488
+ The ListFolders response message.
489
+
490
+ Iterating over this object will yield
491
+ results and resolve additional pages
492
+ automatically.
493
+
494
+ """
495
+ # Create or coerce a protobuf request object.
496
+ # - Quick check: If we got a request object, we should *not* have
497
+ # gotten any keyword arguments that map to the request.
498
+ flattened_params = [parent]
499
+ has_flattened_params = (
500
+ len([param for param in flattened_params if param is not None]) > 0
501
+ )
502
+ if request is not None and has_flattened_params:
503
+ raise ValueError(
504
+ "If the `request` argument is set, then none of "
505
+ "the individual field arguments should be set."
506
+ )
507
+
508
+ # - Use the request object if provided (there's no risk of modifying the input as
509
+ # there are no flattened fields), or create one.
510
+ if not isinstance(request, folders.ListFoldersRequest):
511
+ request = folders.ListFoldersRequest(request)
512
+
513
+ # If we have keyword arguments corresponding to fields on the
514
+ # request, apply these.
515
+ if parent is not None:
516
+ request.parent = parent
517
+
518
+ # Wrap the RPC method; this adds retry and timeout information,
519
+ # and friendly error handling.
520
+ rpc = self._client._transport._wrapped_methods[
521
+ self._client._transport.list_folders
522
+ ]
523
+
524
+ # Validate the universe domain.
525
+ self._client._validate_universe_domain()
526
+
527
+ # Send the request.
528
+ response = await rpc(
529
+ request,
530
+ retry=retry,
531
+ timeout=timeout,
532
+ metadata=metadata,
533
+ )
534
+
535
+ # This method is paged; wrap the response in a pager, which provides
536
+ # an `__aiter__` convenience method.
537
+ response = pagers.ListFoldersAsyncPager(
538
+ method=rpc,
539
+ request=request,
540
+ response=response,
541
+ retry=retry,
542
+ timeout=timeout,
543
+ metadata=metadata,
544
+ )
545
+
546
+ # Done; return the response.
547
+ return response
548
+
549
+ async def search_folders(
550
+ self,
551
+ request: Optional[Union[folders.SearchFoldersRequest, dict]] = None,
552
+ *,
553
+ query: Optional[str] = None,
554
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
555
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
556
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
557
+ ) -> pagers.SearchFoldersAsyncPager:
558
+ r"""Search for folders that match specific filter criteria.
559
+ ``search()`` provides an eventually consistent view of the
560
+ folders a user has access to which meet the specified filter
561
+ criteria.
562
+
563
+ This will only return folders on which the caller has the
564
+ permission ``resourcemanager.folders.get``.
565
+
566
+ .. code-block:: python
567
+
568
+ # This snippet has been automatically generated and should be regarded as a
569
+ # code template only.
570
+ # It will require modifications to work:
571
+ # - It may require correct/in-range values for request initialization.
572
+ # - It may require specifying regional endpoints when creating the service
573
+ # client as shown in:
574
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
575
+ from google.cloud import resourcemanager_v3
576
+
577
+ async def sample_search_folders():
578
+ # Create a client
579
+ client = resourcemanager_v3.FoldersAsyncClient()
580
+
581
+ # Initialize request argument(s)
582
+ request = resourcemanager_v3.SearchFoldersRequest(
583
+ )
584
+
585
+ # Make the request
586
+ page_result = client.search_folders(request=request)
587
+
588
+ # Handle the response
589
+ async for response in page_result:
590
+ print(response)
591
+
592
+ Args:
593
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.SearchFoldersRequest, dict]]):
594
+ The request object. The request message for searching
595
+ folders.
596
+ query (:class:`str`):
597
+ Optional. Search criteria used to select the folders to
598
+ return. If no search criteria is specified then all
599
+ accessible folders will be returned.
600
+
601
+ Query expressions can be used to restrict results based
602
+ upon displayName, state and parent, where the operators
603
+ ``=`` (``:``) ``NOT``, ``AND`` and ``OR`` can be used
604
+ along with the suffix wildcard symbol ``*``.
605
+
606
+ The ``displayName`` field in a query expression should
607
+ use escaped quotes for values that include whitespace to
608
+ prevent unexpected behavior.
609
+
610
+ ::
611
+
612
+ | Field | Description |
613
+ |-------------------------|----------------------------------------|
614
+ | displayName | Filters by displayName. |
615
+ | parent | Filters by parent (for example: folders/123). |
616
+ | state, lifecycleState | Filters by state. |
617
+
618
+ Some example queries are:
619
+
620
+ - Query ``displayName=Test*`` returns Folder resources
621
+ whose display name starts with "Test".
622
+ - Query ``state=ACTIVE`` returns Folder resources with
623
+ ``state`` set to ``ACTIVE``.
624
+ - Query ``parent=folders/123`` returns Folder resources
625
+ that have ``folders/123`` as a parent resource.
626
+ - Query ``parent=folders/123 AND state=ACTIVE`` returns
627
+ active Folder resources that have ``folders/123`` as a
628
+ parent resource.
629
+ - Query ``displayName=\\"Test String\\"`` returns Folder
630
+ resources with display names that include both "Test"
631
+ and "String".
632
+
633
+ This corresponds to the ``query`` field
634
+ on the ``request`` instance; if ``request`` is provided, this
635
+ should not be set.
636
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
637
+ should be retried.
638
+ timeout (float): The timeout for this request.
639
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
640
+ sent along with the request as metadata. Normally, each value must be of type `str`,
641
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
642
+ be of type `bytes`.
643
+
644
+ Returns:
645
+ google.cloud.resourcemanager_v3.services.folders.pagers.SearchFoldersAsyncPager:
646
+ The response message for searching
647
+ folders.
648
+ Iterating over this object will yield
649
+ results and resolve additional pages
650
+ automatically.
651
+
652
+ """
653
+ # Create or coerce a protobuf request object.
654
+ # - Quick check: If we got a request object, we should *not* have
655
+ # gotten any keyword arguments that map to the request.
656
+ flattened_params = [query]
657
+ has_flattened_params = (
658
+ len([param for param in flattened_params if param is not None]) > 0
659
+ )
660
+ if request is not None and has_flattened_params:
661
+ raise ValueError(
662
+ "If the `request` argument is set, then none of "
663
+ "the individual field arguments should be set."
664
+ )
665
+
666
+ # - Use the request object if provided (there's no risk of modifying the input as
667
+ # there are no flattened fields), or create one.
668
+ if not isinstance(request, folders.SearchFoldersRequest):
669
+ request = folders.SearchFoldersRequest(request)
670
+
671
+ # If we have keyword arguments corresponding to fields on the
672
+ # request, apply these.
673
+ if query is not None:
674
+ request.query = query
675
+
676
+ # Wrap the RPC method; this adds retry and timeout information,
677
+ # and friendly error handling.
678
+ rpc = self._client._transport._wrapped_methods[
679
+ self._client._transport.search_folders
680
+ ]
681
+
682
+ # Validate the universe domain.
683
+ self._client._validate_universe_domain()
684
+
685
+ # Send the request.
686
+ response = await rpc(
687
+ request,
688
+ retry=retry,
689
+ timeout=timeout,
690
+ metadata=metadata,
691
+ )
692
+
693
+ # This method is paged; wrap the response in a pager, which provides
694
+ # an `__aiter__` convenience method.
695
+ response = pagers.SearchFoldersAsyncPager(
696
+ method=rpc,
697
+ request=request,
698
+ response=response,
699
+ retry=retry,
700
+ timeout=timeout,
701
+ metadata=metadata,
702
+ )
703
+
704
+ # Done; return the response.
705
+ return response
706
+
707
+ async def create_folder(
708
+ self,
709
+ request: Optional[Union[folders.CreateFolderRequest, dict]] = None,
710
+ *,
711
+ folder: Optional[folders.Folder] = None,
712
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
713
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
714
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
715
+ ) -> operation_async.AsyncOperation:
716
+ r"""Creates a folder in the resource hierarchy. Returns an
717
+ ``Operation`` which can be used to track the progress of the
718
+ folder creation workflow. Upon success, the
719
+ ``Operation.response`` field will be populated with the created
720
+ Folder.
721
+
722
+ In order to succeed, the addition of this new folder must not
723
+ violate the folder naming, height, or fanout constraints.
724
+
725
+ - The folder's ``display_name`` must be distinct from all other
726
+ folders that share its parent.
727
+ - The addition of the folder must not cause the active folder
728
+ hierarchy to exceed a height of 10. Note, the full active +
729
+ deleted folder hierarchy is allowed to reach a height of 20;
730
+ this provides additional headroom when moving folders that
731
+ contain deleted folders.
732
+ - The addition of the folder must not cause the total number of
733
+ folders under its parent to exceed 300.
734
+
735
+ If the operation fails due to a folder constraint violation,
736
+ some errors may be returned by the ``CreateFolder`` request,
737
+ with status code ``FAILED_PRECONDITION`` and an error
738
+ description. Other folder constraint violations will be
739
+ communicated in the ``Operation``, with the specific
740
+ ``PreconditionFailure`` returned in the details list in the
741
+ ``Operation.error`` field.
742
+
743
+ The caller must have ``resourcemanager.folders.create``
744
+ permission on the identified parent.
745
+
746
+ .. code-block:: python
747
+
748
+ # This snippet has been automatically generated and should be regarded as a
749
+ # code template only.
750
+ # It will require modifications to work:
751
+ # - It may require correct/in-range values for request initialization.
752
+ # - It may require specifying regional endpoints when creating the service
753
+ # client as shown in:
754
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
755
+ from google.cloud import resourcemanager_v3
756
+
757
+ async def sample_create_folder():
758
+ # Create a client
759
+ client = resourcemanager_v3.FoldersAsyncClient()
760
+
761
+ # Initialize request argument(s)
762
+ folder = resourcemanager_v3.Folder()
763
+ folder.parent = "parent_value"
764
+
765
+ request = resourcemanager_v3.CreateFolderRequest(
766
+ folder=folder,
767
+ )
768
+
769
+ # Make the request
770
+ operation = client.create_folder(request=request)
771
+
772
+ print("Waiting for operation to complete...")
773
+
774
+ response = (await operation).result()
775
+
776
+ # Handle the response
777
+ print(response)
778
+
779
+ Args:
780
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.CreateFolderRequest, dict]]):
781
+ The request object. The CreateFolder request message.
782
+ folder (:class:`google.cloud.resourcemanager_v3.types.Folder`):
783
+ Required. The folder being created,
784
+ only the display name and parent will be
785
+ consulted. All other fields will be
786
+ ignored.
787
+
788
+ This corresponds to the ``folder`` field
789
+ on the ``request`` instance; if ``request`` is provided, this
790
+ should not be set.
791
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
792
+ should be retried.
793
+ timeout (float): The timeout for this request.
794
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
795
+ sent along with the request as metadata. Normally, each value must be of type `str`,
796
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
797
+ be of type `bytes`.
798
+
799
+ Returns:
800
+ google.api_core.operation_async.AsyncOperation:
801
+ An object representing a long-running operation.
802
+
803
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.Folder` A folder in an organization's resource hierarchy, used to
804
+ organize that organization's resources.
805
+
806
+ """
807
+ # Create or coerce a protobuf request object.
808
+ # - Quick check: If we got a request object, we should *not* have
809
+ # gotten any keyword arguments that map to the request.
810
+ flattened_params = [folder]
811
+ has_flattened_params = (
812
+ len([param for param in flattened_params if param is not None]) > 0
813
+ )
814
+ if request is not None and has_flattened_params:
815
+ raise ValueError(
816
+ "If the `request` argument is set, then none of "
817
+ "the individual field arguments should be set."
818
+ )
819
+
820
+ # - Use the request object if provided (there's no risk of modifying the input as
821
+ # there are no flattened fields), or create one.
822
+ if not isinstance(request, folders.CreateFolderRequest):
823
+ request = folders.CreateFolderRequest(request)
824
+
825
+ # If we have keyword arguments corresponding to fields on the
826
+ # request, apply these.
827
+ if folder is not None:
828
+ request.folder = folder
829
+
830
+ # Wrap the RPC method; this adds retry and timeout information,
831
+ # and friendly error handling.
832
+ rpc = self._client._transport._wrapped_methods[
833
+ self._client._transport.create_folder
834
+ ]
835
+
836
+ # Validate the universe domain.
837
+ self._client._validate_universe_domain()
838
+
839
+ # Send the request.
840
+ response = await rpc(
841
+ request,
842
+ retry=retry,
843
+ timeout=timeout,
844
+ metadata=metadata,
845
+ )
846
+
847
+ # Wrap the response in an operation future.
848
+ response = operation_async.from_gapic(
849
+ response,
850
+ self._client._transport.operations_client,
851
+ folders.Folder,
852
+ metadata_type=folders.CreateFolderMetadata,
853
+ )
854
+
855
+ # Done; return the response.
856
+ return response
857
+
858
+ async def update_folder(
859
+ self,
860
+ request: Optional[Union[folders.UpdateFolderRequest, dict]] = None,
861
+ *,
862
+ folder: Optional[folders.Folder] = None,
863
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
864
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
865
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
866
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
867
+ ) -> operation_async.AsyncOperation:
868
+ r"""Updates a folder, changing its ``display_name``. Changes to the
869
+ folder ``display_name`` will be rejected if they violate either
870
+ the ``display_name`` formatting rules or the naming constraints
871
+ described in the
872
+ [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder]
873
+ documentation.
874
+
875
+ The folder's ``display_name`` must start and end with a letter
876
+ or digit, may contain letters, digits, spaces, hyphens and
877
+ underscores and can be between 3 and 30 characters. This is
878
+ captured by the regular expression:
879
+ ``[\p{L}\p{N}][\p{L}\p{N}_- ]{1,28}[\p{L}\p{N}]``. The caller
880
+ must have ``resourcemanager.folders.update`` permission on the
881
+ identified folder.
882
+
883
+ If the update fails due to the unique name constraint then a
884
+ ``PreconditionFailure`` explaining this violation will be
885
+ returned in the Status.details field.
886
+
887
+ .. code-block:: python
888
+
889
+ # This snippet has been automatically generated and should be regarded as a
890
+ # code template only.
891
+ # It will require modifications to work:
892
+ # - It may require correct/in-range values for request initialization.
893
+ # - It may require specifying regional endpoints when creating the service
894
+ # client as shown in:
895
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
896
+ from google.cloud import resourcemanager_v3
897
+
898
+ async def sample_update_folder():
899
+ # Create a client
900
+ client = resourcemanager_v3.FoldersAsyncClient()
901
+
902
+ # Initialize request argument(s)
903
+ folder = resourcemanager_v3.Folder()
904
+ folder.parent = "parent_value"
905
+
906
+ request = resourcemanager_v3.UpdateFolderRequest(
907
+ folder=folder,
908
+ )
909
+
910
+ # Make the request
911
+ operation = client.update_folder(request=request)
912
+
913
+ print("Waiting for operation to complete...")
914
+
915
+ response = (await operation).result()
916
+
917
+ # Handle the response
918
+ print(response)
919
+
920
+ Args:
921
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.UpdateFolderRequest, dict]]):
922
+ The request object. The request sent to the
923
+ [UpdateFolder][google.cloud.resourcemanager.v3.Folder.UpdateFolder]
924
+ method.
925
+
926
+ Only the ``display_name`` field can be changed. All
927
+ other fields will be ignored. Use the
928
+ [MoveFolder][google.cloud.resourcemanager.v3.Folders.MoveFolder]
929
+ method to change the ``parent`` field.
930
+ folder (:class:`google.cloud.resourcemanager_v3.types.Folder`):
931
+ Required. The new definition of the Folder. It must
932
+ include the ``name`` field, which cannot be changed.
933
+
934
+ This corresponds to the ``folder`` field
935
+ on the ``request`` instance; if ``request`` is provided, this
936
+ should not be set.
937
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
938
+ Required. Fields to be updated. Only the
939
+ ``display_name`` can be updated.
940
+
941
+ This corresponds to the ``update_mask`` field
942
+ on the ``request`` instance; if ``request`` is provided, this
943
+ should not be set.
944
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
945
+ should be retried.
946
+ timeout (float): The timeout for this request.
947
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
948
+ sent along with the request as metadata. Normally, each value must be of type `str`,
949
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
950
+ be of type `bytes`.
951
+
952
+ Returns:
953
+ google.api_core.operation_async.AsyncOperation:
954
+ An object representing a long-running operation.
955
+
956
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.Folder` A folder in an organization's resource hierarchy, used to
957
+ organize that organization's resources.
958
+
959
+ """
960
+ # Create or coerce a protobuf request object.
961
+ # - Quick check: If we got a request object, we should *not* have
962
+ # gotten any keyword arguments that map to the request.
963
+ flattened_params = [folder, update_mask]
964
+ has_flattened_params = (
965
+ len([param for param in flattened_params if param is not None]) > 0
966
+ )
967
+ if request is not None and has_flattened_params:
968
+ raise ValueError(
969
+ "If the `request` argument is set, then none of "
970
+ "the individual field arguments should be set."
971
+ )
972
+
973
+ # - Use the request object if provided (there's no risk of modifying the input as
974
+ # there are no flattened fields), or create one.
975
+ if not isinstance(request, folders.UpdateFolderRequest):
976
+ request = folders.UpdateFolderRequest(request)
977
+
978
+ # If we have keyword arguments corresponding to fields on the
979
+ # request, apply these.
980
+ if folder is not None:
981
+ request.folder = folder
982
+ if update_mask is not None:
983
+ request.update_mask = update_mask
984
+
985
+ # Wrap the RPC method; this adds retry and timeout information,
986
+ # and friendly error handling.
987
+ rpc = self._client._transport._wrapped_methods[
988
+ self._client._transport.update_folder
989
+ ]
990
+
991
+ # Certain fields should be provided within the metadata header;
992
+ # add these here.
993
+ metadata = tuple(metadata) + (
994
+ gapic_v1.routing_header.to_grpc_metadata(
995
+ (("folder.name", request.folder.name),)
996
+ ),
997
+ )
998
+
999
+ # Validate the universe domain.
1000
+ self._client._validate_universe_domain()
1001
+
1002
+ # Send the request.
1003
+ response = await rpc(
1004
+ request,
1005
+ retry=retry,
1006
+ timeout=timeout,
1007
+ metadata=metadata,
1008
+ )
1009
+
1010
+ # Wrap the response in an operation future.
1011
+ response = operation_async.from_gapic(
1012
+ response,
1013
+ self._client._transport.operations_client,
1014
+ folders.Folder,
1015
+ metadata_type=folders.UpdateFolderMetadata,
1016
+ )
1017
+
1018
+ # Done; return the response.
1019
+ return response
1020
+
1021
+ async def move_folder(
1022
+ self,
1023
+ request: Optional[Union[folders.MoveFolderRequest, dict]] = None,
1024
+ *,
1025
+ name: Optional[str] = None,
1026
+ destination_parent: Optional[str] = None,
1027
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1028
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1029
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1030
+ ) -> operation_async.AsyncOperation:
1031
+ r"""Moves a folder under a new resource parent. Returns an
1032
+ ``Operation`` which can be used to track the progress of the
1033
+ folder move workflow. Upon success, the ``Operation.response``
1034
+ field will be populated with the moved folder. Upon failure, a
1035
+ ``FolderOperationError`` categorizing the failure cause will be
1036
+ returned - if the failure occurs synchronously then the
1037
+ ``FolderOperationError`` will be returned in the
1038
+ ``Status.details`` field. If it occurs asynchronously, then the
1039
+ FolderOperation will be returned in the ``Operation.error``
1040
+ field. In addition, the ``Operation.metadata`` field will be
1041
+ populated with a ``FolderOperation`` message as an aid to
1042
+ stateless clients. Folder moves will be rejected if they violate
1043
+ either the naming, height, or fanout constraints described in
1044
+ the
1045
+ [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder]
1046
+ documentation. The caller must have
1047
+ ``resourcemanager.folders.move`` permission on the folder's
1048
+ current and proposed new parent.
1049
+
1050
+ .. code-block:: python
1051
+
1052
+ # This snippet has been automatically generated and should be regarded as a
1053
+ # code template only.
1054
+ # It will require modifications to work:
1055
+ # - It may require correct/in-range values for request initialization.
1056
+ # - It may require specifying regional endpoints when creating the service
1057
+ # client as shown in:
1058
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1059
+ from google.cloud import resourcemanager_v3
1060
+
1061
+ async def sample_move_folder():
1062
+ # Create a client
1063
+ client = resourcemanager_v3.FoldersAsyncClient()
1064
+
1065
+ # Initialize request argument(s)
1066
+ request = resourcemanager_v3.MoveFolderRequest(
1067
+ name="name_value",
1068
+ destination_parent="destination_parent_value",
1069
+ )
1070
+
1071
+ # Make the request
1072
+ operation = client.move_folder(request=request)
1073
+
1074
+ print("Waiting for operation to complete...")
1075
+
1076
+ response = (await operation).result()
1077
+
1078
+ # Handle the response
1079
+ print(response)
1080
+
1081
+ Args:
1082
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.MoveFolderRequest, dict]]):
1083
+ The request object. The MoveFolder request message.
1084
+ name (:class:`str`):
1085
+ Required. The resource name of the Folder to move. Must
1086
+ be of the form folders/{folder_id}
1087
+
1088
+ This corresponds to the ``name`` field
1089
+ on the ``request`` instance; if ``request`` is provided, this
1090
+ should not be set.
1091
+ destination_parent (:class:`str`):
1092
+ Required. The resource name of the folder or
1093
+ organization which should be the folder's new parent.
1094
+ Must be of the form ``folders/{folder_id}`` or
1095
+ ``organizations/{org_id}``.
1096
+
1097
+ This corresponds to the ``destination_parent`` field
1098
+ on the ``request`` instance; if ``request`` is provided, this
1099
+ should not be set.
1100
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1101
+ should be retried.
1102
+ timeout (float): The timeout for this request.
1103
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1104
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1105
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1106
+ be of type `bytes`.
1107
+
1108
+ Returns:
1109
+ google.api_core.operation_async.AsyncOperation:
1110
+ An object representing a long-running operation.
1111
+
1112
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.Folder` A folder in an organization's resource hierarchy, used to
1113
+ organize that organization's resources.
1114
+
1115
+ """
1116
+ # Create or coerce a protobuf request object.
1117
+ # - Quick check: If we got a request object, we should *not* have
1118
+ # gotten any keyword arguments that map to the request.
1119
+ flattened_params = [name, destination_parent]
1120
+ has_flattened_params = (
1121
+ len([param for param in flattened_params if param is not None]) > 0
1122
+ )
1123
+ if request is not None and has_flattened_params:
1124
+ raise ValueError(
1125
+ "If the `request` argument is set, then none of "
1126
+ "the individual field arguments should be set."
1127
+ )
1128
+
1129
+ # - Use the request object if provided (there's no risk of modifying the input as
1130
+ # there are no flattened fields), or create one.
1131
+ if not isinstance(request, folders.MoveFolderRequest):
1132
+ request = folders.MoveFolderRequest(request)
1133
+
1134
+ # If we have keyword arguments corresponding to fields on the
1135
+ # request, apply these.
1136
+ if name is not None:
1137
+ request.name = name
1138
+ if destination_parent is not None:
1139
+ request.destination_parent = destination_parent
1140
+
1141
+ # Wrap the RPC method; this adds retry and timeout information,
1142
+ # and friendly error handling.
1143
+ rpc = self._client._transport._wrapped_methods[
1144
+ self._client._transport.move_folder
1145
+ ]
1146
+
1147
+ # Certain fields should be provided within the metadata header;
1148
+ # add these here.
1149
+ metadata = tuple(metadata) + (
1150
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1151
+ )
1152
+
1153
+ # Validate the universe domain.
1154
+ self._client._validate_universe_domain()
1155
+
1156
+ # Send the request.
1157
+ response = await rpc(
1158
+ request,
1159
+ retry=retry,
1160
+ timeout=timeout,
1161
+ metadata=metadata,
1162
+ )
1163
+
1164
+ # Wrap the response in an operation future.
1165
+ response = operation_async.from_gapic(
1166
+ response,
1167
+ self._client._transport.operations_client,
1168
+ folders.Folder,
1169
+ metadata_type=folders.MoveFolderMetadata,
1170
+ )
1171
+
1172
+ # Done; return the response.
1173
+ return response
1174
+
1175
+ async def delete_folder(
1176
+ self,
1177
+ request: Optional[Union[folders.DeleteFolderRequest, dict]] = None,
1178
+ *,
1179
+ name: Optional[str] = None,
1180
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1181
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1182
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1183
+ ) -> operation_async.AsyncOperation:
1184
+ r"""Requests deletion of a folder. The folder is moved into the
1185
+ [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED]
1186
+ state immediately, and is deleted approximately 30 days later.
1187
+ This method may only be called on an empty folder, where a
1188
+ folder is empty if it doesn't contain any folders or projects in
1189
+ the
1190
+ [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE]
1191
+ state. If called on a folder in
1192
+ [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED]
1193
+ state the operation will result in a no-op success. The caller
1194
+ must have ``resourcemanager.folders.delete`` permission on the
1195
+ identified folder.
1196
+
1197
+ .. code-block:: python
1198
+
1199
+ # This snippet has been automatically generated and should be regarded as a
1200
+ # code template only.
1201
+ # It will require modifications to work:
1202
+ # - It may require correct/in-range values for request initialization.
1203
+ # - It may require specifying regional endpoints when creating the service
1204
+ # client as shown in:
1205
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1206
+ from google.cloud import resourcemanager_v3
1207
+
1208
+ async def sample_delete_folder():
1209
+ # Create a client
1210
+ client = resourcemanager_v3.FoldersAsyncClient()
1211
+
1212
+ # Initialize request argument(s)
1213
+ request = resourcemanager_v3.DeleteFolderRequest(
1214
+ name="name_value",
1215
+ )
1216
+
1217
+ # Make the request
1218
+ operation = client.delete_folder(request=request)
1219
+
1220
+ print("Waiting for operation to complete...")
1221
+
1222
+ response = (await operation).result()
1223
+
1224
+ # Handle the response
1225
+ print(response)
1226
+
1227
+ Args:
1228
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.DeleteFolderRequest, dict]]):
1229
+ The request object. The DeleteFolder request message.
1230
+ name (:class:`str`):
1231
+ Required. The resource name of the folder to be deleted.
1232
+ Must be of the form ``folders/{folder_id}``.
1233
+
1234
+ This corresponds to the ``name`` field
1235
+ on the ``request`` instance; if ``request`` is provided, this
1236
+ should not be set.
1237
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1238
+ should be retried.
1239
+ timeout (float): The timeout for this request.
1240
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1241
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1242
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1243
+ be of type `bytes`.
1244
+
1245
+ Returns:
1246
+ google.api_core.operation_async.AsyncOperation:
1247
+ An object representing a long-running operation.
1248
+
1249
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.Folder` A folder in an organization's resource hierarchy, used to
1250
+ organize that organization's resources.
1251
+
1252
+ """
1253
+ # Create or coerce a protobuf request object.
1254
+ # - Quick check: If we got a request object, we should *not* have
1255
+ # gotten any keyword arguments that map to the request.
1256
+ flattened_params = [name]
1257
+ has_flattened_params = (
1258
+ len([param for param in flattened_params if param is not None]) > 0
1259
+ )
1260
+ if request is not None and has_flattened_params:
1261
+ raise ValueError(
1262
+ "If the `request` argument is set, then none of "
1263
+ "the individual field arguments should be set."
1264
+ )
1265
+
1266
+ # - Use the request object if provided (there's no risk of modifying the input as
1267
+ # there are no flattened fields), or create one.
1268
+ if not isinstance(request, folders.DeleteFolderRequest):
1269
+ request = folders.DeleteFolderRequest(request)
1270
+
1271
+ # If we have keyword arguments corresponding to fields on the
1272
+ # request, apply these.
1273
+ if name is not None:
1274
+ request.name = name
1275
+
1276
+ # Wrap the RPC method; this adds retry and timeout information,
1277
+ # and friendly error handling.
1278
+ rpc = self._client._transport._wrapped_methods[
1279
+ self._client._transport.delete_folder
1280
+ ]
1281
+
1282
+ # Certain fields should be provided within the metadata header;
1283
+ # add these here.
1284
+ metadata = tuple(metadata) + (
1285
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1286
+ )
1287
+
1288
+ # Validate the universe domain.
1289
+ self._client._validate_universe_domain()
1290
+
1291
+ # Send the request.
1292
+ response = await rpc(
1293
+ request,
1294
+ retry=retry,
1295
+ timeout=timeout,
1296
+ metadata=metadata,
1297
+ )
1298
+
1299
+ # Wrap the response in an operation future.
1300
+ response = operation_async.from_gapic(
1301
+ response,
1302
+ self._client._transport.operations_client,
1303
+ folders.Folder,
1304
+ metadata_type=folders.DeleteFolderMetadata,
1305
+ )
1306
+
1307
+ # Done; return the response.
1308
+ return response
1309
+
1310
+ async def undelete_folder(
1311
+ self,
1312
+ request: Optional[Union[folders.UndeleteFolderRequest, dict]] = None,
1313
+ *,
1314
+ name: Optional[str] = None,
1315
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1316
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1317
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1318
+ ) -> operation_async.AsyncOperation:
1319
+ r"""Cancels the deletion request for a folder. This method may be
1320
+ called on a folder in any state. If the folder is in the
1321
+ [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE]
1322
+ state the result will be a no-op success. In order to succeed,
1323
+ the folder's parent must be in the
1324
+ [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE]
1325
+ state. In addition, reintroducing the folder into the tree must
1326
+ not violate folder naming, height, and fanout constraints
1327
+ described in the
1328
+ [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder]
1329
+ documentation. The caller must have
1330
+ ``resourcemanager.folders.undelete`` permission on the
1331
+ identified folder.
1332
+
1333
+ .. code-block:: python
1334
+
1335
+ # This snippet has been automatically generated and should be regarded as a
1336
+ # code template only.
1337
+ # It will require modifications to work:
1338
+ # - It may require correct/in-range values for request initialization.
1339
+ # - It may require specifying regional endpoints when creating the service
1340
+ # client as shown in:
1341
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1342
+ from google.cloud import resourcemanager_v3
1343
+
1344
+ async def sample_undelete_folder():
1345
+ # Create a client
1346
+ client = resourcemanager_v3.FoldersAsyncClient()
1347
+
1348
+ # Initialize request argument(s)
1349
+ request = resourcemanager_v3.UndeleteFolderRequest(
1350
+ name="name_value",
1351
+ )
1352
+
1353
+ # Make the request
1354
+ operation = client.undelete_folder(request=request)
1355
+
1356
+ print("Waiting for operation to complete...")
1357
+
1358
+ response = (await operation).result()
1359
+
1360
+ # Handle the response
1361
+ print(response)
1362
+
1363
+ Args:
1364
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.UndeleteFolderRequest, dict]]):
1365
+ The request object. The UndeleteFolder request message.
1366
+ name (:class:`str`):
1367
+ Required. The resource name of the folder to undelete.
1368
+ Must be of the form ``folders/{folder_id}``.
1369
+
1370
+ This corresponds to the ``name`` field
1371
+ on the ``request`` instance; if ``request`` is provided, this
1372
+ should not be set.
1373
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1374
+ should be retried.
1375
+ timeout (float): The timeout for this request.
1376
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1377
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1378
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1379
+ be of type `bytes`.
1380
+
1381
+ Returns:
1382
+ google.api_core.operation_async.AsyncOperation:
1383
+ An object representing a long-running operation.
1384
+
1385
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.Folder` A folder in an organization's resource hierarchy, used to
1386
+ organize that organization's resources.
1387
+
1388
+ """
1389
+ # Create or coerce a protobuf request object.
1390
+ # - Quick check: If we got a request object, we should *not* have
1391
+ # gotten any keyword arguments that map to the request.
1392
+ flattened_params = [name]
1393
+ has_flattened_params = (
1394
+ len([param for param in flattened_params if param is not None]) > 0
1395
+ )
1396
+ if request is not None and has_flattened_params:
1397
+ raise ValueError(
1398
+ "If the `request` argument is set, then none of "
1399
+ "the individual field arguments should be set."
1400
+ )
1401
+
1402
+ # - Use the request object if provided (there's no risk of modifying the input as
1403
+ # there are no flattened fields), or create one.
1404
+ if not isinstance(request, folders.UndeleteFolderRequest):
1405
+ request = folders.UndeleteFolderRequest(request)
1406
+
1407
+ # If we have keyword arguments corresponding to fields on the
1408
+ # request, apply these.
1409
+ if name is not None:
1410
+ request.name = name
1411
+
1412
+ # Wrap the RPC method; this adds retry and timeout information,
1413
+ # and friendly error handling.
1414
+ rpc = self._client._transport._wrapped_methods[
1415
+ self._client._transport.undelete_folder
1416
+ ]
1417
+
1418
+ # Certain fields should be provided within the metadata header;
1419
+ # add these here.
1420
+ metadata = tuple(metadata) + (
1421
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1422
+ )
1423
+
1424
+ # Validate the universe domain.
1425
+ self._client._validate_universe_domain()
1426
+
1427
+ # Send the request.
1428
+ response = await rpc(
1429
+ request,
1430
+ retry=retry,
1431
+ timeout=timeout,
1432
+ metadata=metadata,
1433
+ )
1434
+
1435
+ # Wrap the response in an operation future.
1436
+ response = operation_async.from_gapic(
1437
+ response,
1438
+ self._client._transport.operations_client,
1439
+ folders.Folder,
1440
+ metadata_type=folders.UndeleteFolderMetadata,
1441
+ )
1442
+
1443
+ # Done; return the response.
1444
+ return response
1445
+
1446
+ async def get_iam_policy(
1447
+ self,
1448
+ request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
1449
+ *,
1450
+ resource: Optional[str] = None,
1451
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1452
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1453
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1454
+ ) -> policy_pb2.Policy:
1455
+ r"""Gets the access control policy for a folder. The returned policy
1456
+ may be empty if no such policy or resource exists. The
1457
+ ``resource`` field should be the folder's resource name, for
1458
+ example: "folders/1234". The caller must have
1459
+ ``resourcemanager.folders.getIamPolicy`` permission on the
1460
+ identified folder.
1461
+
1462
+ .. code-block:: python
1463
+
1464
+ # This snippet has been automatically generated and should be regarded as a
1465
+ # code template only.
1466
+ # It will require modifications to work:
1467
+ # - It may require correct/in-range values for request initialization.
1468
+ # - It may require specifying regional endpoints when creating the service
1469
+ # client as shown in:
1470
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1471
+ from google.cloud import resourcemanager_v3
1472
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
1473
+
1474
+ async def sample_get_iam_policy():
1475
+ # Create a client
1476
+ client = resourcemanager_v3.FoldersAsyncClient()
1477
+
1478
+ # Initialize request argument(s)
1479
+ request = iam_policy_pb2.GetIamPolicyRequest(
1480
+ resource="resource_value",
1481
+ )
1482
+
1483
+ # Make the request
1484
+ response = await client.get_iam_policy(request=request)
1485
+
1486
+ # Handle the response
1487
+ print(response)
1488
+
1489
+ Args:
1490
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]]):
1491
+ The request object. Request message for ``GetIamPolicy`` method.
1492
+ resource (:class:`str`):
1493
+ REQUIRED: The resource for which the
1494
+ policy is being requested. See the
1495
+ operation documentation for the
1496
+ appropriate value for this field.
1497
+
1498
+ This corresponds to the ``resource`` field
1499
+ on the ``request`` instance; if ``request`` is provided, this
1500
+ should not be set.
1501
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1502
+ should be retried.
1503
+ timeout (float): The timeout for this request.
1504
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1505
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1506
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1507
+ be of type `bytes`.
1508
+
1509
+ Returns:
1510
+ google.iam.v1.policy_pb2.Policy:
1511
+ An Identity and Access Management (IAM) policy, which specifies access
1512
+ controls for Google Cloud resources.
1513
+
1514
+ A Policy is a collection of bindings. A binding binds
1515
+ one or more members, or principals, to a single role.
1516
+ Principals can be user accounts, service accounts,
1517
+ Google groups, and domains (such as G Suite). A role
1518
+ is a named list of permissions; each role can be an
1519
+ IAM predefined role or a user-created custom role.
1520
+
1521
+ For some types of Google Cloud resources, a binding
1522
+ can also specify a condition, which is a logical
1523
+ expression that allows access to a resource only if
1524
+ the expression evaluates to true. A condition can add
1525
+ constraints based on attributes of the request, the
1526
+ resource, or both. To learn which resources support
1527
+ conditions in their IAM policies, see the [IAM
1528
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
1529
+
1530
+ **JSON example:**
1531
+
1532
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
1533
+
1534
+ **YAML example:**
1535
+
1536
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
1537
+
1538
+ For a description of IAM and its features, see the
1539
+ [IAM
1540
+ documentation](https://cloud.google.com/iam/docs/).
1541
+
1542
+ """
1543
+ # Create or coerce a protobuf request object.
1544
+ # - Quick check: If we got a request object, we should *not* have
1545
+ # gotten any keyword arguments that map to the request.
1546
+ flattened_params = [resource]
1547
+ has_flattened_params = (
1548
+ len([param for param in flattened_params if param is not None]) > 0
1549
+ )
1550
+ if request is not None and has_flattened_params:
1551
+ raise ValueError(
1552
+ "If the `request` argument is set, then none of "
1553
+ "the individual field arguments should be set."
1554
+ )
1555
+
1556
+ # - The request isn't a proto-plus wrapped type,
1557
+ # so it must be constructed via keyword expansion.
1558
+ if isinstance(request, dict):
1559
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
1560
+ elif not request:
1561
+ request = iam_policy_pb2.GetIamPolicyRequest(resource=resource)
1562
+
1563
+ # Wrap the RPC method; this adds retry and timeout information,
1564
+ # and friendly error handling.
1565
+ rpc = self._client._transport._wrapped_methods[
1566
+ self._client._transport.get_iam_policy
1567
+ ]
1568
+
1569
+ # Certain fields should be provided within the metadata header;
1570
+ # add these here.
1571
+ metadata = tuple(metadata) + (
1572
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1573
+ )
1574
+
1575
+ # Validate the universe domain.
1576
+ self._client._validate_universe_domain()
1577
+
1578
+ # Send the request.
1579
+ response = await rpc(
1580
+ request,
1581
+ retry=retry,
1582
+ timeout=timeout,
1583
+ metadata=metadata,
1584
+ )
1585
+
1586
+ # Done; return the response.
1587
+ return response
1588
+
1589
+ async def set_iam_policy(
1590
+ self,
1591
+ request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
1592
+ *,
1593
+ resource: Optional[str] = None,
1594
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1595
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1596
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1597
+ ) -> policy_pb2.Policy:
1598
+ r"""Sets the access control policy on a folder, replacing any
1599
+ existing policy. The ``resource`` field should be the folder's
1600
+ resource name, for example: "folders/1234". The caller must have
1601
+ ``resourcemanager.folders.setIamPolicy`` permission on the
1602
+ identified folder.
1603
+
1604
+ .. code-block:: python
1605
+
1606
+ # This snippet has been automatically generated and should be regarded as a
1607
+ # code template only.
1608
+ # It will require modifications to work:
1609
+ # - It may require correct/in-range values for request initialization.
1610
+ # - It may require specifying regional endpoints when creating the service
1611
+ # client as shown in:
1612
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1613
+ from google.cloud import resourcemanager_v3
1614
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
1615
+
1616
+ async def sample_set_iam_policy():
1617
+ # Create a client
1618
+ client = resourcemanager_v3.FoldersAsyncClient()
1619
+
1620
+ # Initialize request argument(s)
1621
+ request = iam_policy_pb2.SetIamPolicyRequest(
1622
+ resource="resource_value",
1623
+ )
1624
+
1625
+ # Make the request
1626
+ response = await client.set_iam_policy(request=request)
1627
+
1628
+ # Handle the response
1629
+ print(response)
1630
+
1631
+ Args:
1632
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]]):
1633
+ The request object. Request message for ``SetIamPolicy`` method.
1634
+ resource (:class:`str`):
1635
+ REQUIRED: The resource for which the
1636
+ policy is being specified. See the
1637
+ operation documentation for the
1638
+ appropriate value for this field.
1639
+
1640
+ This corresponds to the ``resource`` field
1641
+ on the ``request`` instance; if ``request`` is provided, this
1642
+ should not be set.
1643
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1644
+ should be retried.
1645
+ timeout (float): The timeout for this request.
1646
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1647
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1648
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1649
+ be of type `bytes`.
1650
+
1651
+ Returns:
1652
+ google.iam.v1.policy_pb2.Policy:
1653
+ An Identity and Access Management (IAM) policy, which specifies access
1654
+ controls for Google Cloud resources.
1655
+
1656
+ A Policy is a collection of bindings. A binding binds
1657
+ one or more members, or principals, to a single role.
1658
+ Principals can be user accounts, service accounts,
1659
+ Google groups, and domains (such as G Suite). A role
1660
+ is a named list of permissions; each role can be an
1661
+ IAM predefined role or a user-created custom role.
1662
+
1663
+ For some types of Google Cloud resources, a binding
1664
+ can also specify a condition, which is a logical
1665
+ expression that allows access to a resource only if
1666
+ the expression evaluates to true. A condition can add
1667
+ constraints based on attributes of the request, the
1668
+ resource, or both. To learn which resources support
1669
+ conditions in their IAM policies, see the [IAM
1670
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
1671
+
1672
+ **JSON example:**
1673
+
1674
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
1675
+
1676
+ **YAML example:**
1677
+
1678
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
1679
+
1680
+ For a description of IAM and its features, see the
1681
+ [IAM
1682
+ documentation](https://cloud.google.com/iam/docs/).
1683
+
1684
+ """
1685
+ # Create or coerce a protobuf request object.
1686
+ # - Quick check: If we got a request object, we should *not* have
1687
+ # gotten any keyword arguments that map to the request.
1688
+ flattened_params = [resource]
1689
+ has_flattened_params = (
1690
+ len([param for param in flattened_params if param is not None]) > 0
1691
+ )
1692
+ if request is not None and has_flattened_params:
1693
+ raise ValueError(
1694
+ "If the `request` argument is set, then none of "
1695
+ "the individual field arguments should be set."
1696
+ )
1697
+
1698
+ # - The request isn't a proto-plus wrapped type,
1699
+ # so it must be constructed via keyword expansion.
1700
+ if isinstance(request, dict):
1701
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
1702
+ elif not request:
1703
+ request = iam_policy_pb2.SetIamPolicyRequest(resource=resource)
1704
+
1705
+ # Wrap the RPC method; this adds retry and timeout information,
1706
+ # and friendly error handling.
1707
+ rpc = self._client._transport._wrapped_methods[
1708
+ self._client._transport.set_iam_policy
1709
+ ]
1710
+
1711
+ # Certain fields should be provided within the metadata header;
1712
+ # add these here.
1713
+ metadata = tuple(metadata) + (
1714
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1715
+ )
1716
+
1717
+ # Validate the universe domain.
1718
+ self._client._validate_universe_domain()
1719
+
1720
+ # Send the request.
1721
+ response = await rpc(
1722
+ request,
1723
+ retry=retry,
1724
+ timeout=timeout,
1725
+ metadata=metadata,
1726
+ )
1727
+
1728
+ # Done; return the response.
1729
+ return response
1730
+
1731
+ async def test_iam_permissions(
1732
+ self,
1733
+ request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
1734
+ *,
1735
+ resource: Optional[str] = None,
1736
+ permissions: Optional[MutableSequence[str]] = None,
1737
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1738
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1739
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1740
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1741
+ r"""Returns permissions that a caller has on the specified folder.
1742
+ The ``resource`` field should be the folder's resource name, for
1743
+ example: "folders/1234".
1744
+
1745
+ There are no permissions required for making this API call.
1746
+
1747
+ .. code-block:: python
1748
+
1749
+ # This snippet has been automatically generated and should be regarded as a
1750
+ # code template only.
1751
+ # It will require modifications to work:
1752
+ # - It may require correct/in-range values for request initialization.
1753
+ # - It may require specifying regional endpoints when creating the service
1754
+ # client as shown in:
1755
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1756
+ from google.cloud import resourcemanager_v3
1757
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
1758
+
1759
+ async def sample_test_iam_permissions():
1760
+ # Create a client
1761
+ client = resourcemanager_v3.FoldersAsyncClient()
1762
+
1763
+ # Initialize request argument(s)
1764
+ request = iam_policy_pb2.TestIamPermissionsRequest(
1765
+ resource="resource_value",
1766
+ permissions=['permissions_value1', 'permissions_value2'],
1767
+ )
1768
+
1769
+ # Make the request
1770
+ response = await client.test_iam_permissions(request=request)
1771
+
1772
+ # Handle the response
1773
+ print(response)
1774
+
1775
+ Args:
1776
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]]):
1777
+ The request object. Request message for ``TestIamPermissions`` method.
1778
+ resource (:class:`str`):
1779
+ REQUIRED: The resource for which the
1780
+ policy detail is being requested. See
1781
+ the operation documentation for the
1782
+ appropriate value for this field.
1783
+
1784
+ This corresponds to the ``resource`` field
1785
+ on the ``request`` instance; if ``request`` is provided, this
1786
+ should not be set.
1787
+ permissions (:class:`MutableSequence[str]`):
1788
+ The set of permissions to check for the ``resource``.
1789
+ Permissions with wildcards (such as '*' or 'storage.*')
1790
+ are not allowed. For more information see `IAM
1791
+ Overview <https://cloud.google.com/iam/docs/overview#permissions>`__.
1792
+
1793
+ This corresponds to the ``permissions`` field
1794
+ on the ``request`` instance; if ``request`` is provided, this
1795
+ should not be set.
1796
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1797
+ should be retried.
1798
+ timeout (float): The timeout for this request.
1799
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1800
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1801
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1802
+ be of type `bytes`.
1803
+
1804
+ Returns:
1805
+ google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse:
1806
+ Response message for TestIamPermissions method.
1807
+ """
1808
+ # Create or coerce a protobuf request object.
1809
+ # - Quick check: If we got a request object, we should *not* have
1810
+ # gotten any keyword arguments that map to the request.
1811
+ flattened_params = [resource, permissions]
1812
+ has_flattened_params = (
1813
+ len([param for param in flattened_params if param is not None]) > 0
1814
+ )
1815
+ if request is not None and has_flattened_params:
1816
+ raise ValueError(
1817
+ "If the `request` argument is set, then none of "
1818
+ "the individual field arguments should be set."
1819
+ )
1820
+
1821
+ # - The request isn't a proto-plus wrapped type,
1822
+ # so it must be constructed via keyword expansion.
1823
+ if isinstance(request, dict):
1824
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
1825
+ elif not request:
1826
+ request = iam_policy_pb2.TestIamPermissionsRequest(
1827
+ resource=resource, permissions=permissions
1828
+ )
1829
+
1830
+ # Wrap the RPC method; this adds retry and timeout information,
1831
+ # and friendly error handling.
1832
+ rpc = self._client._transport._wrapped_methods[
1833
+ self._client._transport.test_iam_permissions
1834
+ ]
1835
+
1836
+ # Certain fields should be provided within the metadata header;
1837
+ # add these here.
1838
+ metadata = tuple(metadata) + (
1839
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1840
+ )
1841
+
1842
+ # Validate the universe domain.
1843
+ self._client._validate_universe_domain()
1844
+
1845
+ # Send the request.
1846
+ response = await rpc(
1847
+ request,
1848
+ retry=retry,
1849
+ timeout=timeout,
1850
+ metadata=metadata,
1851
+ )
1852
+
1853
+ # Done; return the response.
1854
+ return response
1855
+
1856
+ async def get_operation(
1857
+ self,
1858
+ request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None,
1859
+ *,
1860
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1861
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1862
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1863
+ ) -> operations_pb2.Operation:
1864
+ r"""Gets the latest state of a long-running operation.
1865
+
1866
+ Args:
1867
+ request (:class:`~.operations_pb2.GetOperationRequest`):
1868
+ The request object. Request message for
1869
+ `GetOperation` method.
1870
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1871
+ if any, should be retried.
1872
+ timeout (float): The timeout for this request.
1873
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1874
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1875
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1876
+ be of type `bytes`.
1877
+ Returns:
1878
+ ~.operations_pb2.Operation:
1879
+ An ``Operation`` object.
1880
+ """
1881
+ # Create or coerce a protobuf request object.
1882
+ # The request isn't a proto-plus wrapped type,
1883
+ # so it must be constructed via keyword expansion.
1884
+ if request is None:
1885
+ request_pb = operations_pb2.GetOperationRequest()
1886
+ elif isinstance(request, dict):
1887
+ request_pb = operations_pb2.GetOperationRequest(**request)
1888
+ else:
1889
+ request_pb = request
1890
+
1891
+ # Wrap the RPC method; this adds retry and timeout information,
1892
+ # and friendly error handling.
1893
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
1894
+
1895
+ # Certain fields should be provided within the metadata header;
1896
+ # add these here.
1897
+ metadata = tuple(metadata) + (
1898
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
1899
+ )
1900
+
1901
+ # Validate the universe domain.
1902
+ self._client._validate_universe_domain()
1903
+
1904
+ # Send the request.
1905
+ response = await rpc(
1906
+ request_pb,
1907
+ retry=retry,
1908
+ timeout=timeout,
1909
+ metadata=metadata,
1910
+ )
1911
+
1912
+ # Done; return the response.
1913
+ return response
1914
+
1915
+ async def __aenter__(self) -> "FoldersAsyncClient":
1916
+ return self
1917
+
1918
+ async def __aexit__(self, exc_type, exc, tb):
1919
+ await self.transport.close()
1920
+
1921
+
1922
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1923
+ gapic_version=package_version.__version__
1924
+ )
1925
+
1926
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1927
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1928
+
1929
+
1930
+ __all__ = ("FoldersAsyncClient",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/folders/client.py ADDED
The diff for this file is too large to render. See raw diff
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/folders/pagers.py ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from typing import (
17
+ Any,
18
+ AsyncIterator,
19
+ Awaitable,
20
+ Callable,
21
+ Iterator,
22
+ Optional,
23
+ Sequence,
24
+ Tuple,
25
+ Union,
26
+ )
27
+
28
+ from google.api_core import gapic_v1
29
+ from google.api_core import retry as retries
30
+ from google.api_core import retry_async as retries_async
31
+
32
+ try:
33
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
34
+ OptionalAsyncRetry = Union[
35
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
36
+ ]
37
+ except AttributeError: # pragma: NO COVER
38
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
39
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
40
+
41
+ from google.cloud.resourcemanager_v3.types import folders
42
+
43
+
44
+ class ListFoldersPager:
45
+ """A pager for iterating through ``list_folders`` requests.
46
+
47
+ This class thinly wraps an initial
48
+ :class:`google.cloud.resourcemanager_v3.types.ListFoldersResponse` object, and
49
+ provides an ``__iter__`` method to iterate through its
50
+ ``folders`` field.
51
+
52
+ If there are more pages, the ``__iter__`` method will make additional
53
+ ``ListFolders`` requests and continue to iterate
54
+ through the ``folders`` field on the
55
+ corresponding responses.
56
+
57
+ All the usual :class:`google.cloud.resourcemanager_v3.types.ListFoldersResponse`
58
+ attributes are available on the pager. If multiple requests are made, only
59
+ the most recent response is retained, and thus used for attribute lookup.
60
+ """
61
+
62
+ def __init__(
63
+ self,
64
+ method: Callable[..., folders.ListFoldersResponse],
65
+ request: folders.ListFoldersRequest,
66
+ response: folders.ListFoldersResponse,
67
+ *,
68
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
69
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
70
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
71
+ ):
72
+ """Instantiate the pager.
73
+
74
+ Args:
75
+ method (Callable): The method that was originally called, and
76
+ which instantiated this pager.
77
+ request (google.cloud.resourcemanager_v3.types.ListFoldersRequest):
78
+ The initial request object.
79
+ response (google.cloud.resourcemanager_v3.types.ListFoldersResponse):
80
+ The initial response object.
81
+ retry (google.api_core.retry.Retry): Designation of what errors,
82
+ if any, should be retried.
83
+ timeout (float): The timeout for this request.
84
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
85
+ sent along with the request as metadata. Normally, each value must be of type `str`,
86
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
87
+ be of type `bytes`.
88
+ """
89
+ self._method = method
90
+ self._request = folders.ListFoldersRequest(request)
91
+ self._response = response
92
+ self._retry = retry
93
+ self._timeout = timeout
94
+ self._metadata = metadata
95
+
96
+ def __getattr__(self, name: str) -> Any:
97
+ return getattr(self._response, name)
98
+
99
+ @property
100
+ def pages(self) -> Iterator[folders.ListFoldersResponse]:
101
+ yield self._response
102
+ while self._response.next_page_token:
103
+ self._request.page_token = self._response.next_page_token
104
+ self._response = self._method(
105
+ self._request,
106
+ retry=self._retry,
107
+ timeout=self._timeout,
108
+ metadata=self._metadata,
109
+ )
110
+ yield self._response
111
+
112
+ def __iter__(self) -> Iterator[folders.Folder]:
113
+ for page in self.pages:
114
+ yield from page.folders
115
+
116
+ def __repr__(self) -> str:
117
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
118
+
119
+
120
+ class ListFoldersAsyncPager:
121
+ """A pager for iterating through ``list_folders`` requests.
122
+
123
+ This class thinly wraps an initial
124
+ :class:`google.cloud.resourcemanager_v3.types.ListFoldersResponse` object, and
125
+ provides an ``__aiter__`` method to iterate through its
126
+ ``folders`` field.
127
+
128
+ If there are more pages, the ``__aiter__`` method will make additional
129
+ ``ListFolders`` requests and continue to iterate
130
+ through the ``folders`` field on the
131
+ corresponding responses.
132
+
133
+ All the usual :class:`google.cloud.resourcemanager_v3.types.ListFoldersResponse`
134
+ attributes are available on the pager. If multiple requests are made, only
135
+ the most recent response is retained, and thus used for attribute lookup.
136
+ """
137
+
138
+ def __init__(
139
+ self,
140
+ method: Callable[..., Awaitable[folders.ListFoldersResponse]],
141
+ request: folders.ListFoldersRequest,
142
+ response: folders.ListFoldersResponse,
143
+ *,
144
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
145
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
146
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
147
+ ):
148
+ """Instantiates the pager.
149
+
150
+ Args:
151
+ method (Callable): The method that was originally called, and
152
+ which instantiated this pager.
153
+ request (google.cloud.resourcemanager_v3.types.ListFoldersRequest):
154
+ The initial request object.
155
+ response (google.cloud.resourcemanager_v3.types.ListFoldersResponse):
156
+ The initial response object.
157
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
158
+ if any, should be retried.
159
+ timeout (float): The timeout for this request.
160
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
161
+ sent along with the request as metadata. Normally, each value must be of type `str`,
162
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
163
+ be of type `bytes`.
164
+ """
165
+ self._method = method
166
+ self._request = folders.ListFoldersRequest(request)
167
+ self._response = response
168
+ self._retry = retry
169
+ self._timeout = timeout
170
+ self._metadata = metadata
171
+
172
+ def __getattr__(self, name: str) -> Any:
173
+ return getattr(self._response, name)
174
+
175
+ @property
176
+ async def pages(self) -> AsyncIterator[folders.ListFoldersResponse]:
177
+ yield self._response
178
+ while self._response.next_page_token:
179
+ self._request.page_token = self._response.next_page_token
180
+ self._response = await self._method(
181
+ self._request,
182
+ retry=self._retry,
183
+ timeout=self._timeout,
184
+ metadata=self._metadata,
185
+ )
186
+ yield self._response
187
+
188
+ def __aiter__(self) -> AsyncIterator[folders.Folder]:
189
+ async def async_generator():
190
+ async for page in self.pages:
191
+ for response in page.folders:
192
+ yield response
193
+
194
+ return async_generator()
195
+
196
+ def __repr__(self) -> str:
197
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
198
+
199
+
200
+ class SearchFoldersPager:
201
+ """A pager for iterating through ``search_folders`` requests.
202
+
203
+ This class thinly wraps an initial
204
+ :class:`google.cloud.resourcemanager_v3.types.SearchFoldersResponse` object, and
205
+ provides an ``__iter__`` method to iterate through its
206
+ ``folders`` field.
207
+
208
+ If there are more pages, the ``__iter__`` method will make additional
209
+ ``SearchFolders`` requests and continue to iterate
210
+ through the ``folders`` field on the
211
+ corresponding responses.
212
+
213
+ All the usual :class:`google.cloud.resourcemanager_v3.types.SearchFoldersResponse`
214
+ attributes are available on the pager. If multiple requests are made, only
215
+ the most recent response is retained, and thus used for attribute lookup.
216
+ """
217
+
218
+ def __init__(
219
+ self,
220
+ method: Callable[..., folders.SearchFoldersResponse],
221
+ request: folders.SearchFoldersRequest,
222
+ response: folders.SearchFoldersResponse,
223
+ *,
224
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
225
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
226
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
227
+ ):
228
+ """Instantiate the pager.
229
+
230
+ Args:
231
+ method (Callable): The method that was originally called, and
232
+ which instantiated this pager.
233
+ request (google.cloud.resourcemanager_v3.types.SearchFoldersRequest):
234
+ The initial request object.
235
+ response (google.cloud.resourcemanager_v3.types.SearchFoldersResponse):
236
+ The initial response object.
237
+ retry (google.api_core.retry.Retry): Designation of what errors,
238
+ if any, should be retried.
239
+ timeout (float): The timeout for this request.
240
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
241
+ sent along with the request as metadata. Normally, each value must be of type `str`,
242
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
243
+ be of type `bytes`.
244
+ """
245
+ self._method = method
246
+ self._request = folders.SearchFoldersRequest(request)
247
+ self._response = response
248
+ self._retry = retry
249
+ self._timeout = timeout
250
+ self._metadata = metadata
251
+
252
+ def __getattr__(self, name: str) -> Any:
253
+ return getattr(self._response, name)
254
+
255
+ @property
256
+ def pages(self) -> Iterator[folders.SearchFoldersResponse]:
257
+ yield self._response
258
+ while self._response.next_page_token:
259
+ self._request.page_token = self._response.next_page_token
260
+ self._response = self._method(
261
+ self._request,
262
+ retry=self._retry,
263
+ timeout=self._timeout,
264
+ metadata=self._metadata,
265
+ )
266
+ yield self._response
267
+
268
+ def __iter__(self) -> Iterator[folders.Folder]:
269
+ for page in self.pages:
270
+ yield from page.folders
271
+
272
+ def __repr__(self) -> str:
273
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
274
+
275
+
276
+ class SearchFoldersAsyncPager:
277
+ """A pager for iterating through ``search_folders`` requests.
278
+
279
+ This class thinly wraps an initial
280
+ :class:`google.cloud.resourcemanager_v3.types.SearchFoldersResponse` object, and
281
+ provides an ``__aiter__`` method to iterate through its
282
+ ``folders`` field.
283
+
284
+ If there are more pages, the ``__aiter__`` method will make additional
285
+ ``SearchFolders`` requests and continue to iterate
286
+ through the ``folders`` field on the
287
+ corresponding responses.
288
+
289
+ All the usual :class:`google.cloud.resourcemanager_v3.types.SearchFoldersResponse`
290
+ attributes are available on the pager. If multiple requests are made, only
291
+ the most recent response is retained, and thus used for attribute lookup.
292
+ """
293
+
294
+ def __init__(
295
+ self,
296
+ method: Callable[..., Awaitable[folders.SearchFoldersResponse]],
297
+ request: folders.SearchFoldersRequest,
298
+ response: folders.SearchFoldersResponse,
299
+ *,
300
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
301
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
302
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
303
+ ):
304
+ """Instantiates the pager.
305
+
306
+ Args:
307
+ method (Callable): The method that was originally called, and
308
+ which instantiated this pager.
309
+ request (google.cloud.resourcemanager_v3.types.SearchFoldersRequest):
310
+ The initial request object.
311
+ response (google.cloud.resourcemanager_v3.types.SearchFoldersResponse):
312
+ The initial response object.
313
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
314
+ if any, should be retried.
315
+ timeout (float): The timeout for this request.
316
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
317
+ sent along with the request as metadata. Normally, each value must be of type `str`,
318
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
319
+ be of type `bytes`.
320
+ """
321
+ self._method = method
322
+ self._request = folders.SearchFoldersRequest(request)
323
+ self._response = response
324
+ self._retry = retry
325
+ self._timeout = timeout
326
+ self._metadata = metadata
327
+
328
+ def __getattr__(self, name: str) -> Any:
329
+ return getattr(self._response, name)
330
+
331
+ @property
332
+ async def pages(self) -> AsyncIterator[folders.SearchFoldersResponse]:
333
+ yield self._response
334
+ while self._response.next_page_token:
335
+ self._request.page_token = self._response.next_page_token
336
+ self._response = await self._method(
337
+ self._request,
338
+ retry=self._retry,
339
+ timeout=self._timeout,
340
+ metadata=self._metadata,
341
+ )
342
+ yield self._response
343
+
344
+ def __aiter__(self) -> AsyncIterator[folders.Folder]:
345
+ async def async_generator():
346
+ async for page in self.pages:
347
+ for response in page.folders:
348
+ yield response
349
+
350
+ return async_generator()
351
+
352
+ def __repr__(self) -> str:
353
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/organizations/__init__.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from .async_client import OrganizationsAsyncClient
17
+ from .client import OrganizationsClient
18
+
19
+ __all__ = (
20
+ "OrganizationsClient",
21
+ "OrganizationsAsyncClient",
22
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/organizations/async_client.py ADDED
@@ -0,0 +1,1052 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import logging as std_logging
17
+ import re
18
+ from collections import OrderedDict
19
+ from typing import (
20
+ Callable,
21
+ Dict,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ import google.protobuf
33
+ from google.api_core import exceptions as core_exceptions
34
+ from google.api_core import gapic_v1
35
+ from google.api_core import retry_async as retries
36
+ from google.api_core.client_options import ClientOptions
37
+ from google.auth import credentials as ga_credentials # type: ignore
38
+ from google.oauth2 import service_account # type: ignore
39
+
40
+ from google.cloud.resourcemanager_v3 import gapic_version as package_version
41
+
42
+ try:
43
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
44
+ except AttributeError: # pragma: NO COVER
45
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
46
+
47
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
48
+ import google.iam.v1.policy_pb2 as policy_pb2 # type: ignore
49
+ import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
50
+ from google.longrunning import operations_pb2 # type: ignore
51
+
52
+ from google.cloud.resourcemanager_v3.services.organizations import pagers
53
+ from google.cloud.resourcemanager_v3.types import organizations
54
+
55
+ from .client import OrganizationsClient
56
+ from .transports.base import DEFAULT_CLIENT_INFO, OrganizationsTransport
57
+ from .transports.grpc_asyncio import OrganizationsGrpcAsyncIOTransport
58
+
59
+ try:
60
+ from google.api_core import client_logging # type: ignore
61
+
62
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
63
+ except ImportError: # pragma: NO COVER
64
+ CLIENT_LOGGING_SUPPORTED = False
65
+
66
+ _LOGGER = std_logging.getLogger(__name__)
67
+
68
+
69
+ class OrganizationsAsyncClient:
70
+ """Allows users to manage their organization resources."""
71
+
72
+ _client: OrganizationsClient
73
+
74
+ # Copy defaults from the synchronous client for use here.
75
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
76
+ DEFAULT_ENDPOINT = OrganizationsClient.DEFAULT_ENDPOINT
77
+ DEFAULT_MTLS_ENDPOINT = OrganizationsClient.DEFAULT_MTLS_ENDPOINT
78
+ _DEFAULT_ENDPOINT_TEMPLATE = OrganizationsClient._DEFAULT_ENDPOINT_TEMPLATE
79
+ _DEFAULT_UNIVERSE = OrganizationsClient._DEFAULT_UNIVERSE
80
+
81
+ organization_path = staticmethod(OrganizationsClient.organization_path)
82
+ parse_organization_path = staticmethod(OrganizationsClient.parse_organization_path)
83
+ common_billing_account_path = staticmethod(
84
+ OrganizationsClient.common_billing_account_path
85
+ )
86
+ parse_common_billing_account_path = staticmethod(
87
+ OrganizationsClient.parse_common_billing_account_path
88
+ )
89
+ common_folder_path = staticmethod(OrganizationsClient.common_folder_path)
90
+ parse_common_folder_path = staticmethod(
91
+ OrganizationsClient.parse_common_folder_path
92
+ )
93
+ common_organization_path = staticmethod(
94
+ OrganizationsClient.common_organization_path
95
+ )
96
+ parse_common_organization_path = staticmethod(
97
+ OrganizationsClient.parse_common_organization_path
98
+ )
99
+ common_project_path = staticmethod(OrganizationsClient.common_project_path)
100
+ parse_common_project_path = staticmethod(
101
+ OrganizationsClient.parse_common_project_path
102
+ )
103
+ common_location_path = staticmethod(OrganizationsClient.common_location_path)
104
+ parse_common_location_path = staticmethod(
105
+ OrganizationsClient.parse_common_location_path
106
+ )
107
+
108
+ @classmethod
109
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
110
+ """Creates an instance of this client using the provided credentials
111
+ info.
112
+
113
+ Args:
114
+ info (dict): The service account private key info.
115
+ args: Additional arguments to pass to the constructor.
116
+ kwargs: Additional arguments to pass to the constructor.
117
+
118
+ Returns:
119
+ OrganizationsAsyncClient: The constructed client.
120
+ """
121
+ sa_info_func = (
122
+ OrganizationsClient.from_service_account_info.__func__ # type: ignore
123
+ )
124
+ return sa_info_func(OrganizationsAsyncClient, info, *args, **kwargs)
125
+
126
+ @classmethod
127
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
128
+ """Creates an instance of this client using the provided credentials
129
+ file.
130
+
131
+ Args:
132
+ filename (str): The path to the service account private key json
133
+ file.
134
+ args: Additional arguments to pass to the constructor.
135
+ kwargs: Additional arguments to pass to the constructor.
136
+
137
+ Returns:
138
+ OrganizationsAsyncClient: The constructed client.
139
+ """
140
+ sa_file_func = (
141
+ OrganizationsClient.from_service_account_file.__func__ # type: ignore
142
+ )
143
+ return sa_file_func(OrganizationsAsyncClient, filename, *args, **kwargs)
144
+
145
+ from_service_account_json = from_service_account_file
146
+
147
+ @classmethod
148
+ def get_mtls_endpoint_and_cert_source(
149
+ cls, client_options: Optional[ClientOptions] = None
150
+ ):
151
+ """Return the API endpoint and client cert source for mutual TLS.
152
+
153
+ The client cert source is determined in the following order:
154
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
155
+ client cert source is None.
156
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
157
+ default client cert source exists, use the default one; otherwise the client cert
158
+ source is None.
159
+
160
+ The API endpoint is determined in the following order:
161
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
162
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
163
+ default mTLS endpoint; if the environment variable is "never", use the default API
164
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
165
+ use the default API endpoint.
166
+
167
+ More details can be found at https://google.aip.dev/auth/4114.
168
+
169
+ Args:
170
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
171
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
172
+ in this method.
173
+
174
+ Returns:
175
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
176
+ client cert source to use.
177
+
178
+ Raises:
179
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
180
+ """
181
+ return OrganizationsClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
182
+
183
+ @property
184
+ def transport(self) -> OrganizationsTransport:
185
+ """Returns the transport used by the client instance.
186
+
187
+ Returns:
188
+ OrganizationsTransport: The transport used by the client instance.
189
+ """
190
+ return self._client.transport
191
+
192
+ @property
193
+ def api_endpoint(self) -> str:
194
+ """Return the API endpoint used by the client instance.
195
+
196
+ Returns:
197
+ str: The API endpoint used by the client instance.
198
+ """
199
+ return self._client._api_endpoint
200
+
201
+ @property
202
+ def universe_domain(self) -> str:
203
+ """Return the universe domain used by the client instance.
204
+
205
+ Returns:
206
+ str: The universe domain used
207
+ by the client instance.
208
+ """
209
+ return self._client._universe_domain
210
+
211
+ get_transport_class = OrganizationsClient.get_transport_class
212
+
213
+ def __init__(
214
+ self,
215
+ *,
216
+ credentials: Optional[ga_credentials.Credentials] = None,
217
+ transport: Optional[
218
+ Union[str, OrganizationsTransport, Callable[..., OrganizationsTransport]]
219
+ ] = "grpc_asyncio",
220
+ client_options: Optional[ClientOptions] = None,
221
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
222
+ ) -> None:
223
+ """Instantiates the organizations async client.
224
+
225
+ Args:
226
+ credentials (Optional[google.auth.credentials.Credentials]): The
227
+ authorization credentials to attach to requests. These
228
+ credentials identify the application to the service; if none
229
+ are specified, the client will attempt to ascertain the
230
+ credentials from the environment.
231
+ transport (Optional[Union[str,OrganizationsTransport,Callable[..., OrganizationsTransport]]]):
232
+ The transport to use, or a Callable that constructs and returns a new transport to use.
233
+ If a Callable is given, it will be called with the same set of initialization
234
+ arguments as used in the OrganizationsTransport constructor.
235
+ If set to None, a transport is chosen automatically.
236
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
237
+ Custom options for the client.
238
+
239
+ 1. The ``api_endpoint`` property can be used to override the
240
+ default endpoint provided by the client when ``transport`` is
241
+ not explicitly provided. Only if this property is not set and
242
+ ``transport`` was not explicitly provided, the endpoint is
243
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
244
+ variable, which have one of the following values:
245
+ "always" (always use the default mTLS endpoint), "never" (always
246
+ use the default regular endpoint) and "auto" (auto-switch to the
247
+ default mTLS endpoint if client certificate is present; this is
248
+ the default value).
249
+
250
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
251
+ is "true", then the ``client_cert_source`` property can be used
252
+ to provide a client certificate for mTLS transport. If
253
+ not provided, the default SSL client certificate will be used if
254
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
255
+ set, no client certificate will be used.
256
+
257
+ 3. The ``universe_domain`` property can be used to override the
258
+ default "googleapis.com" universe. Note that ``api_endpoint``
259
+ property still takes precedence; and ``universe_domain`` is
260
+ currently not supported for mTLS.
261
+
262
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
263
+ The client info used to send a user-agent string along with
264
+ API requests. If ``None``, then default info will be used.
265
+ Generally, you only need to set this if you're developing
266
+ your own client library.
267
+
268
+ Raises:
269
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
270
+ creation failed for any reason.
271
+ """
272
+ self._client = OrganizationsClient(
273
+ credentials=credentials,
274
+ transport=transport,
275
+ client_options=client_options,
276
+ client_info=client_info,
277
+ )
278
+
279
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
280
+ std_logging.DEBUG
281
+ ): # pragma: NO COVER
282
+ _LOGGER.debug(
283
+ "Created client `google.cloud.resourcemanager_v3.OrganizationsAsyncClient`.",
284
+ extra={
285
+ "serviceName": "google.cloud.resourcemanager.v3.Organizations",
286
+ "universeDomain": getattr(
287
+ self._client._transport._credentials, "universe_domain", ""
288
+ ),
289
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
290
+ "credentialsInfo": getattr(
291
+ self.transport._credentials, "get_cred_info", lambda: None
292
+ )(),
293
+ }
294
+ if hasattr(self._client._transport, "_credentials")
295
+ else {
296
+ "serviceName": "google.cloud.resourcemanager.v3.Organizations",
297
+ "credentialsType": None,
298
+ },
299
+ )
300
+
301
+ async def get_organization(
302
+ self,
303
+ request: Optional[Union[organizations.GetOrganizationRequest, dict]] = None,
304
+ *,
305
+ name: Optional[str] = None,
306
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
307
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
308
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
309
+ ) -> organizations.Organization:
310
+ r"""Fetches an organization resource identified by the
311
+ specified resource name.
312
+
313
+ .. code-block:: python
314
+
315
+ # This snippet has been automatically generated and should be regarded as a
316
+ # code template only.
317
+ # It will require modifications to work:
318
+ # - It may require correct/in-range values for request initialization.
319
+ # - It may require specifying regional endpoints when creating the service
320
+ # client as shown in:
321
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
322
+ from google.cloud import resourcemanager_v3
323
+
324
+ async def sample_get_organization():
325
+ # Create a client
326
+ client = resourcemanager_v3.OrganizationsAsyncClient()
327
+
328
+ # Initialize request argument(s)
329
+ request = resourcemanager_v3.GetOrganizationRequest(
330
+ name="name_value",
331
+ )
332
+
333
+ # Make the request
334
+ response = await client.get_organization(request=request)
335
+
336
+ # Handle the response
337
+ print(response)
338
+
339
+ Args:
340
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.GetOrganizationRequest, dict]]):
341
+ The request object. The request sent to the ``GetOrganization`` method. The
342
+ ``name`` field is required. ``organization_id`` is no
343
+ longer accepted.
344
+ name (:class:`str`):
345
+ Required. The resource name of the Organization to
346
+ fetch. This is the organization's relative path in the
347
+ API, formatted as "organizations/[organizationId]". For
348
+ example, "organizations/1234".
349
+
350
+ This corresponds to the ``name`` field
351
+ on the ``request`` instance; if ``request`` is provided, this
352
+ should not be set.
353
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
354
+ should be retried.
355
+ timeout (float): The timeout for this request.
356
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
357
+ sent along with the request as metadata. Normally, each value must be of type `str`,
358
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
359
+ be of type `bytes`.
360
+
361
+ Returns:
362
+ google.cloud.resourcemanager_v3.types.Organization:
363
+ The root node in the resource
364
+ hierarchy to which a particular entity's
365
+ (a company, for example) resources
366
+ belong.
367
+
368
+ """
369
+ # Create or coerce a protobuf request object.
370
+ # - Quick check: If we got a request object, we should *not* have
371
+ # gotten any keyword arguments that map to the request.
372
+ flattened_params = [name]
373
+ has_flattened_params = (
374
+ len([param for param in flattened_params if param is not None]) > 0
375
+ )
376
+ if request is not None and has_flattened_params:
377
+ raise ValueError(
378
+ "If the `request` argument is set, then none of "
379
+ "the individual field arguments should be set."
380
+ )
381
+
382
+ # - Use the request object if provided (there's no risk of modifying the input as
383
+ # there are no flattened fields), or create one.
384
+ if not isinstance(request, organizations.GetOrganizationRequest):
385
+ request = organizations.GetOrganizationRequest(request)
386
+
387
+ # If we have keyword arguments corresponding to fields on the
388
+ # request, apply these.
389
+ if name is not None:
390
+ request.name = name
391
+
392
+ # Wrap the RPC method; this adds retry and timeout information,
393
+ # and friendly error handling.
394
+ rpc = self._client._transport._wrapped_methods[
395
+ self._client._transport.get_organization
396
+ ]
397
+
398
+ # Certain fields should be provided within the metadata header;
399
+ # add these here.
400
+ metadata = tuple(metadata) + (
401
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
402
+ )
403
+
404
+ # Validate the universe domain.
405
+ self._client._validate_universe_domain()
406
+
407
+ # Send the request.
408
+ response = await rpc(
409
+ request,
410
+ retry=retry,
411
+ timeout=timeout,
412
+ metadata=metadata,
413
+ )
414
+
415
+ # Done; return the response.
416
+ return response
417
+
418
+ async def search_organizations(
419
+ self,
420
+ request: Optional[Union[organizations.SearchOrganizationsRequest, dict]] = None,
421
+ *,
422
+ query: Optional[str] = None,
423
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
424
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
425
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
426
+ ) -> pagers.SearchOrganizationsAsyncPager:
427
+ r"""Searches organization resources that are visible to the user and
428
+ satisfy the specified filter. This method returns organizations
429
+ in an unspecified order. New organizations do not necessarily
430
+ appear at the end of the results, and may take a small amount of
431
+ time to appear.
432
+
433
+ Search will only return organizations on which the user has the
434
+ permission ``resourcemanager.organizations.get``
435
+
436
+ .. code-block:: python
437
+
438
+ # This snippet has been automatically generated and should be regarded as a
439
+ # code template only.
440
+ # It will require modifications to work:
441
+ # - It may require correct/in-range values for request initialization.
442
+ # - It may require specifying regional endpoints when creating the service
443
+ # client as shown in:
444
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
445
+ from google.cloud import resourcemanager_v3
446
+
447
+ async def sample_search_organizations():
448
+ # Create a client
449
+ client = resourcemanager_v3.OrganizationsAsyncClient()
450
+
451
+ # Initialize request argument(s)
452
+ request = resourcemanager_v3.SearchOrganizationsRequest(
453
+ )
454
+
455
+ # Make the request
456
+ page_result = client.search_organizations(request=request)
457
+
458
+ # Handle the response
459
+ async for response in page_result:
460
+ print(response)
461
+
462
+ Args:
463
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.SearchOrganizationsRequest, dict]]):
464
+ The request object. The request sent to the ``SearchOrganizations`` method.
465
+ query (:class:`str`):
466
+ Optional. An optional query string used to filter the
467
+ Organizations to return in the response. Query rules are
468
+ case-insensitive.
469
+
470
+ ::
471
+
472
+ | Field | Description |
473
+ |------------------|--------------------------------------------|
474
+ | directoryCustomerId, owner.directoryCustomerId | Filters by directory
475
+ customer id. |
476
+ | domain | Filters by domain. |
477
+
478
+ Organizations may be queried by ``directoryCustomerId``
479
+ or by ``domain``, where the domain is a G Suite domain,
480
+ for example:
481
+
482
+ - Query ``directorycustomerid:123456789`` returns
483
+ Organization resources with
484
+ ``owner.directory_customer_id`` equal to
485
+ ``123456789``.
486
+ - Query ``domain:google.com`` returns Organization
487
+ resources corresponding to the domain ``google.com``.
488
+
489
+ This corresponds to the ``query`` field
490
+ on the ``request`` instance; if ``request`` is provided, this
491
+ should not be set.
492
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
493
+ should be retried.
494
+ timeout (float): The timeout for this request.
495
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
496
+ sent along with the request as metadata. Normally, each value must be of type `str`,
497
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
498
+ be of type `bytes`.
499
+
500
+ Returns:
501
+ google.cloud.resourcemanager_v3.services.organizations.pagers.SearchOrganizationsAsyncPager:
502
+ The response returned from the SearchOrganizations
503
+ method.
504
+
505
+ Iterating over this object will yield results and
506
+ resolve additional pages automatically.
507
+
508
+ """
509
+ # Create or coerce a protobuf request object.
510
+ # - Quick check: If we got a request object, we should *not* have
511
+ # gotten any keyword arguments that map to the request.
512
+ flattened_params = [query]
513
+ has_flattened_params = (
514
+ len([param for param in flattened_params if param is not None]) > 0
515
+ )
516
+ if request is not None and has_flattened_params:
517
+ raise ValueError(
518
+ "If the `request` argument is set, then none of "
519
+ "the individual field arguments should be set."
520
+ )
521
+
522
+ # - Use the request object if provided (there's no risk of modifying the input as
523
+ # there are no flattened fields), or create one.
524
+ if not isinstance(request, organizations.SearchOrganizationsRequest):
525
+ request = organizations.SearchOrganizationsRequest(request)
526
+
527
+ # If we have keyword arguments corresponding to fields on the
528
+ # request, apply these.
529
+ if query is not None:
530
+ request.query = query
531
+
532
+ # Wrap the RPC method; this adds retry and timeout information,
533
+ # and friendly error handling.
534
+ rpc = self._client._transport._wrapped_methods[
535
+ self._client._transport.search_organizations
536
+ ]
537
+
538
+ # Validate the universe domain.
539
+ self._client._validate_universe_domain()
540
+
541
+ # Send the request.
542
+ response = await rpc(
543
+ request,
544
+ retry=retry,
545
+ timeout=timeout,
546
+ metadata=metadata,
547
+ )
548
+
549
+ # This method is paged; wrap the response in a pager, which provides
550
+ # an `__aiter__` convenience method.
551
+ response = pagers.SearchOrganizationsAsyncPager(
552
+ method=rpc,
553
+ request=request,
554
+ response=response,
555
+ retry=retry,
556
+ timeout=timeout,
557
+ metadata=metadata,
558
+ )
559
+
560
+ # Done; return the response.
561
+ return response
562
+
563
+ async def get_iam_policy(
564
+ self,
565
+ request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
566
+ *,
567
+ resource: Optional[str] = None,
568
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
569
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
570
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
571
+ ) -> policy_pb2.Policy:
572
+ r"""Gets the access control policy for an organization resource. The
573
+ policy may be empty if no such policy or resource exists. The
574
+ ``resource`` field should be the organization's resource name,
575
+ for example: "organizations/123".
576
+
577
+ Authorization requires the IAM permission
578
+ ``resourcemanager.organizations.getIamPolicy`` on the specified
579
+ organization.
580
+
581
+ .. code-block:: python
582
+
583
+ # This snippet has been automatically generated and should be regarded as a
584
+ # code template only.
585
+ # It will require modifications to work:
586
+ # - It may require correct/in-range values for request initialization.
587
+ # - It may require specifying regional endpoints when creating the service
588
+ # client as shown in:
589
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
590
+ from google.cloud import resourcemanager_v3
591
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
592
+
593
+ async def sample_get_iam_policy():
594
+ # Create a client
595
+ client = resourcemanager_v3.OrganizationsAsyncClient()
596
+
597
+ # Initialize request argument(s)
598
+ request = iam_policy_pb2.GetIamPolicyRequest(
599
+ resource="resource_value",
600
+ )
601
+
602
+ # Make the request
603
+ response = await client.get_iam_policy(request=request)
604
+
605
+ # Handle the response
606
+ print(response)
607
+
608
+ Args:
609
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]]):
610
+ The request object. Request message for ``GetIamPolicy`` method.
611
+ resource (:class:`str`):
612
+ REQUIRED: The resource for which the
613
+ policy is being requested. See the
614
+ operation documentation for the
615
+ appropriate value for this field.
616
+
617
+ This corresponds to the ``resource`` field
618
+ on the ``request`` instance; if ``request`` is provided, this
619
+ should not be set.
620
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
621
+ should be retried.
622
+ timeout (float): The timeout for this request.
623
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
624
+ sent along with the request as metadata. Normally, each value must be of type `str`,
625
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
626
+ be of type `bytes`.
627
+
628
+ Returns:
629
+ google.iam.v1.policy_pb2.Policy:
630
+ An Identity and Access Management (IAM) policy, which specifies access
631
+ controls for Google Cloud resources.
632
+
633
+ A Policy is a collection of bindings. A binding binds
634
+ one or more members, or principals, to a single role.
635
+ Principals can be user accounts, service accounts,
636
+ Google groups, and domains (such as G Suite). A role
637
+ is a named list of permissions; each role can be an
638
+ IAM predefined role or a user-created custom role.
639
+
640
+ For some types of Google Cloud resources, a binding
641
+ can also specify a condition, which is a logical
642
+ expression that allows access to a resource only if
643
+ the expression evaluates to true. A condition can add
644
+ constraints based on attributes of the request, the
645
+ resource, or both. To learn which resources support
646
+ conditions in their IAM policies, see the [IAM
647
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
648
+
649
+ **JSON example:**
650
+
651
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
652
+
653
+ **YAML example:**
654
+
655
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
656
+
657
+ For a description of IAM and its features, see the
658
+ [IAM
659
+ documentation](https://cloud.google.com/iam/docs/).
660
+
661
+ """
662
+ # Create or coerce a protobuf request object.
663
+ # - Quick check: If we got a request object, we should *not* have
664
+ # gotten any keyword arguments that map to the request.
665
+ flattened_params = [resource]
666
+ has_flattened_params = (
667
+ len([param for param in flattened_params if param is not None]) > 0
668
+ )
669
+ if request is not None and has_flattened_params:
670
+ raise ValueError(
671
+ "If the `request` argument is set, then none of "
672
+ "the individual field arguments should be set."
673
+ )
674
+
675
+ # - The request isn't a proto-plus wrapped type,
676
+ # so it must be constructed via keyword expansion.
677
+ if isinstance(request, dict):
678
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
679
+ elif not request:
680
+ request = iam_policy_pb2.GetIamPolicyRequest(resource=resource)
681
+
682
+ # Wrap the RPC method; this adds retry and timeout information,
683
+ # and friendly error handling.
684
+ rpc = self._client._transport._wrapped_methods[
685
+ self._client._transport.get_iam_policy
686
+ ]
687
+
688
+ # Certain fields should be provided within the metadata header;
689
+ # add these here.
690
+ metadata = tuple(metadata) + (
691
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
692
+ )
693
+
694
+ # Validate the universe domain.
695
+ self._client._validate_universe_domain()
696
+
697
+ # Send the request.
698
+ response = await rpc(
699
+ request,
700
+ retry=retry,
701
+ timeout=timeout,
702
+ metadata=metadata,
703
+ )
704
+
705
+ # Done; return the response.
706
+ return response
707
+
708
+ async def set_iam_policy(
709
+ self,
710
+ request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
711
+ *,
712
+ resource: Optional[str] = None,
713
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
714
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
715
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
716
+ ) -> policy_pb2.Policy:
717
+ r"""Sets the access control policy on an organization resource.
718
+ Replaces any existing policy. The ``resource`` field should be
719
+ the organization's resource name, for example:
720
+ "organizations/123".
721
+
722
+ Authorization requires the IAM permission
723
+ ``resourcemanager.organizations.setIamPolicy`` on the specified
724
+ organization.
725
+
726
+ .. code-block:: python
727
+
728
+ # This snippet has been automatically generated and should be regarded as a
729
+ # code template only.
730
+ # It will require modifications to work:
731
+ # - It may require correct/in-range values for request initialization.
732
+ # - It may require specifying regional endpoints when creating the service
733
+ # client as shown in:
734
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
735
+ from google.cloud import resourcemanager_v3
736
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
737
+
738
+ async def sample_set_iam_policy():
739
+ # Create a client
740
+ client = resourcemanager_v3.OrganizationsAsyncClient()
741
+
742
+ # Initialize request argument(s)
743
+ request = iam_policy_pb2.SetIamPolicyRequest(
744
+ resource="resource_value",
745
+ )
746
+
747
+ # Make the request
748
+ response = await client.set_iam_policy(request=request)
749
+
750
+ # Handle the response
751
+ print(response)
752
+
753
+ Args:
754
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]]):
755
+ The request object. Request message for ``SetIamPolicy`` method.
756
+ resource (:class:`str`):
757
+ REQUIRED: The resource for which the
758
+ policy is being specified. See the
759
+ operation documentation for the
760
+ appropriate value for this field.
761
+
762
+ This corresponds to the ``resource`` field
763
+ on the ``request`` instance; if ``request`` is provided, this
764
+ should not be set.
765
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
766
+ should be retried.
767
+ timeout (float): The timeout for this request.
768
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
769
+ sent along with the request as metadata. Normally, each value must be of type `str`,
770
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
771
+ be of type `bytes`.
772
+
773
+ Returns:
774
+ google.iam.v1.policy_pb2.Policy:
775
+ An Identity and Access Management (IAM) policy, which specifies access
776
+ controls for Google Cloud resources.
777
+
778
+ A Policy is a collection of bindings. A binding binds
779
+ one or more members, or principals, to a single role.
780
+ Principals can be user accounts, service accounts,
781
+ Google groups, and domains (such as G Suite). A role
782
+ is a named list of permissions; each role can be an
783
+ IAM predefined role or a user-created custom role.
784
+
785
+ For some types of Google Cloud resources, a binding
786
+ can also specify a condition, which is a logical
787
+ expression that allows access to a resource only if
788
+ the expression evaluates to true. A condition can add
789
+ constraints based on attributes of the request, the
790
+ resource, or both. To learn which resources support
791
+ conditions in their IAM policies, see the [IAM
792
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
793
+
794
+ **JSON example:**
795
+
796
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
797
+
798
+ **YAML example:**
799
+
800
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
801
+
802
+ For a description of IAM and its features, see the
803
+ [IAM
804
+ documentation](https://cloud.google.com/iam/docs/).
805
+
806
+ """
807
+ # Create or coerce a protobuf request object.
808
+ # - Quick check: If we got a request object, we should *not* have
809
+ # gotten any keyword arguments that map to the request.
810
+ flattened_params = [resource]
811
+ has_flattened_params = (
812
+ len([param for param in flattened_params if param is not None]) > 0
813
+ )
814
+ if request is not None and has_flattened_params:
815
+ raise ValueError(
816
+ "If the `request` argument is set, then none of "
817
+ "the individual field arguments should be set."
818
+ )
819
+
820
+ # - The request isn't a proto-plus wrapped type,
821
+ # so it must be constructed via keyword expansion.
822
+ if isinstance(request, dict):
823
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
824
+ elif not request:
825
+ request = iam_policy_pb2.SetIamPolicyRequest(resource=resource)
826
+
827
+ # Wrap the RPC method; this adds retry and timeout information,
828
+ # and friendly error handling.
829
+ rpc = self._client._transport._wrapped_methods[
830
+ self._client._transport.set_iam_policy
831
+ ]
832
+
833
+ # Certain fields should be provided within the metadata header;
834
+ # add these here.
835
+ metadata = tuple(metadata) + (
836
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
837
+ )
838
+
839
+ # Validate the universe domain.
840
+ self._client._validate_universe_domain()
841
+
842
+ # Send the request.
843
+ response = await rpc(
844
+ request,
845
+ retry=retry,
846
+ timeout=timeout,
847
+ metadata=metadata,
848
+ )
849
+
850
+ # Done; return the response.
851
+ return response
852
+
853
+ async def test_iam_permissions(
854
+ self,
855
+ request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
856
+ *,
857
+ resource: Optional[str] = None,
858
+ permissions: Optional[MutableSequence[str]] = None,
859
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
860
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
861
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
862
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
863
+ r"""Returns the permissions that a caller has on the specified
864
+ organization. The ``resource`` field should be the
865
+ organization's resource name, for example: "organizations/123".
866
+
867
+ There are no permissions required for making this API call.
868
+
869
+ .. code-block:: python
870
+
871
+ # This snippet has been automatically generated and should be regarded as a
872
+ # code template only.
873
+ # It will require modifications to work:
874
+ # - It may require correct/in-range values for request initialization.
875
+ # - It may require specifying regional endpoints when creating the service
876
+ # client as shown in:
877
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
878
+ from google.cloud import resourcemanager_v3
879
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
880
+
881
+ async def sample_test_iam_permissions():
882
+ # Create a client
883
+ client = resourcemanager_v3.OrganizationsAsyncClient()
884
+
885
+ # Initialize request argument(s)
886
+ request = iam_policy_pb2.TestIamPermissionsRequest(
887
+ resource="resource_value",
888
+ permissions=['permissions_value1', 'permissions_value2'],
889
+ )
890
+
891
+ # Make the request
892
+ response = await client.test_iam_permissions(request=request)
893
+
894
+ # Handle the response
895
+ print(response)
896
+
897
+ Args:
898
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]]):
899
+ The request object. Request message for ``TestIamPermissions`` method.
900
+ resource (:class:`str`):
901
+ REQUIRED: The resource for which the
902
+ policy detail is being requested. See
903
+ the operation documentation for the
904
+ appropriate value for this field.
905
+
906
+ This corresponds to the ``resource`` field
907
+ on the ``request`` instance; if ``request`` is provided, this
908
+ should not be set.
909
+ permissions (:class:`MutableSequence[str]`):
910
+ The set of permissions to check for the ``resource``.
911
+ Permissions with wildcards (such as '*' or 'storage.*')
912
+ are not allowed. For more information see `IAM
913
+ Overview <https://cloud.google.com/iam/docs/overview#permissions>`__.
914
+
915
+ This corresponds to the ``permissions`` field
916
+ on the ``request`` instance; if ``request`` is provided, this
917
+ should not be set.
918
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
919
+ should be retried.
920
+ timeout (float): The timeout for this request.
921
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
922
+ sent along with the request as metadata. Normally, each value must be of type `str`,
923
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
924
+ be of type `bytes`.
925
+
926
+ Returns:
927
+ google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse:
928
+ Response message for TestIamPermissions method.
929
+ """
930
+ # Create or coerce a protobuf request object.
931
+ # - Quick check: If we got a request object, we should *not* have
932
+ # gotten any keyword arguments that map to the request.
933
+ flattened_params = [resource, permissions]
934
+ has_flattened_params = (
935
+ len([param for param in flattened_params if param is not None]) > 0
936
+ )
937
+ if request is not None and has_flattened_params:
938
+ raise ValueError(
939
+ "If the `request` argument is set, then none of "
940
+ "the individual field arguments should be set."
941
+ )
942
+
943
+ # - The request isn't a proto-plus wrapped type,
944
+ # so it must be constructed via keyword expansion.
945
+ if isinstance(request, dict):
946
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
947
+ elif not request:
948
+ request = iam_policy_pb2.TestIamPermissionsRequest(
949
+ resource=resource, permissions=permissions
950
+ )
951
+
952
+ # Wrap the RPC method; this adds retry and timeout information,
953
+ # and friendly error handling.
954
+ rpc = self._client._transport._wrapped_methods[
955
+ self._client._transport.test_iam_permissions
956
+ ]
957
+
958
+ # Certain fields should be provided within the metadata header;
959
+ # add these here.
960
+ metadata = tuple(metadata) + (
961
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
962
+ )
963
+
964
+ # Validate the universe domain.
965
+ self._client._validate_universe_domain()
966
+
967
+ # Send the request.
968
+ response = await rpc(
969
+ request,
970
+ retry=retry,
971
+ timeout=timeout,
972
+ metadata=metadata,
973
+ )
974
+
975
+ # Done; return the response.
976
+ return response
977
+
978
+ async def get_operation(
979
+ self,
980
+ request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None,
981
+ *,
982
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
983
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
984
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
985
+ ) -> operations_pb2.Operation:
986
+ r"""Gets the latest state of a long-running operation.
987
+
988
+ Args:
989
+ request (:class:`~.operations_pb2.GetOperationRequest`):
990
+ The request object. Request message for
991
+ `GetOperation` method.
992
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
993
+ if any, should be retried.
994
+ timeout (float): The timeout for this request.
995
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
996
+ sent along with the request as metadata. Normally, each value must be of type `str`,
997
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
998
+ be of type `bytes`.
999
+ Returns:
1000
+ ~.operations_pb2.Operation:
1001
+ An ``Operation`` object.
1002
+ """
1003
+ # Create or coerce a protobuf request object.
1004
+ # The request isn't a proto-plus wrapped type,
1005
+ # so it must be constructed via keyword expansion.
1006
+ if request is None:
1007
+ request_pb = operations_pb2.GetOperationRequest()
1008
+ elif isinstance(request, dict):
1009
+ request_pb = operations_pb2.GetOperationRequest(**request)
1010
+ else:
1011
+ request_pb = request
1012
+
1013
+ # Wrap the RPC method; this adds retry and timeout information,
1014
+ # and friendly error handling.
1015
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
1016
+
1017
+ # Certain fields should be provided within the metadata header;
1018
+ # add these here.
1019
+ metadata = tuple(metadata) + (
1020
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
1021
+ )
1022
+
1023
+ # Validate the universe domain.
1024
+ self._client._validate_universe_domain()
1025
+
1026
+ # Send the request.
1027
+ response = await rpc(
1028
+ request_pb,
1029
+ retry=retry,
1030
+ timeout=timeout,
1031
+ metadata=metadata,
1032
+ )
1033
+
1034
+ # Done; return the response.
1035
+ return response
1036
+
1037
+ async def __aenter__(self) -> "OrganizationsAsyncClient":
1038
+ return self
1039
+
1040
+ async def __aexit__(self, exc_type, exc, tb):
1041
+ await self.transport.close()
1042
+
1043
+
1044
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1045
+ gapic_version=package_version.__version__
1046
+ )
1047
+
1048
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1049
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1050
+
1051
+
1052
+ __all__ = ("OrganizationsAsyncClient",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/organizations/client.py ADDED
@@ -0,0 +1,1486 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import json
17
+ import logging as std_logging
18
+ import os
19
+ import re
20
+ import warnings
21
+ from collections import OrderedDict
22
+ from http import HTTPStatus
23
+ from typing import (
24
+ Callable,
25
+ Dict,
26
+ Mapping,
27
+ MutableMapping,
28
+ MutableSequence,
29
+ Optional,
30
+ Sequence,
31
+ Tuple,
32
+ Type,
33
+ Union,
34
+ cast,
35
+ )
36
+
37
+ import google.protobuf
38
+ from google.api_core import client_options as client_options_lib
39
+ from google.api_core import exceptions as core_exceptions
40
+ from google.api_core import gapic_v1
41
+ from google.api_core import retry as retries
42
+ from google.auth import credentials as ga_credentials # type: ignore
43
+ from google.auth.exceptions import MutualTLSChannelError # type: ignore
44
+ from google.auth.transport import mtls # type: ignore
45
+ from google.auth.transport.grpc import SslCredentials # type: ignore
46
+ from google.oauth2 import service_account # type: ignore
47
+
48
+ from google.cloud.resourcemanager_v3 import gapic_version as package_version
49
+
50
+ try:
51
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
52
+ except AttributeError: # pragma: NO COVER
53
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
54
+
55
+ try:
56
+ from google.api_core import client_logging # type: ignore
57
+
58
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
59
+ except ImportError: # pragma: NO COVER
60
+ CLIENT_LOGGING_SUPPORTED = False
61
+
62
+ _LOGGER = std_logging.getLogger(__name__)
63
+
64
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
65
+ import google.iam.v1.policy_pb2 as policy_pb2 # type: ignore
66
+ import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
67
+ from google.longrunning import operations_pb2 # type: ignore
68
+
69
+ from google.cloud.resourcemanager_v3.services.organizations import pagers
70
+ from google.cloud.resourcemanager_v3.types import organizations
71
+
72
+ from .transports.base import DEFAULT_CLIENT_INFO, OrganizationsTransport
73
+ from .transports.grpc import OrganizationsGrpcTransport
74
+ from .transports.grpc_asyncio import OrganizationsGrpcAsyncIOTransport
75
+ from .transports.rest import OrganizationsRestTransport
76
+
77
+
78
+ class OrganizationsClientMeta(type):
79
+ """Metaclass for the Organizations client.
80
+
81
+ This provides class-level methods for building and retrieving
82
+ support objects (e.g. transport) without polluting the client instance
83
+ objects.
84
+ """
85
+
86
+ _transport_registry = OrderedDict() # type: Dict[str, Type[OrganizationsTransport]]
87
+ _transport_registry["grpc"] = OrganizationsGrpcTransport
88
+ _transport_registry["grpc_asyncio"] = OrganizationsGrpcAsyncIOTransport
89
+ _transport_registry["rest"] = OrganizationsRestTransport
90
+
91
+ def get_transport_class(
92
+ cls,
93
+ label: Optional[str] = None,
94
+ ) -> Type[OrganizationsTransport]:
95
+ """Returns an appropriate transport class.
96
+
97
+ Args:
98
+ label: The name of the desired transport. If none is
99
+ provided, then the first transport in the registry is used.
100
+
101
+ Returns:
102
+ The transport class to use.
103
+ """
104
+ # If a specific transport is requested, return that one.
105
+ if label:
106
+ return cls._transport_registry[label]
107
+
108
+ # No transport is requested; return the default (that is, the first one
109
+ # in the dictionary).
110
+ return next(iter(cls._transport_registry.values()))
111
+
112
+
113
+ class OrganizationsClient(metaclass=OrganizationsClientMeta):
114
+ """Allows users to manage their organization resources."""
115
+
116
+ @staticmethod
117
+ def _get_default_mtls_endpoint(api_endpoint) -> Optional[str]:
118
+ """Converts api endpoint to mTLS endpoint.
119
+
120
+ Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
121
+ "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
122
+ Args:
123
+ api_endpoint (Optional[str]): the api endpoint to convert.
124
+ Returns:
125
+ Optional[str]: converted mTLS api endpoint.
126
+ """
127
+ if not api_endpoint:
128
+ return api_endpoint
129
+
130
+ mtls_endpoint_re = re.compile(
131
+ r"(?P<name>[^.]+)(?P<mtls>\.mtls)?(?P<sandbox>\.sandbox)?(?P<googledomain>\.googleapis\.com)?"
132
+ )
133
+
134
+ m = mtls_endpoint_re.match(api_endpoint)
135
+ if m is None:
136
+ # Could not parse api_endpoint; return as-is.
137
+ return api_endpoint
138
+
139
+ name, mtls, sandbox, googledomain = m.groups()
140
+ if mtls or not googledomain:
141
+ return api_endpoint
142
+
143
+ if sandbox:
144
+ return api_endpoint.replace(
145
+ "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
146
+ )
147
+
148
+ return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
149
+
150
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
151
+ DEFAULT_ENDPOINT = "cloudresourcemanager.googleapis.com"
152
+ DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
153
+ DEFAULT_ENDPOINT
154
+ )
155
+
156
+ _DEFAULT_ENDPOINT_TEMPLATE = "cloudresourcemanager.{UNIVERSE_DOMAIN}"
157
+ _DEFAULT_UNIVERSE = "googleapis.com"
158
+
159
+ @staticmethod
160
+ def _use_client_cert_effective():
161
+ """Returns whether client certificate should be used for mTLS if the
162
+ google-auth version supports should_use_client_cert automatic mTLS enablement.
163
+
164
+ Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.
165
+
166
+ Returns:
167
+ bool: whether client certificate should be used for mTLS
168
+ Raises:
169
+ ValueError: (If using a version of google-auth without should_use_client_cert and
170
+ GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
171
+ """
172
+ # check if google-auth version supports should_use_client_cert for automatic mTLS enablement
173
+ if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER
174
+ return mtls.should_use_client_cert()
175
+ else: # pragma: NO COVER
176
+ # if unsupported, fallback to reading from env var
177
+ use_client_cert_str = os.getenv(
178
+ "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
179
+ ).lower()
180
+ if use_client_cert_str not in ("true", "false"):
181
+ raise ValueError(
182
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
183
+ " either `true` or `false`"
184
+ )
185
+ return use_client_cert_str == "true"
186
+
187
+ @classmethod
188
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
189
+ """Creates an instance of this client using the provided credentials
190
+ info.
191
+
192
+ Args:
193
+ info (dict): The service account private key info.
194
+ args: Additional arguments to pass to the constructor.
195
+ kwargs: Additional arguments to pass to the constructor.
196
+
197
+ Returns:
198
+ OrganizationsClient: The constructed client.
199
+ """
200
+ credentials = service_account.Credentials.from_service_account_info(info)
201
+ kwargs["credentials"] = credentials
202
+ return cls(*args, **kwargs)
203
+
204
+ @classmethod
205
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
206
+ """Creates an instance of this client using the provided credentials
207
+ file.
208
+
209
+ Args:
210
+ filename (str): The path to the service account private key json
211
+ file.
212
+ args: Additional arguments to pass to the constructor.
213
+ kwargs: Additional arguments to pass to the constructor.
214
+
215
+ Returns:
216
+ OrganizationsClient: The constructed client.
217
+ """
218
+ credentials = service_account.Credentials.from_service_account_file(filename)
219
+ kwargs["credentials"] = credentials
220
+ return cls(*args, **kwargs)
221
+
222
+ from_service_account_json = from_service_account_file
223
+
224
+ @property
225
+ def transport(self) -> OrganizationsTransport:
226
+ """Returns the transport used by the client instance.
227
+
228
+ Returns:
229
+ OrganizationsTransport: The transport used by the client
230
+ instance.
231
+ """
232
+ return self._transport
233
+
234
+ @staticmethod
235
+ def organization_path(
236
+ organization: str,
237
+ ) -> str:
238
+ """Returns a fully-qualified organization string."""
239
+ return "organizations/{organization}".format(
240
+ organization=organization,
241
+ )
242
+
243
+ @staticmethod
244
+ def parse_organization_path(path: str) -> Dict[str, str]:
245
+ """Parses a organization path into its component segments."""
246
+ m = re.match(r"^organizations/(?P<organization>.+?)$", path)
247
+ return m.groupdict() if m else {}
248
+
249
+ @staticmethod
250
+ def common_billing_account_path(
251
+ billing_account: str,
252
+ ) -> str:
253
+ """Returns a fully-qualified billing_account string."""
254
+ return "billingAccounts/{billing_account}".format(
255
+ billing_account=billing_account,
256
+ )
257
+
258
+ @staticmethod
259
+ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
260
+ """Parse a billing_account path into its component segments."""
261
+ m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path)
262
+ return m.groupdict() if m else {}
263
+
264
+ @staticmethod
265
+ def common_folder_path(
266
+ folder: str,
267
+ ) -> str:
268
+ """Returns a fully-qualified folder string."""
269
+ return "folders/{folder}".format(
270
+ folder=folder,
271
+ )
272
+
273
+ @staticmethod
274
+ def parse_common_folder_path(path: str) -> Dict[str, str]:
275
+ """Parse a folder path into its component segments."""
276
+ m = re.match(r"^folders/(?P<folder>.+?)$", path)
277
+ return m.groupdict() if m else {}
278
+
279
+ @staticmethod
280
+ def common_organization_path(
281
+ organization: str,
282
+ ) -> str:
283
+ """Returns a fully-qualified organization string."""
284
+ return "organizations/{organization}".format(
285
+ organization=organization,
286
+ )
287
+
288
+ @staticmethod
289
+ def parse_common_organization_path(path: str) -> Dict[str, str]:
290
+ """Parse a organization path into its component segments."""
291
+ m = re.match(r"^organizations/(?P<organization>.+?)$", path)
292
+ return m.groupdict() if m else {}
293
+
294
+ @staticmethod
295
+ def common_project_path(
296
+ project: str,
297
+ ) -> str:
298
+ """Returns a fully-qualified project string."""
299
+ return "projects/{project}".format(
300
+ project=project,
301
+ )
302
+
303
+ @staticmethod
304
+ def parse_common_project_path(path: str) -> Dict[str, str]:
305
+ """Parse a project path into its component segments."""
306
+ m = re.match(r"^projects/(?P<project>.+?)$", path)
307
+ return m.groupdict() if m else {}
308
+
309
+ @staticmethod
310
+ def common_location_path(
311
+ project: str,
312
+ location: str,
313
+ ) -> str:
314
+ """Returns a fully-qualified location string."""
315
+ return "projects/{project}/locations/{location}".format(
316
+ project=project,
317
+ location=location,
318
+ )
319
+
320
+ @staticmethod
321
+ def parse_common_location_path(path: str) -> Dict[str, str]:
322
+ """Parse a location path into its component segments."""
323
+ m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path)
324
+ return m.groupdict() if m else {}
325
+
326
+ @classmethod
327
+ def get_mtls_endpoint_and_cert_source(
328
+ cls, client_options: Optional[client_options_lib.ClientOptions] = None
329
+ ):
330
+ """Deprecated. Return the API endpoint and client cert source for mutual TLS.
331
+
332
+ The client cert source is determined in the following order:
333
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
334
+ client cert source is None.
335
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
336
+ default client cert source exists, use the default one; otherwise the client cert
337
+ source is None.
338
+
339
+ The API endpoint is determined in the following order:
340
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
341
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
342
+ default mTLS endpoint; if the environment variable is "never", use the default API
343
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
344
+ use the default API endpoint.
345
+
346
+ More details can be found at https://google.aip.dev/auth/4114.
347
+
348
+ Args:
349
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
350
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
351
+ in this method.
352
+
353
+ Returns:
354
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
355
+ client cert source to use.
356
+
357
+ Raises:
358
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
359
+ """
360
+
361
+ warnings.warn(
362
+ "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.",
363
+ DeprecationWarning,
364
+ )
365
+ if client_options is None:
366
+ client_options = client_options_lib.ClientOptions()
367
+ use_client_cert = OrganizationsClient._use_client_cert_effective()
368
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
369
+ if use_mtls_endpoint not in ("auto", "never", "always"):
370
+ raise MutualTLSChannelError(
371
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
372
+ )
373
+
374
+ # Figure out the client cert source to use.
375
+ client_cert_source = None
376
+ if use_client_cert:
377
+ if client_options.client_cert_source:
378
+ client_cert_source = client_options.client_cert_source
379
+ elif mtls.has_default_client_cert_source():
380
+ client_cert_source = mtls.default_client_cert_source()
381
+
382
+ # Figure out which api endpoint to use.
383
+ if client_options.api_endpoint is not None:
384
+ api_endpoint = client_options.api_endpoint
385
+ elif use_mtls_endpoint == "always" or (
386
+ use_mtls_endpoint == "auto" and client_cert_source
387
+ ):
388
+ api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
389
+ else:
390
+ api_endpoint = cls.DEFAULT_ENDPOINT
391
+
392
+ return api_endpoint, client_cert_source
393
+
394
+ @staticmethod
395
+ def _read_environment_variables():
396
+ """Returns the environment variables used by the client.
397
+
398
+ Returns:
399
+ Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
400
+ GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.
401
+
402
+ Raises:
403
+ ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
404
+ any of ["true", "false"].
405
+ google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
406
+ is not any of ["auto", "never", "always"].
407
+ """
408
+ use_client_cert = OrganizationsClient._use_client_cert_effective()
409
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
410
+ universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
411
+ if use_mtls_endpoint not in ("auto", "never", "always"):
412
+ raise MutualTLSChannelError(
413
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
414
+ )
415
+ return use_client_cert, use_mtls_endpoint, universe_domain_env
416
+
417
+ @staticmethod
418
+ def _get_client_cert_source(provided_cert_source, use_cert_flag):
419
+ """Return the client cert source to be used by the client.
420
+
421
+ Args:
422
+ provided_cert_source (bytes): The client certificate source provided.
423
+ use_cert_flag (bool): A flag indicating whether to use the client certificate.
424
+
425
+ Returns:
426
+ bytes or None: The client cert source to be used by the client.
427
+ """
428
+ client_cert_source = None
429
+ if use_cert_flag:
430
+ if provided_cert_source:
431
+ client_cert_source = provided_cert_source
432
+ elif mtls.has_default_client_cert_source():
433
+ client_cert_source = mtls.default_client_cert_source()
434
+ return client_cert_source
435
+
436
+ @staticmethod
437
+ def _get_api_endpoint(
438
+ api_override, client_cert_source, universe_domain, use_mtls_endpoint
439
+ ) -> str:
440
+ """Return the API endpoint used by the client.
441
+
442
+ Args:
443
+ api_override (str): The API endpoint override. If specified, this is always
444
+ the return value of this function and the other arguments are not used.
445
+ client_cert_source (bytes): The client certificate source used by the client.
446
+ universe_domain (str): The universe domain used by the client.
447
+ use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
448
+ Possible values are "always", "auto", or "never".
449
+
450
+ Returns:
451
+ str: The API endpoint to be used by the client.
452
+ """
453
+ if api_override is not None:
454
+ api_endpoint = api_override
455
+ elif use_mtls_endpoint == "always" or (
456
+ use_mtls_endpoint == "auto" and client_cert_source
457
+ ):
458
+ _default_universe = OrganizationsClient._DEFAULT_UNIVERSE
459
+ if universe_domain != _default_universe:
460
+ raise MutualTLSChannelError(
461
+ f"mTLS is not supported in any universe other than {_default_universe}."
462
+ )
463
+ api_endpoint = OrganizationsClient.DEFAULT_MTLS_ENDPOINT
464
+ else:
465
+ api_endpoint = OrganizationsClient._DEFAULT_ENDPOINT_TEMPLATE.format(
466
+ UNIVERSE_DOMAIN=universe_domain
467
+ )
468
+ return api_endpoint
469
+
470
+ @staticmethod
471
+ def _get_universe_domain(
472
+ client_universe_domain: Optional[str], universe_domain_env: Optional[str]
473
+ ) -> str:
474
+ """Return the universe domain used by the client.
475
+
476
+ Args:
477
+ client_universe_domain (Optional[str]): The universe domain configured via the client options.
478
+ universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
479
+
480
+ Returns:
481
+ str: The universe domain to be used by the client.
482
+
483
+ Raises:
484
+ ValueError: If the universe domain is an empty string.
485
+ """
486
+ universe_domain = OrganizationsClient._DEFAULT_UNIVERSE
487
+ if client_universe_domain is not None:
488
+ universe_domain = client_universe_domain
489
+ elif universe_domain_env is not None:
490
+ universe_domain = universe_domain_env
491
+ if len(universe_domain.strip()) == 0:
492
+ raise ValueError("Universe Domain cannot be an empty string.")
493
+ return universe_domain
494
+
495
+ def _validate_universe_domain(self):
496
+ """Validates client's and credentials' universe domains are consistent.
497
+
498
+ Returns:
499
+ bool: True iff the configured universe domain is valid.
500
+
501
+ Raises:
502
+ ValueError: If the configured universe domain is not valid.
503
+ """
504
+
505
+ # NOTE (b/349488459): universe validation is disabled until further notice.
506
+ return True
507
+
508
+ def _add_cred_info_for_auth_errors(
509
+ self, error: core_exceptions.GoogleAPICallError
510
+ ) -> None:
511
+ """Adds credential info string to error details for 401/403/404 errors.
512
+
513
+ Args:
514
+ error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
515
+ """
516
+ if error.code not in [
517
+ HTTPStatus.UNAUTHORIZED,
518
+ HTTPStatus.FORBIDDEN,
519
+ HTTPStatus.NOT_FOUND,
520
+ ]:
521
+ return
522
+
523
+ cred = self._transport._credentials
524
+
525
+ # get_cred_info is only available in google-auth>=2.35.0
526
+ if not hasattr(cred, "get_cred_info"):
527
+ return
528
+
529
+ # ignore the type check since pypy test fails when get_cred_info
530
+ # is not available
531
+ cred_info = cred.get_cred_info() # type: ignore
532
+ if cred_info and hasattr(error._details, "append"):
533
+ error._details.append(json.dumps(cred_info))
534
+
535
+ @property
536
+ def api_endpoint(self) -> str:
537
+ """Return the API endpoint used by the client instance.
538
+
539
+ Returns:
540
+ str: The API endpoint used by the client instance.
541
+ """
542
+ return self._api_endpoint
543
+
544
+ @property
545
+ def universe_domain(self) -> str:
546
+ """Return the universe domain used by the client instance.
547
+
548
+ Returns:
549
+ str: The universe domain used by the client instance.
550
+ """
551
+ return self._universe_domain
552
+
553
+ def __init__(
554
+ self,
555
+ *,
556
+ credentials: Optional[ga_credentials.Credentials] = None,
557
+ transport: Optional[
558
+ Union[str, OrganizationsTransport, Callable[..., OrganizationsTransport]]
559
+ ] = None,
560
+ client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
561
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
562
+ ) -> None:
563
+ """Instantiates the organizations client.
564
+
565
+ Args:
566
+ credentials (Optional[google.auth.credentials.Credentials]): The
567
+ authorization credentials to attach to requests. These
568
+ credentials identify the application to the service; if none
569
+ are specified, the client will attempt to ascertain the
570
+ credentials from the environment.
571
+ transport (Optional[Union[str,OrganizationsTransport,Callable[..., OrganizationsTransport]]]):
572
+ The transport to use, or a Callable that constructs and returns a new transport.
573
+ If a Callable is given, it will be called with the same set of initialization
574
+ arguments as used in the OrganizationsTransport constructor.
575
+ If set to None, a transport is chosen automatically.
576
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
577
+ Custom options for the client.
578
+
579
+ 1. The ``api_endpoint`` property can be used to override the
580
+ default endpoint provided by the client when ``transport`` is
581
+ not explicitly provided. Only if this property is not set and
582
+ ``transport`` was not explicitly provided, the endpoint is
583
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
584
+ variable, which have one of the following values:
585
+ "always" (always use the default mTLS endpoint), "never" (always
586
+ use the default regular endpoint) and "auto" (auto-switch to the
587
+ default mTLS endpoint if client certificate is present; this is
588
+ the default value).
589
+
590
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
591
+ is "true", then the ``client_cert_source`` property can be used
592
+ to provide a client certificate for mTLS transport. If
593
+ not provided, the default SSL client certificate will be used if
594
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
595
+ set, no client certificate will be used.
596
+
597
+ 3. The ``universe_domain`` property can be used to override the
598
+ default "googleapis.com" universe. Note that the ``api_endpoint``
599
+ property still takes precedence; and ``universe_domain`` is
600
+ currently not supported for mTLS.
601
+
602
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
603
+ The client info used to send a user-agent string along with
604
+ API requests. If ``None``, then default info will be used.
605
+ Generally, you only need to set this if you're developing
606
+ your own client library.
607
+
608
+ Raises:
609
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
610
+ creation failed for any reason.
611
+ """
612
+ self._client_options = client_options
613
+ if isinstance(self._client_options, dict):
614
+ self._client_options = client_options_lib.from_dict(self._client_options)
615
+ if self._client_options is None:
616
+ self._client_options = client_options_lib.ClientOptions()
617
+ self._client_options = cast(
618
+ client_options_lib.ClientOptions, self._client_options
619
+ )
620
+
621
+ universe_domain_opt = getattr(self._client_options, "universe_domain", None)
622
+
623
+ self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = (
624
+ OrganizationsClient._read_environment_variables()
625
+ )
626
+ self._client_cert_source = OrganizationsClient._get_client_cert_source(
627
+ self._client_options.client_cert_source, self._use_client_cert
628
+ )
629
+ self._universe_domain = OrganizationsClient._get_universe_domain(
630
+ universe_domain_opt, self._universe_domain_env
631
+ )
632
+ self._api_endpoint: str = "" # updated below, depending on `transport`
633
+
634
+ # Initialize the universe domain validation.
635
+ self._is_universe_domain_valid = False
636
+
637
+ if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER
638
+ # Setup logging.
639
+ client_logging.initialize_logging()
640
+
641
+ api_key_value = getattr(self._client_options, "api_key", None)
642
+ if api_key_value and credentials:
643
+ raise ValueError(
644
+ "client_options.api_key and credentials are mutually exclusive"
645
+ )
646
+
647
+ # Save or instantiate the transport.
648
+ # Ordinarily, we provide the transport, but allowing a custom transport
649
+ # instance provides an extensibility point for unusual situations.
650
+ transport_provided = isinstance(transport, OrganizationsTransport)
651
+ if transport_provided:
652
+ # transport is a OrganizationsTransport instance.
653
+ if credentials or self._client_options.credentials_file or api_key_value:
654
+ raise ValueError(
655
+ "When providing a transport instance, "
656
+ "provide its credentials directly."
657
+ )
658
+ if self._client_options.scopes:
659
+ raise ValueError(
660
+ "When providing a transport instance, provide its scopes directly."
661
+ )
662
+ self._transport = cast(OrganizationsTransport, transport)
663
+ self._api_endpoint = self._transport.host
664
+
665
+ self._api_endpoint = (
666
+ self._api_endpoint
667
+ or OrganizationsClient._get_api_endpoint(
668
+ self._client_options.api_endpoint,
669
+ self._client_cert_source,
670
+ self._universe_domain,
671
+ self._use_mtls_endpoint,
672
+ )
673
+ )
674
+
675
+ if not transport_provided:
676
+ import google.auth._default # type: ignore
677
+
678
+ if api_key_value and hasattr(
679
+ google.auth._default, "get_api_key_credentials"
680
+ ):
681
+ credentials = google.auth._default.get_api_key_credentials(
682
+ api_key_value
683
+ )
684
+
685
+ transport_init: Union[
686
+ Type[OrganizationsTransport], Callable[..., OrganizationsTransport]
687
+ ] = (
688
+ OrganizationsClient.get_transport_class(transport)
689
+ if isinstance(transport, str) or transport is None
690
+ else cast(Callable[..., OrganizationsTransport], transport)
691
+ )
692
+ # initialize with the provided callable or the passed in class
693
+ self._transport = transport_init(
694
+ credentials=credentials,
695
+ credentials_file=self._client_options.credentials_file,
696
+ host=self._api_endpoint,
697
+ scopes=self._client_options.scopes,
698
+ client_cert_source_for_mtls=self._client_cert_source,
699
+ quota_project_id=self._client_options.quota_project_id,
700
+ client_info=client_info,
701
+ always_use_jwt_access=True,
702
+ api_audience=self._client_options.api_audience,
703
+ )
704
+
705
+ if "async" not in str(self._transport):
706
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
707
+ std_logging.DEBUG
708
+ ): # pragma: NO COVER
709
+ _LOGGER.debug(
710
+ "Created client `google.cloud.resourcemanager_v3.OrganizationsClient`.",
711
+ extra={
712
+ "serviceName": "google.cloud.resourcemanager.v3.Organizations",
713
+ "universeDomain": getattr(
714
+ self._transport._credentials, "universe_domain", ""
715
+ ),
716
+ "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
717
+ "credentialsInfo": getattr(
718
+ self.transport._credentials, "get_cred_info", lambda: None
719
+ )(),
720
+ }
721
+ if hasattr(self._transport, "_credentials")
722
+ else {
723
+ "serviceName": "google.cloud.resourcemanager.v3.Organizations",
724
+ "credentialsType": None,
725
+ },
726
+ )
727
+
728
+ def get_organization(
729
+ self,
730
+ request: Optional[Union[organizations.GetOrganizationRequest, dict]] = None,
731
+ *,
732
+ name: Optional[str] = None,
733
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
734
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
735
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
736
+ ) -> organizations.Organization:
737
+ r"""Fetches an organization resource identified by the
738
+ specified resource name.
739
+
740
+ .. code-block:: python
741
+
742
+ # This snippet has been automatically generated and should be regarded as a
743
+ # code template only.
744
+ # It will require modifications to work:
745
+ # - It may require correct/in-range values for request initialization.
746
+ # - It may require specifying regional endpoints when creating the service
747
+ # client as shown in:
748
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
749
+ from google.cloud import resourcemanager_v3
750
+
751
+ def sample_get_organization():
752
+ # Create a client
753
+ client = resourcemanager_v3.OrganizationsClient()
754
+
755
+ # Initialize request argument(s)
756
+ request = resourcemanager_v3.GetOrganizationRequest(
757
+ name="name_value",
758
+ )
759
+
760
+ # Make the request
761
+ response = client.get_organization(request=request)
762
+
763
+ # Handle the response
764
+ print(response)
765
+
766
+ Args:
767
+ request (Union[google.cloud.resourcemanager_v3.types.GetOrganizationRequest, dict]):
768
+ The request object. The request sent to the ``GetOrganization`` method. The
769
+ ``name`` field is required. ``organization_id`` is no
770
+ longer accepted.
771
+ name (str):
772
+ Required. The resource name of the Organization to
773
+ fetch. This is the organization's relative path in the
774
+ API, formatted as "organizations/[organizationId]". For
775
+ example, "organizations/1234".
776
+
777
+ This corresponds to the ``name`` field
778
+ on the ``request`` instance; if ``request`` is provided, this
779
+ should not be set.
780
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
781
+ should be retried.
782
+ timeout (float): The timeout for this request.
783
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
784
+ sent along with the request as metadata. Normally, each value must be of type `str`,
785
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
786
+ be of type `bytes`.
787
+
788
+ Returns:
789
+ google.cloud.resourcemanager_v3.types.Organization:
790
+ The root node in the resource
791
+ hierarchy to which a particular entity's
792
+ (a company, for example) resources
793
+ belong.
794
+
795
+ """
796
+ # Create or coerce a protobuf request object.
797
+ # - Quick check: If we got a request object, we should *not* have
798
+ # gotten any keyword arguments that map to the request.
799
+ flattened_params = [name]
800
+ has_flattened_params = (
801
+ len([param for param in flattened_params if param is not None]) > 0
802
+ )
803
+ if request is not None and has_flattened_params:
804
+ raise ValueError(
805
+ "If the `request` argument is set, then none of "
806
+ "the individual field arguments should be set."
807
+ )
808
+
809
+ # - Use the request object if provided (there's no risk of modifying the input as
810
+ # there are no flattened fields), or create one.
811
+ if not isinstance(request, organizations.GetOrganizationRequest):
812
+ request = organizations.GetOrganizationRequest(request)
813
+ # If we have keyword arguments corresponding to fields on the
814
+ # request, apply these.
815
+ if name is not None:
816
+ request.name = name
817
+
818
+ # Wrap the RPC method; this adds retry and timeout information,
819
+ # and friendly error handling.
820
+ rpc = self._transport._wrapped_methods[self._transport.get_organization]
821
+
822
+ # Certain fields should be provided within the metadata header;
823
+ # add these here.
824
+ metadata = tuple(metadata) + (
825
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
826
+ )
827
+
828
+ # Validate the universe domain.
829
+ self._validate_universe_domain()
830
+
831
+ # Send the request.
832
+ response = rpc(
833
+ request,
834
+ retry=retry,
835
+ timeout=timeout,
836
+ metadata=metadata,
837
+ )
838
+
839
+ # Done; return the response.
840
+ return response
841
+
842
+ def search_organizations(
843
+ self,
844
+ request: Optional[Union[organizations.SearchOrganizationsRequest, dict]] = None,
845
+ *,
846
+ query: Optional[str] = None,
847
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
848
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
849
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
850
+ ) -> pagers.SearchOrganizationsPager:
851
+ r"""Searches organization resources that are visible to the user and
852
+ satisfy the specified filter. This method returns organizations
853
+ in an unspecified order. New organizations do not necessarily
854
+ appear at the end of the results, and may take a small amount of
855
+ time to appear.
856
+
857
+ Search will only return organizations on which the user has the
858
+ permission ``resourcemanager.organizations.get``
859
+
860
+ .. code-block:: python
861
+
862
+ # This snippet has been automatically generated and should be regarded as a
863
+ # code template only.
864
+ # It will require modifications to work:
865
+ # - It may require correct/in-range values for request initialization.
866
+ # - It may require specifying regional endpoints when creating the service
867
+ # client as shown in:
868
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
869
+ from google.cloud import resourcemanager_v3
870
+
871
+ def sample_search_organizations():
872
+ # Create a client
873
+ client = resourcemanager_v3.OrganizationsClient()
874
+
875
+ # Initialize request argument(s)
876
+ request = resourcemanager_v3.SearchOrganizationsRequest(
877
+ )
878
+
879
+ # Make the request
880
+ page_result = client.search_organizations(request=request)
881
+
882
+ # Handle the response
883
+ for response in page_result:
884
+ print(response)
885
+
886
+ Args:
887
+ request (Union[google.cloud.resourcemanager_v3.types.SearchOrganizationsRequest, dict]):
888
+ The request object. The request sent to the ``SearchOrganizations`` method.
889
+ query (str):
890
+ Optional. An optional query string used to filter the
891
+ Organizations to return in the response. Query rules are
892
+ case-insensitive.
893
+
894
+ ::
895
+
896
+ | Field | Description |
897
+ |------------------|--------------------------------------------|
898
+ | directoryCustomerId, owner.directoryCustomerId | Filters by directory
899
+ customer id. |
900
+ | domain | Filters by domain. |
901
+
902
+ Organizations may be queried by ``directoryCustomerId``
903
+ or by ``domain``, where the domain is a G Suite domain,
904
+ for example:
905
+
906
+ - Query ``directorycustomerid:123456789`` returns
907
+ Organization resources with
908
+ ``owner.directory_customer_id`` equal to
909
+ ``123456789``.
910
+ - Query ``domain:google.com`` returns Organization
911
+ resources corresponding to the domain ``google.com``.
912
+
913
+ This corresponds to the ``query`` field
914
+ on the ``request`` instance; if ``request`` is provided, this
915
+ should not be set.
916
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
917
+ should be retried.
918
+ timeout (float): The timeout for this request.
919
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
920
+ sent along with the request as metadata. Normally, each value must be of type `str`,
921
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
922
+ be of type `bytes`.
923
+
924
+ Returns:
925
+ google.cloud.resourcemanager_v3.services.organizations.pagers.SearchOrganizationsPager:
926
+ The response returned from the SearchOrganizations
927
+ method.
928
+
929
+ Iterating over this object will yield results and
930
+ resolve additional pages automatically.
931
+
932
+ """
933
+ # Create or coerce a protobuf request object.
934
+ # - Quick check: If we got a request object, we should *not* have
935
+ # gotten any keyword arguments that map to the request.
936
+ flattened_params = [query]
937
+ has_flattened_params = (
938
+ len([param for param in flattened_params if param is not None]) > 0
939
+ )
940
+ if request is not None and has_flattened_params:
941
+ raise ValueError(
942
+ "If the `request` argument is set, then none of "
943
+ "the individual field arguments should be set."
944
+ )
945
+
946
+ # - Use the request object if provided (there's no risk of modifying the input as
947
+ # there are no flattened fields), or create one.
948
+ if not isinstance(request, organizations.SearchOrganizationsRequest):
949
+ request = organizations.SearchOrganizationsRequest(request)
950
+ # If we have keyword arguments corresponding to fields on the
951
+ # request, apply these.
952
+ if query is not None:
953
+ request.query = query
954
+
955
+ # Wrap the RPC method; this adds retry and timeout information,
956
+ # and friendly error handling.
957
+ rpc = self._transport._wrapped_methods[self._transport.search_organizations]
958
+
959
+ # Validate the universe domain.
960
+ self._validate_universe_domain()
961
+
962
+ # Send the request.
963
+ response = rpc(
964
+ request,
965
+ retry=retry,
966
+ timeout=timeout,
967
+ metadata=metadata,
968
+ )
969
+
970
+ # This method is paged; wrap the response in a pager, which provides
971
+ # an `__iter__` convenience method.
972
+ response = pagers.SearchOrganizationsPager(
973
+ method=rpc,
974
+ request=request,
975
+ response=response,
976
+ retry=retry,
977
+ timeout=timeout,
978
+ metadata=metadata,
979
+ )
980
+
981
+ # Done; return the response.
982
+ return response
983
+
984
+ def get_iam_policy(
985
+ self,
986
+ request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
987
+ *,
988
+ resource: Optional[str] = None,
989
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
990
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
991
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
992
+ ) -> policy_pb2.Policy:
993
+ r"""Gets the access control policy for an organization resource. The
994
+ policy may be empty if no such policy or resource exists. The
995
+ ``resource`` field should be the organization's resource name,
996
+ for example: "organizations/123".
997
+
998
+ Authorization requires the IAM permission
999
+ ``resourcemanager.organizations.getIamPolicy`` on the specified
1000
+ organization.
1001
+
1002
+ .. code-block:: python
1003
+
1004
+ # This snippet has been automatically generated and should be regarded as a
1005
+ # code template only.
1006
+ # It will require modifications to work:
1007
+ # - It may require correct/in-range values for request initialization.
1008
+ # - It may require specifying regional endpoints when creating the service
1009
+ # client as shown in:
1010
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1011
+ from google.cloud import resourcemanager_v3
1012
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
1013
+
1014
+ def sample_get_iam_policy():
1015
+ # Create a client
1016
+ client = resourcemanager_v3.OrganizationsClient()
1017
+
1018
+ # Initialize request argument(s)
1019
+ request = iam_policy_pb2.GetIamPolicyRequest(
1020
+ resource="resource_value",
1021
+ )
1022
+
1023
+ # Make the request
1024
+ response = client.get_iam_policy(request=request)
1025
+
1026
+ # Handle the response
1027
+ print(response)
1028
+
1029
+ Args:
1030
+ request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]):
1031
+ The request object. Request message for ``GetIamPolicy`` method.
1032
+ resource (str):
1033
+ REQUIRED: The resource for which the
1034
+ policy is being requested. See the
1035
+ operation documentation for the
1036
+ appropriate value for this field.
1037
+
1038
+ This corresponds to the ``resource`` field
1039
+ on the ``request`` instance; if ``request`` is provided, this
1040
+ should not be set.
1041
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1042
+ should be retried.
1043
+ timeout (float): The timeout for this request.
1044
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1045
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1046
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1047
+ be of type `bytes`.
1048
+
1049
+ Returns:
1050
+ google.iam.v1.policy_pb2.Policy:
1051
+ An Identity and Access Management (IAM) policy, which specifies access
1052
+ controls for Google Cloud resources.
1053
+
1054
+ A Policy is a collection of bindings. A binding binds
1055
+ one or more members, or principals, to a single role.
1056
+ Principals can be user accounts, service accounts,
1057
+ Google groups, and domains (such as G Suite). A role
1058
+ is a named list of permissions; each role can be an
1059
+ IAM predefined role or a user-created custom role.
1060
+
1061
+ For some types of Google Cloud resources, a binding
1062
+ can also specify a condition, which is a logical
1063
+ expression that allows access to a resource only if
1064
+ the expression evaluates to true. A condition can add
1065
+ constraints based on attributes of the request, the
1066
+ resource, or both. To learn which resources support
1067
+ conditions in their IAM policies, see the [IAM
1068
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
1069
+
1070
+ **JSON example:**
1071
+
1072
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
1073
+
1074
+ **YAML example:**
1075
+
1076
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
1077
+
1078
+ For a description of IAM and its features, see the
1079
+ [IAM
1080
+ documentation](https://cloud.google.com/iam/docs/).
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
+ flattened_params = [resource]
1087
+ has_flattened_params = (
1088
+ len([param for param in flattened_params if param is not None]) > 0
1089
+ )
1090
+ if request is not None and has_flattened_params:
1091
+ raise ValueError(
1092
+ "If the `request` argument is set, then none of "
1093
+ "the individual field arguments should be set."
1094
+ )
1095
+
1096
+ if isinstance(request, dict):
1097
+ # - The request isn't a proto-plus wrapped type,
1098
+ # so it must be constructed via keyword expansion.
1099
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
1100
+ elif not request:
1101
+ # Null request, just make one.
1102
+ request = iam_policy_pb2.GetIamPolicyRequest()
1103
+ if resource is not None:
1104
+ request.resource = resource
1105
+
1106
+ # Wrap the RPC method; this adds retry and timeout information,
1107
+ # and friendly error handling.
1108
+ rpc = self._transport._wrapped_methods[self._transport.get_iam_policy]
1109
+
1110
+ # Certain fields should be provided within the metadata header;
1111
+ # add these here.
1112
+ metadata = tuple(metadata) + (
1113
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1114
+ )
1115
+
1116
+ # Validate the universe domain.
1117
+ self._validate_universe_domain()
1118
+
1119
+ # Send the request.
1120
+ response = rpc(
1121
+ request,
1122
+ retry=retry,
1123
+ timeout=timeout,
1124
+ metadata=metadata,
1125
+ )
1126
+
1127
+ # Done; return the response.
1128
+ return response
1129
+
1130
+ def set_iam_policy(
1131
+ self,
1132
+ request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
1133
+ *,
1134
+ resource: Optional[str] = None,
1135
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1136
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1137
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1138
+ ) -> policy_pb2.Policy:
1139
+ r"""Sets the access control policy on an organization resource.
1140
+ Replaces any existing policy. The ``resource`` field should be
1141
+ the organization's resource name, for example:
1142
+ "organizations/123".
1143
+
1144
+ Authorization requires the IAM permission
1145
+ ``resourcemanager.organizations.setIamPolicy`` on the specified
1146
+ organization.
1147
+
1148
+ .. code-block:: python
1149
+
1150
+ # This snippet has been automatically generated and should be regarded as a
1151
+ # code template only.
1152
+ # It will require modifications to work:
1153
+ # - It may require correct/in-range values for request initialization.
1154
+ # - It may require specifying regional endpoints when creating the service
1155
+ # client as shown in:
1156
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1157
+ from google.cloud import resourcemanager_v3
1158
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
1159
+
1160
+ def sample_set_iam_policy():
1161
+ # Create a client
1162
+ client = resourcemanager_v3.OrganizationsClient()
1163
+
1164
+ # Initialize request argument(s)
1165
+ request = iam_policy_pb2.SetIamPolicyRequest(
1166
+ resource="resource_value",
1167
+ )
1168
+
1169
+ # Make the request
1170
+ response = client.set_iam_policy(request=request)
1171
+
1172
+ # Handle the response
1173
+ print(response)
1174
+
1175
+ Args:
1176
+ request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]):
1177
+ The request object. Request message for ``SetIamPolicy`` method.
1178
+ resource (str):
1179
+ REQUIRED: The resource for which the
1180
+ policy is being specified. See the
1181
+ operation documentation for the
1182
+ appropriate value for this field.
1183
+
1184
+ This corresponds to the ``resource`` field
1185
+ on the ``request`` instance; if ``request`` is provided, this
1186
+ should not be set.
1187
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1188
+ should be retried.
1189
+ timeout (float): The timeout for this request.
1190
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1191
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1192
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1193
+ be of type `bytes`.
1194
+
1195
+ Returns:
1196
+ google.iam.v1.policy_pb2.Policy:
1197
+ An Identity and Access Management (IAM) policy, which specifies access
1198
+ controls for Google Cloud resources.
1199
+
1200
+ A Policy is a collection of bindings. A binding binds
1201
+ one or more members, or principals, to a single role.
1202
+ Principals can be user accounts, service accounts,
1203
+ Google groups, and domains (such as G Suite). A role
1204
+ is a named list of permissions; each role can be an
1205
+ IAM predefined role or a user-created custom role.
1206
+
1207
+ For some types of Google Cloud resources, a binding
1208
+ can also specify a condition, which is a logical
1209
+ expression that allows access to a resource only if
1210
+ the expression evaluates to true. A condition can add
1211
+ constraints based on attributes of the request, the
1212
+ resource, or both. To learn which resources support
1213
+ conditions in their IAM policies, see the [IAM
1214
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
1215
+
1216
+ **JSON example:**
1217
+
1218
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
1219
+
1220
+ **YAML example:**
1221
+
1222
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
1223
+
1224
+ For a description of IAM and its features, see the
1225
+ [IAM
1226
+ documentation](https://cloud.google.com/iam/docs/).
1227
+
1228
+ """
1229
+ # Create or coerce a protobuf request object.
1230
+ # - Quick check: If we got a request object, we should *not* have
1231
+ # gotten any keyword arguments that map to the request.
1232
+ flattened_params = [resource]
1233
+ has_flattened_params = (
1234
+ len([param for param in flattened_params if param is not None]) > 0
1235
+ )
1236
+ if request is not None and has_flattened_params:
1237
+ raise ValueError(
1238
+ "If the `request` argument is set, then none of "
1239
+ "the individual field arguments should be set."
1240
+ )
1241
+
1242
+ if isinstance(request, dict):
1243
+ # - The request isn't a proto-plus wrapped type,
1244
+ # so it must be constructed via keyword expansion.
1245
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
1246
+ elif not request:
1247
+ # Null request, just make one.
1248
+ request = iam_policy_pb2.SetIamPolicyRequest()
1249
+ if resource is not None:
1250
+ request.resource = resource
1251
+
1252
+ # Wrap the RPC method; this adds retry and timeout information,
1253
+ # and friendly error handling.
1254
+ rpc = self._transport._wrapped_methods[self._transport.set_iam_policy]
1255
+
1256
+ # Certain fields should be provided within the metadata header;
1257
+ # add these here.
1258
+ metadata = tuple(metadata) + (
1259
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1260
+ )
1261
+
1262
+ # Validate the universe domain.
1263
+ self._validate_universe_domain()
1264
+
1265
+ # Send the request.
1266
+ response = rpc(
1267
+ request,
1268
+ retry=retry,
1269
+ timeout=timeout,
1270
+ metadata=metadata,
1271
+ )
1272
+
1273
+ # Done; return the response.
1274
+ return response
1275
+
1276
+ def test_iam_permissions(
1277
+ self,
1278
+ request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
1279
+ *,
1280
+ resource: Optional[str] = None,
1281
+ permissions: Optional[MutableSequence[str]] = None,
1282
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1283
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1284
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1285
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1286
+ r"""Returns the permissions that a caller has on the specified
1287
+ organization. The ``resource`` field should be the
1288
+ organization's resource name, for example: "organizations/123".
1289
+
1290
+ There are no permissions required for making this API call.
1291
+
1292
+ .. code-block:: python
1293
+
1294
+ # This snippet has been automatically generated and should be regarded as a
1295
+ # code template only.
1296
+ # It will require modifications to work:
1297
+ # - It may require correct/in-range values for request initialization.
1298
+ # - It may require specifying regional endpoints when creating the service
1299
+ # client as shown in:
1300
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1301
+ from google.cloud import resourcemanager_v3
1302
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
1303
+
1304
+ def sample_test_iam_permissions():
1305
+ # Create a client
1306
+ client = resourcemanager_v3.OrganizationsClient()
1307
+
1308
+ # Initialize request argument(s)
1309
+ request = iam_policy_pb2.TestIamPermissionsRequest(
1310
+ resource="resource_value",
1311
+ permissions=['permissions_value1', 'permissions_value2'],
1312
+ )
1313
+
1314
+ # Make the request
1315
+ response = client.test_iam_permissions(request=request)
1316
+
1317
+ # Handle the response
1318
+ print(response)
1319
+
1320
+ Args:
1321
+ request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]):
1322
+ The request object. Request message for ``TestIamPermissions`` method.
1323
+ resource (str):
1324
+ REQUIRED: The resource for which the
1325
+ policy detail is being requested. See
1326
+ the operation documentation for the
1327
+ appropriate value for this field.
1328
+
1329
+ This corresponds to the ``resource`` field
1330
+ on the ``request`` instance; if ``request`` is provided, this
1331
+ should not be set.
1332
+ permissions (MutableSequence[str]):
1333
+ The set of permissions to check for the ``resource``.
1334
+ Permissions with wildcards (such as '*' or 'storage.*')
1335
+ are not allowed. For more information see `IAM
1336
+ Overview <https://cloud.google.com/iam/docs/overview#permissions>`__.
1337
+
1338
+ This corresponds to the ``permissions`` field
1339
+ on the ``request`` instance; if ``request`` is provided, this
1340
+ should not be set.
1341
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1342
+ should be retried.
1343
+ timeout (float): The timeout for this request.
1344
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1345
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1346
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1347
+ be of type `bytes`.
1348
+
1349
+ Returns:
1350
+ google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse:
1351
+ Response message for TestIamPermissions method.
1352
+ """
1353
+ # Create or coerce a protobuf request object.
1354
+ # - Quick check: If we got a request object, we should *not* have
1355
+ # gotten any keyword arguments that map to the request.
1356
+ flattened_params = [resource, permissions]
1357
+ has_flattened_params = (
1358
+ len([param for param in flattened_params if param is not None]) > 0
1359
+ )
1360
+ if request is not None and has_flattened_params:
1361
+ raise ValueError(
1362
+ "If the `request` argument is set, then none of "
1363
+ "the individual field arguments should be set."
1364
+ )
1365
+
1366
+ if isinstance(request, dict):
1367
+ # - The request isn't a proto-plus wrapped type,
1368
+ # so it must be constructed via keyword expansion.
1369
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
1370
+ elif not request:
1371
+ # Null request, just make one.
1372
+ request = iam_policy_pb2.TestIamPermissionsRequest()
1373
+ if resource is not None:
1374
+ request.resource = resource
1375
+ if permissions:
1376
+ request.permissions.extend(permissions)
1377
+
1378
+ # Wrap the RPC method; this adds retry and timeout information,
1379
+ # and friendly error handling.
1380
+ rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions]
1381
+
1382
+ # Certain fields should be provided within the metadata header;
1383
+ # add these here.
1384
+ metadata = tuple(metadata) + (
1385
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1386
+ )
1387
+
1388
+ # Validate the universe domain.
1389
+ self._validate_universe_domain()
1390
+
1391
+ # Send the request.
1392
+ response = rpc(
1393
+ request,
1394
+ retry=retry,
1395
+ timeout=timeout,
1396
+ metadata=metadata,
1397
+ )
1398
+
1399
+ # Done; return the response.
1400
+ return response
1401
+
1402
+ def __enter__(self) -> "OrganizationsClient":
1403
+ return self
1404
+
1405
+ def __exit__(self, type, value, traceback):
1406
+ """Releases underlying transport's resources.
1407
+
1408
+ .. warning::
1409
+ ONLY use as a context manager if the transport is NOT shared
1410
+ with other clients! Exiting the with block will CLOSE the transport
1411
+ and may cause errors in other clients!
1412
+ """
1413
+ self.transport.close()
1414
+
1415
+ def get_operation(
1416
+ self,
1417
+ request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None,
1418
+ *,
1419
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1420
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1421
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1422
+ ) -> operations_pb2.Operation:
1423
+ r"""Gets the latest state of a long-running operation.
1424
+
1425
+ Args:
1426
+ request (:class:`~.operations_pb2.GetOperationRequest`):
1427
+ The request object. Request message for
1428
+ `GetOperation` method.
1429
+ retry (google.api_core.retry.Retry): Designation of what errors,
1430
+ if any, should be retried.
1431
+ timeout (float): The timeout for this request.
1432
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1433
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1434
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1435
+ be of type `bytes`.
1436
+ Returns:
1437
+ ~.operations_pb2.Operation:
1438
+ An ``Operation`` object.
1439
+ """
1440
+ # Create or coerce a protobuf request object.
1441
+ # The request isn't a proto-plus wrapped type,
1442
+ # so it must be constructed via keyword expansion.
1443
+ if request is None:
1444
+ request_pb = operations_pb2.GetOperationRequest()
1445
+ elif isinstance(request, dict):
1446
+ request_pb = operations_pb2.GetOperationRequest(**request)
1447
+ else:
1448
+ request_pb = request
1449
+
1450
+ # Wrap the RPC method; this adds retry and timeout information,
1451
+ # and friendly error handling.
1452
+ rpc = self._transport._wrapped_methods[self._transport.get_operation]
1453
+
1454
+ # Certain fields should be provided within the metadata header;
1455
+ # add these here.
1456
+ metadata = tuple(metadata) + (
1457
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
1458
+ )
1459
+
1460
+ # Validate the universe domain.
1461
+ self._validate_universe_domain()
1462
+
1463
+ try:
1464
+ # Send the request.
1465
+ response = rpc(
1466
+ request_pb,
1467
+ retry=retry,
1468
+ timeout=timeout,
1469
+ metadata=metadata,
1470
+ )
1471
+
1472
+ # Done; return the response.
1473
+ return response
1474
+ except core_exceptions.GoogleAPICallError as e:
1475
+ self._add_cred_info_for_auth_errors(e)
1476
+ raise e
1477
+
1478
+
1479
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1480
+ gapic_version=package_version.__version__
1481
+ )
1482
+
1483
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1484
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1485
+
1486
+ __all__ = ("OrganizationsClient",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/organizations/pagers.py ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from typing import (
17
+ Any,
18
+ AsyncIterator,
19
+ Awaitable,
20
+ Callable,
21
+ Iterator,
22
+ Optional,
23
+ Sequence,
24
+ Tuple,
25
+ Union,
26
+ )
27
+
28
+ from google.api_core import gapic_v1
29
+ from google.api_core import retry as retries
30
+ from google.api_core import retry_async as retries_async
31
+
32
+ try:
33
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
34
+ OptionalAsyncRetry = Union[
35
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
36
+ ]
37
+ except AttributeError: # pragma: NO COVER
38
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
39
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
40
+
41
+ from google.cloud.resourcemanager_v3.types import organizations
42
+
43
+
44
+ class SearchOrganizationsPager:
45
+ """A pager for iterating through ``search_organizations`` requests.
46
+
47
+ This class thinly wraps an initial
48
+ :class:`google.cloud.resourcemanager_v3.types.SearchOrganizationsResponse` object, and
49
+ provides an ``__iter__`` method to iterate through its
50
+ ``organizations`` field.
51
+
52
+ If there are more pages, the ``__iter__`` method will make additional
53
+ ``SearchOrganizations`` requests and continue to iterate
54
+ through the ``organizations`` field on the
55
+ corresponding responses.
56
+
57
+ All the usual :class:`google.cloud.resourcemanager_v3.types.SearchOrganizationsResponse`
58
+ attributes are available on the pager. If multiple requests are made, only
59
+ the most recent response is retained, and thus used for attribute lookup.
60
+ """
61
+
62
+ def __init__(
63
+ self,
64
+ method: Callable[..., organizations.SearchOrganizationsResponse],
65
+ request: organizations.SearchOrganizationsRequest,
66
+ response: organizations.SearchOrganizationsResponse,
67
+ *,
68
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
69
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
70
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
71
+ ):
72
+ """Instantiate the pager.
73
+
74
+ Args:
75
+ method (Callable): The method that was originally called, and
76
+ which instantiated this pager.
77
+ request (google.cloud.resourcemanager_v3.types.SearchOrganizationsRequest):
78
+ The initial request object.
79
+ response (google.cloud.resourcemanager_v3.types.SearchOrganizationsResponse):
80
+ The initial response object.
81
+ retry (google.api_core.retry.Retry): Designation of what errors,
82
+ if any, should be retried.
83
+ timeout (float): The timeout for this request.
84
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
85
+ sent along with the request as metadata. Normally, each value must be of type `str`,
86
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
87
+ be of type `bytes`.
88
+ """
89
+ self._method = method
90
+ self._request = organizations.SearchOrganizationsRequest(request)
91
+ self._response = response
92
+ self._retry = retry
93
+ self._timeout = timeout
94
+ self._metadata = metadata
95
+
96
+ def __getattr__(self, name: str) -> Any:
97
+ return getattr(self._response, name)
98
+
99
+ @property
100
+ def pages(self) -> Iterator[organizations.SearchOrganizationsResponse]:
101
+ yield self._response
102
+ while self._response.next_page_token:
103
+ self._request.page_token = self._response.next_page_token
104
+ self._response = self._method(
105
+ self._request,
106
+ retry=self._retry,
107
+ timeout=self._timeout,
108
+ metadata=self._metadata,
109
+ )
110
+ yield self._response
111
+
112
+ def __iter__(self) -> Iterator[organizations.Organization]:
113
+ for page in self.pages:
114
+ yield from page.organizations
115
+
116
+ def __repr__(self) -> str:
117
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
118
+
119
+
120
+ class SearchOrganizationsAsyncPager:
121
+ """A pager for iterating through ``search_organizations`` requests.
122
+
123
+ This class thinly wraps an initial
124
+ :class:`google.cloud.resourcemanager_v3.types.SearchOrganizationsResponse` object, and
125
+ provides an ``__aiter__`` method to iterate through its
126
+ ``organizations`` field.
127
+
128
+ If there are more pages, the ``__aiter__`` method will make additional
129
+ ``SearchOrganizations`` requests and continue to iterate
130
+ through the ``organizations`` field on the
131
+ corresponding responses.
132
+
133
+ All the usual :class:`google.cloud.resourcemanager_v3.types.SearchOrganizationsResponse`
134
+ attributes are available on the pager. If multiple requests are made, only
135
+ the most recent response is retained, and thus used for attribute lookup.
136
+ """
137
+
138
+ def __init__(
139
+ self,
140
+ method: Callable[..., Awaitable[organizations.SearchOrganizationsResponse]],
141
+ request: organizations.SearchOrganizationsRequest,
142
+ response: organizations.SearchOrganizationsResponse,
143
+ *,
144
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
145
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
146
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
147
+ ):
148
+ """Instantiates the pager.
149
+
150
+ Args:
151
+ method (Callable): The method that was originally called, and
152
+ which instantiated this pager.
153
+ request (google.cloud.resourcemanager_v3.types.SearchOrganizationsRequest):
154
+ The initial request object.
155
+ response (google.cloud.resourcemanager_v3.types.SearchOrganizationsResponse):
156
+ The initial response object.
157
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
158
+ if any, should be retried.
159
+ timeout (float): The timeout for this request.
160
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
161
+ sent along with the request as metadata. Normally, each value must be of type `str`,
162
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
163
+ be of type `bytes`.
164
+ """
165
+ self._method = method
166
+ self._request = organizations.SearchOrganizationsRequest(request)
167
+ self._response = response
168
+ self._retry = retry
169
+ self._timeout = timeout
170
+ self._metadata = metadata
171
+
172
+ def __getattr__(self, name: str) -> Any:
173
+ return getattr(self._response, name)
174
+
175
+ @property
176
+ async def pages(self) -> AsyncIterator[organizations.SearchOrganizationsResponse]:
177
+ yield self._response
178
+ while self._response.next_page_token:
179
+ self._request.page_token = self._response.next_page_token
180
+ self._response = await self._method(
181
+ self._request,
182
+ retry=self._retry,
183
+ timeout=self._timeout,
184
+ metadata=self._metadata,
185
+ )
186
+ yield self._response
187
+
188
+ def __aiter__(self) -> AsyncIterator[organizations.Organization]:
189
+ async def async_generator():
190
+ async for page in self.pages:
191
+ for response in page.organizations:
192
+ yield response
193
+
194
+ return async_generator()
195
+
196
+ def __repr__(self) -> str:
197
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/__init__.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from .async_client import ProjectsAsyncClient
17
+ from .client import ProjectsClient
18
+
19
+ __all__ = (
20
+ "ProjectsClient",
21
+ "ProjectsAsyncClient",
22
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (400 Bytes). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/__pycache__/async_client.cpython-311.pyc ADDED
Binary file (83.8 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/async_client.py ADDED
@@ -0,0 +1,1985 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import logging as std_logging
17
+ import re
18
+ from collections import OrderedDict
19
+ from typing import (
20
+ Callable,
21
+ Dict,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ import google.protobuf
33
+ from google.api_core import exceptions as core_exceptions
34
+ from google.api_core import gapic_v1
35
+ from google.api_core import retry_async as retries
36
+ from google.api_core.client_options import ClientOptions
37
+ from google.auth import credentials as ga_credentials # type: ignore
38
+ from google.oauth2 import service_account # type: ignore
39
+
40
+ from google.cloud.resourcemanager_v3 import gapic_version as package_version
41
+
42
+ try:
43
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
44
+ except AttributeError: # pragma: NO COVER
45
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
46
+
47
+ import google.api_core.operation as operation # type: ignore
48
+ import google.api_core.operation_async as operation_async # type: ignore
49
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
50
+ import google.iam.v1.policy_pb2 as policy_pb2 # type: ignore
51
+ import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
52
+ import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
53
+ from google.longrunning import operations_pb2 # type: ignore
54
+
55
+ from google.cloud.resourcemanager_v3.services.projects import pagers
56
+ from google.cloud.resourcemanager_v3.types import projects
57
+
58
+ from .client import ProjectsClient
59
+ from .transports.base import DEFAULT_CLIENT_INFO, ProjectsTransport
60
+ from .transports.grpc_asyncio import ProjectsGrpcAsyncIOTransport
61
+
62
+ try:
63
+ from google.api_core import client_logging # type: ignore
64
+
65
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
66
+ except ImportError: # pragma: NO COVER
67
+ CLIENT_LOGGING_SUPPORTED = False
68
+
69
+ _LOGGER = std_logging.getLogger(__name__)
70
+
71
+
72
+ class ProjectsAsyncClient:
73
+ """Manages Google Cloud Projects."""
74
+
75
+ _client: ProjectsClient
76
+
77
+ # Copy defaults from the synchronous client for use here.
78
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
79
+ DEFAULT_ENDPOINT = ProjectsClient.DEFAULT_ENDPOINT
80
+ DEFAULT_MTLS_ENDPOINT = ProjectsClient.DEFAULT_MTLS_ENDPOINT
81
+ _DEFAULT_ENDPOINT_TEMPLATE = ProjectsClient._DEFAULT_ENDPOINT_TEMPLATE
82
+ _DEFAULT_UNIVERSE = ProjectsClient._DEFAULT_UNIVERSE
83
+
84
+ project_path = staticmethod(ProjectsClient.project_path)
85
+ parse_project_path = staticmethod(ProjectsClient.parse_project_path)
86
+ common_billing_account_path = staticmethod(
87
+ ProjectsClient.common_billing_account_path
88
+ )
89
+ parse_common_billing_account_path = staticmethod(
90
+ ProjectsClient.parse_common_billing_account_path
91
+ )
92
+ common_folder_path = staticmethod(ProjectsClient.common_folder_path)
93
+ parse_common_folder_path = staticmethod(ProjectsClient.parse_common_folder_path)
94
+ common_organization_path = staticmethod(ProjectsClient.common_organization_path)
95
+ parse_common_organization_path = staticmethod(
96
+ ProjectsClient.parse_common_organization_path
97
+ )
98
+ common_project_path = staticmethod(ProjectsClient.common_project_path)
99
+ parse_common_project_path = staticmethod(ProjectsClient.parse_common_project_path)
100
+ common_location_path = staticmethod(ProjectsClient.common_location_path)
101
+ parse_common_location_path = staticmethod(ProjectsClient.parse_common_location_path)
102
+
103
+ @classmethod
104
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
105
+ """Creates an instance of this client using the provided credentials
106
+ info.
107
+
108
+ Args:
109
+ info (dict): The service account private key info.
110
+ args: Additional arguments to pass to the constructor.
111
+ kwargs: Additional arguments to pass to the constructor.
112
+
113
+ Returns:
114
+ ProjectsAsyncClient: The constructed client.
115
+ """
116
+ sa_info_func = (
117
+ ProjectsClient.from_service_account_info.__func__ # type: ignore
118
+ )
119
+ return sa_info_func(ProjectsAsyncClient, info, *args, **kwargs)
120
+
121
+ @classmethod
122
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
123
+ """Creates an instance of this client using the provided credentials
124
+ file.
125
+
126
+ Args:
127
+ filename (str): The path to the service account private key json
128
+ file.
129
+ args: Additional arguments to pass to the constructor.
130
+ kwargs: Additional arguments to pass to the constructor.
131
+
132
+ Returns:
133
+ ProjectsAsyncClient: The constructed client.
134
+ """
135
+ sa_file_func = (
136
+ ProjectsClient.from_service_account_file.__func__ # type: ignore
137
+ )
138
+ return sa_file_func(ProjectsAsyncClient, filename, *args, **kwargs)
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 ProjectsClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
177
+
178
+ @property
179
+ def transport(self) -> ProjectsTransport:
180
+ """Returns the transport used by the client instance.
181
+
182
+ Returns:
183
+ ProjectsTransport: The transport used by the client instance.
184
+ """
185
+ return self._client.transport
186
+
187
+ @property
188
+ def api_endpoint(self) -> str:
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 = ProjectsClient.get_transport_class
207
+
208
+ def __init__(
209
+ self,
210
+ *,
211
+ credentials: Optional[ga_credentials.Credentials] = None,
212
+ transport: Optional[
213
+ Union[str, ProjectsTransport, Callable[..., ProjectsTransport]]
214
+ ] = "grpc_asyncio",
215
+ client_options: Optional[ClientOptions] = None,
216
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
217
+ ) -> None:
218
+ """Instantiates the projects async client.
219
+
220
+ Args:
221
+ credentials (Optional[google.auth.credentials.Credentials]): The
222
+ authorization credentials to attach to requests. These
223
+ credentials identify the application to the service; if none
224
+ are specified, the client will attempt to ascertain the
225
+ credentials from the environment.
226
+ transport (Optional[Union[str,ProjectsTransport,Callable[..., ProjectsTransport]]]):
227
+ The transport to use, or a Callable that constructs and returns a new transport to use.
228
+ If a Callable is given, it will be called with the same set of initialization
229
+ arguments as used in the ProjectsTransport constructor.
230
+ If set to None, a transport is chosen automatically.
231
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
232
+ Custom options for the client.
233
+
234
+ 1. The ``api_endpoint`` property can be used to override the
235
+ default endpoint provided by the client when ``transport`` is
236
+ not explicitly provided. Only if this property is not set and
237
+ ``transport`` was not explicitly provided, the endpoint is
238
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
239
+ variable, which have one of the following values:
240
+ "always" (always use the default mTLS endpoint), "never" (always
241
+ use the default regular endpoint) and "auto" (auto-switch to the
242
+ default mTLS endpoint if client certificate is present; this is
243
+ the default value).
244
+
245
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
246
+ is "true", then the ``client_cert_source`` property can be used
247
+ to provide a client certificate for mTLS transport. If
248
+ not provided, the default SSL client certificate will be used if
249
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
250
+ set, no client certificate will be used.
251
+
252
+ 3. The ``universe_domain`` property can be used to override the
253
+ default "googleapis.com" universe. Note that ``api_endpoint``
254
+ property still takes precedence; and ``universe_domain`` is
255
+ currently not supported for mTLS.
256
+
257
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
258
+ The client info used to send a user-agent string along with
259
+ API requests. If ``None``, then default info will be used.
260
+ Generally, you only need to set this if you're developing
261
+ your own client library.
262
+
263
+ Raises:
264
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
265
+ creation failed for any reason.
266
+ """
267
+ self._client = ProjectsClient(
268
+ credentials=credentials,
269
+ transport=transport,
270
+ client_options=client_options,
271
+ client_info=client_info,
272
+ )
273
+
274
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
275
+ std_logging.DEBUG
276
+ ): # pragma: NO COVER
277
+ _LOGGER.debug(
278
+ "Created client `google.cloud.resourcemanager_v3.ProjectsAsyncClient`.",
279
+ extra={
280
+ "serviceName": "google.cloud.resourcemanager.v3.Projects",
281
+ "universeDomain": getattr(
282
+ self._client._transport._credentials, "universe_domain", ""
283
+ ),
284
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
285
+ "credentialsInfo": getattr(
286
+ self.transport._credentials, "get_cred_info", lambda: None
287
+ )(),
288
+ }
289
+ if hasattr(self._client._transport, "_credentials")
290
+ else {
291
+ "serviceName": "google.cloud.resourcemanager.v3.Projects",
292
+ "credentialsType": None,
293
+ },
294
+ )
295
+
296
+ async def get_project(
297
+ self,
298
+ request: Optional[Union[projects.GetProjectRequest, dict]] = None,
299
+ *,
300
+ name: Optional[str] = None,
301
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
302
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
303
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
304
+ ) -> projects.Project:
305
+ r"""Retrieves the project identified by the specified ``name`` (for
306
+ example, ``projects/415104041262``).
307
+
308
+ The caller must have ``resourcemanager.projects.get`` permission
309
+ for this project.
310
+
311
+ .. code-block:: python
312
+
313
+ # This snippet has been automatically generated and should be regarded as a
314
+ # code template only.
315
+ # It will require modifications to work:
316
+ # - It may require correct/in-range values for request initialization.
317
+ # - It may require specifying regional endpoints when creating the service
318
+ # client as shown in:
319
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
320
+ from google.cloud import resourcemanager_v3
321
+
322
+ async def sample_get_project():
323
+ # Create a client
324
+ client = resourcemanager_v3.ProjectsAsyncClient()
325
+
326
+ # Initialize request argument(s)
327
+ request = resourcemanager_v3.GetProjectRequest(
328
+ name="name_value",
329
+ )
330
+
331
+ # Make the request
332
+ response = await client.get_project(request=request)
333
+
334
+ # Handle the response
335
+ print(response)
336
+
337
+ Args:
338
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.GetProjectRequest, dict]]):
339
+ The request object. The request sent to the
340
+ [GetProject][google.cloud.resourcemanager.v3.Projects.GetProject]
341
+ method.
342
+ name (:class:`str`):
343
+ Required. The name of the project (for example,
344
+ ``projects/415104041262``).
345
+
346
+ This corresponds to the ``name`` field
347
+ on the ``request`` instance; if ``request`` is provided, this
348
+ should not be set.
349
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
350
+ should be retried.
351
+ timeout (float): The timeout for this request.
352
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
353
+ sent along with the request as metadata. Normally, each value must be of type `str`,
354
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
355
+ be of type `bytes`.
356
+
357
+ Returns:
358
+ google.cloud.resourcemanager_v3.types.Project:
359
+ A project is a high-level Google
360
+ Cloud entity. It is a container for
361
+ ACLs, APIs, App Engine Apps, VMs, and
362
+ other Google Cloud Platform resources.
363
+
364
+ """
365
+ # Create or coerce a protobuf request object.
366
+ # - Quick check: If we got a request object, we should *not* have
367
+ # gotten any keyword arguments that map to the request.
368
+ flattened_params = [name]
369
+ has_flattened_params = (
370
+ len([param for param in flattened_params if param is not None]) > 0
371
+ )
372
+ if request is not None and has_flattened_params:
373
+ raise ValueError(
374
+ "If the `request` argument is set, then none of "
375
+ "the individual field arguments should be set."
376
+ )
377
+
378
+ # - Use the request object if provided (there's no risk of modifying the input as
379
+ # there are no flattened fields), or create one.
380
+ if not isinstance(request, projects.GetProjectRequest):
381
+ request = projects.GetProjectRequest(request)
382
+
383
+ # If we have keyword arguments corresponding to fields on the
384
+ # request, apply these.
385
+ if name is not None:
386
+ request.name = name
387
+
388
+ # Wrap the RPC method; this adds retry and timeout information,
389
+ # and friendly error handling.
390
+ rpc = self._client._transport._wrapped_methods[
391
+ self._client._transport.get_project
392
+ ]
393
+
394
+ # Certain fields should be provided within the metadata header;
395
+ # add these here.
396
+ metadata = tuple(metadata) + (
397
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
398
+ )
399
+
400
+ # Validate the universe domain.
401
+ self._client._validate_universe_domain()
402
+
403
+ # Send the request.
404
+ response = await rpc(
405
+ request,
406
+ retry=retry,
407
+ timeout=timeout,
408
+ metadata=metadata,
409
+ )
410
+
411
+ # Done; return the response.
412
+ return response
413
+
414
+ async def list_projects(
415
+ self,
416
+ request: Optional[Union[projects.ListProjectsRequest, dict]] = None,
417
+ *,
418
+ parent: Optional[str] = None,
419
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
420
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
421
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
422
+ ) -> pagers.ListProjectsAsyncPager:
423
+ r"""Lists projects that are direct children of the specified folder
424
+ or organization resource. ``list()`` provides a strongly
425
+ consistent view of the projects underneath the specified parent
426
+ resource. ``list()`` returns projects sorted based upon the
427
+ (ascending) lexical ordering of their ``display_name``. The
428
+ caller must have ``resourcemanager.projects.list`` permission on
429
+ the identified parent.
430
+
431
+ .. code-block:: python
432
+
433
+ # This snippet has been automatically generated and should be regarded as a
434
+ # code template only.
435
+ # It will require modifications to work:
436
+ # - It may require correct/in-range values for request initialization.
437
+ # - It may require specifying regional endpoints when creating the service
438
+ # client as shown in:
439
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
440
+ from google.cloud import resourcemanager_v3
441
+
442
+ async def sample_list_projects():
443
+ # Create a client
444
+ client = resourcemanager_v3.ProjectsAsyncClient()
445
+
446
+ # Initialize request argument(s)
447
+ request = resourcemanager_v3.ListProjectsRequest(
448
+ parent="parent_value",
449
+ )
450
+
451
+ # Make the request
452
+ page_result = client.list_projects(request=request)
453
+
454
+ # Handle the response
455
+ async for response in page_result:
456
+ print(response)
457
+
458
+ Args:
459
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.ListProjectsRequest, dict]]):
460
+ The request object. The request sent to the
461
+ [ListProjects][google.cloud.resourcemanager.v3.Projects.ListProjects]
462
+ method.
463
+ parent (:class:`str`):
464
+ Required. The name of the parent resource whose projects
465
+ are being listed. Only children of this parent resource
466
+ are listed; descendants are not listed.
467
+
468
+ If the parent is a folder, use the value
469
+ ``folders/{folder_id}``. If the parent is an
470
+ organization, use the value ``organizations/{org_id}``.
471
+
472
+ This corresponds to the ``parent`` field
473
+ on the ``request`` instance; if ``request`` is provided, this
474
+ should not be set.
475
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
476
+ should be retried.
477
+ timeout (float): The timeout for this request.
478
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
479
+ sent along with the request as metadata. Normally, each value must be of type `str`,
480
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
481
+ be of type `bytes`.
482
+
483
+ Returns:
484
+ google.cloud.resourcemanager_v3.services.projects.pagers.ListProjectsAsyncPager:
485
+ A page of the response received from the
486
+ [ListProjects][google.cloud.resourcemanager.v3.Projects.ListProjects]
487
+ method.
488
+
489
+ A paginated response where more pages are available
490
+ has next_page_token set. This token can be used in a
491
+ subsequent request to retrieve the next request page.
492
+
493
+ NOTE: A response may contain fewer elements than the
494
+ request page_size and still have a next_page_token.
495
+
496
+ Iterating over this object will yield results and
497
+ resolve additional pages automatically.
498
+
499
+ """
500
+ # Create or coerce a protobuf request object.
501
+ # - Quick check: If we got a request object, we should *not* have
502
+ # gotten any keyword arguments that map to the request.
503
+ flattened_params = [parent]
504
+ has_flattened_params = (
505
+ len([param for param in flattened_params if param is not None]) > 0
506
+ )
507
+ if request is not None and has_flattened_params:
508
+ raise ValueError(
509
+ "If the `request` argument is set, then none of "
510
+ "the individual field arguments should be set."
511
+ )
512
+
513
+ # - Use the request object if provided (there's no risk of modifying the input as
514
+ # there are no flattened fields), or create one.
515
+ if not isinstance(request, projects.ListProjectsRequest):
516
+ request = projects.ListProjectsRequest(request)
517
+
518
+ # If we have keyword arguments corresponding to fields on the
519
+ # request, apply these.
520
+ if parent is not None:
521
+ request.parent = parent
522
+
523
+ # Wrap the RPC method; this adds retry and timeout information,
524
+ # and friendly error handling.
525
+ rpc = self._client._transport._wrapped_methods[
526
+ self._client._transport.list_projects
527
+ ]
528
+
529
+ # Validate the universe domain.
530
+ self._client._validate_universe_domain()
531
+
532
+ # Send the request.
533
+ response = await rpc(
534
+ request,
535
+ retry=retry,
536
+ timeout=timeout,
537
+ metadata=metadata,
538
+ )
539
+
540
+ # This method is paged; wrap the response in a pager, which provides
541
+ # an `__aiter__` convenience method.
542
+ response = pagers.ListProjectsAsyncPager(
543
+ method=rpc,
544
+ request=request,
545
+ response=response,
546
+ retry=retry,
547
+ timeout=timeout,
548
+ metadata=metadata,
549
+ )
550
+
551
+ # Done; return the response.
552
+ return response
553
+
554
+ async def search_projects(
555
+ self,
556
+ request: Optional[Union[projects.SearchProjectsRequest, dict]] = None,
557
+ *,
558
+ query: Optional[str] = None,
559
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
560
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
561
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
562
+ ) -> pagers.SearchProjectsAsyncPager:
563
+ r"""Search for projects that the caller has both
564
+ ``resourcemanager.projects.get`` permission on, and also satisfy
565
+ the specified query.
566
+
567
+ This method returns projects in an unspecified order.
568
+
569
+ This method is eventually consistent with project mutations;
570
+ this means that a newly created project may not appear in the
571
+ results or recent updates to an existing project may not be
572
+ reflected in the results. To retrieve the latest state of a
573
+ project, use the
574
+ [GetProject][google.cloud.resourcemanager.v3.Projects.GetProject]
575
+ method.
576
+
577
+ .. code-block:: python
578
+
579
+ # This snippet has been automatically generated and should be regarded as a
580
+ # code template only.
581
+ # It will require modifications to work:
582
+ # - It may require correct/in-range values for request initialization.
583
+ # - It may require specifying regional endpoints when creating the service
584
+ # client as shown in:
585
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
586
+ from google.cloud import resourcemanager_v3
587
+
588
+ async def sample_search_projects():
589
+ # Create a client
590
+ client = resourcemanager_v3.ProjectsAsyncClient()
591
+
592
+ # Initialize request argument(s)
593
+ request = resourcemanager_v3.SearchProjectsRequest(
594
+ )
595
+
596
+ # Make the request
597
+ page_result = client.search_projects(request=request)
598
+
599
+ # Handle the response
600
+ async for response in page_result:
601
+ print(response)
602
+
603
+ Args:
604
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.SearchProjectsRequest, dict]]):
605
+ The request object. The request sent to the
606
+ [SearchProjects][google.cloud.resourcemanager.v3.Projects.SearchProjects]
607
+ method.
608
+ query (:class:`str`):
609
+ Optional. A query string for searching for projects that
610
+ the caller has ``resourcemanager.projects.get``
611
+ permission to. If multiple fields are included in the
612
+ query, then it will return results that match any of the
613
+ fields. Some eligible fields are:
614
+
615
+ - **``displayName``, ``name``**: Filters by displayName.
616
+ - **``parent``**: Project's parent (for example:
617
+ ``folders/123``, ``organizations/*``). Prefer
618
+ ``parent`` field over ``parent.type`` and
619
+ ``parent.id``.
620
+ - **``parent.type``**: Parent's type: ``folder`` or
621
+ ``organization``.
622
+ - **``parent.id``**: Parent's id number (for example:
623
+ ``123``).
624
+ - **``id``, ``projectId``**: Filters by projectId.
625
+ - **``state``, ``lifecycleState``**: Filters by state.
626
+ - **``labels``**: Filters by label name or value.
627
+ - **``labels.<key>`` (where ``<key>`` is the name of a
628
+ label)**: Filters by label name.
629
+
630
+ Search expressions are case insensitive.
631
+
632
+ Some examples queries:
633
+
634
+ - **``name:how*``**: The project's name starts with
635
+ "how".
636
+ - **``name:Howl``**: The project's name is ``Howl`` or
637
+ ``howl``.
638
+ - **``name:HOWL``**: Equivalent to above.
639
+ - **``NAME:howl``**: Equivalent to above.
640
+ - **``labels.color:*``**: The project has the label
641
+ ``color``.
642
+ - **``labels.color:red``**: The project's label
643
+ ``color`` has the value ``red``.
644
+ - **``labels.color:red labels.size:big``**: The
645
+ project's label ``color`` has the value ``red`` or its
646
+ label ``size`` has the value ``big``.
647
+
648
+ If no query is specified, the call will return projects
649
+ for which the user has the
650
+ ``resourcemanager.projects.get`` permission.
651
+
652
+ This corresponds to the ``query`` field
653
+ on the ``request`` instance; if ``request`` is provided, this
654
+ should not be set.
655
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
656
+ should be retried.
657
+ timeout (float): The timeout for this request.
658
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
659
+ sent along with the request as metadata. Normally, each value must be of type `str`,
660
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
661
+ be of type `bytes`.
662
+
663
+ Returns:
664
+ google.cloud.resourcemanager_v3.services.projects.pagers.SearchProjectsAsyncPager:
665
+ A page of the response received from the
666
+ [SearchProjects][google.cloud.resourcemanager.v3.Projects.SearchProjects]
667
+ method.
668
+
669
+ A paginated response where more pages are available
670
+ has next_page_token set. This token can be used in a
671
+ subsequent request to retrieve the next request page.
672
+
673
+ Iterating over this object will yield results and
674
+ resolve additional pages automatically.
675
+
676
+ """
677
+ # Create or coerce a protobuf request object.
678
+ # - Quick check: If we got a request object, we should *not* have
679
+ # gotten any keyword arguments that map to the request.
680
+ flattened_params = [query]
681
+ has_flattened_params = (
682
+ len([param for param in flattened_params if param is not None]) > 0
683
+ )
684
+ if request is not None and has_flattened_params:
685
+ raise ValueError(
686
+ "If the `request` argument is set, then none of "
687
+ "the individual field arguments should be set."
688
+ )
689
+
690
+ # - Use the request object if provided (there's no risk of modifying the input as
691
+ # there are no flattened fields), or create one.
692
+ if not isinstance(request, projects.SearchProjectsRequest):
693
+ request = projects.SearchProjectsRequest(request)
694
+
695
+ # If we have keyword arguments corresponding to fields on the
696
+ # request, apply these.
697
+ if query is not None:
698
+ request.query = query
699
+
700
+ # Wrap the RPC method; this adds retry and timeout information,
701
+ # and friendly error handling.
702
+ rpc = self._client._transport._wrapped_methods[
703
+ self._client._transport.search_projects
704
+ ]
705
+
706
+ # Validate the universe domain.
707
+ self._client._validate_universe_domain()
708
+
709
+ # Send the request.
710
+ response = await rpc(
711
+ request,
712
+ retry=retry,
713
+ timeout=timeout,
714
+ metadata=metadata,
715
+ )
716
+
717
+ # This method is paged; wrap the response in a pager, which provides
718
+ # an `__aiter__` convenience method.
719
+ response = pagers.SearchProjectsAsyncPager(
720
+ method=rpc,
721
+ request=request,
722
+ response=response,
723
+ retry=retry,
724
+ timeout=timeout,
725
+ metadata=metadata,
726
+ )
727
+
728
+ # Done; return the response.
729
+ return response
730
+
731
+ async def create_project(
732
+ self,
733
+ request: Optional[Union[projects.CreateProjectRequest, dict]] = None,
734
+ *,
735
+ project: Optional[projects.Project] = None,
736
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
737
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
738
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
739
+ ) -> operation_async.AsyncOperation:
740
+ r"""Request that a new project be created. The result is an
741
+ ``Operation`` which can be used to track the creation process.
742
+ This process usually takes a few seconds, but can sometimes take
743
+ much longer. The tracking ``Operation`` is automatically deleted
744
+ after a few hours, so there is no need to call
745
+ ``DeleteOperation``.
746
+
747
+ .. code-block:: python
748
+
749
+ # This snippet has been automatically generated and should be regarded as a
750
+ # code template only.
751
+ # It will require modifications to work:
752
+ # - It may require correct/in-range values for request initialization.
753
+ # - It may require specifying regional endpoints when creating the service
754
+ # client as shown in:
755
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
756
+ from google.cloud import resourcemanager_v3
757
+
758
+ async def sample_create_project():
759
+ # Create a client
760
+ client = resourcemanager_v3.ProjectsAsyncClient()
761
+
762
+ # Initialize request argument(s)
763
+ request = resourcemanager_v3.CreateProjectRequest(
764
+ )
765
+
766
+ # Make the request
767
+ operation = client.create_project(request=request)
768
+
769
+ print("Waiting for operation to complete...")
770
+
771
+ response = (await operation).result()
772
+
773
+ # Handle the response
774
+ print(response)
775
+
776
+ Args:
777
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.CreateProjectRequest, dict]]):
778
+ The request object. The request sent to the
779
+ [CreateProject][google.cloud.resourcemanager.v3.Projects.CreateProject]
780
+ method.
781
+ project (:class:`google.cloud.resourcemanager_v3.types.Project`):
782
+ Required. The Project to create.
783
+
784
+ Project ID is required. If the requested ID is
785
+ unavailable, the request fails.
786
+
787
+ If the ``parent`` field is set, the
788
+ ``resourcemanager.projects.create`` permission is
789
+ checked on the parent resource. If no parent is set and
790
+ the authorization credentials belong to an Organization,
791
+ the parent will be set to that Organization.
792
+
793
+ This corresponds to the ``project`` field
794
+ on the ``request`` instance; if ``request`` is provided, this
795
+ should not be set.
796
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
797
+ should be retried.
798
+ timeout (float): The timeout for this request.
799
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
800
+ sent along with the request as metadata. Normally, each value must be of type `str`,
801
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
802
+ be of type `bytes`.
803
+
804
+ Returns:
805
+ google.api_core.operation_async.AsyncOperation:
806
+ An object representing a long-running operation.
807
+
808
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.Project` A project is a high-level Google Cloud entity. It is a
809
+ container for ACLs, APIs, App Engine Apps, VMs, and
810
+ other Google Cloud Platform resources.
811
+
812
+ """
813
+ # Create or coerce a protobuf request object.
814
+ # - Quick check: If we got a request object, we should *not* have
815
+ # gotten any keyword arguments that map to the request.
816
+ flattened_params = [project]
817
+ has_flattened_params = (
818
+ len([param for param in flattened_params if param is not None]) > 0
819
+ )
820
+ if request is not None and has_flattened_params:
821
+ raise ValueError(
822
+ "If the `request` argument is set, then none of "
823
+ "the individual field arguments should be set."
824
+ )
825
+
826
+ # - Use the request object if provided (there's no risk of modifying the input as
827
+ # there are no flattened fields), or create one.
828
+ if not isinstance(request, projects.CreateProjectRequest):
829
+ request = projects.CreateProjectRequest(request)
830
+
831
+ # If we have keyword arguments corresponding to fields on the
832
+ # request, apply these.
833
+ if project is not None:
834
+ request.project = project
835
+
836
+ # Wrap the RPC method; this adds retry and timeout information,
837
+ # and friendly error handling.
838
+ rpc = self._client._transport._wrapped_methods[
839
+ self._client._transport.create_project
840
+ ]
841
+
842
+ # Validate the universe domain.
843
+ self._client._validate_universe_domain()
844
+
845
+ # Send the request.
846
+ response = await rpc(
847
+ request,
848
+ retry=retry,
849
+ timeout=timeout,
850
+ metadata=metadata,
851
+ )
852
+
853
+ # Wrap the response in an operation future.
854
+ response = operation_async.from_gapic(
855
+ response,
856
+ self._client._transport.operations_client,
857
+ projects.Project,
858
+ metadata_type=projects.CreateProjectMetadata,
859
+ )
860
+
861
+ # Done; return the response.
862
+ return response
863
+
864
+ async def update_project(
865
+ self,
866
+ request: Optional[Union[projects.UpdateProjectRequest, dict]] = None,
867
+ *,
868
+ project: Optional[projects.Project] = None,
869
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
870
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
871
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
872
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
873
+ ) -> operation_async.AsyncOperation:
874
+ r"""Updates the ``display_name`` and labels of the project
875
+ identified by the specified ``name`` (for example,
876
+ ``projects/415104041262``). Deleting all labels requires an
877
+ update mask for labels field.
878
+
879
+ The caller must have ``resourcemanager.projects.update``
880
+ permission for this project.
881
+
882
+ .. code-block:: python
883
+
884
+ # This snippet has been automatically generated and should be regarded as a
885
+ # code template only.
886
+ # It will require modifications to work:
887
+ # - It may require correct/in-range values for request initialization.
888
+ # - It may require specifying regional endpoints when creating the service
889
+ # client as shown in:
890
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
891
+ from google.cloud import resourcemanager_v3
892
+
893
+ async def sample_update_project():
894
+ # Create a client
895
+ client = resourcemanager_v3.ProjectsAsyncClient()
896
+
897
+ # Initialize request argument(s)
898
+ request = resourcemanager_v3.UpdateProjectRequest(
899
+ )
900
+
901
+ # Make the request
902
+ operation = client.update_project(request=request)
903
+
904
+ print("Waiting for operation to complete...")
905
+
906
+ response = (await operation).result()
907
+
908
+ # Handle the response
909
+ print(response)
910
+
911
+ Args:
912
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.UpdateProjectRequest, dict]]):
913
+ The request object. The request sent to the
914
+ [UpdateProject][google.cloud.resourcemanager.v3.Projects.UpdateProject]
915
+ method.
916
+
917
+ Only the ``display_name`` and ``labels`` fields can be
918
+ change. Use the
919
+ [MoveProject][google.cloud.resourcemanager.v3.Projects.MoveProject]
920
+ method to change the ``parent`` field.
921
+ project (:class:`google.cloud.resourcemanager_v3.types.Project`):
922
+ Required. The new definition of the
923
+ project.
924
+
925
+ This corresponds to the ``project`` field
926
+ on the ``request`` instance; if ``request`` is provided, this
927
+ should not be set.
928
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
929
+ Optional. An update mask to
930
+ selectively update fields.
931
+
932
+ This corresponds to the ``update_mask`` field
933
+ on the ``request`` instance; if ``request`` is provided, this
934
+ should not be set.
935
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
936
+ should be retried.
937
+ timeout (float): The timeout for this request.
938
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
939
+ sent along with the request as metadata. Normally, each value must be of type `str`,
940
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
941
+ be of type `bytes`.
942
+
943
+ Returns:
944
+ google.api_core.operation_async.AsyncOperation:
945
+ An object representing a long-running operation.
946
+
947
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.Project` A project is a high-level Google Cloud entity. It is a
948
+ container for ACLs, APIs, App Engine Apps, VMs, and
949
+ other Google Cloud Platform resources.
950
+
951
+ """
952
+ # Create or coerce a protobuf request object.
953
+ # - Quick check: If we got a request object, we should *not* have
954
+ # gotten any keyword arguments that map to the request.
955
+ flattened_params = [project, update_mask]
956
+ has_flattened_params = (
957
+ len([param for param in flattened_params if param is not None]) > 0
958
+ )
959
+ if request is not None and has_flattened_params:
960
+ raise ValueError(
961
+ "If the `request` argument is set, then none of "
962
+ "the individual field arguments should be set."
963
+ )
964
+
965
+ # - Use the request object if provided (there's no risk of modifying the input as
966
+ # there are no flattened fields), or create one.
967
+ if not isinstance(request, projects.UpdateProjectRequest):
968
+ request = projects.UpdateProjectRequest(request)
969
+
970
+ # If we have keyword arguments corresponding to fields on the
971
+ # request, apply these.
972
+ if project is not None:
973
+ request.project = project
974
+ if update_mask is not None:
975
+ request.update_mask = update_mask
976
+
977
+ # Wrap the RPC method; this adds retry and timeout information,
978
+ # and friendly error handling.
979
+ rpc = self._client._transport._wrapped_methods[
980
+ self._client._transport.update_project
981
+ ]
982
+
983
+ # Certain fields should be provided within the metadata header;
984
+ # add these here.
985
+ metadata = tuple(metadata) + (
986
+ gapic_v1.routing_header.to_grpc_metadata(
987
+ (("project.name", request.project.name),)
988
+ ),
989
+ )
990
+
991
+ # Validate the universe domain.
992
+ self._client._validate_universe_domain()
993
+
994
+ # Send the request.
995
+ response = await rpc(
996
+ request,
997
+ retry=retry,
998
+ timeout=timeout,
999
+ metadata=metadata,
1000
+ )
1001
+
1002
+ # Wrap the response in an operation future.
1003
+ response = operation_async.from_gapic(
1004
+ response,
1005
+ self._client._transport.operations_client,
1006
+ projects.Project,
1007
+ metadata_type=projects.UpdateProjectMetadata,
1008
+ )
1009
+
1010
+ # Done; return the response.
1011
+ return response
1012
+
1013
+ async def move_project(
1014
+ self,
1015
+ request: Optional[Union[projects.MoveProjectRequest, dict]] = None,
1016
+ *,
1017
+ name: Optional[str] = None,
1018
+ destination_parent: Optional[str] = None,
1019
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1020
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1021
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1022
+ ) -> operation_async.AsyncOperation:
1023
+ r"""Move a project to another place in your resource hierarchy,
1024
+ under a new resource parent.
1025
+
1026
+ Returns an operation which can be used to track the process of
1027
+ the project move workflow. Upon success, the
1028
+ ``Operation.response`` field will be populated with the moved
1029
+ project.
1030
+
1031
+ The caller must have ``resourcemanager.projects.move``
1032
+ permission on the project, on the project's current and proposed
1033
+ new parent.
1034
+
1035
+ If project has no current parent, or it currently does not have
1036
+ an associated organization resource, you will also need the
1037
+ ``resourcemanager.projects.setIamPolicy`` permission in the
1038
+ project.
1039
+
1040
+ .. code-block:: python
1041
+
1042
+ # This snippet has been automatically generated and should be regarded as a
1043
+ # code template only.
1044
+ # It will require modifications to work:
1045
+ # - It may require correct/in-range values for request initialization.
1046
+ # - It may require specifying regional endpoints when creating the service
1047
+ # client as shown in:
1048
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1049
+ from google.cloud import resourcemanager_v3
1050
+
1051
+ async def sample_move_project():
1052
+ # Create a client
1053
+ client = resourcemanager_v3.ProjectsAsyncClient()
1054
+
1055
+ # Initialize request argument(s)
1056
+ request = resourcemanager_v3.MoveProjectRequest(
1057
+ name="name_value",
1058
+ destination_parent="destination_parent_value",
1059
+ )
1060
+
1061
+ # Make the request
1062
+ operation = client.move_project(request=request)
1063
+
1064
+ print("Waiting for operation to complete...")
1065
+
1066
+ response = (await operation).result()
1067
+
1068
+ # Handle the response
1069
+ print(response)
1070
+
1071
+ Args:
1072
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.MoveProjectRequest, dict]]):
1073
+ The request object. The request sent to
1074
+ [MoveProject][google.cloud.resourcemanager.v3.Projects.MoveProject]
1075
+ method.
1076
+ name (:class:`str`):
1077
+ Required. The name of the project to
1078
+ move.
1079
+
1080
+ This corresponds to the ``name`` field
1081
+ on the ``request`` instance; if ``request`` is provided, this
1082
+ should not be set.
1083
+ destination_parent (:class:`str`):
1084
+ Required. The new parent to move the
1085
+ Project under.
1086
+
1087
+ This corresponds to the ``destination_parent`` field
1088
+ on the ``request`` instance; if ``request`` is provided, this
1089
+ should not be set.
1090
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1091
+ should be retried.
1092
+ timeout (float): The timeout for this request.
1093
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1094
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1095
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1096
+ be of type `bytes`.
1097
+
1098
+ Returns:
1099
+ google.api_core.operation_async.AsyncOperation:
1100
+ An object representing a long-running operation.
1101
+
1102
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.Project` A project is a high-level Google Cloud entity. It is a
1103
+ container for ACLs, APIs, App Engine Apps, VMs, and
1104
+ other Google Cloud Platform resources.
1105
+
1106
+ """
1107
+ # Create or coerce a protobuf request object.
1108
+ # - Quick check: If we got a request object, we should *not* have
1109
+ # gotten any keyword arguments that map to the request.
1110
+ flattened_params = [name, destination_parent]
1111
+ has_flattened_params = (
1112
+ len([param for param in flattened_params if param is not None]) > 0
1113
+ )
1114
+ if request is not None and has_flattened_params:
1115
+ raise ValueError(
1116
+ "If the `request` argument is set, then none of "
1117
+ "the individual field arguments should be set."
1118
+ )
1119
+
1120
+ # - Use the request object if provided (there's no risk of modifying the input as
1121
+ # there are no flattened fields), or create one.
1122
+ if not isinstance(request, projects.MoveProjectRequest):
1123
+ request = projects.MoveProjectRequest(request)
1124
+
1125
+ # If we have keyword arguments corresponding to fields on the
1126
+ # request, apply these.
1127
+ if name is not None:
1128
+ request.name = name
1129
+ if destination_parent is not None:
1130
+ request.destination_parent = destination_parent
1131
+
1132
+ # Wrap the RPC method; this adds retry and timeout information,
1133
+ # and friendly error handling.
1134
+ rpc = self._client._transport._wrapped_methods[
1135
+ self._client._transport.move_project
1136
+ ]
1137
+
1138
+ # Certain fields should be provided within the metadata header;
1139
+ # add these here.
1140
+ metadata = tuple(metadata) + (
1141
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1142
+ )
1143
+
1144
+ # Validate the universe domain.
1145
+ self._client._validate_universe_domain()
1146
+
1147
+ # Send the request.
1148
+ response = await rpc(
1149
+ request,
1150
+ retry=retry,
1151
+ timeout=timeout,
1152
+ metadata=metadata,
1153
+ )
1154
+
1155
+ # Wrap the response in an operation future.
1156
+ response = operation_async.from_gapic(
1157
+ response,
1158
+ self._client._transport.operations_client,
1159
+ projects.Project,
1160
+ metadata_type=projects.MoveProjectMetadata,
1161
+ )
1162
+
1163
+ # Done; return the response.
1164
+ return response
1165
+
1166
+ async def delete_project(
1167
+ self,
1168
+ request: Optional[Union[projects.DeleteProjectRequest, dict]] = None,
1169
+ *,
1170
+ name: Optional[str] = None,
1171
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1172
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1173
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1174
+ ) -> operation_async.AsyncOperation:
1175
+ r"""Marks the project identified by the specified ``name`` (for
1176
+ example, ``projects/415104041262``) for deletion.
1177
+
1178
+ This method will only affect the project if it has a lifecycle
1179
+ state of
1180
+ [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE].
1181
+
1182
+ This method changes the Project's lifecycle state from
1183
+ [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE]
1184
+ to
1185
+ [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Project.State.DELETE_REQUESTED].
1186
+ The deletion starts at an unspecified time, at which point the
1187
+ Project is no longer accessible.
1188
+
1189
+ Until the deletion completes, you can check the lifecycle state
1190
+ checked by retrieving the project with [GetProject]
1191
+ [google.cloud.resourcemanager.v3.Projects.GetProject], and the
1192
+ project remains visible to [ListProjects]
1193
+ [google.cloud.resourcemanager.v3.Projects.ListProjects].
1194
+ However, you cannot update the project.
1195
+
1196
+ After the deletion completes, the project is not retrievable by
1197
+ the [GetProject]
1198
+ [google.cloud.resourcemanager.v3.Projects.GetProject],
1199
+ [ListProjects]
1200
+ [google.cloud.resourcemanager.v3.Projects.ListProjects], and
1201
+ [SearchProjects][google.cloud.resourcemanager.v3.Projects.SearchProjects]
1202
+ methods.
1203
+
1204
+ This method behaves idempotently, such that deleting a
1205
+ ``DELETE_REQUESTED`` project will not cause an error, but also
1206
+ won't do anything.
1207
+
1208
+ The caller must have ``resourcemanager.projects.delete``
1209
+ permissions for this project.
1210
+
1211
+ .. code-block:: python
1212
+
1213
+ # This snippet has been automatically generated and should be regarded as a
1214
+ # code template only.
1215
+ # It will require modifications to work:
1216
+ # - It may require correct/in-range values for request initialization.
1217
+ # - It may require specifying regional endpoints when creating the service
1218
+ # client as shown in:
1219
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1220
+ from google.cloud import resourcemanager_v3
1221
+
1222
+ async def sample_delete_project():
1223
+ # Create a client
1224
+ client = resourcemanager_v3.ProjectsAsyncClient()
1225
+
1226
+ # Initialize request argument(s)
1227
+ request = resourcemanager_v3.DeleteProjectRequest(
1228
+ name="name_value",
1229
+ )
1230
+
1231
+ # Make the request
1232
+ operation = client.delete_project(request=request)
1233
+
1234
+ print("Waiting for operation to complete...")
1235
+
1236
+ response = (await operation).result()
1237
+
1238
+ # Handle the response
1239
+ print(response)
1240
+
1241
+ Args:
1242
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.DeleteProjectRequest, dict]]):
1243
+ The request object. [DeleteProject][google.cloud.resourcemanager.v3.Projects.DeleteProject]
1244
+ method.
1245
+ name (:class:`str`):
1246
+ Required. The name of the Project (for example,
1247
+ ``projects/415104041262``).
1248
+
1249
+ This corresponds to the ``name`` field
1250
+ on the ``request`` instance; if ``request`` is provided, this
1251
+ should not be set.
1252
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1253
+ should be retried.
1254
+ timeout (float): The timeout for this request.
1255
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1256
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1257
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1258
+ be of type `bytes`.
1259
+
1260
+ Returns:
1261
+ google.api_core.operation_async.AsyncOperation:
1262
+ An object representing a long-running operation.
1263
+
1264
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.Project` A project is a high-level Google Cloud entity. It is a
1265
+ container for ACLs, APIs, App Engine Apps, VMs, and
1266
+ other Google Cloud Platform resources.
1267
+
1268
+ """
1269
+ # Create or coerce a protobuf request object.
1270
+ # - Quick check: If we got a request object, we should *not* have
1271
+ # gotten any keyword arguments that map to the request.
1272
+ flattened_params = [name]
1273
+ has_flattened_params = (
1274
+ len([param for param in flattened_params if param is not None]) > 0
1275
+ )
1276
+ if request is not None and has_flattened_params:
1277
+ raise ValueError(
1278
+ "If the `request` argument is set, then none of "
1279
+ "the individual field arguments should be set."
1280
+ )
1281
+
1282
+ # - Use the request object if provided (there's no risk of modifying the input as
1283
+ # there are no flattened fields), or create one.
1284
+ if not isinstance(request, projects.DeleteProjectRequest):
1285
+ request = projects.DeleteProjectRequest(request)
1286
+
1287
+ # If we have keyword arguments corresponding to fields on the
1288
+ # request, apply these.
1289
+ if name is not None:
1290
+ request.name = name
1291
+
1292
+ # Wrap the RPC method; this adds retry and timeout information,
1293
+ # and friendly error handling.
1294
+ rpc = self._client._transport._wrapped_methods[
1295
+ self._client._transport.delete_project
1296
+ ]
1297
+
1298
+ # Certain fields should be provided within the metadata header;
1299
+ # add these here.
1300
+ metadata = tuple(metadata) + (
1301
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1302
+ )
1303
+
1304
+ # Validate the universe domain.
1305
+ self._client._validate_universe_domain()
1306
+
1307
+ # Send the request.
1308
+ response = await rpc(
1309
+ request,
1310
+ retry=retry,
1311
+ timeout=timeout,
1312
+ metadata=metadata,
1313
+ )
1314
+
1315
+ # Wrap the response in an operation future.
1316
+ response = operation_async.from_gapic(
1317
+ response,
1318
+ self._client._transport.operations_client,
1319
+ projects.Project,
1320
+ metadata_type=projects.DeleteProjectMetadata,
1321
+ )
1322
+
1323
+ # Done; return the response.
1324
+ return response
1325
+
1326
+ async def undelete_project(
1327
+ self,
1328
+ request: Optional[Union[projects.UndeleteProjectRequest, dict]] = None,
1329
+ *,
1330
+ name: Optional[str] = None,
1331
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1332
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1333
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1334
+ ) -> operation_async.AsyncOperation:
1335
+ r"""Restores the project identified by the specified ``name`` (for
1336
+ example, ``projects/415104041262``). You can only use this
1337
+ method for a project that has a lifecycle state of
1338
+ [DELETE_REQUESTED] [Projects.State.DELETE_REQUESTED]. After
1339
+ deletion starts, the project cannot be restored.
1340
+
1341
+ The caller must have ``resourcemanager.projects.undelete``
1342
+ permission for this project.
1343
+
1344
+ .. code-block:: python
1345
+
1346
+ # This snippet has been automatically generated and should be regarded as a
1347
+ # code template only.
1348
+ # It will require modifications to work:
1349
+ # - It may require correct/in-range values for request initialization.
1350
+ # - It may require specifying regional endpoints when creating the service
1351
+ # client as shown in:
1352
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1353
+ from google.cloud import resourcemanager_v3
1354
+
1355
+ async def sample_undelete_project():
1356
+ # Create a client
1357
+ client = resourcemanager_v3.ProjectsAsyncClient()
1358
+
1359
+ # Initialize request argument(s)
1360
+ request = resourcemanager_v3.UndeleteProjectRequest(
1361
+ name="name_value",
1362
+ )
1363
+
1364
+ # Make the request
1365
+ operation = client.undelete_project(request=request)
1366
+
1367
+ print("Waiting for operation to complete...")
1368
+
1369
+ response = (await operation).result()
1370
+
1371
+ # Handle the response
1372
+ print(response)
1373
+
1374
+ Args:
1375
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.UndeleteProjectRequest, dict]]):
1376
+ The request object. The request sent to the [UndeleteProject]
1377
+ [google.cloud.resourcemanager.v3.Projects.UndeleteProject]
1378
+ method.
1379
+ name (:class:`str`):
1380
+ Required. The name of the project (for example,
1381
+ ``projects/415104041262``).
1382
+
1383
+ Required.
1384
+
1385
+ This corresponds to the ``name`` field
1386
+ on the ``request`` instance; if ``request`` is provided, this
1387
+ should not be set.
1388
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1389
+ should be retried.
1390
+ timeout (float): The timeout for this request.
1391
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1392
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1393
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1394
+ be of type `bytes`.
1395
+
1396
+ Returns:
1397
+ google.api_core.operation_async.AsyncOperation:
1398
+ An object representing a long-running operation.
1399
+
1400
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.Project` A project is a high-level Google Cloud entity. It is a
1401
+ container for ACLs, APIs, App Engine Apps, VMs, and
1402
+ other Google Cloud Platform resources.
1403
+
1404
+ """
1405
+ # Create or coerce a protobuf request object.
1406
+ # - Quick check: If we got a request object, we should *not* have
1407
+ # gotten any keyword arguments that map to the request.
1408
+ flattened_params = [name]
1409
+ has_flattened_params = (
1410
+ len([param for param in flattened_params if param is not None]) > 0
1411
+ )
1412
+ if request is not None and has_flattened_params:
1413
+ raise ValueError(
1414
+ "If the `request` argument is set, then none of "
1415
+ "the individual field arguments should be set."
1416
+ )
1417
+
1418
+ # - Use the request object if provided (there's no risk of modifying the input as
1419
+ # there are no flattened fields), or create one.
1420
+ if not isinstance(request, projects.UndeleteProjectRequest):
1421
+ request = projects.UndeleteProjectRequest(request)
1422
+
1423
+ # If we have keyword arguments corresponding to fields on the
1424
+ # request, apply these.
1425
+ if name is not None:
1426
+ request.name = name
1427
+
1428
+ # Wrap the RPC method; this adds retry and timeout information,
1429
+ # and friendly error handling.
1430
+ rpc = self._client._transport._wrapped_methods[
1431
+ self._client._transport.undelete_project
1432
+ ]
1433
+
1434
+ # Certain fields should be provided within the metadata header;
1435
+ # add these here.
1436
+ metadata = tuple(metadata) + (
1437
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1438
+ )
1439
+
1440
+ # Validate the universe domain.
1441
+ self._client._validate_universe_domain()
1442
+
1443
+ # Send the request.
1444
+ response = await rpc(
1445
+ request,
1446
+ retry=retry,
1447
+ timeout=timeout,
1448
+ metadata=metadata,
1449
+ )
1450
+
1451
+ # Wrap the response in an operation future.
1452
+ response = operation_async.from_gapic(
1453
+ response,
1454
+ self._client._transport.operations_client,
1455
+ projects.Project,
1456
+ metadata_type=projects.UndeleteProjectMetadata,
1457
+ )
1458
+
1459
+ # Done; return the response.
1460
+ return response
1461
+
1462
+ async def get_iam_policy(
1463
+ self,
1464
+ request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
1465
+ *,
1466
+ resource: Optional[str] = None,
1467
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1468
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1469
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1470
+ ) -> policy_pb2.Policy:
1471
+ r"""Returns the IAM access control policy for the specified project,
1472
+ in the format ``projects/{ProjectIdOrNumber}`` e.g.
1473
+ projects/123. Permission is denied if the policy or the resource
1474
+ do not exist.
1475
+
1476
+ .. code-block:: python
1477
+
1478
+ # This snippet has been automatically generated and should be regarded as a
1479
+ # code template only.
1480
+ # It will require modifications to work:
1481
+ # - It may require correct/in-range values for request initialization.
1482
+ # - It may require specifying regional endpoints when creating the service
1483
+ # client as shown in:
1484
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1485
+ from google.cloud import resourcemanager_v3
1486
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
1487
+
1488
+ async def sample_get_iam_policy():
1489
+ # Create a client
1490
+ client = resourcemanager_v3.ProjectsAsyncClient()
1491
+
1492
+ # Initialize request argument(s)
1493
+ request = iam_policy_pb2.GetIamPolicyRequest(
1494
+ resource="resource_value",
1495
+ )
1496
+
1497
+ # Make the request
1498
+ response = await client.get_iam_policy(request=request)
1499
+
1500
+ # Handle the response
1501
+ print(response)
1502
+
1503
+ Args:
1504
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]]):
1505
+ The request object. Request message for ``GetIamPolicy`` method.
1506
+ resource (:class:`str`):
1507
+ REQUIRED: The resource for which the
1508
+ policy is being requested. See the
1509
+ operation documentation for the
1510
+ appropriate value for this field.
1511
+
1512
+ This corresponds to the ``resource`` field
1513
+ on the ``request`` instance; if ``request`` is provided, this
1514
+ should not be set.
1515
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1516
+ should be retried.
1517
+ timeout (float): The timeout for this request.
1518
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1519
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1520
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1521
+ be of type `bytes`.
1522
+
1523
+ Returns:
1524
+ google.iam.v1.policy_pb2.Policy:
1525
+ An Identity and Access Management (IAM) policy, which specifies access
1526
+ controls for Google Cloud resources.
1527
+
1528
+ A Policy is a collection of bindings. A binding binds
1529
+ one or more members, or principals, to a single role.
1530
+ Principals can be user accounts, service accounts,
1531
+ Google groups, and domains (such as G Suite). A role
1532
+ is a named list of permissions; each role can be an
1533
+ IAM predefined role or a user-created custom role.
1534
+
1535
+ For some types of Google Cloud resources, a binding
1536
+ can also specify a condition, which is a logical
1537
+ expression that allows access to a resource only if
1538
+ the expression evaluates to true. A condition can add
1539
+ constraints based on attributes of the request, the
1540
+ resource, or both. To learn which resources support
1541
+ conditions in their IAM policies, see the [IAM
1542
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
1543
+
1544
+ **JSON example:**
1545
+
1546
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
1547
+
1548
+ **YAML example:**
1549
+
1550
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
1551
+
1552
+ For a description of IAM and its features, see the
1553
+ [IAM
1554
+ documentation](https://cloud.google.com/iam/docs/).
1555
+
1556
+ """
1557
+ # Create or coerce a protobuf request object.
1558
+ # - Quick check: If we got a request object, we should *not* have
1559
+ # gotten any keyword arguments that map to the request.
1560
+ flattened_params = [resource]
1561
+ has_flattened_params = (
1562
+ len([param for param in flattened_params if param is not None]) > 0
1563
+ )
1564
+ if request is not None and has_flattened_params:
1565
+ raise ValueError(
1566
+ "If the `request` argument is set, then none of "
1567
+ "the individual field arguments should be set."
1568
+ )
1569
+
1570
+ # - The request isn't a proto-plus wrapped type,
1571
+ # so it must be constructed via keyword expansion.
1572
+ if isinstance(request, dict):
1573
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
1574
+ elif not request:
1575
+ request = iam_policy_pb2.GetIamPolicyRequest(resource=resource)
1576
+
1577
+ # Wrap the RPC method; this adds retry and timeout information,
1578
+ # and friendly error handling.
1579
+ rpc = self._client._transport._wrapped_methods[
1580
+ self._client._transport.get_iam_policy
1581
+ ]
1582
+
1583
+ # Certain fields should be provided within the metadata header;
1584
+ # add these here.
1585
+ metadata = tuple(metadata) + (
1586
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1587
+ )
1588
+
1589
+ # Validate the universe domain.
1590
+ self._client._validate_universe_domain()
1591
+
1592
+ # Send the request.
1593
+ response = await rpc(
1594
+ request,
1595
+ retry=retry,
1596
+ timeout=timeout,
1597
+ metadata=metadata,
1598
+ )
1599
+
1600
+ # Done; return the response.
1601
+ return response
1602
+
1603
+ async def set_iam_policy(
1604
+ self,
1605
+ request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
1606
+ *,
1607
+ resource: Optional[str] = None,
1608
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1609
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1610
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1611
+ ) -> policy_pb2.Policy:
1612
+ r"""Sets the IAM access control policy for the specified project, in
1613
+ the format ``projects/{ProjectIdOrNumber}`` e.g. projects/123.
1614
+
1615
+ CAUTION: This method will replace the existing policy, and
1616
+ cannot be used to append additional IAM settings.
1617
+
1618
+ Note: Removing service accounts from policies or changing their
1619
+ roles can render services completely inoperable. It is important
1620
+ to understand how the service account is being used before
1621
+ removing or updating its roles.
1622
+
1623
+ The following constraints apply when using ``setIamPolicy()``:
1624
+
1625
+ - Project does not support ``allUsers`` and
1626
+ ``allAuthenticatedUsers`` as ``members`` in a ``Binding`` of a
1627
+ ``Policy``.
1628
+
1629
+ - The owner role can be granted to a ``user``,
1630
+ ``serviceAccount``, or a group that is part of an
1631
+ organization. For example, group@myownpersonaldomain.com could
1632
+ be added as an owner to a project in the
1633
+ myownpersonaldomain.com organization, but not the
1634
+ examplepetstore.com organization.
1635
+
1636
+ - Service accounts can be made owners of a project directly
1637
+ without any restrictions. However, to be added as an owner, a
1638
+ user must be invited using the Cloud Platform console and must
1639
+ accept the invitation.
1640
+
1641
+ - A user cannot be granted the owner role using
1642
+ ``setIamPolicy()``. The user must be granted the owner role
1643
+ using the Cloud Platform Console and must explicitly accept
1644
+ the invitation.
1645
+
1646
+ - Invitations to grant the owner role cannot be sent using
1647
+ ``setIamPolicy()``; they must be sent only using the Cloud
1648
+ Platform Console.
1649
+
1650
+ - If the project is not part of an organization, there must be
1651
+ at least one owner who has accepted the Terms of Service (ToS)
1652
+ agreement in the policy. Calling ``setIamPolicy()`` to remove
1653
+ the last ToS-accepted owner from the policy will fail. This
1654
+ restriction also applies to legacy projects that no longer
1655
+ have owners who have accepted the ToS. Edits to IAM policies
1656
+ will be rejected until the lack of a ToS-accepting owner is
1657
+ rectified. If the project is part of an organization, you can
1658
+ remove all owners, potentially making the organization
1659
+ inaccessible.
1660
+
1661
+ .. code-block:: python
1662
+
1663
+ # This snippet has been automatically generated and should be regarded as a
1664
+ # code template only.
1665
+ # It will require modifications to work:
1666
+ # - It may require correct/in-range values for request initialization.
1667
+ # - It may require specifying regional endpoints when creating the service
1668
+ # client as shown in:
1669
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1670
+ from google.cloud import resourcemanager_v3
1671
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
1672
+
1673
+ async def sample_set_iam_policy():
1674
+ # Create a client
1675
+ client = resourcemanager_v3.ProjectsAsyncClient()
1676
+
1677
+ # Initialize request argument(s)
1678
+ request = iam_policy_pb2.SetIamPolicyRequest(
1679
+ resource="resource_value",
1680
+ )
1681
+
1682
+ # Make the request
1683
+ response = await client.set_iam_policy(request=request)
1684
+
1685
+ # Handle the response
1686
+ print(response)
1687
+
1688
+ Args:
1689
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]]):
1690
+ The request object. Request message for ``SetIamPolicy`` method.
1691
+ resource (:class:`str`):
1692
+ REQUIRED: The resource for which the
1693
+ policy is being specified. See the
1694
+ operation documentation for the
1695
+ appropriate value for this field.
1696
+
1697
+ This corresponds to the ``resource`` field
1698
+ on the ``request`` instance; if ``request`` is provided, this
1699
+ should not be set.
1700
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1701
+ should be retried.
1702
+ timeout (float): The timeout for this request.
1703
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1704
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1705
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1706
+ be of type `bytes`.
1707
+
1708
+ Returns:
1709
+ google.iam.v1.policy_pb2.Policy:
1710
+ An Identity and Access Management (IAM) policy, which specifies access
1711
+ controls for Google Cloud resources.
1712
+
1713
+ A Policy is a collection of bindings. A binding binds
1714
+ one or more members, or principals, to a single role.
1715
+ Principals can be user accounts, service accounts,
1716
+ Google groups, and domains (such as G Suite). A role
1717
+ is a named list of permissions; each role can be an
1718
+ IAM predefined role or a user-created custom role.
1719
+
1720
+ For some types of Google Cloud resources, a binding
1721
+ can also specify a condition, which is a logical
1722
+ expression that allows access to a resource only if
1723
+ the expression evaluates to true. A condition can add
1724
+ constraints based on attributes of the request, the
1725
+ resource, or both. To learn which resources support
1726
+ conditions in their IAM policies, see the [IAM
1727
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
1728
+
1729
+ **JSON example:**
1730
+
1731
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
1732
+
1733
+ **YAML example:**
1734
+
1735
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
1736
+
1737
+ For a description of IAM and its features, see the
1738
+ [IAM
1739
+ documentation](https://cloud.google.com/iam/docs/).
1740
+
1741
+ """
1742
+ # Create or coerce a protobuf request object.
1743
+ # - Quick check: If we got a request object, we should *not* have
1744
+ # gotten any keyword arguments that map to the request.
1745
+ flattened_params = [resource]
1746
+ has_flattened_params = (
1747
+ len([param for param in flattened_params if param is not None]) > 0
1748
+ )
1749
+ if request is not None and has_flattened_params:
1750
+ raise ValueError(
1751
+ "If the `request` argument is set, then none of "
1752
+ "the individual field arguments should be set."
1753
+ )
1754
+
1755
+ # - The request isn't a proto-plus wrapped type,
1756
+ # so it must be constructed via keyword expansion.
1757
+ if isinstance(request, dict):
1758
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
1759
+ elif not request:
1760
+ request = iam_policy_pb2.SetIamPolicyRequest(resource=resource)
1761
+
1762
+ # Wrap the RPC method; this adds retry and timeout information,
1763
+ # and friendly error handling.
1764
+ rpc = self._client._transport._wrapped_methods[
1765
+ self._client._transport.set_iam_policy
1766
+ ]
1767
+
1768
+ # Certain fields should be provided within the metadata header;
1769
+ # add these here.
1770
+ metadata = tuple(metadata) + (
1771
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1772
+ )
1773
+
1774
+ # Validate the universe domain.
1775
+ self._client._validate_universe_domain()
1776
+
1777
+ # Send the request.
1778
+ response = await rpc(
1779
+ request,
1780
+ retry=retry,
1781
+ timeout=timeout,
1782
+ metadata=metadata,
1783
+ )
1784
+
1785
+ # Done; return the response.
1786
+ return response
1787
+
1788
+ async def test_iam_permissions(
1789
+ self,
1790
+ request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
1791
+ *,
1792
+ resource: Optional[str] = None,
1793
+ permissions: Optional[MutableSequence[str]] = None,
1794
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1795
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1796
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1797
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1798
+ r"""Returns permissions that a caller has on the specified project,
1799
+ in the format ``projects/{ProjectIdOrNumber}`` e.g.
1800
+ projects/123..
1801
+
1802
+ .. code-block:: python
1803
+
1804
+ # This snippet has been automatically generated and should be regarded as a
1805
+ # code template only.
1806
+ # It will require modifications to work:
1807
+ # - It may require correct/in-range values for request initialization.
1808
+ # - It may require specifying regional endpoints when creating the service
1809
+ # client as shown in:
1810
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1811
+ from google.cloud import resourcemanager_v3
1812
+ import google.iam.v1.iam_policy_pb2 as iam_policy_pb2 # type: ignore
1813
+
1814
+ async def sample_test_iam_permissions():
1815
+ # Create a client
1816
+ client = resourcemanager_v3.ProjectsAsyncClient()
1817
+
1818
+ # Initialize request argument(s)
1819
+ request = iam_policy_pb2.TestIamPermissionsRequest(
1820
+ resource="resource_value",
1821
+ permissions=['permissions_value1', 'permissions_value2'],
1822
+ )
1823
+
1824
+ # Make the request
1825
+ response = await client.test_iam_permissions(request=request)
1826
+
1827
+ # Handle the response
1828
+ print(response)
1829
+
1830
+ Args:
1831
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]]):
1832
+ The request object. Request message for ``TestIamPermissions`` method.
1833
+ resource (:class:`str`):
1834
+ REQUIRED: The resource for which the
1835
+ policy detail is being requested. See
1836
+ the operation documentation for the
1837
+ appropriate value for this field.
1838
+
1839
+ This corresponds to the ``resource`` field
1840
+ on the ``request`` instance; if ``request`` is provided, this
1841
+ should not be set.
1842
+ permissions (:class:`MutableSequence[str]`):
1843
+ The set of permissions to check for the ``resource``.
1844
+ Permissions with wildcards (such as '*' or 'storage.*')
1845
+ are not allowed. For more information see `IAM
1846
+ Overview <https://cloud.google.com/iam/docs/overview#permissions>`__.
1847
+
1848
+ This corresponds to the ``permissions`` field
1849
+ on the ``request`` instance; if ``request`` is provided, this
1850
+ should not be set.
1851
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1852
+ should be retried.
1853
+ timeout (float): The timeout for this request.
1854
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1855
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1856
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1857
+ be of type `bytes`.
1858
+
1859
+ Returns:
1860
+ google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse:
1861
+ Response message for TestIamPermissions method.
1862
+ """
1863
+ # Create or coerce a protobuf request object.
1864
+ # - Quick check: If we got a request object, we should *not* have
1865
+ # gotten any keyword arguments that map to the request.
1866
+ flattened_params = [resource, permissions]
1867
+ has_flattened_params = (
1868
+ len([param for param in flattened_params if param is not None]) > 0
1869
+ )
1870
+ if request is not None and has_flattened_params:
1871
+ raise ValueError(
1872
+ "If the `request` argument is set, then none of "
1873
+ "the individual field arguments should be set."
1874
+ )
1875
+
1876
+ # - The request isn't a proto-plus wrapped type,
1877
+ # so it must be constructed via keyword expansion.
1878
+ if isinstance(request, dict):
1879
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
1880
+ elif not request:
1881
+ request = iam_policy_pb2.TestIamPermissionsRequest(
1882
+ resource=resource, permissions=permissions
1883
+ )
1884
+
1885
+ # Wrap the RPC method; this adds retry and timeout information,
1886
+ # and friendly error handling.
1887
+ rpc = self._client._transport._wrapped_methods[
1888
+ self._client._transport.test_iam_permissions
1889
+ ]
1890
+
1891
+ # Certain fields should be provided within the metadata header;
1892
+ # add these here.
1893
+ metadata = tuple(metadata) + (
1894
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1895
+ )
1896
+
1897
+ # Validate the universe domain.
1898
+ self._client._validate_universe_domain()
1899
+
1900
+ # Send the request.
1901
+ response = await rpc(
1902
+ request,
1903
+ retry=retry,
1904
+ timeout=timeout,
1905
+ metadata=metadata,
1906
+ )
1907
+
1908
+ # Done; return the response.
1909
+ return response
1910
+
1911
+ async def get_operation(
1912
+ self,
1913
+ request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None,
1914
+ *,
1915
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1916
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1917
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1918
+ ) -> operations_pb2.Operation:
1919
+ r"""Gets the latest state of a long-running operation.
1920
+
1921
+ Args:
1922
+ request (:class:`~.operations_pb2.GetOperationRequest`):
1923
+ The request object. Request message for
1924
+ `GetOperation` method.
1925
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1926
+ if any, should be retried.
1927
+ timeout (float): The timeout for this request.
1928
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1929
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1930
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1931
+ be of type `bytes`.
1932
+ Returns:
1933
+ ~.operations_pb2.Operation:
1934
+ An ``Operation`` object.
1935
+ """
1936
+ # Create or coerce a protobuf request object.
1937
+ # The request isn't a proto-plus wrapped type,
1938
+ # so it must be constructed via keyword expansion.
1939
+ if request is None:
1940
+ request_pb = operations_pb2.GetOperationRequest()
1941
+ elif isinstance(request, dict):
1942
+ request_pb = operations_pb2.GetOperationRequest(**request)
1943
+ else:
1944
+ request_pb = request
1945
+
1946
+ # Wrap the RPC method; this adds retry and timeout information,
1947
+ # and friendly error handling.
1948
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
1949
+
1950
+ # Certain fields should be provided within the metadata header;
1951
+ # add these here.
1952
+ metadata = tuple(metadata) + (
1953
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
1954
+ )
1955
+
1956
+ # Validate the universe domain.
1957
+ self._client._validate_universe_domain()
1958
+
1959
+ # Send the request.
1960
+ response = await rpc(
1961
+ request_pb,
1962
+ retry=retry,
1963
+ timeout=timeout,
1964
+ metadata=metadata,
1965
+ )
1966
+
1967
+ # Done; return the response.
1968
+ return response
1969
+
1970
+ async def __aenter__(self) -> "ProjectsAsyncClient":
1971
+ return self
1972
+
1973
+ async def __aexit__(self, exc_type, exc, tb):
1974
+ await self.transport.close()
1975
+
1976
+
1977
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1978
+ gapic_version=package_version.__version__
1979
+ )
1980
+
1981
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1982
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1983
+
1984
+
1985
+ __all__ = ("ProjectsAsyncClient",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/client.py ADDED
The diff for this file is too large to render. See raw diff
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/projects/pagers.py ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from typing import (
17
+ Any,
18
+ AsyncIterator,
19
+ Awaitable,
20
+ Callable,
21
+ Iterator,
22
+ Optional,
23
+ Sequence,
24
+ Tuple,
25
+ Union,
26
+ )
27
+
28
+ from google.api_core import gapic_v1
29
+ from google.api_core import retry as retries
30
+ from google.api_core import retry_async as retries_async
31
+
32
+ try:
33
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
34
+ OptionalAsyncRetry = Union[
35
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
36
+ ]
37
+ except AttributeError: # pragma: NO COVER
38
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
39
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
40
+
41
+ from google.cloud.resourcemanager_v3.types import projects
42
+
43
+
44
+ class ListProjectsPager:
45
+ """A pager for iterating through ``list_projects`` requests.
46
+
47
+ This class thinly wraps an initial
48
+ :class:`google.cloud.resourcemanager_v3.types.ListProjectsResponse` object, and
49
+ provides an ``__iter__`` method to iterate through its
50
+ ``projects`` field.
51
+
52
+ If there are more pages, the ``__iter__`` method will make additional
53
+ ``ListProjects`` requests and continue to iterate
54
+ through the ``projects`` field on the
55
+ corresponding responses.
56
+
57
+ All the usual :class:`google.cloud.resourcemanager_v3.types.ListProjectsResponse`
58
+ attributes are available on the pager. If multiple requests are made, only
59
+ the most recent response is retained, and thus used for attribute lookup.
60
+ """
61
+
62
+ def __init__(
63
+ self,
64
+ method: Callable[..., projects.ListProjectsResponse],
65
+ request: projects.ListProjectsRequest,
66
+ response: projects.ListProjectsResponse,
67
+ *,
68
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
69
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
70
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
71
+ ):
72
+ """Instantiate the pager.
73
+
74
+ Args:
75
+ method (Callable): The method that was originally called, and
76
+ which instantiated this pager.
77
+ request (google.cloud.resourcemanager_v3.types.ListProjectsRequest):
78
+ The initial request object.
79
+ response (google.cloud.resourcemanager_v3.types.ListProjectsResponse):
80
+ The initial response object.
81
+ retry (google.api_core.retry.Retry): Designation of what errors,
82
+ if any, should be retried.
83
+ timeout (float): The timeout for this request.
84
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
85
+ sent along with the request as metadata. Normally, each value must be of type `str`,
86
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
87
+ be of type `bytes`.
88
+ """
89
+ self._method = method
90
+ self._request = projects.ListProjectsRequest(request)
91
+ self._response = response
92
+ self._retry = retry
93
+ self._timeout = timeout
94
+ self._metadata = metadata
95
+
96
+ def __getattr__(self, name: str) -> Any:
97
+ return getattr(self._response, name)
98
+
99
+ @property
100
+ def pages(self) -> Iterator[projects.ListProjectsResponse]:
101
+ yield self._response
102
+ while self._response.next_page_token:
103
+ self._request.page_token = self._response.next_page_token
104
+ self._response = self._method(
105
+ self._request,
106
+ retry=self._retry,
107
+ timeout=self._timeout,
108
+ metadata=self._metadata,
109
+ )
110
+ yield self._response
111
+
112
+ def __iter__(self) -> Iterator[projects.Project]:
113
+ for page in self.pages:
114
+ yield from page.projects
115
+
116
+ def __repr__(self) -> str:
117
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
118
+
119
+
120
+ class ListProjectsAsyncPager:
121
+ """A pager for iterating through ``list_projects`` requests.
122
+
123
+ This class thinly wraps an initial
124
+ :class:`google.cloud.resourcemanager_v3.types.ListProjectsResponse` object, and
125
+ provides an ``__aiter__`` method to iterate through its
126
+ ``projects`` field.
127
+
128
+ If there are more pages, the ``__aiter__`` method will make additional
129
+ ``ListProjects`` requests and continue to iterate
130
+ through the ``projects`` field on the
131
+ corresponding responses.
132
+
133
+ All the usual :class:`google.cloud.resourcemanager_v3.types.ListProjectsResponse`
134
+ attributes are available on the pager. If multiple requests are made, only
135
+ the most recent response is retained, and thus used for attribute lookup.
136
+ """
137
+
138
+ def __init__(
139
+ self,
140
+ method: Callable[..., Awaitable[projects.ListProjectsResponse]],
141
+ request: projects.ListProjectsRequest,
142
+ response: projects.ListProjectsResponse,
143
+ *,
144
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
145
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
146
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
147
+ ):
148
+ """Instantiates the pager.
149
+
150
+ Args:
151
+ method (Callable): The method that was originally called, and
152
+ which instantiated this pager.
153
+ request (google.cloud.resourcemanager_v3.types.ListProjectsRequest):
154
+ The initial request object.
155
+ response (google.cloud.resourcemanager_v3.types.ListProjectsResponse):
156
+ The initial response object.
157
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
158
+ if any, should be retried.
159
+ timeout (float): The timeout for this request.
160
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
161
+ sent along with the request as metadata. Normally, each value must be of type `str`,
162
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
163
+ be of type `bytes`.
164
+ """
165
+ self._method = method
166
+ self._request = projects.ListProjectsRequest(request)
167
+ self._response = response
168
+ self._retry = retry
169
+ self._timeout = timeout
170
+ self._metadata = metadata
171
+
172
+ def __getattr__(self, name: str) -> Any:
173
+ return getattr(self._response, name)
174
+
175
+ @property
176
+ async def pages(self) -> AsyncIterator[projects.ListProjectsResponse]:
177
+ yield self._response
178
+ while self._response.next_page_token:
179
+ self._request.page_token = self._response.next_page_token
180
+ self._response = await self._method(
181
+ self._request,
182
+ retry=self._retry,
183
+ timeout=self._timeout,
184
+ metadata=self._metadata,
185
+ )
186
+ yield self._response
187
+
188
+ def __aiter__(self) -> AsyncIterator[projects.Project]:
189
+ async def async_generator():
190
+ async for page in self.pages:
191
+ for response in page.projects:
192
+ yield response
193
+
194
+ return async_generator()
195
+
196
+ def __repr__(self) -> str:
197
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
198
+
199
+
200
+ class SearchProjectsPager:
201
+ """A pager for iterating through ``search_projects`` requests.
202
+
203
+ This class thinly wraps an initial
204
+ :class:`google.cloud.resourcemanager_v3.types.SearchProjectsResponse` object, and
205
+ provides an ``__iter__`` method to iterate through its
206
+ ``projects`` field.
207
+
208
+ If there are more pages, the ``__iter__`` method will make additional
209
+ ``SearchProjects`` requests and continue to iterate
210
+ through the ``projects`` field on the
211
+ corresponding responses.
212
+
213
+ All the usual :class:`google.cloud.resourcemanager_v3.types.SearchProjectsResponse`
214
+ attributes are available on the pager. If multiple requests are made, only
215
+ the most recent response is retained, and thus used for attribute lookup.
216
+ """
217
+
218
+ def __init__(
219
+ self,
220
+ method: Callable[..., projects.SearchProjectsResponse],
221
+ request: projects.SearchProjectsRequest,
222
+ response: projects.SearchProjectsResponse,
223
+ *,
224
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
225
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
226
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
227
+ ):
228
+ """Instantiate the pager.
229
+
230
+ Args:
231
+ method (Callable): The method that was originally called, and
232
+ which instantiated this pager.
233
+ request (google.cloud.resourcemanager_v3.types.SearchProjectsRequest):
234
+ The initial request object.
235
+ response (google.cloud.resourcemanager_v3.types.SearchProjectsResponse):
236
+ The initial response object.
237
+ retry (google.api_core.retry.Retry): Designation of what errors,
238
+ if any, should be retried.
239
+ timeout (float): The timeout for this request.
240
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
241
+ sent along with the request as metadata. Normally, each value must be of type `str`,
242
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
243
+ be of type `bytes`.
244
+ """
245
+ self._method = method
246
+ self._request = projects.SearchProjectsRequest(request)
247
+ self._response = response
248
+ self._retry = retry
249
+ self._timeout = timeout
250
+ self._metadata = metadata
251
+
252
+ def __getattr__(self, name: str) -> Any:
253
+ return getattr(self._response, name)
254
+
255
+ @property
256
+ def pages(self) -> Iterator[projects.SearchProjectsResponse]:
257
+ yield self._response
258
+ while self._response.next_page_token:
259
+ self._request.page_token = self._response.next_page_token
260
+ self._response = self._method(
261
+ self._request,
262
+ retry=self._retry,
263
+ timeout=self._timeout,
264
+ metadata=self._metadata,
265
+ )
266
+ yield self._response
267
+
268
+ def __iter__(self) -> Iterator[projects.Project]:
269
+ for page in self.pages:
270
+ yield from page.projects
271
+
272
+ def __repr__(self) -> str:
273
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
274
+
275
+
276
+ class SearchProjectsAsyncPager:
277
+ """A pager for iterating through ``search_projects`` requests.
278
+
279
+ This class thinly wraps an initial
280
+ :class:`google.cloud.resourcemanager_v3.types.SearchProjectsResponse` object, and
281
+ provides an ``__aiter__`` method to iterate through its
282
+ ``projects`` field.
283
+
284
+ If there are more pages, the ``__aiter__`` method will make additional
285
+ ``SearchProjects`` requests and continue to iterate
286
+ through the ``projects`` field on the
287
+ corresponding responses.
288
+
289
+ All the usual :class:`google.cloud.resourcemanager_v3.types.SearchProjectsResponse`
290
+ attributes are available on the pager. If multiple requests are made, only
291
+ the most recent response is retained, and thus used for attribute lookup.
292
+ """
293
+
294
+ def __init__(
295
+ self,
296
+ method: Callable[..., Awaitable[projects.SearchProjectsResponse]],
297
+ request: projects.SearchProjectsRequest,
298
+ response: projects.SearchProjectsResponse,
299
+ *,
300
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
301
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
302
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
303
+ ):
304
+ """Instantiates the pager.
305
+
306
+ Args:
307
+ method (Callable): The method that was originally called, and
308
+ which instantiated this pager.
309
+ request (google.cloud.resourcemanager_v3.types.SearchProjectsRequest):
310
+ The initial request object.
311
+ response (google.cloud.resourcemanager_v3.types.SearchProjectsResponse):
312
+ The initial response object.
313
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
314
+ if any, should be retried.
315
+ timeout (float): The timeout for this request.
316
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
317
+ sent along with the request as metadata. Normally, each value must be of type `str`,
318
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
319
+ be of type `bytes`.
320
+ """
321
+ self._method = method
322
+ self._request = projects.SearchProjectsRequest(request)
323
+ self._response = response
324
+ self._retry = retry
325
+ self._timeout = timeout
326
+ self._metadata = metadata
327
+
328
+ def __getattr__(self, name: str) -> Any:
329
+ return getattr(self._response, name)
330
+
331
+ @property
332
+ async def pages(self) -> AsyncIterator[projects.SearchProjectsResponse]:
333
+ yield self._response
334
+ while self._response.next_page_token:
335
+ self._request.page_token = self._response.next_page_token
336
+ self._response = await self._method(
337
+ self._request,
338
+ retry=self._retry,
339
+ timeout=self._timeout,
340
+ metadata=self._metadata,
341
+ )
342
+ yield self._response
343
+
344
+ def __aiter__(self) -> AsyncIterator[projects.Project]:
345
+ async def async_generator():
346
+ async for page in self.pages:
347
+ for response in page.projects:
348
+ yield response
349
+
350
+ return async_generator()
351
+
352
+ def __repr__(self) -> str:
353
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/__init__.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from .async_client import TagBindingsAsyncClient
17
+ from .client import TagBindingsClient
18
+
19
+ __all__ = (
20
+ "TagBindingsClient",
21
+ "TagBindingsAsyncClient",
22
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (410 Bytes). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/__pycache__/async_client.cpython-311.pyc ADDED
Binary file (36.2 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/__pycache__/client.cpython-311.pyc ADDED
Binary file (55.9 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/__pycache__/pagers.cpython-311.pyc ADDED
Binary file (18.3 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/resourcemanager_v3/services/tag_bindings/async_client.py ADDED
@@ -0,0 +1,883 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import logging as std_logging
17
+ import re
18
+ from collections import OrderedDict
19
+ from typing import (
20
+ Callable,
21
+ Dict,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ import google.protobuf
33
+ from google.api_core import exceptions as core_exceptions
34
+ from google.api_core import gapic_v1
35
+ from google.api_core import retry_async as retries
36
+ from google.api_core.client_options import ClientOptions
37
+ from google.auth import credentials as ga_credentials # type: ignore
38
+ from google.oauth2 import service_account # type: ignore
39
+
40
+ from google.cloud.resourcemanager_v3 import gapic_version as package_version
41
+
42
+ try:
43
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
44
+ except AttributeError: # pragma: NO COVER
45
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
46
+
47
+ import google.api_core.operation as operation # type: ignore
48
+ import google.api_core.operation_async as operation_async # type: ignore
49
+ import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
50
+ from google.longrunning import operations_pb2 # type: ignore
51
+
52
+ from google.cloud.resourcemanager_v3.services.tag_bindings import pagers
53
+ from google.cloud.resourcemanager_v3.types import tag_bindings
54
+
55
+ from .client import TagBindingsClient
56
+ from .transports.base import DEFAULT_CLIENT_INFO, TagBindingsTransport
57
+ from .transports.grpc_asyncio import TagBindingsGrpcAsyncIOTransport
58
+
59
+ try:
60
+ from google.api_core import client_logging # type: ignore
61
+
62
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
63
+ except ImportError: # pragma: NO COVER
64
+ CLIENT_LOGGING_SUPPORTED = False
65
+
66
+ _LOGGER = std_logging.getLogger(__name__)
67
+
68
+
69
+ class TagBindingsAsyncClient:
70
+ """Allow users to create and manage TagBindings between
71
+ TagValues and different Google Cloud resources throughout the
72
+ GCP resource hierarchy.
73
+ """
74
+
75
+ _client: TagBindingsClient
76
+
77
+ # Copy defaults from the synchronous client for use here.
78
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
79
+ DEFAULT_ENDPOINT = TagBindingsClient.DEFAULT_ENDPOINT
80
+ DEFAULT_MTLS_ENDPOINT = TagBindingsClient.DEFAULT_MTLS_ENDPOINT
81
+ _DEFAULT_ENDPOINT_TEMPLATE = TagBindingsClient._DEFAULT_ENDPOINT_TEMPLATE
82
+ _DEFAULT_UNIVERSE = TagBindingsClient._DEFAULT_UNIVERSE
83
+
84
+ tag_binding_path = staticmethod(TagBindingsClient.tag_binding_path)
85
+ parse_tag_binding_path = staticmethod(TagBindingsClient.parse_tag_binding_path)
86
+ tag_key_path = staticmethod(TagBindingsClient.tag_key_path)
87
+ parse_tag_key_path = staticmethod(TagBindingsClient.parse_tag_key_path)
88
+ tag_value_path = staticmethod(TagBindingsClient.tag_value_path)
89
+ parse_tag_value_path = staticmethod(TagBindingsClient.parse_tag_value_path)
90
+ common_billing_account_path = staticmethod(
91
+ TagBindingsClient.common_billing_account_path
92
+ )
93
+ parse_common_billing_account_path = staticmethod(
94
+ TagBindingsClient.parse_common_billing_account_path
95
+ )
96
+ common_folder_path = staticmethod(TagBindingsClient.common_folder_path)
97
+ parse_common_folder_path = staticmethod(TagBindingsClient.parse_common_folder_path)
98
+ common_organization_path = staticmethod(TagBindingsClient.common_organization_path)
99
+ parse_common_organization_path = staticmethod(
100
+ TagBindingsClient.parse_common_organization_path
101
+ )
102
+ common_project_path = staticmethod(TagBindingsClient.common_project_path)
103
+ parse_common_project_path = staticmethod(
104
+ TagBindingsClient.parse_common_project_path
105
+ )
106
+ common_location_path = staticmethod(TagBindingsClient.common_location_path)
107
+ parse_common_location_path = staticmethod(
108
+ TagBindingsClient.parse_common_location_path
109
+ )
110
+
111
+ @classmethod
112
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
113
+ """Creates an instance of this client using the provided credentials
114
+ info.
115
+
116
+ Args:
117
+ info (dict): The service account private key info.
118
+ args: Additional arguments to pass to the constructor.
119
+ kwargs: Additional arguments to pass to the constructor.
120
+
121
+ Returns:
122
+ TagBindingsAsyncClient: The constructed client.
123
+ """
124
+ sa_info_func = (
125
+ TagBindingsClient.from_service_account_info.__func__ # type: ignore
126
+ )
127
+ return sa_info_func(TagBindingsAsyncClient, info, *args, **kwargs)
128
+
129
+ @classmethod
130
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
131
+ """Creates an instance of this client using the provided credentials
132
+ file.
133
+
134
+ Args:
135
+ filename (str): The path to the service account private key json
136
+ file.
137
+ args: Additional arguments to pass to the constructor.
138
+ kwargs: Additional arguments to pass to the constructor.
139
+
140
+ Returns:
141
+ TagBindingsAsyncClient: The constructed client.
142
+ """
143
+ sa_file_func = (
144
+ TagBindingsClient.from_service_account_file.__func__ # type: ignore
145
+ )
146
+ return sa_file_func(TagBindingsAsyncClient, filename, *args, **kwargs)
147
+
148
+ from_service_account_json = from_service_account_file
149
+
150
+ @classmethod
151
+ def get_mtls_endpoint_and_cert_source(
152
+ cls, client_options: Optional[ClientOptions] = None
153
+ ):
154
+ """Return the API endpoint and client cert source for mutual TLS.
155
+
156
+ The client cert source is determined in the following order:
157
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
158
+ client cert source is None.
159
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
160
+ default client cert source exists, use the default one; otherwise the client cert
161
+ source is None.
162
+
163
+ The API endpoint is determined in the following order:
164
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
165
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
166
+ default mTLS endpoint; if the environment variable is "never", use the default API
167
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
168
+ use the default API endpoint.
169
+
170
+ More details can be found at https://google.aip.dev/auth/4114.
171
+
172
+ Args:
173
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
174
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
175
+ in this method.
176
+
177
+ Returns:
178
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
179
+ client cert source to use.
180
+
181
+ Raises:
182
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
183
+ """
184
+ return TagBindingsClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
185
+
186
+ @property
187
+ def transport(self) -> TagBindingsTransport:
188
+ """Returns the transport used by the client instance.
189
+
190
+ Returns:
191
+ TagBindingsTransport: The transport used by the client instance.
192
+ """
193
+ return self._client.transport
194
+
195
+ @property
196
+ def api_endpoint(self) -> str:
197
+ """Return the API endpoint used by the client instance.
198
+
199
+ Returns:
200
+ str: The API endpoint used by the client instance.
201
+ """
202
+ return self._client._api_endpoint
203
+
204
+ @property
205
+ def universe_domain(self) -> str:
206
+ """Return the universe domain used by the client instance.
207
+
208
+ Returns:
209
+ str: The universe domain used
210
+ by the client instance.
211
+ """
212
+ return self._client._universe_domain
213
+
214
+ get_transport_class = TagBindingsClient.get_transport_class
215
+
216
+ def __init__(
217
+ self,
218
+ *,
219
+ credentials: Optional[ga_credentials.Credentials] = None,
220
+ transport: Optional[
221
+ Union[str, TagBindingsTransport, Callable[..., TagBindingsTransport]]
222
+ ] = "grpc_asyncio",
223
+ client_options: Optional[ClientOptions] = None,
224
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
225
+ ) -> None:
226
+ """Instantiates the tag bindings async client.
227
+
228
+ Args:
229
+ credentials (Optional[google.auth.credentials.Credentials]): The
230
+ authorization credentials to attach to requests. These
231
+ credentials identify the application to the service; if none
232
+ are specified, the client will attempt to ascertain the
233
+ credentials from the environment.
234
+ transport (Optional[Union[str,TagBindingsTransport,Callable[..., TagBindingsTransport]]]):
235
+ The transport to use, or a Callable that constructs and returns a new transport to use.
236
+ If a Callable is given, it will be called with the same set of initialization
237
+ arguments as used in the TagBindingsTransport constructor.
238
+ If set to None, a transport is chosen automatically.
239
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
240
+ Custom options for the client.
241
+
242
+ 1. The ``api_endpoint`` property can be used to override the
243
+ default endpoint provided by the client when ``transport`` is
244
+ not explicitly provided. Only if this property is not set and
245
+ ``transport`` was not explicitly provided, the endpoint is
246
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
247
+ variable, which have one of the following values:
248
+ "always" (always use the default mTLS endpoint), "never" (always
249
+ use the default regular endpoint) and "auto" (auto-switch to the
250
+ default mTLS endpoint if client certificate is present; this is
251
+ the default value).
252
+
253
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
254
+ is "true", then the ``client_cert_source`` property can be used
255
+ to provide a client certificate for mTLS transport. If
256
+ not provided, the default SSL client certificate will be used if
257
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
258
+ set, no client certificate will be used.
259
+
260
+ 3. The ``universe_domain`` property can be used to override the
261
+ default "googleapis.com" universe. Note that ``api_endpoint``
262
+ property still takes precedence; and ``universe_domain`` is
263
+ currently not supported for mTLS.
264
+
265
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
266
+ The client info used to send a user-agent string along with
267
+ API requests. If ``None``, then default info will be used.
268
+ Generally, you only need to set this if you're developing
269
+ your own client library.
270
+
271
+ Raises:
272
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
273
+ creation failed for any reason.
274
+ """
275
+ self._client = TagBindingsClient(
276
+ credentials=credentials,
277
+ transport=transport,
278
+ client_options=client_options,
279
+ client_info=client_info,
280
+ )
281
+
282
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
283
+ std_logging.DEBUG
284
+ ): # pragma: NO COVER
285
+ _LOGGER.debug(
286
+ "Created client `google.cloud.resourcemanager_v3.TagBindingsAsyncClient`.",
287
+ extra={
288
+ "serviceName": "google.cloud.resourcemanager.v3.TagBindings",
289
+ "universeDomain": getattr(
290
+ self._client._transport._credentials, "universe_domain", ""
291
+ ),
292
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
293
+ "credentialsInfo": getattr(
294
+ self.transport._credentials, "get_cred_info", lambda: None
295
+ )(),
296
+ }
297
+ if hasattr(self._client._transport, "_credentials")
298
+ else {
299
+ "serviceName": "google.cloud.resourcemanager.v3.TagBindings",
300
+ "credentialsType": None,
301
+ },
302
+ )
303
+
304
+ async def list_tag_bindings(
305
+ self,
306
+ request: Optional[Union[tag_bindings.ListTagBindingsRequest, dict]] = None,
307
+ *,
308
+ parent: Optional[str] = None,
309
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
310
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
311
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
312
+ ) -> pagers.ListTagBindingsAsyncPager:
313
+ r"""Lists the TagBindings for the given Google Cloud resource, as
314
+ specified with ``parent``.
315
+
316
+ NOTE: The ``parent`` field is expected to be a full resource
317
+ name:
318
+ https://cloud.google.com/apis/design/resource_names#full_resource_name
319
+
320
+ .. code-block:: python
321
+
322
+ # This snippet has been automatically generated and should be regarded as a
323
+ # code template only.
324
+ # It will require modifications to work:
325
+ # - It may require correct/in-range values for request initialization.
326
+ # - It may require specifying regional endpoints when creating the service
327
+ # client as shown in:
328
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
329
+ from google.cloud import resourcemanager_v3
330
+
331
+ async def sample_list_tag_bindings():
332
+ # Create a client
333
+ client = resourcemanager_v3.TagBindingsAsyncClient()
334
+
335
+ # Initialize request argument(s)
336
+ request = resourcemanager_v3.ListTagBindingsRequest(
337
+ parent="parent_value",
338
+ )
339
+
340
+ # Make the request
341
+ page_result = client.list_tag_bindings(request=request)
342
+
343
+ # Handle the response
344
+ async for response in page_result:
345
+ print(response)
346
+
347
+ Args:
348
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.ListTagBindingsRequest, dict]]):
349
+ The request object. The request message to list all
350
+ TagBindings for a parent.
351
+ parent (:class:`str`):
352
+ Required. The full resource name of a
353
+ resource for which you want to list
354
+ existing TagBindings. E.g.
355
+ "//cloudresourcemanager.googleapis.com/projects/123"
356
+
357
+ This corresponds to the ``parent`` field
358
+ on the ``request`` instance; if ``request`` is provided, this
359
+ should not be set.
360
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
361
+ should be retried.
362
+ timeout (float): The timeout for this request.
363
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
364
+ sent along with the request as metadata. Normally, each value must be of type `str`,
365
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
366
+ be of type `bytes`.
367
+
368
+ Returns:
369
+ google.cloud.resourcemanager_v3.services.tag_bindings.pagers.ListTagBindingsAsyncPager:
370
+ The ListTagBindings response.
371
+
372
+ Iterating over this object will yield
373
+ results and resolve additional pages
374
+ automatically.
375
+
376
+ """
377
+ # Create or coerce a protobuf request object.
378
+ # - Quick check: If we got a request object, we should *not* have
379
+ # gotten any keyword arguments that map to the request.
380
+ flattened_params = [parent]
381
+ has_flattened_params = (
382
+ len([param for param in flattened_params if param is not None]) > 0
383
+ )
384
+ if request is not None and has_flattened_params:
385
+ raise ValueError(
386
+ "If the `request` argument is set, then none of "
387
+ "the individual field arguments should be set."
388
+ )
389
+
390
+ # - Use the request object if provided (there's no risk of modifying the input as
391
+ # there are no flattened fields), or create one.
392
+ if not isinstance(request, tag_bindings.ListTagBindingsRequest):
393
+ request = tag_bindings.ListTagBindingsRequest(request)
394
+
395
+ # If we have keyword arguments corresponding to fields on the
396
+ # request, apply these.
397
+ if parent is not None:
398
+ request.parent = parent
399
+
400
+ # Wrap the RPC method; this adds retry and timeout information,
401
+ # and friendly error handling.
402
+ rpc = self._client._transport._wrapped_methods[
403
+ self._client._transport.list_tag_bindings
404
+ ]
405
+
406
+ # Validate the universe domain.
407
+ self._client._validate_universe_domain()
408
+
409
+ # Send the request.
410
+ response = await rpc(
411
+ request,
412
+ retry=retry,
413
+ timeout=timeout,
414
+ metadata=metadata,
415
+ )
416
+
417
+ # This method is paged; wrap the response in a pager, which provides
418
+ # an `__aiter__` convenience method.
419
+ response = pagers.ListTagBindingsAsyncPager(
420
+ method=rpc,
421
+ request=request,
422
+ response=response,
423
+ retry=retry,
424
+ timeout=timeout,
425
+ metadata=metadata,
426
+ )
427
+
428
+ # Done; return the response.
429
+ return response
430
+
431
+ async def create_tag_binding(
432
+ self,
433
+ request: Optional[Union[tag_bindings.CreateTagBindingRequest, dict]] = None,
434
+ *,
435
+ tag_binding: Optional[tag_bindings.TagBinding] = None,
436
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
437
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
438
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
439
+ ) -> operation_async.AsyncOperation:
440
+ r"""Creates a TagBinding between a TagValue and a Google
441
+ Cloud resource.
442
+
443
+ .. code-block:: python
444
+
445
+ # This snippet has been automatically generated and should be regarded as a
446
+ # code template only.
447
+ # It will require modifications to work:
448
+ # - It may require correct/in-range values for request initialization.
449
+ # - It may require specifying regional endpoints when creating the service
450
+ # client as shown in:
451
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
452
+ from google.cloud import resourcemanager_v3
453
+
454
+ async def sample_create_tag_binding():
455
+ # Create a client
456
+ client = resourcemanager_v3.TagBindingsAsyncClient()
457
+
458
+ # Initialize request argument(s)
459
+ request = resourcemanager_v3.CreateTagBindingRequest(
460
+ )
461
+
462
+ # Make the request
463
+ operation = client.create_tag_binding(request=request)
464
+
465
+ print("Waiting for operation to complete...")
466
+
467
+ response = (await operation).result()
468
+
469
+ # Handle the response
470
+ print(response)
471
+
472
+ Args:
473
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.CreateTagBindingRequest, dict]]):
474
+ The request object. The request message to create a
475
+ TagBinding.
476
+ tag_binding (:class:`google.cloud.resourcemanager_v3.types.TagBinding`):
477
+ Required. The TagBinding to be
478
+ created.
479
+
480
+ This corresponds to the ``tag_binding`` field
481
+ on the ``request`` instance; if ``request`` is provided, this
482
+ should not be set.
483
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
484
+ should be retried.
485
+ timeout (float): The timeout for this request.
486
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
487
+ sent along with the request as metadata. Normally, each value must be of type `str`,
488
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
489
+ be of type `bytes`.
490
+
491
+ Returns:
492
+ google.api_core.operation_async.AsyncOperation:
493
+ An object representing a long-running operation.
494
+
495
+ The result type for the operation will be :class:`google.cloud.resourcemanager_v3.types.TagBinding` A TagBinding represents a connection between a TagValue and a cloud
496
+ resource Once a TagBinding is created, the TagValue
497
+ is applied to all the descendants of the Google Cloud
498
+ resource.
499
+
500
+ """
501
+ # Create or coerce a protobuf request object.
502
+ # - Quick check: If we got a request object, we should *not* have
503
+ # gotten any keyword arguments that map to the request.
504
+ flattened_params = [tag_binding]
505
+ has_flattened_params = (
506
+ len([param for param in flattened_params if param is not None]) > 0
507
+ )
508
+ if request is not None and has_flattened_params:
509
+ raise ValueError(
510
+ "If the `request` argument is set, then none of "
511
+ "the individual field arguments should be set."
512
+ )
513
+
514
+ # - Use the request object if provided (there's no risk of modifying the input as
515
+ # there are no flattened fields), or create one.
516
+ if not isinstance(request, tag_bindings.CreateTagBindingRequest):
517
+ request = tag_bindings.CreateTagBindingRequest(request)
518
+
519
+ # If we have keyword arguments corresponding to fields on the
520
+ # request, apply these.
521
+ if tag_binding is not None:
522
+ request.tag_binding = tag_binding
523
+
524
+ # Wrap the RPC method; this adds retry and timeout information,
525
+ # and friendly error handling.
526
+ rpc = self._client._transport._wrapped_methods[
527
+ self._client._transport.create_tag_binding
528
+ ]
529
+
530
+ # Validate the universe domain.
531
+ self._client._validate_universe_domain()
532
+
533
+ # Send the request.
534
+ response = await rpc(
535
+ request,
536
+ retry=retry,
537
+ timeout=timeout,
538
+ metadata=metadata,
539
+ )
540
+
541
+ # Wrap the response in an operation future.
542
+ response = operation_async.from_gapic(
543
+ response,
544
+ self._client._transport.operations_client,
545
+ tag_bindings.TagBinding,
546
+ metadata_type=tag_bindings.CreateTagBindingMetadata,
547
+ )
548
+
549
+ # Done; return the response.
550
+ return response
551
+
552
+ async def delete_tag_binding(
553
+ self,
554
+ request: Optional[Union[tag_bindings.DeleteTagBindingRequest, dict]] = None,
555
+ *,
556
+ name: Optional[str] = None,
557
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
558
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
559
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
560
+ ) -> operation_async.AsyncOperation:
561
+ r"""Deletes a TagBinding.
562
+
563
+ .. code-block:: python
564
+
565
+ # This snippet has been automatically generated and should be regarded as a
566
+ # code template only.
567
+ # It will require modifications to work:
568
+ # - It may require correct/in-range values for request initialization.
569
+ # - It may require specifying regional endpoints when creating the service
570
+ # client as shown in:
571
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
572
+ from google.cloud import resourcemanager_v3
573
+
574
+ async def sample_delete_tag_binding():
575
+ # Create a client
576
+ client = resourcemanager_v3.TagBindingsAsyncClient()
577
+
578
+ # Initialize request argument(s)
579
+ request = resourcemanager_v3.DeleteTagBindingRequest(
580
+ name="name_value",
581
+ )
582
+
583
+ # Make the request
584
+ operation = client.delete_tag_binding(request=request)
585
+
586
+ print("Waiting for operation to complete...")
587
+
588
+ response = (await operation).result()
589
+
590
+ # Handle the response
591
+ print(response)
592
+
593
+ Args:
594
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.DeleteTagBindingRequest, dict]]):
595
+ The request object. The request message to delete a
596
+ TagBinding.
597
+ name (:class:`str`):
598
+ Required. The name of the TagBinding. This is a String
599
+ of the form: ``tagBindings/{id}`` (e.g.
600
+ ``tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F123/tagValues/456``).
601
+
602
+ This corresponds to the ``name`` field
603
+ on the ``request`` instance; if ``request`` is provided, this
604
+ should not be set.
605
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
606
+ should be retried.
607
+ timeout (float): The timeout for this request.
608
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
609
+ sent along with the request as metadata. Normally, each value must be of type `str`,
610
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
611
+ be of type `bytes`.
612
+
613
+ Returns:
614
+ google.api_core.operation_async.AsyncOperation:
615
+ An object representing a long-running operation.
616
+
617
+ The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated
618
+ empty messages in your APIs. A typical example is to
619
+ use it as the request or the response type of an API
620
+ method. For instance:
621
+
622
+ service Foo {
623
+ rpc Bar(google.protobuf.Empty) returns
624
+ (google.protobuf.Empty);
625
+
626
+ }
627
+
628
+ """
629
+ # Create or coerce a protobuf request object.
630
+ # - Quick check: If we got a request object, we should *not* have
631
+ # gotten any keyword arguments that map to the request.
632
+ flattened_params = [name]
633
+ has_flattened_params = (
634
+ len([param for param in flattened_params if param is not None]) > 0
635
+ )
636
+ if request is not None and has_flattened_params:
637
+ raise ValueError(
638
+ "If the `request` argument is set, then none of "
639
+ "the individual field arguments should be set."
640
+ )
641
+
642
+ # - Use the request object if provided (there's no risk of modifying the input as
643
+ # there are no flattened fields), or create one.
644
+ if not isinstance(request, tag_bindings.DeleteTagBindingRequest):
645
+ request = tag_bindings.DeleteTagBindingRequest(request)
646
+
647
+ # If we have keyword arguments corresponding to fields on the
648
+ # request, apply these.
649
+ if name is not None:
650
+ request.name = name
651
+
652
+ # Wrap the RPC method; this adds retry and timeout information,
653
+ # and friendly error handling.
654
+ rpc = self._client._transport._wrapped_methods[
655
+ self._client._transport.delete_tag_binding
656
+ ]
657
+
658
+ # Certain fields should be provided within the metadata header;
659
+ # add these here.
660
+ metadata = tuple(metadata) + (
661
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
662
+ )
663
+
664
+ # Validate the universe domain.
665
+ self._client._validate_universe_domain()
666
+
667
+ # Send the request.
668
+ response = await rpc(
669
+ request,
670
+ retry=retry,
671
+ timeout=timeout,
672
+ metadata=metadata,
673
+ )
674
+
675
+ # Wrap the response in an operation future.
676
+ response = operation_async.from_gapic(
677
+ response,
678
+ self._client._transport.operations_client,
679
+ empty_pb2.Empty,
680
+ metadata_type=tag_bindings.DeleteTagBindingMetadata,
681
+ )
682
+
683
+ # Done; return the response.
684
+ return response
685
+
686
+ async def list_effective_tags(
687
+ self,
688
+ request: Optional[Union[tag_bindings.ListEffectiveTagsRequest, dict]] = None,
689
+ *,
690
+ parent: Optional[str] = None,
691
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
692
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
693
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
694
+ ) -> pagers.ListEffectiveTagsAsyncPager:
695
+ r"""Return a list of effective tags for the given Google Cloud
696
+ resource, as specified in ``parent``.
697
+
698
+ .. code-block:: python
699
+
700
+ # This snippet has been automatically generated and should be regarded as a
701
+ # code template only.
702
+ # It will require modifications to work:
703
+ # - It may require correct/in-range values for request initialization.
704
+ # - It may require specifying regional endpoints when creating the service
705
+ # client as shown in:
706
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
707
+ from google.cloud import resourcemanager_v3
708
+
709
+ async def sample_list_effective_tags():
710
+ # Create a client
711
+ client = resourcemanager_v3.TagBindingsAsyncClient()
712
+
713
+ # Initialize request argument(s)
714
+ request = resourcemanager_v3.ListEffectiveTagsRequest(
715
+ parent="parent_value",
716
+ )
717
+
718
+ # Make the request
719
+ page_result = client.list_effective_tags(request=request)
720
+
721
+ # Handle the response
722
+ async for response in page_result:
723
+ print(response)
724
+
725
+ Args:
726
+ request (Optional[Union[google.cloud.resourcemanager_v3.types.ListEffectiveTagsRequest, dict]]):
727
+ The request object. The request message to
728
+ ListEffectiveTags
729
+ parent (:class:`str`):
730
+ Required. The full resource name of a
731
+ resource for which you want to list the
732
+ effective tags. E.g.
733
+ "//cloudresourcemanager.googleapis.com/projects/123"
734
+
735
+ This corresponds to the ``parent`` field
736
+ on the ``request`` instance; if ``request`` is provided, this
737
+ should not be set.
738
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
739
+ should be retried.
740
+ timeout (float): The timeout for this request.
741
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
742
+ sent along with the request as metadata. Normally, each value must be of type `str`,
743
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
744
+ be of type `bytes`.
745
+
746
+ Returns:
747
+ google.cloud.resourcemanager_v3.services.tag_bindings.pagers.ListEffectiveTagsAsyncPager:
748
+ The response of ListEffectiveTags.
749
+
750
+ Iterating over this object will yield
751
+ results and resolve additional pages
752
+ automatically.
753
+
754
+ """
755
+ # Create or coerce a protobuf request object.
756
+ # - Quick check: If we got a request object, we should *not* have
757
+ # gotten any keyword arguments that map to the request.
758
+ flattened_params = [parent]
759
+ has_flattened_params = (
760
+ len([param for param in flattened_params if param is not None]) > 0
761
+ )
762
+ if request is not None and has_flattened_params:
763
+ raise ValueError(
764
+ "If the `request` argument is set, then none of "
765
+ "the individual field arguments should be set."
766
+ )
767
+
768
+ # - Use the request object if provided (there's no risk of modifying the input as
769
+ # there are no flattened fields), or create one.
770
+ if not isinstance(request, tag_bindings.ListEffectiveTagsRequest):
771
+ request = tag_bindings.ListEffectiveTagsRequest(request)
772
+
773
+ # If we have keyword arguments corresponding to fields on the
774
+ # request, apply these.
775
+ if parent is not None:
776
+ request.parent = parent
777
+
778
+ # Wrap the RPC method; this adds retry and timeout information,
779
+ # and friendly error handling.
780
+ rpc = self._client._transport._wrapped_methods[
781
+ self._client._transport.list_effective_tags
782
+ ]
783
+
784
+ # Validate the universe domain.
785
+ self._client._validate_universe_domain()
786
+
787
+ # Send the request.
788
+ response = await rpc(
789
+ request,
790
+ retry=retry,
791
+ timeout=timeout,
792
+ metadata=metadata,
793
+ )
794
+
795
+ # This method is paged; wrap the response in a pager, which provides
796
+ # an `__aiter__` convenience method.
797
+ response = pagers.ListEffectiveTagsAsyncPager(
798
+ method=rpc,
799
+ request=request,
800
+ response=response,
801
+ retry=retry,
802
+ timeout=timeout,
803
+ metadata=metadata,
804
+ )
805
+
806
+ # Done; return the response.
807
+ return response
808
+
809
+ async def get_operation(
810
+ self,
811
+ request: Optional[Union[operations_pb2.GetOperationRequest, dict]] = None,
812
+ *,
813
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
814
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
815
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
816
+ ) -> operations_pb2.Operation:
817
+ r"""Gets the latest state of a long-running operation.
818
+
819
+ Args:
820
+ request (:class:`~.operations_pb2.GetOperationRequest`):
821
+ The request object. Request message for
822
+ `GetOperation` method.
823
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
824
+ if any, should be retried.
825
+ timeout (float): The timeout for this request.
826
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
827
+ sent along with the request as metadata. Normally, each value must be of type `str`,
828
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
829
+ be of type `bytes`.
830
+ Returns:
831
+ ~.operations_pb2.Operation:
832
+ An ``Operation`` object.
833
+ """
834
+ # Create or coerce a protobuf request object.
835
+ # The request isn't a proto-plus wrapped type,
836
+ # so it must be constructed via keyword expansion.
837
+ if request is None:
838
+ request_pb = operations_pb2.GetOperationRequest()
839
+ elif isinstance(request, dict):
840
+ request_pb = operations_pb2.GetOperationRequest(**request)
841
+ else:
842
+ request_pb = request
843
+
844
+ # Wrap the RPC method; this adds retry and timeout information,
845
+ # and friendly error handling.
846
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
847
+
848
+ # Certain fields should be provided within the metadata header;
849
+ # add these here.
850
+ metadata = tuple(metadata) + (
851
+ gapic_v1.routing_header.to_grpc_metadata((("name", request_pb.name),)),
852
+ )
853
+
854
+ # Validate the universe domain.
855
+ self._client._validate_universe_domain()
856
+
857
+ # Send the request.
858
+ response = await rpc(
859
+ request_pb,
860
+ retry=retry,
861
+ timeout=timeout,
862
+ metadata=metadata,
863
+ )
864
+
865
+ # Done; return the response.
866
+ return response
867
+
868
+ async def __aenter__(self) -> "TagBindingsAsyncClient":
869
+ return self
870
+
871
+ async def __aexit__(self, exc_type, exc, tb):
872
+ await self.transport.close()
873
+
874
+
875
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
876
+ gapic_version=package_version.__version__
877
+ )
878
+
879
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
880
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
881
+
882
+
883
+ __all__ = ("TagBindingsAsyncClient",)