assassinlike commited on
Commit
849bf0d
·
verified ·
1 Parent(s): 8f6f13f

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/aiplatform_v1/services/__pycache__/__init__.cpython-311.pyc +0 -0
  2. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/data_foundry_service/__init__.py +22 -0
  3. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/data_foundry_service/async_client.py +1115 -0
  4. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/data_foundry_service/client.py +1603 -0
  5. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/dataset_service/__init__.py +22 -0
  6. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/dataset_service/async_client.py +0 -0
  7. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/dataset_service/client.py +0 -0
  8. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/dataset_service/pagers.py +981 -0
  9. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__init__.py +22 -0
  10. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__pycache__/__init__.cpython-311.pyc +0 -0
  11. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__pycache__/async_client.cpython-311.pyc +0 -0
  12. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__pycache__/client.cpython-311.pyc +0 -0
  13. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__pycache__/pagers.cpython-311.pyc +0 -0
  14. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/async_client.py +1940 -0
  15. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/client.py +0 -0
  16. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/pagers.py +385 -0
  17. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__init__.py +58 -0
  18. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__pycache__/__init__.cpython-311.pyc +0 -0
  19. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__pycache__/base.cpython-311.pyc +0 -0
  20. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__pycache__/grpc.cpython-311.pyc +0 -0
  21. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__pycache__/grpc_asyncio.cpython-311.pyc +0 -0
  22. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__pycache__/rest_base.cpython-311.pyc +0 -0
  23. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/base.py +411 -0
  24. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc.py +749 -0
  25. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc_asyncio.py +847 -0
  26. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest.py +0 -0
  27. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_asyncio.py +0 -0
  28. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_base.py +0 -0
  29. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/endpoint_service/__init__.py +22 -0
  30. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/endpoint_service/async_client.py +0 -0
  31. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/endpoint_service/client.py +0 -0
  32. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/endpoint_service/pagers.py +197 -0
  33. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/__init__.py +22 -0
  34. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/__pycache__/__init__.cpython-311.pyc +0 -0
  35. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/__pycache__/async_client.cpython-311.pyc +0 -0
  36. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/__pycache__/client.cpython-311.pyc +0 -0
  37. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/async_client.py +1103 -0
  38. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/client.py +1591 -0
  39. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__init__.py +54 -0
  40. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/__init__.cpython-311.pyc +0 -0
  41. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/base.cpython-311.pyc +0 -0
  42. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/grpc.cpython-311.pyc +0 -0
  43. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/grpc_asyncio.cpython-311.pyc +0 -0
  44. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/rest.cpython-311.pyc +0 -0
  45. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/rest_asyncio.cpython-311.pyc +0 -0
  46. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/rest_base.cpython-311.pyc +0 -0
  47. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/base.py +326 -0
  48. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc.py +569 -0
  49. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc_asyncio.py +642 -0
  50. data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest.py +2032 -0
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (223 Bytes). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/data_foundry_service/__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 .client import DataFoundryServiceClient
17
+ from .async_client import DataFoundryServiceAsyncClient
18
+
19
+ __all__ = (
20
+ "DataFoundryServiceClient",
21
+ "DataFoundryServiceAsyncClient",
22
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/data_foundry_service/async_client.py ADDED
@@ -0,0 +1,1115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from collections import OrderedDict
18
+ import re
19
+ from typing import (
20
+ Dict,
21
+ Callable,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ from google.cloud.aiplatform_v1 import gapic_version as package_version
33
+
34
+ from google.api_core.client_options import ClientOptions
35
+ from google.api_core import exceptions as core_exceptions
36
+ from google.api_core import gapic_v1
37
+ from google.api_core import retry_async as retries
38
+ from google.auth import credentials as ga_credentials # type: ignore
39
+ from google.oauth2 import service_account # type: ignore
40
+ import google.protobuf
41
+
42
+
43
+ try:
44
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
45
+ except AttributeError: # pragma: NO COVER
46
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
47
+
48
+ from google.cloud.aiplatform_v1.types import data_foundry_service
49
+ from google.cloud.location import locations_pb2 # type: ignore
50
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
51
+ from google.iam.v1 import policy_pb2 # type: ignore
52
+ from google.longrunning import operations_pb2 # type: ignore
53
+ from .transports.base import DataFoundryServiceTransport, DEFAULT_CLIENT_INFO
54
+ from .transports.grpc_asyncio import DataFoundryServiceGrpcAsyncIOTransport
55
+ from .client import DataFoundryServiceClient
56
+
57
+ try:
58
+ from google.api_core import client_logging # type: ignore
59
+
60
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
61
+ except ImportError: # pragma: NO COVER
62
+ CLIENT_LOGGING_SUPPORTED = False
63
+
64
+ _LOGGER = std_logging.getLogger(__name__)
65
+
66
+
67
+ class DataFoundryServiceAsyncClient:
68
+ """Service for generating and preparing datasets for Gen AI
69
+ evaluation.
70
+ """
71
+
72
+ _client: DataFoundryServiceClient
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 = DataFoundryServiceClient.DEFAULT_ENDPOINT
77
+ DEFAULT_MTLS_ENDPOINT = DataFoundryServiceClient.DEFAULT_MTLS_ENDPOINT
78
+ _DEFAULT_ENDPOINT_TEMPLATE = DataFoundryServiceClient._DEFAULT_ENDPOINT_TEMPLATE
79
+ _DEFAULT_UNIVERSE = DataFoundryServiceClient._DEFAULT_UNIVERSE
80
+
81
+ common_billing_account_path = staticmethod(
82
+ DataFoundryServiceClient.common_billing_account_path
83
+ )
84
+ parse_common_billing_account_path = staticmethod(
85
+ DataFoundryServiceClient.parse_common_billing_account_path
86
+ )
87
+ common_folder_path = staticmethod(DataFoundryServiceClient.common_folder_path)
88
+ parse_common_folder_path = staticmethod(
89
+ DataFoundryServiceClient.parse_common_folder_path
90
+ )
91
+ common_organization_path = staticmethod(
92
+ DataFoundryServiceClient.common_organization_path
93
+ )
94
+ parse_common_organization_path = staticmethod(
95
+ DataFoundryServiceClient.parse_common_organization_path
96
+ )
97
+ common_project_path = staticmethod(DataFoundryServiceClient.common_project_path)
98
+ parse_common_project_path = staticmethod(
99
+ DataFoundryServiceClient.parse_common_project_path
100
+ )
101
+ common_location_path = staticmethod(DataFoundryServiceClient.common_location_path)
102
+ parse_common_location_path = staticmethod(
103
+ DataFoundryServiceClient.parse_common_location_path
104
+ )
105
+
106
+ @classmethod
107
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
108
+ """Creates an instance of this client using the provided credentials
109
+ info.
110
+
111
+ Args:
112
+ info (dict): The service account private key info.
113
+ args: Additional arguments to pass to the constructor.
114
+ kwargs: Additional arguments to pass to the constructor.
115
+
116
+ Returns:
117
+ DataFoundryServiceAsyncClient: The constructed client.
118
+ """
119
+ sa_info_func = (
120
+ DataFoundryServiceClient.from_service_account_info.__func__ # type: ignore
121
+ )
122
+ return sa_info_func(DataFoundryServiceAsyncClient, info, *args, **kwargs)
123
+
124
+ @classmethod
125
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
126
+ """Creates an instance of this client using the provided credentials
127
+ file.
128
+
129
+ Args:
130
+ filename (str): The path to the service account private key json
131
+ file.
132
+ args: Additional arguments to pass to the constructor.
133
+ kwargs: Additional arguments to pass to the constructor.
134
+
135
+ Returns:
136
+ DataFoundryServiceAsyncClient: The constructed client.
137
+ """
138
+ sa_file_func = (
139
+ DataFoundryServiceClient.from_service_account_file.__func__ # type: ignore
140
+ )
141
+ return sa_file_func(DataFoundryServiceAsyncClient, filename, *args, **kwargs)
142
+
143
+ from_service_account_json = from_service_account_file
144
+
145
+ @classmethod
146
+ def get_mtls_endpoint_and_cert_source(
147
+ cls, client_options: Optional[ClientOptions] = None
148
+ ):
149
+ """Return the API endpoint and client cert source for mutual TLS.
150
+
151
+ The client cert source is determined in the following order:
152
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
153
+ client cert source is None.
154
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
155
+ default client cert source exists, use the default one; otherwise the client cert
156
+ source is None.
157
+
158
+ The API endpoint is determined in the following order:
159
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
160
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
161
+ default mTLS endpoint; if the environment variable is "never", use the default API
162
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
163
+ use the default API endpoint.
164
+
165
+ More details can be found at https://google.aip.dev/auth/4114.
166
+
167
+ Args:
168
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
169
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
170
+ in this method.
171
+
172
+ Returns:
173
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
174
+ client cert source to use.
175
+
176
+ Raises:
177
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
178
+ """
179
+ return DataFoundryServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
180
+
181
+ @property
182
+ def transport(self) -> DataFoundryServiceTransport:
183
+ """Returns the transport used by the client instance.
184
+
185
+ Returns:
186
+ DataFoundryServiceTransport: The transport used by the client instance.
187
+ """
188
+ return self._client.transport
189
+
190
+ @property
191
+ def api_endpoint(self):
192
+ """Return the API endpoint used by the client instance.
193
+
194
+ Returns:
195
+ str: The API endpoint used by the client instance.
196
+ """
197
+ return self._client._api_endpoint
198
+
199
+ @property
200
+ def universe_domain(self) -> str:
201
+ """Return the universe domain used by the client instance.
202
+
203
+ Returns:
204
+ str: The universe domain used
205
+ by the client instance.
206
+ """
207
+ return self._client._universe_domain
208
+
209
+ get_transport_class = DataFoundryServiceClient.get_transport_class
210
+
211
+ def __init__(
212
+ self,
213
+ *,
214
+ credentials: Optional[ga_credentials.Credentials] = None,
215
+ transport: Optional[
216
+ Union[
217
+ str,
218
+ DataFoundryServiceTransport,
219
+ Callable[..., DataFoundryServiceTransport],
220
+ ]
221
+ ] = "grpc_asyncio",
222
+ client_options: Optional[ClientOptions] = None,
223
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
224
+ ) -> None:
225
+ """Instantiates the data foundry service async client.
226
+
227
+ Args:
228
+ credentials (Optional[google.auth.credentials.Credentials]): The
229
+ authorization credentials to attach to requests. These
230
+ credentials identify the application to the service; if none
231
+ are specified, the client will attempt to ascertain the
232
+ credentials from the environment.
233
+ transport (Optional[Union[str,DataFoundryServiceTransport,Callable[..., DataFoundryServiceTransport]]]):
234
+ The transport to use, or a Callable that constructs and returns a new transport to use.
235
+ If a Callable is given, it will be called with the same set of initialization
236
+ arguments as used in the DataFoundryServiceTransport constructor.
237
+ If set to None, a transport is chosen automatically.
238
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
239
+ Custom options for the client.
240
+
241
+ 1. The ``api_endpoint`` property can be used to override the
242
+ default endpoint provided by the client when ``transport`` is
243
+ not explicitly provided. Only if this property is not set and
244
+ ``transport`` was not explicitly provided, the endpoint is
245
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
246
+ variable, which have one of the following values:
247
+ "always" (always use the default mTLS endpoint), "never" (always
248
+ use the default regular endpoint) and "auto" (auto-switch to the
249
+ default mTLS endpoint if client certificate is present; this is
250
+ the default value).
251
+
252
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
253
+ is "true", then the ``client_cert_source`` property can be used
254
+ to provide a client certificate for mTLS transport. If
255
+ not provided, the default SSL client certificate will be used if
256
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
257
+ set, no client certificate will be used.
258
+
259
+ 3. The ``universe_domain`` property can be used to override the
260
+ default "googleapis.com" universe. Note that ``api_endpoint``
261
+ property still takes precedence; and ``universe_domain`` is
262
+ currently not supported for mTLS.
263
+
264
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
265
+ The client info used to send a user-agent string along with
266
+ API requests. If ``None``, then default info will be used.
267
+ Generally, you only need to set this if you're developing
268
+ your own client library.
269
+
270
+ Raises:
271
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
272
+ creation failed for any reason.
273
+ """
274
+ self._client = DataFoundryServiceClient(
275
+ credentials=credentials,
276
+ transport=transport,
277
+ client_options=client_options,
278
+ client_info=client_info,
279
+ )
280
+
281
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
282
+ std_logging.DEBUG
283
+ ): # pragma: NO COVER
284
+ _LOGGER.debug(
285
+ "Created client `google.cloud.aiplatform_v1.DataFoundryServiceAsyncClient`.",
286
+ extra=(
287
+ {
288
+ "serviceName": "google.cloud.aiplatform.v1.DataFoundryService",
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.aiplatform.v1.DataFoundryService",
300
+ "credentialsType": None,
301
+ }
302
+ ),
303
+ )
304
+
305
+ async def generate_synthetic_data(
306
+ self,
307
+ request: Optional[
308
+ Union[data_foundry_service.GenerateSyntheticDataRequest, dict]
309
+ ] = None,
310
+ *,
311
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
312
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
313
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
314
+ ) -> data_foundry_service.GenerateSyntheticDataResponse:
315
+ r"""Generates synthetic data based on the provided
316
+ configuration.
317
+
318
+ .. code-block:: python
319
+
320
+ # This snippet has been automatically generated and should be regarded as a
321
+ # code template only.
322
+ # It will require modifications to work:
323
+ # - It may require correct/in-range values for request initialization.
324
+ # - It may require specifying regional endpoints when creating the service
325
+ # client as shown in:
326
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
327
+ from google.cloud import aiplatform_v1
328
+
329
+ async def sample_generate_synthetic_data():
330
+ # Create a client
331
+ client = aiplatform_v1.DataFoundryServiceAsyncClient()
332
+
333
+ # Initialize request argument(s)
334
+ task_description = aiplatform_v1.TaskDescriptionStrategy()
335
+ task_description.task_description = "task_description_value"
336
+
337
+ output_field_specs = aiplatform_v1.OutputFieldSpec()
338
+ output_field_specs.field_name = "field_name_value"
339
+
340
+ request = aiplatform_v1.GenerateSyntheticDataRequest(
341
+ task_description=task_description,
342
+ location="location_value",
343
+ count=553,
344
+ output_field_specs=output_field_specs,
345
+ )
346
+
347
+ # Make the request
348
+ response = await client.generate_synthetic_data(request=request)
349
+
350
+ # Handle the response
351
+ print(response)
352
+
353
+ Args:
354
+ request (Optional[Union[google.cloud.aiplatform_v1.types.GenerateSyntheticDataRequest, dict]]):
355
+ The request object. Request message for
356
+ DataFoundryService.GenerateSyntheticData.
357
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
358
+ should be retried.
359
+ timeout (float): The timeout for this request.
360
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
361
+ sent along with the request as metadata. Normally, each value must be of type `str`,
362
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
363
+ be of type `bytes`.
364
+
365
+ Returns:
366
+ google.cloud.aiplatform_v1.types.GenerateSyntheticDataResponse:
367
+ The response containing the generated
368
+ data.
369
+
370
+ """
371
+ # Create or coerce a protobuf request object.
372
+ # - Use the request object if provided (there's no risk of modifying the input as
373
+ # there are no flattened fields), or create one.
374
+ if not isinstance(request, data_foundry_service.GenerateSyntheticDataRequest):
375
+ request = data_foundry_service.GenerateSyntheticDataRequest(request)
376
+
377
+ # Wrap the RPC method; this adds retry and timeout information,
378
+ # and friendly error handling.
379
+ rpc = self._client._transport._wrapped_methods[
380
+ self._client._transport.generate_synthetic_data
381
+ ]
382
+
383
+ # Certain fields should be provided within the metadata header;
384
+ # add these here.
385
+ metadata = tuple(metadata) + (
386
+ gapic_v1.routing_header.to_grpc_metadata((("location", request.location),)),
387
+ )
388
+
389
+ # Validate the universe domain.
390
+ self._client._validate_universe_domain()
391
+
392
+ # Send the request.
393
+ response = await rpc(
394
+ request,
395
+ retry=retry,
396
+ timeout=timeout,
397
+ metadata=metadata,
398
+ )
399
+
400
+ # Done; return the response.
401
+ return response
402
+
403
+ async def list_operations(
404
+ self,
405
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
406
+ *,
407
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
408
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
409
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
410
+ ) -> operations_pb2.ListOperationsResponse:
411
+ r"""Lists operations that match the specified filter in the request.
412
+
413
+ Args:
414
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
415
+ The request object. Request message for
416
+ `ListOperations` method.
417
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
418
+ if any, should be retried.
419
+ timeout (float): The timeout for this request.
420
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
421
+ sent along with the request as metadata. Normally, each value must be of type `str`,
422
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
423
+ be of type `bytes`.
424
+ Returns:
425
+ ~.operations_pb2.ListOperationsResponse:
426
+ Response message for ``ListOperations`` method.
427
+ """
428
+ # Create or coerce a protobuf request object.
429
+ # The request isn't a proto-plus wrapped type,
430
+ # so it must be constructed via keyword expansion.
431
+ if isinstance(request, dict):
432
+ request = operations_pb2.ListOperationsRequest(**request)
433
+
434
+ # Wrap the RPC method; this adds retry and timeout information,
435
+ # and friendly error handling.
436
+ rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
437
+
438
+ # Certain fields should be provided within the metadata header;
439
+ # add these here.
440
+ metadata = tuple(metadata) + (
441
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
442
+ )
443
+
444
+ # Validate the universe domain.
445
+ self._client._validate_universe_domain()
446
+
447
+ # Send the request.
448
+ response = await rpc(
449
+ request,
450
+ retry=retry,
451
+ timeout=timeout,
452
+ metadata=metadata,
453
+ )
454
+
455
+ # Done; return the response.
456
+ return response
457
+
458
+ async def get_operation(
459
+ self,
460
+ request: Optional[operations_pb2.GetOperationRequest] = None,
461
+ *,
462
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
463
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
464
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
465
+ ) -> operations_pb2.Operation:
466
+ r"""Gets the latest state of a long-running operation.
467
+
468
+ Args:
469
+ request (:class:`~.operations_pb2.GetOperationRequest`):
470
+ The request object. Request message for
471
+ `GetOperation` method.
472
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
473
+ if any, should be retried.
474
+ timeout (float): The timeout for this request.
475
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
476
+ sent along with the request as metadata. Normally, each value must be of type `str`,
477
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
478
+ be of type `bytes`.
479
+ Returns:
480
+ ~.operations_pb2.Operation:
481
+ An ``Operation`` object.
482
+ """
483
+ # Create or coerce a protobuf request object.
484
+ # The request isn't a proto-plus wrapped type,
485
+ # so it must be constructed via keyword expansion.
486
+ if isinstance(request, dict):
487
+ request = operations_pb2.GetOperationRequest(**request)
488
+
489
+ # Wrap the RPC method; this adds retry and timeout information,
490
+ # and friendly error handling.
491
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
492
+
493
+ # Certain fields should be provided within the metadata header;
494
+ # add these here.
495
+ metadata = tuple(metadata) + (
496
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
497
+ )
498
+
499
+ # Validate the universe domain.
500
+ self._client._validate_universe_domain()
501
+
502
+ # Send the request.
503
+ response = await rpc(
504
+ request,
505
+ retry=retry,
506
+ timeout=timeout,
507
+ metadata=metadata,
508
+ )
509
+
510
+ # Done; return the response.
511
+ return response
512
+
513
+ async def delete_operation(
514
+ self,
515
+ request: Optional[operations_pb2.DeleteOperationRequest] = None,
516
+ *,
517
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
518
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
519
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
520
+ ) -> None:
521
+ r"""Deletes a long-running operation.
522
+
523
+ This method indicates that the client is no longer interested
524
+ in the operation result. It does not cancel the operation.
525
+ If the server doesn't support this method, it returns
526
+ `google.rpc.Code.UNIMPLEMENTED`.
527
+
528
+ Args:
529
+ request (:class:`~.operations_pb2.DeleteOperationRequest`):
530
+ The request object. Request message for
531
+ `DeleteOperation` method.
532
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
533
+ if any, should be retried.
534
+ timeout (float): The timeout for this request.
535
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
536
+ sent along with the request as metadata. Normally, each value must be of type `str`,
537
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
538
+ be of type `bytes`.
539
+ Returns:
540
+ None
541
+ """
542
+ # Create or coerce a protobuf request object.
543
+ # The request isn't a proto-plus wrapped type,
544
+ # so it must be constructed via keyword expansion.
545
+ if isinstance(request, dict):
546
+ request = operations_pb2.DeleteOperationRequest(**request)
547
+
548
+ # Wrap the RPC method; this adds retry and timeout information,
549
+ # and friendly error handling.
550
+ rpc = self.transport._wrapped_methods[self._client._transport.delete_operation]
551
+
552
+ # Certain fields should be provided within the metadata header;
553
+ # add these here.
554
+ metadata = tuple(metadata) + (
555
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
556
+ )
557
+
558
+ # Validate the universe domain.
559
+ self._client._validate_universe_domain()
560
+
561
+ # Send the request.
562
+ await rpc(
563
+ request,
564
+ retry=retry,
565
+ timeout=timeout,
566
+ metadata=metadata,
567
+ )
568
+
569
+ async def cancel_operation(
570
+ self,
571
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
572
+ *,
573
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
574
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
575
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
576
+ ) -> None:
577
+ r"""Starts asynchronous cancellation on a long-running operation.
578
+
579
+ The server makes a best effort to cancel the operation, but success
580
+ is not guaranteed. If the server doesn't support this method, it returns
581
+ `google.rpc.Code.UNIMPLEMENTED`.
582
+
583
+ Args:
584
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
585
+ The request object. Request message for
586
+ `CancelOperation` method.
587
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
588
+ if any, should be retried.
589
+ timeout (float): The timeout for this request.
590
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
591
+ sent along with the request as metadata. Normally, each value must be of type `str`,
592
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
593
+ be of type `bytes`.
594
+ Returns:
595
+ None
596
+ """
597
+ # Create or coerce a protobuf request object.
598
+ # The request isn't a proto-plus wrapped type,
599
+ # so it must be constructed via keyword expansion.
600
+ if isinstance(request, dict):
601
+ request = operations_pb2.CancelOperationRequest(**request)
602
+
603
+ # Wrap the RPC method; this adds retry and timeout information,
604
+ # and friendly error handling.
605
+ rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
606
+
607
+ # Certain fields should be provided within the metadata header;
608
+ # add these here.
609
+ metadata = tuple(metadata) + (
610
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
611
+ )
612
+
613
+ # Validate the universe domain.
614
+ self._client._validate_universe_domain()
615
+
616
+ # Send the request.
617
+ await rpc(
618
+ request,
619
+ retry=retry,
620
+ timeout=timeout,
621
+ metadata=metadata,
622
+ )
623
+
624
+ async def wait_operation(
625
+ self,
626
+ request: Optional[operations_pb2.WaitOperationRequest] = None,
627
+ *,
628
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
629
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
630
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
631
+ ) -> operations_pb2.Operation:
632
+ r"""Waits until the specified long-running operation is done or reaches at most
633
+ a specified timeout, returning the latest state.
634
+
635
+ If the operation is already done, the latest state is immediately returned.
636
+ If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
637
+ timeout is used. If the server does not support this method, it returns
638
+ `google.rpc.Code.UNIMPLEMENTED`.
639
+
640
+ Args:
641
+ request (:class:`~.operations_pb2.WaitOperationRequest`):
642
+ The request object. Request message for
643
+ `WaitOperation` method.
644
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
645
+ if any, should be retried.
646
+ timeout (float): The timeout for this request.
647
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
648
+ sent along with the request as metadata. Normally, each value must be of type `str`,
649
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
650
+ be of type `bytes`.
651
+ Returns:
652
+ ~.operations_pb2.Operation:
653
+ An ``Operation`` object.
654
+ """
655
+ # Create or coerce a protobuf request object.
656
+ # The request isn't a proto-plus wrapped type,
657
+ # so it must be constructed via keyword expansion.
658
+ if isinstance(request, dict):
659
+ request = operations_pb2.WaitOperationRequest(**request)
660
+
661
+ # Wrap the RPC method; this adds retry and timeout information,
662
+ # and friendly error handling.
663
+ rpc = self.transport._wrapped_methods[self._client._transport.wait_operation]
664
+
665
+ # Certain fields should be provided within the metadata header;
666
+ # add these here.
667
+ metadata = tuple(metadata) + (
668
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
669
+ )
670
+
671
+ # Validate the universe domain.
672
+ self._client._validate_universe_domain()
673
+
674
+ # Send the request.
675
+ response = await rpc(
676
+ request,
677
+ retry=retry,
678
+ timeout=timeout,
679
+ metadata=metadata,
680
+ )
681
+
682
+ # Done; return the response.
683
+ return response
684
+
685
+ async def set_iam_policy(
686
+ self,
687
+ request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
688
+ *,
689
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
690
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
691
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
692
+ ) -> policy_pb2.Policy:
693
+ r"""Sets the IAM access control policy on the specified function.
694
+
695
+ Replaces any existing policy.
696
+
697
+ Args:
698
+ request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`):
699
+ The request object. Request message for `SetIamPolicy`
700
+ method.
701
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
702
+ should be retried.
703
+ timeout (float): The timeout for this request.
704
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
705
+ sent along with the request as metadata. Normally, each value must be of type `str`,
706
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
707
+ be of type `bytes`.
708
+ Returns:
709
+ ~.policy_pb2.Policy:
710
+ Defines an Identity and Access Management (IAM) policy.
711
+ It is used to specify access control policies for Cloud
712
+ Platform resources.
713
+ A ``Policy`` is a collection of ``bindings``. A
714
+ ``binding`` binds one or more ``members`` to a single
715
+ ``role``. Members can be user accounts, service
716
+ accounts, Google groups, and domains (such as G Suite).
717
+ A ``role`` is a named list of permissions (defined by
718
+ IAM or configured by users). A ``binding`` can
719
+ optionally specify a ``condition``, which is a logic
720
+ expression that further constrains the role binding
721
+ based on attributes about the request and/or target
722
+ resource.
723
+
724
+ **JSON Example**
725
+
726
+ ::
727
+
728
+ {
729
+ "bindings": [
730
+ {
731
+ "role": "roles/resourcemanager.organizationAdmin",
732
+ "members": [
733
+ "user:mike@example.com",
734
+ "group:admins@example.com",
735
+ "domain:google.com",
736
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
737
+ ]
738
+ },
739
+ {
740
+ "role": "roles/resourcemanager.organizationViewer",
741
+ "members": ["user:eve@example.com"],
742
+ "condition": {
743
+ "title": "expirable access",
744
+ "description": "Does not grant access after Sep 2020",
745
+ "expression": "request.time <
746
+ timestamp('2020-10-01T00:00:00.000Z')",
747
+ }
748
+ }
749
+ ]
750
+ }
751
+
752
+ **YAML Example**
753
+
754
+ ::
755
+
756
+ bindings:
757
+ - members:
758
+ - user:mike@example.com
759
+ - group:admins@example.com
760
+ - domain:google.com
761
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
762
+ role: roles/resourcemanager.organizationAdmin
763
+ - members:
764
+ - user:eve@example.com
765
+ role: roles/resourcemanager.organizationViewer
766
+ condition:
767
+ title: expirable access
768
+ description: Does not grant access after Sep 2020
769
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
770
+
771
+ For a description of IAM and its features, see the `IAM
772
+ developer's
773
+ guide <https://cloud.google.com/iam/docs>`__.
774
+ """
775
+ # Create or coerce a protobuf request object.
776
+
777
+ # The request isn't a proto-plus wrapped type,
778
+ # so it must be constructed via keyword expansion.
779
+ if isinstance(request, dict):
780
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
781
+
782
+ # Wrap the RPC method; this adds retry and timeout information,
783
+ # and friendly error handling.
784
+ rpc = self.transport._wrapped_methods[self._client._transport.set_iam_policy]
785
+
786
+ # Certain fields should be provided within the metadata header;
787
+ # add these here.
788
+ metadata = tuple(metadata) + (
789
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
790
+ )
791
+
792
+ # Validate the universe domain.
793
+ self._client._validate_universe_domain()
794
+
795
+ # Send the request.
796
+ response = await rpc(
797
+ request,
798
+ retry=retry,
799
+ timeout=timeout,
800
+ metadata=metadata,
801
+ )
802
+
803
+ # Done; return the response.
804
+ return response
805
+
806
+ async def get_iam_policy(
807
+ self,
808
+ request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
809
+ *,
810
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
811
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
812
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
813
+ ) -> policy_pb2.Policy:
814
+ r"""Gets the IAM access control policy for a function.
815
+
816
+ Returns an empty policy if the function exists and does not have a
817
+ policy set.
818
+
819
+ Args:
820
+ request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
821
+ The request object. Request message for `GetIamPolicy`
822
+ method.
823
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if
824
+ 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
+ ~.policy_pb2.Policy:
832
+ Defines an Identity and Access Management (IAM) policy.
833
+ It is used to specify access control policies for Cloud
834
+ Platform resources.
835
+ A ``Policy`` is a collection of ``bindings``. A
836
+ ``binding`` binds one or more ``members`` to a single
837
+ ``role``. Members can be user accounts, service
838
+ accounts, Google groups, and domains (such as G Suite).
839
+ A ``role`` is a named list of permissions (defined by
840
+ IAM or configured by users). A ``binding`` can
841
+ optionally specify a ``condition``, which is a logic
842
+ expression that further constrains the role binding
843
+ based on attributes about the request and/or target
844
+ resource.
845
+
846
+ **JSON Example**
847
+
848
+ ::
849
+
850
+ {
851
+ "bindings": [
852
+ {
853
+ "role": "roles/resourcemanager.organizationAdmin",
854
+ "members": [
855
+ "user:mike@example.com",
856
+ "group:admins@example.com",
857
+ "domain:google.com",
858
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
859
+ ]
860
+ },
861
+ {
862
+ "role": "roles/resourcemanager.organizationViewer",
863
+ "members": ["user:eve@example.com"],
864
+ "condition": {
865
+ "title": "expirable access",
866
+ "description": "Does not grant access after Sep 2020",
867
+ "expression": "request.time <
868
+ timestamp('2020-10-01T00:00:00.000Z')",
869
+ }
870
+ }
871
+ ]
872
+ }
873
+
874
+ **YAML Example**
875
+
876
+ ::
877
+
878
+ bindings:
879
+ - members:
880
+ - user:mike@example.com
881
+ - group:admins@example.com
882
+ - domain:google.com
883
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
884
+ role: roles/resourcemanager.organizationAdmin
885
+ - members:
886
+ - user:eve@example.com
887
+ role: roles/resourcemanager.organizationViewer
888
+ condition:
889
+ title: expirable access
890
+ description: Does not grant access after Sep 2020
891
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
892
+
893
+ For a description of IAM and its features, see the `IAM
894
+ developer's
895
+ guide <https://cloud.google.com/iam/docs>`__.
896
+ """
897
+ # Create or coerce a protobuf request object.
898
+
899
+ # The request isn't a proto-plus wrapped type,
900
+ # so it must be constructed via keyword expansion.
901
+ if isinstance(request, dict):
902
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
903
+
904
+ # Wrap the RPC method; this adds retry and timeout information,
905
+ # and friendly error handling.
906
+ rpc = self.transport._wrapped_methods[self._client._transport.get_iam_policy]
907
+
908
+ # Certain fields should be provided within the metadata header;
909
+ # add these here.
910
+ metadata = tuple(metadata) + (
911
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
912
+ )
913
+
914
+ # Validate the universe domain.
915
+ self._client._validate_universe_domain()
916
+
917
+ # Send the request.
918
+ response = await rpc(
919
+ request,
920
+ retry=retry,
921
+ timeout=timeout,
922
+ metadata=metadata,
923
+ )
924
+
925
+ # Done; return the response.
926
+ return response
927
+
928
+ async def test_iam_permissions(
929
+ self,
930
+ request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
931
+ *,
932
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
933
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
934
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
935
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
936
+ r"""Tests the specified IAM permissions against the IAM access control
937
+ policy for a function.
938
+
939
+ If the function does not exist, this will return an empty set
940
+ of permissions, not a NOT_FOUND error.
941
+
942
+ Args:
943
+ request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
944
+ The request object. Request message for
945
+ `TestIamPermissions` method.
946
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
947
+ if any, should be retried.
948
+ timeout (float): The timeout for this request.
949
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
950
+ sent along with the request as metadata. Normally, each value must be of type `str`,
951
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
952
+ be of type `bytes`.
953
+ Returns:
954
+ ~.iam_policy_pb2.TestIamPermissionsResponse:
955
+ Response message for ``TestIamPermissions`` method.
956
+ """
957
+ # Create or coerce a protobuf request object.
958
+
959
+ # The request isn't a proto-plus wrapped type,
960
+ # so it must be constructed via keyword expansion.
961
+ if isinstance(request, dict):
962
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
963
+
964
+ # Wrap the RPC method; this adds retry and timeout information,
965
+ # and friendly error handling.
966
+ rpc = self.transport._wrapped_methods[
967
+ self._client._transport.test_iam_permissions
968
+ ]
969
+
970
+ # Certain fields should be provided within the metadata header;
971
+ # add these here.
972
+ metadata = tuple(metadata) + (
973
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
974
+ )
975
+
976
+ # Validate the universe domain.
977
+ self._client._validate_universe_domain()
978
+
979
+ # Send the request.
980
+ response = await rpc(
981
+ request,
982
+ retry=retry,
983
+ timeout=timeout,
984
+ metadata=metadata,
985
+ )
986
+
987
+ # Done; return the response.
988
+ return response
989
+
990
+ async def get_location(
991
+ self,
992
+ request: Optional[locations_pb2.GetLocationRequest] = None,
993
+ *,
994
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
995
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
996
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
997
+ ) -> locations_pb2.Location:
998
+ r"""Gets information about a location.
999
+
1000
+ Args:
1001
+ request (:class:`~.location_pb2.GetLocationRequest`):
1002
+ The request object. Request message for
1003
+ `GetLocation` method.
1004
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1005
+ if any, should be retried.
1006
+ timeout (float): The timeout for this request.
1007
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1008
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1009
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1010
+ be of type `bytes`.
1011
+ Returns:
1012
+ ~.location_pb2.Location:
1013
+ Location object.
1014
+ """
1015
+ # Create or coerce a protobuf request object.
1016
+ # The request isn't a proto-plus wrapped type,
1017
+ # so it must be constructed via keyword expansion.
1018
+ if isinstance(request, dict):
1019
+ request = locations_pb2.GetLocationRequest(**request)
1020
+
1021
+ # Wrap the RPC method; this adds retry and timeout information,
1022
+ # and friendly error handling.
1023
+ rpc = self.transport._wrapped_methods[self._client._transport.get_location]
1024
+
1025
+ # Certain fields should be provided within the metadata header;
1026
+ # add these here.
1027
+ metadata = tuple(metadata) + (
1028
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1029
+ )
1030
+
1031
+ # Validate the universe domain.
1032
+ self._client._validate_universe_domain()
1033
+
1034
+ # Send the request.
1035
+ response = await rpc(
1036
+ request,
1037
+ retry=retry,
1038
+ timeout=timeout,
1039
+ metadata=metadata,
1040
+ )
1041
+
1042
+ # Done; return the response.
1043
+ return response
1044
+
1045
+ async def list_locations(
1046
+ self,
1047
+ request: Optional[locations_pb2.ListLocationsRequest] = None,
1048
+ *,
1049
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1050
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1051
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1052
+ ) -> locations_pb2.ListLocationsResponse:
1053
+ r"""Lists information about the supported locations for this service.
1054
+
1055
+ Args:
1056
+ request (:class:`~.location_pb2.ListLocationsRequest`):
1057
+ The request object. Request message for
1058
+ `ListLocations` method.
1059
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1060
+ if any, should be retried.
1061
+ timeout (float): The timeout for this request.
1062
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1063
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1064
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1065
+ be of type `bytes`.
1066
+ Returns:
1067
+ ~.location_pb2.ListLocationsResponse:
1068
+ Response message for ``ListLocations`` method.
1069
+ """
1070
+ # Create or coerce a protobuf request object.
1071
+ # The request isn't a proto-plus wrapped type,
1072
+ # so it must be constructed via keyword expansion.
1073
+ if isinstance(request, dict):
1074
+ request = locations_pb2.ListLocationsRequest(**request)
1075
+
1076
+ # Wrap the RPC method; this adds retry and timeout information,
1077
+ # and friendly error handling.
1078
+ rpc = self.transport._wrapped_methods[self._client._transport.list_locations]
1079
+
1080
+ # Certain fields should be provided within the metadata header;
1081
+ # add these here.
1082
+ metadata = tuple(metadata) + (
1083
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1084
+ )
1085
+
1086
+ # Validate the universe domain.
1087
+ self._client._validate_universe_domain()
1088
+
1089
+ # Send the request.
1090
+ response = await rpc(
1091
+ request,
1092
+ retry=retry,
1093
+ timeout=timeout,
1094
+ metadata=metadata,
1095
+ )
1096
+
1097
+ # Done; return the response.
1098
+ return response
1099
+
1100
+ async def __aenter__(self) -> "DataFoundryServiceAsyncClient":
1101
+ return self
1102
+
1103
+ async def __aexit__(self, exc_type, exc, tb):
1104
+ await self.transport.close()
1105
+
1106
+
1107
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1108
+ gapic_version=package_version.__version__
1109
+ )
1110
+
1111
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1112
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1113
+
1114
+
1115
+ __all__ = ("DataFoundryServiceAsyncClient",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/data_foundry_service/client.py ADDED
@@ -0,0 +1,1603 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 http import HTTPStatus
18
+ import json
19
+ import logging as std_logging
20
+ import os
21
+ import re
22
+ from typing import (
23
+ Dict,
24
+ Callable,
25
+ Mapping,
26
+ MutableMapping,
27
+ MutableSequence,
28
+ Optional,
29
+ Sequence,
30
+ Tuple,
31
+ Type,
32
+ Union,
33
+ cast,
34
+ )
35
+ import warnings
36
+
37
+ from google.cloud.aiplatform_v1 import gapic_version as package_version
38
+
39
+ from google.api_core import client_options as client_options_lib
40
+ from google.api_core import exceptions as core_exceptions
41
+ from google.api_core import gapic_v1
42
+ from google.api_core import retry as retries
43
+ from google.auth import credentials as ga_credentials # type: ignore
44
+ from google.auth.transport import mtls # type: ignore
45
+ from google.auth.transport.grpc import SslCredentials # type: ignore
46
+ from google.auth.exceptions import MutualTLSChannelError # type: ignore
47
+ from google.oauth2 import service_account # type: ignore
48
+ import google.protobuf
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
+ from google.cloud.aiplatform_v1.types import data_foundry_service
65
+ from google.cloud.location import locations_pb2 # type: ignore
66
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
67
+ from google.iam.v1 import policy_pb2 # type: ignore
68
+ from google.longrunning import operations_pb2 # type: ignore
69
+ from .transports.base import DataFoundryServiceTransport, DEFAULT_CLIENT_INFO
70
+ from .transports.grpc import DataFoundryServiceGrpcTransport
71
+ from .transports.grpc_asyncio import DataFoundryServiceGrpcAsyncIOTransport
72
+ from .transports.rest import DataFoundryServiceRestTransport
73
+
74
+ try:
75
+ from .transports.rest_asyncio import AsyncDataFoundryServiceRestTransport
76
+
77
+ HAS_ASYNC_REST_DEPENDENCIES = True
78
+ except ImportError as e: # pragma: NO COVER
79
+ HAS_ASYNC_REST_DEPENDENCIES = False
80
+ ASYNC_REST_EXCEPTION = e
81
+
82
+
83
+ class DataFoundryServiceClientMeta(type):
84
+ """Metaclass for the DataFoundryService client.
85
+
86
+ This provides class-level methods for building and retrieving
87
+ support objects (e.g. transport) without polluting the client instance
88
+ objects.
89
+ """
90
+
91
+ _transport_registry = (
92
+ OrderedDict()
93
+ ) # type: Dict[str, Type[DataFoundryServiceTransport]]
94
+ _transport_registry["grpc"] = DataFoundryServiceGrpcTransport
95
+ _transport_registry["grpc_asyncio"] = DataFoundryServiceGrpcAsyncIOTransport
96
+ _transport_registry["rest"] = DataFoundryServiceRestTransport
97
+ if HAS_ASYNC_REST_DEPENDENCIES: # pragma: NO COVER
98
+ _transport_registry["rest_asyncio"] = AsyncDataFoundryServiceRestTransport
99
+
100
+ def get_transport_class(
101
+ cls,
102
+ label: Optional[str] = None,
103
+ ) -> Type[DataFoundryServiceTransport]:
104
+ """Returns an appropriate transport class.
105
+
106
+ Args:
107
+ label: The name of the desired transport. If none is
108
+ provided, then the first transport in the registry is used.
109
+
110
+ Returns:
111
+ The transport class to use.
112
+ """
113
+ # If a specific transport is requested, return that one.
114
+ if (
115
+ label == "rest_asyncio" and not HAS_ASYNC_REST_DEPENDENCIES
116
+ ): # pragma: NO COVER
117
+ raise ASYNC_REST_EXCEPTION
118
+ if label:
119
+ return cls._transport_registry[label]
120
+
121
+ # No transport is requested; return the default (that is, the first one
122
+ # in the dictionary).
123
+ return next(iter(cls._transport_registry.values()))
124
+
125
+
126
+ class DataFoundryServiceClient(metaclass=DataFoundryServiceClientMeta):
127
+ """Service for generating and preparing datasets for Gen AI
128
+ evaluation.
129
+ """
130
+
131
+ @staticmethod
132
+ def _get_default_mtls_endpoint(api_endpoint):
133
+ """Converts api endpoint to mTLS endpoint.
134
+
135
+ Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
136
+ "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
137
+ Args:
138
+ api_endpoint (Optional[str]): the api endpoint to convert.
139
+ Returns:
140
+ str: converted mTLS api endpoint.
141
+ """
142
+ if not api_endpoint:
143
+ return api_endpoint
144
+
145
+ mtls_endpoint_re = re.compile(
146
+ r"(?P<name>[^.]+)(?P<mtls>\.mtls)?(?P<sandbox>\.sandbox)?(?P<googledomain>\.googleapis\.com)?"
147
+ )
148
+
149
+ m = mtls_endpoint_re.match(api_endpoint)
150
+ name, mtls, sandbox, googledomain = m.groups()
151
+ if mtls or not googledomain:
152
+ return api_endpoint
153
+
154
+ if sandbox:
155
+ return api_endpoint.replace(
156
+ "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
157
+ )
158
+
159
+ return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
160
+
161
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
162
+ DEFAULT_ENDPOINT = "aiplatform.googleapis.com"
163
+ DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
164
+ DEFAULT_ENDPOINT
165
+ )
166
+
167
+ _DEFAULT_ENDPOINT_TEMPLATE = "aiplatform.{UNIVERSE_DOMAIN}"
168
+ _DEFAULT_UNIVERSE = "googleapis.com"
169
+
170
+ @staticmethod
171
+ def _use_client_cert_effective():
172
+ """Returns whether client certificate should be used for mTLS if the
173
+ google-auth version supports should_use_client_cert automatic mTLS enablement.
174
+
175
+ Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.
176
+
177
+ Returns:
178
+ bool: whether client certificate should be used for mTLS
179
+ Raises:
180
+ ValueError: (If using a version of google-auth without should_use_client_cert and
181
+ GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
182
+ """
183
+ # check if google-auth version supports should_use_client_cert for automatic mTLS enablement
184
+ if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER
185
+ return mtls.should_use_client_cert()
186
+ else: # pragma: NO COVER
187
+ # if unsupported, fallback to reading from env var
188
+ use_client_cert_str = os.getenv(
189
+ "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
190
+ ).lower()
191
+ if use_client_cert_str not in ("true", "false"):
192
+ raise ValueError(
193
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
194
+ " either `true` or `false`"
195
+ )
196
+ return use_client_cert_str == "true"
197
+
198
+ @classmethod
199
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
200
+ """Creates an instance of this client using the provided credentials
201
+ info.
202
+
203
+ Args:
204
+ info (dict): The service account private key info.
205
+ args: Additional arguments to pass to the constructor.
206
+ kwargs: Additional arguments to pass to the constructor.
207
+
208
+ Returns:
209
+ DataFoundryServiceClient: The constructed client.
210
+ """
211
+ credentials = service_account.Credentials.from_service_account_info(info)
212
+ kwargs["credentials"] = credentials
213
+ return cls(*args, **kwargs)
214
+
215
+ @classmethod
216
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
217
+ """Creates an instance of this client using the provided credentials
218
+ file.
219
+
220
+ Args:
221
+ filename (str): The path to the service account private key json
222
+ file.
223
+ args: Additional arguments to pass to the constructor.
224
+ kwargs: Additional arguments to pass to the constructor.
225
+
226
+ Returns:
227
+ DataFoundryServiceClient: The constructed client.
228
+ """
229
+ credentials = service_account.Credentials.from_service_account_file(filename)
230
+ kwargs["credentials"] = credentials
231
+ return cls(*args, **kwargs)
232
+
233
+ from_service_account_json = from_service_account_file
234
+
235
+ @property
236
+ def transport(self) -> DataFoundryServiceTransport:
237
+ """Returns the transport used by the client instance.
238
+
239
+ Returns:
240
+ DataFoundryServiceTransport: The transport used by the client
241
+ instance.
242
+ """
243
+ return self._transport
244
+
245
+ @staticmethod
246
+ def common_billing_account_path(
247
+ billing_account: str,
248
+ ) -> str:
249
+ """Returns a fully-qualified billing_account string."""
250
+ return "billingAccounts/{billing_account}".format(
251
+ billing_account=billing_account,
252
+ )
253
+
254
+ @staticmethod
255
+ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
256
+ """Parse a billing_account path into its component segments."""
257
+ m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path)
258
+ return m.groupdict() if m else {}
259
+
260
+ @staticmethod
261
+ def common_folder_path(
262
+ folder: str,
263
+ ) -> str:
264
+ """Returns a fully-qualified folder string."""
265
+ return "folders/{folder}".format(
266
+ folder=folder,
267
+ )
268
+
269
+ @staticmethod
270
+ def parse_common_folder_path(path: str) -> Dict[str, str]:
271
+ """Parse a folder path into its component segments."""
272
+ m = re.match(r"^folders/(?P<folder>.+?)$", path)
273
+ return m.groupdict() if m else {}
274
+
275
+ @staticmethod
276
+ def common_organization_path(
277
+ organization: str,
278
+ ) -> str:
279
+ """Returns a fully-qualified organization string."""
280
+ return "organizations/{organization}".format(
281
+ organization=organization,
282
+ )
283
+
284
+ @staticmethod
285
+ def parse_common_organization_path(path: str) -> Dict[str, str]:
286
+ """Parse a organization path into its component segments."""
287
+ m = re.match(r"^organizations/(?P<organization>.+?)$", path)
288
+ return m.groupdict() if m else {}
289
+
290
+ @staticmethod
291
+ def common_project_path(
292
+ project: str,
293
+ ) -> str:
294
+ """Returns a fully-qualified project string."""
295
+ return "projects/{project}".format(
296
+ project=project,
297
+ )
298
+
299
+ @staticmethod
300
+ def parse_common_project_path(path: str) -> Dict[str, str]:
301
+ """Parse a project path into its component segments."""
302
+ m = re.match(r"^projects/(?P<project>.+?)$", path)
303
+ return m.groupdict() if m else {}
304
+
305
+ @staticmethod
306
+ def common_location_path(
307
+ project: str,
308
+ location: str,
309
+ ) -> str:
310
+ """Returns a fully-qualified location string."""
311
+ return "projects/{project}/locations/{location}".format(
312
+ project=project,
313
+ location=location,
314
+ )
315
+
316
+ @staticmethod
317
+ def parse_common_location_path(path: str) -> Dict[str, str]:
318
+ """Parse a location path into its component segments."""
319
+ m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path)
320
+ return m.groupdict() if m else {}
321
+
322
+ @classmethod
323
+ def get_mtls_endpoint_and_cert_source(
324
+ cls, client_options: Optional[client_options_lib.ClientOptions] = None
325
+ ):
326
+ """Deprecated. Return the API endpoint and client cert source for mutual TLS.
327
+
328
+ The client cert source is determined in the following order:
329
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
330
+ client cert source is None.
331
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
332
+ default client cert source exists, use the default one; otherwise the client cert
333
+ source is None.
334
+
335
+ The API endpoint is determined in the following order:
336
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
337
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
338
+ default mTLS endpoint; if the environment variable is "never", use the default API
339
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
340
+ use the default API endpoint.
341
+
342
+ More details can be found at https://google.aip.dev/auth/4114.
343
+
344
+ Args:
345
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
346
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
347
+ in this method.
348
+
349
+ Returns:
350
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
351
+ client cert source to use.
352
+
353
+ Raises:
354
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
355
+ """
356
+
357
+ warnings.warn(
358
+ "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.",
359
+ DeprecationWarning,
360
+ )
361
+ if client_options is None:
362
+ client_options = client_options_lib.ClientOptions()
363
+ use_client_cert = DataFoundryServiceClient._use_client_cert_effective()
364
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
365
+ if use_mtls_endpoint not in ("auto", "never", "always"):
366
+ raise MutualTLSChannelError(
367
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
368
+ )
369
+
370
+ # Figure out the client cert source to use.
371
+ client_cert_source = None
372
+ if use_client_cert:
373
+ if client_options.client_cert_source:
374
+ client_cert_source = client_options.client_cert_source
375
+ elif mtls.has_default_client_cert_source():
376
+ client_cert_source = mtls.default_client_cert_source()
377
+
378
+ # Figure out which api endpoint to use.
379
+ if client_options.api_endpoint is not None:
380
+ api_endpoint = client_options.api_endpoint
381
+ elif use_mtls_endpoint == "always" or (
382
+ use_mtls_endpoint == "auto" and client_cert_source
383
+ ):
384
+ api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
385
+ else:
386
+ api_endpoint = cls.DEFAULT_ENDPOINT
387
+
388
+ return api_endpoint, client_cert_source
389
+
390
+ @staticmethod
391
+ def _read_environment_variables():
392
+ """Returns the environment variables used by the client.
393
+
394
+ Returns:
395
+ Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
396
+ GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.
397
+
398
+ Raises:
399
+ ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
400
+ any of ["true", "false"].
401
+ google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
402
+ is not any of ["auto", "never", "always"].
403
+ """
404
+ use_client_cert = DataFoundryServiceClient._use_client_cert_effective()
405
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
406
+ universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
407
+ if use_mtls_endpoint not in ("auto", "never", "always"):
408
+ raise MutualTLSChannelError(
409
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
410
+ )
411
+ return use_client_cert, use_mtls_endpoint, universe_domain_env
412
+
413
+ @staticmethod
414
+ def _get_client_cert_source(provided_cert_source, use_cert_flag):
415
+ """Return the client cert source to be used by the client.
416
+
417
+ Args:
418
+ provided_cert_source (bytes): The client certificate source provided.
419
+ use_cert_flag (bool): A flag indicating whether to use the client certificate.
420
+
421
+ Returns:
422
+ bytes or None: The client cert source to be used by the client.
423
+ """
424
+ client_cert_source = None
425
+ if use_cert_flag:
426
+ if provided_cert_source:
427
+ client_cert_source = provided_cert_source
428
+ elif mtls.has_default_client_cert_source():
429
+ client_cert_source = mtls.default_client_cert_source()
430
+ return client_cert_source
431
+
432
+ @staticmethod
433
+ def _get_api_endpoint(
434
+ api_override, client_cert_source, universe_domain, use_mtls_endpoint
435
+ ):
436
+ """Return the API endpoint used by the client.
437
+
438
+ Args:
439
+ api_override (str): The API endpoint override. If specified, this is always
440
+ the return value of this function and the other arguments are not used.
441
+ client_cert_source (bytes): The client certificate source used by the client.
442
+ universe_domain (str): The universe domain used by the client.
443
+ use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
444
+ Possible values are "always", "auto", or "never".
445
+
446
+ Returns:
447
+ str: The API endpoint to be used by the client.
448
+ """
449
+ if api_override is not None:
450
+ api_endpoint = api_override
451
+ elif use_mtls_endpoint == "always" or (
452
+ use_mtls_endpoint == "auto" and client_cert_source
453
+ ):
454
+ _default_universe = DataFoundryServiceClient._DEFAULT_UNIVERSE
455
+ if universe_domain != _default_universe:
456
+ raise MutualTLSChannelError(
457
+ f"mTLS is not supported in any universe other than {_default_universe}."
458
+ )
459
+ api_endpoint = DataFoundryServiceClient.DEFAULT_MTLS_ENDPOINT
460
+ else:
461
+ api_endpoint = DataFoundryServiceClient._DEFAULT_ENDPOINT_TEMPLATE.format(
462
+ UNIVERSE_DOMAIN=universe_domain
463
+ )
464
+ return api_endpoint
465
+
466
+ @staticmethod
467
+ def _get_universe_domain(
468
+ client_universe_domain: Optional[str], universe_domain_env: Optional[str]
469
+ ) -> str:
470
+ """Return the universe domain used by the client.
471
+
472
+ Args:
473
+ client_universe_domain (Optional[str]): The universe domain configured via the client options.
474
+ universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
475
+
476
+ Returns:
477
+ str: The universe domain to be used by the client.
478
+
479
+ Raises:
480
+ ValueError: If the universe domain is an empty string.
481
+ """
482
+ universe_domain = DataFoundryServiceClient._DEFAULT_UNIVERSE
483
+ if client_universe_domain is not None:
484
+ universe_domain = client_universe_domain
485
+ elif universe_domain_env is not None:
486
+ universe_domain = universe_domain_env
487
+ if len(universe_domain.strip()) == 0:
488
+ raise ValueError("Universe Domain cannot be an empty string.")
489
+ return universe_domain
490
+
491
+ def _validate_universe_domain(self):
492
+ """Validates client's and credentials' universe domains are consistent.
493
+
494
+ Returns:
495
+ bool: True iff the configured universe domain is valid.
496
+
497
+ Raises:
498
+ ValueError: If the configured universe domain is not valid.
499
+ """
500
+
501
+ # NOTE (b/349488459): universe validation is disabled until further notice.
502
+ return True
503
+
504
+ def _add_cred_info_for_auth_errors(
505
+ self, error: core_exceptions.GoogleAPICallError
506
+ ) -> None:
507
+ """Adds credential info string to error details for 401/403/404 errors.
508
+
509
+ Args:
510
+ error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
511
+ """
512
+ if error.code not in [
513
+ HTTPStatus.UNAUTHORIZED,
514
+ HTTPStatus.FORBIDDEN,
515
+ HTTPStatus.NOT_FOUND,
516
+ ]:
517
+ return
518
+
519
+ cred = self._transport._credentials
520
+
521
+ # get_cred_info is only available in google-auth>=2.35.0
522
+ if not hasattr(cred, "get_cred_info"):
523
+ return
524
+
525
+ # ignore the type check since pypy test fails when get_cred_info
526
+ # is not available
527
+ cred_info = cred.get_cred_info() # type: ignore
528
+ if cred_info and hasattr(error._details, "append"):
529
+ error._details.append(json.dumps(cred_info))
530
+
531
+ @property
532
+ def api_endpoint(self):
533
+ """Return the API endpoint used by the client instance.
534
+
535
+ Returns:
536
+ str: The API endpoint used by the client instance.
537
+ """
538
+ return self._api_endpoint
539
+
540
+ @property
541
+ def universe_domain(self) -> str:
542
+ """Return the universe domain used by the client instance.
543
+
544
+ Returns:
545
+ str: The universe domain used by the client instance.
546
+ """
547
+ return self._universe_domain
548
+
549
+ def __init__(
550
+ self,
551
+ *,
552
+ credentials: Optional[ga_credentials.Credentials] = None,
553
+ transport: Optional[
554
+ Union[
555
+ str,
556
+ DataFoundryServiceTransport,
557
+ Callable[..., DataFoundryServiceTransport],
558
+ ]
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 data foundry service 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,DataFoundryServiceTransport,Callable[..., DataFoundryServiceTransport]]]):
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 DataFoundryServiceTransport 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
+ DataFoundryServiceClient._read_environment_variables()
625
+ )
626
+ self._client_cert_source = DataFoundryServiceClient._get_client_cert_source(
627
+ self._client_options.client_cert_source, self._use_client_cert
628
+ )
629
+ self._universe_domain = DataFoundryServiceClient._get_universe_domain(
630
+ universe_domain_opt, self._universe_domain_env
631
+ )
632
+ self._api_endpoint = None # 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, DataFoundryServiceTransport)
651
+ if transport_provided:
652
+ # transport is a DataFoundryServiceTransport 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 "
661
+ "directly."
662
+ )
663
+ self._transport = cast(DataFoundryServiceTransport, transport)
664
+ self._api_endpoint = self._transport.host
665
+
666
+ self._api_endpoint = (
667
+ self._api_endpoint
668
+ or DataFoundryServiceClient._get_api_endpoint(
669
+ self._client_options.api_endpoint,
670
+ self._client_cert_source,
671
+ self._universe_domain,
672
+ self._use_mtls_endpoint,
673
+ )
674
+ )
675
+
676
+ if not transport_provided:
677
+ transport_init: Union[
678
+ Type[DataFoundryServiceTransport],
679
+ Callable[..., DataFoundryServiceTransport],
680
+ ] = (
681
+ DataFoundryServiceClient.get_transport_class(transport)
682
+ if isinstance(transport, str) or transport is None
683
+ else cast(Callable[..., DataFoundryServiceTransport], transport)
684
+ )
685
+
686
+ if "rest_asyncio" in str(transport_init):
687
+ unsupported_params = {
688
+ "google.api_core.client_options.ClientOptions.credentials_file": self._client_options.credentials_file,
689
+ "google.api_core.client_options.ClientOptions.scopes": self._client_options.scopes,
690
+ "google.api_core.client_options.ClientOptions.quota_project_id": self._client_options.quota_project_id,
691
+ "google.api_core.client_options.ClientOptions.client_cert_source": self._client_options.client_cert_source,
692
+ "google.api_core.client_options.ClientOptions.api_audience": self._client_options.api_audience,
693
+ }
694
+ provided_unsupported_params = [
695
+ name
696
+ for name, value in unsupported_params.items()
697
+ if value is not None
698
+ ]
699
+ if provided_unsupported_params:
700
+ raise core_exceptions.AsyncRestUnsupportedParameterError( # type: ignore
701
+ f"The following provided parameters are not supported for `transport=rest_asyncio`: {', '.join(provided_unsupported_params)}"
702
+ )
703
+ self._transport = transport_init(
704
+ credentials=credentials,
705
+ host=self._api_endpoint,
706
+ client_info=client_info,
707
+ )
708
+ return
709
+
710
+ import google.auth._default # type: ignore
711
+
712
+ if api_key_value and hasattr(
713
+ google.auth._default, "get_api_key_credentials"
714
+ ):
715
+ credentials = google.auth._default.get_api_key_credentials(
716
+ api_key_value
717
+ )
718
+
719
+ # initialize with the provided callable or the passed in class
720
+ self._transport = transport_init(
721
+ credentials=credentials,
722
+ credentials_file=self._client_options.credentials_file,
723
+ host=self._api_endpoint,
724
+ scopes=self._client_options.scopes,
725
+ client_cert_source_for_mtls=self._client_cert_source,
726
+ quota_project_id=self._client_options.quota_project_id,
727
+ client_info=client_info,
728
+ always_use_jwt_access=True,
729
+ api_audience=self._client_options.api_audience,
730
+ )
731
+
732
+ if "async" not in str(self._transport):
733
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
734
+ std_logging.DEBUG
735
+ ): # pragma: NO COVER
736
+ _LOGGER.debug(
737
+ "Created client `google.cloud.aiplatform_v1.DataFoundryServiceClient`.",
738
+ extra=(
739
+ {
740
+ "serviceName": "google.cloud.aiplatform.v1.DataFoundryService",
741
+ "universeDomain": getattr(
742
+ self._transport._credentials, "universe_domain", ""
743
+ ),
744
+ "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
745
+ "credentialsInfo": getattr(
746
+ self.transport._credentials,
747
+ "get_cred_info",
748
+ lambda: None,
749
+ )(),
750
+ }
751
+ if hasattr(self._transport, "_credentials")
752
+ else {
753
+ "serviceName": "google.cloud.aiplatform.v1.DataFoundryService",
754
+ "credentialsType": None,
755
+ }
756
+ ),
757
+ )
758
+
759
+ def generate_synthetic_data(
760
+ self,
761
+ request: Optional[
762
+ Union[data_foundry_service.GenerateSyntheticDataRequest, dict]
763
+ ] = None,
764
+ *,
765
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
766
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
767
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
768
+ ) -> data_foundry_service.GenerateSyntheticDataResponse:
769
+ r"""Generates synthetic data based on the provided
770
+ configuration.
771
+
772
+ .. code-block:: python
773
+
774
+ # This snippet has been automatically generated and should be regarded as a
775
+ # code template only.
776
+ # It will require modifications to work:
777
+ # - It may require correct/in-range values for request initialization.
778
+ # - It may require specifying regional endpoints when creating the service
779
+ # client as shown in:
780
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
781
+ from google.cloud import aiplatform_v1
782
+
783
+ def sample_generate_synthetic_data():
784
+ # Create a client
785
+ client = aiplatform_v1.DataFoundryServiceClient()
786
+
787
+ # Initialize request argument(s)
788
+ task_description = aiplatform_v1.TaskDescriptionStrategy()
789
+ task_description.task_description = "task_description_value"
790
+
791
+ output_field_specs = aiplatform_v1.OutputFieldSpec()
792
+ output_field_specs.field_name = "field_name_value"
793
+
794
+ request = aiplatform_v1.GenerateSyntheticDataRequest(
795
+ task_description=task_description,
796
+ location="location_value",
797
+ count=553,
798
+ output_field_specs=output_field_specs,
799
+ )
800
+
801
+ # Make the request
802
+ response = client.generate_synthetic_data(request=request)
803
+
804
+ # Handle the response
805
+ print(response)
806
+
807
+ Args:
808
+ request (Union[google.cloud.aiplatform_v1.types.GenerateSyntheticDataRequest, dict]):
809
+ The request object. Request message for
810
+ DataFoundryService.GenerateSyntheticData.
811
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
812
+ should be retried.
813
+ timeout (float): The timeout for this request.
814
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
815
+ sent along with the request as metadata. Normally, each value must be of type `str`,
816
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
817
+ be of type `bytes`.
818
+
819
+ Returns:
820
+ google.cloud.aiplatform_v1.types.GenerateSyntheticDataResponse:
821
+ The response containing the generated
822
+ data.
823
+
824
+ """
825
+ # Create or coerce a protobuf request object.
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, data_foundry_service.GenerateSyntheticDataRequest):
829
+ request = data_foundry_service.GenerateSyntheticDataRequest(request)
830
+
831
+ # Wrap the RPC method; this adds retry and timeout information,
832
+ # and friendly error handling.
833
+ rpc = self._transport._wrapped_methods[self._transport.generate_synthetic_data]
834
+
835
+ # Certain fields should be provided within the metadata header;
836
+ # add these here.
837
+ metadata = tuple(metadata) + (
838
+ gapic_v1.routing_header.to_grpc_metadata((("location", request.location),)),
839
+ )
840
+
841
+ # Validate the universe domain.
842
+ self._validate_universe_domain()
843
+
844
+ # Send the request.
845
+ response = rpc(
846
+ request,
847
+ retry=retry,
848
+ timeout=timeout,
849
+ metadata=metadata,
850
+ )
851
+
852
+ # Done; return the response.
853
+ return response
854
+
855
+ def __enter__(self) -> "DataFoundryServiceClient":
856
+ return self
857
+
858
+ def __exit__(self, type, value, traceback):
859
+ """Releases underlying transport's resources.
860
+
861
+ .. warning::
862
+ ONLY use as a context manager if the transport is NOT shared
863
+ with other clients! Exiting the with block will CLOSE the transport
864
+ and may cause errors in other clients!
865
+ """
866
+ self.transport.close()
867
+
868
+ def list_operations(
869
+ self,
870
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
871
+ *,
872
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
873
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
874
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
875
+ ) -> operations_pb2.ListOperationsResponse:
876
+ r"""Lists operations that match the specified filter in the request.
877
+
878
+ Args:
879
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
880
+ The request object. Request message for
881
+ `ListOperations` method.
882
+ retry (google.api_core.retry.Retry): Designation of what errors,
883
+ if any, should be retried.
884
+ timeout (float): The timeout for this request.
885
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
886
+ sent along with the request as metadata. Normally, each value must be of type `str`,
887
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
888
+ be of type `bytes`.
889
+ Returns:
890
+ ~.operations_pb2.ListOperationsResponse:
891
+ Response message for ``ListOperations`` method.
892
+ """
893
+ # Create or coerce a protobuf request object.
894
+ # The request isn't a proto-plus wrapped type,
895
+ # so it must be constructed via keyword expansion.
896
+ if isinstance(request, dict):
897
+ request = operations_pb2.ListOperationsRequest(**request)
898
+
899
+ # Wrap the RPC method; this adds retry and timeout information,
900
+ # and friendly error handling.
901
+ rpc = self._transport._wrapped_methods[self._transport.list_operations]
902
+
903
+ # Certain fields should be provided within the metadata header;
904
+ # add these here.
905
+ metadata = tuple(metadata) + (
906
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
907
+ )
908
+
909
+ # Validate the universe domain.
910
+ self._validate_universe_domain()
911
+
912
+ try:
913
+ # Send the request.
914
+ response = rpc(
915
+ request,
916
+ retry=retry,
917
+ timeout=timeout,
918
+ metadata=metadata,
919
+ )
920
+
921
+ # Done; return the response.
922
+ return response
923
+ except core_exceptions.GoogleAPICallError as e:
924
+ self._add_cred_info_for_auth_errors(e)
925
+ raise e
926
+
927
+ def get_operation(
928
+ self,
929
+ request: Optional[operations_pb2.GetOperationRequest] = None,
930
+ *,
931
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
932
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
933
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
934
+ ) -> operations_pb2.Operation:
935
+ r"""Gets the latest state of a long-running operation.
936
+
937
+ Args:
938
+ request (:class:`~.operations_pb2.GetOperationRequest`):
939
+ The request object. Request message for
940
+ `GetOperation` method.
941
+ retry (google.api_core.retry.Retry): Designation of what errors,
942
+ if any, should be retried.
943
+ timeout (float): The timeout for this request.
944
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
945
+ sent along with the request as metadata. Normally, each value must be of type `str`,
946
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
947
+ be of type `bytes`.
948
+ Returns:
949
+ ~.operations_pb2.Operation:
950
+ An ``Operation`` object.
951
+ """
952
+ # Create or coerce a protobuf request object.
953
+ # The request isn't a proto-plus wrapped type,
954
+ # so it must be constructed via keyword expansion.
955
+ if isinstance(request, dict):
956
+ request = operations_pb2.GetOperationRequest(**request)
957
+
958
+ # Wrap the RPC method; this adds retry and timeout information,
959
+ # and friendly error handling.
960
+ rpc = self._transport._wrapped_methods[self._transport.get_operation]
961
+
962
+ # Certain fields should be provided within the metadata header;
963
+ # add these here.
964
+ metadata = tuple(metadata) + (
965
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
966
+ )
967
+
968
+ # Validate the universe domain.
969
+ self._validate_universe_domain()
970
+
971
+ try:
972
+ # Send the request.
973
+ response = rpc(
974
+ request,
975
+ retry=retry,
976
+ timeout=timeout,
977
+ metadata=metadata,
978
+ )
979
+
980
+ # Done; return the response.
981
+ return response
982
+ except core_exceptions.GoogleAPICallError as e:
983
+ self._add_cred_info_for_auth_errors(e)
984
+ raise e
985
+
986
+ def delete_operation(
987
+ self,
988
+ request: Optional[operations_pb2.DeleteOperationRequest] = None,
989
+ *,
990
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
991
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
992
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
993
+ ) -> None:
994
+ r"""Deletes a long-running operation.
995
+
996
+ This method indicates that the client is no longer interested
997
+ in the operation result. It does not cancel the operation.
998
+ If the server doesn't support this method, it returns
999
+ `google.rpc.Code.UNIMPLEMENTED`.
1000
+
1001
+ Args:
1002
+ request (:class:`~.operations_pb2.DeleteOperationRequest`):
1003
+ The request object. Request message for
1004
+ `DeleteOperation` method.
1005
+ retry (google.api_core.retry.Retry): Designation of what errors,
1006
+ if any, should be retried.
1007
+ timeout (float): The timeout for this request.
1008
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1009
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1010
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1011
+ be of type `bytes`.
1012
+ Returns:
1013
+ None
1014
+ """
1015
+ # Create or coerce a protobuf request object.
1016
+ # The request isn't a proto-plus wrapped type,
1017
+ # so it must be constructed via keyword expansion.
1018
+ if isinstance(request, dict):
1019
+ request = operations_pb2.DeleteOperationRequest(**request)
1020
+
1021
+ # Wrap the RPC method; this adds retry and timeout information,
1022
+ # and friendly error handling.
1023
+ rpc = self._transport._wrapped_methods[self._transport.delete_operation]
1024
+
1025
+ # Certain fields should be provided within the metadata header;
1026
+ # add these here.
1027
+ metadata = tuple(metadata) + (
1028
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1029
+ )
1030
+
1031
+ # Validate the universe domain.
1032
+ self._validate_universe_domain()
1033
+
1034
+ # Send the request.
1035
+ rpc(
1036
+ request,
1037
+ retry=retry,
1038
+ timeout=timeout,
1039
+ metadata=metadata,
1040
+ )
1041
+
1042
+ def cancel_operation(
1043
+ self,
1044
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
1045
+ *,
1046
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1047
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1048
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1049
+ ) -> None:
1050
+ r"""Starts asynchronous cancellation on a long-running operation.
1051
+
1052
+ The server makes a best effort to cancel the operation, but success
1053
+ is not guaranteed. If the server doesn't support this method, it returns
1054
+ `google.rpc.Code.UNIMPLEMENTED`.
1055
+
1056
+ Args:
1057
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
1058
+ The request object. Request message for
1059
+ `CancelOperation` method.
1060
+ retry (google.api_core.retry.Retry): Designation of what errors,
1061
+ if any, should be retried.
1062
+ timeout (float): The timeout for this request.
1063
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1064
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1065
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1066
+ be of type `bytes`.
1067
+ Returns:
1068
+ None
1069
+ """
1070
+ # Create or coerce a protobuf request object.
1071
+ # The request isn't a proto-plus wrapped type,
1072
+ # so it must be constructed via keyword expansion.
1073
+ if isinstance(request, dict):
1074
+ request = operations_pb2.CancelOperationRequest(**request)
1075
+
1076
+ # Wrap the RPC method; this adds retry and timeout information,
1077
+ # and friendly error handling.
1078
+ rpc = self._transport._wrapped_methods[self._transport.cancel_operation]
1079
+
1080
+ # Certain fields should be provided within the metadata header;
1081
+ # add these here.
1082
+ metadata = tuple(metadata) + (
1083
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1084
+ )
1085
+
1086
+ # Validate the universe domain.
1087
+ self._validate_universe_domain()
1088
+
1089
+ # Send the request.
1090
+ rpc(
1091
+ request,
1092
+ retry=retry,
1093
+ timeout=timeout,
1094
+ metadata=metadata,
1095
+ )
1096
+
1097
+ def wait_operation(
1098
+ self,
1099
+ request: Optional[operations_pb2.WaitOperationRequest] = None,
1100
+ *,
1101
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1102
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1103
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1104
+ ) -> operations_pb2.Operation:
1105
+ r"""Waits until the specified long-running operation is done or reaches at most
1106
+ a specified timeout, returning the latest state.
1107
+
1108
+ If the operation is already done, the latest state is immediately returned.
1109
+ If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
1110
+ timeout is used. If the server does not support this method, it returns
1111
+ `google.rpc.Code.UNIMPLEMENTED`.
1112
+
1113
+ Args:
1114
+ request (:class:`~.operations_pb2.WaitOperationRequest`):
1115
+ The request object. Request message for
1116
+ `WaitOperation` method.
1117
+ retry (google.api_core.retry.Retry): Designation of what errors,
1118
+ if any, should be retried.
1119
+ timeout (float): The timeout for this request.
1120
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1121
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1122
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1123
+ be of type `bytes`.
1124
+ Returns:
1125
+ ~.operations_pb2.Operation:
1126
+ An ``Operation`` object.
1127
+ """
1128
+ # Create or coerce a protobuf request object.
1129
+ # The request isn't a proto-plus wrapped type,
1130
+ # so it must be constructed via keyword expansion.
1131
+ if isinstance(request, dict):
1132
+ request = operations_pb2.WaitOperationRequest(**request)
1133
+
1134
+ # Wrap the RPC method; this adds retry and timeout information,
1135
+ # and friendly error handling.
1136
+ rpc = self._transport._wrapped_methods[self._transport.wait_operation]
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._validate_universe_domain()
1146
+
1147
+ try:
1148
+ # Send the request.
1149
+ response = rpc(
1150
+ request,
1151
+ retry=retry,
1152
+ timeout=timeout,
1153
+ metadata=metadata,
1154
+ )
1155
+
1156
+ # Done; return the response.
1157
+ return response
1158
+ except core_exceptions.GoogleAPICallError as e:
1159
+ self._add_cred_info_for_auth_errors(e)
1160
+ raise e
1161
+
1162
+ def set_iam_policy(
1163
+ self,
1164
+ request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
1165
+ *,
1166
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1167
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1168
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1169
+ ) -> policy_pb2.Policy:
1170
+ r"""Sets the IAM access control policy on the specified function.
1171
+
1172
+ Replaces any existing policy.
1173
+
1174
+ Args:
1175
+ request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`):
1176
+ The request object. Request message for `SetIamPolicy`
1177
+ method.
1178
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1179
+ should be retried.
1180
+ timeout (float): The timeout for this request.
1181
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1182
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1183
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1184
+ be of type `bytes`.
1185
+ Returns:
1186
+ ~.policy_pb2.Policy:
1187
+ Defines an Identity and Access Management (IAM) policy.
1188
+ It is used to specify access control policies for Cloud
1189
+ Platform resources.
1190
+ A ``Policy`` is a collection of ``bindings``. A
1191
+ ``binding`` binds one or more ``members`` to a single
1192
+ ``role``. Members can be user accounts, service
1193
+ accounts, Google groups, and domains (such as G Suite).
1194
+ A ``role`` is a named list of permissions (defined by
1195
+ IAM or configured by users). A ``binding`` can
1196
+ optionally specify a ``condition``, which is a logic
1197
+ expression that further constrains the role binding
1198
+ based on attributes about the request and/or target
1199
+ resource.
1200
+
1201
+ **JSON Example**
1202
+
1203
+ ::
1204
+
1205
+ {
1206
+ "bindings": [
1207
+ {
1208
+ "role": "roles/resourcemanager.organizationAdmin",
1209
+ "members": [
1210
+ "user:mike@example.com",
1211
+ "group:admins@example.com",
1212
+ "domain:google.com",
1213
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
1214
+ ]
1215
+ },
1216
+ {
1217
+ "role": "roles/resourcemanager.organizationViewer",
1218
+ "members": ["user:eve@example.com"],
1219
+ "condition": {
1220
+ "title": "expirable access",
1221
+ "description": "Does not grant access after Sep 2020",
1222
+ "expression": "request.time <
1223
+ timestamp('2020-10-01T00:00:00.000Z')",
1224
+ }
1225
+ }
1226
+ ]
1227
+ }
1228
+
1229
+ **YAML Example**
1230
+
1231
+ ::
1232
+
1233
+ bindings:
1234
+ - members:
1235
+ - user:mike@example.com
1236
+ - group:admins@example.com
1237
+ - domain:google.com
1238
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
1239
+ role: roles/resourcemanager.organizationAdmin
1240
+ - members:
1241
+ - user:eve@example.com
1242
+ role: roles/resourcemanager.organizationViewer
1243
+ condition:
1244
+ title: expirable access
1245
+ description: Does not grant access after Sep 2020
1246
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
1247
+
1248
+ For a description of IAM and its features, see the `IAM
1249
+ developer's
1250
+ guide <https://cloud.google.com/iam/docs>`__.
1251
+ """
1252
+ # Create or coerce a protobuf request object.
1253
+
1254
+ # The request isn't a proto-plus wrapped type,
1255
+ # so it must be constructed via keyword expansion.
1256
+ if isinstance(request, dict):
1257
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
1258
+
1259
+ # Wrap the RPC method; this adds retry and timeout information,
1260
+ # and friendly error handling.
1261
+ rpc = self._transport._wrapped_methods[self._transport.set_iam_policy]
1262
+
1263
+ # Certain fields should be provided within the metadata header;
1264
+ # add these here.
1265
+ metadata = tuple(metadata) + (
1266
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1267
+ )
1268
+
1269
+ # Validate the universe domain.
1270
+ self._validate_universe_domain()
1271
+
1272
+ try:
1273
+ # Send the request.
1274
+ response = rpc(
1275
+ request,
1276
+ retry=retry,
1277
+ timeout=timeout,
1278
+ metadata=metadata,
1279
+ )
1280
+
1281
+ # Done; return the response.
1282
+ return response
1283
+ except core_exceptions.GoogleAPICallError as e:
1284
+ self._add_cred_info_for_auth_errors(e)
1285
+ raise e
1286
+
1287
+ def get_iam_policy(
1288
+ self,
1289
+ request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
1290
+ *,
1291
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1292
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1293
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1294
+ ) -> policy_pb2.Policy:
1295
+ r"""Gets the IAM access control policy for a function.
1296
+
1297
+ Returns an empty policy if the function exists and does not have a
1298
+ policy set.
1299
+
1300
+ Args:
1301
+ request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
1302
+ The request object. Request message for `GetIamPolicy`
1303
+ method.
1304
+ retry (google.api_core.retry.Retry): Designation of what errors, if
1305
+ any, should be retried.
1306
+ timeout (float): The timeout for this request.
1307
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1308
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1309
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1310
+ be of type `bytes`.
1311
+ Returns:
1312
+ ~.policy_pb2.Policy:
1313
+ Defines an Identity and Access Management (IAM) policy.
1314
+ It is used to specify access control policies for Cloud
1315
+ Platform resources.
1316
+ A ``Policy`` is a collection of ``bindings``. A
1317
+ ``binding`` binds one or more ``members`` to a single
1318
+ ``role``. Members can be user accounts, service
1319
+ accounts, Google groups, and domains (such as G Suite).
1320
+ A ``role`` is a named list of permissions (defined by
1321
+ IAM or configured by users). A ``binding`` can
1322
+ optionally specify a ``condition``, which is a logic
1323
+ expression that further constrains the role binding
1324
+ based on attributes about the request and/or target
1325
+ resource.
1326
+
1327
+ **JSON Example**
1328
+
1329
+ ::
1330
+
1331
+ {
1332
+ "bindings": [
1333
+ {
1334
+ "role": "roles/resourcemanager.organizationAdmin",
1335
+ "members": [
1336
+ "user:mike@example.com",
1337
+ "group:admins@example.com",
1338
+ "domain:google.com",
1339
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
1340
+ ]
1341
+ },
1342
+ {
1343
+ "role": "roles/resourcemanager.organizationViewer",
1344
+ "members": ["user:eve@example.com"],
1345
+ "condition": {
1346
+ "title": "expirable access",
1347
+ "description": "Does not grant access after Sep 2020",
1348
+ "expression": "request.time <
1349
+ timestamp('2020-10-01T00:00:00.000Z')",
1350
+ }
1351
+ }
1352
+ ]
1353
+ }
1354
+
1355
+ **YAML Example**
1356
+
1357
+ ::
1358
+
1359
+ bindings:
1360
+ - members:
1361
+ - user:mike@example.com
1362
+ - group:admins@example.com
1363
+ - domain:google.com
1364
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
1365
+ role: roles/resourcemanager.organizationAdmin
1366
+ - members:
1367
+ - user:eve@example.com
1368
+ role: roles/resourcemanager.organizationViewer
1369
+ condition:
1370
+ title: expirable access
1371
+ description: Does not grant access after Sep 2020
1372
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
1373
+
1374
+ For a description of IAM and its features, see the `IAM
1375
+ developer's
1376
+ guide <https://cloud.google.com/iam/docs>`__.
1377
+ """
1378
+ # Create or coerce a protobuf request object.
1379
+
1380
+ # The request isn't a proto-plus wrapped type,
1381
+ # so it must be constructed via keyword expansion.
1382
+ if isinstance(request, dict):
1383
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
1384
+
1385
+ # Wrap the RPC method; this adds retry and timeout information,
1386
+ # and friendly error handling.
1387
+ rpc = self._transport._wrapped_methods[self._transport.get_iam_policy]
1388
+
1389
+ # Certain fields should be provided within the metadata header;
1390
+ # add these here.
1391
+ metadata = tuple(metadata) + (
1392
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1393
+ )
1394
+
1395
+ # Validate the universe domain.
1396
+ self._validate_universe_domain()
1397
+
1398
+ try:
1399
+ # Send the request.
1400
+ response = rpc(
1401
+ request,
1402
+ retry=retry,
1403
+ timeout=timeout,
1404
+ metadata=metadata,
1405
+ )
1406
+
1407
+ # Done; return the response.
1408
+ return response
1409
+ except core_exceptions.GoogleAPICallError as e:
1410
+ self._add_cred_info_for_auth_errors(e)
1411
+ raise e
1412
+
1413
+ def test_iam_permissions(
1414
+ self,
1415
+ request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
1416
+ *,
1417
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1418
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1419
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1420
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1421
+ r"""Tests the specified IAM permissions against the IAM access control
1422
+ policy for a function.
1423
+
1424
+ If the function does not exist, this will return an empty set
1425
+ of permissions, not a NOT_FOUND error.
1426
+
1427
+ Args:
1428
+ request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
1429
+ The request object. Request message for
1430
+ `TestIamPermissions` method.
1431
+ retry (google.api_core.retry.Retry): Designation of what errors,
1432
+ if any, should be retried.
1433
+ timeout (float): The timeout for this request.
1434
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1435
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1436
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1437
+ be of type `bytes`.
1438
+ Returns:
1439
+ ~.iam_policy_pb2.TestIamPermissionsResponse:
1440
+ Response message for ``TestIamPermissions`` method.
1441
+ """
1442
+ # Create or coerce a protobuf request object.
1443
+
1444
+ # The request isn't a proto-plus wrapped type,
1445
+ # so it must be constructed via keyword expansion.
1446
+ if isinstance(request, dict):
1447
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
1448
+
1449
+ # Wrap the RPC method; this adds retry and timeout information,
1450
+ # and friendly error handling.
1451
+ rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions]
1452
+
1453
+ # Certain fields should be provided within the metadata header;
1454
+ # add these here.
1455
+ metadata = tuple(metadata) + (
1456
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1457
+ )
1458
+
1459
+ # Validate the universe domain.
1460
+ self._validate_universe_domain()
1461
+
1462
+ try:
1463
+ # Send the request.
1464
+ response = rpc(
1465
+ request,
1466
+ retry=retry,
1467
+ timeout=timeout,
1468
+ metadata=metadata,
1469
+ )
1470
+
1471
+ # Done; return the response.
1472
+ return response
1473
+ except core_exceptions.GoogleAPICallError as e:
1474
+ self._add_cred_info_for_auth_errors(e)
1475
+ raise e
1476
+
1477
+ def get_location(
1478
+ self,
1479
+ request: Optional[locations_pb2.GetLocationRequest] = None,
1480
+ *,
1481
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1482
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1483
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1484
+ ) -> locations_pb2.Location:
1485
+ r"""Gets information about a location.
1486
+
1487
+ Args:
1488
+ request (:class:`~.location_pb2.GetLocationRequest`):
1489
+ The request object. Request message for
1490
+ `GetLocation` method.
1491
+ retry (google.api_core.retry.Retry): Designation of what errors,
1492
+ if any, should be retried.
1493
+ timeout (float): The timeout for this request.
1494
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1495
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1496
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1497
+ be of type `bytes`.
1498
+ Returns:
1499
+ ~.location_pb2.Location:
1500
+ Location object.
1501
+ """
1502
+ # Create or coerce a protobuf request object.
1503
+ # The request isn't a proto-plus wrapped type,
1504
+ # so it must be constructed via keyword expansion.
1505
+ if isinstance(request, dict):
1506
+ request = locations_pb2.GetLocationRequest(**request)
1507
+
1508
+ # Wrap the RPC method; this adds retry and timeout information,
1509
+ # and friendly error handling.
1510
+ rpc = self._transport._wrapped_methods[self._transport.get_location]
1511
+
1512
+ # Certain fields should be provided within the metadata header;
1513
+ # add these here.
1514
+ metadata = tuple(metadata) + (
1515
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1516
+ )
1517
+
1518
+ # Validate the universe domain.
1519
+ self._validate_universe_domain()
1520
+
1521
+ try:
1522
+ # Send the request.
1523
+ response = rpc(
1524
+ request,
1525
+ retry=retry,
1526
+ timeout=timeout,
1527
+ metadata=metadata,
1528
+ )
1529
+
1530
+ # Done; return the response.
1531
+ return response
1532
+ except core_exceptions.GoogleAPICallError as e:
1533
+ self._add_cred_info_for_auth_errors(e)
1534
+ raise e
1535
+
1536
+ def list_locations(
1537
+ self,
1538
+ request: Optional[locations_pb2.ListLocationsRequest] = None,
1539
+ *,
1540
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1541
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1542
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1543
+ ) -> locations_pb2.ListLocationsResponse:
1544
+ r"""Lists information about the supported locations for this service.
1545
+
1546
+ Args:
1547
+ request (:class:`~.location_pb2.ListLocationsRequest`):
1548
+ The request object. Request message for
1549
+ `ListLocations` method.
1550
+ retry (google.api_core.retry.Retry): Designation of what errors,
1551
+ if any, should be retried.
1552
+ timeout (float): The timeout for this request.
1553
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1554
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1555
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1556
+ be of type `bytes`.
1557
+ Returns:
1558
+ ~.location_pb2.ListLocationsResponse:
1559
+ Response message for ``ListLocations`` method.
1560
+ """
1561
+ # Create or coerce a protobuf request object.
1562
+ # The request isn't a proto-plus wrapped type,
1563
+ # so it must be constructed via keyword expansion.
1564
+ if isinstance(request, dict):
1565
+ request = locations_pb2.ListLocationsRequest(**request)
1566
+
1567
+ # Wrap the RPC method; this adds retry and timeout information,
1568
+ # and friendly error handling.
1569
+ rpc = self._transport._wrapped_methods[self._transport.list_locations]
1570
+
1571
+ # Certain fields should be provided within the metadata header;
1572
+ # add these here.
1573
+ metadata = tuple(metadata) + (
1574
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1575
+ )
1576
+
1577
+ # Validate the universe domain.
1578
+ self._validate_universe_domain()
1579
+
1580
+ try:
1581
+ # Send the request.
1582
+ response = rpc(
1583
+ request,
1584
+ retry=retry,
1585
+ timeout=timeout,
1586
+ metadata=metadata,
1587
+ )
1588
+
1589
+ # Done; return the response.
1590
+ return response
1591
+ except core_exceptions.GoogleAPICallError as e:
1592
+ self._add_cred_info_for_auth_errors(e)
1593
+ raise e
1594
+
1595
+
1596
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1597
+ gapic_version=package_version.__version__
1598
+ )
1599
+
1600
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1601
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1602
+
1603
+ __all__ = ("DataFoundryServiceClient",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/dataset_service/__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 .client import DatasetServiceClient
17
+ from .async_client import DatasetServiceAsyncClient
18
+
19
+ __all__ = (
20
+ "DatasetServiceClient",
21
+ "DatasetServiceAsyncClient",
22
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/dataset_service/async_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/aiplatform_v1/services/dataset_service/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/aiplatform_v1/services/dataset_service/pagers.py ADDED
@@ -0,0 +1,981 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 google.api_core import gapic_v1
17
+ from google.api_core import retry as retries
18
+ from google.api_core import retry_async as retries_async
19
+ from typing import (
20
+ Any,
21
+ AsyncIterator,
22
+ Awaitable,
23
+ Callable,
24
+ Sequence,
25
+ Tuple,
26
+ Optional,
27
+ Iterator,
28
+ Union,
29
+ )
30
+
31
+ try:
32
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
33
+ OptionalAsyncRetry = Union[
34
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
35
+ ]
36
+ except AttributeError: # pragma: NO COVER
37
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
38
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
39
+
40
+ from google.cloud.aiplatform_v1.types import annotation
41
+ from google.cloud.aiplatform_v1.types import data_item
42
+ from google.cloud.aiplatform_v1.types import dataset
43
+ from google.cloud.aiplatform_v1.types import dataset_service
44
+ from google.cloud.aiplatform_v1.types import dataset_version
45
+ from google.cloud.aiplatform_v1.types import saved_query
46
+
47
+
48
+ class ListDatasetsPager:
49
+ """A pager for iterating through ``list_datasets`` requests.
50
+
51
+ This class thinly wraps an initial
52
+ :class:`google.cloud.aiplatform_v1.types.ListDatasetsResponse` object, and
53
+ provides an ``__iter__`` method to iterate through its
54
+ ``datasets`` field.
55
+
56
+ If there are more pages, the ``__iter__`` method will make additional
57
+ ``ListDatasets`` requests and continue to iterate
58
+ through the ``datasets`` field on the
59
+ corresponding responses.
60
+
61
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListDatasetsResponse`
62
+ attributes are available on the pager. If multiple requests are made, only
63
+ the most recent response is retained, and thus used for attribute lookup.
64
+ """
65
+
66
+ def __init__(
67
+ self,
68
+ method: Callable[..., dataset_service.ListDatasetsResponse],
69
+ request: dataset_service.ListDatasetsRequest,
70
+ response: dataset_service.ListDatasetsResponse,
71
+ *,
72
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
73
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
74
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
75
+ ):
76
+ """Instantiate the pager.
77
+
78
+ Args:
79
+ method (Callable): The method that was originally called, and
80
+ which instantiated this pager.
81
+ request (google.cloud.aiplatform_v1.types.ListDatasetsRequest):
82
+ The initial request object.
83
+ response (google.cloud.aiplatform_v1.types.ListDatasetsResponse):
84
+ The initial response object.
85
+ retry (google.api_core.retry.Retry): Designation of what errors,
86
+ if any, should be retried.
87
+ timeout (float): The timeout for this request.
88
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
89
+ sent along with the request as metadata. Normally, each value must be of type `str`,
90
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
91
+ be of type `bytes`.
92
+ """
93
+ self._method = method
94
+ self._request = dataset_service.ListDatasetsRequest(request)
95
+ self._response = response
96
+ self._retry = retry
97
+ self._timeout = timeout
98
+ self._metadata = metadata
99
+
100
+ def __getattr__(self, name: str) -> Any:
101
+ return getattr(self._response, name)
102
+
103
+ @property
104
+ def pages(self) -> Iterator[dataset_service.ListDatasetsResponse]:
105
+ yield self._response
106
+ while self._response.next_page_token:
107
+ self._request.page_token = self._response.next_page_token
108
+ self._response = self._method(
109
+ self._request,
110
+ retry=self._retry,
111
+ timeout=self._timeout,
112
+ metadata=self._metadata,
113
+ )
114
+ yield self._response
115
+
116
+ def __iter__(self) -> Iterator[dataset.Dataset]:
117
+ for page in self.pages:
118
+ yield from page.datasets
119
+
120
+ def __repr__(self) -> str:
121
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
122
+
123
+
124
+ class ListDatasetsAsyncPager:
125
+ """A pager for iterating through ``list_datasets`` requests.
126
+
127
+ This class thinly wraps an initial
128
+ :class:`google.cloud.aiplatform_v1.types.ListDatasetsResponse` object, and
129
+ provides an ``__aiter__`` method to iterate through its
130
+ ``datasets`` field.
131
+
132
+ If there are more pages, the ``__aiter__`` method will make additional
133
+ ``ListDatasets`` requests and continue to iterate
134
+ through the ``datasets`` field on the
135
+ corresponding responses.
136
+
137
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListDatasetsResponse`
138
+ attributes are available on the pager. If multiple requests are made, only
139
+ the most recent response is retained, and thus used for attribute lookup.
140
+ """
141
+
142
+ def __init__(
143
+ self,
144
+ method: Callable[..., Awaitable[dataset_service.ListDatasetsResponse]],
145
+ request: dataset_service.ListDatasetsRequest,
146
+ response: dataset_service.ListDatasetsResponse,
147
+ *,
148
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
149
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
150
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
151
+ ):
152
+ """Instantiates the pager.
153
+
154
+ Args:
155
+ method (Callable): The method that was originally called, and
156
+ which instantiated this pager.
157
+ request (google.cloud.aiplatform_v1.types.ListDatasetsRequest):
158
+ The initial request object.
159
+ response (google.cloud.aiplatform_v1.types.ListDatasetsResponse):
160
+ The initial response object.
161
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
162
+ if any, should be retried.
163
+ timeout (float): The timeout for this request.
164
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
165
+ sent along with the request as metadata. Normally, each value must be of type `str`,
166
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
167
+ be of type `bytes`.
168
+ """
169
+ self._method = method
170
+ self._request = dataset_service.ListDatasetsRequest(request)
171
+ self._response = response
172
+ self._retry = retry
173
+ self._timeout = timeout
174
+ self._metadata = metadata
175
+
176
+ def __getattr__(self, name: str) -> Any:
177
+ return getattr(self._response, name)
178
+
179
+ @property
180
+ async def pages(self) -> AsyncIterator[dataset_service.ListDatasetsResponse]:
181
+ yield self._response
182
+ while self._response.next_page_token:
183
+ self._request.page_token = self._response.next_page_token
184
+ self._response = await self._method(
185
+ self._request,
186
+ retry=self._retry,
187
+ timeout=self._timeout,
188
+ metadata=self._metadata,
189
+ )
190
+ yield self._response
191
+
192
+ def __aiter__(self) -> AsyncIterator[dataset.Dataset]:
193
+ async def async_generator():
194
+ async for page in self.pages:
195
+ for response in page.datasets:
196
+ yield response
197
+
198
+ return async_generator()
199
+
200
+ def __repr__(self) -> str:
201
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
202
+
203
+
204
+ class ListDatasetVersionsPager:
205
+ """A pager for iterating through ``list_dataset_versions`` requests.
206
+
207
+ This class thinly wraps an initial
208
+ :class:`google.cloud.aiplatform_v1.types.ListDatasetVersionsResponse` object, and
209
+ provides an ``__iter__`` method to iterate through its
210
+ ``dataset_versions`` field.
211
+
212
+ If there are more pages, the ``__iter__`` method will make additional
213
+ ``ListDatasetVersions`` requests and continue to iterate
214
+ through the ``dataset_versions`` field on the
215
+ corresponding responses.
216
+
217
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListDatasetVersionsResponse`
218
+ attributes are available on the pager. If multiple requests are made, only
219
+ the most recent response is retained, and thus used for attribute lookup.
220
+ """
221
+
222
+ def __init__(
223
+ self,
224
+ method: Callable[..., dataset_service.ListDatasetVersionsResponse],
225
+ request: dataset_service.ListDatasetVersionsRequest,
226
+ response: dataset_service.ListDatasetVersionsResponse,
227
+ *,
228
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
229
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
230
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
231
+ ):
232
+ """Instantiate the pager.
233
+
234
+ Args:
235
+ method (Callable): The method that was originally called, and
236
+ which instantiated this pager.
237
+ request (google.cloud.aiplatform_v1.types.ListDatasetVersionsRequest):
238
+ The initial request object.
239
+ response (google.cloud.aiplatform_v1.types.ListDatasetVersionsResponse):
240
+ The initial response object.
241
+ retry (google.api_core.retry.Retry): Designation of what errors,
242
+ if any, should be retried.
243
+ timeout (float): The timeout for this request.
244
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
245
+ sent along with the request as metadata. Normally, each value must be of type `str`,
246
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
247
+ be of type `bytes`.
248
+ """
249
+ self._method = method
250
+ self._request = dataset_service.ListDatasetVersionsRequest(request)
251
+ self._response = response
252
+ self._retry = retry
253
+ self._timeout = timeout
254
+ self._metadata = metadata
255
+
256
+ def __getattr__(self, name: str) -> Any:
257
+ return getattr(self._response, name)
258
+
259
+ @property
260
+ def pages(self) -> Iterator[dataset_service.ListDatasetVersionsResponse]:
261
+ yield self._response
262
+ while self._response.next_page_token:
263
+ self._request.page_token = self._response.next_page_token
264
+ self._response = self._method(
265
+ self._request,
266
+ retry=self._retry,
267
+ timeout=self._timeout,
268
+ metadata=self._metadata,
269
+ )
270
+ yield self._response
271
+
272
+ def __iter__(self) -> Iterator[dataset_version.DatasetVersion]:
273
+ for page in self.pages:
274
+ yield from page.dataset_versions
275
+
276
+ def __repr__(self) -> str:
277
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
278
+
279
+
280
+ class ListDatasetVersionsAsyncPager:
281
+ """A pager for iterating through ``list_dataset_versions`` requests.
282
+
283
+ This class thinly wraps an initial
284
+ :class:`google.cloud.aiplatform_v1.types.ListDatasetVersionsResponse` object, and
285
+ provides an ``__aiter__`` method to iterate through its
286
+ ``dataset_versions`` field.
287
+
288
+ If there are more pages, the ``__aiter__`` method will make additional
289
+ ``ListDatasetVersions`` requests and continue to iterate
290
+ through the ``dataset_versions`` field on the
291
+ corresponding responses.
292
+
293
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListDatasetVersionsResponse`
294
+ attributes are available on the pager. If multiple requests are made, only
295
+ the most recent response is retained, and thus used for attribute lookup.
296
+ """
297
+
298
+ def __init__(
299
+ self,
300
+ method: Callable[..., Awaitable[dataset_service.ListDatasetVersionsResponse]],
301
+ request: dataset_service.ListDatasetVersionsRequest,
302
+ response: dataset_service.ListDatasetVersionsResponse,
303
+ *,
304
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
305
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
306
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
307
+ ):
308
+ """Instantiates the pager.
309
+
310
+ Args:
311
+ method (Callable): The method that was originally called, and
312
+ which instantiated this pager.
313
+ request (google.cloud.aiplatform_v1.types.ListDatasetVersionsRequest):
314
+ The initial request object.
315
+ response (google.cloud.aiplatform_v1.types.ListDatasetVersionsResponse):
316
+ The initial response object.
317
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
318
+ if any, should be retried.
319
+ timeout (float): The timeout for this request.
320
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
321
+ sent along with the request as metadata. Normally, each value must be of type `str`,
322
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
323
+ be of type `bytes`.
324
+ """
325
+ self._method = method
326
+ self._request = dataset_service.ListDatasetVersionsRequest(request)
327
+ self._response = response
328
+ self._retry = retry
329
+ self._timeout = timeout
330
+ self._metadata = metadata
331
+
332
+ def __getattr__(self, name: str) -> Any:
333
+ return getattr(self._response, name)
334
+
335
+ @property
336
+ async def pages(self) -> AsyncIterator[dataset_service.ListDatasetVersionsResponse]:
337
+ yield self._response
338
+ while self._response.next_page_token:
339
+ self._request.page_token = self._response.next_page_token
340
+ self._response = await self._method(
341
+ self._request,
342
+ retry=self._retry,
343
+ timeout=self._timeout,
344
+ metadata=self._metadata,
345
+ )
346
+ yield self._response
347
+
348
+ def __aiter__(self) -> AsyncIterator[dataset_version.DatasetVersion]:
349
+ async def async_generator():
350
+ async for page in self.pages:
351
+ for response in page.dataset_versions:
352
+ yield response
353
+
354
+ return async_generator()
355
+
356
+ def __repr__(self) -> str:
357
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
358
+
359
+
360
+ class ListDataItemsPager:
361
+ """A pager for iterating through ``list_data_items`` requests.
362
+
363
+ This class thinly wraps an initial
364
+ :class:`google.cloud.aiplatform_v1.types.ListDataItemsResponse` object, and
365
+ provides an ``__iter__`` method to iterate through its
366
+ ``data_items`` field.
367
+
368
+ If there are more pages, the ``__iter__`` method will make additional
369
+ ``ListDataItems`` requests and continue to iterate
370
+ through the ``data_items`` field on the
371
+ corresponding responses.
372
+
373
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListDataItemsResponse`
374
+ attributes are available on the pager. If multiple requests are made, only
375
+ the most recent response is retained, and thus used for attribute lookup.
376
+ """
377
+
378
+ def __init__(
379
+ self,
380
+ method: Callable[..., dataset_service.ListDataItemsResponse],
381
+ request: dataset_service.ListDataItemsRequest,
382
+ response: dataset_service.ListDataItemsResponse,
383
+ *,
384
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
385
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
386
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
387
+ ):
388
+ """Instantiate the pager.
389
+
390
+ Args:
391
+ method (Callable): The method that was originally called, and
392
+ which instantiated this pager.
393
+ request (google.cloud.aiplatform_v1.types.ListDataItemsRequest):
394
+ The initial request object.
395
+ response (google.cloud.aiplatform_v1.types.ListDataItemsResponse):
396
+ The initial response object.
397
+ retry (google.api_core.retry.Retry): Designation of what errors,
398
+ if any, should be retried.
399
+ timeout (float): The timeout for this request.
400
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
401
+ sent along with the request as metadata. Normally, each value must be of type `str`,
402
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
403
+ be of type `bytes`.
404
+ """
405
+ self._method = method
406
+ self._request = dataset_service.ListDataItemsRequest(request)
407
+ self._response = response
408
+ self._retry = retry
409
+ self._timeout = timeout
410
+ self._metadata = metadata
411
+
412
+ def __getattr__(self, name: str) -> Any:
413
+ return getattr(self._response, name)
414
+
415
+ @property
416
+ def pages(self) -> Iterator[dataset_service.ListDataItemsResponse]:
417
+ yield self._response
418
+ while self._response.next_page_token:
419
+ self._request.page_token = self._response.next_page_token
420
+ self._response = self._method(
421
+ self._request,
422
+ retry=self._retry,
423
+ timeout=self._timeout,
424
+ metadata=self._metadata,
425
+ )
426
+ yield self._response
427
+
428
+ def __iter__(self) -> Iterator[data_item.DataItem]:
429
+ for page in self.pages:
430
+ yield from page.data_items
431
+
432
+ def __repr__(self) -> str:
433
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
434
+
435
+
436
+ class ListDataItemsAsyncPager:
437
+ """A pager for iterating through ``list_data_items`` requests.
438
+
439
+ This class thinly wraps an initial
440
+ :class:`google.cloud.aiplatform_v1.types.ListDataItemsResponse` object, and
441
+ provides an ``__aiter__`` method to iterate through its
442
+ ``data_items`` field.
443
+
444
+ If there are more pages, the ``__aiter__`` method will make additional
445
+ ``ListDataItems`` requests and continue to iterate
446
+ through the ``data_items`` field on the
447
+ corresponding responses.
448
+
449
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListDataItemsResponse`
450
+ attributes are available on the pager. If multiple requests are made, only
451
+ the most recent response is retained, and thus used for attribute lookup.
452
+ """
453
+
454
+ def __init__(
455
+ self,
456
+ method: Callable[..., Awaitable[dataset_service.ListDataItemsResponse]],
457
+ request: dataset_service.ListDataItemsRequest,
458
+ response: dataset_service.ListDataItemsResponse,
459
+ *,
460
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
461
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
462
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
463
+ ):
464
+ """Instantiates the pager.
465
+
466
+ Args:
467
+ method (Callable): The method that was originally called, and
468
+ which instantiated this pager.
469
+ request (google.cloud.aiplatform_v1.types.ListDataItemsRequest):
470
+ The initial request object.
471
+ response (google.cloud.aiplatform_v1.types.ListDataItemsResponse):
472
+ The initial response object.
473
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
474
+ if any, should be retried.
475
+ timeout (float): The timeout for this request.
476
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
477
+ sent along with the request as metadata. Normally, each value must be of type `str`,
478
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
479
+ be of type `bytes`.
480
+ """
481
+ self._method = method
482
+ self._request = dataset_service.ListDataItemsRequest(request)
483
+ self._response = response
484
+ self._retry = retry
485
+ self._timeout = timeout
486
+ self._metadata = metadata
487
+
488
+ def __getattr__(self, name: str) -> Any:
489
+ return getattr(self._response, name)
490
+
491
+ @property
492
+ async def pages(self) -> AsyncIterator[dataset_service.ListDataItemsResponse]:
493
+ yield self._response
494
+ while self._response.next_page_token:
495
+ self._request.page_token = self._response.next_page_token
496
+ self._response = await self._method(
497
+ self._request,
498
+ retry=self._retry,
499
+ timeout=self._timeout,
500
+ metadata=self._metadata,
501
+ )
502
+ yield self._response
503
+
504
+ def __aiter__(self) -> AsyncIterator[data_item.DataItem]:
505
+ async def async_generator():
506
+ async for page in self.pages:
507
+ for response in page.data_items:
508
+ yield response
509
+
510
+ return async_generator()
511
+
512
+ def __repr__(self) -> str:
513
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
514
+
515
+
516
+ class SearchDataItemsPager:
517
+ """A pager for iterating through ``search_data_items`` requests.
518
+
519
+ This class thinly wraps an initial
520
+ :class:`google.cloud.aiplatform_v1.types.SearchDataItemsResponse` object, and
521
+ provides an ``__iter__`` method to iterate through its
522
+ ``data_item_views`` field.
523
+
524
+ If there are more pages, the ``__iter__`` method will make additional
525
+ ``SearchDataItems`` requests and continue to iterate
526
+ through the ``data_item_views`` field on the
527
+ corresponding responses.
528
+
529
+ All the usual :class:`google.cloud.aiplatform_v1.types.SearchDataItemsResponse`
530
+ attributes are available on the pager. If multiple requests are made, only
531
+ the most recent response is retained, and thus used for attribute lookup.
532
+ """
533
+
534
+ def __init__(
535
+ self,
536
+ method: Callable[..., dataset_service.SearchDataItemsResponse],
537
+ request: dataset_service.SearchDataItemsRequest,
538
+ response: dataset_service.SearchDataItemsResponse,
539
+ *,
540
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
541
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
542
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
543
+ ):
544
+ """Instantiate the pager.
545
+
546
+ Args:
547
+ method (Callable): The method that was originally called, and
548
+ which instantiated this pager.
549
+ request (google.cloud.aiplatform_v1.types.SearchDataItemsRequest):
550
+ The initial request object.
551
+ response (google.cloud.aiplatform_v1.types.SearchDataItemsResponse):
552
+ The initial response object.
553
+ retry (google.api_core.retry.Retry): Designation of what errors,
554
+ if any, should be retried.
555
+ timeout (float): The timeout for this request.
556
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
557
+ sent along with the request as metadata. Normally, each value must be of type `str`,
558
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
559
+ be of type `bytes`.
560
+ """
561
+ self._method = method
562
+ self._request = dataset_service.SearchDataItemsRequest(request)
563
+ self._response = response
564
+ self._retry = retry
565
+ self._timeout = timeout
566
+ self._metadata = metadata
567
+
568
+ def __getattr__(self, name: str) -> Any:
569
+ return getattr(self._response, name)
570
+
571
+ @property
572
+ def pages(self) -> Iterator[dataset_service.SearchDataItemsResponse]:
573
+ yield self._response
574
+ while self._response.next_page_token:
575
+ self._request.page_token = self._response.next_page_token
576
+ self._response = self._method(
577
+ self._request,
578
+ retry=self._retry,
579
+ timeout=self._timeout,
580
+ metadata=self._metadata,
581
+ )
582
+ yield self._response
583
+
584
+ def __iter__(self) -> Iterator[dataset_service.DataItemView]:
585
+ for page in self.pages:
586
+ yield from page.data_item_views
587
+
588
+ def __repr__(self) -> str:
589
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
590
+
591
+
592
+ class SearchDataItemsAsyncPager:
593
+ """A pager for iterating through ``search_data_items`` requests.
594
+
595
+ This class thinly wraps an initial
596
+ :class:`google.cloud.aiplatform_v1.types.SearchDataItemsResponse` object, and
597
+ provides an ``__aiter__`` method to iterate through its
598
+ ``data_item_views`` field.
599
+
600
+ If there are more pages, the ``__aiter__`` method will make additional
601
+ ``SearchDataItems`` requests and continue to iterate
602
+ through the ``data_item_views`` field on the
603
+ corresponding responses.
604
+
605
+ All the usual :class:`google.cloud.aiplatform_v1.types.SearchDataItemsResponse`
606
+ attributes are available on the pager. If multiple requests are made, only
607
+ the most recent response is retained, and thus used for attribute lookup.
608
+ """
609
+
610
+ def __init__(
611
+ self,
612
+ method: Callable[..., Awaitable[dataset_service.SearchDataItemsResponse]],
613
+ request: dataset_service.SearchDataItemsRequest,
614
+ response: dataset_service.SearchDataItemsResponse,
615
+ *,
616
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
617
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
618
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
619
+ ):
620
+ """Instantiates the pager.
621
+
622
+ Args:
623
+ method (Callable): The method that was originally called, and
624
+ which instantiated this pager.
625
+ request (google.cloud.aiplatform_v1.types.SearchDataItemsRequest):
626
+ The initial request object.
627
+ response (google.cloud.aiplatform_v1.types.SearchDataItemsResponse):
628
+ The initial response object.
629
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
630
+ if any, should be retried.
631
+ timeout (float): The timeout for this request.
632
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
633
+ sent along with the request as metadata. Normally, each value must be of type `str`,
634
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
635
+ be of type `bytes`.
636
+ """
637
+ self._method = method
638
+ self._request = dataset_service.SearchDataItemsRequest(request)
639
+ self._response = response
640
+ self._retry = retry
641
+ self._timeout = timeout
642
+ self._metadata = metadata
643
+
644
+ def __getattr__(self, name: str) -> Any:
645
+ return getattr(self._response, name)
646
+
647
+ @property
648
+ async def pages(self) -> AsyncIterator[dataset_service.SearchDataItemsResponse]:
649
+ yield self._response
650
+ while self._response.next_page_token:
651
+ self._request.page_token = self._response.next_page_token
652
+ self._response = await self._method(
653
+ self._request,
654
+ retry=self._retry,
655
+ timeout=self._timeout,
656
+ metadata=self._metadata,
657
+ )
658
+ yield self._response
659
+
660
+ def __aiter__(self) -> AsyncIterator[dataset_service.DataItemView]:
661
+ async def async_generator():
662
+ async for page in self.pages:
663
+ for response in page.data_item_views:
664
+ yield response
665
+
666
+ return async_generator()
667
+
668
+ def __repr__(self) -> str:
669
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
670
+
671
+
672
+ class ListSavedQueriesPager:
673
+ """A pager for iterating through ``list_saved_queries`` requests.
674
+
675
+ This class thinly wraps an initial
676
+ :class:`google.cloud.aiplatform_v1.types.ListSavedQueriesResponse` object, and
677
+ provides an ``__iter__`` method to iterate through its
678
+ ``saved_queries`` field.
679
+
680
+ If there are more pages, the ``__iter__`` method will make additional
681
+ ``ListSavedQueries`` requests and continue to iterate
682
+ through the ``saved_queries`` field on the
683
+ corresponding responses.
684
+
685
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListSavedQueriesResponse`
686
+ attributes are available on the pager. If multiple requests are made, only
687
+ the most recent response is retained, and thus used for attribute lookup.
688
+ """
689
+
690
+ def __init__(
691
+ self,
692
+ method: Callable[..., dataset_service.ListSavedQueriesResponse],
693
+ request: dataset_service.ListSavedQueriesRequest,
694
+ response: dataset_service.ListSavedQueriesResponse,
695
+ *,
696
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
697
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
698
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
699
+ ):
700
+ """Instantiate the pager.
701
+
702
+ Args:
703
+ method (Callable): The method that was originally called, and
704
+ which instantiated this pager.
705
+ request (google.cloud.aiplatform_v1.types.ListSavedQueriesRequest):
706
+ The initial request object.
707
+ response (google.cloud.aiplatform_v1.types.ListSavedQueriesResponse):
708
+ The initial response object.
709
+ retry (google.api_core.retry.Retry): Designation of what errors,
710
+ if any, should be retried.
711
+ timeout (float): The timeout for this request.
712
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
713
+ sent along with the request as metadata. Normally, each value must be of type `str`,
714
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
715
+ be of type `bytes`.
716
+ """
717
+ self._method = method
718
+ self._request = dataset_service.ListSavedQueriesRequest(request)
719
+ self._response = response
720
+ self._retry = retry
721
+ self._timeout = timeout
722
+ self._metadata = metadata
723
+
724
+ def __getattr__(self, name: str) -> Any:
725
+ return getattr(self._response, name)
726
+
727
+ @property
728
+ def pages(self) -> Iterator[dataset_service.ListSavedQueriesResponse]:
729
+ yield self._response
730
+ while self._response.next_page_token:
731
+ self._request.page_token = self._response.next_page_token
732
+ self._response = self._method(
733
+ self._request,
734
+ retry=self._retry,
735
+ timeout=self._timeout,
736
+ metadata=self._metadata,
737
+ )
738
+ yield self._response
739
+
740
+ def __iter__(self) -> Iterator[saved_query.SavedQuery]:
741
+ for page in self.pages:
742
+ yield from page.saved_queries
743
+
744
+ def __repr__(self) -> str:
745
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
746
+
747
+
748
+ class ListSavedQueriesAsyncPager:
749
+ """A pager for iterating through ``list_saved_queries`` requests.
750
+
751
+ This class thinly wraps an initial
752
+ :class:`google.cloud.aiplatform_v1.types.ListSavedQueriesResponse` object, and
753
+ provides an ``__aiter__`` method to iterate through its
754
+ ``saved_queries`` field.
755
+
756
+ If there are more pages, the ``__aiter__`` method will make additional
757
+ ``ListSavedQueries`` requests and continue to iterate
758
+ through the ``saved_queries`` field on the
759
+ corresponding responses.
760
+
761
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListSavedQueriesResponse`
762
+ attributes are available on the pager. If multiple requests are made, only
763
+ the most recent response is retained, and thus used for attribute lookup.
764
+ """
765
+
766
+ def __init__(
767
+ self,
768
+ method: Callable[..., Awaitable[dataset_service.ListSavedQueriesResponse]],
769
+ request: dataset_service.ListSavedQueriesRequest,
770
+ response: dataset_service.ListSavedQueriesResponse,
771
+ *,
772
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
773
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
774
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
775
+ ):
776
+ """Instantiates the pager.
777
+
778
+ Args:
779
+ method (Callable): The method that was originally called, and
780
+ which instantiated this pager.
781
+ request (google.cloud.aiplatform_v1.types.ListSavedQueriesRequest):
782
+ The initial request object.
783
+ response (google.cloud.aiplatform_v1.types.ListSavedQueriesResponse):
784
+ The initial response object.
785
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
786
+ if any, should be retried.
787
+ timeout (float): The timeout for this request.
788
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
789
+ sent along with the request as metadata. Normally, each value must be of type `str`,
790
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
791
+ be of type `bytes`.
792
+ """
793
+ self._method = method
794
+ self._request = dataset_service.ListSavedQueriesRequest(request)
795
+ self._response = response
796
+ self._retry = retry
797
+ self._timeout = timeout
798
+ self._metadata = metadata
799
+
800
+ def __getattr__(self, name: str) -> Any:
801
+ return getattr(self._response, name)
802
+
803
+ @property
804
+ async def pages(self) -> AsyncIterator[dataset_service.ListSavedQueriesResponse]:
805
+ yield self._response
806
+ while self._response.next_page_token:
807
+ self._request.page_token = self._response.next_page_token
808
+ self._response = await self._method(
809
+ self._request,
810
+ retry=self._retry,
811
+ timeout=self._timeout,
812
+ metadata=self._metadata,
813
+ )
814
+ yield self._response
815
+
816
+ def __aiter__(self) -> AsyncIterator[saved_query.SavedQuery]:
817
+ async def async_generator():
818
+ async for page in self.pages:
819
+ for response in page.saved_queries:
820
+ yield response
821
+
822
+ return async_generator()
823
+
824
+ def __repr__(self) -> str:
825
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
826
+
827
+
828
+ class ListAnnotationsPager:
829
+ """A pager for iterating through ``list_annotations`` requests.
830
+
831
+ This class thinly wraps an initial
832
+ :class:`google.cloud.aiplatform_v1.types.ListAnnotationsResponse` object, and
833
+ provides an ``__iter__`` method to iterate through its
834
+ ``annotations`` field.
835
+
836
+ If there are more pages, the ``__iter__`` method will make additional
837
+ ``ListAnnotations`` requests and continue to iterate
838
+ through the ``annotations`` field on the
839
+ corresponding responses.
840
+
841
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListAnnotationsResponse`
842
+ attributes are available on the pager. If multiple requests are made, only
843
+ the most recent response is retained, and thus used for attribute lookup.
844
+ """
845
+
846
+ def __init__(
847
+ self,
848
+ method: Callable[..., dataset_service.ListAnnotationsResponse],
849
+ request: dataset_service.ListAnnotationsRequest,
850
+ response: dataset_service.ListAnnotationsResponse,
851
+ *,
852
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
853
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
854
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
855
+ ):
856
+ """Instantiate the pager.
857
+
858
+ Args:
859
+ method (Callable): The method that was originally called, and
860
+ which instantiated this pager.
861
+ request (google.cloud.aiplatform_v1.types.ListAnnotationsRequest):
862
+ The initial request object.
863
+ response (google.cloud.aiplatform_v1.types.ListAnnotationsResponse):
864
+ The initial response object.
865
+ retry (google.api_core.retry.Retry): Designation of what errors,
866
+ if any, should be retried.
867
+ timeout (float): The timeout for this request.
868
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
869
+ sent along with the request as metadata. Normally, each value must be of type `str`,
870
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
871
+ be of type `bytes`.
872
+ """
873
+ self._method = method
874
+ self._request = dataset_service.ListAnnotationsRequest(request)
875
+ self._response = response
876
+ self._retry = retry
877
+ self._timeout = timeout
878
+ self._metadata = metadata
879
+
880
+ def __getattr__(self, name: str) -> Any:
881
+ return getattr(self._response, name)
882
+
883
+ @property
884
+ def pages(self) -> Iterator[dataset_service.ListAnnotationsResponse]:
885
+ yield self._response
886
+ while self._response.next_page_token:
887
+ self._request.page_token = self._response.next_page_token
888
+ self._response = self._method(
889
+ self._request,
890
+ retry=self._retry,
891
+ timeout=self._timeout,
892
+ metadata=self._metadata,
893
+ )
894
+ yield self._response
895
+
896
+ def __iter__(self) -> Iterator[annotation.Annotation]:
897
+ for page in self.pages:
898
+ yield from page.annotations
899
+
900
+ def __repr__(self) -> str:
901
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
902
+
903
+
904
+ class ListAnnotationsAsyncPager:
905
+ """A pager for iterating through ``list_annotations`` requests.
906
+
907
+ This class thinly wraps an initial
908
+ :class:`google.cloud.aiplatform_v1.types.ListAnnotationsResponse` object, and
909
+ provides an ``__aiter__`` method to iterate through its
910
+ ``annotations`` field.
911
+
912
+ If there are more pages, the ``__aiter__`` method will make additional
913
+ ``ListAnnotations`` requests and continue to iterate
914
+ through the ``annotations`` field on the
915
+ corresponding responses.
916
+
917
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListAnnotationsResponse`
918
+ attributes are available on the pager. If multiple requests are made, only
919
+ the most recent response is retained, and thus used for attribute lookup.
920
+ """
921
+
922
+ def __init__(
923
+ self,
924
+ method: Callable[..., Awaitable[dataset_service.ListAnnotationsResponse]],
925
+ request: dataset_service.ListAnnotationsRequest,
926
+ response: dataset_service.ListAnnotationsResponse,
927
+ *,
928
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
929
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
930
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
931
+ ):
932
+ """Instantiates the pager.
933
+
934
+ Args:
935
+ method (Callable): The method that was originally called, and
936
+ which instantiated this pager.
937
+ request (google.cloud.aiplatform_v1.types.ListAnnotationsRequest):
938
+ The initial request object.
939
+ response (google.cloud.aiplatform_v1.types.ListAnnotationsResponse):
940
+ The initial response object.
941
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
942
+ if any, should be retried.
943
+ timeout (float): The timeout for this request.
944
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
945
+ sent along with the request as metadata. Normally, each value must be of type `str`,
946
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
947
+ be of type `bytes`.
948
+ """
949
+ self._method = method
950
+ self._request = dataset_service.ListAnnotationsRequest(request)
951
+ self._response = response
952
+ self._retry = retry
953
+ self._timeout = timeout
954
+ self._metadata = metadata
955
+
956
+ def __getattr__(self, name: str) -> Any:
957
+ return getattr(self._response, name)
958
+
959
+ @property
960
+ async def pages(self) -> AsyncIterator[dataset_service.ListAnnotationsResponse]:
961
+ yield self._response
962
+ while self._response.next_page_token:
963
+ self._request.page_token = self._response.next_page_token
964
+ self._response = await self._method(
965
+ self._request,
966
+ retry=self._retry,
967
+ timeout=self._timeout,
968
+ metadata=self._metadata,
969
+ )
970
+ yield self._response
971
+
972
+ def __aiter__(self) -> AsyncIterator[annotation.Annotation]:
973
+ async def async_generator():
974
+ async for page in self.pages:
975
+ for response in page.annotations:
976
+ yield response
977
+
978
+ return async_generator()
979
+
980
+ def __repr__(self) -> str:
981
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__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 .client import DeploymentResourcePoolServiceClient
17
+ from .async_client import DeploymentResourcePoolServiceAsyncClient
18
+
19
+ __all__ = (
20
+ "DeploymentResourcePoolServiceClient",
21
+ "DeploymentResourcePoolServiceAsyncClient",
22
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (461 Bytes). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__pycache__/async_client.cpython-311.pyc ADDED
Binary file (75.6 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__pycache__/client.cpython-311.pyc ADDED
Binary file (98.9 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/__pycache__/pagers.cpython-311.pyc ADDED
Binary file (19.2 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/async_client.py ADDED
@@ -0,0 +1,1940 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from collections import OrderedDict
18
+ import re
19
+ from typing import (
20
+ Dict,
21
+ Callable,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ from google.cloud.aiplatform_v1 import gapic_version as package_version
33
+
34
+ from google.api_core.client_options import ClientOptions
35
+ from google.api_core import exceptions as core_exceptions
36
+ from google.api_core import gapic_v1
37
+ from google.api_core import retry_async as retries
38
+ from google.auth import credentials as ga_credentials # type: ignore
39
+ from google.oauth2 import service_account # type: ignore
40
+ import google.protobuf
41
+
42
+
43
+ try:
44
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
45
+ except AttributeError: # pragma: NO COVER
46
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
47
+
48
+ from google.cloud.aiplatform_v1.services.deployment_resource_pool_service import pagers
49
+ from google.cloud.aiplatform_v1.types import deployment_resource_pool
50
+ from google.cloud.aiplatform_v1.types import (
51
+ deployment_resource_pool as gca_deployment_resource_pool,
52
+ )
53
+ from google.cloud.aiplatform_v1.types import deployment_resource_pool_service
54
+ from google.cloud.aiplatform_v1.types import encryption_spec
55
+ from google.cloud.aiplatform_v1.types import endpoint
56
+ from google.cloud.aiplatform_v1.types import machine_resources
57
+ from google.cloud.aiplatform_v1.types import operation as gca_operation
58
+ from google.cloud.location import locations_pb2 # type: ignore
59
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
60
+ from google.iam.v1 import policy_pb2 # type: ignore
61
+ from google.longrunning import operations_pb2 # type: ignore
62
+ import google.api_core.operation as gac_operation # type: ignore
63
+ import google.api_core.operation_async as operation_async # type: ignore
64
+ import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
65
+ import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
66
+ import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
67
+ from .transports.base import DeploymentResourcePoolServiceTransport, DEFAULT_CLIENT_INFO
68
+ from .transports.grpc_asyncio import DeploymentResourcePoolServiceGrpcAsyncIOTransport
69
+ from .client import DeploymentResourcePoolServiceClient
70
+
71
+ try:
72
+ from google.api_core import client_logging # type: ignore
73
+
74
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
75
+ except ImportError: # pragma: NO COVER
76
+ CLIENT_LOGGING_SUPPORTED = False
77
+
78
+ _LOGGER = std_logging.getLogger(__name__)
79
+
80
+
81
+ class DeploymentResourcePoolServiceAsyncClient:
82
+ """A service that manages the DeploymentResourcePool resource."""
83
+
84
+ _client: DeploymentResourcePoolServiceClient
85
+
86
+ # Copy defaults from the synchronous client for use here.
87
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
88
+ DEFAULT_ENDPOINT = DeploymentResourcePoolServiceClient.DEFAULT_ENDPOINT
89
+ DEFAULT_MTLS_ENDPOINT = DeploymentResourcePoolServiceClient.DEFAULT_MTLS_ENDPOINT
90
+ _DEFAULT_ENDPOINT_TEMPLATE = (
91
+ DeploymentResourcePoolServiceClient._DEFAULT_ENDPOINT_TEMPLATE
92
+ )
93
+ _DEFAULT_UNIVERSE = DeploymentResourcePoolServiceClient._DEFAULT_UNIVERSE
94
+
95
+ deployment_resource_pool_path = staticmethod(
96
+ DeploymentResourcePoolServiceClient.deployment_resource_pool_path
97
+ )
98
+ parse_deployment_resource_pool_path = staticmethod(
99
+ DeploymentResourcePoolServiceClient.parse_deployment_resource_pool_path
100
+ )
101
+ endpoint_path = staticmethod(DeploymentResourcePoolServiceClient.endpoint_path)
102
+ parse_endpoint_path = staticmethod(
103
+ DeploymentResourcePoolServiceClient.parse_endpoint_path
104
+ )
105
+ model_path = staticmethod(DeploymentResourcePoolServiceClient.model_path)
106
+ parse_model_path = staticmethod(
107
+ DeploymentResourcePoolServiceClient.parse_model_path
108
+ )
109
+ reservation_path = staticmethod(
110
+ DeploymentResourcePoolServiceClient.reservation_path
111
+ )
112
+ parse_reservation_path = staticmethod(
113
+ DeploymentResourcePoolServiceClient.parse_reservation_path
114
+ )
115
+ common_billing_account_path = staticmethod(
116
+ DeploymentResourcePoolServiceClient.common_billing_account_path
117
+ )
118
+ parse_common_billing_account_path = staticmethod(
119
+ DeploymentResourcePoolServiceClient.parse_common_billing_account_path
120
+ )
121
+ common_folder_path = staticmethod(
122
+ DeploymentResourcePoolServiceClient.common_folder_path
123
+ )
124
+ parse_common_folder_path = staticmethod(
125
+ DeploymentResourcePoolServiceClient.parse_common_folder_path
126
+ )
127
+ common_organization_path = staticmethod(
128
+ DeploymentResourcePoolServiceClient.common_organization_path
129
+ )
130
+ parse_common_organization_path = staticmethod(
131
+ DeploymentResourcePoolServiceClient.parse_common_organization_path
132
+ )
133
+ common_project_path = staticmethod(
134
+ DeploymentResourcePoolServiceClient.common_project_path
135
+ )
136
+ parse_common_project_path = staticmethod(
137
+ DeploymentResourcePoolServiceClient.parse_common_project_path
138
+ )
139
+ common_location_path = staticmethod(
140
+ DeploymentResourcePoolServiceClient.common_location_path
141
+ )
142
+ parse_common_location_path = staticmethod(
143
+ DeploymentResourcePoolServiceClient.parse_common_location_path
144
+ )
145
+
146
+ @classmethod
147
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
148
+ """Creates an instance of this client using the provided credentials
149
+ info.
150
+
151
+ Args:
152
+ info (dict): The service account private key info.
153
+ args: Additional arguments to pass to the constructor.
154
+ kwargs: Additional arguments to pass to the constructor.
155
+
156
+ Returns:
157
+ DeploymentResourcePoolServiceAsyncClient: The constructed client.
158
+ """
159
+ sa_info_func = (
160
+ DeploymentResourcePoolServiceClient.from_service_account_info.__func__ # type: ignore
161
+ )
162
+ return sa_info_func(
163
+ DeploymentResourcePoolServiceAsyncClient, info, *args, **kwargs
164
+ )
165
+
166
+ @classmethod
167
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
168
+ """Creates an instance of this client using the provided credentials
169
+ file.
170
+
171
+ Args:
172
+ filename (str): The path to the service account private key json
173
+ file.
174
+ args: Additional arguments to pass to the constructor.
175
+ kwargs: Additional arguments to pass to the constructor.
176
+
177
+ Returns:
178
+ DeploymentResourcePoolServiceAsyncClient: The constructed client.
179
+ """
180
+ sa_file_func = (
181
+ DeploymentResourcePoolServiceClient.from_service_account_file.__func__ # type: ignore
182
+ )
183
+ return sa_file_func(
184
+ DeploymentResourcePoolServiceAsyncClient, filename, *args, **kwargs
185
+ )
186
+
187
+ from_service_account_json = from_service_account_file
188
+
189
+ @classmethod
190
+ def get_mtls_endpoint_and_cert_source(
191
+ cls, client_options: Optional[ClientOptions] = None
192
+ ):
193
+ """Return the API endpoint and client cert source for mutual TLS.
194
+
195
+ The client cert source is determined in the following order:
196
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
197
+ client cert source is None.
198
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
199
+ default client cert source exists, use the default one; otherwise the client cert
200
+ source is None.
201
+
202
+ The API endpoint is determined in the following order:
203
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
204
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
205
+ default mTLS endpoint; if the environment variable is "never", use the default API
206
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
207
+ use the default API endpoint.
208
+
209
+ More details can be found at https://google.aip.dev/auth/4114.
210
+
211
+ Args:
212
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
213
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
214
+ in this method.
215
+
216
+ Returns:
217
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
218
+ client cert source to use.
219
+
220
+ Raises:
221
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
222
+ """
223
+ return DeploymentResourcePoolServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
224
+
225
+ @property
226
+ def transport(self) -> DeploymentResourcePoolServiceTransport:
227
+ """Returns the transport used by the client instance.
228
+
229
+ Returns:
230
+ DeploymentResourcePoolServiceTransport: The transport used by the client instance.
231
+ """
232
+ return self._client.transport
233
+
234
+ @property
235
+ def api_endpoint(self):
236
+ """Return the API endpoint used by the client instance.
237
+
238
+ Returns:
239
+ str: The API endpoint used by the client instance.
240
+ """
241
+ return self._client._api_endpoint
242
+
243
+ @property
244
+ def universe_domain(self) -> str:
245
+ """Return the universe domain used by the client instance.
246
+
247
+ Returns:
248
+ str: The universe domain used
249
+ by the client instance.
250
+ """
251
+ return self._client._universe_domain
252
+
253
+ get_transport_class = DeploymentResourcePoolServiceClient.get_transport_class
254
+
255
+ def __init__(
256
+ self,
257
+ *,
258
+ credentials: Optional[ga_credentials.Credentials] = None,
259
+ transport: Optional[
260
+ Union[
261
+ str,
262
+ DeploymentResourcePoolServiceTransport,
263
+ Callable[..., DeploymentResourcePoolServiceTransport],
264
+ ]
265
+ ] = "grpc_asyncio",
266
+ client_options: Optional[ClientOptions] = None,
267
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
268
+ ) -> None:
269
+ """Instantiates the deployment resource pool service async client.
270
+
271
+ Args:
272
+ credentials (Optional[google.auth.credentials.Credentials]): The
273
+ authorization credentials to attach to requests. These
274
+ credentials identify the application to the service; if none
275
+ are specified, the client will attempt to ascertain the
276
+ credentials from the environment.
277
+ transport (Optional[Union[str,DeploymentResourcePoolServiceTransport,Callable[..., DeploymentResourcePoolServiceTransport]]]):
278
+ The transport to use, or a Callable that constructs and returns a new transport to use.
279
+ If a Callable is given, it will be called with the same set of initialization
280
+ arguments as used in the DeploymentResourcePoolServiceTransport constructor.
281
+ If set to None, a transport is chosen automatically.
282
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
283
+ Custom options for the client.
284
+
285
+ 1. The ``api_endpoint`` property can be used to override the
286
+ default endpoint provided by the client when ``transport`` is
287
+ not explicitly provided. Only if this property is not set and
288
+ ``transport`` was not explicitly provided, the endpoint is
289
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
290
+ variable, which have one of the following values:
291
+ "always" (always use the default mTLS endpoint), "never" (always
292
+ use the default regular endpoint) and "auto" (auto-switch to the
293
+ default mTLS endpoint if client certificate is present; this is
294
+ the default value).
295
+
296
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
297
+ is "true", then the ``client_cert_source`` property can be used
298
+ to provide a client certificate for mTLS transport. If
299
+ not provided, the default SSL client certificate will be used if
300
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
301
+ set, no client certificate will be used.
302
+
303
+ 3. The ``universe_domain`` property can be used to override the
304
+ default "googleapis.com" universe. Note that ``api_endpoint``
305
+ property still takes precedence; and ``universe_domain`` is
306
+ currently not supported for mTLS.
307
+
308
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
309
+ The client info used to send a user-agent string along with
310
+ API requests. If ``None``, then default info will be used.
311
+ Generally, you only need to set this if you're developing
312
+ your own client library.
313
+
314
+ Raises:
315
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
316
+ creation failed for any reason.
317
+ """
318
+ self._client = DeploymentResourcePoolServiceClient(
319
+ credentials=credentials,
320
+ transport=transport,
321
+ client_options=client_options,
322
+ client_info=client_info,
323
+ )
324
+
325
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
326
+ std_logging.DEBUG
327
+ ): # pragma: NO COVER
328
+ _LOGGER.debug(
329
+ "Created client `google.cloud.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient`.",
330
+ extra=(
331
+ {
332
+ "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService",
333
+ "universeDomain": getattr(
334
+ self._client._transport._credentials, "universe_domain", ""
335
+ ),
336
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
337
+ "credentialsInfo": getattr(
338
+ self.transport._credentials, "get_cred_info", lambda: None
339
+ )(),
340
+ }
341
+ if hasattr(self._client._transport, "_credentials")
342
+ else {
343
+ "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService",
344
+ "credentialsType": None,
345
+ }
346
+ ),
347
+ )
348
+
349
+ async def create_deployment_resource_pool(
350
+ self,
351
+ request: Optional[
352
+ Union[
353
+ deployment_resource_pool_service.CreateDeploymentResourcePoolRequest,
354
+ dict,
355
+ ]
356
+ ] = None,
357
+ *,
358
+ parent: Optional[str] = None,
359
+ deployment_resource_pool: Optional[
360
+ gca_deployment_resource_pool.DeploymentResourcePool
361
+ ] = None,
362
+ deployment_resource_pool_id: Optional[str] = None,
363
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
364
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
365
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
366
+ ) -> operation_async.AsyncOperation:
367
+ r"""Create a DeploymentResourcePool.
368
+
369
+ .. code-block:: python
370
+
371
+ # This snippet has been automatically generated and should be regarded as a
372
+ # code template only.
373
+ # It will require modifications to work:
374
+ # - It may require correct/in-range values for request initialization.
375
+ # - It may require specifying regional endpoints when creating the service
376
+ # client as shown in:
377
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
378
+ from google.cloud import aiplatform_v1
379
+
380
+ async def sample_create_deployment_resource_pool():
381
+ # Create a client
382
+ client = aiplatform_v1.DeploymentResourcePoolServiceAsyncClient()
383
+
384
+ # Initialize request argument(s)
385
+ deployment_resource_pool = aiplatform_v1.DeploymentResourcePool()
386
+ deployment_resource_pool.dedicated_resources.min_replica_count = 1803
387
+
388
+ request = aiplatform_v1.CreateDeploymentResourcePoolRequest(
389
+ parent="parent_value",
390
+ deployment_resource_pool=deployment_resource_pool,
391
+ deployment_resource_pool_id="deployment_resource_pool_id_value",
392
+ )
393
+
394
+ # Make the request
395
+ operation = client.create_deployment_resource_pool(request=request)
396
+
397
+ print("Waiting for operation to complete...")
398
+
399
+ response = (await operation).result()
400
+
401
+ # Handle the response
402
+ print(response)
403
+
404
+ Args:
405
+ request (Optional[Union[google.cloud.aiplatform_v1.types.CreateDeploymentResourcePoolRequest, dict]]):
406
+ The request object. Request message for
407
+ CreateDeploymentResourcePool method.
408
+ parent (:class:`str`):
409
+ Required. The parent location resource where this
410
+ DeploymentResourcePool will be created. Format:
411
+ ``projects/{project}/locations/{location}``
412
+
413
+ This corresponds to the ``parent`` field
414
+ on the ``request`` instance; if ``request`` is provided, this
415
+ should not be set.
416
+ deployment_resource_pool (:class:`google.cloud.aiplatform_v1.types.DeploymentResourcePool`):
417
+ Required. The DeploymentResourcePool
418
+ to create.
419
+
420
+ This corresponds to the ``deployment_resource_pool`` field
421
+ on the ``request`` instance; if ``request`` is provided, this
422
+ should not be set.
423
+ deployment_resource_pool_id (:class:`str`):
424
+ Required. The ID to use for the DeploymentResourcePool,
425
+ which will become the final component of the
426
+ DeploymentResourcePool's resource name.
427
+
428
+ The maximum length is 63 characters, and valid
429
+ characters are ``/^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$/``.
430
+
431
+ This corresponds to the ``deployment_resource_pool_id`` field
432
+ on the ``request`` instance; if ``request`` is provided, this
433
+ should not be set.
434
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
435
+ should be retried.
436
+ timeout (float): The timeout for this request.
437
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
438
+ sent along with the request as metadata. Normally, each value must be of type `str`,
439
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
440
+ be of type `bytes`.
441
+
442
+ Returns:
443
+ google.api_core.operation_async.AsyncOperation:
444
+ An object representing a long-running operation.
445
+
446
+ The result type for the operation will be :class:`google.cloud.aiplatform_v1.types.DeploymentResourcePool` A description of resources that can be shared by multiple DeployedModels,
447
+ whose underlying specification consists of a
448
+ DedicatedResources.
449
+
450
+ """
451
+ # Create or coerce a protobuf request object.
452
+ # - Quick check: If we got a request object, we should *not* have
453
+ # gotten any keyword arguments that map to the request.
454
+ flattened_params = [
455
+ parent,
456
+ deployment_resource_pool,
457
+ deployment_resource_pool_id,
458
+ ]
459
+ has_flattened_params = (
460
+ len([param for param in flattened_params if param is not None]) > 0
461
+ )
462
+ if request is not None and has_flattened_params:
463
+ raise ValueError(
464
+ "If the `request` argument is set, then none of "
465
+ "the individual field arguments should be set."
466
+ )
467
+
468
+ # - Use the request object if provided (there's no risk of modifying the input as
469
+ # there are no flattened fields), or create one.
470
+ if not isinstance(
471
+ request,
472
+ deployment_resource_pool_service.CreateDeploymentResourcePoolRequest,
473
+ ):
474
+ request = (
475
+ deployment_resource_pool_service.CreateDeploymentResourcePoolRequest(
476
+ request
477
+ )
478
+ )
479
+
480
+ # If we have keyword arguments corresponding to fields on the
481
+ # request, apply these.
482
+ if parent is not None:
483
+ request.parent = parent
484
+ if deployment_resource_pool is not None:
485
+ request.deployment_resource_pool = deployment_resource_pool
486
+ if deployment_resource_pool_id is not None:
487
+ request.deployment_resource_pool_id = deployment_resource_pool_id
488
+
489
+ # Wrap the RPC method; this adds retry and timeout information,
490
+ # and friendly error handling.
491
+ rpc = self._client._transport._wrapped_methods[
492
+ self._client._transport.create_deployment_resource_pool
493
+ ]
494
+
495
+ # Certain fields should be provided within the metadata header;
496
+ # add these here.
497
+ metadata = tuple(metadata) + (
498
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
499
+ )
500
+
501
+ # Validate the universe domain.
502
+ self._client._validate_universe_domain()
503
+
504
+ # Send the request.
505
+ response = await rpc(
506
+ request,
507
+ retry=retry,
508
+ timeout=timeout,
509
+ metadata=metadata,
510
+ )
511
+
512
+ # Wrap the response in an operation future.
513
+ response = operation_async.from_gapic(
514
+ response,
515
+ self._client._transport.operations_client,
516
+ gca_deployment_resource_pool.DeploymentResourcePool,
517
+ metadata_type=deployment_resource_pool_service.CreateDeploymentResourcePoolOperationMetadata,
518
+ )
519
+
520
+ # Done; return the response.
521
+ return response
522
+
523
+ async def get_deployment_resource_pool(
524
+ self,
525
+ request: Optional[
526
+ Union[
527
+ deployment_resource_pool_service.GetDeploymentResourcePoolRequest, dict
528
+ ]
529
+ ] = None,
530
+ *,
531
+ name: Optional[str] = None,
532
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
533
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
534
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
535
+ ) -> deployment_resource_pool.DeploymentResourcePool:
536
+ r"""Get a DeploymentResourcePool.
537
+
538
+ .. code-block:: python
539
+
540
+ # This snippet has been automatically generated and should be regarded as a
541
+ # code template only.
542
+ # It will require modifications to work:
543
+ # - It may require correct/in-range values for request initialization.
544
+ # - It may require specifying regional endpoints when creating the service
545
+ # client as shown in:
546
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
547
+ from google.cloud import aiplatform_v1
548
+
549
+ async def sample_get_deployment_resource_pool():
550
+ # Create a client
551
+ client = aiplatform_v1.DeploymentResourcePoolServiceAsyncClient()
552
+
553
+ # Initialize request argument(s)
554
+ request = aiplatform_v1.GetDeploymentResourcePoolRequest(
555
+ name="name_value",
556
+ )
557
+
558
+ # Make the request
559
+ response = await client.get_deployment_resource_pool(request=request)
560
+
561
+ # Handle the response
562
+ print(response)
563
+
564
+ Args:
565
+ request (Optional[Union[google.cloud.aiplatform_v1.types.GetDeploymentResourcePoolRequest, dict]]):
566
+ The request object. Request message for
567
+ GetDeploymentResourcePool method.
568
+ name (:class:`str`):
569
+ Required. The name of the DeploymentResourcePool to
570
+ retrieve. Format:
571
+ ``projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool}``
572
+
573
+ This corresponds to the ``name`` field
574
+ on the ``request`` instance; if ``request`` is provided, this
575
+ should not be set.
576
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
577
+ should be retried.
578
+ timeout (float): The timeout for this request.
579
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
580
+ sent along with the request as metadata. Normally, each value must be of type `str`,
581
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
582
+ be of type `bytes`.
583
+
584
+ Returns:
585
+ google.cloud.aiplatform_v1.types.DeploymentResourcePool:
586
+ A description of resources that can
587
+ be shared by multiple DeployedModels,
588
+ whose underlying specification consists
589
+ of a DedicatedResources.
590
+
591
+ """
592
+ # Create or coerce a protobuf request object.
593
+ # - Quick check: If we got a request object, we should *not* have
594
+ # gotten any keyword arguments that map to the request.
595
+ flattened_params = [name]
596
+ has_flattened_params = (
597
+ len([param for param in flattened_params if param is not None]) > 0
598
+ )
599
+ if request is not None and has_flattened_params:
600
+ raise ValueError(
601
+ "If the `request` argument is set, then none of "
602
+ "the individual field arguments should be set."
603
+ )
604
+
605
+ # - Use the request object if provided (there's no risk of modifying the input as
606
+ # there are no flattened fields), or create one.
607
+ if not isinstance(
608
+ request, deployment_resource_pool_service.GetDeploymentResourcePoolRequest
609
+ ):
610
+ request = deployment_resource_pool_service.GetDeploymentResourcePoolRequest(
611
+ request
612
+ )
613
+
614
+ # If we have keyword arguments corresponding to fields on the
615
+ # request, apply these.
616
+ if name is not None:
617
+ request.name = name
618
+
619
+ # Wrap the RPC method; this adds retry and timeout information,
620
+ # and friendly error handling.
621
+ rpc = self._client._transport._wrapped_methods[
622
+ self._client._transport.get_deployment_resource_pool
623
+ ]
624
+
625
+ # Certain fields should be provided within the metadata header;
626
+ # add these here.
627
+ metadata = tuple(metadata) + (
628
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
629
+ )
630
+
631
+ # Validate the universe domain.
632
+ self._client._validate_universe_domain()
633
+
634
+ # Send the request.
635
+ response = await rpc(
636
+ request,
637
+ retry=retry,
638
+ timeout=timeout,
639
+ metadata=metadata,
640
+ )
641
+
642
+ # Done; return the response.
643
+ return response
644
+
645
+ async def list_deployment_resource_pools(
646
+ self,
647
+ request: Optional[
648
+ Union[
649
+ deployment_resource_pool_service.ListDeploymentResourcePoolsRequest,
650
+ dict,
651
+ ]
652
+ ] = None,
653
+ *,
654
+ parent: Optional[str] = None,
655
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
656
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
657
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
658
+ ) -> pagers.ListDeploymentResourcePoolsAsyncPager:
659
+ r"""List DeploymentResourcePools in a location.
660
+
661
+ .. code-block:: python
662
+
663
+ # This snippet has been automatically generated and should be regarded as a
664
+ # code template only.
665
+ # It will require modifications to work:
666
+ # - It may require correct/in-range values for request initialization.
667
+ # - It may require specifying regional endpoints when creating the service
668
+ # client as shown in:
669
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
670
+ from google.cloud import aiplatform_v1
671
+
672
+ async def sample_list_deployment_resource_pools():
673
+ # Create a client
674
+ client = aiplatform_v1.DeploymentResourcePoolServiceAsyncClient()
675
+
676
+ # Initialize request argument(s)
677
+ request = aiplatform_v1.ListDeploymentResourcePoolsRequest(
678
+ parent="parent_value",
679
+ )
680
+
681
+ # Make the request
682
+ page_result = client.list_deployment_resource_pools(request=request)
683
+
684
+ # Handle the response
685
+ async for response in page_result:
686
+ print(response)
687
+
688
+ Args:
689
+ request (Optional[Union[google.cloud.aiplatform_v1.types.ListDeploymentResourcePoolsRequest, dict]]):
690
+ The request object. Request message for
691
+ ListDeploymentResourcePools method.
692
+ parent (:class:`str`):
693
+ Required. The parent Location which owns this collection
694
+ of DeploymentResourcePools. Format:
695
+ ``projects/{project}/locations/{location}``
696
+
697
+ This corresponds to the ``parent`` field
698
+ on the ``request`` instance; if ``request`` is provided, this
699
+ should not be set.
700
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
701
+ should be retried.
702
+ timeout (float): The timeout for this request.
703
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
704
+ sent along with the request as metadata. Normally, each value must be of type `str`,
705
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
706
+ be of type `bytes`.
707
+
708
+ Returns:
709
+ google.cloud.aiplatform_v1.services.deployment_resource_pool_service.pagers.ListDeploymentResourcePoolsAsyncPager:
710
+ Response message for
711
+ ListDeploymentResourcePools method.
712
+ Iterating over this object will yield
713
+ results and resolve additional pages
714
+ automatically.
715
+
716
+ """
717
+ # Create or coerce a protobuf request object.
718
+ # - Quick check: If we got a request object, we should *not* have
719
+ # gotten any keyword arguments that map to the request.
720
+ flattened_params = [parent]
721
+ has_flattened_params = (
722
+ len([param for param in flattened_params if param is not None]) > 0
723
+ )
724
+ if request is not None and has_flattened_params:
725
+ raise ValueError(
726
+ "If the `request` argument is set, then none of "
727
+ "the individual field arguments should be set."
728
+ )
729
+
730
+ # - Use the request object if provided (there's no risk of modifying the input as
731
+ # there are no flattened fields), or create one.
732
+ if not isinstance(
733
+ request, deployment_resource_pool_service.ListDeploymentResourcePoolsRequest
734
+ ):
735
+ request = (
736
+ deployment_resource_pool_service.ListDeploymentResourcePoolsRequest(
737
+ request
738
+ )
739
+ )
740
+
741
+ # If we have keyword arguments corresponding to fields on the
742
+ # request, apply these.
743
+ if parent is not None:
744
+ request.parent = parent
745
+
746
+ # Wrap the RPC method; this adds retry and timeout information,
747
+ # and friendly error handling.
748
+ rpc = self._client._transport._wrapped_methods[
749
+ self._client._transport.list_deployment_resource_pools
750
+ ]
751
+
752
+ # Certain fields should be provided within the metadata header;
753
+ # add these here.
754
+ metadata = tuple(metadata) + (
755
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
756
+ )
757
+
758
+ # Validate the universe domain.
759
+ self._client._validate_universe_domain()
760
+
761
+ # Send the request.
762
+ response = await rpc(
763
+ request,
764
+ retry=retry,
765
+ timeout=timeout,
766
+ metadata=metadata,
767
+ )
768
+
769
+ # This method is paged; wrap the response in a pager, which provides
770
+ # an `__aiter__` convenience method.
771
+ response = pagers.ListDeploymentResourcePoolsAsyncPager(
772
+ method=rpc,
773
+ request=request,
774
+ response=response,
775
+ retry=retry,
776
+ timeout=timeout,
777
+ metadata=metadata,
778
+ )
779
+
780
+ # Done; return the response.
781
+ return response
782
+
783
+ async def update_deployment_resource_pool(
784
+ self,
785
+ request: Optional[
786
+ Union[
787
+ deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest,
788
+ dict,
789
+ ]
790
+ ] = None,
791
+ *,
792
+ deployment_resource_pool: Optional[
793
+ gca_deployment_resource_pool.DeploymentResourcePool
794
+ ] = None,
795
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
796
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
797
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
798
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
799
+ ) -> operation_async.AsyncOperation:
800
+ r"""Update a DeploymentResourcePool.
801
+
802
+ .. code-block:: python
803
+
804
+ # This snippet has been automatically generated and should be regarded as a
805
+ # code template only.
806
+ # It will require modifications to work:
807
+ # - It may require correct/in-range values for request initialization.
808
+ # - It may require specifying regional endpoints when creating the service
809
+ # client as shown in:
810
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
811
+ from google.cloud import aiplatform_v1
812
+
813
+ async def sample_update_deployment_resource_pool():
814
+ # Create a client
815
+ client = aiplatform_v1.DeploymentResourcePoolServiceAsyncClient()
816
+
817
+ # Initialize request argument(s)
818
+ deployment_resource_pool = aiplatform_v1.DeploymentResourcePool()
819
+ deployment_resource_pool.dedicated_resources.min_replica_count = 1803
820
+
821
+ request = aiplatform_v1.UpdateDeploymentResourcePoolRequest(
822
+ deployment_resource_pool=deployment_resource_pool,
823
+ )
824
+
825
+ # Make the request
826
+ operation = client.update_deployment_resource_pool(request=request)
827
+
828
+ print("Waiting for operation to complete...")
829
+
830
+ response = (await operation).result()
831
+
832
+ # Handle the response
833
+ print(response)
834
+
835
+ Args:
836
+ request (Optional[Union[google.cloud.aiplatform_v1.types.UpdateDeploymentResourcePoolRequest, dict]]):
837
+ The request object. Request message for
838
+ UpdateDeploymentResourcePool method.
839
+ deployment_resource_pool (:class:`google.cloud.aiplatform_v1.types.DeploymentResourcePool`):
840
+ Required. The DeploymentResourcePool to update.
841
+
842
+ The DeploymentResourcePool's ``name`` field is used to
843
+ identify the DeploymentResourcePool to update. Format:
844
+ ``projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool}``
845
+
846
+ This corresponds to the ``deployment_resource_pool`` field
847
+ on the ``request`` instance; if ``request`` is provided, this
848
+ should not be set.
849
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
850
+ Required. The list of fields to
851
+ update.
852
+
853
+ This corresponds to the ``update_mask`` field
854
+ on the ``request`` instance; if ``request`` is provided, this
855
+ should not be set.
856
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
857
+ should be retried.
858
+ timeout (float): The timeout for this request.
859
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
860
+ sent along with the request as metadata. Normally, each value must be of type `str`,
861
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
862
+ be of type `bytes`.
863
+
864
+ Returns:
865
+ google.api_core.operation_async.AsyncOperation:
866
+ An object representing a long-running operation.
867
+
868
+ The result type for the operation will be :class:`google.cloud.aiplatform_v1.types.DeploymentResourcePool` A description of resources that can be shared by multiple DeployedModels,
869
+ whose underlying specification consists of a
870
+ DedicatedResources.
871
+
872
+ """
873
+ # Create or coerce a protobuf request object.
874
+ # - Quick check: If we got a request object, we should *not* have
875
+ # gotten any keyword arguments that map to the request.
876
+ flattened_params = [deployment_resource_pool, update_mask]
877
+ has_flattened_params = (
878
+ len([param for param in flattened_params if param is not None]) > 0
879
+ )
880
+ if request is not None and has_flattened_params:
881
+ raise ValueError(
882
+ "If the `request` argument is set, then none of "
883
+ "the individual field arguments should be set."
884
+ )
885
+
886
+ # - Use the request object if provided (there's no risk of modifying the input as
887
+ # there are no flattened fields), or create one.
888
+ if not isinstance(
889
+ request,
890
+ deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest,
891
+ ):
892
+ request = (
893
+ deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest(
894
+ request
895
+ )
896
+ )
897
+
898
+ # If we have keyword arguments corresponding to fields on the
899
+ # request, apply these.
900
+ if deployment_resource_pool is not None:
901
+ request.deployment_resource_pool = deployment_resource_pool
902
+ if update_mask is not None:
903
+ request.update_mask = update_mask
904
+
905
+ # Wrap the RPC method; this adds retry and timeout information,
906
+ # and friendly error handling.
907
+ rpc = self._client._transport._wrapped_methods[
908
+ self._client._transport.update_deployment_resource_pool
909
+ ]
910
+
911
+ # Certain fields should be provided within the metadata header;
912
+ # add these here.
913
+ metadata = tuple(metadata) + (
914
+ gapic_v1.routing_header.to_grpc_metadata(
915
+ (
916
+ (
917
+ "deployment_resource_pool.name",
918
+ request.deployment_resource_pool.name,
919
+ ),
920
+ )
921
+ ),
922
+ )
923
+
924
+ # Validate the universe domain.
925
+ self._client._validate_universe_domain()
926
+
927
+ # Send the request.
928
+ response = await rpc(
929
+ request,
930
+ retry=retry,
931
+ timeout=timeout,
932
+ metadata=metadata,
933
+ )
934
+
935
+ # Wrap the response in an operation future.
936
+ response = operation_async.from_gapic(
937
+ response,
938
+ self._client._transport.operations_client,
939
+ gca_deployment_resource_pool.DeploymentResourcePool,
940
+ metadata_type=deployment_resource_pool_service.UpdateDeploymentResourcePoolOperationMetadata,
941
+ )
942
+
943
+ # Done; return the response.
944
+ return response
945
+
946
+ async def delete_deployment_resource_pool(
947
+ self,
948
+ request: Optional[
949
+ Union[
950
+ deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest,
951
+ dict,
952
+ ]
953
+ ] = None,
954
+ *,
955
+ name: Optional[str] = None,
956
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
957
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
958
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
959
+ ) -> operation_async.AsyncOperation:
960
+ r"""Delete a DeploymentResourcePool.
961
+
962
+ .. code-block:: python
963
+
964
+ # This snippet has been automatically generated and should be regarded as a
965
+ # code template only.
966
+ # It will require modifications to work:
967
+ # - It may require correct/in-range values for request initialization.
968
+ # - It may require specifying regional endpoints when creating the service
969
+ # client as shown in:
970
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
971
+ from google.cloud import aiplatform_v1
972
+
973
+ async def sample_delete_deployment_resource_pool():
974
+ # Create a client
975
+ client = aiplatform_v1.DeploymentResourcePoolServiceAsyncClient()
976
+
977
+ # Initialize request argument(s)
978
+ request = aiplatform_v1.DeleteDeploymentResourcePoolRequest(
979
+ name="name_value",
980
+ )
981
+
982
+ # Make the request
983
+ operation = client.delete_deployment_resource_pool(request=request)
984
+
985
+ print("Waiting for operation to complete...")
986
+
987
+ response = (await operation).result()
988
+
989
+ # Handle the response
990
+ print(response)
991
+
992
+ Args:
993
+ request (Optional[Union[google.cloud.aiplatform_v1.types.DeleteDeploymentResourcePoolRequest, dict]]):
994
+ The request object. Request message for
995
+ DeleteDeploymentResourcePool method.
996
+ name (:class:`str`):
997
+ Required. The name of the DeploymentResourcePool to
998
+ delete. Format:
999
+ ``projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool}``
1000
+
1001
+ This corresponds to the ``name`` field
1002
+ on the ``request`` instance; if ``request`` is provided, this
1003
+ should not be set.
1004
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1005
+ should be retried.
1006
+ timeout (float): The timeout for this request.
1007
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1008
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1009
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1010
+ be of type `bytes`.
1011
+
1012
+ Returns:
1013
+ google.api_core.operation_async.AsyncOperation:
1014
+ An object representing a long-running operation.
1015
+
1016
+ 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
1017
+ empty messages in your APIs. A typical example is to
1018
+ use it as the request or the response type of an API
1019
+ method. For instance:
1020
+
1021
+ service Foo {
1022
+ rpc Bar(google.protobuf.Empty) returns
1023
+ (google.protobuf.Empty);
1024
+
1025
+ }
1026
+
1027
+ """
1028
+ # Create or coerce a protobuf request object.
1029
+ # - Quick check: If we got a request object, we should *not* have
1030
+ # gotten any keyword arguments that map to the request.
1031
+ flattened_params = [name]
1032
+ has_flattened_params = (
1033
+ len([param for param in flattened_params if param is not None]) > 0
1034
+ )
1035
+ if request is not None and has_flattened_params:
1036
+ raise ValueError(
1037
+ "If the `request` argument is set, then none of "
1038
+ "the individual field arguments should be set."
1039
+ )
1040
+
1041
+ # - Use the request object if provided (there's no risk of modifying the input as
1042
+ # there are no flattened fields), or create one.
1043
+ if not isinstance(
1044
+ request,
1045
+ deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest,
1046
+ ):
1047
+ request = (
1048
+ deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest(
1049
+ request
1050
+ )
1051
+ )
1052
+
1053
+ # If we have keyword arguments corresponding to fields on the
1054
+ # request, apply these.
1055
+ if name is not None:
1056
+ request.name = name
1057
+
1058
+ # Wrap the RPC method; this adds retry and timeout information,
1059
+ # and friendly error handling.
1060
+ rpc = self._client._transport._wrapped_methods[
1061
+ self._client._transport.delete_deployment_resource_pool
1062
+ ]
1063
+
1064
+ # Certain fields should be provided within the metadata header;
1065
+ # add these here.
1066
+ metadata = tuple(metadata) + (
1067
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1068
+ )
1069
+
1070
+ # Validate the universe domain.
1071
+ self._client._validate_universe_domain()
1072
+
1073
+ # Send the request.
1074
+ response = await rpc(
1075
+ request,
1076
+ retry=retry,
1077
+ timeout=timeout,
1078
+ metadata=metadata,
1079
+ )
1080
+
1081
+ # Wrap the response in an operation future.
1082
+ response = operation_async.from_gapic(
1083
+ response,
1084
+ self._client._transport.operations_client,
1085
+ empty_pb2.Empty,
1086
+ metadata_type=gca_operation.DeleteOperationMetadata,
1087
+ )
1088
+
1089
+ # Done; return the response.
1090
+ return response
1091
+
1092
+ async def query_deployed_models(
1093
+ self,
1094
+ request: Optional[
1095
+ Union[deployment_resource_pool_service.QueryDeployedModelsRequest, dict]
1096
+ ] = None,
1097
+ *,
1098
+ deployment_resource_pool: Optional[str] = None,
1099
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1100
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1101
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1102
+ ) -> pagers.QueryDeployedModelsAsyncPager:
1103
+ r"""List DeployedModels that have been deployed on this
1104
+ DeploymentResourcePool.
1105
+
1106
+ .. code-block:: python
1107
+
1108
+ # This snippet has been automatically generated and should be regarded as a
1109
+ # code template only.
1110
+ # It will require modifications to work:
1111
+ # - It may require correct/in-range values for request initialization.
1112
+ # - It may require specifying regional endpoints when creating the service
1113
+ # client as shown in:
1114
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1115
+ from google.cloud import aiplatform_v1
1116
+
1117
+ async def sample_query_deployed_models():
1118
+ # Create a client
1119
+ client = aiplatform_v1.DeploymentResourcePoolServiceAsyncClient()
1120
+
1121
+ # Initialize request argument(s)
1122
+ request = aiplatform_v1.QueryDeployedModelsRequest(
1123
+ deployment_resource_pool="deployment_resource_pool_value",
1124
+ )
1125
+
1126
+ # Make the request
1127
+ page_result = client.query_deployed_models(request=request)
1128
+
1129
+ # Handle the response
1130
+ async for response in page_result:
1131
+ print(response)
1132
+
1133
+ Args:
1134
+ request (Optional[Union[google.cloud.aiplatform_v1.types.QueryDeployedModelsRequest, dict]]):
1135
+ The request object. Request message for
1136
+ QueryDeployedModels method.
1137
+ deployment_resource_pool (:class:`str`):
1138
+ Required. The name of the target DeploymentResourcePool
1139
+ to query. Format:
1140
+ ``projects/{project}/locations/{location}/deploymentResourcePools/{deployment_resource_pool}``
1141
+
1142
+ This corresponds to the ``deployment_resource_pool`` field
1143
+ on the ``request`` instance; if ``request`` is provided, this
1144
+ should not be set.
1145
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1146
+ should be retried.
1147
+ timeout (float): The timeout for this request.
1148
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1149
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1150
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1151
+ be of type `bytes`.
1152
+
1153
+ Returns:
1154
+ google.cloud.aiplatform_v1.services.deployment_resource_pool_service.pagers.QueryDeployedModelsAsyncPager:
1155
+ Response message for
1156
+ QueryDeployedModels method.
1157
+ Iterating over this object will yield
1158
+ results and resolve additional pages
1159
+ automatically.
1160
+
1161
+ """
1162
+ # Create or coerce a protobuf request object.
1163
+ # - Quick check: If we got a request object, we should *not* have
1164
+ # gotten any keyword arguments that map to the request.
1165
+ flattened_params = [deployment_resource_pool]
1166
+ has_flattened_params = (
1167
+ len([param for param in flattened_params if param is not None]) > 0
1168
+ )
1169
+ if request is not None and has_flattened_params:
1170
+ raise ValueError(
1171
+ "If the `request` argument is set, then none of "
1172
+ "the individual field arguments should be set."
1173
+ )
1174
+
1175
+ # - Use the request object if provided (there's no risk of modifying the input as
1176
+ # there are no flattened fields), or create one.
1177
+ if not isinstance(
1178
+ request, deployment_resource_pool_service.QueryDeployedModelsRequest
1179
+ ):
1180
+ request = deployment_resource_pool_service.QueryDeployedModelsRequest(
1181
+ request
1182
+ )
1183
+
1184
+ # If we have keyword arguments corresponding to fields on the
1185
+ # request, apply these.
1186
+ if deployment_resource_pool is not None:
1187
+ request.deployment_resource_pool = deployment_resource_pool
1188
+
1189
+ # Wrap the RPC method; this adds retry and timeout information,
1190
+ # and friendly error handling.
1191
+ rpc = self._client._transport._wrapped_methods[
1192
+ self._client._transport.query_deployed_models
1193
+ ]
1194
+
1195
+ # Certain fields should be provided within the metadata header;
1196
+ # add these here.
1197
+ metadata = tuple(metadata) + (
1198
+ gapic_v1.routing_header.to_grpc_metadata(
1199
+ (("deployment_resource_pool", request.deployment_resource_pool),)
1200
+ ),
1201
+ )
1202
+
1203
+ # Validate the universe domain.
1204
+ self._client._validate_universe_domain()
1205
+
1206
+ # Send the request.
1207
+ response = await rpc(
1208
+ request,
1209
+ retry=retry,
1210
+ timeout=timeout,
1211
+ metadata=metadata,
1212
+ )
1213
+
1214
+ # This method is paged; wrap the response in a pager, which provides
1215
+ # an `__aiter__` convenience method.
1216
+ response = pagers.QueryDeployedModelsAsyncPager(
1217
+ method=rpc,
1218
+ request=request,
1219
+ response=response,
1220
+ retry=retry,
1221
+ timeout=timeout,
1222
+ metadata=metadata,
1223
+ )
1224
+
1225
+ # Done; return the response.
1226
+ return response
1227
+
1228
+ async def list_operations(
1229
+ self,
1230
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
1231
+ *,
1232
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1233
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1234
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1235
+ ) -> operations_pb2.ListOperationsResponse:
1236
+ r"""Lists operations that match the specified filter in the request.
1237
+
1238
+ Args:
1239
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
1240
+ The request object. Request message for
1241
+ `ListOperations` method.
1242
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1243
+ if any, should be retried.
1244
+ timeout (float): The timeout for this request.
1245
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1246
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1247
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1248
+ be of type `bytes`.
1249
+ Returns:
1250
+ ~.operations_pb2.ListOperationsResponse:
1251
+ Response message for ``ListOperations`` method.
1252
+ """
1253
+ # Create or coerce a protobuf request object.
1254
+ # The request isn't a proto-plus wrapped type,
1255
+ # so it must be constructed via keyword expansion.
1256
+ if isinstance(request, dict):
1257
+ request = operations_pb2.ListOperationsRequest(**request)
1258
+
1259
+ # Wrap the RPC method; this adds retry and timeout information,
1260
+ # and friendly error handling.
1261
+ rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
1262
+
1263
+ # Certain fields should be provided within the metadata header;
1264
+ # add these here.
1265
+ metadata = tuple(metadata) + (
1266
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1267
+ )
1268
+
1269
+ # Validate the universe domain.
1270
+ self._client._validate_universe_domain()
1271
+
1272
+ # Send the request.
1273
+ response = await rpc(
1274
+ request,
1275
+ retry=retry,
1276
+ timeout=timeout,
1277
+ metadata=metadata,
1278
+ )
1279
+
1280
+ # Done; return the response.
1281
+ return response
1282
+
1283
+ async def get_operation(
1284
+ self,
1285
+ request: Optional[operations_pb2.GetOperationRequest] = None,
1286
+ *,
1287
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1288
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1289
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1290
+ ) -> operations_pb2.Operation:
1291
+ r"""Gets the latest state of a long-running operation.
1292
+
1293
+ Args:
1294
+ request (:class:`~.operations_pb2.GetOperationRequest`):
1295
+ The request object. Request message for
1296
+ `GetOperation` method.
1297
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1298
+ if any, should be retried.
1299
+ timeout (float): The timeout for this request.
1300
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1301
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1302
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1303
+ be of type `bytes`.
1304
+ Returns:
1305
+ ~.operations_pb2.Operation:
1306
+ An ``Operation`` object.
1307
+ """
1308
+ # Create or coerce a protobuf request object.
1309
+ # The request isn't a proto-plus wrapped type,
1310
+ # so it must be constructed via keyword expansion.
1311
+ if isinstance(request, dict):
1312
+ request = operations_pb2.GetOperationRequest(**request)
1313
+
1314
+ # Wrap the RPC method; this adds retry and timeout information,
1315
+ # and friendly error handling.
1316
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
1317
+
1318
+ # Certain fields should be provided within the metadata header;
1319
+ # add these here.
1320
+ metadata = tuple(metadata) + (
1321
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1322
+ )
1323
+
1324
+ # Validate the universe domain.
1325
+ self._client._validate_universe_domain()
1326
+
1327
+ # Send the request.
1328
+ response = await rpc(
1329
+ request,
1330
+ retry=retry,
1331
+ timeout=timeout,
1332
+ metadata=metadata,
1333
+ )
1334
+
1335
+ # Done; return the response.
1336
+ return response
1337
+
1338
+ async def delete_operation(
1339
+ self,
1340
+ request: Optional[operations_pb2.DeleteOperationRequest] = None,
1341
+ *,
1342
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1343
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1344
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1345
+ ) -> None:
1346
+ r"""Deletes a long-running operation.
1347
+
1348
+ This method indicates that the client is no longer interested
1349
+ in the operation result. It does not cancel the operation.
1350
+ If the server doesn't support this method, it returns
1351
+ `google.rpc.Code.UNIMPLEMENTED`.
1352
+
1353
+ Args:
1354
+ request (:class:`~.operations_pb2.DeleteOperationRequest`):
1355
+ The request object. Request message for
1356
+ `DeleteOperation` method.
1357
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1358
+ if any, should be retried.
1359
+ timeout (float): The timeout for this request.
1360
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1361
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1362
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1363
+ be of type `bytes`.
1364
+ Returns:
1365
+ None
1366
+ """
1367
+ # Create or coerce a protobuf request object.
1368
+ # The request isn't a proto-plus wrapped type,
1369
+ # so it must be constructed via keyword expansion.
1370
+ if isinstance(request, dict):
1371
+ request = operations_pb2.DeleteOperationRequest(**request)
1372
+
1373
+ # Wrap the RPC method; this adds retry and timeout information,
1374
+ # and friendly error handling.
1375
+ rpc = self.transport._wrapped_methods[self._client._transport.delete_operation]
1376
+
1377
+ # Certain fields should be provided within the metadata header;
1378
+ # add these here.
1379
+ metadata = tuple(metadata) + (
1380
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1381
+ )
1382
+
1383
+ # Validate the universe domain.
1384
+ self._client._validate_universe_domain()
1385
+
1386
+ # Send the request.
1387
+ await rpc(
1388
+ request,
1389
+ retry=retry,
1390
+ timeout=timeout,
1391
+ metadata=metadata,
1392
+ )
1393
+
1394
+ async def cancel_operation(
1395
+ self,
1396
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
1397
+ *,
1398
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1399
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1400
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1401
+ ) -> None:
1402
+ r"""Starts asynchronous cancellation on a long-running operation.
1403
+
1404
+ The server makes a best effort to cancel the operation, but success
1405
+ is not guaranteed. If the server doesn't support this method, it returns
1406
+ `google.rpc.Code.UNIMPLEMENTED`.
1407
+
1408
+ Args:
1409
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
1410
+ The request object. Request message for
1411
+ `CancelOperation` method.
1412
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1413
+ if any, should be retried.
1414
+ timeout (float): The timeout for this request.
1415
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1416
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1417
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1418
+ be of type `bytes`.
1419
+ Returns:
1420
+ None
1421
+ """
1422
+ # Create or coerce a protobuf request object.
1423
+ # The request isn't a proto-plus wrapped type,
1424
+ # so it must be constructed via keyword expansion.
1425
+ if isinstance(request, dict):
1426
+ request = operations_pb2.CancelOperationRequest(**request)
1427
+
1428
+ # Wrap the RPC method; this adds retry and timeout information,
1429
+ # and friendly error handling.
1430
+ rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
1431
+
1432
+ # Certain fields should be provided within the metadata header;
1433
+ # add these here.
1434
+ metadata = tuple(metadata) + (
1435
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1436
+ )
1437
+
1438
+ # Validate the universe domain.
1439
+ self._client._validate_universe_domain()
1440
+
1441
+ # Send the request.
1442
+ await rpc(
1443
+ request,
1444
+ retry=retry,
1445
+ timeout=timeout,
1446
+ metadata=metadata,
1447
+ )
1448
+
1449
+ async def wait_operation(
1450
+ self,
1451
+ request: Optional[operations_pb2.WaitOperationRequest] = None,
1452
+ *,
1453
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1454
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1455
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1456
+ ) -> operations_pb2.Operation:
1457
+ r"""Waits until the specified long-running operation is done or reaches at most
1458
+ a specified timeout, returning the latest state.
1459
+
1460
+ If the operation is already done, the latest state is immediately returned.
1461
+ If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
1462
+ timeout is used. If the server does not support this method, it returns
1463
+ `google.rpc.Code.UNIMPLEMENTED`.
1464
+
1465
+ Args:
1466
+ request (:class:`~.operations_pb2.WaitOperationRequest`):
1467
+ The request object. Request message for
1468
+ `WaitOperation` method.
1469
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1470
+ if any, should be retried.
1471
+ timeout (float): The timeout for this request.
1472
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1473
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1474
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1475
+ be of type `bytes`.
1476
+ Returns:
1477
+ ~.operations_pb2.Operation:
1478
+ An ``Operation`` object.
1479
+ """
1480
+ # Create or coerce a protobuf request object.
1481
+ # The request isn't a proto-plus wrapped type,
1482
+ # so it must be constructed via keyword expansion.
1483
+ if isinstance(request, dict):
1484
+ request = operations_pb2.WaitOperationRequest(**request)
1485
+
1486
+ # Wrap the RPC method; this adds retry and timeout information,
1487
+ # and friendly error handling.
1488
+ rpc = self.transport._wrapped_methods[self._client._transport.wait_operation]
1489
+
1490
+ # Certain fields should be provided within the metadata header;
1491
+ # add these here.
1492
+ metadata = tuple(metadata) + (
1493
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1494
+ )
1495
+
1496
+ # Validate the universe domain.
1497
+ self._client._validate_universe_domain()
1498
+
1499
+ # Send the request.
1500
+ response = await rpc(
1501
+ request,
1502
+ retry=retry,
1503
+ timeout=timeout,
1504
+ metadata=metadata,
1505
+ )
1506
+
1507
+ # Done; return the response.
1508
+ return response
1509
+
1510
+ async def set_iam_policy(
1511
+ self,
1512
+ request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
1513
+ *,
1514
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1515
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1516
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1517
+ ) -> policy_pb2.Policy:
1518
+ r"""Sets the IAM access control policy on the specified function.
1519
+
1520
+ Replaces any existing policy.
1521
+
1522
+ Args:
1523
+ request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`):
1524
+ The request object. Request message for `SetIamPolicy`
1525
+ method.
1526
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1527
+ should be retried.
1528
+ timeout (float): The timeout for this request.
1529
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1530
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1531
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1532
+ be of type `bytes`.
1533
+ Returns:
1534
+ ~.policy_pb2.Policy:
1535
+ Defines an Identity and Access Management (IAM) policy.
1536
+ It is used to specify access control policies for Cloud
1537
+ Platform resources.
1538
+ A ``Policy`` is a collection of ``bindings``. A
1539
+ ``binding`` binds one or more ``members`` to a single
1540
+ ``role``. Members can be user accounts, service
1541
+ accounts, Google groups, and domains (such as G Suite).
1542
+ A ``role`` is a named list of permissions (defined by
1543
+ IAM or configured by users). A ``binding`` can
1544
+ optionally specify a ``condition``, which is a logic
1545
+ expression that further constrains the role binding
1546
+ based on attributes about the request and/or target
1547
+ resource.
1548
+
1549
+ **JSON Example**
1550
+
1551
+ ::
1552
+
1553
+ {
1554
+ "bindings": [
1555
+ {
1556
+ "role": "roles/resourcemanager.organizationAdmin",
1557
+ "members": [
1558
+ "user:mike@example.com",
1559
+ "group:admins@example.com",
1560
+ "domain:google.com",
1561
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
1562
+ ]
1563
+ },
1564
+ {
1565
+ "role": "roles/resourcemanager.organizationViewer",
1566
+ "members": ["user:eve@example.com"],
1567
+ "condition": {
1568
+ "title": "expirable access",
1569
+ "description": "Does not grant access after Sep 2020",
1570
+ "expression": "request.time <
1571
+ timestamp('2020-10-01T00:00:00.000Z')",
1572
+ }
1573
+ }
1574
+ ]
1575
+ }
1576
+
1577
+ **YAML Example**
1578
+
1579
+ ::
1580
+
1581
+ bindings:
1582
+ - members:
1583
+ - user:mike@example.com
1584
+ - group:admins@example.com
1585
+ - domain:google.com
1586
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
1587
+ role: roles/resourcemanager.organizationAdmin
1588
+ - members:
1589
+ - user:eve@example.com
1590
+ role: roles/resourcemanager.organizationViewer
1591
+ condition:
1592
+ title: expirable access
1593
+ description: Does not grant access after Sep 2020
1594
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
1595
+
1596
+ For a description of IAM and its features, see the `IAM
1597
+ developer's
1598
+ guide <https://cloud.google.com/iam/docs>`__.
1599
+ """
1600
+ # Create or coerce a protobuf request object.
1601
+
1602
+ # The request isn't a proto-plus wrapped type,
1603
+ # so it must be constructed via keyword expansion.
1604
+ if isinstance(request, dict):
1605
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
1606
+
1607
+ # Wrap the RPC method; this adds retry and timeout information,
1608
+ # and friendly error handling.
1609
+ rpc = self.transport._wrapped_methods[self._client._transport.set_iam_policy]
1610
+
1611
+ # Certain fields should be provided within the metadata header;
1612
+ # add these here.
1613
+ metadata = tuple(metadata) + (
1614
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1615
+ )
1616
+
1617
+ # Validate the universe domain.
1618
+ self._client._validate_universe_domain()
1619
+
1620
+ # Send the request.
1621
+ response = await rpc(
1622
+ request,
1623
+ retry=retry,
1624
+ timeout=timeout,
1625
+ metadata=metadata,
1626
+ )
1627
+
1628
+ # Done; return the response.
1629
+ return response
1630
+
1631
+ async def get_iam_policy(
1632
+ self,
1633
+ request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
1634
+ *,
1635
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1636
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1637
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1638
+ ) -> policy_pb2.Policy:
1639
+ r"""Gets the IAM access control policy for a function.
1640
+
1641
+ Returns an empty policy if the function exists and does not have a
1642
+ policy set.
1643
+
1644
+ Args:
1645
+ request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
1646
+ The request object. Request message for `GetIamPolicy`
1647
+ method.
1648
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if
1649
+ any, should be retried.
1650
+ timeout (float): The timeout for this request.
1651
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1652
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1653
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1654
+ be of type `bytes`.
1655
+ Returns:
1656
+ ~.policy_pb2.Policy:
1657
+ Defines an Identity and Access Management (IAM) policy.
1658
+ It is used to specify access control policies for Cloud
1659
+ Platform resources.
1660
+ A ``Policy`` is a collection of ``bindings``. A
1661
+ ``binding`` binds one or more ``members`` to a single
1662
+ ``role``. Members can be user accounts, service
1663
+ accounts, Google groups, and domains (such as G Suite).
1664
+ A ``role`` is a named list of permissions (defined by
1665
+ IAM or configured by users). A ``binding`` can
1666
+ optionally specify a ``condition``, which is a logic
1667
+ expression that further constrains the role binding
1668
+ based on attributes about the request and/or target
1669
+ resource.
1670
+
1671
+ **JSON Example**
1672
+
1673
+ ::
1674
+
1675
+ {
1676
+ "bindings": [
1677
+ {
1678
+ "role": "roles/resourcemanager.organizationAdmin",
1679
+ "members": [
1680
+ "user:mike@example.com",
1681
+ "group:admins@example.com",
1682
+ "domain:google.com",
1683
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
1684
+ ]
1685
+ },
1686
+ {
1687
+ "role": "roles/resourcemanager.organizationViewer",
1688
+ "members": ["user:eve@example.com"],
1689
+ "condition": {
1690
+ "title": "expirable access",
1691
+ "description": "Does not grant access after Sep 2020",
1692
+ "expression": "request.time <
1693
+ timestamp('2020-10-01T00:00:00.000Z')",
1694
+ }
1695
+ }
1696
+ ]
1697
+ }
1698
+
1699
+ **YAML Example**
1700
+
1701
+ ::
1702
+
1703
+ bindings:
1704
+ - members:
1705
+ - user:mike@example.com
1706
+ - group:admins@example.com
1707
+ - domain:google.com
1708
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
1709
+ role: roles/resourcemanager.organizationAdmin
1710
+ - members:
1711
+ - user:eve@example.com
1712
+ role: roles/resourcemanager.organizationViewer
1713
+ condition:
1714
+ title: expirable access
1715
+ description: Does not grant access after Sep 2020
1716
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
1717
+
1718
+ For a description of IAM and its features, see the `IAM
1719
+ developer's
1720
+ guide <https://cloud.google.com/iam/docs>`__.
1721
+ """
1722
+ # Create or coerce a protobuf request object.
1723
+
1724
+ # The request isn't a proto-plus wrapped type,
1725
+ # so it must be constructed via keyword expansion.
1726
+ if isinstance(request, dict):
1727
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
1728
+
1729
+ # Wrap the RPC method; this adds retry and timeout information,
1730
+ # and friendly error handling.
1731
+ rpc = self.transport._wrapped_methods[self._client._transport.get_iam_policy]
1732
+
1733
+ # Certain fields should be provided within the metadata header;
1734
+ # add these here.
1735
+ metadata = tuple(metadata) + (
1736
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1737
+ )
1738
+
1739
+ # Validate the universe domain.
1740
+ self._client._validate_universe_domain()
1741
+
1742
+ # Send the request.
1743
+ response = await rpc(
1744
+ request,
1745
+ retry=retry,
1746
+ timeout=timeout,
1747
+ metadata=metadata,
1748
+ )
1749
+
1750
+ # Done; return the response.
1751
+ return response
1752
+
1753
+ async def test_iam_permissions(
1754
+ self,
1755
+ request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
1756
+ *,
1757
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1758
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1759
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1760
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1761
+ r"""Tests the specified IAM permissions against the IAM access control
1762
+ policy for a function.
1763
+
1764
+ If the function does not exist, this will return an empty set
1765
+ of permissions, not a NOT_FOUND error.
1766
+
1767
+ Args:
1768
+ request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
1769
+ The request object. Request message for
1770
+ `TestIamPermissions` method.
1771
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1772
+ if any, should be retried.
1773
+ timeout (float): The timeout for this request.
1774
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1775
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1776
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1777
+ be of type `bytes`.
1778
+ Returns:
1779
+ ~.iam_policy_pb2.TestIamPermissionsResponse:
1780
+ Response message for ``TestIamPermissions`` method.
1781
+ """
1782
+ # Create or coerce a protobuf request object.
1783
+
1784
+ # The request isn't a proto-plus wrapped type,
1785
+ # so it must be constructed via keyword expansion.
1786
+ if isinstance(request, dict):
1787
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
1788
+
1789
+ # Wrap the RPC method; this adds retry and timeout information,
1790
+ # and friendly error handling.
1791
+ rpc = self.transport._wrapped_methods[
1792
+ self._client._transport.test_iam_permissions
1793
+ ]
1794
+
1795
+ # Certain fields should be provided within the metadata header;
1796
+ # add these here.
1797
+ metadata = tuple(metadata) + (
1798
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1799
+ )
1800
+
1801
+ # Validate the universe domain.
1802
+ self._client._validate_universe_domain()
1803
+
1804
+ # Send the request.
1805
+ response = await rpc(
1806
+ request,
1807
+ retry=retry,
1808
+ timeout=timeout,
1809
+ metadata=metadata,
1810
+ )
1811
+
1812
+ # Done; return the response.
1813
+ return response
1814
+
1815
+ async def get_location(
1816
+ self,
1817
+ request: Optional[locations_pb2.GetLocationRequest] = None,
1818
+ *,
1819
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1820
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1821
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1822
+ ) -> locations_pb2.Location:
1823
+ r"""Gets information about a location.
1824
+
1825
+ Args:
1826
+ request (:class:`~.location_pb2.GetLocationRequest`):
1827
+ The request object. Request message for
1828
+ `GetLocation` method.
1829
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1830
+ if any, should be retried.
1831
+ timeout (float): The timeout for this request.
1832
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1833
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1834
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1835
+ be of type `bytes`.
1836
+ Returns:
1837
+ ~.location_pb2.Location:
1838
+ Location object.
1839
+ """
1840
+ # Create or coerce a protobuf request object.
1841
+ # The request isn't a proto-plus wrapped type,
1842
+ # so it must be constructed via keyword expansion.
1843
+ if isinstance(request, dict):
1844
+ request = locations_pb2.GetLocationRequest(**request)
1845
+
1846
+ # Wrap the RPC method; this adds retry and timeout information,
1847
+ # and friendly error handling.
1848
+ rpc = self.transport._wrapped_methods[self._client._transport.get_location]
1849
+
1850
+ # Certain fields should be provided within the metadata header;
1851
+ # add these here.
1852
+ metadata = tuple(metadata) + (
1853
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1854
+ )
1855
+
1856
+ # Validate the universe domain.
1857
+ self._client._validate_universe_domain()
1858
+
1859
+ # Send the request.
1860
+ response = await rpc(
1861
+ request,
1862
+ retry=retry,
1863
+ timeout=timeout,
1864
+ metadata=metadata,
1865
+ )
1866
+
1867
+ # Done; return the response.
1868
+ return response
1869
+
1870
+ async def list_locations(
1871
+ self,
1872
+ request: Optional[locations_pb2.ListLocationsRequest] = None,
1873
+ *,
1874
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1875
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1876
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1877
+ ) -> locations_pb2.ListLocationsResponse:
1878
+ r"""Lists information about the supported locations for this service.
1879
+
1880
+ Args:
1881
+ request (:class:`~.location_pb2.ListLocationsRequest`):
1882
+ The request object. Request message for
1883
+ `ListLocations` method.
1884
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1885
+ if any, should be retried.
1886
+ timeout (float): The timeout for this request.
1887
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1888
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1889
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1890
+ be of type `bytes`.
1891
+ Returns:
1892
+ ~.location_pb2.ListLocationsResponse:
1893
+ Response message for ``ListLocations`` method.
1894
+ """
1895
+ # Create or coerce a protobuf request object.
1896
+ # The request isn't a proto-plus wrapped type,
1897
+ # so it must be constructed via keyword expansion.
1898
+ if isinstance(request, dict):
1899
+ request = locations_pb2.ListLocationsRequest(**request)
1900
+
1901
+ # Wrap the RPC method; this adds retry and timeout information,
1902
+ # and friendly error handling.
1903
+ rpc = self.transport._wrapped_methods[self._client._transport.list_locations]
1904
+
1905
+ # Certain fields should be provided within the metadata header;
1906
+ # add these here.
1907
+ metadata = tuple(metadata) + (
1908
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1909
+ )
1910
+
1911
+ # Validate the universe domain.
1912
+ self._client._validate_universe_domain()
1913
+
1914
+ # Send the request.
1915
+ response = await rpc(
1916
+ request,
1917
+ retry=retry,
1918
+ timeout=timeout,
1919
+ metadata=metadata,
1920
+ )
1921
+
1922
+ # Done; return the response.
1923
+ return response
1924
+
1925
+ async def __aenter__(self) -> "DeploymentResourcePoolServiceAsyncClient":
1926
+ return self
1927
+
1928
+ async def __aexit__(self, exc_type, exc, tb):
1929
+ await self.transport.close()
1930
+
1931
+
1932
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1933
+ gapic_version=package_version.__version__
1934
+ )
1935
+
1936
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1937
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1938
+
1939
+
1940
+ __all__ = ("DeploymentResourcePoolServiceAsyncClient",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/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/aiplatform_v1/services/deployment_resource_pool_service/pagers.py ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 google.api_core import gapic_v1
17
+ from google.api_core import retry as retries
18
+ from google.api_core import retry_async as retries_async
19
+ from typing import (
20
+ Any,
21
+ AsyncIterator,
22
+ Awaitable,
23
+ Callable,
24
+ Sequence,
25
+ Tuple,
26
+ Optional,
27
+ Iterator,
28
+ Union,
29
+ )
30
+
31
+ try:
32
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
33
+ OptionalAsyncRetry = Union[
34
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
35
+ ]
36
+ except AttributeError: # pragma: NO COVER
37
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
38
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
39
+
40
+ from google.cloud.aiplatform_v1.types import deployment_resource_pool
41
+ from google.cloud.aiplatform_v1.types import deployment_resource_pool_service
42
+ from google.cloud.aiplatform_v1.types import endpoint
43
+
44
+
45
+ class ListDeploymentResourcePoolsPager:
46
+ """A pager for iterating through ``list_deployment_resource_pools`` requests.
47
+
48
+ This class thinly wraps an initial
49
+ :class:`google.cloud.aiplatform_v1.types.ListDeploymentResourcePoolsResponse` object, and
50
+ provides an ``__iter__`` method to iterate through its
51
+ ``deployment_resource_pools`` field.
52
+
53
+ If there are more pages, the ``__iter__`` method will make additional
54
+ ``ListDeploymentResourcePools`` requests and continue to iterate
55
+ through the ``deployment_resource_pools`` field on the
56
+ corresponding responses.
57
+
58
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListDeploymentResourcePoolsResponse`
59
+ attributes are available on the pager. If multiple requests are made, only
60
+ the most recent response is retained, and thus used for attribute lookup.
61
+ """
62
+
63
+ def __init__(
64
+ self,
65
+ method: Callable[
66
+ ..., deployment_resource_pool_service.ListDeploymentResourcePoolsResponse
67
+ ],
68
+ request: deployment_resource_pool_service.ListDeploymentResourcePoolsRequest,
69
+ response: deployment_resource_pool_service.ListDeploymentResourcePoolsResponse,
70
+ *,
71
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
72
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
73
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
74
+ ):
75
+ """Instantiate the pager.
76
+
77
+ Args:
78
+ method (Callable): The method that was originally called, and
79
+ which instantiated this pager.
80
+ request (google.cloud.aiplatform_v1.types.ListDeploymentResourcePoolsRequest):
81
+ The initial request object.
82
+ response (google.cloud.aiplatform_v1.types.ListDeploymentResourcePoolsResponse):
83
+ The initial response object.
84
+ retry (google.api_core.retry.Retry): Designation of what errors,
85
+ if any, should be retried.
86
+ timeout (float): The timeout for this request.
87
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
88
+ sent along with the request as metadata. Normally, each value must be of type `str`,
89
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
90
+ be of type `bytes`.
91
+ """
92
+ self._method = method
93
+ self._request = (
94
+ deployment_resource_pool_service.ListDeploymentResourcePoolsRequest(request)
95
+ )
96
+ self._response = response
97
+ self._retry = retry
98
+ self._timeout = timeout
99
+ self._metadata = metadata
100
+
101
+ def __getattr__(self, name: str) -> Any:
102
+ return getattr(self._response, name)
103
+
104
+ @property
105
+ def pages(
106
+ self,
107
+ ) -> Iterator[deployment_resource_pool_service.ListDeploymentResourcePoolsResponse]:
108
+ yield self._response
109
+ while self._response.next_page_token:
110
+ self._request.page_token = self._response.next_page_token
111
+ self._response = self._method(
112
+ self._request,
113
+ retry=self._retry,
114
+ timeout=self._timeout,
115
+ metadata=self._metadata,
116
+ )
117
+ yield self._response
118
+
119
+ def __iter__(self) -> Iterator[deployment_resource_pool.DeploymentResourcePool]:
120
+ for page in self.pages:
121
+ yield from page.deployment_resource_pools
122
+
123
+ def __repr__(self) -> str:
124
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
125
+
126
+
127
+ class ListDeploymentResourcePoolsAsyncPager:
128
+ """A pager for iterating through ``list_deployment_resource_pools`` requests.
129
+
130
+ This class thinly wraps an initial
131
+ :class:`google.cloud.aiplatform_v1.types.ListDeploymentResourcePoolsResponse` object, and
132
+ provides an ``__aiter__`` method to iterate through its
133
+ ``deployment_resource_pools`` field.
134
+
135
+ If there are more pages, the ``__aiter__`` method will make additional
136
+ ``ListDeploymentResourcePools`` requests and continue to iterate
137
+ through the ``deployment_resource_pools`` field on the
138
+ corresponding responses.
139
+
140
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListDeploymentResourcePoolsResponse`
141
+ attributes are available on the pager. If multiple requests are made, only
142
+ the most recent response is retained, and thus used for attribute lookup.
143
+ """
144
+
145
+ def __init__(
146
+ self,
147
+ method: Callable[
148
+ ...,
149
+ Awaitable[
150
+ deployment_resource_pool_service.ListDeploymentResourcePoolsResponse
151
+ ],
152
+ ],
153
+ request: deployment_resource_pool_service.ListDeploymentResourcePoolsRequest,
154
+ response: deployment_resource_pool_service.ListDeploymentResourcePoolsResponse,
155
+ *,
156
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
157
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
158
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
159
+ ):
160
+ """Instantiates the pager.
161
+
162
+ Args:
163
+ method (Callable): The method that was originally called, and
164
+ which instantiated this pager.
165
+ request (google.cloud.aiplatform_v1.types.ListDeploymentResourcePoolsRequest):
166
+ The initial request object.
167
+ response (google.cloud.aiplatform_v1.types.ListDeploymentResourcePoolsResponse):
168
+ The initial response object.
169
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
170
+ if any, should be retried.
171
+ timeout (float): The timeout for this request.
172
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
173
+ sent along with the request as metadata. Normally, each value must be of type `str`,
174
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
175
+ be of type `bytes`.
176
+ """
177
+ self._method = method
178
+ self._request = (
179
+ deployment_resource_pool_service.ListDeploymentResourcePoolsRequest(request)
180
+ )
181
+ self._response = response
182
+ self._retry = retry
183
+ self._timeout = timeout
184
+ self._metadata = metadata
185
+
186
+ def __getattr__(self, name: str) -> Any:
187
+ return getattr(self._response, name)
188
+
189
+ @property
190
+ async def pages(
191
+ self,
192
+ ) -> AsyncIterator[
193
+ deployment_resource_pool_service.ListDeploymentResourcePoolsResponse
194
+ ]:
195
+ yield self._response
196
+ while self._response.next_page_token:
197
+ self._request.page_token = self._response.next_page_token
198
+ self._response = await self._method(
199
+ self._request,
200
+ retry=self._retry,
201
+ timeout=self._timeout,
202
+ metadata=self._metadata,
203
+ )
204
+ yield self._response
205
+
206
+ def __aiter__(
207
+ self,
208
+ ) -> AsyncIterator[deployment_resource_pool.DeploymentResourcePool]:
209
+ async def async_generator():
210
+ async for page in self.pages:
211
+ for response in page.deployment_resource_pools:
212
+ yield response
213
+
214
+ return async_generator()
215
+
216
+ def __repr__(self) -> str:
217
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
218
+
219
+
220
+ class QueryDeployedModelsPager:
221
+ """A pager for iterating through ``query_deployed_models`` requests.
222
+
223
+ This class thinly wraps an initial
224
+ :class:`google.cloud.aiplatform_v1.types.QueryDeployedModelsResponse` object, and
225
+ provides an ``__iter__`` method to iterate through its
226
+ ``deployed_models`` field.
227
+
228
+ If there are more pages, the ``__iter__`` method will make additional
229
+ ``QueryDeployedModels`` requests and continue to iterate
230
+ through the ``deployed_models`` field on the
231
+ corresponding responses.
232
+
233
+ All the usual :class:`google.cloud.aiplatform_v1.types.QueryDeployedModelsResponse`
234
+ attributes are available on the pager. If multiple requests are made, only
235
+ the most recent response is retained, and thus used for attribute lookup.
236
+ """
237
+
238
+ def __init__(
239
+ self,
240
+ method: Callable[
241
+ ..., deployment_resource_pool_service.QueryDeployedModelsResponse
242
+ ],
243
+ request: deployment_resource_pool_service.QueryDeployedModelsRequest,
244
+ response: deployment_resource_pool_service.QueryDeployedModelsResponse,
245
+ *,
246
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
247
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
248
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
249
+ ):
250
+ """Instantiate the pager.
251
+
252
+ Args:
253
+ method (Callable): The method that was originally called, and
254
+ which instantiated this pager.
255
+ request (google.cloud.aiplatform_v1.types.QueryDeployedModelsRequest):
256
+ The initial request object.
257
+ response (google.cloud.aiplatform_v1.types.QueryDeployedModelsResponse):
258
+ The initial response object.
259
+ retry (google.api_core.retry.Retry): Designation of what errors,
260
+ if any, should be retried.
261
+ timeout (float): The timeout for this request.
262
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
263
+ sent along with the request as metadata. Normally, each value must be of type `str`,
264
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
265
+ be of type `bytes`.
266
+ """
267
+ self._method = method
268
+ self._request = deployment_resource_pool_service.QueryDeployedModelsRequest(
269
+ request
270
+ )
271
+ self._response = response
272
+ self._retry = retry
273
+ self._timeout = timeout
274
+ self._metadata = metadata
275
+
276
+ def __getattr__(self, name: str) -> Any:
277
+ return getattr(self._response, name)
278
+
279
+ @property
280
+ def pages(
281
+ self,
282
+ ) -> Iterator[deployment_resource_pool_service.QueryDeployedModelsResponse]:
283
+ yield self._response
284
+ while self._response.next_page_token:
285
+ self._request.page_token = self._response.next_page_token
286
+ self._response = self._method(
287
+ self._request,
288
+ retry=self._retry,
289
+ timeout=self._timeout,
290
+ metadata=self._metadata,
291
+ )
292
+ yield self._response
293
+
294
+ def __iter__(self) -> Iterator[endpoint.DeployedModel]:
295
+ for page in self.pages:
296
+ yield from page.deployed_models
297
+
298
+ def __repr__(self) -> str:
299
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
300
+
301
+
302
+ class QueryDeployedModelsAsyncPager:
303
+ """A pager for iterating through ``query_deployed_models`` requests.
304
+
305
+ This class thinly wraps an initial
306
+ :class:`google.cloud.aiplatform_v1.types.QueryDeployedModelsResponse` object, and
307
+ provides an ``__aiter__`` method to iterate through its
308
+ ``deployed_models`` field.
309
+
310
+ If there are more pages, the ``__aiter__`` method will make additional
311
+ ``QueryDeployedModels`` requests and continue to iterate
312
+ through the ``deployed_models`` field on the
313
+ corresponding responses.
314
+
315
+ All the usual :class:`google.cloud.aiplatform_v1.types.QueryDeployedModelsResponse`
316
+ attributes are available on the pager. If multiple requests are made, only
317
+ the most recent response is retained, and thus used for attribute lookup.
318
+ """
319
+
320
+ def __init__(
321
+ self,
322
+ method: Callable[
323
+ ..., Awaitable[deployment_resource_pool_service.QueryDeployedModelsResponse]
324
+ ],
325
+ request: deployment_resource_pool_service.QueryDeployedModelsRequest,
326
+ response: deployment_resource_pool_service.QueryDeployedModelsResponse,
327
+ *,
328
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
329
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
330
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
331
+ ):
332
+ """Instantiates the pager.
333
+
334
+ Args:
335
+ method (Callable): The method that was originally called, and
336
+ which instantiated this pager.
337
+ request (google.cloud.aiplatform_v1.types.QueryDeployedModelsRequest):
338
+ The initial request object.
339
+ response (google.cloud.aiplatform_v1.types.QueryDeployedModelsResponse):
340
+ The initial response object.
341
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
342
+ if any, should be retried.
343
+ timeout (float): The timeout for this request.
344
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
345
+ sent along with the request as metadata. Normally, each value must be of type `str`,
346
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
347
+ be of type `bytes`.
348
+ """
349
+ self._method = method
350
+ self._request = deployment_resource_pool_service.QueryDeployedModelsRequest(
351
+ request
352
+ )
353
+ self._response = response
354
+ self._retry = retry
355
+ self._timeout = timeout
356
+ self._metadata = metadata
357
+
358
+ def __getattr__(self, name: str) -> Any:
359
+ return getattr(self._response, name)
360
+
361
+ @property
362
+ async def pages(
363
+ self,
364
+ ) -> AsyncIterator[deployment_resource_pool_service.QueryDeployedModelsResponse]:
365
+ yield self._response
366
+ while self._response.next_page_token:
367
+ self._request.page_token = self._response.next_page_token
368
+ self._response = await self._method(
369
+ self._request,
370
+ retry=self._retry,
371
+ timeout=self._timeout,
372
+ metadata=self._metadata,
373
+ )
374
+ yield self._response
375
+
376
+ def __aiter__(self) -> AsyncIterator[endpoint.DeployedModel]:
377
+ async def async_generator():
378
+ async for page in self.pages:
379
+ for response in page.deployed_models:
380
+ yield response
381
+
382
+ return async_generator()
383
+
384
+ def __repr__(self) -> str:
385
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__init__.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, Tuple
18
+
19
+ from .base import DeploymentResourcePoolServiceTransport
20
+ from .grpc import DeploymentResourcePoolServiceGrpcTransport
21
+ from .grpc_asyncio import DeploymentResourcePoolServiceGrpcAsyncIOTransport
22
+ from .rest import DeploymentResourcePoolServiceRestTransport
23
+ from .rest import DeploymentResourcePoolServiceRestInterceptor
24
+
25
+ ASYNC_REST_CLASSES: Tuple[str, ...]
26
+ try:
27
+ from .rest_asyncio import AsyncDeploymentResourcePoolServiceRestTransport
28
+ from .rest_asyncio import AsyncDeploymentResourcePoolServiceRestInterceptor
29
+
30
+ ASYNC_REST_CLASSES = (
31
+ "AsyncDeploymentResourcePoolServiceRestTransport",
32
+ "AsyncDeploymentResourcePoolServiceRestInterceptor",
33
+ )
34
+ HAS_REST_ASYNC = True
35
+ except ImportError: # pragma: NO COVER
36
+ ASYNC_REST_CLASSES = ()
37
+ HAS_REST_ASYNC = False
38
+
39
+
40
+ # Compile a registry of transports.
41
+ _transport_registry = (
42
+ OrderedDict()
43
+ ) # type: Dict[str, Type[DeploymentResourcePoolServiceTransport]]
44
+ _transport_registry["grpc"] = DeploymentResourcePoolServiceGrpcTransport
45
+ _transport_registry["grpc_asyncio"] = DeploymentResourcePoolServiceGrpcAsyncIOTransport
46
+ _transport_registry["rest"] = DeploymentResourcePoolServiceRestTransport
47
+ if HAS_REST_ASYNC: # pragma: NO COVER
48
+ _transport_registry["rest_asyncio"] = (
49
+ AsyncDeploymentResourcePoolServiceRestTransport
50
+ )
51
+
52
+ __all__ = (
53
+ "DeploymentResourcePoolServiceTransport",
54
+ "DeploymentResourcePoolServiceGrpcTransport",
55
+ "DeploymentResourcePoolServiceGrpcAsyncIOTransport",
56
+ "DeploymentResourcePoolServiceRestTransport",
57
+ "DeploymentResourcePoolServiceRestInterceptor",
58
+ ) + ASYNC_REST_CLASSES
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (1.57 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__pycache__/base.cpython-311.pyc ADDED
Binary file (16.3 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__pycache__/grpc.cpython-311.pyc ADDED
Binary file (31.6 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__pycache__/grpc_asyncio.cpython-311.pyc ADDED
Binary file (35.4 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/__pycache__/rest_base.cpython-311.pyc ADDED
Binary file (84.6 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/base.py ADDED
@@ -0,0 +1,411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from google.cloud.aiplatform_v1 import gapic_version as package_version
20
+
21
+ import google.auth # type: ignore
22
+ import google.api_core
23
+ from google.api_core import exceptions as core_exceptions
24
+ from google.api_core import gapic_v1
25
+ from google.api_core import retry as retries
26
+ from google.api_core import operations_v1
27
+ from google.auth import credentials as ga_credentials # type: ignore
28
+ from google.oauth2 import service_account # type: ignore
29
+ import google.protobuf
30
+
31
+ from google.cloud.aiplatform_v1.types import deployment_resource_pool
32
+ from google.cloud.aiplatform_v1.types import deployment_resource_pool_service
33
+ from google.cloud.location import locations_pb2 # type: ignore
34
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
35
+ from google.iam.v1 import policy_pb2 # type: ignore
36
+ from google.longrunning import operations_pb2 # type: ignore
37
+
38
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
39
+ gapic_version=package_version.__version__
40
+ )
41
+
42
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
43
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
44
+
45
+
46
+ class DeploymentResourcePoolServiceTransport(abc.ABC):
47
+ """Abstract transport class for DeploymentResourcePoolService."""
48
+
49
+ AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
50
+
51
+ DEFAULT_HOST: str = "aiplatform.googleapis.com"
52
+
53
+ def __init__(
54
+ self,
55
+ *,
56
+ host: str = DEFAULT_HOST,
57
+ credentials: Optional[ga_credentials.Credentials] = None,
58
+ credentials_file: Optional[str] = None,
59
+ scopes: Optional[Sequence[str]] = None,
60
+ quota_project_id: Optional[str] = None,
61
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
62
+ always_use_jwt_access: Optional[bool] = False,
63
+ api_audience: Optional[str] = None,
64
+ **kwargs,
65
+ ) -> None:
66
+ """Instantiate the transport.
67
+
68
+ Args:
69
+ host (Optional[str]):
70
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
71
+ credentials (Optional[google.auth.credentials.Credentials]): The
72
+ authorization credentials to attach to requests. These
73
+ credentials identify the application to the service; if none
74
+ are specified, the client will attempt to ascertain the
75
+ credentials from the environment.
76
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
77
+ be loaded with :func:`google.auth.load_credentials_from_file`.
78
+ This argument is mutually exclusive with credentials. This argument will be
79
+ removed in the next major version of this library.
80
+ scopes (Optional[Sequence[str]]): A list of scopes.
81
+ quota_project_id (Optional[str]): An optional project to use for billing
82
+ and quota.
83
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
84
+ The client info used to send a user-agent string along with
85
+ API requests. If ``None``, then default info will be used.
86
+ Generally, you only need to set this if you're developing
87
+ your own client library.
88
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
89
+ be used for service account credentials.
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
+ @property
140
+ def host(self):
141
+ return self._host
142
+
143
+ def _prep_wrapped_messages(self, client_info):
144
+ # Precompute the wrapped methods.
145
+ self._wrapped_methods = {
146
+ self.create_deployment_resource_pool: gapic_v1.method.wrap_method(
147
+ self.create_deployment_resource_pool,
148
+ default_timeout=None,
149
+ client_info=client_info,
150
+ ),
151
+ self.get_deployment_resource_pool: gapic_v1.method.wrap_method(
152
+ self.get_deployment_resource_pool,
153
+ default_timeout=None,
154
+ client_info=client_info,
155
+ ),
156
+ self.list_deployment_resource_pools: gapic_v1.method.wrap_method(
157
+ self.list_deployment_resource_pools,
158
+ default_timeout=None,
159
+ client_info=client_info,
160
+ ),
161
+ self.update_deployment_resource_pool: gapic_v1.method.wrap_method(
162
+ self.update_deployment_resource_pool,
163
+ default_timeout=None,
164
+ client_info=client_info,
165
+ ),
166
+ self.delete_deployment_resource_pool: gapic_v1.method.wrap_method(
167
+ self.delete_deployment_resource_pool,
168
+ default_timeout=None,
169
+ client_info=client_info,
170
+ ),
171
+ self.query_deployed_models: gapic_v1.method.wrap_method(
172
+ self.query_deployed_models,
173
+ default_timeout=None,
174
+ client_info=client_info,
175
+ ),
176
+ self.get_location: gapic_v1.method.wrap_method(
177
+ self.get_location,
178
+ default_timeout=None,
179
+ client_info=client_info,
180
+ ),
181
+ self.list_locations: gapic_v1.method.wrap_method(
182
+ self.list_locations,
183
+ default_timeout=None,
184
+ client_info=client_info,
185
+ ),
186
+ self.get_iam_policy: gapic_v1.method.wrap_method(
187
+ self.get_iam_policy,
188
+ default_timeout=None,
189
+ client_info=client_info,
190
+ ),
191
+ self.set_iam_policy: gapic_v1.method.wrap_method(
192
+ self.set_iam_policy,
193
+ default_timeout=None,
194
+ client_info=client_info,
195
+ ),
196
+ self.test_iam_permissions: gapic_v1.method.wrap_method(
197
+ self.test_iam_permissions,
198
+ default_timeout=None,
199
+ client_info=client_info,
200
+ ),
201
+ self.cancel_operation: gapic_v1.method.wrap_method(
202
+ self.cancel_operation,
203
+ default_timeout=None,
204
+ client_info=client_info,
205
+ ),
206
+ self.delete_operation: gapic_v1.method.wrap_method(
207
+ self.delete_operation,
208
+ default_timeout=None,
209
+ client_info=client_info,
210
+ ),
211
+ self.get_operation: gapic_v1.method.wrap_method(
212
+ self.get_operation,
213
+ default_timeout=None,
214
+ client_info=client_info,
215
+ ),
216
+ self.list_operations: gapic_v1.method.wrap_method(
217
+ self.list_operations,
218
+ default_timeout=None,
219
+ client_info=client_info,
220
+ ),
221
+ self.wait_operation: gapic_v1.method.wrap_method(
222
+ self.wait_operation,
223
+ default_timeout=None,
224
+ client_info=client_info,
225
+ ),
226
+ }
227
+
228
+ def close(self):
229
+ """Closes resources associated with the transport.
230
+
231
+ .. warning::
232
+ Only call this method if the transport is NOT shared
233
+ with other clients - this may cause errors in other clients!
234
+ """
235
+ raise NotImplementedError()
236
+
237
+ @property
238
+ def operations_client(self):
239
+ """Return the client designed to process long-running operations."""
240
+ raise NotImplementedError()
241
+
242
+ @property
243
+ def create_deployment_resource_pool(
244
+ self,
245
+ ) -> Callable[
246
+ [deployment_resource_pool_service.CreateDeploymentResourcePoolRequest],
247
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
248
+ ]:
249
+ raise NotImplementedError()
250
+
251
+ @property
252
+ def get_deployment_resource_pool(
253
+ self,
254
+ ) -> Callable[
255
+ [deployment_resource_pool_service.GetDeploymentResourcePoolRequest],
256
+ Union[
257
+ deployment_resource_pool.DeploymentResourcePool,
258
+ Awaitable[deployment_resource_pool.DeploymentResourcePool],
259
+ ],
260
+ ]:
261
+ raise NotImplementedError()
262
+
263
+ @property
264
+ def list_deployment_resource_pools(
265
+ self,
266
+ ) -> Callable[
267
+ [deployment_resource_pool_service.ListDeploymentResourcePoolsRequest],
268
+ Union[
269
+ deployment_resource_pool_service.ListDeploymentResourcePoolsResponse,
270
+ Awaitable[
271
+ deployment_resource_pool_service.ListDeploymentResourcePoolsResponse
272
+ ],
273
+ ],
274
+ ]:
275
+ raise NotImplementedError()
276
+
277
+ @property
278
+ def update_deployment_resource_pool(
279
+ self,
280
+ ) -> Callable[
281
+ [deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest],
282
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
283
+ ]:
284
+ raise NotImplementedError()
285
+
286
+ @property
287
+ def delete_deployment_resource_pool(
288
+ self,
289
+ ) -> Callable[
290
+ [deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest],
291
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
292
+ ]:
293
+ raise NotImplementedError()
294
+
295
+ @property
296
+ def query_deployed_models(
297
+ self,
298
+ ) -> Callable[
299
+ [deployment_resource_pool_service.QueryDeployedModelsRequest],
300
+ Union[
301
+ deployment_resource_pool_service.QueryDeployedModelsResponse,
302
+ Awaitable[deployment_resource_pool_service.QueryDeployedModelsResponse],
303
+ ],
304
+ ]:
305
+ raise NotImplementedError()
306
+
307
+ @property
308
+ def list_operations(
309
+ self,
310
+ ) -> Callable[
311
+ [operations_pb2.ListOperationsRequest],
312
+ Union[
313
+ operations_pb2.ListOperationsResponse,
314
+ Awaitable[operations_pb2.ListOperationsResponse],
315
+ ],
316
+ ]:
317
+ raise NotImplementedError()
318
+
319
+ @property
320
+ def get_operation(
321
+ self,
322
+ ) -> Callable[
323
+ [operations_pb2.GetOperationRequest],
324
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
325
+ ]:
326
+ raise NotImplementedError()
327
+
328
+ @property
329
+ def cancel_operation(
330
+ self,
331
+ ) -> Callable[
332
+ [operations_pb2.CancelOperationRequest],
333
+ None,
334
+ ]:
335
+ raise NotImplementedError()
336
+
337
+ @property
338
+ def delete_operation(
339
+ self,
340
+ ) -> Callable[
341
+ [operations_pb2.DeleteOperationRequest],
342
+ None,
343
+ ]:
344
+ raise NotImplementedError()
345
+
346
+ @property
347
+ def wait_operation(
348
+ self,
349
+ ) -> Callable[
350
+ [operations_pb2.WaitOperationRequest],
351
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
352
+ ]:
353
+ raise NotImplementedError()
354
+
355
+ @property
356
+ def set_iam_policy(
357
+ self,
358
+ ) -> Callable[
359
+ [iam_policy_pb2.SetIamPolicyRequest],
360
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
361
+ ]:
362
+ raise NotImplementedError()
363
+
364
+ @property
365
+ def get_iam_policy(
366
+ self,
367
+ ) -> Callable[
368
+ [iam_policy_pb2.GetIamPolicyRequest],
369
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
370
+ ]:
371
+ raise NotImplementedError()
372
+
373
+ @property
374
+ def test_iam_permissions(
375
+ self,
376
+ ) -> Callable[
377
+ [iam_policy_pb2.TestIamPermissionsRequest],
378
+ Union[
379
+ iam_policy_pb2.TestIamPermissionsResponse,
380
+ Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
381
+ ],
382
+ ]:
383
+ raise NotImplementedError()
384
+
385
+ @property
386
+ def get_location(
387
+ self,
388
+ ) -> Callable[
389
+ [locations_pb2.GetLocationRequest],
390
+ Union[locations_pb2.Location, Awaitable[locations_pb2.Location]],
391
+ ]:
392
+ raise NotImplementedError()
393
+
394
+ @property
395
+ def list_locations(
396
+ self,
397
+ ) -> Callable[
398
+ [locations_pb2.ListLocationsRequest],
399
+ Union[
400
+ locations_pb2.ListLocationsResponse,
401
+ Awaitable[locations_pb2.ListLocationsResponse],
402
+ ],
403
+ ]:
404
+ raise NotImplementedError()
405
+
406
+ @property
407
+ def kind(self) -> str:
408
+ raise NotImplementedError()
409
+
410
+
411
+ __all__ = ("DeploymentResourcePoolServiceTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc.py ADDED
@@ -0,0 +1,749 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from google.api_core import grpc_helpers
23
+ from google.api_core import operations_v1
24
+ from google.api_core import gapic_v1
25
+ import google.auth # type: ignore
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.auth.transport.grpc import SslCredentials # type: ignore
28
+ from google.protobuf.json_format import MessageToJson
29
+ import google.protobuf.message
30
+
31
+ import grpc # type: ignore
32
+ import proto # type: ignore
33
+
34
+ from google.cloud.aiplatform_v1.types import deployment_resource_pool
35
+ from google.cloud.aiplatform_v1.types import deployment_resource_pool_service
36
+ from google.cloud.location import locations_pb2 # type: ignore
37
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
38
+ from google.iam.v1 import policy_pb2 # type: ignore
39
+ from google.longrunning import operations_pb2 # type: ignore
40
+ from .base import DeploymentResourcePoolServiceTransport, DEFAULT_CLIENT_INFO
41
+
42
+ try:
43
+ from google.api_core import client_logging # type: ignore
44
+
45
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
46
+ except ImportError: # pragma: NO COVER
47
+ CLIENT_LOGGING_SUPPORTED = False
48
+
49
+ _LOGGER = std_logging.getLogger(__name__)
50
+
51
+
52
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
53
+ def intercept_unary_unary(self, continuation, client_call_details, request):
54
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
55
+ std_logging.DEBUG
56
+ )
57
+ if logging_enabled: # pragma: NO COVER
58
+ request_metadata = client_call_details.metadata
59
+ if isinstance(request, proto.Message):
60
+ request_payload = type(request).to_json(request)
61
+ elif isinstance(request, google.protobuf.message.Message):
62
+ request_payload = MessageToJson(request)
63
+ else:
64
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
65
+
66
+ request_metadata = {
67
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
68
+ for key, value in request_metadata
69
+ }
70
+ grpc_request = {
71
+ "payload": request_payload,
72
+ "requestMethod": "grpc",
73
+ "metadata": dict(request_metadata),
74
+ }
75
+ _LOGGER.debug(
76
+ f"Sending request for {client_call_details.method}",
77
+ extra={
78
+ "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService",
79
+ "rpcName": str(client_call_details.method),
80
+ "request": grpc_request,
81
+ "metadata": grpc_request["metadata"],
82
+ },
83
+ )
84
+ response = continuation(client_call_details, request)
85
+ if logging_enabled: # pragma: NO COVER
86
+ response_metadata = response.trailing_metadata()
87
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
88
+ metadata = (
89
+ dict([(k, str(v)) for k, v in response_metadata])
90
+ if response_metadata
91
+ else None
92
+ )
93
+ result = response.result()
94
+ if isinstance(result, proto.Message):
95
+ response_payload = type(result).to_json(result)
96
+ elif isinstance(result, google.protobuf.message.Message):
97
+ response_payload = MessageToJson(result)
98
+ else:
99
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
100
+ grpc_response = {
101
+ "payload": response_payload,
102
+ "metadata": metadata,
103
+ "status": "OK",
104
+ }
105
+ _LOGGER.debug(
106
+ f"Received response for {client_call_details.method}.",
107
+ extra={
108
+ "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService",
109
+ "rpcName": client_call_details.method,
110
+ "response": grpc_response,
111
+ "metadata": grpc_response["metadata"],
112
+ },
113
+ )
114
+ return response
115
+
116
+
117
+ class DeploymentResourcePoolServiceGrpcTransport(
118
+ DeploymentResourcePoolServiceTransport
119
+ ):
120
+ """gRPC backend transport for DeploymentResourcePoolService.
121
+
122
+ A service that manages the DeploymentResourcePool resource.
123
+
124
+ This class defines the same methods as the primary client, so the
125
+ primary client can load the underlying transport implementation
126
+ and call it.
127
+
128
+ It sends protocol buffers over the wire using gRPC (which is built on
129
+ top of HTTP/2); the ``grpcio`` package must be installed.
130
+ """
131
+
132
+ _stubs: Dict[str, Callable]
133
+
134
+ def __init__(
135
+ self,
136
+ *,
137
+ host: str = "aiplatform.googleapis.com",
138
+ credentials: Optional[ga_credentials.Credentials] = None,
139
+ credentials_file: Optional[str] = None,
140
+ scopes: Optional[Sequence[str]] = None,
141
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
142
+ api_mtls_endpoint: Optional[str] = None,
143
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
144
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
145
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
146
+ quota_project_id: Optional[str] = None,
147
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
148
+ always_use_jwt_access: Optional[bool] = False,
149
+ api_audience: Optional[str] = None,
150
+ ) -> None:
151
+ """Instantiate the transport.
152
+
153
+ Args:
154
+ host (Optional[str]):
155
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
156
+ credentials (Optional[google.auth.credentials.Credentials]): The
157
+ authorization credentials to attach to requests. These
158
+ credentials identify the application to the service; if none
159
+ are specified, the client will attempt to ascertain the
160
+ credentials from the environment.
161
+ This argument is ignored if a ``channel`` instance is provided.
162
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
163
+ be loaded with :func:`google.auth.load_credentials_from_file`.
164
+ This argument is ignored if a ``channel`` instance is provided.
165
+ This argument will be removed in the next major version of this library.
166
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
167
+ ignored if a ``channel`` instance is provided.
168
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
169
+ A ``Channel`` instance through which to make calls, or a Callable
170
+ that constructs and returns one. If set to None, ``self.create_channel``
171
+ is used to create the channel. If a Callable is given, it will be called
172
+ with the same arguments as used in ``self.create_channel``.
173
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
174
+ If provided, it overrides the ``host`` argument and tries to create
175
+ a mutual TLS channel with client SSL credentials from
176
+ ``client_cert_source`` or application default SSL credentials.
177
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
178
+ Deprecated. A callback to provide client SSL certificate bytes and
179
+ private key bytes, both in PEM format. It is ignored if
180
+ ``api_mtls_endpoint`` is None.
181
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
182
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
183
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
184
+ A callback to provide client certificate bytes and private key bytes,
185
+ both in PEM format. It is used to configure a mutual TLS channel. It is
186
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
187
+ quota_project_id (Optional[str]): An optional project to use for billing
188
+ and quota.
189
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
190
+ The client info used to send a user-agent string along with
191
+ API requests. If ``None``, then default info will be used.
192
+ Generally, you only need to set this if you're developing
193
+ your own client library.
194
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
195
+ be used for service account credentials.
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
+ self._operations_client: Optional[operations_v1.OperationsClient] = None
207
+
208
+ if api_mtls_endpoint:
209
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
210
+ if client_cert_source:
211
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
212
+
213
+ if isinstance(channel, grpc.Channel):
214
+ # Ignore credentials if a channel was passed.
215
+ credentials = None
216
+ self._ignore_credentials = True
217
+ # If a channel was explicitly provided, set it.
218
+ self._grpc_channel = channel
219
+ self._ssl_channel_credentials = None
220
+
221
+ else:
222
+ if api_mtls_endpoint:
223
+ host = api_mtls_endpoint
224
+
225
+ # Create SSL credentials with client_cert_source or application
226
+ # default SSL credentials.
227
+ if client_cert_source:
228
+ cert, key = client_cert_source()
229
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
230
+ certificate_chain=cert, private_key=key
231
+ )
232
+ else:
233
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
234
+
235
+ else:
236
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
237
+ cert, key = client_cert_source_for_mtls()
238
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
239
+ certificate_chain=cert, private_key=key
240
+ )
241
+
242
+ # The base transport sets the host, credentials and scopes
243
+ super().__init__(
244
+ host=host,
245
+ credentials=credentials,
246
+ credentials_file=credentials_file,
247
+ scopes=scopes,
248
+ quota_project_id=quota_project_id,
249
+ client_info=client_info,
250
+ always_use_jwt_access=always_use_jwt_access,
251
+ api_audience=api_audience,
252
+ )
253
+
254
+ if not self._grpc_channel:
255
+ # initialize with the provided callable or the default channel
256
+ channel_init = channel or type(self).create_channel
257
+ self._grpc_channel = channel_init(
258
+ self._host,
259
+ # use the credentials which are saved
260
+ credentials=self._credentials,
261
+ # Set ``credentials_file`` to ``None`` here as
262
+ # the credentials that we saved earlier should be used.
263
+ credentials_file=None,
264
+ scopes=self._scopes,
265
+ ssl_credentials=self._ssl_channel_credentials,
266
+ quota_project_id=quota_project_id,
267
+ options=[
268
+ ("grpc.max_send_message_length", -1),
269
+ ("grpc.max_receive_message_length", -1),
270
+ ],
271
+ )
272
+
273
+ self._interceptor = _LoggingClientInterceptor()
274
+ self._logged_channel = grpc.intercept_channel(
275
+ self._grpc_channel, self._interceptor
276
+ )
277
+
278
+ # Wrap messages. This must be done after self._logged_channel exists
279
+ self._prep_wrapped_messages(client_info)
280
+
281
+ @classmethod
282
+ def create_channel(
283
+ cls,
284
+ host: str = "aiplatform.googleapis.com",
285
+ credentials: Optional[ga_credentials.Credentials] = None,
286
+ credentials_file: Optional[str] = None,
287
+ scopes: Optional[Sequence[str]] = None,
288
+ quota_project_id: Optional[str] = None,
289
+ **kwargs,
290
+ ) -> grpc.Channel:
291
+ """Create and return a gRPC channel object.
292
+ Args:
293
+ host (Optional[str]): The host for the channel to use.
294
+ credentials (Optional[~.Credentials]): The
295
+ authorization credentials to attach to requests. These
296
+ credentials identify this application to the service. If
297
+ none are specified, the client will attempt to ascertain
298
+ the credentials from the environment.
299
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
300
+ be loaded with :func:`google.auth.load_credentials_from_file`.
301
+ This argument is mutually exclusive with credentials. This argument will be
302
+ removed in the next major version of this library.
303
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
304
+ service. These are only used when credentials are not specified and
305
+ are passed to :func:`google.auth.default`.
306
+ quota_project_id (Optional[str]): An optional project to use for billing
307
+ and quota.
308
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
309
+ channel creation.
310
+ Returns:
311
+ grpc.Channel: A gRPC channel object.
312
+
313
+ Raises:
314
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
315
+ and ``credentials_file`` are passed.
316
+ """
317
+
318
+ return grpc_helpers.create_channel(
319
+ host,
320
+ credentials=credentials,
321
+ credentials_file=credentials_file,
322
+ quota_project_id=quota_project_id,
323
+ default_scopes=cls.AUTH_SCOPES,
324
+ scopes=scopes,
325
+ default_host=cls.DEFAULT_HOST,
326
+ **kwargs,
327
+ )
328
+
329
+ @property
330
+ def grpc_channel(self) -> grpc.Channel:
331
+ """Return the channel designed to connect to this service."""
332
+ return self._grpc_channel
333
+
334
+ @property
335
+ def operations_client(self) -> operations_v1.OperationsClient:
336
+ """Create the client designed to process long-running operations.
337
+
338
+ This property caches on the instance; repeated calls return the same
339
+ client.
340
+ """
341
+ # Quick check: Only create a new client if we do not already have one.
342
+ if self._operations_client is None:
343
+ self._operations_client = operations_v1.OperationsClient(
344
+ self._logged_channel
345
+ )
346
+
347
+ # Return the client from cache.
348
+ return self._operations_client
349
+
350
+ @property
351
+ def create_deployment_resource_pool(
352
+ self,
353
+ ) -> Callable[
354
+ [deployment_resource_pool_service.CreateDeploymentResourcePoolRequest],
355
+ operations_pb2.Operation,
356
+ ]:
357
+ r"""Return a callable for the create deployment resource
358
+ pool method over gRPC.
359
+
360
+ Create a DeploymentResourcePool.
361
+
362
+ Returns:
363
+ Callable[[~.CreateDeploymentResourcePoolRequest],
364
+ ~.Operation]:
365
+ A function that, when called, will call the underlying RPC
366
+ on the server.
367
+ """
368
+ # Generate a "stub function" on-the-fly which will actually make
369
+ # the request.
370
+ # gRPC handles serialization and deserialization, so we just need
371
+ # to pass in the functions for each.
372
+ if "create_deployment_resource_pool" not in self._stubs:
373
+ self._stubs["create_deployment_resource_pool"] = (
374
+ self._logged_channel.unary_unary(
375
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/CreateDeploymentResourcePool",
376
+ request_serializer=deployment_resource_pool_service.CreateDeploymentResourcePoolRequest.serialize,
377
+ response_deserializer=operations_pb2.Operation.FromString,
378
+ )
379
+ )
380
+ return self._stubs["create_deployment_resource_pool"]
381
+
382
+ @property
383
+ def get_deployment_resource_pool(
384
+ self,
385
+ ) -> Callable[
386
+ [deployment_resource_pool_service.GetDeploymentResourcePoolRequest],
387
+ deployment_resource_pool.DeploymentResourcePool,
388
+ ]:
389
+ r"""Return a callable for the get deployment resource pool method over gRPC.
390
+
391
+ Get a DeploymentResourcePool.
392
+
393
+ Returns:
394
+ Callable[[~.GetDeploymentResourcePoolRequest],
395
+ ~.DeploymentResourcePool]:
396
+ A function that, when called, will call the underlying RPC
397
+ on the server.
398
+ """
399
+ # Generate a "stub function" on-the-fly which will actually make
400
+ # the request.
401
+ # gRPC handles serialization and deserialization, so we just need
402
+ # to pass in the functions for each.
403
+ if "get_deployment_resource_pool" not in self._stubs:
404
+ self._stubs["get_deployment_resource_pool"] = (
405
+ self._logged_channel.unary_unary(
406
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/GetDeploymentResourcePool",
407
+ request_serializer=deployment_resource_pool_service.GetDeploymentResourcePoolRequest.serialize,
408
+ response_deserializer=deployment_resource_pool.DeploymentResourcePool.deserialize,
409
+ )
410
+ )
411
+ return self._stubs["get_deployment_resource_pool"]
412
+
413
+ @property
414
+ def list_deployment_resource_pools(
415
+ self,
416
+ ) -> Callable[
417
+ [deployment_resource_pool_service.ListDeploymentResourcePoolsRequest],
418
+ deployment_resource_pool_service.ListDeploymentResourcePoolsResponse,
419
+ ]:
420
+ r"""Return a callable for the list deployment resource pools method over gRPC.
421
+
422
+ List DeploymentResourcePools in a location.
423
+
424
+ Returns:
425
+ Callable[[~.ListDeploymentResourcePoolsRequest],
426
+ ~.ListDeploymentResourcePoolsResponse]:
427
+ A function that, when called, will call the underlying RPC
428
+ on the server.
429
+ """
430
+ # Generate a "stub function" on-the-fly which will actually make
431
+ # the request.
432
+ # gRPC handles serialization and deserialization, so we just need
433
+ # to pass in the functions for each.
434
+ if "list_deployment_resource_pools" not in self._stubs:
435
+ self._stubs["list_deployment_resource_pools"] = (
436
+ self._logged_channel.unary_unary(
437
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/ListDeploymentResourcePools",
438
+ request_serializer=deployment_resource_pool_service.ListDeploymentResourcePoolsRequest.serialize,
439
+ response_deserializer=deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.deserialize,
440
+ )
441
+ )
442
+ return self._stubs["list_deployment_resource_pools"]
443
+
444
+ @property
445
+ def update_deployment_resource_pool(
446
+ self,
447
+ ) -> Callable[
448
+ [deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest],
449
+ operations_pb2.Operation,
450
+ ]:
451
+ r"""Return a callable for the update deployment resource
452
+ pool method over gRPC.
453
+
454
+ Update a DeploymentResourcePool.
455
+
456
+ Returns:
457
+ Callable[[~.UpdateDeploymentResourcePoolRequest],
458
+ ~.Operation]:
459
+ A function that, when called, will call the underlying RPC
460
+ on the server.
461
+ """
462
+ # Generate a "stub function" on-the-fly which will actually make
463
+ # the request.
464
+ # gRPC handles serialization and deserialization, so we just need
465
+ # to pass in the functions for each.
466
+ if "update_deployment_resource_pool" not in self._stubs:
467
+ self._stubs["update_deployment_resource_pool"] = (
468
+ self._logged_channel.unary_unary(
469
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/UpdateDeploymentResourcePool",
470
+ request_serializer=deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest.serialize,
471
+ response_deserializer=operations_pb2.Operation.FromString,
472
+ )
473
+ )
474
+ return self._stubs["update_deployment_resource_pool"]
475
+
476
+ @property
477
+ def delete_deployment_resource_pool(
478
+ self,
479
+ ) -> Callable[
480
+ [deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest],
481
+ operations_pb2.Operation,
482
+ ]:
483
+ r"""Return a callable for the delete deployment resource
484
+ pool method over gRPC.
485
+
486
+ Delete a DeploymentResourcePool.
487
+
488
+ Returns:
489
+ Callable[[~.DeleteDeploymentResourcePoolRequest],
490
+ ~.Operation]:
491
+ A function that, when called, will call the underlying RPC
492
+ on the server.
493
+ """
494
+ # Generate a "stub function" on-the-fly which will actually make
495
+ # the request.
496
+ # gRPC handles serialization and deserialization, so we just need
497
+ # to pass in the functions for each.
498
+ if "delete_deployment_resource_pool" not in self._stubs:
499
+ self._stubs["delete_deployment_resource_pool"] = (
500
+ self._logged_channel.unary_unary(
501
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/DeleteDeploymentResourcePool",
502
+ request_serializer=deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest.serialize,
503
+ response_deserializer=operations_pb2.Operation.FromString,
504
+ )
505
+ )
506
+ return self._stubs["delete_deployment_resource_pool"]
507
+
508
+ @property
509
+ def query_deployed_models(
510
+ self,
511
+ ) -> Callable[
512
+ [deployment_resource_pool_service.QueryDeployedModelsRequest],
513
+ deployment_resource_pool_service.QueryDeployedModelsResponse,
514
+ ]:
515
+ r"""Return a callable for the query deployed models method over gRPC.
516
+
517
+ List DeployedModels that have been deployed on this
518
+ DeploymentResourcePool.
519
+
520
+ Returns:
521
+ Callable[[~.QueryDeployedModelsRequest],
522
+ ~.QueryDeployedModelsResponse]:
523
+ A function that, when called, will call the underlying RPC
524
+ on the server.
525
+ """
526
+ # Generate a "stub function" on-the-fly which will actually make
527
+ # the request.
528
+ # gRPC handles serialization and deserialization, so we just need
529
+ # to pass in the functions for each.
530
+ if "query_deployed_models" not in self._stubs:
531
+ self._stubs["query_deployed_models"] = self._logged_channel.unary_unary(
532
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/QueryDeployedModels",
533
+ request_serializer=deployment_resource_pool_service.QueryDeployedModelsRequest.serialize,
534
+ response_deserializer=deployment_resource_pool_service.QueryDeployedModelsResponse.deserialize,
535
+ )
536
+ return self._stubs["query_deployed_models"]
537
+
538
+ def close(self):
539
+ self._logged_channel.close()
540
+
541
+ @property
542
+ def delete_operation(
543
+ self,
544
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
545
+ r"""Return a callable for the delete_operation method over gRPC."""
546
+ # Generate a "stub function" on-the-fly which will actually make
547
+ # the request.
548
+ # gRPC handles serialization and deserialization, so we just need
549
+ # to pass in the functions for each.
550
+ if "delete_operation" not in self._stubs:
551
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
552
+ "/google.longrunning.Operations/DeleteOperation",
553
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
554
+ response_deserializer=None,
555
+ )
556
+ return self._stubs["delete_operation"]
557
+
558
+ @property
559
+ def cancel_operation(
560
+ self,
561
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
562
+ r"""Return a callable for the cancel_operation method over gRPC."""
563
+ # Generate a "stub function" on-the-fly which will actually make
564
+ # the request.
565
+ # gRPC handles serialization and deserialization, so we just need
566
+ # to pass in the functions for each.
567
+ if "cancel_operation" not in self._stubs:
568
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
569
+ "/google.longrunning.Operations/CancelOperation",
570
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
571
+ response_deserializer=None,
572
+ )
573
+ return self._stubs["cancel_operation"]
574
+
575
+ @property
576
+ def wait_operation(
577
+ self,
578
+ ) -> Callable[[operations_pb2.WaitOperationRequest], None]:
579
+ r"""Return a callable for the wait_operation method over gRPC."""
580
+ # Generate a "stub function" on-the-fly which will actually make
581
+ # the request.
582
+ # gRPC handles serialization and deserialization, so we just need
583
+ # to pass in the functions for each.
584
+ if "wait_operation" not in self._stubs:
585
+ self._stubs["wait_operation"] = self._logged_channel.unary_unary(
586
+ "/google.longrunning.Operations/WaitOperation",
587
+ request_serializer=operations_pb2.WaitOperationRequest.SerializeToString,
588
+ response_deserializer=None,
589
+ )
590
+ return self._stubs["wait_operation"]
591
+
592
+ @property
593
+ def get_operation(
594
+ self,
595
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
596
+ r"""Return a callable for the get_operation method over gRPC."""
597
+ # Generate a "stub function" on-the-fly which will actually make
598
+ # the request.
599
+ # gRPC handles serialization and deserialization, so we just need
600
+ # to pass in the functions for each.
601
+ if "get_operation" not in self._stubs:
602
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
603
+ "/google.longrunning.Operations/GetOperation",
604
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
605
+ response_deserializer=operations_pb2.Operation.FromString,
606
+ )
607
+ return self._stubs["get_operation"]
608
+
609
+ @property
610
+ def list_operations(
611
+ self,
612
+ ) -> Callable[
613
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
614
+ ]:
615
+ r"""Return a callable for the list_operations method over gRPC."""
616
+ # Generate a "stub function" on-the-fly which will actually make
617
+ # the request.
618
+ # gRPC handles serialization and deserialization, so we just need
619
+ # to pass in the functions for each.
620
+ if "list_operations" not in self._stubs:
621
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
622
+ "/google.longrunning.Operations/ListOperations",
623
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
624
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
625
+ )
626
+ return self._stubs["list_operations"]
627
+
628
+ @property
629
+ def list_locations(
630
+ self,
631
+ ) -> Callable[
632
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
633
+ ]:
634
+ r"""Return a callable for the list locations method over gRPC."""
635
+ # Generate a "stub function" on-the-fly which will actually make
636
+ # the request.
637
+ # gRPC handles serialization and deserialization, so we just need
638
+ # to pass in the functions for each.
639
+ if "list_locations" not in self._stubs:
640
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
641
+ "/google.cloud.location.Locations/ListLocations",
642
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
643
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
644
+ )
645
+ return self._stubs["list_locations"]
646
+
647
+ @property
648
+ def get_location(
649
+ self,
650
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
651
+ r"""Return a callable for the list locations method over gRPC."""
652
+ # Generate a "stub function" on-the-fly which will actually make
653
+ # the request.
654
+ # gRPC handles serialization and deserialization, so we just need
655
+ # to pass in the functions for each.
656
+ if "get_location" not in self._stubs:
657
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
658
+ "/google.cloud.location.Locations/GetLocation",
659
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
660
+ response_deserializer=locations_pb2.Location.FromString,
661
+ )
662
+ return self._stubs["get_location"]
663
+
664
+ @property
665
+ def set_iam_policy(
666
+ self,
667
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
668
+ r"""Return a callable for the set iam policy method over gRPC.
669
+ Sets the IAM access control policy on the specified
670
+ function. Replaces any existing policy.
671
+ Returns:
672
+ Callable[[~.SetIamPolicyRequest],
673
+ ~.Policy]:
674
+ A function that, when called, will call the underlying RPC
675
+ on the server.
676
+ """
677
+ # Generate a "stub function" on-the-fly which will actually make
678
+ # the request.
679
+ # gRPC handles serialization and deserialization, so we just need
680
+ # to pass in the functions for each.
681
+ if "set_iam_policy" not in self._stubs:
682
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
683
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
684
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
685
+ response_deserializer=policy_pb2.Policy.FromString,
686
+ )
687
+ return self._stubs["set_iam_policy"]
688
+
689
+ @property
690
+ def get_iam_policy(
691
+ self,
692
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
693
+ r"""Return a callable for the get iam policy method over gRPC.
694
+ Gets the IAM access control policy for a function.
695
+ Returns an empty policy if the function exists and does
696
+ not have a policy set.
697
+ Returns:
698
+ Callable[[~.GetIamPolicyRequest],
699
+ ~.Policy]:
700
+ A function that, when called, will call the underlying RPC
701
+ on the server.
702
+ """
703
+ # Generate a "stub function" on-the-fly which will actually make
704
+ # the request.
705
+ # gRPC handles serialization and deserialization, so we just need
706
+ # to pass in the functions for each.
707
+ if "get_iam_policy" not in self._stubs:
708
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
709
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
710
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
711
+ response_deserializer=policy_pb2.Policy.FromString,
712
+ )
713
+ return self._stubs["get_iam_policy"]
714
+
715
+ @property
716
+ def test_iam_permissions(
717
+ self,
718
+ ) -> Callable[
719
+ [iam_policy_pb2.TestIamPermissionsRequest],
720
+ iam_policy_pb2.TestIamPermissionsResponse,
721
+ ]:
722
+ r"""Return a callable for the test iam permissions method over gRPC.
723
+ Tests the specified permissions against the IAM access control
724
+ policy for a function. If the function does not exist, this will
725
+ return an empty set of permissions, not a NOT_FOUND error.
726
+ Returns:
727
+ Callable[[~.TestIamPermissionsRequest],
728
+ ~.TestIamPermissionsResponse]:
729
+ A function that, when called, will call the underlying RPC
730
+ on the server.
731
+ """
732
+ # Generate a "stub function" on-the-fly which will actually make
733
+ # the request.
734
+ # gRPC handles serialization and deserialization, so we just need
735
+ # to pass in the functions for each.
736
+ if "test_iam_permissions" not in self._stubs:
737
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
738
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
739
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
740
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
741
+ )
742
+ return self._stubs["test_iam_permissions"]
743
+
744
+ @property
745
+ def kind(self) -> str:
746
+ return "grpc"
747
+
748
+
749
+ __all__ = ("DeploymentResourcePoolServiceGrpcTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc_asyncio.py ADDED
@@ -0,0 +1,847 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 pickle
19
+ import logging as std_logging
20
+ import warnings
21
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
22
+
23
+ from google.api_core import gapic_v1
24
+ from google.api_core import grpc_helpers_async
25
+ from google.api_core import exceptions as core_exceptions
26
+ from google.api_core import retry_async as retries
27
+ from google.api_core import operations_v1
28
+ from google.auth import credentials as ga_credentials # type: ignore
29
+ from google.auth.transport.grpc import SslCredentials # type: ignore
30
+ from google.protobuf.json_format import MessageToJson
31
+ import google.protobuf.message
32
+
33
+ import grpc # type: ignore
34
+ import proto # type: ignore
35
+ from grpc.experimental import aio # type: ignore
36
+
37
+ from google.cloud.aiplatform_v1.types import deployment_resource_pool
38
+ from google.cloud.aiplatform_v1.types import deployment_resource_pool_service
39
+ from google.cloud.location import locations_pb2 # type: ignore
40
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
41
+ from google.iam.v1 import policy_pb2 # type: ignore
42
+ from google.longrunning import operations_pb2 # type: ignore
43
+ from .base import DeploymentResourcePoolServiceTransport, DEFAULT_CLIENT_INFO
44
+ from .grpc import DeploymentResourcePoolServiceGrpcTransport
45
+
46
+ try:
47
+ from google.api_core import client_logging # type: ignore
48
+
49
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
50
+ except ImportError: # pragma: NO COVER
51
+ CLIENT_LOGGING_SUPPORTED = False
52
+
53
+ _LOGGER = std_logging.getLogger(__name__)
54
+
55
+
56
+ class _LoggingClientAIOInterceptor(
57
+ grpc.aio.UnaryUnaryClientInterceptor
58
+ ): # pragma: NO COVER
59
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
60
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
61
+ std_logging.DEBUG
62
+ )
63
+ if logging_enabled: # pragma: NO COVER
64
+ request_metadata = client_call_details.metadata
65
+ if isinstance(request, proto.Message):
66
+ request_payload = type(request).to_json(request)
67
+ elif isinstance(request, google.protobuf.message.Message):
68
+ request_payload = MessageToJson(request)
69
+ else:
70
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
71
+
72
+ request_metadata = {
73
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
74
+ for key, value in request_metadata
75
+ }
76
+ grpc_request = {
77
+ "payload": request_payload,
78
+ "requestMethod": "grpc",
79
+ "metadata": dict(request_metadata),
80
+ }
81
+ _LOGGER.debug(
82
+ f"Sending request for {client_call_details.method}",
83
+ extra={
84
+ "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService",
85
+ "rpcName": str(client_call_details.method),
86
+ "request": grpc_request,
87
+ "metadata": grpc_request["metadata"],
88
+ },
89
+ )
90
+ response = await continuation(client_call_details, request)
91
+ if logging_enabled: # pragma: NO COVER
92
+ response_metadata = await response.trailing_metadata()
93
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
94
+ metadata = (
95
+ dict([(k, str(v)) for k, v in response_metadata])
96
+ if response_metadata
97
+ else None
98
+ )
99
+ result = await response
100
+ if isinstance(result, proto.Message):
101
+ response_payload = type(result).to_json(result)
102
+ elif isinstance(result, google.protobuf.message.Message):
103
+ response_payload = MessageToJson(result)
104
+ else:
105
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
106
+ grpc_response = {
107
+ "payload": response_payload,
108
+ "metadata": metadata,
109
+ "status": "OK",
110
+ }
111
+ _LOGGER.debug(
112
+ f"Received response to rpc {client_call_details.method}.",
113
+ extra={
114
+ "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService",
115
+ "rpcName": str(client_call_details.method),
116
+ "response": grpc_response,
117
+ "metadata": grpc_response["metadata"],
118
+ },
119
+ )
120
+ return response
121
+
122
+
123
+ class DeploymentResourcePoolServiceGrpcAsyncIOTransport(
124
+ DeploymentResourcePoolServiceTransport
125
+ ):
126
+ """gRPC AsyncIO backend transport for DeploymentResourcePoolService.
127
+
128
+ A service that manages the DeploymentResourcePool resource.
129
+
130
+ This class defines the same methods as the primary client, so the
131
+ primary client can load the underlying transport implementation
132
+ and call it.
133
+
134
+ It sends protocol buffers over the wire using gRPC (which is built on
135
+ top of HTTP/2); the ``grpcio`` package must be installed.
136
+ """
137
+
138
+ _grpc_channel: aio.Channel
139
+ _stubs: Dict[str, Callable] = {}
140
+
141
+ @classmethod
142
+ def create_channel(
143
+ cls,
144
+ host: str = "aiplatform.googleapis.com",
145
+ credentials: Optional[ga_credentials.Credentials] = None,
146
+ credentials_file: Optional[str] = None,
147
+ scopes: Optional[Sequence[str]] = None,
148
+ quota_project_id: Optional[str] = None,
149
+ **kwargs,
150
+ ) -> aio.Channel:
151
+ """Create and return a gRPC AsyncIO channel object.
152
+ Args:
153
+ host (Optional[str]): The host for the channel to use.
154
+ credentials (Optional[~.Credentials]): The
155
+ authorization credentials to attach to requests. These
156
+ credentials identify this application to the service. If
157
+ none are specified, the client will attempt to ascertain
158
+ the credentials from the environment.
159
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
160
+ be loaded with :func:`google.auth.load_credentials_from_file`. This argument will be
161
+ removed in the next major version of this library.
162
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
163
+ service. These are only used when credentials are not specified and
164
+ are passed to :func:`google.auth.default`.
165
+ quota_project_id (Optional[str]): An optional project to use for billing
166
+ and quota.
167
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
168
+ channel creation.
169
+ Returns:
170
+ aio.Channel: A gRPC AsyncIO channel object.
171
+ """
172
+
173
+ return grpc_helpers_async.create_channel(
174
+ host,
175
+ credentials=credentials,
176
+ credentials_file=credentials_file,
177
+ quota_project_id=quota_project_id,
178
+ default_scopes=cls.AUTH_SCOPES,
179
+ scopes=scopes,
180
+ default_host=cls.DEFAULT_HOST,
181
+ **kwargs,
182
+ )
183
+
184
+ def __init__(
185
+ self,
186
+ *,
187
+ host: str = "aiplatform.googleapis.com",
188
+ credentials: Optional[ga_credentials.Credentials] = None,
189
+ credentials_file: Optional[str] = None,
190
+ scopes: Optional[Sequence[str]] = None,
191
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
192
+ api_mtls_endpoint: Optional[str] = None,
193
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
194
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
195
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
196
+ quota_project_id: Optional[str] = None,
197
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
198
+ always_use_jwt_access: Optional[bool] = False,
199
+ api_audience: Optional[str] = None,
200
+ ) -> None:
201
+ """Instantiate the transport.
202
+
203
+ Args:
204
+ host (Optional[str]):
205
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
206
+ credentials (Optional[google.auth.credentials.Credentials]): The
207
+ authorization credentials to attach to requests. These
208
+ credentials identify the application to the service; if none
209
+ are specified, the client will attempt to ascertain the
210
+ credentials from the environment.
211
+ This argument is ignored if a ``channel`` instance is provided.
212
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
213
+ be loaded with :func:`google.auth.load_credentials_from_file`.
214
+ This argument is ignored if a ``channel`` instance is provided.
215
+ This argument will be removed in the next major version of this library.
216
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
217
+ service. These are only used when credentials are not specified and
218
+ are passed to :func:`google.auth.default`.
219
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
220
+ A ``Channel`` instance through which to make calls, or a Callable
221
+ that constructs and returns one. If set to None, ``self.create_channel``
222
+ is used to create the channel. If a Callable is given, it will be called
223
+ with the same arguments as used in ``self.create_channel``.
224
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
225
+ If provided, it overrides the ``host`` argument and tries to create
226
+ a mutual TLS channel with client SSL credentials from
227
+ ``client_cert_source`` or application default SSL credentials.
228
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
229
+ Deprecated. A callback to provide client SSL certificate bytes and
230
+ private key bytes, both in PEM format. It is ignored if
231
+ ``api_mtls_endpoint`` is None.
232
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
233
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
234
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
235
+ A callback to provide client certificate bytes and private key bytes,
236
+ both in PEM format. It is used to configure a mutual TLS channel. It is
237
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
238
+ quota_project_id (Optional[str]): An optional project to use for billing
239
+ and quota.
240
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
241
+ The client info used to send a user-agent string along with
242
+ API requests. If ``None``, then default info will be used.
243
+ Generally, you only need to set this if you're developing
244
+ your own client library.
245
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
246
+ be used for service account credentials.
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
+ self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
258
+
259
+ if api_mtls_endpoint:
260
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
261
+ if client_cert_source:
262
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
263
+
264
+ if isinstance(channel, aio.Channel):
265
+ # Ignore credentials if a channel was passed.
266
+ credentials = None
267
+ self._ignore_credentials = True
268
+ # If a channel was explicitly provided, set it.
269
+ self._grpc_channel = channel
270
+ self._ssl_channel_credentials = None
271
+ else:
272
+ if api_mtls_endpoint:
273
+ host = api_mtls_endpoint
274
+
275
+ # Create SSL credentials with client_cert_source or application
276
+ # default SSL credentials.
277
+ if client_cert_source:
278
+ cert, key = client_cert_source()
279
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
280
+ certificate_chain=cert, private_key=key
281
+ )
282
+ else:
283
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
284
+
285
+ else:
286
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
287
+ cert, key = client_cert_source_for_mtls()
288
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
289
+ certificate_chain=cert, private_key=key
290
+ )
291
+
292
+ # The base transport sets the host, credentials and scopes
293
+ super().__init__(
294
+ host=host,
295
+ credentials=credentials,
296
+ credentials_file=credentials_file,
297
+ scopes=scopes,
298
+ quota_project_id=quota_project_id,
299
+ client_info=client_info,
300
+ always_use_jwt_access=always_use_jwt_access,
301
+ api_audience=api_audience,
302
+ )
303
+
304
+ if not self._grpc_channel:
305
+ # initialize with the provided callable or the default channel
306
+ channel_init = channel or type(self).create_channel
307
+ self._grpc_channel = channel_init(
308
+ self._host,
309
+ # use the credentials which are saved
310
+ credentials=self._credentials,
311
+ # Set ``credentials_file`` to ``None`` here as
312
+ # the credentials that we saved earlier should be used.
313
+ credentials_file=None,
314
+ scopes=self._scopes,
315
+ ssl_credentials=self._ssl_channel_credentials,
316
+ quota_project_id=quota_project_id,
317
+ options=[
318
+ ("grpc.max_send_message_length", -1),
319
+ ("grpc.max_receive_message_length", -1),
320
+ ],
321
+ )
322
+
323
+ self._interceptor = _LoggingClientAIOInterceptor()
324
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
325
+ self._logged_channel = self._grpc_channel
326
+ self._wrap_with_kind = (
327
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
328
+ )
329
+ # Wrap messages. This must be done after self._logged_channel exists
330
+ self._prep_wrapped_messages(client_info)
331
+
332
+ @property
333
+ def grpc_channel(self) -> aio.Channel:
334
+ """Create the channel designed to connect to this service.
335
+
336
+ This property caches on the instance; repeated calls return
337
+ the same channel.
338
+ """
339
+ # Return the channel from cache.
340
+ return self._grpc_channel
341
+
342
+ @property
343
+ def operations_client(self) -> operations_v1.OperationsAsyncClient:
344
+ """Create the client designed to process long-running operations.
345
+
346
+ This property caches on the instance; repeated calls return the same
347
+ client.
348
+ """
349
+ # Quick check: Only create a new client if we do not already have one.
350
+ if self._operations_client is None:
351
+ self._operations_client = operations_v1.OperationsAsyncClient(
352
+ self._logged_channel
353
+ )
354
+
355
+ # Return the client from cache.
356
+ return self._operations_client
357
+
358
+ @property
359
+ def create_deployment_resource_pool(
360
+ self,
361
+ ) -> Callable[
362
+ [deployment_resource_pool_service.CreateDeploymentResourcePoolRequest],
363
+ Awaitable[operations_pb2.Operation],
364
+ ]:
365
+ r"""Return a callable for the create deployment resource
366
+ pool method over gRPC.
367
+
368
+ Create a DeploymentResourcePool.
369
+
370
+ Returns:
371
+ Callable[[~.CreateDeploymentResourcePoolRequest],
372
+ Awaitable[~.Operation]]:
373
+ A function that, when called, will call the underlying RPC
374
+ on the server.
375
+ """
376
+ # Generate a "stub function" on-the-fly which will actually make
377
+ # the request.
378
+ # gRPC handles serialization and deserialization, so we just need
379
+ # to pass in the functions for each.
380
+ if "create_deployment_resource_pool" not in self._stubs:
381
+ self._stubs["create_deployment_resource_pool"] = (
382
+ self._logged_channel.unary_unary(
383
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/CreateDeploymentResourcePool",
384
+ request_serializer=deployment_resource_pool_service.CreateDeploymentResourcePoolRequest.serialize,
385
+ response_deserializer=operations_pb2.Operation.FromString,
386
+ )
387
+ )
388
+ return self._stubs["create_deployment_resource_pool"]
389
+
390
+ @property
391
+ def get_deployment_resource_pool(
392
+ self,
393
+ ) -> Callable[
394
+ [deployment_resource_pool_service.GetDeploymentResourcePoolRequest],
395
+ Awaitable[deployment_resource_pool.DeploymentResourcePool],
396
+ ]:
397
+ r"""Return a callable for the get deployment resource pool method over gRPC.
398
+
399
+ Get a DeploymentResourcePool.
400
+
401
+ Returns:
402
+ Callable[[~.GetDeploymentResourcePoolRequest],
403
+ Awaitable[~.DeploymentResourcePool]]:
404
+ A function that, when called, will call the underlying RPC
405
+ on the server.
406
+ """
407
+ # Generate a "stub function" on-the-fly which will actually make
408
+ # the request.
409
+ # gRPC handles serialization and deserialization, so we just need
410
+ # to pass in the functions for each.
411
+ if "get_deployment_resource_pool" not in self._stubs:
412
+ self._stubs["get_deployment_resource_pool"] = (
413
+ self._logged_channel.unary_unary(
414
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/GetDeploymentResourcePool",
415
+ request_serializer=deployment_resource_pool_service.GetDeploymentResourcePoolRequest.serialize,
416
+ response_deserializer=deployment_resource_pool.DeploymentResourcePool.deserialize,
417
+ )
418
+ )
419
+ return self._stubs["get_deployment_resource_pool"]
420
+
421
+ @property
422
+ def list_deployment_resource_pools(
423
+ self,
424
+ ) -> Callable[
425
+ [deployment_resource_pool_service.ListDeploymentResourcePoolsRequest],
426
+ Awaitable[deployment_resource_pool_service.ListDeploymentResourcePoolsResponse],
427
+ ]:
428
+ r"""Return a callable for the list deployment resource pools method over gRPC.
429
+
430
+ List DeploymentResourcePools in a location.
431
+
432
+ Returns:
433
+ Callable[[~.ListDeploymentResourcePoolsRequest],
434
+ Awaitable[~.ListDeploymentResourcePoolsResponse]]:
435
+ A function that, when called, will call the underlying RPC
436
+ on the server.
437
+ """
438
+ # Generate a "stub function" on-the-fly which will actually make
439
+ # the request.
440
+ # gRPC handles serialization and deserialization, so we just need
441
+ # to pass in the functions for each.
442
+ if "list_deployment_resource_pools" not in self._stubs:
443
+ self._stubs["list_deployment_resource_pools"] = (
444
+ self._logged_channel.unary_unary(
445
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/ListDeploymentResourcePools",
446
+ request_serializer=deployment_resource_pool_service.ListDeploymentResourcePoolsRequest.serialize,
447
+ response_deserializer=deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.deserialize,
448
+ )
449
+ )
450
+ return self._stubs["list_deployment_resource_pools"]
451
+
452
+ @property
453
+ def update_deployment_resource_pool(
454
+ self,
455
+ ) -> Callable[
456
+ [deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest],
457
+ Awaitable[operations_pb2.Operation],
458
+ ]:
459
+ r"""Return a callable for the update deployment resource
460
+ pool method over gRPC.
461
+
462
+ Update a DeploymentResourcePool.
463
+
464
+ Returns:
465
+ Callable[[~.UpdateDeploymentResourcePoolRequest],
466
+ Awaitable[~.Operation]]:
467
+ A function that, when called, will call the underlying RPC
468
+ on the server.
469
+ """
470
+ # Generate a "stub function" on-the-fly which will actually make
471
+ # the request.
472
+ # gRPC handles serialization and deserialization, so we just need
473
+ # to pass in the functions for each.
474
+ if "update_deployment_resource_pool" not in self._stubs:
475
+ self._stubs["update_deployment_resource_pool"] = (
476
+ self._logged_channel.unary_unary(
477
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/UpdateDeploymentResourcePool",
478
+ request_serializer=deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest.serialize,
479
+ response_deserializer=operations_pb2.Operation.FromString,
480
+ )
481
+ )
482
+ return self._stubs["update_deployment_resource_pool"]
483
+
484
+ @property
485
+ def delete_deployment_resource_pool(
486
+ self,
487
+ ) -> Callable[
488
+ [deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest],
489
+ Awaitable[operations_pb2.Operation],
490
+ ]:
491
+ r"""Return a callable for the delete deployment resource
492
+ pool method over gRPC.
493
+
494
+ Delete a DeploymentResourcePool.
495
+
496
+ Returns:
497
+ Callable[[~.DeleteDeploymentResourcePoolRequest],
498
+ Awaitable[~.Operation]]:
499
+ A function that, when called, will call the underlying RPC
500
+ on the server.
501
+ """
502
+ # Generate a "stub function" on-the-fly which will actually make
503
+ # the request.
504
+ # gRPC handles serialization and deserialization, so we just need
505
+ # to pass in the functions for each.
506
+ if "delete_deployment_resource_pool" not in self._stubs:
507
+ self._stubs["delete_deployment_resource_pool"] = (
508
+ self._logged_channel.unary_unary(
509
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/DeleteDeploymentResourcePool",
510
+ request_serializer=deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest.serialize,
511
+ response_deserializer=operations_pb2.Operation.FromString,
512
+ )
513
+ )
514
+ return self._stubs["delete_deployment_resource_pool"]
515
+
516
+ @property
517
+ def query_deployed_models(
518
+ self,
519
+ ) -> Callable[
520
+ [deployment_resource_pool_service.QueryDeployedModelsRequest],
521
+ Awaitable[deployment_resource_pool_service.QueryDeployedModelsResponse],
522
+ ]:
523
+ r"""Return a callable for the query deployed models method over gRPC.
524
+
525
+ List DeployedModels that have been deployed on this
526
+ DeploymentResourcePool.
527
+
528
+ Returns:
529
+ Callable[[~.QueryDeployedModelsRequest],
530
+ Awaitable[~.QueryDeployedModelsResponse]]:
531
+ A function that, when called, will call the underlying RPC
532
+ on the server.
533
+ """
534
+ # Generate a "stub function" on-the-fly which will actually make
535
+ # the request.
536
+ # gRPC handles serialization and deserialization, so we just need
537
+ # to pass in the functions for each.
538
+ if "query_deployed_models" not in self._stubs:
539
+ self._stubs["query_deployed_models"] = self._logged_channel.unary_unary(
540
+ "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/QueryDeployedModels",
541
+ request_serializer=deployment_resource_pool_service.QueryDeployedModelsRequest.serialize,
542
+ response_deserializer=deployment_resource_pool_service.QueryDeployedModelsResponse.deserialize,
543
+ )
544
+ return self._stubs["query_deployed_models"]
545
+
546
+ def _prep_wrapped_messages(self, client_info):
547
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
548
+ self._wrapped_methods = {
549
+ self.create_deployment_resource_pool: self._wrap_method(
550
+ self.create_deployment_resource_pool,
551
+ default_timeout=None,
552
+ client_info=client_info,
553
+ ),
554
+ self.get_deployment_resource_pool: self._wrap_method(
555
+ self.get_deployment_resource_pool,
556
+ default_timeout=None,
557
+ client_info=client_info,
558
+ ),
559
+ self.list_deployment_resource_pools: self._wrap_method(
560
+ self.list_deployment_resource_pools,
561
+ default_timeout=None,
562
+ client_info=client_info,
563
+ ),
564
+ self.update_deployment_resource_pool: self._wrap_method(
565
+ self.update_deployment_resource_pool,
566
+ default_timeout=None,
567
+ client_info=client_info,
568
+ ),
569
+ self.delete_deployment_resource_pool: self._wrap_method(
570
+ self.delete_deployment_resource_pool,
571
+ default_timeout=None,
572
+ client_info=client_info,
573
+ ),
574
+ self.query_deployed_models: self._wrap_method(
575
+ self.query_deployed_models,
576
+ default_timeout=None,
577
+ client_info=client_info,
578
+ ),
579
+ self.get_location: self._wrap_method(
580
+ self.get_location,
581
+ default_timeout=None,
582
+ client_info=client_info,
583
+ ),
584
+ self.list_locations: self._wrap_method(
585
+ self.list_locations,
586
+ default_timeout=None,
587
+ client_info=client_info,
588
+ ),
589
+ self.get_iam_policy: self._wrap_method(
590
+ self.get_iam_policy,
591
+ default_timeout=None,
592
+ client_info=client_info,
593
+ ),
594
+ self.set_iam_policy: self._wrap_method(
595
+ self.set_iam_policy,
596
+ default_timeout=None,
597
+ client_info=client_info,
598
+ ),
599
+ self.test_iam_permissions: self._wrap_method(
600
+ self.test_iam_permissions,
601
+ default_timeout=None,
602
+ client_info=client_info,
603
+ ),
604
+ self.cancel_operation: self._wrap_method(
605
+ self.cancel_operation,
606
+ default_timeout=None,
607
+ client_info=client_info,
608
+ ),
609
+ self.delete_operation: self._wrap_method(
610
+ self.delete_operation,
611
+ default_timeout=None,
612
+ client_info=client_info,
613
+ ),
614
+ self.get_operation: self._wrap_method(
615
+ self.get_operation,
616
+ default_timeout=None,
617
+ client_info=client_info,
618
+ ),
619
+ self.list_operations: self._wrap_method(
620
+ self.list_operations,
621
+ default_timeout=None,
622
+ client_info=client_info,
623
+ ),
624
+ self.wait_operation: self._wrap_method(
625
+ self.wait_operation,
626
+ default_timeout=None,
627
+ client_info=client_info,
628
+ ),
629
+ }
630
+
631
+ def _wrap_method(self, func, *args, **kwargs):
632
+ if self._wrap_with_kind: # pragma: NO COVER
633
+ kwargs["kind"] = self.kind
634
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
635
+
636
+ def close(self):
637
+ return self._logged_channel.close()
638
+
639
+ @property
640
+ def kind(self) -> str:
641
+ return "grpc_asyncio"
642
+
643
+ @property
644
+ def delete_operation(
645
+ self,
646
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
647
+ r"""Return a callable for the delete_operation method over gRPC."""
648
+ # Generate a "stub function" on-the-fly which will actually make
649
+ # the request.
650
+ # gRPC handles serialization and deserialization, so we just need
651
+ # to pass in the functions for each.
652
+ if "delete_operation" not in self._stubs:
653
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
654
+ "/google.longrunning.Operations/DeleteOperation",
655
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
656
+ response_deserializer=None,
657
+ )
658
+ return self._stubs["delete_operation"]
659
+
660
+ @property
661
+ def cancel_operation(
662
+ self,
663
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
664
+ r"""Return a callable for the cancel_operation method over gRPC."""
665
+ # Generate a "stub function" on-the-fly which will actually make
666
+ # the request.
667
+ # gRPC handles serialization and deserialization, so we just need
668
+ # to pass in the functions for each.
669
+ if "cancel_operation" not in self._stubs:
670
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
671
+ "/google.longrunning.Operations/CancelOperation",
672
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
673
+ response_deserializer=None,
674
+ )
675
+ return self._stubs["cancel_operation"]
676
+
677
+ @property
678
+ def wait_operation(
679
+ self,
680
+ ) -> Callable[[operations_pb2.WaitOperationRequest], None]:
681
+ r"""Return a callable for the wait_operation method over gRPC."""
682
+ # Generate a "stub function" on-the-fly which will actually make
683
+ # the request.
684
+ # gRPC handles serialization and deserialization, so we just need
685
+ # to pass in the functions for each.
686
+ if "wait_operation" not in self._stubs:
687
+ self._stubs["wait_operation"] = self._logged_channel.unary_unary(
688
+ "/google.longrunning.Operations/WaitOperation",
689
+ request_serializer=operations_pb2.WaitOperationRequest.SerializeToString,
690
+ response_deserializer=None,
691
+ )
692
+ return self._stubs["wait_operation"]
693
+
694
+ @property
695
+ def get_operation(
696
+ self,
697
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
698
+ r"""Return a callable for the get_operation method over gRPC."""
699
+ # Generate a "stub function" on-the-fly which will actually make
700
+ # the request.
701
+ # gRPC handles serialization and deserialization, so we just need
702
+ # to pass in the functions for each.
703
+ if "get_operation" not in self._stubs:
704
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
705
+ "/google.longrunning.Operations/GetOperation",
706
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
707
+ response_deserializer=operations_pb2.Operation.FromString,
708
+ )
709
+ return self._stubs["get_operation"]
710
+
711
+ @property
712
+ def list_operations(
713
+ self,
714
+ ) -> Callable[
715
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
716
+ ]:
717
+ r"""Return a callable for the list_operations method over gRPC."""
718
+ # Generate a "stub function" on-the-fly which will actually make
719
+ # the request.
720
+ # gRPC handles serialization and deserialization, so we just need
721
+ # to pass in the functions for each.
722
+ if "list_operations" not in self._stubs:
723
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
724
+ "/google.longrunning.Operations/ListOperations",
725
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
726
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
727
+ )
728
+ return self._stubs["list_operations"]
729
+
730
+ @property
731
+ def list_locations(
732
+ self,
733
+ ) -> Callable[
734
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
735
+ ]:
736
+ r"""Return a callable for the list locations method over gRPC."""
737
+ # Generate a "stub function" on-the-fly which will actually make
738
+ # the request.
739
+ # gRPC handles serialization and deserialization, so we just need
740
+ # to pass in the functions for each.
741
+ if "list_locations" not in self._stubs:
742
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
743
+ "/google.cloud.location.Locations/ListLocations",
744
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
745
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
746
+ )
747
+ return self._stubs["list_locations"]
748
+
749
+ @property
750
+ def get_location(
751
+ self,
752
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
753
+ r"""Return a callable for the list locations method over gRPC."""
754
+ # Generate a "stub function" on-the-fly which will actually make
755
+ # the request.
756
+ # gRPC handles serialization and deserialization, so we just need
757
+ # to pass in the functions for each.
758
+ if "get_location" not in self._stubs:
759
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
760
+ "/google.cloud.location.Locations/GetLocation",
761
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
762
+ response_deserializer=locations_pb2.Location.FromString,
763
+ )
764
+ return self._stubs["get_location"]
765
+
766
+ @property
767
+ def set_iam_policy(
768
+ self,
769
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
770
+ r"""Return a callable for the set iam policy method over gRPC.
771
+ Sets the IAM access control policy on the specified
772
+ function. Replaces any existing policy.
773
+ Returns:
774
+ Callable[[~.SetIamPolicyRequest],
775
+ ~.Policy]:
776
+ A function that, when called, will call the underlying RPC
777
+ on the server.
778
+ """
779
+ # Generate a "stub function" on-the-fly which will actually make
780
+ # the request.
781
+ # gRPC handles serialization and deserialization, so we just need
782
+ # to pass in the functions for each.
783
+ if "set_iam_policy" not in self._stubs:
784
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
785
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
786
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
787
+ response_deserializer=policy_pb2.Policy.FromString,
788
+ )
789
+ return self._stubs["set_iam_policy"]
790
+
791
+ @property
792
+ def get_iam_policy(
793
+ self,
794
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
795
+ r"""Return a callable for the get iam policy method over gRPC.
796
+ Gets the IAM access control policy for a function.
797
+ Returns an empty policy if the function exists and does
798
+ not have a policy set.
799
+ Returns:
800
+ Callable[[~.GetIamPolicyRequest],
801
+ ~.Policy]:
802
+ A function that, when called, will call the underlying RPC
803
+ on the server.
804
+ """
805
+ # Generate a "stub function" on-the-fly which will actually make
806
+ # the request.
807
+ # gRPC handles serialization and deserialization, so we just need
808
+ # to pass in the functions for each.
809
+ if "get_iam_policy" not in self._stubs:
810
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
811
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
812
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
813
+ response_deserializer=policy_pb2.Policy.FromString,
814
+ )
815
+ return self._stubs["get_iam_policy"]
816
+
817
+ @property
818
+ def test_iam_permissions(
819
+ self,
820
+ ) -> Callable[
821
+ [iam_policy_pb2.TestIamPermissionsRequest],
822
+ iam_policy_pb2.TestIamPermissionsResponse,
823
+ ]:
824
+ r"""Return a callable for the test iam permissions method over gRPC.
825
+ Tests the specified permissions against the IAM access control
826
+ policy for a function. If the function does not exist, this will
827
+ return an empty set of permissions, not a NOT_FOUND error.
828
+ Returns:
829
+ Callable[[~.TestIamPermissionsRequest],
830
+ ~.TestIamPermissionsResponse]:
831
+ A function that, when called, will call the underlying RPC
832
+ on the server.
833
+ """
834
+ # Generate a "stub function" on-the-fly which will actually make
835
+ # the request.
836
+ # gRPC handles serialization and deserialization, so we just need
837
+ # to pass in the functions for each.
838
+ if "test_iam_permissions" not in self._stubs:
839
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
840
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
841
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
842
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
843
+ )
844
+ return self._stubs["test_iam_permissions"]
845
+
846
+
847
+ __all__ = ("DeploymentResourcePoolServiceGrpcAsyncIOTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest.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/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_asyncio.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/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_base.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/aiplatform_v1/services/endpoint_service/__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 .client import EndpointServiceClient
17
+ from .async_client import EndpointServiceAsyncClient
18
+
19
+ __all__ = (
20
+ "EndpointServiceClient",
21
+ "EndpointServiceAsyncClient",
22
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/endpoint_service/async_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/aiplatform_v1/services/endpoint_service/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/aiplatform_v1/services/endpoint_service/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 google.api_core import gapic_v1
17
+ from google.api_core import retry as retries
18
+ from google.api_core import retry_async as retries_async
19
+ from typing import (
20
+ Any,
21
+ AsyncIterator,
22
+ Awaitable,
23
+ Callable,
24
+ Sequence,
25
+ Tuple,
26
+ Optional,
27
+ Iterator,
28
+ Union,
29
+ )
30
+
31
+ try:
32
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
33
+ OptionalAsyncRetry = Union[
34
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
35
+ ]
36
+ except AttributeError: # pragma: NO COVER
37
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
38
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
39
+
40
+ from google.cloud.aiplatform_v1.types import endpoint
41
+ from google.cloud.aiplatform_v1.types import endpoint_service
42
+
43
+
44
+ class ListEndpointsPager:
45
+ """A pager for iterating through ``list_endpoints`` requests.
46
+
47
+ This class thinly wraps an initial
48
+ :class:`google.cloud.aiplatform_v1.types.ListEndpointsResponse` object, and
49
+ provides an ``__iter__`` method to iterate through its
50
+ ``endpoints`` field.
51
+
52
+ If there are more pages, the ``__iter__`` method will make additional
53
+ ``ListEndpoints`` requests and continue to iterate
54
+ through the ``endpoints`` field on the
55
+ corresponding responses.
56
+
57
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListEndpointsResponse`
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[..., endpoint_service.ListEndpointsResponse],
65
+ request: endpoint_service.ListEndpointsRequest,
66
+ response: endpoint_service.ListEndpointsResponse,
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.aiplatform_v1.types.ListEndpointsRequest):
78
+ The initial request object.
79
+ response (google.cloud.aiplatform_v1.types.ListEndpointsResponse):
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 = endpoint_service.ListEndpointsRequest(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[endpoint_service.ListEndpointsResponse]:
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[endpoint.Endpoint]:
113
+ for page in self.pages:
114
+ yield from page.endpoints
115
+
116
+ def __repr__(self) -> str:
117
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
118
+
119
+
120
+ class ListEndpointsAsyncPager:
121
+ """A pager for iterating through ``list_endpoints`` requests.
122
+
123
+ This class thinly wraps an initial
124
+ :class:`google.cloud.aiplatform_v1.types.ListEndpointsResponse` object, and
125
+ provides an ``__aiter__`` method to iterate through its
126
+ ``endpoints`` field.
127
+
128
+ If there are more pages, the ``__aiter__`` method will make additional
129
+ ``ListEndpoints`` requests and continue to iterate
130
+ through the ``endpoints`` field on the
131
+ corresponding responses.
132
+
133
+ All the usual :class:`google.cloud.aiplatform_v1.types.ListEndpointsResponse`
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[endpoint_service.ListEndpointsResponse]],
141
+ request: endpoint_service.ListEndpointsRequest,
142
+ response: endpoint_service.ListEndpointsResponse,
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.aiplatform_v1.types.ListEndpointsRequest):
154
+ The initial request object.
155
+ response (google.cloud.aiplatform_v1.types.ListEndpointsResponse):
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 = endpoint_service.ListEndpointsRequest(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[endpoint_service.ListEndpointsResponse]:
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[endpoint.Endpoint]:
189
+ async def async_generator():
190
+ async for page in self.pages:
191
+ for response in page.endpoints:
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/aiplatform_v1/services/evaluation_service/__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 .client import EvaluationServiceClient
17
+ from .async_client import EvaluationServiceAsyncClient
18
+
19
+ __all__ = (
20
+ "EvaluationServiceClient",
21
+ "EvaluationServiceAsyncClient",
22
+ )
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (423 Bytes). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/__pycache__/async_client.cpython-311.pyc ADDED
Binary file (45.2 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/__pycache__/client.cpython-311.pyc ADDED
Binary file (65.6 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/async_client.py ADDED
@@ -0,0 +1,1103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from collections import OrderedDict
18
+ import re
19
+ from typing import (
20
+ Dict,
21
+ Callable,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ from google.cloud.aiplatform_v1 import gapic_version as package_version
33
+
34
+ from google.api_core.client_options import ClientOptions
35
+ from google.api_core import exceptions as core_exceptions
36
+ from google.api_core import gapic_v1
37
+ from google.api_core import retry_async as retries
38
+ from google.auth import credentials as ga_credentials # type: ignore
39
+ from google.oauth2 import service_account # type: ignore
40
+ import google.protobuf
41
+
42
+
43
+ try:
44
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
45
+ except AttributeError: # pragma: NO COVER
46
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
47
+
48
+ from google.cloud.aiplatform_v1.types import evaluation_service
49
+ from google.cloud.location import locations_pb2 # type: ignore
50
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
51
+ from google.iam.v1 import policy_pb2 # type: ignore
52
+ from google.longrunning import operations_pb2 # type: ignore
53
+ from .transports.base import EvaluationServiceTransport, DEFAULT_CLIENT_INFO
54
+ from .transports.grpc_asyncio import EvaluationServiceGrpcAsyncIOTransport
55
+ from .client import EvaluationServiceClient
56
+
57
+ try:
58
+ from google.api_core import client_logging # type: ignore
59
+
60
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
61
+ except ImportError: # pragma: NO COVER
62
+ CLIENT_LOGGING_SUPPORTED = False
63
+
64
+ _LOGGER = std_logging.getLogger(__name__)
65
+
66
+
67
+ class EvaluationServiceAsyncClient:
68
+ """Vertex AI Online Evaluation Service."""
69
+
70
+ _client: EvaluationServiceClient
71
+
72
+ # Copy defaults from the synchronous client for use here.
73
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
74
+ DEFAULT_ENDPOINT = EvaluationServiceClient.DEFAULT_ENDPOINT
75
+ DEFAULT_MTLS_ENDPOINT = EvaluationServiceClient.DEFAULT_MTLS_ENDPOINT
76
+ _DEFAULT_ENDPOINT_TEMPLATE = EvaluationServiceClient._DEFAULT_ENDPOINT_TEMPLATE
77
+ _DEFAULT_UNIVERSE = EvaluationServiceClient._DEFAULT_UNIVERSE
78
+
79
+ common_billing_account_path = staticmethod(
80
+ EvaluationServiceClient.common_billing_account_path
81
+ )
82
+ parse_common_billing_account_path = staticmethod(
83
+ EvaluationServiceClient.parse_common_billing_account_path
84
+ )
85
+ common_folder_path = staticmethod(EvaluationServiceClient.common_folder_path)
86
+ parse_common_folder_path = staticmethod(
87
+ EvaluationServiceClient.parse_common_folder_path
88
+ )
89
+ common_organization_path = staticmethod(
90
+ EvaluationServiceClient.common_organization_path
91
+ )
92
+ parse_common_organization_path = staticmethod(
93
+ EvaluationServiceClient.parse_common_organization_path
94
+ )
95
+ common_project_path = staticmethod(EvaluationServiceClient.common_project_path)
96
+ parse_common_project_path = staticmethod(
97
+ EvaluationServiceClient.parse_common_project_path
98
+ )
99
+ common_location_path = staticmethod(EvaluationServiceClient.common_location_path)
100
+ parse_common_location_path = staticmethod(
101
+ EvaluationServiceClient.parse_common_location_path
102
+ )
103
+
104
+ @classmethod
105
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
106
+ """Creates an instance of this client using the provided credentials
107
+ info.
108
+
109
+ Args:
110
+ info (dict): The service account private key info.
111
+ args: Additional arguments to pass to the constructor.
112
+ kwargs: Additional arguments to pass to the constructor.
113
+
114
+ Returns:
115
+ EvaluationServiceAsyncClient: The constructed client.
116
+ """
117
+ sa_info_func = (
118
+ EvaluationServiceClient.from_service_account_info.__func__ # type: ignore
119
+ )
120
+ return sa_info_func(EvaluationServiceAsyncClient, info, *args, **kwargs)
121
+
122
+ @classmethod
123
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
124
+ """Creates an instance of this client using the provided credentials
125
+ file.
126
+
127
+ Args:
128
+ filename (str): The path to the service account private key json
129
+ file.
130
+ args: Additional arguments to pass to the constructor.
131
+ kwargs: Additional arguments to pass to the constructor.
132
+
133
+ Returns:
134
+ EvaluationServiceAsyncClient: The constructed client.
135
+ """
136
+ sa_file_func = (
137
+ EvaluationServiceClient.from_service_account_file.__func__ # type: ignore
138
+ )
139
+ return sa_file_func(EvaluationServiceAsyncClient, filename, *args, **kwargs)
140
+
141
+ from_service_account_json = from_service_account_file
142
+
143
+ @classmethod
144
+ def get_mtls_endpoint_and_cert_source(
145
+ cls, client_options: Optional[ClientOptions] = None
146
+ ):
147
+ """Return the API endpoint and client cert source for mutual TLS.
148
+
149
+ The client cert source is determined in the following order:
150
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
151
+ client cert source is None.
152
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
153
+ default client cert source exists, use the default one; otherwise the client cert
154
+ source is None.
155
+
156
+ The API endpoint is determined in the following order:
157
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
158
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
159
+ default mTLS endpoint; if the environment variable is "never", use the default API
160
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
161
+ use the default API endpoint.
162
+
163
+ More details can be found at https://google.aip.dev/auth/4114.
164
+
165
+ Args:
166
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
167
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
168
+ in this method.
169
+
170
+ Returns:
171
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
172
+ client cert source to use.
173
+
174
+ Raises:
175
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
176
+ """
177
+ return EvaluationServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
178
+
179
+ @property
180
+ def transport(self) -> EvaluationServiceTransport:
181
+ """Returns the transport used by the client instance.
182
+
183
+ Returns:
184
+ EvaluationServiceTransport: The transport used by the client instance.
185
+ """
186
+ return self._client.transport
187
+
188
+ @property
189
+ def api_endpoint(self):
190
+ """Return the API endpoint used by the client instance.
191
+
192
+ Returns:
193
+ str: The API endpoint used by the client instance.
194
+ """
195
+ return self._client._api_endpoint
196
+
197
+ @property
198
+ def universe_domain(self) -> str:
199
+ """Return the universe domain used by the client instance.
200
+
201
+ Returns:
202
+ str: The universe domain used
203
+ by the client instance.
204
+ """
205
+ return self._client._universe_domain
206
+
207
+ get_transport_class = EvaluationServiceClient.get_transport_class
208
+
209
+ def __init__(
210
+ self,
211
+ *,
212
+ credentials: Optional[ga_credentials.Credentials] = None,
213
+ transport: Optional[
214
+ Union[
215
+ str,
216
+ EvaluationServiceTransport,
217
+ Callable[..., EvaluationServiceTransport],
218
+ ]
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 evaluation service 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,EvaluationServiceTransport,Callable[..., EvaluationServiceTransport]]]):
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 EvaluationServiceTransport 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 = EvaluationServiceClient(
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.aiplatform_v1.EvaluationServiceAsyncClient`.",
284
+ extra=(
285
+ {
286
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
287
+ "universeDomain": getattr(
288
+ self._client._transport._credentials, "universe_domain", ""
289
+ ),
290
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
291
+ "credentialsInfo": getattr(
292
+ self.transport._credentials, "get_cred_info", lambda: None
293
+ )(),
294
+ }
295
+ if hasattr(self._client._transport, "_credentials")
296
+ else {
297
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
298
+ "credentialsType": None,
299
+ }
300
+ ),
301
+ )
302
+
303
+ async def evaluate_instances(
304
+ self,
305
+ request: Optional[
306
+ Union[evaluation_service.EvaluateInstancesRequest, dict]
307
+ ] = None,
308
+ *,
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
+ ) -> evaluation_service.EvaluateInstancesResponse:
313
+ r"""Evaluates instances based on a given metric.
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 aiplatform_v1
325
+
326
+ async def sample_evaluate_instances():
327
+ # Create a client
328
+ client = aiplatform_v1.EvaluationServiceAsyncClient()
329
+
330
+ # Initialize request argument(s)
331
+ request = aiplatform_v1.EvaluateInstancesRequest(
332
+ location="location_value",
333
+ )
334
+
335
+ # Make the request
336
+ response = await client.evaluate_instances(request=request)
337
+
338
+ # Handle the response
339
+ print(response)
340
+
341
+ Args:
342
+ request (Optional[Union[google.cloud.aiplatform_v1.types.EvaluateInstancesRequest, dict]]):
343
+ The request object. Request message for
344
+ EvaluationService.EvaluateInstances.
345
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
346
+ should be retried.
347
+ timeout (float): The timeout for this request.
348
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
349
+ sent along with the request as metadata. Normally, each value must be of type `str`,
350
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
351
+ be of type `bytes`.
352
+
353
+ Returns:
354
+ google.cloud.aiplatform_v1.types.EvaluateInstancesResponse:
355
+ Response message for
356
+ EvaluationService.EvaluateInstances.
357
+
358
+ """
359
+ # Create or coerce a protobuf request object.
360
+ # - Use the request object if provided (there's no risk of modifying the input as
361
+ # there are no flattened fields), or create one.
362
+ if not isinstance(request, evaluation_service.EvaluateInstancesRequest):
363
+ request = evaluation_service.EvaluateInstancesRequest(request)
364
+
365
+ # Wrap the RPC method; this adds retry and timeout information,
366
+ # and friendly error handling.
367
+ rpc = self._client._transport._wrapped_methods[
368
+ self._client._transport.evaluate_instances
369
+ ]
370
+
371
+ # Certain fields should be provided within the metadata header;
372
+ # add these here.
373
+ metadata = tuple(metadata) + (
374
+ gapic_v1.routing_header.to_grpc_metadata((("location", request.location),)),
375
+ )
376
+
377
+ # Validate the universe domain.
378
+ self._client._validate_universe_domain()
379
+
380
+ # Send the request.
381
+ response = await rpc(
382
+ request,
383
+ retry=retry,
384
+ timeout=timeout,
385
+ metadata=metadata,
386
+ )
387
+
388
+ # Done; return the response.
389
+ return response
390
+
391
+ async def list_operations(
392
+ self,
393
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
394
+ *,
395
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
396
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
397
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
398
+ ) -> operations_pb2.ListOperationsResponse:
399
+ r"""Lists operations that match the specified filter in the request.
400
+
401
+ Args:
402
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
403
+ The request object. Request message for
404
+ `ListOperations` method.
405
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
406
+ if any, should be retried.
407
+ timeout (float): The timeout for this request.
408
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
409
+ sent along with the request as metadata. Normally, each value must be of type `str`,
410
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
411
+ be of type `bytes`.
412
+ Returns:
413
+ ~.operations_pb2.ListOperationsResponse:
414
+ Response message for ``ListOperations`` method.
415
+ """
416
+ # Create or coerce a protobuf request object.
417
+ # The request isn't a proto-plus wrapped type,
418
+ # so it must be constructed via keyword expansion.
419
+ if isinstance(request, dict):
420
+ request = operations_pb2.ListOperationsRequest(**request)
421
+
422
+ # Wrap the RPC method; this adds retry and timeout information,
423
+ # and friendly error handling.
424
+ rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
425
+
426
+ # Certain fields should be provided within the metadata header;
427
+ # add these here.
428
+ metadata = tuple(metadata) + (
429
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
430
+ )
431
+
432
+ # Validate the universe domain.
433
+ self._client._validate_universe_domain()
434
+
435
+ # Send the request.
436
+ response = await rpc(
437
+ request,
438
+ retry=retry,
439
+ timeout=timeout,
440
+ metadata=metadata,
441
+ )
442
+
443
+ # Done; return the response.
444
+ return response
445
+
446
+ async def get_operation(
447
+ self,
448
+ request: Optional[operations_pb2.GetOperationRequest] = None,
449
+ *,
450
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
451
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
452
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
453
+ ) -> operations_pb2.Operation:
454
+ r"""Gets the latest state of a long-running operation.
455
+
456
+ Args:
457
+ request (:class:`~.operations_pb2.GetOperationRequest`):
458
+ The request object. Request message for
459
+ `GetOperation` method.
460
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
461
+ if any, should be retried.
462
+ timeout (float): The timeout for this request.
463
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
464
+ sent along with the request as metadata. Normally, each value must be of type `str`,
465
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
466
+ be of type `bytes`.
467
+ Returns:
468
+ ~.operations_pb2.Operation:
469
+ An ``Operation`` object.
470
+ """
471
+ # Create or coerce a protobuf request object.
472
+ # The request isn't a proto-plus wrapped type,
473
+ # so it must be constructed via keyword expansion.
474
+ if isinstance(request, dict):
475
+ request = operations_pb2.GetOperationRequest(**request)
476
+
477
+ # Wrap the RPC method; this adds retry and timeout information,
478
+ # and friendly error handling.
479
+ rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
480
+
481
+ # Certain fields should be provided within the metadata header;
482
+ # add these here.
483
+ metadata = tuple(metadata) + (
484
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
485
+ )
486
+
487
+ # Validate the universe domain.
488
+ self._client._validate_universe_domain()
489
+
490
+ # Send the request.
491
+ response = await rpc(
492
+ request,
493
+ retry=retry,
494
+ timeout=timeout,
495
+ metadata=metadata,
496
+ )
497
+
498
+ # Done; return the response.
499
+ return response
500
+
501
+ async def delete_operation(
502
+ self,
503
+ request: Optional[operations_pb2.DeleteOperationRequest] = None,
504
+ *,
505
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
506
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
507
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
508
+ ) -> None:
509
+ r"""Deletes a long-running operation.
510
+
511
+ This method indicates that the client is no longer interested
512
+ in the operation result. It does not cancel the operation.
513
+ If the server doesn't support this method, it returns
514
+ `google.rpc.Code.UNIMPLEMENTED`.
515
+
516
+ Args:
517
+ request (:class:`~.operations_pb2.DeleteOperationRequest`):
518
+ The request object. Request message for
519
+ `DeleteOperation` method.
520
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
521
+ if any, should be retried.
522
+ timeout (float): The timeout for this request.
523
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
524
+ sent along with the request as metadata. Normally, each value must be of type `str`,
525
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
526
+ be of type `bytes`.
527
+ Returns:
528
+ None
529
+ """
530
+ # Create or coerce a protobuf request object.
531
+ # The request isn't a proto-plus wrapped type,
532
+ # so it must be constructed via keyword expansion.
533
+ if isinstance(request, dict):
534
+ request = operations_pb2.DeleteOperationRequest(**request)
535
+
536
+ # Wrap the RPC method; this adds retry and timeout information,
537
+ # and friendly error handling.
538
+ rpc = self.transport._wrapped_methods[self._client._transport.delete_operation]
539
+
540
+ # Certain fields should be provided within the metadata header;
541
+ # add these here.
542
+ metadata = tuple(metadata) + (
543
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
544
+ )
545
+
546
+ # Validate the universe domain.
547
+ self._client._validate_universe_domain()
548
+
549
+ # Send the request.
550
+ await rpc(
551
+ request,
552
+ retry=retry,
553
+ timeout=timeout,
554
+ metadata=metadata,
555
+ )
556
+
557
+ async def cancel_operation(
558
+ self,
559
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
560
+ *,
561
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
562
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
563
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
564
+ ) -> None:
565
+ r"""Starts asynchronous cancellation on a long-running operation.
566
+
567
+ The server makes a best effort to cancel the operation, but success
568
+ is not guaranteed. If the server doesn't support this method, it returns
569
+ `google.rpc.Code.UNIMPLEMENTED`.
570
+
571
+ Args:
572
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
573
+ The request object. Request message for
574
+ `CancelOperation` method.
575
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
576
+ if any, should be retried.
577
+ timeout (float): The timeout for this request.
578
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
579
+ sent along with the request as metadata. Normally, each value must be of type `str`,
580
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
581
+ be of type `bytes`.
582
+ Returns:
583
+ None
584
+ """
585
+ # Create or coerce a protobuf request object.
586
+ # The request isn't a proto-plus wrapped type,
587
+ # so it must be constructed via keyword expansion.
588
+ if isinstance(request, dict):
589
+ request = operations_pb2.CancelOperationRequest(**request)
590
+
591
+ # Wrap the RPC method; this adds retry and timeout information,
592
+ # and friendly error handling.
593
+ rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
594
+
595
+ # Certain fields should be provided within the metadata header;
596
+ # add these here.
597
+ metadata = tuple(metadata) + (
598
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
599
+ )
600
+
601
+ # Validate the universe domain.
602
+ self._client._validate_universe_domain()
603
+
604
+ # Send the request.
605
+ await rpc(
606
+ request,
607
+ retry=retry,
608
+ timeout=timeout,
609
+ metadata=metadata,
610
+ )
611
+
612
+ async def wait_operation(
613
+ self,
614
+ request: Optional[operations_pb2.WaitOperationRequest] = None,
615
+ *,
616
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
617
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
618
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
619
+ ) -> operations_pb2.Operation:
620
+ r"""Waits until the specified long-running operation is done or reaches at most
621
+ a specified timeout, returning the latest state.
622
+
623
+ If the operation is already done, the latest state is immediately returned.
624
+ If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
625
+ timeout is used. If the server does not support this method, it returns
626
+ `google.rpc.Code.UNIMPLEMENTED`.
627
+
628
+ Args:
629
+ request (:class:`~.operations_pb2.WaitOperationRequest`):
630
+ The request object. Request message for
631
+ `WaitOperation` method.
632
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
633
+ if any, should be retried.
634
+ timeout (float): The timeout for this request.
635
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
636
+ sent along with the request as metadata. Normally, each value must be of type `str`,
637
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
638
+ be of type `bytes`.
639
+ Returns:
640
+ ~.operations_pb2.Operation:
641
+ An ``Operation`` object.
642
+ """
643
+ # Create or coerce a protobuf request object.
644
+ # The request isn't a proto-plus wrapped type,
645
+ # so it must be constructed via keyword expansion.
646
+ if isinstance(request, dict):
647
+ request = operations_pb2.WaitOperationRequest(**request)
648
+
649
+ # Wrap the RPC method; this adds retry and timeout information,
650
+ # and friendly error handling.
651
+ rpc = self.transport._wrapped_methods[self._client._transport.wait_operation]
652
+
653
+ # Certain fields should be provided within the metadata header;
654
+ # add these here.
655
+ metadata = tuple(metadata) + (
656
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
657
+ )
658
+
659
+ # Validate the universe domain.
660
+ self._client._validate_universe_domain()
661
+
662
+ # Send the request.
663
+ response = await rpc(
664
+ request,
665
+ retry=retry,
666
+ timeout=timeout,
667
+ metadata=metadata,
668
+ )
669
+
670
+ # Done; return the response.
671
+ return response
672
+
673
+ async def set_iam_policy(
674
+ self,
675
+ request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
676
+ *,
677
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
678
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
679
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
680
+ ) -> policy_pb2.Policy:
681
+ r"""Sets the IAM access control policy on the specified function.
682
+
683
+ Replaces any existing policy.
684
+
685
+ Args:
686
+ request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`):
687
+ The request object. Request message for `SetIamPolicy`
688
+ method.
689
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
690
+ should be retried.
691
+ timeout (float): The timeout for this request.
692
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
693
+ sent along with the request as metadata. Normally, each value must be of type `str`,
694
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
695
+ be of type `bytes`.
696
+ Returns:
697
+ ~.policy_pb2.Policy:
698
+ Defines an Identity and Access Management (IAM) policy.
699
+ It is used to specify access control policies for Cloud
700
+ Platform resources.
701
+ A ``Policy`` is a collection of ``bindings``. A
702
+ ``binding`` binds one or more ``members`` to a single
703
+ ``role``. Members can be user accounts, service
704
+ accounts, Google groups, and domains (such as G Suite).
705
+ A ``role`` is a named list of permissions (defined by
706
+ IAM or configured by users). A ``binding`` can
707
+ optionally specify a ``condition``, which is a logic
708
+ expression that further constrains the role binding
709
+ based on attributes about the request and/or target
710
+ resource.
711
+
712
+ **JSON Example**
713
+
714
+ ::
715
+
716
+ {
717
+ "bindings": [
718
+ {
719
+ "role": "roles/resourcemanager.organizationAdmin",
720
+ "members": [
721
+ "user:mike@example.com",
722
+ "group:admins@example.com",
723
+ "domain:google.com",
724
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
725
+ ]
726
+ },
727
+ {
728
+ "role": "roles/resourcemanager.organizationViewer",
729
+ "members": ["user:eve@example.com"],
730
+ "condition": {
731
+ "title": "expirable access",
732
+ "description": "Does not grant access after Sep 2020",
733
+ "expression": "request.time <
734
+ timestamp('2020-10-01T00:00:00.000Z')",
735
+ }
736
+ }
737
+ ]
738
+ }
739
+
740
+ **YAML Example**
741
+
742
+ ::
743
+
744
+ bindings:
745
+ - members:
746
+ - user:mike@example.com
747
+ - group:admins@example.com
748
+ - domain:google.com
749
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
750
+ role: roles/resourcemanager.organizationAdmin
751
+ - members:
752
+ - user:eve@example.com
753
+ role: roles/resourcemanager.organizationViewer
754
+ condition:
755
+ title: expirable access
756
+ description: Does not grant access after Sep 2020
757
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
758
+
759
+ For a description of IAM and its features, see the `IAM
760
+ developer's
761
+ guide <https://cloud.google.com/iam/docs>`__.
762
+ """
763
+ # Create or coerce a protobuf request object.
764
+
765
+ # The request isn't a proto-plus wrapped type,
766
+ # so it must be constructed via keyword expansion.
767
+ if isinstance(request, dict):
768
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
769
+
770
+ # Wrap the RPC method; this adds retry and timeout information,
771
+ # and friendly error handling.
772
+ rpc = self.transport._wrapped_methods[self._client._transport.set_iam_policy]
773
+
774
+ # Certain fields should be provided within the metadata header;
775
+ # add these here.
776
+ metadata = tuple(metadata) + (
777
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
778
+ )
779
+
780
+ # Validate the universe domain.
781
+ self._client._validate_universe_domain()
782
+
783
+ # Send the request.
784
+ response = await rpc(
785
+ request,
786
+ retry=retry,
787
+ timeout=timeout,
788
+ metadata=metadata,
789
+ )
790
+
791
+ # Done; return the response.
792
+ return response
793
+
794
+ async def get_iam_policy(
795
+ self,
796
+ request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
797
+ *,
798
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
799
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
800
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
801
+ ) -> policy_pb2.Policy:
802
+ r"""Gets the IAM access control policy for a function.
803
+
804
+ Returns an empty policy if the function exists and does not have a
805
+ policy set.
806
+
807
+ Args:
808
+ request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
809
+ The request object. Request message for `GetIamPolicy`
810
+ method.
811
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if
812
+ any, should be retried.
813
+ timeout (float): The timeout for this request.
814
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
815
+ sent along with the request as metadata. Normally, each value must be of type `str`,
816
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
817
+ be of type `bytes`.
818
+ Returns:
819
+ ~.policy_pb2.Policy:
820
+ Defines an Identity and Access Management (IAM) policy.
821
+ It is used to specify access control policies for Cloud
822
+ Platform resources.
823
+ A ``Policy`` is a collection of ``bindings``. A
824
+ ``binding`` binds one or more ``members`` to a single
825
+ ``role``. Members can be user accounts, service
826
+ accounts, Google groups, and domains (such as G Suite).
827
+ A ``role`` is a named list of permissions (defined by
828
+ IAM or configured by users). A ``binding`` can
829
+ optionally specify a ``condition``, which is a logic
830
+ expression that further constrains the role binding
831
+ based on attributes about the request and/or target
832
+ resource.
833
+
834
+ **JSON Example**
835
+
836
+ ::
837
+
838
+ {
839
+ "bindings": [
840
+ {
841
+ "role": "roles/resourcemanager.organizationAdmin",
842
+ "members": [
843
+ "user:mike@example.com",
844
+ "group:admins@example.com",
845
+ "domain:google.com",
846
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
847
+ ]
848
+ },
849
+ {
850
+ "role": "roles/resourcemanager.organizationViewer",
851
+ "members": ["user:eve@example.com"],
852
+ "condition": {
853
+ "title": "expirable access",
854
+ "description": "Does not grant access after Sep 2020",
855
+ "expression": "request.time <
856
+ timestamp('2020-10-01T00:00:00.000Z')",
857
+ }
858
+ }
859
+ ]
860
+ }
861
+
862
+ **YAML Example**
863
+
864
+ ::
865
+
866
+ bindings:
867
+ - members:
868
+ - user:mike@example.com
869
+ - group:admins@example.com
870
+ - domain:google.com
871
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
872
+ role: roles/resourcemanager.organizationAdmin
873
+ - members:
874
+ - user:eve@example.com
875
+ role: roles/resourcemanager.organizationViewer
876
+ condition:
877
+ title: expirable access
878
+ description: Does not grant access after Sep 2020
879
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
880
+
881
+ For a description of IAM and its features, see the `IAM
882
+ developer's
883
+ guide <https://cloud.google.com/iam/docs>`__.
884
+ """
885
+ # Create or coerce a protobuf request object.
886
+
887
+ # The request isn't a proto-plus wrapped type,
888
+ # so it must be constructed via keyword expansion.
889
+ if isinstance(request, dict):
890
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
891
+
892
+ # Wrap the RPC method; this adds retry and timeout information,
893
+ # and friendly error handling.
894
+ rpc = self.transport._wrapped_methods[self._client._transport.get_iam_policy]
895
+
896
+ # Certain fields should be provided within the metadata header;
897
+ # add these here.
898
+ metadata = tuple(metadata) + (
899
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
900
+ )
901
+
902
+ # Validate the universe domain.
903
+ self._client._validate_universe_domain()
904
+
905
+ # Send the request.
906
+ response = await rpc(
907
+ request,
908
+ retry=retry,
909
+ timeout=timeout,
910
+ metadata=metadata,
911
+ )
912
+
913
+ # Done; return the response.
914
+ return response
915
+
916
+ async def test_iam_permissions(
917
+ self,
918
+ request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
919
+ *,
920
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
921
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
922
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
923
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
924
+ r"""Tests the specified IAM permissions against the IAM access control
925
+ policy for a function.
926
+
927
+ If the function does not exist, this will return an empty set
928
+ of permissions, not a NOT_FOUND error.
929
+
930
+ Args:
931
+ request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
932
+ The request object. Request message for
933
+ `TestIamPermissions` method.
934
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
935
+ if any, should be retried.
936
+ timeout (float): The timeout for this request.
937
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
938
+ sent along with the request as metadata. Normally, each value must be of type `str`,
939
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
940
+ be of type `bytes`.
941
+ Returns:
942
+ ~.iam_policy_pb2.TestIamPermissionsResponse:
943
+ Response message for ``TestIamPermissions`` method.
944
+ """
945
+ # Create or coerce a protobuf request object.
946
+
947
+ # The request isn't a proto-plus wrapped type,
948
+ # so it must be constructed via keyword expansion.
949
+ if isinstance(request, dict):
950
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
951
+
952
+ # Wrap the RPC method; this adds retry and timeout information,
953
+ # and friendly error handling.
954
+ rpc = self.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_location(
979
+ self,
980
+ request: Optional[locations_pb2.GetLocationRequest] = 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
+ ) -> locations_pb2.Location:
986
+ r"""Gets information about a location.
987
+
988
+ Args:
989
+ request (:class:`~.location_pb2.GetLocationRequest`):
990
+ The request object. Request message for
991
+ `GetLocation` 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
+ ~.location_pb2.Location:
1001
+ Location 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 isinstance(request, dict):
1007
+ request = locations_pb2.GetLocationRequest(**request)
1008
+
1009
+ # Wrap the RPC method; this adds retry and timeout information,
1010
+ # and friendly error handling.
1011
+ rpc = self.transport._wrapped_methods[self._client._transport.get_location]
1012
+
1013
+ # Certain fields should be provided within the metadata header;
1014
+ # add these here.
1015
+ metadata = tuple(metadata) + (
1016
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1017
+ )
1018
+
1019
+ # Validate the universe domain.
1020
+ self._client._validate_universe_domain()
1021
+
1022
+ # Send the request.
1023
+ response = await rpc(
1024
+ request,
1025
+ retry=retry,
1026
+ timeout=timeout,
1027
+ metadata=metadata,
1028
+ )
1029
+
1030
+ # Done; return the response.
1031
+ return response
1032
+
1033
+ async def list_locations(
1034
+ self,
1035
+ request: Optional[locations_pb2.ListLocationsRequest] = None,
1036
+ *,
1037
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1038
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1039
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1040
+ ) -> locations_pb2.ListLocationsResponse:
1041
+ r"""Lists information about the supported locations for this service.
1042
+
1043
+ Args:
1044
+ request (:class:`~.location_pb2.ListLocationsRequest`):
1045
+ The request object. Request message for
1046
+ `ListLocations` method.
1047
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors,
1048
+ if any, should be retried.
1049
+ timeout (float): The timeout for this request.
1050
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1051
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1052
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1053
+ be of type `bytes`.
1054
+ Returns:
1055
+ ~.location_pb2.ListLocationsResponse:
1056
+ Response message for ``ListLocations`` method.
1057
+ """
1058
+ # Create or coerce a protobuf request object.
1059
+ # The request isn't a proto-plus wrapped type,
1060
+ # so it must be constructed via keyword expansion.
1061
+ if isinstance(request, dict):
1062
+ request = locations_pb2.ListLocationsRequest(**request)
1063
+
1064
+ # Wrap the RPC method; this adds retry and timeout information,
1065
+ # and friendly error handling.
1066
+ rpc = self.transport._wrapped_methods[self._client._transport.list_locations]
1067
+
1068
+ # Certain fields should be provided within the metadata header;
1069
+ # add these here.
1070
+ metadata = tuple(metadata) + (
1071
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1072
+ )
1073
+
1074
+ # Validate the universe domain.
1075
+ self._client._validate_universe_domain()
1076
+
1077
+ # Send the request.
1078
+ response = await rpc(
1079
+ request,
1080
+ retry=retry,
1081
+ timeout=timeout,
1082
+ metadata=metadata,
1083
+ )
1084
+
1085
+ # Done; return the response.
1086
+ return response
1087
+
1088
+ async def __aenter__(self) -> "EvaluationServiceAsyncClient":
1089
+ return self
1090
+
1091
+ async def __aexit__(self, exc_type, exc, tb):
1092
+ await self.transport.close()
1093
+
1094
+
1095
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1096
+ gapic_version=package_version.__version__
1097
+ )
1098
+
1099
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1100
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1101
+
1102
+
1103
+ __all__ = ("EvaluationServiceAsyncClient",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/client.py ADDED
@@ -0,0 +1,1591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 http import HTTPStatus
18
+ import json
19
+ import logging as std_logging
20
+ import os
21
+ import re
22
+ from typing import (
23
+ Dict,
24
+ Callable,
25
+ Mapping,
26
+ MutableMapping,
27
+ MutableSequence,
28
+ Optional,
29
+ Sequence,
30
+ Tuple,
31
+ Type,
32
+ Union,
33
+ cast,
34
+ )
35
+ import warnings
36
+
37
+ from google.cloud.aiplatform_v1 import gapic_version as package_version
38
+
39
+ from google.api_core import client_options as client_options_lib
40
+ from google.api_core import exceptions as core_exceptions
41
+ from google.api_core import gapic_v1
42
+ from google.api_core import retry as retries
43
+ from google.auth import credentials as ga_credentials # type: ignore
44
+ from google.auth.transport import mtls # type: ignore
45
+ from google.auth.transport.grpc import SslCredentials # type: ignore
46
+ from google.auth.exceptions import MutualTLSChannelError # type: ignore
47
+ from google.oauth2 import service_account # type: ignore
48
+ import google.protobuf
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
+ from google.cloud.aiplatform_v1.types import evaluation_service
65
+ from google.cloud.location import locations_pb2 # type: ignore
66
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
67
+ from google.iam.v1 import policy_pb2 # type: ignore
68
+ from google.longrunning import operations_pb2 # type: ignore
69
+ from .transports.base import EvaluationServiceTransport, DEFAULT_CLIENT_INFO
70
+ from .transports.grpc import EvaluationServiceGrpcTransport
71
+ from .transports.grpc_asyncio import EvaluationServiceGrpcAsyncIOTransport
72
+ from .transports.rest import EvaluationServiceRestTransport
73
+
74
+ try:
75
+ from .transports.rest_asyncio import AsyncEvaluationServiceRestTransport
76
+
77
+ HAS_ASYNC_REST_DEPENDENCIES = True
78
+ except ImportError as e: # pragma: NO COVER
79
+ HAS_ASYNC_REST_DEPENDENCIES = False
80
+ ASYNC_REST_EXCEPTION = e
81
+
82
+
83
+ class EvaluationServiceClientMeta(type):
84
+ """Metaclass for the EvaluationService client.
85
+
86
+ This provides class-level methods for building and retrieving
87
+ support objects (e.g. transport) without polluting the client instance
88
+ objects.
89
+ """
90
+
91
+ _transport_registry = (
92
+ OrderedDict()
93
+ ) # type: Dict[str, Type[EvaluationServiceTransport]]
94
+ _transport_registry["grpc"] = EvaluationServiceGrpcTransport
95
+ _transport_registry["grpc_asyncio"] = EvaluationServiceGrpcAsyncIOTransport
96
+ _transport_registry["rest"] = EvaluationServiceRestTransport
97
+ if HAS_ASYNC_REST_DEPENDENCIES: # pragma: NO COVER
98
+ _transport_registry["rest_asyncio"] = AsyncEvaluationServiceRestTransport
99
+
100
+ def get_transport_class(
101
+ cls,
102
+ label: Optional[str] = None,
103
+ ) -> Type[EvaluationServiceTransport]:
104
+ """Returns an appropriate transport class.
105
+
106
+ Args:
107
+ label: The name of the desired transport. If none is
108
+ provided, then the first transport in the registry is used.
109
+
110
+ Returns:
111
+ The transport class to use.
112
+ """
113
+ # If a specific transport is requested, return that one.
114
+ if (
115
+ label == "rest_asyncio" and not HAS_ASYNC_REST_DEPENDENCIES
116
+ ): # pragma: NO COVER
117
+ raise ASYNC_REST_EXCEPTION
118
+ if label:
119
+ return cls._transport_registry[label]
120
+
121
+ # No transport is requested; return the default (that is, the first one
122
+ # in the dictionary).
123
+ return next(iter(cls._transport_registry.values()))
124
+
125
+
126
+ class EvaluationServiceClient(metaclass=EvaluationServiceClientMeta):
127
+ """Vertex AI Online Evaluation Service."""
128
+
129
+ @staticmethod
130
+ def _get_default_mtls_endpoint(api_endpoint):
131
+ """Converts api endpoint to mTLS endpoint.
132
+
133
+ Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
134
+ "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
135
+ Args:
136
+ api_endpoint (Optional[str]): the api endpoint to convert.
137
+ Returns:
138
+ str: converted mTLS api endpoint.
139
+ """
140
+ if not api_endpoint:
141
+ return api_endpoint
142
+
143
+ mtls_endpoint_re = re.compile(
144
+ r"(?P<name>[^.]+)(?P<mtls>\.mtls)?(?P<sandbox>\.sandbox)?(?P<googledomain>\.googleapis\.com)?"
145
+ )
146
+
147
+ m = mtls_endpoint_re.match(api_endpoint)
148
+ name, mtls, sandbox, googledomain = m.groups()
149
+ if mtls or not googledomain:
150
+ return api_endpoint
151
+
152
+ if sandbox:
153
+ return api_endpoint.replace(
154
+ "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
155
+ )
156
+
157
+ return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
158
+
159
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
160
+ DEFAULT_ENDPOINT = "aiplatform.googleapis.com"
161
+ DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
162
+ DEFAULT_ENDPOINT
163
+ )
164
+
165
+ _DEFAULT_ENDPOINT_TEMPLATE = "aiplatform.{UNIVERSE_DOMAIN}"
166
+ _DEFAULT_UNIVERSE = "googleapis.com"
167
+
168
+ @staticmethod
169
+ def _use_client_cert_effective():
170
+ """Returns whether client certificate should be used for mTLS if the
171
+ google-auth version supports should_use_client_cert automatic mTLS enablement.
172
+
173
+ Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.
174
+
175
+ Returns:
176
+ bool: whether client certificate should be used for mTLS
177
+ Raises:
178
+ ValueError: (If using a version of google-auth without should_use_client_cert and
179
+ GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
180
+ """
181
+ # check if google-auth version supports should_use_client_cert for automatic mTLS enablement
182
+ if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER
183
+ return mtls.should_use_client_cert()
184
+ else: # pragma: NO COVER
185
+ # if unsupported, fallback to reading from env var
186
+ use_client_cert_str = os.getenv(
187
+ "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
188
+ ).lower()
189
+ if use_client_cert_str not in ("true", "false"):
190
+ raise ValueError(
191
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
192
+ " either `true` or `false`"
193
+ )
194
+ return use_client_cert_str == "true"
195
+
196
+ @classmethod
197
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
198
+ """Creates an instance of this client using the provided credentials
199
+ info.
200
+
201
+ Args:
202
+ info (dict): The service account private key info.
203
+ args: Additional arguments to pass to the constructor.
204
+ kwargs: Additional arguments to pass to the constructor.
205
+
206
+ Returns:
207
+ EvaluationServiceClient: The constructed client.
208
+ """
209
+ credentials = service_account.Credentials.from_service_account_info(info)
210
+ kwargs["credentials"] = credentials
211
+ return cls(*args, **kwargs)
212
+
213
+ @classmethod
214
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
215
+ """Creates an instance of this client using the provided credentials
216
+ file.
217
+
218
+ Args:
219
+ filename (str): The path to the service account private key json
220
+ file.
221
+ args: Additional arguments to pass to the constructor.
222
+ kwargs: Additional arguments to pass to the constructor.
223
+
224
+ Returns:
225
+ EvaluationServiceClient: The constructed client.
226
+ """
227
+ credentials = service_account.Credentials.from_service_account_file(filename)
228
+ kwargs["credentials"] = credentials
229
+ return cls(*args, **kwargs)
230
+
231
+ from_service_account_json = from_service_account_file
232
+
233
+ @property
234
+ def transport(self) -> EvaluationServiceTransport:
235
+ """Returns the transport used by the client instance.
236
+
237
+ Returns:
238
+ EvaluationServiceTransport: The transport used by the client
239
+ instance.
240
+ """
241
+ return self._transport
242
+
243
+ @staticmethod
244
+ def common_billing_account_path(
245
+ billing_account: str,
246
+ ) -> str:
247
+ """Returns a fully-qualified billing_account string."""
248
+ return "billingAccounts/{billing_account}".format(
249
+ billing_account=billing_account,
250
+ )
251
+
252
+ @staticmethod
253
+ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
254
+ """Parse a billing_account path into its component segments."""
255
+ m = re.match(r"^billingAccounts/(?P<billing_account>.+?)$", path)
256
+ return m.groupdict() if m else {}
257
+
258
+ @staticmethod
259
+ def common_folder_path(
260
+ folder: str,
261
+ ) -> str:
262
+ """Returns a fully-qualified folder string."""
263
+ return "folders/{folder}".format(
264
+ folder=folder,
265
+ )
266
+
267
+ @staticmethod
268
+ def parse_common_folder_path(path: str) -> Dict[str, str]:
269
+ """Parse a folder path into its component segments."""
270
+ m = re.match(r"^folders/(?P<folder>.+?)$", path)
271
+ return m.groupdict() if m else {}
272
+
273
+ @staticmethod
274
+ def common_organization_path(
275
+ organization: str,
276
+ ) -> str:
277
+ """Returns a fully-qualified organization string."""
278
+ return "organizations/{organization}".format(
279
+ organization=organization,
280
+ )
281
+
282
+ @staticmethod
283
+ def parse_common_organization_path(path: str) -> Dict[str, str]:
284
+ """Parse a organization path into its component segments."""
285
+ m = re.match(r"^organizations/(?P<organization>.+?)$", path)
286
+ return m.groupdict() if m else {}
287
+
288
+ @staticmethod
289
+ def common_project_path(
290
+ project: str,
291
+ ) -> str:
292
+ """Returns a fully-qualified project string."""
293
+ return "projects/{project}".format(
294
+ project=project,
295
+ )
296
+
297
+ @staticmethod
298
+ def parse_common_project_path(path: str) -> Dict[str, str]:
299
+ """Parse a project path into its component segments."""
300
+ m = re.match(r"^projects/(?P<project>.+?)$", path)
301
+ return m.groupdict() if m else {}
302
+
303
+ @staticmethod
304
+ def common_location_path(
305
+ project: str,
306
+ location: str,
307
+ ) -> str:
308
+ """Returns a fully-qualified location string."""
309
+ return "projects/{project}/locations/{location}".format(
310
+ project=project,
311
+ location=location,
312
+ )
313
+
314
+ @staticmethod
315
+ def parse_common_location_path(path: str) -> Dict[str, str]:
316
+ """Parse a location path into its component segments."""
317
+ m = re.match(r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path)
318
+ return m.groupdict() if m else {}
319
+
320
+ @classmethod
321
+ def get_mtls_endpoint_and_cert_source(
322
+ cls, client_options: Optional[client_options_lib.ClientOptions] = None
323
+ ):
324
+ """Deprecated. Return the API endpoint and client cert source for mutual TLS.
325
+
326
+ The client cert source is determined in the following order:
327
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
328
+ client cert source is None.
329
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
330
+ default client cert source exists, use the default one; otherwise the client cert
331
+ source is None.
332
+
333
+ The API endpoint is determined in the following order:
334
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
335
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
336
+ default mTLS endpoint; if the environment variable is "never", use the default API
337
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
338
+ use the default API endpoint.
339
+
340
+ More details can be found at https://google.aip.dev/auth/4114.
341
+
342
+ Args:
343
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
344
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
345
+ in this method.
346
+
347
+ Returns:
348
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
349
+ client cert source to use.
350
+
351
+ Raises:
352
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
353
+ """
354
+
355
+ warnings.warn(
356
+ "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.",
357
+ DeprecationWarning,
358
+ )
359
+ if client_options is None:
360
+ client_options = client_options_lib.ClientOptions()
361
+ use_client_cert = EvaluationServiceClient._use_client_cert_effective()
362
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
363
+ if use_mtls_endpoint not in ("auto", "never", "always"):
364
+ raise MutualTLSChannelError(
365
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
366
+ )
367
+
368
+ # Figure out the client cert source to use.
369
+ client_cert_source = None
370
+ if use_client_cert:
371
+ if client_options.client_cert_source:
372
+ client_cert_source = client_options.client_cert_source
373
+ elif mtls.has_default_client_cert_source():
374
+ client_cert_source = mtls.default_client_cert_source()
375
+
376
+ # Figure out which api endpoint to use.
377
+ if client_options.api_endpoint is not None:
378
+ api_endpoint = client_options.api_endpoint
379
+ elif use_mtls_endpoint == "always" or (
380
+ use_mtls_endpoint == "auto" and client_cert_source
381
+ ):
382
+ api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
383
+ else:
384
+ api_endpoint = cls.DEFAULT_ENDPOINT
385
+
386
+ return api_endpoint, client_cert_source
387
+
388
+ @staticmethod
389
+ def _read_environment_variables():
390
+ """Returns the environment variables used by the client.
391
+
392
+ Returns:
393
+ Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
394
+ GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.
395
+
396
+ Raises:
397
+ ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
398
+ any of ["true", "false"].
399
+ google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
400
+ is not any of ["auto", "never", "always"].
401
+ """
402
+ use_client_cert = EvaluationServiceClient._use_client_cert_effective()
403
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
404
+ universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
405
+ if use_mtls_endpoint not in ("auto", "never", "always"):
406
+ raise MutualTLSChannelError(
407
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
408
+ )
409
+ return use_client_cert, use_mtls_endpoint, universe_domain_env
410
+
411
+ @staticmethod
412
+ def _get_client_cert_source(provided_cert_source, use_cert_flag):
413
+ """Return the client cert source to be used by the client.
414
+
415
+ Args:
416
+ provided_cert_source (bytes): The client certificate source provided.
417
+ use_cert_flag (bool): A flag indicating whether to use the client certificate.
418
+
419
+ Returns:
420
+ bytes or None: The client cert source to be used by the client.
421
+ """
422
+ client_cert_source = None
423
+ if use_cert_flag:
424
+ if provided_cert_source:
425
+ client_cert_source = provided_cert_source
426
+ elif mtls.has_default_client_cert_source():
427
+ client_cert_source = mtls.default_client_cert_source()
428
+ return client_cert_source
429
+
430
+ @staticmethod
431
+ def _get_api_endpoint(
432
+ api_override, client_cert_source, universe_domain, use_mtls_endpoint
433
+ ):
434
+ """Return the API endpoint used by the client.
435
+
436
+ Args:
437
+ api_override (str): The API endpoint override. If specified, this is always
438
+ the return value of this function and the other arguments are not used.
439
+ client_cert_source (bytes): The client certificate source used by the client.
440
+ universe_domain (str): The universe domain used by the client.
441
+ use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
442
+ Possible values are "always", "auto", or "never".
443
+
444
+ Returns:
445
+ str: The API endpoint to be used by the client.
446
+ """
447
+ if api_override is not None:
448
+ api_endpoint = api_override
449
+ elif use_mtls_endpoint == "always" or (
450
+ use_mtls_endpoint == "auto" and client_cert_source
451
+ ):
452
+ _default_universe = EvaluationServiceClient._DEFAULT_UNIVERSE
453
+ if universe_domain != _default_universe:
454
+ raise MutualTLSChannelError(
455
+ f"mTLS is not supported in any universe other than {_default_universe}."
456
+ )
457
+ api_endpoint = EvaluationServiceClient.DEFAULT_MTLS_ENDPOINT
458
+ else:
459
+ api_endpoint = EvaluationServiceClient._DEFAULT_ENDPOINT_TEMPLATE.format(
460
+ UNIVERSE_DOMAIN=universe_domain
461
+ )
462
+ return api_endpoint
463
+
464
+ @staticmethod
465
+ def _get_universe_domain(
466
+ client_universe_domain: Optional[str], universe_domain_env: Optional[str]
467
+ ) -> str:
468
+ """Return the universe domain used by the client.
469
+
470
+ Args:
471
+ client_universe_domain (Optional[str]): The universe domain configured via the client options.
472
+ universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
473
+
474
+ Returns:
475
+ str: The universe domain to be used by the client.
476
+
477
+ Raises:
478
+ ValueError: If the universe domain is an empty string.
479
+ """
480
+ universe_domain = EvaluationServiceClient._DEFAULT_UNIVERSE
481
+ if client_universe_domain is not None:
482
+ universe_domain = client_universe_domain
483
+ elif universe_domain_env is not None:
484
+ universe_domain = universe_domain_env
485
+ if len(universe_domain.strip()) == 0:
486
+ raise ValueError("Universe Domain cannot be an empty string.")
487
+ return universe_domain
488
+
489
+ def _validate_universe_domain(self):
490
+ """Validates client's and credentials' universe domains are consistent.
491
+
492
+ Returns:
493
+ bool: True iff the configured universe domain is valid.
494
+
495
+ Raises:
496
+ ValueError: If the configured universe domain is not valid.
497
+ """
498
+
499
+ # NOTE (b/349488459): universe validation is disabled until further notice.
500
+ return True
501
+
502
+ def _add_cred_info_for_auth_errors(
503
+ self, error: core_exceptions.GoogleAPICallError
504
+ ) -> None:
505
+ """Adds credential info string to error details for 401/403/404 errors.
506
+
507
+ Args:
508
+ error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
509
+ """
510
+ if error.code not in [
511
+ HTTPStatus.UNAUTHORIZED,
512
+ HTTPStatus.FORBIDDEN,
513
+ HTTPStatus.NOT_FOUND,
514
+ ]:
515
+ return
516
+
517
+ cred = self._transport._credentials
518
+
519
+ # get_cred_info is only available in google-auth>=2.35.0
520
+ if not hasattr(cred, "get_cred_info"):
521
+ return
522
+
523
+ # ignore the type check since pypy test fails when get_cred_info
524
+ # is not available
525
+ cred_info = cred.get_cred_info() # type: ignore
526
+ if cred_info and hasattr(error._details, "append"):
527
+ error._details.append(json.dumps(cred_info))
528
+
529
+ @property
530
+ def api_endpoint(self):
531
+ """Return the API endpoint used by the client instance.
532
+
533
+ Returns:
534
+ str: The API endpoint used by the client instance.
535
+ """
536
+ return self._api_endpoint
537
+
538
+ @property
539
+ def universe_domain(self) -> str:
540
+ """Return the universe domain used by the client instance.
541
+
542
+ Returns:
543
+ str: The universe domain used by the client instance.
544
+ """
545
+ return self._universe_domain
546
+
547
+ def __init__(
548
+ self,
549
+ *,
550
+ credentials: Optional[ga_credentials.Credentials] = None,
551
+ transport: Optional[
552
+ Union[
553
+ str,
554
+ EvaluationServiceTransport,
555
+ Callable[..., EvaluationServiceTransport],
556
+ ]
557
+ ] = None,
558
+ client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
559
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
560
+ ) -> None:
561
+ """Instantiates the evaluation service client.
562
+
563
+ Args:
564
+ credentials (Optional[google.auth.credentials.Credentials]): The
565
+ authorization credentials to attach to requests. These
566
+ credentials identify the application to the service; if none
567
+ are specified, the client will attempt to ascertain the
568
+ credentials from the environment.
569
+ transport (Optional[Union[str,EvaluationServiceTransport,Callable[..., EvaluationServiceTransport]]]):
570
+ The transport to use, or a Callable that constructs and returns a new transport.
571
+ If a Callable is given, it will be called with the same set of initialization
572
+ arguments as used in the EvaluationServiceTransport constructor.
573
+ If set to None, a transport is chosen automatically.
574
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
575
+ Custom options for the client.
576
+
577
+ 1. The ``api_endpoint`` property can be used to override the
578
+ default endpoint provided by the client when ``transport`` is
579
+ not explicitly provided. Only if this property is not set and
580
+ ``transport`` was not explicitly provided, the endpoint is
581
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
582
+ variable, which have one of the following values:
583
+ "always" (always use the default mTLS endpoint), "never" (always
584
+ use the default regular endpoint) and "auto" (auto-switch to the
585
+ default mTLS endpoint if client certificate is present; this is
586
+ the default value).
587
+
588
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
589
+ is "true", then the ``client_cert_source`` property can be used
590
+ to provide a client certificate for mTLS transport. If
591
+ not provided, the default SSL client certificate will be used if
592
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
593
+ set, no client certificate will be used.
594
+
595
+ 3. The ``universe_domain`` property can be used to override the
596
+ default "googleapis.com" universe. Note that the ``api_endpoint``
597
+ property still takes precedence; and ``universe_domain`` is
598
+ currently not supported for mTLS.
599
+
600
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
601
+ The client info used to send a user-agent string along with
602
+ API requests. If ``None``, then default info will be used.
603
+ Generally, you only need to set this if you're developing
604
+ your own client library.
605
+
606
+ Raises:
607
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
608
+ creation failed for any reason.
609
+ """
610
+ self._client_options = client_options
611
+ if isinstance(self._client_options, dict):
612
+ self._client_options = client_options_lib.from_dict(self._client_options)
613
+ if self._client_options is None:
614
+ self._client_options = client_options_lib.ClientOptions()
615
+ self._client_options = cast(
616
+ client_options_lib.ClientOptions, self._client_options
617
+ )
618
+
619
+ universe_domain_opt = getattr(self._client_options, "universe_domain", None)
620
+
621
+ self._use_client_cert, self._use_mtls_endpoint, self._universe_domain_env = (
622
+ EvaluationServiceClient._read_environment_variables()
623
+ )
624
+ self._client_cert_source = EvaluationServiceClient._get_client_cert_source(
625
+ self._client_options.client_cert_source, self._use_client_cert
626
+ )
627
+ self._universe_domain = EvaluationServiceClient._get_universe_domain(
628
+ universe_domain_opt, self._universe_domain_env
629
+ )
630
+ self._api_endpoint = None # updated below, depending on `transport`
631
+
632
+ # Initialize the universe domain validation.
633
+ self._is_universe_domain_valid = False
634
+
635
+ if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER
636
+ # Setup logging.
637
+ client_logging.initialize_logging()
638
+
639
+ api_key_value = getattr(self._client_options, "api_key", None)
640
+ if api_key_value and credentials:
641
+ raise ValueError(
642
+ "client_options.api_key and credentials are mutually exclusive"
643
+ )
644
+
645
+ # Save or instantiate the transport.
646
+ # Ordinarily, we provide the transport, but allowing a custom transport
647
+ # instance provides an extensibility point for unusual situations.
648
+ transport_provided = isinstance(transport, EvaluationServiceTransport)
649
+ if transport_provided:
650
+ # transport is a EvaluationServiceTransport instance.
651
+ if credentials or self._client_options.credentials_file or api_key_value:
652
+ raise ValueError(
653
+ "When providing a transport instance, "
654
+ "provide its credentials directly."
655
+ )
656
+ if self._client_options.scopes:
657
+ raise ValueError(
658
+ "When providing a transport instance, provide its scopes "
659
+ "directly."
660
+ )
661
+ self._transport = cast(EvaluationServiceTransport, transport)
662
+ self._api_endpoint = self._transport.host
663
+
664
+ self._api_endpoint = (
665
+ self._api_endpoint
666
+ or EvaluationServiceClient._get_api_endpoint(
667
+ self._client_options.api_endpoint,
668
+ self._client_cert_source,
669
+ self._universe_domain,
670
+ self._use_mtls_endpoint,
671
+ )
672
+ )
673
+
674
+ if not transport_provided:
675
+ transport_init: Union[
676
+ Type[EvaluationServiceTransport],
677
+ Callable[..., EvaluationServiceTransport],
678
+ ] = (
679
+ EvaluationServiceClient.get_transport_class(transport)
680
+ if isinstance(transport, str) or transport is None
681
+ else cast(Callable[..., EvaluationServiceTransport], transport)
682
+ )
683
+
684
+ if "rest_asyncio" in str(transport_init):
685
+ unsupported_params = {
686
+ "google.api_core.client_options.ClientOptions.credentials_file": self._client_options.credentials_file,
687
+ "google.api_core.client_options.ClientOptions.scopes": self._client_options.scopes,
688
+ "google.api_core.client_options.ClientOptions.quota_project_id": self._client_options.quota_project_id,
689
+ "google.api_core.client_options.ClientOptions.client_cert_source": self._client_options.client_cert_source,
690
+ "google.api_core.client_options.ClientOptions.api_audience": self._client_options.api_audience,
691
+ }
692
+ provided_unsupported_params = [
693
+ name
694
+ for name, value in unsupported_params.items()
695
+ if value is not None
696
+ ]
697
+ if provided_unsupported_params:
698
+ raise core_exceptions.AsyncRestUnsupportedParameterError( # type: ignore
699
+ f"The following provided parameters are not supported for `transport=rest_asyncio`: {', '.join(provided_unsupported_params)}"
700
+ )
701
+ self._transport = transport_init(
702
+ credentials=credentials,
703
+ host=self._api_endpoint,
704
+ client_info=client_info,
705
+ )
706
+ return
707
+
708
+ import google.auth._default # type: ignore
709
+
710
+ if api_key_value and hasattr(
711
+ google.auth._default, "get_api_key_credentials"
712
+ ):
713
+ credentials = google.auth._default.get_api_key_credentials(
714
+ api_key_value
715
+ )
716
+
717
+ # initialize with the provided callable or the passed in class
718
+ self._transport = transport_init(
719
+ credentials=credentials,
720
+ credentials_file=self._client_options.credentials_file,
721
+ host=self._api_endpoint,
722
+ scopes=self._client_options.scopes,
723
+ client_cert_source_for_mtls=self._client_cert_source,
724
+ quota_project_id=self._client_options.quota_project_id,
725
+ client_info=client_info,
726
+ always_use_jwt_access=True,
727
+ api_audience=self._client_options.api_audience,
728
+ )
729
+
730
+ if "async" not in str(self._transport):
731
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
732
+ std_logging.DEBUG
733
+ ): # pragma: NO COVER
734
+ _LOGGER.debug(
735
+ "Created client `google.cloud.aiplatform_v1.EvaluationServiceClient`.",
736
+ extra=(
737
+ {
738
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
739
+ "universeDomain": getattr(
740
+ self._transport._credentials, "universe_domain", ""
741
+ ),
742
+ "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
743
+ "credentialsInfo": getattr(
744
+ self.transport._credentials,
745
+ "get_cred_info",
746
+ lambda: None,
747
+ )(),
748
+ }
749
+ if hasattr(self._transport, "_credentials")
750
+ else {
751
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
752
+ "credentialsType": None,
753
+ }
754
+ ),
755
+ )
756
+
757
+ def evaluate_instances(
758
+ self,
759
+ request: Optional[
760
+ Union[evaluation_service.EvaluateInstancesRequest, dict]
761
+ ] = None,
762
+ *,
763
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
764
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
765
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
766
+ ) -> evaluation_service.EvaluateInstancesResponse:
767
+ r"""Evaluates instances based on a given metric.
768
+
769
+ .. code-block:: python
770
+
771
+ # This snippet has been automatically generated and should be regarded as a
772
+ # code template only.
773
+ # It will require modifications to work:
774
+ # - It may require correct/in-range values for request initialization.
775
+ # - It may require specifying regional endpoints when creating the service
776
+ # client as shown in:
777
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
778
+ from google.cloud import aiplatform_v1
779
+
780
+ def sample_evaluate_instances():
781
+ # Create a client
782
+ client = aiplatform_v1.EvaluationServiceClient()
783
+
784
+ # Initialize request argument(s)
785
+ request = aiplatform_v1.EvaluateInstancesRequest(
786
+ location="location_value",
787
+ )
788
+
789
+ # Make the request
790
+ response = client.evaluate_instances(request=request)
791
+
792
+ # Handle the response
793
+ print(response)
794
+
795
+ Args:
796
+ request (Union[google.cloud.aiplatform_v1.types.EvaluateInstancesRequest, dict]):
797
+ The request object. Request message for
798
+ EvaluationService.EvaluateInstances.
799
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
800
+ should be retried.
801
+ timeout (float): The timeout for this request.
802
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
803
+ sent along with the request as metadata. Normally, each value must be of type `str`,
804
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
805
+ be of type `bytes`.
806
+
807
+ Returns:
808
+ google.cloud.aiplatform_v1.types.EvaluateInstancesResponse:
809
+ Response message for
810
+ EvaluationService.EvaluateInstances.
811
+
812
+ """
813
+ # Create or coerce a protobuf request object.
814
+ # - Use the request object if provided (there's no risk of modifying the input as
815
+ # there are no flattened fields), or create one.
816
+ if not isinstance(request, evaluation_service.EvaluateInstancesRequest):
817
+ request = evaluation_service.EvaluateInstancesRequest(request)
818
+
819
+ # Wrap the RPC method; this adds retry and timeout information,
820
+ # and friendly error handling.
821
+ rpc = self._transport._wrapped_methods[self._transport.evaluate_instances]
822
+
823
+ # Certain fields should be provided within the metadata header;
824
+ # add these here.
825
+ metadata = tuple(metadata) + (
826
+ gapic_v1.routing_header.to_grpc_metadata((("location", request.location),)),
827
+ )
828
+
829
+ # Validate the universe domain.
830
+ self._validate_universe_domain()
831
+
832
+ # Send the request.
833
+ response = rpc(
834
+ request,
835
+ retry=retry,
836
+ timeout=timeout,
837
+ metadata=metadata,
838
+ )
839
+
840
+ # Done; return the response.
841
+ return response
842
+
843
+ def __enter__(self) -> "EvaluationServiceClient":
844
+ return self
845
+
846
+ def __exit__(self, type, value, traceback):
847
+ """Releases underlying transport's resources.
848
+
849
+ .. warning::
850
+ ONLY use as a context manager if the transport is NOT shared
851
+ with other clients! Exiting the with block will CLOSE the transport
852
+ and may cause errors in other clients!
853
+ """
854
+ self.transport.close()
855
+
856
+ def list_operations(
857
+ self,
858
+ request: Optional[operations_pb2.ListOperationsRequest] = None,
859
+ *,
860
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
861
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
862
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
863
+ ) -> operations_pb2.ListOperationsResponse:
864
+ r"""Lists operations that match the specified filter in the request.
865
+
866
+ Args:
867
+ request (:class:`~.operations_pb2.ListOperationsRequest`):
868
+ The request object. Request message for
869
+ `ListOperations` method.
870
+ retry (google.api_core.retry.Retry): Designation of what errors,
871
+ if any, should be retried.
872
+ timeout (float): The timeout for this request.
873
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
874
+ sent along with the request as metadata. Normally, each value must be of type `str`,
875
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
876
+ be of type `bytes`.
877
+ Returns:
878
+ ~.operations_pb2.ListOperationsResponse:
879
+ Response message for ``ListOperations`` method.
880
+ """
881
+ # Create or coerce a protobuf request object.
882
+ # The request isn't a proto-plus wrapped type,
883
+ # so it must be constructed via keyword expansion.
884
+ if isinstance(request, dict):
885
+ request = operations_pb2.ListOperationsRequest(**request)
886
+
887
+ # Wrap the RPC method; this adds retry and timeout information,
888
+ # and friendly error handling.
889
+ rpc = self._transport._wrapped_methods[self._transport.list_operations]
890
+
891
+ # Certain fields should be provided within the metadata header;
892
+ # add these here.
893
+ metadata = tuple(metadata) + (
894
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
895
+ )
896
+
897
+ # Validate the universe domain.
898
+ self._validate_universe_domain()
899
+
900
+ try:
901
+ # Send the request.
902
+ response = rpc(
903
+ request,
904
+ retry=retry,
905
+ timeout=timeout,
906
+ metadata=metadata,
907
+ )
908
+
909
+ # Done; return the response.
910
+ return response
911
+ except core_exceptions.GoogleAPICallError as e:
912
+ self._add_cred_info_for_auth_errors(e)
913
+ raise e
914
+
915
+ def get_operation(
916
+ self,
917
+ request: Optional[operations_pb2.GetOperationRequest] = None,
918
+ *,
919
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
920
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
921
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
922
+ ) -> operations_pb2.Operation:
923
+ r"""Gets the latest state of a long-running operation.
924
+
925
+ Args:
926
+ request (:class:`~.operations_pb2.GetOperationRequest`):
927
+ The request object. Request message for
928
+ `GetOperation` method.
929
+ retry (google.api_core.retry.Retry): Designation of what errors,
930
+ if any, should be retried.
931
+ timeout (float): The timeout for this request.
932
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
933
+ sent along with the request as metadata. Normally, each value must be of type `str`,
934
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
935
+ be of type `bytes`.
936
+ Returns:
937
+ ~.operations_pb2.Operation:
938
+ An ``Operation`` object.
939
+ """
940
+ # Create or coerce a protobuf request object.
941
+ # The request isn't a proto-plus wrapped type,
942
+ # so it must be constructed via keyword expansion.
943
+ if isinstance(request, dict):
944
+ request = operations_pb2.GetOperationRequest(**request)
945
+
946
+ # Wrap the RPC method; this adds retry and timeout information,
947
+ # and friendly error handling.
948
+ rpc = self._transport._wrapped_methods[self._transport.get_operation]
949
+
950
+ # Certain fields should be provided within the metadata header;
951
+ # add these here.
952
+ metadata = tuple(metadata) + (
953
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
954
+ )
955
+
956
+ # Validate the universe domain.
957
+ self._validate_universe_domain()
958
+
959
+ try:
960
+ # Send the request.
961
+ response = rpc(
962
+ request,
963
+ retry=retry,
964
+ timeout=timeout,
965
+ metadata=metadata,
966
+ )
967
+
968
+ # Done; return the response.
969
+ return response
970
+ except core_exceptions.GoogleAPICallError as e:
971
+ self._add_cred_info_for_auth_errors(e)
972
+ raise e
973
+
974
+ def delete_operation(
975
+ self,
976
+ request: Optional[operations_pb2.DeleteOperationRequest] = None,
977
+ *,
978
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
979
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
980
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
981
+ ) -> None:
982
+ r"""Deletes a long-running operation.
983
+
984
+ This method indicates that the client is no longer interested
985
+ in the operation result. It does not cancel the operation.
986
+ If the server doesn't support this method, it returns
987
+ `google.rpc.Code.UNIMPLEMENTED`.
988
+
989
+ Args:
990
+ request (:class:`~.operations_pb2.DeleteOperationRequest`):
991
+ The request object. Request message for
992
+ `DeleteOperation` method.
993
+ retry (google.api_core.retry.Retry): Designation of what errors,
994
+ if any, should be retried.
995
+ timeout (float): The timeout for this request.
996
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
997
+ sent along with the request as metadata. Normally, each value must be of type `str`,
998
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
999
+ be of type `bytes`.
1000
+ Returns:
1001
+ None
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 isinstance(request, dict):
1007
+ request = operations_pb2.DeleteOperationRequest(**request)
1008
+
1009
+ # Wrap the RPC method; this adds retry and timeout information,
1010
+ # and friendly error handling.
1011
+ rpc = self._transport._wrapped_methods[self._transport.delete_operation]
1012
+
1013
+ # Certain fields should be provided within the metadata header;
1014
+ # add these here.
1015
+ metadata = tuple(metadata) + (
1016
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1017
+ )
1018
+
1019
+ # Validate the universe domain.
1020
+ self._validate_universe_domain()
1021
+
1022
+ # Send the request.
1023
+ rpc(
1024
+ request,
1025
+ retry=retry,
1026
+ timeout=timeout,
1027
+ metadata=metadata,
1028
+ )
1029
+
1030
+ def cancel_operation(
1031
+ self,
1032
+ request: Optional[operations_pb2.CancelOperationRequest] = None,
1033
+ *,
1034
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1035
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1036
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1037
+ ) -> None:
1038
+ r"""Starts asynchronous cancellation on a long-running operation.
1039
+
1040
+ The server makes a best effort to cancel the operation, but success
1041
+ is not guaranteed. If the server doesn't support this method, it returns
1042
+ `google.rpc.Code.UNIMPLEMENTED`.
1043
+
1044
+ Args:
1045
+ request (:class:`~.operations_pb2.CancelOperationRequest`):
1046
+ The request object. Request message for
1047
+ `CancelOperation` method.
1048
+ retry (google.api_core.retry.Retry): Designation of what errors,
1049
+ if any, should be retried.
1050
+ timeout (float): The timeout for this request.
1051
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1052
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1053
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1054
+ be of type `bytes`.
1055
+ Returns:
1056
+ None
1057
+ """
1058
+ # Create or coerce a protobuf request object.
1059
+ # The request isn't a proto-plus wrapped type,
1060
+ # so it must be constructed via keyword expansion.
1061
+ if isinstance(request, dict):
1062
+ request = operations_pb2.CancelOperationRequest(**request)
1063
+
1064
+ # Wrap the RPC method; this adds retry and timeout information,
1065
+ # and friendly error handling.
1066
+ rpc = self._transport._wrapped_methods[self._transport.cancel_operation]
1067
+
1068
+ # Certain fields should be provided within the metadata header;
1069
+ # add these here.
1070
+ metadata = tuple(metadata) + (
1071
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1072
+ )
1073
+
1074
+ # Validate the universe domain.
1075
+ self._validate_universe_domain()
1076
+
1077
+ # Send the request.
1078
+ rpc(
1079
+ request,
1080
+ retry=retry,
1081
+ timeout=timeout,
1082
+ metadata=metadata,
1083
+ )
1084
+
1085
+ def wait_operation(
1086
+ self,
1087
+ request: Optional[operations_pb2.WaitOperationRequest] = None,
1088
+ *,
1089
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1090
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1091
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1092
+ ) -> operations_pb2.Operation:
1093
+ r"""Waits until the specified long-running operation is done or reaches at most
1094
+ a specified timeout, returning the latest state.
1095
+
1096
+ If the operation is already done, the latest state is immediately returned.
1097
+ If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
1098
+ timeout is used. If the server does not support this method, it returns
1099
+ `google.rpc.Code.UNIMPLEMENTED`.
1100
+
1101
+ Args:
1102
+ request (:class:`~.operations_pb2.WaitOperationRequest`):
1103
+ The request object. Request message for
1104
+ `WaitOperation` method.
1105
+ retry (google.api_core.retry.Retry): Designation of what errors,
1106
+ if any, should be retried.
1107
+ timeout (float): The timeout for this request.
1108
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1109
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1110
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1111
+ be of type `bytes`.
1112
+ Returns:
1113
+ ~.operations_pb2.Operation:
1114
+ An ``Operation`` object.
1115
+ """
1116
+ # Create or coerce a protobuf request object.
1117
+ # The request isn't a proto-plus wrapped type,
1118
+ # so it must be constructed via keyword expansion.
1119
+ if isinstance(request, dict):
1120
+ request = operations_pb2.WaitOperationRequest(**request)
1121
+
1122
+ # Wrap the RPC method; this adds retry and timeout information,
1123
+ # and friendly error handling.
1124
+ rpc = self._transport._wrapped_methods[self._transport.wait_operation]
1125
+
1126
+ # Certain fields should be provided within the metadata header;
1127
+ # add these here.
1128
+ metadata = tuple(metadata) + (
1129
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1130
+ )
1131
+
1132
+ # Validate the universe domain.
1133
+ self._validate_universe_domain()
1134
+
1135
+ try:
1136
+ # Send the request.
1137
+ response = rpc(
1138
+ request,
1139
+ retry=retry,
1140
+ timeout=timeout,
1141
+ metadata=metadata,
1142
+ )
1143
+
1144
+ # Done; return the response.
1145
+ return response
1146
+ except core_exceptions.GoogleAPICallError as e:
1147
+ self._add_cred_info_for_auth_errors(e)
1148
+ raise e
1149
+
1150
+ def set_iam_policy(
1151
+ self,
1152
+ request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
1153
+ *,
1154
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1155
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1156
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1157
+ ) -> policy_pb2.Policy:
1158
+ r"""Sets the IAM access control policy on the specified function.
1159
+
1160
+ Replaces any existing policy.
1161
+
1162
+ Args:
1163
+ request (:class:`~.iam_policy_pb2.SetIamPolicyRequest`):
1164
+ The request object. Request message for `SetIamPolicy`
1165
+ method.
1166
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1167
+ should be retried.
1168
+ timeout (float): The timeout for this request.
1169
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1170
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1171
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1172
+ be of type `bytes`.
1173
+ Returns:
1174
+ ~.policy_pb2.Policy:
1175
+ Defines an Identity and Access Management (IAM) policy.
1176
+ It is used to specify access control policies for Cloud
1177
+ Platform resources.
1178
+ A ``Policy`` is a collection of ``bindings``. A
1179
+ ``binding`` binds one or more ``members`` to a single
1180
+ ``role``. Members can be user accounts, service
1181
+ accounts, Google groups, and domains (such as G Suite).
1182
+ A ``role`` is a named list of permissions (defined by
1183
+ IAM or configured by users). A ``binding`` can
1184
+ optionally specify a ``condition``, which is a logic
1185
+ expression that further constrains the role binding
1186
+ based on attributes about the request and/or target
1187
+ resource.
1188
+
1189
+ **JSON Example**
1190
+
1191
+ ::
1192
+
1193
+ {
1194
+ "bindings": [
1195
+ {
1196
+ "role": "roles/resourcemanager.organizationAdmin",
1197
+ "members": [
1198
+ "user:mike@example.com",
1199
+ "group:admins@example.com",
1200
+ "domain:google.com",
1201
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
1202
+ ]
1203
+ },
1204
+ {
1205
+ "role": "roles/resourcemanager.organizationViewer",
1206
+ "members": ["user:eve@example.com"],
1207
+ "condition": {
1208
+ "title": "expirable access",
1209
+ "description": "Does not grant access after Sep 2020",
1210
+ "expression": "request.time <
1211
+ timestamp('2020-10-01T00:00:00.000Z')",
1212
+ }
1213
+ }
1214
+ ]
1215
+ }
1216
+
1217
+ **YAML Example**
1218
+
1219
+ ::
1220
+
1221
+ bindings:
1222
+ - members:
1223
+ - user:mike@example.com
1224
+ - group:admins@example.com
1225
+ - domain:google.com
1226
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
1227
+ role: roles/resourcemanager.organizationAdmin
1228
+ - members:
1229
+ - user:eve@example.com
1230
+ role: roles/resourcemanager.organizationViewer
1231
+ condition:
1232
+ title: expirable access
1233
+ description: Does not grant access after Sep 2020
1234
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
1235
+
1236
+ For a description of IAM and its features, see the `IAM
1237
+ developer's
1238
+ guide <https://cloud.google.com/iam/docs>`__.
1239
+ """
1240
+ # Create or coerce a protobuf request object.
1241
+
1242
+ # The request isn't a proto-plus wrapped type,
1243
+ # so it must be constructed via keyword expansion.
1244
+ if isinstance(request, dict):
1245
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
1246
+
1247
+ # Wrap the RPC method; this adds retry and timeout information,
1248
+ # and friendly error handling.
1249
+ rpc = self._transport._wrapped_methods[self._transport.set_iam_policy]
1250
+
1251
+ # Certain fields should be provided within the metadata header;
1252
+ # add these here.
1253
+ metadata = tuple(metadata) + (
1254
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1255
+ )
1256
+
1257
+ # Validate the universe domain.
1258
+ self._validate_universe_domain()
1259
+
1260
+ try:
1261
+ # Send the request.
1262
+ response = rpc(
1263
+ request,
1264
+ retry=retry,
1265
+ timeout=timeout,
1266
+ metadata=metadata,
1267
+ )
1268
+
1269
+ # Done; return the response.
1270
+ return response
1271
+ except core_exceptions.GoogleAPICallError as e:
1272
+ self._add_cred_info_for_auth_errors(e)
1273
+ raise e
1274
+
1275
+ def get_iam_policy(
1276
+ self,
1277
+ request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None,
1278
+ *,
1279
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1280
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1281
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1282
+ ) -> policy_pb2.Policy:
1283
+ r"""Gets the IAM access control policy for a function.
1284
+
1285
+ Returns an empty policy if the function exists and does not have a
1286
+ policy set.
1287
+
1288
+ Args:
1289
+ request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
1290
+ The request object. Request message for `GetIamPolicy`
1291
+ method.
1292
+ retry (google.api_core.retry.Retry): Designation of what errors, if
1293
+ any, should be retried.
1294
+ timeout (float): The timeout for this request.
1295
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1296
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1297
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1298
+ be of type `bytes`.
1299
+ Returns:
1300
+ ~.policy_pb2.Policy:
1301
+ Defines an Identity and Access Management (IAM) policy.
1302
+ It is used to specify access control policies for Cloud
1303
+ Platform resources.
1304
+ A ``Policy`` is a collection of ``bindings``. A
1305
+ ``binding`` binds one or more ``members`` to a single
1306
+ ``role``. Members can be user accounts, service
1307
+ accounts, Google groups, and domains (such as G Suite).
1308
+ A ``role`` is a named list of permissions (defined by
1309
+ IAM or configured by users). A ``binding`` can
1310
+ optionally specify a ``condition``, which is a logic
1311
+ expression that further constrains the role binding
1312
+ based on attributes about the request and/or target
1313
+ resource.
1314
+
1315
+ **JSON Example**
1316
+
1317
+ ::
1318
+
1319
+ {
1320
+ "bindings": [
1321
+ {
1322
+ "role": "roles/resourcemanager.organizationAdmin",
1323
+ "members": [
1324
+ "user:mike@example.com",
1325
+ "group:admins@example.com",
1326
+ "domain:google.com",
1327
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
1328
+ ]
1329
+ },
1330
+ {
1331
+ "role": "roles/resourcemanager.organizationViewer",
1332
+ "members": ["user:eve@example.com"],
1333
+ "condition": {
1334
+ "title": "expirable access",
1335
+ "description": "Does not grant access after Sep 2020",
1336
+ "expression": "request.time <
1337
+ timestamp('2020-10-01T00:00:00.000Z')",
1338
+ }
1339
+ }
1340
+ ]
1341
+ }
1342
+
1343
+ **YAML Example**
1344
+
1345
+ ::
1346
+
1347
+ bindings:
1348
+ - members:
1349
+ - user:mike@example.com
1350
+ - group:admins@example.com
1351
+ - domain:google.com
1352
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
1353
+ role: roles/resourcemanager.organizationAdmin
1354
+ - members:
1355
+ - user:eve@example.com
1356
+ role: roles/resourcemanager.organizationViewer
1357
+ condition:
1358
+ title: expirable access
1359
+ description: Does not grant access after Sep 2020
1360
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
1361
+
1362
+ For a description of IAM and its features, see the `IAM
1363
+ developer's
1364
+ guide <https://cloud.google.com/iam/docs>`__.
1365
+ """
1366
+ # Create or coerce a protobuf request object.
1367
+
1368
+ # The request isn't a proto-plus wrapped type,
1369
+ # so it must be constructed via keyword expansion.
1370
+ if isinstance(request, dict):
1371
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
1372
+
1373
+ # Wrap the RPC method; this adds retry and timeout information,
1374
+ # and friendly error handling.
1375
+ rpc = self._transport._wrapped_methods[self._transport.get_iam_policy]
1376
+
1377
+ # Certain fields should be provided within the metadata header;
1378
+ # add these here.
1379
+ metadata = tuple(metadata) + (
1380
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1381
+ )
1382
+
1383
+ # Validate the universe domain.
1384
+ self._validate_universe_domain()
1385
+
1386
+ try:
1387
+ # Send the request.
1388
+ response = rpc(
1389
+ request,
1390
+ retry=retry,
1391
+ timeout=timeout,
1392
+ metadata=metadata,
1393
+ )
1394
+
1395
+ # Done; return the response.
1396
+ return response
1397
+ except core_exceptions.GoogleAPICallError as e:
1398
+ self._add_cred_info_for_auth_errors(e)
1399
+ raise e
1400
+
1401
+ def test_iam_permissions(
1402
+ self,
1403
+ request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None,
1404
+ *,
1405
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1406
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1407
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1408
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1409
+ r"""Tests the specified IAM permissions against the IAM access control
1410
+ policy for a function.
1411
+
1412
+ If the function does not exist, this will return an empty set
1413
+ of permissions, not a NOT_FOUND error.
1414
+
1415
+ Args:
1416
+ request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
1417
+ The request object. Request message for
1418
+ `TestIamPermissions` method.
1419
+ retry (google.api_core.retry.Retry): Designation of what errors,
1420
+ if any, should be retried.
1421
+ timeout (float): The timeout for this request.
1422
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1423
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1424
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1425
+ be of type `bytes`.
1426
+ Returns:
1427
+ ~.iam_policy_pb2.TestIamPermissionsResponse:
1428
+ Response message for ``TestIamPermissions`` method.
1429
+ """
1430
+ # Create or coerce a protobuf request object.
1431
+
1432
+ # The request isn't a proto-plus wrapped type,
1433
+ # so it must be constructed via keyword expansion.
1434
+ if isinstance(request, dict):
1435
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
1436
+
1437
+ # Wrap the RPC method; this adds retry and timeout information,
1438
+ # and friendly error handling.
1439
+ rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions]
1440
+
1441
+ # Certain fields should be provided within the metadata header;
1442
+ # add these here.
1443
+ metadata = tuple(metadata) + (
1444
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
1445
+ )
1446
+
1447
+ # Validate the universe domain.
1448
+ self._validate_universe_domain()
1449
+
1450
+ try:
1451
+ # Send the request.
1452
+ response = rpc(
1453
+ request,
1454
+ retry=retry,
1455
+ timeout=timeout,
1456
+ metadata=metadata,
1457
+ )
1458
+
1459
+ # Done; return the response.
1460
+ return response
1461
+ except core_exceptions.GoogleAPICallError as e:
1462
+ self._add_cred_info_for_auth_errors(e)
1463
+ raise e
1464
+
1465
+ def get_location(
1466
+ self,
1467
+ request: Optional[locations_pb2.GetLocationRequest] = None,
1468
+ *,
1469
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1470
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1471
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1472
+ ) -> locations_pb2.Location:
1473
+ r"""Gets information about a location.
1474
+
1475
+ Args:
1476
+ request (:class:`~.location_pb2.GetLocationRequest`):
1477
+ The request object. Request message for
1478
+ `GetLocation` method.
1479
+ retry (google.api_core.retry.Retry): Designation of what errors,
1480
+ if any, should be retried.
1481
+ timeout (float): The timeout for this request.
1482
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1483
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1484
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1485
+ be of type `bytes`.
1486
+ Returns:
1487
+ ~.location_pb2.Location:
1488
+ Location object.
1489
+ """
1490
+ # Create or coerce a protobuf request object.
1491
+ # The request isn't a proto-plus wrapped type,
1492
+ # so it must be constructed via keyword expansion.
1493
+ if isinstance(request, dict):
1494
+ request = locations_pb2.GetLocationRequest(**request)
1495
+
1496
+ # Wrap the RPC method; this adds retry and timeout information,
1497
+ # and friendly error handling.
1498
+ rpc = self._transport._wrapped_methods[self._transport.get_location]
1499
+
1500
+ # Certain fields should be provided within the metadata header;
1501
+ # add these here.
1502
+ metadata = tuple(metadata) + (
1503
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1504
+ )
1505
+
1506
+ # Validate the universe domain.
1507
+ self._validate_universe_domain()
1508
+
1509
+ try:
1510
+ # Send the request.
1511
+ response = rpc(
1512
+ request,
1513
+ retry=retry,
1514
+ timeout=timeout,
1515
+ metadata=metadata,
1516
+ )
1517
+
1518
+ # Done; return the response.
1519
+ return response
1520
+ except core_exceptions.GoogleAPICallError as e:
1521
+ self._add_cred_info_for_auth_errors(e)
1522
+ raise e
1523
+
1524
+ def list_locations(
1525
+ self,
1526
+ request: Optional[locations_pb2.ListLocationsRequest] = None,
1527
+ *,
1528
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1529
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1530
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1531
+ ) -> locations_pb2.ListLocationsResponse:
1532
+ r"""Lists information about the supported locations for this service.
1533
+
1534
+ Args:
1535
+ request (:class:`~.location_pb2.ListLocationsRequest`):
1536
+ The request object. Request message for
1537
+ `ListLocations` method.
1538
+ retry (google.api_core.retry.Retry): Designation of what errors,
1539
+ if any, should be retried.
1540
+ timeout (float): The timeout for this request.
1541
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1542
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1543
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1544
+ be of type `bytes`.
1545
+ Returns:
1546
+ ~.location_pb2.ListLocationsResponse:
1547
+ Response message for ``ListLocations`` method.
1548
+ """
1549
+ # Create or coerce a protobuf request object.
1550
+ # The request isn't a proto-plus wrapped type,
1551
+ # so it must be constructed via keyword expansion.
1552
+ if isinstance(request, dict):
1553
+ request = locations_pb2.ListLocationsRequest(**request)
1554
+
1555
+ # Wrap the RPC method; this adds retry and timeout information,
1556
+ # and friendly error handling.
1557
+ rpc = self._transport._wrapped_methods[self._transport.list_locations]
1558
+
1559
+ # Certain fields should be provided within the metadata header;
1560
+ # add these here.
1561
+ metadata = tuple(metadata) + (
1562
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1563
+ )
1564
+
1565
+ # Validate the universe domain.
1566
+ self._validate_universe_domain()
1567
+
1568
+ try:
1569
+ # Send the request.
1570
+ response = rpc(
1571
+ request,
1572
+ retry=retry,
1573
+ timeout=timeout,
1574
+ metadata=metadata,
1575
+ )
1576
+
1577
+ # Done; return the response.
1578
+ return response
1579
+ except core_exceptions.GoogleAPICallError as e:
1580
+ self._add_cred_info_for_auth_errors(e)
1581
+ raise e
1582
+
1583
+
1584
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1585
+ gapic_version=package_version.__version__
1586
+ )
1587
+
1588
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
1589
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
1590
+
1591
+ __all__ = ("EvaluationServiceClient",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__init__.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, Tuple
18
+
19
+ from .base import EvaluationServiceTransport
20
+ from .grpc import EvaluationServiceGrpcTransport
21
+ from .grpc_asyncio import EvaluationServiceGrpcAsyncIOTransport
22
+ from .rest import EvaluationServiceRestTransport
23
+ from .rest import EvaluationServiceRestInterceptor
24
+
25
+ ASYNC_REST_CLASSES: Tuple[str, ...]
26
+ try:
27
+ from .rest_asyncio import AsyncEvaluationServiceRestTransport
28
+ from .rest_asyncio import AsyncEvaluationServiceRestInterceptor
29
+
30
+ ASYNC_REST_CLASSES = (
31
+ "AsyncEvaluationServiceRestTransport",
32
+ "AsyncEvaluationServiceRestInterceptor",
33
+ )
34
+ HAS_REST_ASYNC = True
35
+ except ImportError: # pragma: NO COVER
36
+ ASYNC_REST_CLASSES = ()
37
+ HAS_REST_ASYNC = False
38
+
39
+
40
+ # Compile a registry of transports.
41
+ _transport_registry = OrderedDict() # type: Dict[str, Type[EvaluationServiceTransport]]
42
+ _transport_registry["grpc"] = EvaluationServiceGrpcTransport
43
+ _transport_registry["grpc_asyncio"] = EvaluationServiceGrpcAsyncIOTransport
44
+ _transport_registry["rest"] = EvaluationServiceRestTransport
45
+ if HAS_REST_ASYNC: # pragma: NO COVER
46
+ _transport_registry["rest_asyncio"] = AsyncEvaluationServiceRestTransport
47
+
48
+ __all__ = (
49
+ "EvaluationServiceTransport",
50
+ "EvaluationServiceGrpcTransport",
51
+ "EvaluationServiceGrpcAsyncIOTransport",
52
+ "EvaluationServiceRestTransport",
53
+ "EvaluationServiceRestInterceptor",
54
+ ) + ASYNC_REST_CLASSES
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (1.46 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/base.cpython-311.pyc ADDED
Binary file (12.5 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/grpc.cpython-311.pyc ADDED
Binary file (25.1 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/grpc_asyncio.cpython-311.pyc ADDED
Binary file (27.9 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/rest.cpython-311.pyc ADDED
Binary file (77.5 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/rest_asyncio.cpython-311.pyc ADDED
Binary file (84.9 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/__pycache__/rest_base.cpython-311.pyc ADDED
Binary file (70.9 kB). View file
 
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/base.py ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from google.cloud.aiplatform_v1 import gapic_version as package_version
20
+
21
+ import google.auth # type: ignore
22
+ import google.api_core
23
+ from google.api_core import exceptions as core_exceptions
24
+ from google.api_core import gapic_v1
25
+ from google.api_core import retry as retries
26
+ from google.auth import credentials as ga_credentials # type: ignore
27
+ from google.oauth2 import service_account # type: ignore
28
+ import google.protobuf
29
+
30
+ from google.cloud.aiplatform_v1.types import evaluation_service
31
+ from google.cloud.location import locations_pb2 # type: ignore
32
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
33
+ from google.iam.v1 import policy_pb2 # type: ignore
34
+ from google.longrunning import operations_pb2 # type: ignore
35
+
36
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
37
+ gapic_version=package_version.__version__
38
+ )
39
+
40
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
41
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
42
+
43
+
44
+ class EvaluationServiceTransport(abc.ABC):
45
+ """Abstract transport class for EvaluationService."""
46
+
47
+ AUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",)
48
+
49
+ DEFAULT_HOST: str = "aiplatform.googleapis.com"
50
+
51
+ def __init__(
52
+ self,
53
+ *,
54
+ host: str = DEFAULT_HOST,
55
+ credentials: Optional[ga_credentials.Credentials] = None,
56
+ credentials_file: Optional[str] = None,
57
+ scopes: Optional[Sequence[str]] = None,
58
+ quota_project_id: Optional[str] = None,
59
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
60
+ always_use_jwt_access: Optional[bool] = False,
61
+ api_audience: Optional[str] = None,
62
+ **kwargs,
63
+ ) -> None:
64
+ """Instantiate the transport.
65
+
66
+ Args:
67
+ host (Optional[str]):
68
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
69
+ credentials (Optional[google.auth.credentials.Credentials]): The
70
+ authorization credentials to attach to requests. These
71
+ credentials identify the application to the service; if none
72
+ are specified, the client will attempt to ascertain the
73
+ credentials from the environment.
74
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
75
+ be loaded with :func:`google.auth.load_credentials_from_file`.
76
+ This argument is mutually exclusive with credentials. This argument will be
77
+ removed in the next major version of this library.
78
+ scopes (Optional[Sequence[str]]): A list of scopes.
79
+ quota_project_id (Optional[str]): An optional project to use for billing
80
+ and quota.
81
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
82
+ The client info used to send a user-agent string along with
83
+ API requests. If ``None``, then default info will be used.
84
+ Generally, you only need to set this if you're developing
85
+ your own client library.
86
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
87
+ be used for service account credentials.
88
+ """
89
+
90
+ # Save the scopes.
91
+ self._scopes = scopes
92
+ if not hasattr(self, "_ignore_credentials"):
93
+ self._ignore_credentials: bool = False
94
+
95
+ # If no credentials are provided, then determine the appropriate
96
+ # defaults.
97
+ if credentials and credentials_file:
98
+ raise core_exceptions.DuplicateCredentialArgs(
99
+ "'credentials_file' and 'credentials' are mutually exclusive"
100
+ )
101
+
102
+ if credentials_file is not None:
103
+ credentials, _ = google.auth.load_credentials_from_file(
104
+ credentials_file,
105
+ scopes=scopes,
106
+ quota_project_id=quota_project_id,
107
+ default_scopes=self.AUTH_SCOPES,
108
+ )
109
+ elif credentials is None and not self._ignore_credentials:
110
+ credentials, _ = google.auth.default(
111
+ scopes=scopes,
112
+ quota_project_id=quota_project_id,
113
+ default_scopes=self.AUTH_SCOPES,
114
+ )
115
+ # Don't apply audience if the credentials file passed from user.
116
+ if hasattr(credentials, "with_gdch_audience"):
117
+ credentials = credentials.with_gdch_audience(
118
+ api_audience if api_audience else host
119
+ )
120
+
121
+ # If the credentials are service account credentials, then always try to use self signed JWT.
122
+ if (
123
+ always_use_jwt_access
124
+ and isinstance(credentials, service_account.Credentials)
125
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
126
+ ):
127
+ credentials = credentials.with_always_use_jwt_access(True)
128
+
129
+ # Save the credentials.
130
+ self._credentials = credentials
131
+
132
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
133
+ if ":" not in host:
134
+ host += ":443"
135
+ self._host = host
136
+
137
+ @property
138
+ def host(self):
139
+ return self._host
140
+
141
+ def _prep_wrapped_messages(self, client_info):
142
+ # Precompute the wrapped methods.
143
+ self._wrapped_methods = {
144
+ self.evaluate_instances: gapic_v1.method.wrap_method(
145
+ self.evaluate_instances,
146
+ default_timeout=None,
147
+ client_info=client_info,
148
+ ),
149
+ self.get_location: gapic_v1.method.wrap_method(
150
+ self.get_location,
151
+ default_timeout=None,
152
+ client_info=client_info,
153
+ ),
154
+ self.list_locations: gapic_v1.method.wrap_method(
155
+ self.list_locations,
156
+ default_timeout=None,
157
+ client_info=client_info,
158
+ ),
159
+ self.get_iam_policy: gapic_v1.method.wrap_method(
160
+ self.get_iam_policy,
161
+ default_timeout=None,
162
+ client_info=client_info,
163
+ ),
164
+ self.set_iam_policy: gapic_v1.method.wrap_method(
165
+ self.set_iam_policy,
166
+ default_timeout=None,
167
+ client_info=client_info,
168
+ ),
169
+ self.test_iam_permissions: gapic_v1.method.wrap_method(
170
+ self.test_iam_permissions,
171
+ default_timeout=None,
172
+ client_info=client_info,
173
+ ),
174
+ self.cancel_operation: gapic_v1.method.wrap_method(
175
+ self.cancel_operation,
176
+ default_timeout=None,
177
+ client_info=client_info,
178
+ ),
179
+ self.delete_operation: gapic_v1.method.wrap_method(
180
+ self.delete_operation,
181
+ default_timeout=None,
182
+ client_info=client_info,
183
+ ),
184
+ self.get_operation: gapic_v1.method.wrap_method(
185
+ self.get_operation,
186
+ default_timeout=None,
187
+ client_info=client_info,
188
+ ),
189
+ self.list_operations: gapic_v1.method.wrap_method(
190
+ self.list_operations,
191
+ default_timeout=None,
192
+ client_info=client_info,
193
+ ),
194
+ self.wait_operation: gapic_v1.method.wrap_method(
195
+ self.wait_operation,
196
+ default_timeout=None,
197
+ client_info=client_info,
198
+ ),
199
+ }
200
+
201
+ def close(self):
202
+ """Closes resources associated with the transport.
203
+
204
+ .. warning::
205
+ Only call this method if the transport is NOT shared
206
+ with other clients - this may cause errors in other clients!
207
+ """
208
+ raise NotImplementedError()
209
+
210
+ @property
211
+ def evaluate_instances(
212
+ self,
213
+ ) -> Callable[
214
+ [evaluation_service.EvaluateInstancesRequest],
215
+ Union[
216
+ evaluation_service.EvaluateInstancesResponse,
217
+ Awaitable[evaluation_service.EvaluateInstancesResponse],
218
+ ],
219
+ ]:
220
+ raise NotImplementedError()
221
+
222
+ @property
223
+ def list_operations(
224
+ self,
225
+ ) -> Callable[
226
+ [operations_pb2.ListOperationsRequest],
227
+ Union[
228
+ operations_pb2.ListOperationsResponse,
229
+ Awaitable[operations_pb2.ListOperationsResponse],
230
+ ],
231
+ ]:
232
+ raise NotImplementedError()
233
+
234
+ @property
235
+ def get_operation(
236
+ self,
237
+ ) -> Callable[
238
+ [operations_pb2.GetOperationRequest],
239
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
240
+ ]:
241
+ raise NotImplementedError()
242
+
243
+ @property
244
+ def cancel_operation(
245
+ self,
246
+ ) -> Callable[
247
+ [operations_pb2.CancelOperationRequest],
248
+ None,
249
+ ]:
250
+ raise NotImplementedError()
251
+
252
+ @property
253
+ def delete_operation(
254
+ self,
255
+ ) -> Callable[
256
+ [operations_pb2.DeleteOperationRequest],
257
+ None,
258
+ ]:
259
+ raise NotImplementedError()
260
+
261
+ @property
262
+ def wait_operation(
263
+ self,
264
+ ) -> Callable[
265
+ [operations_pb2.WaitOperationRequest],
266
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
267
+ ]:
268
+ raise NotImplementedError()
269
+
270
+ @property
271
+ def set_iam_policy(
272
+ self,
273
+ ) -> Callable[
274
+ [iam_policy_pb2.SetIamPolicyRequest],
275
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
276
+ ]:
277
+ raise NotImplementedError()
278
+
279
+ @property
280
+ def get_iam_policy(
281
+ self,
282
+ ) -> Callable[
283
+ [iam_policy_pb2.GetIamPolicyRequest],
284
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
285
+ ]:
286
+ raise NotImplementedError()
287
+
288
+ @property
289
+ def test_iam_permissions(
290
+ self,
291
+ ) -> Callable[
292
+ [iam_policy_pb2.TestIamPermissionsRequest],
293
+ Union[
294
+ iam_policy_pb2.TestIamPermissionsResponse,
295
+ Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
296
+ ],
297
+ ]:
298
+ raise NotImplementedError()
299
+
300
+ @property
301
+ def get_location(
302
+ self,
303
+ ) -> Callable[
304
+ [locations_pb2.GetLocationRequest],
305
+ Union[locations_pb2.Location, Awaitable[locations_pb2.Location]],
306
+ ]:
307
+ raise NotImplementedError()
308
+
309
+ @property
310
+ def list_locations(
311
+ self,
312
+ ) -> Callable[
313
+ [locations_pb2.ListLocationsRequest],
314
+ Union[
315
+ locations_pb2.ListLocationsResponse,
316
+ Awaitable[locations_pb2.ListLocationsResponse],
317
+ ],
318
+ ]:
319
+ raise NotImplementedError()
320
+
321
+ @property
322
+ def kind(self) -> str:
323
+ raise NotImplementedError()
324
+
325
+
326
+ __all__ = ("EvaluationServiceTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc.py ADDED
@@ -0,0 +1,569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from google.api_core import grpc_helpers
23
+ from google.api_core import gapic_v1
24
+ import google.auth # type: ignore
25
+ from google.auth import credentials as ga_credentials # type: ignore
26
+ from google.auth.transport.grpc import SslCredentials # type: ignore
27
+ from google.protobuf.json_format import MessageToJson
28
+ import google.protobuf.message
29
+
30
+ import grpc # type: ignore
31
+ import proto # type: ignore
32
+
33
+ from google.cloud.aiplatform_v1.types import evaluation_service
34
+ from google.cloud.location import locations_pb2 # type: ignore
35
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
36
+ from google.iam.v1 import policy_pb2 # type: ignore
37
+ from google.longrunning import operations_pb2 # type: ignore
38
+ from .base import EvaluationServiceTransport, DEFAULT_CLIENT_INFO
39
+
40
+ try:
41
+ from google.api_core import client_logging # type: ignore
42
+
43
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
44
+ except ImportError: # pragma: NO COVER
45
+ CLIENT_LOGGING_SUPPORTED = False
46
+
47
+ _LOGGER = std_logging.getLogger(__name__)
48
+
49
+
50
+ class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
51
+ def intercept_unary_unary(self, continuation, client_call_details, request):
52
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
53
+ std_logging.DEBUG
54
+ )
55
+ if logging_enabled: # pragma: NO COVER
56
+ request_metadata = client_call_details.metadata
57
+ if isinstance(request, proto.Message):
58
+ request_payload = type(request).to_json(request)
59
+ elif isinstance(request, google.protobuf.message.Message):
60
+ request_payload = MessageToJson(request)
61
+ else:
62
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
63
+
64
+ request_metadata = {
65
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
66
+ for key, value in request_metadata
67
+ }
68
+ grpc_request = {
69
+ "payload": request_payload,
70
+ "requestMethod": "grpc",
71
+ "metadata": dict(request_metadata),
72
+ }
73
+ _LOGGER.debug(
74
+ f"Sending request for {client_call_details.method}",
75
+ extra={
76
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
77
+ "rpcName": str(client_call_details.method),
78
+ "request": grpc_request,
79
+ "metadata": grpc_request["metadata"],
80
+ },
81
+ )
82
+ response = continuation(client_call_details, request)
83
+ if logging_enabled: # pragma: NO COVER
84
+ response_metadata = response.trailing_metadata()
85
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
86
+ metadata = (
87
+ dict([(k, str(v)) for k, v in response_metadata])
88
+ if response_metadata
89
+ else None
90
+ )
91
+ result = response.result()
92
+ if isinstance(result, proto.Message):
93
+ response_payload = type(result).to_json(result)
94
+ elif isinstance(result, google.protobuf.message.Message):
95
+ response_payload = MessageToJson(result)
96
+ else:
97
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
98
+ grpc_response = {
99
+ "payload": response_payload,
100
+ "metadata": metadata,
101
+ "status": "OK",
102
+ }
103
+ _LOGGER.debug(
104
+ f"Received response for {client_call_details.method}.",
105
+ extra={
106
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
107
+ "rpcName": client_call_details.method,
108
+ "response": grpc_response,
109
+ "metadata": grpc_response["metadata"],
110
+ },
111
+ )
112
+ return response
113
+
114
+
115
+ class EvaluationServiceGrpcTransport(EvaluationServiceTransport):
116
+ """gRPC backend transport for EvaluationService.
117
+
118
+ Vertex AI Online Evaluation Service.
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 = "aiplatform.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: 'aiplatform.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
+
193
+ Raises:
194
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
195
+ creation failed for any reason.
196
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
197
+ and ``credentials_file`` are passed.
198
+ """
199
+ self._grpc_channel = None
200
+ self._ssl_channel_credentials = ssl_channel_credentials
201
+ self._stubs: Dict[str, Callable] = {}
202
+
203
+ if api_mtls_endpoint:
204
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
205
+ if client_cert_source:
206
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
207
+
208
+ if isinstance(channel, grpc.Channel):
209
+ # Ignore credentials if a channel was passed.
210
+ credentials = None
211
+ self._ignore_credentials = True
212
+ # If a channel was explicitly provided, set it.
213
+ self._grpc_channel = channel
214
+ self._ssl_channel_credentials = None
215
+
216
+ else:
217
+ if api_mtls_endpoint:
218
+ host = api_mtls_endpoint
219
+
220
+ # Create SSL credentials with client_cert_source or application
221
+ # default SSL credentials.
222
+ if client_cert_source:
223
+ cert, key = client_cert_source()
224
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
225
+ certificate_chain=cert, private_key=key
226
+ )
227
+ else:
228
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
229
+
230
+ else:
231
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
232
+ cert, key = client_cert_source_for_mtls()
233
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
234
+ certificate_chain=cert, private_key=key
235
+ )
236
+
237
+ # The base transport sets the host, credentials and scopes
238
+ super().__init__(
239
+ host=host,
240
+ credentials=credentials,
241
+ credentials_file=credentials_file,
242
+ scopes=scopes,
243
+ quota_project_id=quota_project_id,
244
+ client_info=client_info,
245
+ always_use_jwt_access=always_use_jwt_access,
246
+ api_audience=api_audience,
247
+ )
248
+
249
+ if not self._grpc_channel:
250
+ # initialize with the provided callable or the default channel
251
+ channel_init = channel or type(self).create_channel
252
+ self._grpc_channel = channel_init(
253
+ self._host,
254
+ # use the credentials which are saved
255
+ credentials=self._credentials,
256
+ # Set ``credentials_file`` to ``None`` here as
257
+ # the credentials that we saved earlier should be used.
258
+ credentials_file=None,
259
+ scopes=self._scopes,
260
+ ssl_credentials=self._ssl_channel_credentials,
261
+ quota_project_id=quota_project_id,
262
+ options=[
263
+ ("grpc.max_send_message_length", -1),
264
+ ("grpc.max_receive_message_length", -1),
265
+ ],
266
+ )
267
+
268
+ self._interceptor = _LoggingClientInterceptor()
269
+ self._logged_channel = grpc.intercept_channel(
270
+ self._grpc_channel, self._interceptor
271
+ )
272
+
273
+ # Wrap messages. This must be done after self._logged_channel exists
274
+ self._prep_wrapped_messages(client_info)
275
+
276
+ @classmethod
277
+ def create_channel(
278
+ cls,
279
+ host: str = "aiplatform.googleapis.com",
280
+ credentials: Optional[ga_credentials.Credentials] = None,
281
+ credentials_file: Optional[str] = None,
282
+ scopes: Optional[Sequence[str]] = None,
283
+ quota_project_id: Optional[str] = None,
284
+ **kwargs,
285
+ ) -> grpc.Channel:
286
+ """Create and return a gRPC channel object.
287
+ Args:
288
+ host (Optional[str]): The host for the channel to use.
289
+ credentials (Optional[~.Credentials]): The
290
+ authorization credentials to attach to requests. These
291
+ credentials identify this application to the service. If
292
+ none are specified, the client will attempt to ascertain
293
+ the credentials from the environment.
294
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
295
+ be loaded with :func:`google.auth.load_credentials_from_file`.
296
+ This argument is mutually exclusive with credentials. This argument will be
297
+ removed in the next major version of this library.
298
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
299
+ service. These are only used when credentials are not specified and
300
+ are passed to :func:`google.auth.default`.
301
+ quota_project_id (Optional[str]): An optional project to use for billing
302
+ and quota.
303
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
304
+ channel creation.
305
+ Returns:
306
+ grpc.Channel: A gRPC channel object.
307
+
308
+ Raises:
309
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
310
+ and ``credentials_file`` are passed.
311
+ """
312
+
313
+ return grpc_helpers.create_channel(
314
+ host,
315
+ credentials=credentials,
316
+ credentials_file=credentials_file,
317
+ quota_project_id=quota_project_id,
318
+ default_scopes=cls.AUTH_SCOPES,
319
+ scopes=scopes,
320
+ default_host=cls.DEFAULT_HOST,
321
+ **kwargs,
322
+ )
323
+
324
+ @property
325
+ def grpc_channel(self) -> grpc.Channel:
326
+ """Return the channel designed to connect to this service."""
327
+ return self._grpc_channel
328
+
329
+ @property
330
+ def evaluate_instances(
331
+ self,
332
+ ) -> Callable[
333
+ [evaluation_service.EvaluateInstancesRequest],
334
+ evaluation_service.EvaluateInstancesResponse,
335
+ ]:
336
+ r"""Return a callable for the evaluate instances method over gRPC.
337
+
338
+ Evaluates instances based on a given metric.
339
+
340
+ Returns:
341
+ Callable[[~.EvaluateInstancesRequest],
342
+ ~.EvaluateInstancesResponse]:
343
+ A function that, when called, will call the underlying RPC
344
+ on the server.
345
+ """
346
+ # Generate a "stub function" on-the-fly which will actually make
347
+ # the request.
348
+ # gRPC handles serialization and deserialization, so we just need
349
+ # to pass in the functions for each.
350
+ if "evaluate_instances" not in self._stubs:
351
+ self._stubs["evaluate_instances"] = self._logged_channel.unary_unary(
352
+ "/google.cloud.aiplatform.v1.EvaluationService/EvaluateInstances",
353
+ request_serializer=evaluation_service.EvaluateInstancesRequest.serialize,
354
+ response_deserializer=evaluation_service.EvaluateInstancesResponse.deserialize,
355
+ )
356
+ return self._stubs["evaluate_instances"]
357
+
358
+ def close(self):
359
+ self._logged_channel.close()
360
+
361
+ @property
362
+ def delete_operation(
363
+ self,
364
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
365
+ r"""Return a callable for the delete_operation method over gRPC."""
366
+ # Generate a "stub function" on-the-fly which will actually make
367
+ # the request.
368
+ # gRPC handles serialization and deserialization, so we just need
369
+ # to pass in the functions for each.
370
+ if "delete_operation" not in self._stubs:
371
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
372
+ "/google.longrunning.Operations/DeleteOperation",
373
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
374
+ response_deserializer=None,
375
+ )
376
+ return self._stubs["delete_operation"]
377
+
378
+ @property
379
+ def cancel_operation(
380
+ self,
381
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
382
+ r"""Return a callable for the cancel_operation method over gRPC."""
383
+ # Generate a "stub function" on-the-fly which will actually make
384
+ # the request.
385
+ # gRPC handles serialization and deserialization, so we just need
386
+ # to pass in the functions for each.
387
+ if "cancel_operation" not in self._stubs:
388
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
389
+ "/google.longrunning.Operations/CancelOperation",
390
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
391
+ response_deserializer=None,
392
+ )
393
+ return self._stubs["cancel_operation"]
394
+
395
+ @property
396
+ def wait_operation(
397
+ self,
398
+ ) -> Callable[[operations_pb2.WaitOperationRequest], None]:
399
+ r"""Return a callable for the wait_operation method over gRPC."""
400
+ # Generate a "stub function" on-the-fly which will actually make
401
+ # the request.
402
+ # gRPC handles serialization and deserialization, so we just need
403
+ # to pass in the functions for each.
404
+ if "wait_operation" not in self._stubs:
405
+ self._stubs["wait_operation"] = self._logged_channel.unary_unary(
406
+ "/google.longrunning.Operations/WaitOperation",
407
+ request_serializer=operations_pb2.WaitOperationRequest.SerializeToString,
408
+ response_deserializer=None,
409
+ )
410
+ return self._stubs["wait_operation"]
411
+
412
+ @property
413
+ def get_operation(
414
+ self,
415
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
416
+ r"""Return a callable for the get_operation method over gRPC."""
417
+ # Generate a "stub function" on-the-fly which will actually make
418
+ # the request.
419
+ # gRPC handles serialization and deserialization, so we just need
420
+ # to pass in the functions for each.
421
+ if "get_operation" not in self._stubs:
422
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
423
+ "/google.longrunning.Operations/GetOperation",
424
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
425
+ response_deserializer=operations_pb2.Operation.FromString,
426
+ )
427
+ return self._stubs["get_operation"]
428
+
429
+ @property
430
+ def list_operations(
431
+ self,
432
+ ) -> Callable[
433
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
434
+ ]:
435
+ r"""Return a callable for the list_operations method over gRPC."""
436
+ # Generate a "stub function" on-the-fly which will actually make
437
+ # the request.
438
+ # gRPC handles serialization and deserialization, so we just need
439
+ # to pass in the functions for each.
440
+ if "list_operations" not in self._stubs:
441
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
442
+ "/google.longrunning.Operations/ListOperations",
443
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
444
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
445
+ )
446
+ return self._stubs["list_operations"]
447
+
448
+ @property
449
+ def list_locations(
450
+ self,
451
+ ) -> Callable[
452
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
453
+ ]:
454
+ r"""Return a callable for the list locations method over gRPC."""
455
+ # Generate a "stub function" on-the-fly which will actually make
456
+ # the request.
457
+ # gRPC handles serialization and deserialization, so we just need
458
+ # to pass in the functions for each.
459
+ if "list_locations" not in self._stubs:
460
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
461
+ "/google.cloud.location.Locations/ListLocations",
462
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
463
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
464
+ )
465
+ return self._stubs["list_locations"]
466
+
467
+ @property
468
+ def get_location(
469
+ self,
470
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
471
+ r"""Return a callable for the list locations method over gRPC."""
472
+ # Generate a "stub function" on-the-fly which will actually make
473
+ # the request.
474
+ # gRPC handles serialization and deserialization, so we just need
475
+ # to pass in the functions for each.
476
+ if "get_location" not in self._stubs:
477
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
478
+ "/google.cloud.location.Locations/GetLocation",
479
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
480
+ response_deserializer=locations_pb2.Location.FromString,
481
+ )
482
+ return self._stubs["get_location"]
483
+
484
+ @property
485
+ def set_iam_policy(
486
+ self,
487
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
488
+ r"""Return a callable for the set iam policy method over gRPC.
489
+ Sets the IAM access control policy on the specified
490
+ function. Replaces any existing policy.
491
+ Returns:
492
+ Callable[[~.SetIamPolicyRequest],
493
+ ~.Policy]:
494
+ A function that, when called, will call the underlying RPC
495
+ on the server.
496
+ """
497
+ # Generate a "stub function" on-the-fly which will actually make
498
+ # the request.
499
+ # gRPC handles serialization and deserialization, so we just need
500
+ # to pass in the functions for each.
501
+ if "set_iam_policy" not in self._stubs:
502
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
503
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
504
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
505
+ response_deserializer=policy_pb2.Policy.FromString,
506
+ )
507
+ return self._stubs["set_iam_policy"]
508
+
509
+ @property
510
+ def get_iam_policy(
511
+ self,
512
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
513
+ r"""Return a callable for the get iam policy method over gRPC.
514
+ Gets the IAM access control policy for a function.
515
+ Returns an empty policy if the function exists and does
516
+ not have a policy set.
517
+ Returns:
518
+ Callable[[~.GetIamPolicyRequest],
519
+ ~.Policy]:
520
+ A function that, when called, will call the underlying RPC
521
+ on the server.
522
+ """
523
+ # Generate a "stub function" on-the-fly which will actually make
524
+ # the request.
525
+ # gRPC handles serialization and deserialization, so we just need
526
+ # to pass in the functions for each.
527
+ if "get_iam_policy" not in self._stubs:
528
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
529
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
530
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
531
+ response_deserializer=policy_pb2.Policy.FromString,
532
+ )
533
+ return self._stubs["get_iam_policy"]
534
+
535
+ @property
536
+ def test_iam_permissions(
537
+ self,
538
+ ) -> Callable[
539
+ [iam_policy_pb2.TestIamPermissionsRequest],
540
+ iam_policy_pb2.TestIamPermissionsResponse,
541
+ ]:
542
+ r"""Return a callable for the test iam permissions method over gRPC.
543
+ Tests the specified permissions against the IAM access control
544
+ policy for a function. If the function does not exist, this will
545
+ return an empty set of permissions, not a NOT_FOUND error.
546
+ Returns:
547
+ Callable[[~.TestIamPermissionsRequest],
548
+ ~.TestIamPermissionsResponse]:
549
+ A function that, when called, will call the underlying RPC
550
+ on the server.
551
+ """
552
+ # Generate a "stub function" on-the-fly which will actually make
553
+ # the request.
554
+ # gRPC handles serialization and deserialization, so we just need
555
+ # to pass in the functions for each.
556
+ if "test_iam_permissions" not in self._stubs:
557
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
558
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
559
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
560
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
561
+ )
562
+ return self._stubs["test_iam_permissions"]
563
+
564
+ @property
565
+ def kind(self) -> str:
566
+ return "grpc"
567
+
568
+
569
+ __all__ = ("EvaluationServiceGrpcTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc_asyncio.py ADDED
@@ -0,0 +1,642 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 pickle
19
+ import logging as std_logging
20
+ import warnings
21
+ from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
22
+
23
+ from google.api_core import gapic_v1
24
+ from google.api_core import grpc_helpers_async
25
+ from google.api_core import exceptions as core_exceptions
26
+ from google.api_core import retry_async as retries
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
+ import google.protobuf.message
31
+
32
+ import grpc # type: ignore
33
+ import proto # type: ignore
34
+ from grpc.experimental import aio # type: ignore
35
+
36
+ from google.cloud.aiplatform_v1.types import evaluation_service
37
+ from google.cloud.location import locations_pb2 # type: ignore
38
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
39
+ from google.iam.v1 import policy_pb2 # type: ignore
40
+ from google.longrunning import operations_pb2 # type: ignore
41
+ from .base import EvaluationServiceTransport, DEFAULT_CLIENT_INFO
42
+ from .grpc import EvaluationServiceGrpcTransport
43
+
44
+ try:
45
+ from google.api_core import client_logging # type: ignore
46
+
47
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
48
+ except ImportError: # pragma: NO COVER
49
+ CLIENT_LOGGING_SUPPORTED = False
50
+
51
+ _LOGGER = std_logging.getLogger(__name__)
52
+
53
+
54
+ class _LoggingClientAIOInterceptor(
55
+ grpc.aio.UnaryUnaryClientInterceptor
56
+ ): # pragma: NO COVER
57
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
58
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
59
+ std_logging.DEBUG
60
+ )
61
+ if logging_enabled: # pragma: NO COVER
62
+ request_metadata = client_call_details.metadata
63
+ if isinstance(request, proto.Message):
64
+ request_payload = type(request).to_json(request)
65
+ elif isinstance(request, google.protobuf.message.Message):
66
+ request_payload = MessageToJson(request)
67
+ else:
68
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
69
+
70
+ request_metadata = {
71
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
72
+ for key, value in request_metadata
73
+ }
74
+ grpc_request = {
75
+ "payload": request_payload,
76
+ "requestMethod": "grpc",
77
+ "metadata": dict(request_metadata),
78
+ }
79
+ _LOGGER.debug(
80
+ f"Sending request for {client_call_details.method}",
81
+ extra={
82
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
83
+ "rpcName": str(client_call_details.method),
84
+ "request": grpc_request,
85
+ "metadata": grpc_request["metadata"],
86
+ },
87
+ )
88
+ response = await continuation(client_call_details, request)
89
+ if logging_enabled: # pragma: NO COVER
90
+ response_metadata = await response.trailing_metadata()
91
+ # Convert gRPC metadata `<class 'grpc.aio._metadata.Metadata'>` to list of tuples
92
+ metadata = (
93
+ dict([(k, str(v)) for k, v in response_metadata])
94
+ if response_metadata
95
+ else None
96
+ )
97
+ result = await response
98
+ if isinstance(result, proto.Message):
99
+ response_payload = type(result).to_json(result)
100
+ elif isinstance(result, google.protobuf.message.Message):
101
+ response_payload = MessageToJson(result)
102
+ else:
103
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
104
+ grpc_response = {
105
+ "payload": response_payload,
106
+ "metadata": metadata,
107
+ "status": "OK",
108
+ }
109
+ _LOGGER.debug(
110
+ f"Received response to rpc {client_call_details.method}.",
111
+ extra={
112
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
113
+ "rpcName": str(client_call_details.method),
114
+ "response": grpc_response,
115
+ "metadata": grpc_response["metadata"],
116
+ },
117
+ )
118
+ return response
119
+
120
+
121
+ class EvaluationServiceGrpcAsyncIOTransport(EvaluationServiceTransport):
122
+ """gRPC AsyncIO backend transport for EvaluationService.
123
+
124
+ Vertex AI Online Evaluation Service.
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 = "aiplatform.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 = "aiplatform.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: 'aiplatform.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
+
244
+ Raises:
245
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
246
+ creation failed for any reason.
247
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
248
+ and ``credentials_file`` are passed.
249
+ """
250
+ self._grpc_channel = None
251
+ self._ssl_channel_credentials = ssl_channel_credentials
252
+ self._stubs: Dict[str, Callable] = {}
253
+
254
+ if api_mtls_endpoint:
255
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
256
+ if client_cert_source:
257
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
258
+
259
+ if isinstance(channel, aio.Channel):
260
+ # Ignore credentials if a channel was passed.
261
+ credentials = None
262
+ self._ignore_credentials = True
263
+ # If a channel was explicitly provided, set it.
264
+ self._grpc_channel = channel
265
+ self._ssl_channel_credentials = None
266
+ else:
267
+ if api_mtls_endpoint:
268
+ host = api_mtls_endpoint
269
+
270
+ # Create SSL credentials with client_cert_source or application
271
+ # default SSL credentials.
272
+ if client_cert_source:
273
+ cert, key = client_cert_source()
274
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
275
+ certificate_chain=cert, private_key=key
276
+ )
277
+ else:
278
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
279
+
280
+ else:
281
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
282
+ cert, key = client_cert_source_for_mtls()
283
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
284
+ certificate_chain=cert, private_key=key
285
+ )
286
+
287
+ # The base transport sets the host, credentials and scopes
288
+ super().__init__(
289
+ host=host,
290
+ credentials=credentials,
291
+ credentials_file=credentials_file,
292
+ scopes=scopes,
293
+ quota_project_id=quota_project_id,
294
+ client_info=client_info,
295
+ always_use_jwt_access=always_use_jwt_access,
296
+ api_audience=api_audience,
297
+ )
298
+
299
+ if not self._grpc_channel:
300
+ # initialize with the provided callable or the default channel
301
+ channel_init = channel or type(self).create_channel
302
+ self._grpc_channel = channel_init(
303
+ self._host,
304
+ # use the credentials which are saved
305
+ credentials=self._credentials,
306
+ # Set ``credentials_file`` to ``None`` here as
307
+ # the credentials that we saved earlier should be used.
308
+ credentials_file=None,
309
+ scopes=self._scopes,
310
+ ssl_credentials=self._ssl_channel_credentials,
311
+ quota_project_id=quota_project_id,
312
+ options=[
313
+ ("grpc.max_send_message_length", -1),
314
+ ("grpc.max_receive_message_length", -1),
315
+ ],
316
+ )
317
+
318
+ self._interceptor = _LoggingClientAIOInterceptor()
319
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
320
+ self._logged_channel = self._grpc_channel
321
+ self._wrap_with_kind = (
322
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
323
+ )
324
+ # Wrap messages. This must be done after self._logged_channel exists
325
+ self._prep_wrapped_messages(client_info)
326
+
327
+ @property
328
+ def grpc_channel(self) -> aio.Channel:
329
+ """Create the channel designed to connect to this service.
330
+
331
+ This property caches on the instance; repeated calls return
332
+ the same channel.
333
+ """
334
+ # Return the channel from cache.
335
+ return self._grpc_channel
336
+
337
+ @property
338
+ def evaluate_instances(
339
+ self,
340
+ ) -> Callable[
341
+ [evaluation_service.EvaluateInstancesRequest],
342
+ Awaitable[evaluation_service.EvaluateInstancesResponse],
343
+ ]:
344
+ r"""Return a callable for the evaluate instances method over gRPC.
345
+
346
+ Evaluates instances based on a given metric.
347
+
348
+ Returns:
349
+ Callable[[~.EvaluateInstancesRequest],
350
+ Awaitable[~.EvaluateInstancesResponse]]:
351
+ A function that, when called, will call the underlying RPC
352
+ on the server.
353
+ """
354
+ # Generate a "stub function" on-the-fly which will actually make
355
+ # the request.
356
+ # gRPC handles serialization and deserialization, so we just need
357
+ # to pass in the functions for each.
358
+ if "evaluate_instances" not in self._stubs:
359
+ self._stubs["evaluate_instances"] = self._logged_channel.unary_unary(
360
+ "/google.cloud.aiplatform.v1.EvaluationService/EvaluateInstances",
361
+ request_serializer=evaluation_service.EvaluateInstancesRequest.serialize,
362
+ response_deserializer=evaluation_service.EvaluateInstancesResponse.deserialize,
363
+ )
364
+ return self._stubs["evaluate_instances"]
365
+
366
+ def _prep_wrapped_messages(self, client_info):
367
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
368
+ self._wrapped_methods = {
369
+ self.evaluate_instances: self._wrap_method(
370
+ self.evaluate_instances,
371
+ default_timeout=None,
372
+ client_info=client_info,
373
+ ),
374
+ self.get_location: self._wrap_method(
375
+ self.get_location,
376
+ default_timeout=None,
377
+ client_info=client_info,
378
+ ),
379
+ self.list_locations: self._wrap_method(
380
+ self.list_locations,
381
+ default_timeout=None,
382
+ client_info=client_info,
383
+ ),
384
+ self.get_iam_policy: self._wrap_method(
385
+ self.get_iam_policy,
386
+ default_timeout=None,
387
+ client_info=client_info,
388
+ ),
389
+ self.set_iam_policy: self._wrap_method(
390
+ self.set_iam_policy,
391
+ default_timeout=None,
392
+ client_info=client_info,
393
+ ),
394
+ self.test_iam_permissions: self._wrap_method(
395
+ self.test_iam_permissions,
396
+ default_timeout=None,
397
+ client_info=client_info,
398
+ ),
399
+ self.cancel_operation: self._wrap_method(
400
+ self.cancel_operation,
401
+ default_timeout=None,
402
+ client_info=client_info,
403
+ ),
404
+ self.delete_operation: self._wrap_method(
405
+ self.delete_operation,
406
+ default_timeout=None,
407
+ client_info=client_info,
408
+ ),
409
+ self.get_operation: self._wrap_method(
410
+ self.get_operation,
411
+ default_timeout=None,
412
+ client_info=client_info,
413
+ ),
414
+ self.list_operations: self._wrap_method(
415
+ self.list_operations,
416
+ default_timeout=None,
417
+ client_info=client_info,
418
+ ),
419
+ self.wait_operation: self._wrap_method(
420
+ self.wait_operation,
421
+ default_timeout=None,
422
+ client_info=client_info,
423
+ ),
424
+ }
425
+
426
+ def _wrap_method(self, func, *args, **kwargs):
427
+ if self._wrap_with_kind: # pragma: NO COVER
428
+ kwargs["kind"] = self.kind
429
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
430
+
431
+ def close(self):
432
+ return self._logged_channel.close()
433
+
434
+ @property
435
+ def kind(self) -> str:
436
+ return "grpc_asyncio"
437
+
438
+ @property
439
+ def delete_operation(
440
+ self,
441
+ ) -> Callable[[operations_pb2.DeleteOperationRequest], None]:
442
+ r"""Return a callable for the delete_operation method over gRPC."""
443
+ # Generate a "stub function" on-the-fly which will actually make
444
+ # the request.
445
+ # gRPC handles serialization and deserialization, so we just need
446
+ # to pass in the functions for each.
447
+ if "delete_operation" not in self._stubs:
448
+ self._stubs["delete_operation"] = self._logged_channel.unary_unary(
449
+ "/google.longrunning.Operations/DeleteOperation",
450
+ request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString,
451
+ response_deserializer=None,
452
+ )
453
+ return self._stubs["delete_operation"]
454
+
455
+ @property
456
+ def cancel_operation(
457
+ self,
458
+ ) -> Callable[[operations_pb2.CancelOperationRequest], None]:
459
+ r"""Return a callable for the cancel_operation method over gRPC."""
460
+ # Generate a "stub function" on-the-fly which will actually make
461
+ # the request.
462
+ # gRPC handles serialization and deserialization, so we just need
463
+ # to pass in the functions for each.
464
+ if "cancel_operation" not in self._stubs:
465
+ self._stubs["cancel_operation"] = self._logged_channel.unary_unary(
466
+ "/google.longrunning.Operations/CancelOperation",
467
+ request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
468
+ response_deserializer=None,
469
+ )
470
+ return self._stubs["cancel_operation"]
471
+
472
+ @property
473
+ def wait_operation(
474
+ self,
475
+ ) -> Callable[[operations_pb2.WaitOperationRequest], None]:
476
+ r"""Return a callable for the wait_operation method over gRPC."""
477
+ # Generate a "stub function" on-the-fly which will actually make
478
+ # the request.
479
+ # gRPC handles serialization and deserialization, so we just need
480
+ # to pass in the functions for each.
481
+ if "wait_operation" not in self._stubs:
482
+ self._stubs["wait_operation"] = self._logged_channel.unary_unary(
483
+ "/google.longrunning.Operations/WaitOperation",
484
+ request_serializer=operations_pb2.WaitOperationRequest.SerializeToString,
485
+ response_deserializer=None,
486
+ )
487
+ return self._stubs["wait_operation"]
488
+
489
+ @property
490
+ def get_operation(
491
+ self,
492
+ ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
493
+ r"""Return a callable for the get_operation method over gRPC."""
494
+ # Generate a "stub function" on-the-fly which will actually make
495
+ # the request.
496
+ # gRPC handles serialization and deserialization, so we just need
497
+ # to pass in the functions for each.
498
+ if "get_operation" not in self._stubs:
499
+ self._stubs["get_operation"] = self._logged_channel.unary_unary(
500
+ "/google.longrunning.Operations/GetOperation",
501
+ request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
502
+ response_deserializer=operations_pb2.Operation.FromString,
503
+ )
504
+ return self._stubs["get_operation"]
505
+
506
+ @property
507
+ def list_operations(
508
+ self,
509
+ ) -> Callable[
510
+ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse
511
+ ]:
512
+ r"""Return a callable for the list_operations method over gRPC."""
513
+ # Generate a "stub function" on-the-fly which will actually make
514
+ # the request.
515
+ # gRPC handles serialization and deserialization, so we just need
516
+ # to pass in the functions for each.
517
+ if "list_operations" not in self._stubs:
518
+ self._stubs["list_operations"] = self._logged_channel.unary_unary(
519
+ "/google.longrunning.Operations/ListOperations",
520
+ request_serializer=operations_pb2.ListOperationsRequest.SerializeToString,
521
+ response_deserializer=operations_pb2.ListOperationsResponse.FromString,
522
+ )
523
+ return self._stubs["list_operations"]
524
+
525
+ @property
526
+ def list_locations(
527
+ self,
528
+ ) -> Callable[
529
+ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse
530
+ ]:
531
+ r"""Return a callable for the list locations method over gRPC."""
532
+ # Generate a "stub function" on-the-fly which will actually make
533
+ # the request.
534
+ # gRPC handles serialization and deserialization, so we just need
535
+ # to pass in the functions for each.
536
+ if "list_locations" not in self._stubs:
537
+ self._stubs["list_locations"] = self._logged_channel.unary_unary(
538
+ "/google.cloud.location.Locations/ListLocations",
539
+ request_serializer=locations_pb2.ListLocationsRequest.SerializeToString,
540
+ response_deserializer=locations_pb2.ListLocationsResponse.FromString,
541
+ )
542
+ return self._stubs["list_locations"]
543
+
544
+ @property
545
+ def get_location(
546
+ self,
547
+ ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]:
548
+ r"""Return a callable for the list locations method over gRPC."""
549
+ # Generate a "stub function" on-the-fly which will actually make
550
+ # the request.
551
+ # gRPC handles serialization and deserialization, so we just need
552
+ # to pass in the functions for each.
553
+ if "get_location" not in self._stubs:
554
+ self._stubs["get_location"] = self._logged_channel.unary_unary(
555
+ "/google.cloud.location.Locations/GetLocation",
556
+ request_serializer=locations_pb2.GetLocationRequest.SerializeToString,
557
+ response_deserializer=locations_pb2.Location.FromString,
558
+ )
559
+ return self._stubs["get_location"]
560
+
561
+ @property
562
+ def set_iam_policy(
563
+ self,
564
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
565
+ r"""Return a callable for the set iam policy method over gRPC.
566
+ Sets the IAM access control policy on the specified
567
+ function. Replaces any existing policy.
568
+ Returns:
569
+ Callable[[~.SetIamPolicyRequest],
570
+ ~.Policy]:
571
+ A function that, when called, will call the underlying RPC
572
+ on the server.
573
+ """
574
+ # Generate a "stub function" on-the-fly which will actually make
575
+ # the request.
576
+ # gRPC handles serialization and deserialization, so we just need
577
+ # to pass in the functions for each.
578
+ if "set_iam_policy" not in self._stubs:
579
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
580
+ "/google.iam.v1.IAMPolicy/SetIamPolicy",
581
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
582
+ response_deserializer=policy_pb2.Policy.FromString,
583
+ )
584
+ return self._stubs["set_iam_policy"]
585
+
586
+ @property
587
+ def get_iam_policy(
588
+ self,
589
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
590
+ r"""Return a callable for the get iam policy method over gRPC.
591
+ Gets the IAM access control policy for a function.
592
+ Returns an empty policy if the function exists and does
593
+ not have a policy set.
594
+ Returns:
595
+ Callable[[~.GetIamPolicyRequest],
596
+ ~.Policy]:
597
+ A function that, when called, will call the underlying RPC
598
+ on the server.
599
+ """
600
+ # Generate a "stub function" on-the-fly which will actually make
601
+ # the request.
602
+ # gRPC handles serialization and deserialization, so we just need
603
+ # to pass in the functions for each.
604
+ if "get_iam_policy" not in self._stubs:
605
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
606
+ "/google.iam.v1.IAMPolicy/GetIamPolicy",
607
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
608
+ response_deserializer=policy_pb2.Policy.FromString,
609
+ )
610
+ return self._stubs["get_iam_policy"]
611
+
612
+ @property
613
+ def test_iam_permissions(
614
+ self,
615
+ ) -> Callable[
616
+ [iam_policy_pb2.TestIamPermissionsRequest],
617
+ iam_policy_pb2.TestIamPermissionsResponse,
618
+ ]:
619
+ r"""Return a callable for the test iam permissions method over gRPC.
620
+ Tests the specified permissions against the IAM access control
621
+ policy for a function. If the function does not exist, this will
622
+ return an empty set of permissions, not a NOT_FOUND error.
623
+ Returns:
624
+ Callable[[~.TestIamPermissionsRequest],
625
+ ~.TestIamPermissionsResponse]:
626
+ A function that, when called, will call the underlying RPC
627
+ on the server.
628
+ """
629
+ # Generate a "stub function" on-the-fly which will actually make
630
+ # the request.
631
+ # gRPC handles serialization and deserialization, so we just need
632
+ # to pass in the functions for each.
633
+ if "test_iam_permissions" not in self._stubs:
634
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
635
+ "/google.iam.v1.IAMPolicy/TestIamPermissions",
636
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
637
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
638
+ )
639
+ return self._stubs["test_iam_permissions"]
640
+
641
+
642
+ __all__ = ("EvaluationServiceGrpcAsyncIOTransport",)
data/conda_envs/evalclaw/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest.py ADDED
@@ -0,0 +1,2032 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
17
+ import json # type: ignore
18
+
19
+ from google.auth.transport.requests import AuthorizedSession # type: ignore
20
+ from google.auth import credentials as ga_credentials # type: ignore
21
+ from google.api_core import exceptions as core_exceptions
22
+ from google.api_core import retry as retries
23
+ from google.api_core import rest_helpers
24
+ from google.api_core import rest_streaming
25
+ from google.api_core import gapic_v1
26
+ import google.protobuf
27
+
28
+ from google.protobuf import json_format
29
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
30
+ from google.iam.v1 import policy_pb2 # type: ignore
31
+ from google.cloud.location import locations_pb2 # type: ignore
32
+
33
+ from requests import __version__ as requests_version
34
+ import dataclasses
35
+ from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
36
+ import warnings
37
+
38
+
39
+ from google.cloud.aiplatform_v1.types import evaluation_service
40
+ from google.longrunning import operations_pb2 # type: ignore
41
+
42
+
43
+ from .rest_base import _BaseEvaluationServiceRestTransport
44
+ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO
45
+
46
+ try:
47
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
48
+ except AttributeError: # pragma: NO COVER
49
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
50
+
51
+ try:
52
+ from google.api_core import client_logging # type: ignore
53
+
54
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
55
+ except ImportError: # pragma: NO COVER
56
+ CLIENT_LOGGING_SUPPORTED = False
57
+
58
+ _LOGGER = logging.getLogger(__name__)
59
+
60
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
61
+ gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version,
62
+ grpc_version=None,
63
+ rest_version=f"requests@{requests_version}",
64
+ )
65
+
66
+ if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
67
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
68
+
69
+
70
+ class EvaluationServiceRestInterceptor:
71
+ """Interceptor for EvaluationService.
72
+
73
+ Interceptors are used to manipulate requests, request metadata, and responses
74
+ in arbitrary ways.
75
+ Example use cases include:
76
+ * Logging
77
+ * Verifying requests according to service or custom semantics
78
+ * Stripping extraneous information from responses
79
+
80
+ These use cases and more can be enabled by injecting an
81
+ instance of a custom subclass when constructing the EvaluationServiceRestTransport.
82
+
83
+ .. code-block:: python
84
+ class MyCustomEvaluationServiceInterceptor(EvaluationServiceRestInterceptor):
85
+ def pre_evaluate_instances(self, request, metadata):
86
+ logging.log(f"Received request: {request}")
87
+ return request, metadata
88
+
89
+ def post_evaluate_instances(self, response):
90
+ logging.log(f"Received response: {response}")
91
+ return response
92
+
93
+ transport = EvaluationServiceRestTransport(interceptor=MyCustomEvaluationServiceInterceptor())
94
+ client = EvaluationServiceClient(transport=transport)
95
+
96
+
97
+ """
98
+
99
+ def pre_evaluate_instances(
100
+ self,
101
+ request: evaluation_service.EvaluateInstancesRequest,
102
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
103
+ ) -> Tuple[
104
+ evaluation_service.EvaluateInstancesRequest,
105
+ Sequence[Tuple[str, Union[str, bytes]]],
106
+ ]:
107
+ """Pre-rpc interceptor for evaluate_instances
108
+
109
+ Override in a subclass to manipulate the request or metadata
110
+ before they are sent to the EvaluationService server.
111
+ """
112
+ return request, metadata
113
+
114
+ def post_evaluate_instances(
115
+ self, response: evaluation_service.EvaluateInstancesResponse
116
+ ) -> evaluation_service.EvaluateInstancesResponse:
117
+ """Post-rpc interceptor for evaluate_instances
118
+
119
+ DEPRECATED. Please use the `post_evaluate_instances_with_metadata`
120
+ interceptor instead.
121
+
122
+ Override in a subclass to read or manipulate the response
123
+ after it is returned by the EvaluationService server but before
124
+ it is returned to user code. This `post_evaluate_instances` interceptor runs
125
+ before the `post_evaluate_instances_with_metadata` interceptor.
126
+ """
127
+ return response
128
+
129
+ def post_evaluate_instances_with_metadata(
130
+ self,
131
+ response: evaluation_service.EvaluateInstancesResponse,
132
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
133
+ ) -> Tuple[
134
+ evaluation_service.EvaluateInstancesResponse,
135
+ Sequence[Tuple[str, Union[str, bytes]]],
136
+ ]:
137
+ """Post-rpc interceptor for evaluate_instances
138
+
139
+ Override in a subclass to read or manipulate the response or metadata after it
140
+ is returned by the EvaluationService server but before it is returned to user code.
141
+
142
+ We recommend only using this `post_evaluate_instances_with_metadata`
143
+ interceptor in new development instead of the `post_evaluate_instances` interceptor.
144
+ When both interceptors are used, this `post_evaluate_instances_with_metadata` interceptor runs after the
145
+ `post_evaluate_instances` interceptor. The (possibly modified) response returned by
146
+ `post_evaluate_instances` will be passed to
147
+ `post_evaluate_instances_with_metadata`.
148
+ """
149
+ return response, metadata
150
+
151
+ def pre_get_location(
152
+ self,
153
+ request: locations_pb2.GetLocationRequest,
154
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
155
+ ) -> Tuple[
156
+ locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]]
157
+ ]:
158
+ """Pre-rpc interceptor for get_location
159
+
160
+ Override in a subclass to manipulate the request or metadata
161
+ before they are sent to the EvaluationService server.
162
+ """
163
+ return request, metadata
164
+
165
+ def post_get_location(
166
+ self, response: locations_pb2.Location
167
+ ) -> locations_pb2.Location:
168
+ """Post-rpc interceptor for get_location
169
+
170
+ Override in a subclass to manipulate the response
171
+ after it is returned by the EvaluationService server but before
172
+ it is returned to user code.
173
+ """
174
+ return response
175
+
176
+ def pre_list_locations(
177
+ self,
178
+ request: locations_pb2.ListLocationsRequest,
179
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
180
+ ) -> Tuple[
181
+ locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]]
182
+ ]:
183
+ """Pre-rpc interceptor for list_locations
184
+
185
+ Override in a subclass to manipulate the request or metadata
186
+ before they are sent to the EvaluationService server.
187
+ """
188
+ return request, metadata
189
+
190
+ def post_list_locations(
191
+ self, response: locations_pb2.ListLocationsResponse
192
+ ) -> locations_pb2.ListLocationsResponse:
193
+ """Post-rpc interceptor for list_locations
194
+
195
+ Override in a subclass to manipulate the response
196
+ after it is returned by the EvaluationService server but before
197
+ it is returned to user code.
198
+ """
199
+ return response
200
+
201
+ def pre_get_iam_policy(
202
+ self,
203
+ request: iam_policy_pb2.GetIamPolicyRequest,
204
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
205
+ ) -> Tuple[
206
+ iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
207
+ ]:
208
+ """Pre-rpc interceptor for get_iam_policy
209
+
210
+ Override in a subclass to manipulate the request or metadata
211
+ before they are sent to the EvaluationService server.
212
+ """
213
+ return request, metadata
214
+
215
+ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
216
+ """Post-rpc interceptor for get_iam_policy
217
+
218
+ Override in a subclass to manipulate the response
219
+ after it is returned by the EvaluationService server but before
220
+ it is returned to user code.
221
+ """
222
+ return response
223
+
224
+ def pre_set_iam_policy(
225
+ self,
226
+ request: iam_policy_pb2.SetIamPolicyRequest,
227
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
228
+ ) -> Tuple[
229
+ iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
230
+ ]:
231
+ """Pre-rpc interceptor for set_iam_policy
232
+
233
+ Override in a subclass to manipulate the request or metadata
234
+ before they are sent to the EvaluationService server.
235
+ """
236
+ return request, metadata
237
+
238
+ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
239
+ """Post-rpc interceptor for set_iam_policy
240
+
241
+ Override in a subclass to manipulate the response
242
+ after it is returned by the EvaluationService server but before
243
+ it is returned to user code.
244
+ """
245
+ return response
246
+
247
+ def pre_test_iam_permissions(
248
+ self,
249
+ request: iam_policy_pb2.TestIamPermissionsRequest,
250
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
251
+ ) -> Tuple[
252
+ iam_policy_pb2.TestIamPermissionsRequest,
253
+ Sequence[Tuple[str, Union[str, bytes]]],
254
+ ]:
255
+ """Pre-rpc interceptor for test_iam_permissions
256
+
257
+ Override in a subclass to manipulate the request or metadata
258
+ before they are sent to the EvaluationService server.
259
+ """
260
+ return request, metadata
261
+
262
+ def post_test_iam_permissions(
263
+ self, response: iam_policy_pb2.TestIamPermissionsResponse
264
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
265
+ """Post-rpc interceptor for test_iam_permissions
266
+
267
+ Override in a subclass to manipulate the response
268
+ after it is returned by the EvaluationService server but before
269
+ it is returned to user code.
270
+ """
271
+ return response
272
+
273
+ def pre_cancel_operation(
274
+ self,
275
+ request: operations_pb2.CancelOperationRequest,
276
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
277
+ ) -> Tuple[
278
+ operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
279
+ ]:
280
+ """Pre-rpc interceptor for cancel_operation
281
+
282
+ Override in a subclass to manipulate the request or metadata
283
+ before they are sent to the EvaluationService server.
284
+ """
285
+ return request, metadata
286
+
287
+ def post_cancel_operation(self, response: None) -> None:
288
+ """Post-rpc interceptor for cancel_operation
289
+
290
+ Override in a subclass to manipulate the response
291
+ after it is returned by the EvaluationService server but before
292
+ it is returned to user code.
293
+ """
294
+ return response
295
+
296
+ def pre_delete_operation(
297
+ self,
298
+ request: operations_pb2.DeleteOperationRequest,
299
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
300
+ ) -> Tuple[
301
+ operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
302
+ ]:
303
+ """Pre-rpc interceptor for delete_operation
304
+
305
+ Override in a subclass to manipulate the request or metadata
306
+ before they are sent to the EvaluationService server.
307
+ """
308
+ return request, metadata
309
+
310
+ def post_delete_operation(self, response: None) -> None:
311
+ """Post-rpc interceptor for delete_operation
312
+
313
+ Override in a subclass to manipulate the response
314
+ after it is returned by the EvaluationService server but before
315
+ it is returned to user code.
316
+ """
317
+ return response
318
+
319
+ def pre_get_operation(
320
+ self,
321
+ request: operations_pb2.GetOperationRequest,
322
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
323
+ ) -> Tuple[
324
+ operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
325
+ ]:
326
+ """Pre-rpc interceptor for get_operation
327
+
328
+ Override in a subclass to manipulate the request or metadata
329
+ before they are sent to the EvaluationService server.
330
+ """
331
+ return request, metadata
332
+
333
+ def post_get_operation(
334
+ self, response: operations_pb2.Operation
335
+ ) -> operations_pb2.Operation:
336
+ """Post-rpc interceptor for get_operation
337
+
338
+ Override in a subclass to manipulate the response
339
+ after it is returned by the EvaluationService server but before
340
+ it is returned to user code.
341
+ """
342
+ return response
343
+
344
+ def pre_list_operations(
345
+ self,
346
+ request: operations_pb2.ListOperationsRequest,
347
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
348
+ ) -> Tuple[
349
+ operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]]
350
+ ]:
351
+ """Pre-rpc interceptor for list_operations
352
+
353
+ Override in a subclass to manipulate the request or metadata
354
+ before they are sent to the EvaluationService server.
355
+ """
356
+ return request, metadata
357
+
358
+ def post_list_operations(
359
+ self, response: operations_pb2.ListOperationsResponse
360
+ ) -> operations_pb2.ListOperationsResponse:
361
+ """Post-rpc interceptor for list_operations
362
+
363
+ Override in a subclass to manipulate the response
364
+ after it is returned by the EvaluationService server but before
365
+ it is returned to user code.
366
+ """
367
+ return response
368
+
369
+ def pre_wait_operation(
370
+ self,
371
+ request: operations_pb2.WaitOperationRequest,
372
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
373
+ ) -> Tuple[
374
+ operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]
375
+ ]:
376
+ """Pre-rpc interceptor for wait_operation
377
+
378
+ Override in a subclass to manipulate the request or metadata
379
+ before they are sent to the EvaluationService server.
380
+ """
381
+ return request, metadata
382
+
383
+ def post_wait_operation(
384
+ self, response: operations_pb2.Operation
385
+ ) -> operations_pb2.Operation:
386
+ """Post-rpc interceptor for wait_operation
387
+
388
+ Override in a subclass to manipulate the response
389
+ after it is returned by the EvaluationService server but before
390
+ it is returned to user code.
391
+ """
392
+ return response
393
+
394
+
395
+ @dataclasses.dataclass
396
+ class EvaluationServiceRestStub:
397
+ _session: AuthorizedSession
398
+ _host: str
399
+ _interceptor: EvaluationServiceRestInterceptor
400
+
401
+
402
+ class EvaluationServiceRestTransport(_BaseEvaluationServiceRestTransport):
403
+ """REST backend synchronous transport for EvaluationService.
404
+
405
+ Vertex AI Online Evaluation Service.
406
+
407
+ This class defines the same methods as the primary client, so the
408
+ primary client can load the underlying transport implementation
409
+ and call it.
410
+
411
+ It sends JSON representations of protocol buffers over HTTP/1.1
412
+ """
413
+
414
+ def __init__(
415
+ self,
416
+ *,
417
+ host: str = "aiplatform.googleapis.com",
418
+ credentials: Optional[ga_credentials.Credentials] = None,
419
+ credentials_file: Optional[str] = None,
420
+ scopes: Optional[Sequence[str]] = None,
421
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
422
+ quota_project_id: Optional[str] = None,
423
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
424
+ always_use_jwt_access: Optional[bool] = False,
425
+ url_scheme: str = "https",
426
+ interceptor: Optional[EvaluationServiceRestInterceptor] = None,
427
+ api_audience: Optional[str] = None,
428
+ ) -> None:
429
+ """Instantiate the transport.
430
+
431
+ Args:
432
+ host (Optional[str]):
433
+ The hostname to connect to (default: 'aiplatform.googleapis.com').
434
+ credentials (Optional[google.auth.credentials.Credentials]): The
435
+ authorization credentials to attach to requests. These
436
+ credentials identify the application to the service; if none
437
+ are specified, the client will attempt to ascertain the
438
+ credentials from the environment.
439
+
440
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
441
+ be loaded with :func:`google.auth.load_credentials_from_file`.
442
+ This argument is ignored if ``channel`` is provided. This argument will be
443
+ removed in the next major version of this library.
444
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
445
+ ignored if ``channel`` is provided.
446
+ client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
447
+ certificate to configure mutual TLS HTTP channel. It is ignored
448
+ if ``channel`` is provided.
449
+ quota_project_id (Optional[str]): An optional project to use for billing
450
+ and quota.
451
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
452
+ The client info used to send a user-agent string along with
453
+ API requests. If ``None``, then default info will be used.
454
+ Generally, you only need to set this if you are developing
455
+ your own client library.
456
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
457
+ be used for service account credentials.
458
+ url_scheme: the protocol scheme for the API endpoint. Normally
459
+ "https", but for testing or local servers,
460
+ "http" can be specified.
461
+ """
462
+ # Run the base constructor
463
+ # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
464
+ # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
465
+ # credentials object
466
+ super().__init__(
467
+ host=host,
468
+ credentials=credentials,
469
+ client_info=client_info,
470
+ always_use_jwt_access=always_use_jwt_access,
471
+ url_scheme=url_scheme,
472
+ api_audience=api_audience,
473
+ )
474
+ self._session = AuthorizedSession(
475
+ self._credentials, default_host=self.DEFAULT_HOST
476
+ )
477
+ if client_cert_source_for_mtls:
478
+ self._session.configure_mtls_channel(client_cert_source_for_mtls)
479
+ self._interceptor = interceptor or EvaluationServiceRestInterceptor()
480
+ self._prep_wrapped_messages(client_info)
481
+
482
+ class _EvaluateInstances(
483
+ _BaseEvaluationServiceRestTransport._BaseEvaluateInstances,
484
+ EvaluationServiceRestStub,
485
+ ):
486
+ def __hash__(self):
487
+ return hash("EvaluationServiceRestTransport.EvaluateInstances")
488
+
489
+ @staticmethod
490
+ def _get_response(
491
+ host,
492
+ metadata,
493
+ query_params,
494
+ session,
495
+ timeout,
496
+ transcoded_request,
497
+ body=None,
498
+ ):
499
+
500
+ uri = transcoded_request["uri"]
501
+ method = transcoded_request["method"]
502
+ headers = dict(metadata)
503
+ headers["Content-Type"] = "application/json"
504
+ response = getattr(session, method)(
505
+ "{host}{uri}".format(host=host, uri=uri),
506
+ timeout=timeout,
507
+ headers=headers,
508
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
509
+ data=body,
510
+ )
511
+ return response
512
+
513
+ def __call__(
514
+ self,
515
+ request: evaluation_service.EvaluateInstancesRequest,
516
+ *,
517
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
518
+ timeout: Optional[float] = None,
519
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
520
+ ) -> evaluation_service.EvaluateInstancesResponse:
521
+ r"""Call the evaluate instances method over HTTP.
522
+
523
+ Args:
524
+ request (~.evaluation_service.EvaluateInstancesRequest):
525
+ The request object. Request message for
526
+ EvaluationService.EvaluateInstances.
527
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
528
+ should be retried.
529
+ timeout (float): The timeout for this request.
530
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
531
+ sent along with the request as metadata. Normally, each value must be of type `str`,
532
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
533
+ be of type `bytes`.
534
+
535
+ Returns:
536
+ ~.evaluation_service.EvaluateInstancesResponse:
537
+ Response message for
538
+ EvaluationService.EvaluateInstances.
539
+
540
+ """
541
+
542
+ http_options = (
543
+ _BaseEvaluationServiceRestTransport._BaseEvaluateInstances._get_http_options()
544
+ )
545
+
546
+ request, metadata = self._interceptor.pre_evaluate_instances(
547
+ request, metadata
548
+ )
549
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseEvaluateInstances._get_transcoded_request(
550
+ http_options, request
551
+ )
552
+
553
+ body = _BaseEvaluationServiceRestTransport._BaseEvaluateInstances._get_request_body_json(
554
+ transcoded_request
555
+ )
556
+
557
+ # Jsonify the query params
558
+ query_params = _BaseEvaluationServiceRestTransport._BaseEvaluateInstances._get_query_params_json(
559
+ transcoded_request
560
+ )
561
+
562
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
563
+ logging.DEBUG
564
+ ): # pragma: NO COVER
565
+ request_url = "{host}{uri}".format(
566
+ host=self._host, uri=transcoded_request["uri"]
567
+ )
568
+ method = transcoded_request["method"]
569
+ try:
570
+ request_payload = type(request).to_json(request)
571
+ except:
572
+ request_payload = None
573
+ http_request = {
574
+ "payload": request_payload,
575
+ "requestMethod": method,
576
+ "requestUrl": request_url,
577
+ "headers": dict(metadata),
578
+ }
579
+ _LOGGER.debug(
580
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.EvaluateInstances",
581
+ extra={
582
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
583
+ "rpcName": "EvaluateInstances",
584
+ "httpRequest": http_request,
585
+ "metadata": http_request["headers"],
586
+ },
587
+ )
588
+
589
+ # Send the request
590
+ response = EvaluationServiceRestTransport._EvaluateInstances._get_response(
591
+ self._host,
592
+ metadata,
593
+ query_params,
594
+ self._session,
595
+ timeout,
596
+ transcoded_request,
597
+ body,
598
+ )
599
+
600
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
601
+ # subclass.
602
+ if response.status_code >= 400:
603
+ raise core_exceptions.from_http_response(response)
604
+
605
+ # Return the response
606
+ resp = evaluation_service.EvaluateInstancesResponse()
607
+ pb_resp = evaluation_service.EvaluateInstancesResponse.pb(resp)
608
+
609
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
610
+
611
+ resp = self._interceptor.post_evaluate_instances(resp)
612
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
613
+ resp, _ = self._interceptor.post_evaluate_instances_with_metadata(
614
+ resp, response_metadata
615
+ )
616
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
617
+ logging.DEBUG
618
+ ): # pragma: NO COVER
619
+ try:
620
+ response_payload = (
621
+ evaluation_service.EvaluateInstancesResponse.to_json(response)
622
+ )
623
+ except:
624
+ response_payload = None
625
+ http_response = {
626
+ "payload": response_payload,
627
+ "headers": dict(response.headers),
628
+ "status": response.status_code,
629
+ }
630
+ _LOGGER.debug(
631
+ "Received response for google.cloud.aiplatform_v1.EvaluationServiceClient.evaluate_instances",
632
+ extra={
633
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
634
+ "rpcName": "EvaluateInstances",
635
+ "metadata": http_response["headers"],
636
+ "httpResponse": http_response,
637
+ },
638
+ )
639
+ return resp
640
+
641
+ @property
642
+ def evaluate_instances(
643
+ self,
644
+ ) -> Callable[
645
+ [evaluation_service.EvaluateInstancesRequest],
646
+ evaluation_service.EvaluateInstancesResponse,
647
+ ]:
648
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
649
+ # In C++ this would require a dynamic_cast
650
+ return self._EvaluateInstances(self._session, self._host, self._interceptor) # type: ignore
651
+
652
+ @property
653
+ def get_location(self):
654
+ return self._GetLocation(self._session, self._host, self._interceptor) # type: ignore
655
+
656
+ class _GetLocation(
657
+ _BaseEvaluationServiceRestTransport._BaseGetLocation, EvaluationServiceRestStub
658
+ ):
659
+ def __hash__(self):
660
+ return hash("EvaluationServiceRestTransport.GetLocation")
661
+
662
+ @staticmethod
663
+ def _get_response(
664
+ host,
665
+ metadata,
666
+ query_params,
667
+ session,
668
+ timeout,
669
+ transcoded_request,
670
+ body=None,
671
+ ):
672
+
673
+ uri = transcoded_request["uri"]
674
+ method = transcoded_request["method"]
675
+ headers = dict(metadata)
676
+ headers["Content-Type"] = "application/json"
677
+ response = getattr(session, method)(
678
+ "{host}{uri}".format(host=host, uri=uri),
679
+ timeout=timeout,
680
+ headers=headers,
681
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
682
+ )
683
+ return response
684
+
685
+ def __call__(
686
+ self,
687
+ request: locations_pb2.GetLocationRequest,
688
+ *,
689
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
690
+ timeout: Optional[float] = None,
691
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
692
+ ) -> locations_pb2.Location:
693
+ r"""Call the get location method over HTTP.
694
+
695
+ Args:
696
+ request (locations_pb2.GetLocationRequest):
697
+ The request object for GetLocation method.
698
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
699
+ should be retried.
700
+ timeout (float): The timeout for this request.
701
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
702
+ sent along with the request as metadata. Normally, each value must be of type `str`,
703
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
704
+ be of type `bytes`.
705
+
706
+ Returns:
707
+ locations_pb2.Location: Response from GetLocation method.
708
+ """
709
+
710
+ http_options = (
711
+ _BaseEvaluationServiceRestTransport._BaseGetLocation._get_http_options()
712
+ )
713
+
714
+ request, metadata = self._interceptor.pre_get_location(request, metadata)
715
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseGetLocation._get_transcoded_request(
716
+ http_options, request
717
+ )
718
+
719
+ # Jsonify the query params
720
+ query_params = _BaseEvaluationServiceRestTransport._BaseGetLocation._get_query_params_json(
721
+ transcoded_request
722
+ )
723
+
724
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
725
+ logging.DEBUG
726
+ ): # pragma: NO COVER
727
+ request_url = "{host}{uri}".format(
728
+ host=self._host, uri=transcoded_request["uri"]
729
+ )
730
+ method = transcoded_request["method"]
731
+ try:
732
+ request_payload = json_format.MessageToJson(request)
733
+ except:
734
+ request_payload = None
735
+ http_request = {
736
+ "payload": request_payload,
737
+ "requestMethod": method,
738
+ "requestUrl": request_url,
739
+ "headers": dict(metadata),
740
+ }
741
+ _LOGGER.debug(
742
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.GetLocation",
743
+ extra={
744
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
745
+ "rpcName": "GetLocation",
746
+ "httpRequest": http_request,
747
+ "metadata": http_request["headers"],
748
+ },
749
+ )
750
+
751
+ # Send the request
752
+ response = EvaluationServiceRestTransport._GetLocation._get_response(
753
+ self._host,
754
+ metadata,
755
+ query_params,
756
+ self._session,
757
+ timeout,
758
+ transcoded_request,
759
+ )
760
+
761
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
762
+ # subclass.
763
+ if response.status_code >= 400:
764
+ raise core_exceptions.from_http_response(response)
765
+
766
+ content = response.content.decode("utf-8")
767
+ resp = locations_pb2.Location()
768
+ resp = json_format.Parse(content, resp)
769
+ resp = self._interceptor.post_get_location(resp)
770
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
771
+ logging.DEBUG
772
+ ): # pragma: NO COVER
773
+ try:
774
+ response_payload = json_format.MessageToJson(resp)
775
+ except:
776
+ response_payload = None
777
+ http_response = {
778
+ "payload": response_payload,
779
+ "headers": dict(response.headers),
780
+ "status": response.status_code,
781
+ }
782
+ _LOGGER.debug(
783
+ "Received response for google.cloud.aiplatform_v1.EvaluationServiceAsyncClient.GetLocation",
784
+ extra={
785
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
786
+ "rpcName": "GetLocation",
787
+ "httpResponse": http_response,
788
+ "metadata": http_response["headers"],
789
+ },
790
+ )
791
+ return resp
792
+
793
+ @property
794
+ def list_locations(self):
795
+ return self._ListLocations(self._session, self._host, self._interceptor) # type: ignore
796
+
797
+ class _ListLocations(
798
+ _BaseEvaluationServiceRestTransport._BaseListLocations,
799
+ EvaluationServiceRestStub,
800
+ ):
801
+ def __hash__(self):
802
+ return hash("EvaluationServiceRestTransport.ListLocations")
803
+
804
+ @staticmethod
805
+ def _get_response(
806
+ host,
807
+ metadata,
808
+ query_params,
809
+ session,
810
+ timeout,
811
+ transcoded_request,
812
+ body=None,
813
+ ):
814
+
815
+ uri = transcoded_request["uri"]
816
+ method = transcoded_request["method"]
817
+ headers = dict(metadata)
818
+ headers["Content-Type"] = "application/json"
819
+ response = getattr(session, method)(
820
+ "{host}{uri}".format(host=host, uri=uri),
821
+ timeout=timeout,
822
+ headers=headers,
823
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
824
+ )
825
+ return response
826
+
827
+ def __call__(
828
+ self,
829
+ request: locations_pb2.ListLocationsRequest,
830
+ *,
831
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
832
+ timeout: Optional[float] = None,
833
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
834
+ ) -> locations_pb2.ListLocationsResponse:
835
+ r"""Call the list locations method over HTTP.
836
+
837
+ Args:
838
+ request (locations_pb2.ListLocationsRequest):
839
+ The request object for ListLocations method.
840
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
841
+ should be retried.
842
+ timeout (float): The timeout for this request.
843
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
844
+ sent along with the request as metadata. Normally, each value must be of type `str`,
845
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
846
+ be of type `bytes`.
847
+
848
+ Returns:
849
+ locations_pb2.ListLocationsResponse: Response from ListLocations method.
850
+ """
851
+
852
+ http_options = (
853
+ _BaseEvaluationServiceRestTransport._BaseListLocations._get_http_options()
854
+ )
855
+
856
+ request, metadata = self._interceptor.pre_list_locations(request, metadata)
857
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseListLocations._get_transcoded_request(
858
+ http_options, request
859
+ )
860
+
861
+ # Jsonify the query params
862
+ query_params = _BaseEvaluationServiceRestTransport._BaseListLocations._get_query_params_json(
863
+ transcoded_request
864
+ )
865
+
866
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
867
+ logging.DEBUG
868
+ ): # pragma: NO COVER
869
+ request_url = "{host}{uri}".format(
870
+ host=self._host, uri=transcoded_request["uri"]
871
+ )
872
+ method = transcoded_request["method"]
873
+ try:
874
+ request_payload = json_format.MessageToJson(request)
875
+ except:
876
+ request_payload = None
877
+ http_request = {
878
+ "payload": request_payload,
879
+ "requestMethod": method,
880
+ "requestUrl": request_url,
881
+ "headers": dict(metadata),
882
+ }
883
+ _LOGGER.debug(
884
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.ListLocations",
885
+ extra={
886
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
887
+ "rpcName": "ListLocations",
888
+ "httpRequest": http_request,
889
+ "metadata": http_request["headers"],
890
+ },
891
+ )
892
+
893
+ # Send the request
894
+ response = EvaluationServiceRestTransport._ListLocations._get_response(
895
+ self._host,
896
+ metadata,
897
+ query_params,
898
+ self._session,
899
+ timeout,
900
+ transcoded_request,
901
+ )
902
+
903
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
904
+ # subclass.
905
+ if response.status_code >= 400:
906
+ raise core_exceptions.from_http_response(response)
907
+
908
+ content = response.content.decode("utf-8")
909
+ resp = locations_pb2.ListLocationsResponse()
910
+ resp = json_format.Parse(content, resp)
911
+ resp = self._interceptor.post_list_locations(resp)
912
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
913
+ logging.DEBUG
914
+ ): # pragma: NO COVER
915
+ try:
916
+ response_payload = json_format.MessageToJson(resp)
917
+ except:
918
+ response_payload = None
919
+ http_response = {
920
+ "payload": response_payload,
921
+ "headers": dict(response.headers),
922
+ "status": response.status_code,
923
+ }
924
+ _LOGGER.debug(
925
+ "Received response for google.cloud.aiplatform_v1.EvaluationServiceAsyncClient.ListLocations",
926
+ extra={
927
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
928
+ "rpcName": "ListLocations",
929
+ "httpResponse": http_response,
930
+ "metadata": http_response["headers"],
931
+ },
932
+ )
933
+ return resp
934
+
935
+ @property
936
+ def get_iam_policy(self):
937
+ return self._GetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
938
+
939
+ class _GetIamPolicy(
940
+ _BaseEvaluationServiceRestTransport._BaseGetIamPolicy, EvaluationServiceRestStub
941
+ ):
942
+ def __hash__(self):
943
+ return hash("EvaluationServiceRestTransport.GetIamPolicy")
944
+
945
+ @staticmethod
946
+ def _get_response(
947
+ host,
948
+ metadata,
949
+ query_params,
950
+ session,
951
+ timeout,
952
+ transcoded_request,
953
+ body=None,
954
+ ):
955
+
956
+ uri = transcoded_request["uri"]
957
+ method = transcoded_request["method"]
958
+ headers = dict(metadata)
959
+ headers["Content-Type"] = "application/json"
960
+ response = getattr(session, method)(
961
+ "{host}{uri}".format(host=host, uri=uri),
962
+ timeout=timeout,
963
+ headers=headers,
964
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
965
+ )
966
+ return response
967
+
968
+ def __call__(
969
+ self,
970
+ request: iam_policy_pb2.GetIamPolicyRequest,
971
+ *,
972
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
973
+ timeout: Optional[float] = None,
974
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
975
+ ) -> policy_pb2.Policy:
976
+ r"""Call the get iam policy method over HTTP.
977
+
978
+ Args:
979
+ request (iam_policy_pb2.GetIamPolicyRequest):
980
+ The request object for GetIamPolicy method.
981
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
982
+ should be retried.
983
+ timeout (float): The timeout for this request.
984
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
985
+ sent along with the request as metadata. Normally, each value must be of type `str`,
986
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
987
+ be of type `bytes`.
988
+
989
+ Returns:
990
+ policy_pb2.Policy: Response from GetIamPolicy method.
991
+ """
992
+
993
+ http_options = (
994
+ _BaseEvaluationServiceRestTransport._BaseGetIamPolicy._get_http_options()
995
+ )
996
+
997
+ request, metadata = self._interceptor.pre_get_iam_policy(request, metadata)
998
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseGetIamPolicy._get_transcoded_request(
999
+ http_options, request
1000
+ )
1001
+
1002
+ # Jsonify the query params
1003
+ query_params = _BaseEvaluationServiceRestTransport._BaseGetIamPolicy._get_query_params_json(
1004
+ transcoded_request
1005
+ )
1006
+
1007
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1008
+ logging.DEBUG
1009
+ ): # pragma: NO COVER
1010
+ request_url = "{host}{uri}".format(
1011
+ host=self._host, uri=transcoded_request["uri"]
1012
+ )
1013
+ method = transcoded_request["method"]
1014
+ try:
1015
+ request_payload = json_format.MessageToJson(request)
1016
+ except:
1017
+ request_payload = None
1018
+ http_request = {
1019
+ "payload": request_payload,
1020
+ "requestMethod": method,
1021
+ "requestUrl": request_url,
1022
+ "headers": dict(metadata),
1023
+ }
1024
+ _LOGGER.debug(
1025
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.GetIamPolicy",
1026
+ extra={
1027
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1028
+ "rpcName": "GetIamPolicy",
1029
+ "httpRequest": http_request,
1030
+ "metadata": http_request["headers"],
1031
+ },
1032
+ )
1033
+
1034
+ # Send the request
1035
+ response = EvaluationServiceRestTransport._GetIamPolicy._get_response(
1036
+ self._host,
1037
+ metadata,
1038
+ query_params,
1039
+ self._session,
1040
+ timeout,
1041
+ transcoded_request,
1042
+ )
1043
+
1044
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1045
+ # subclass.
1046
+ if response.status_code >= 400:
1047
+ raise core_exceptions.from_http_response(response)
1048
+
1049
+ content = response.content.decode("utf-8")
1050
+ resp = policy_pb2.Policy()
1051
+ resp = json_format.Parse(content, resp)
1052
+ resp = self._interceptor.post_get_iam_policy(resp)
1053
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1054
+ logging.DEBUG
1055
+ ): # pragma: NO COVER
1056
+ try:
1057
+ response_payload = json_format.MessageToJson(resp)
1058
+ except:
1059
+ response_payload = None
1060
+ http_response = {
1061
+ "payload": response_payload,
1062
+ "headers": dict(response.headers),
1063
+ "status": response.status_code,
1064
+ }
1065
+ _LOGGER.debug(
1066
+ "Received response for google.cloud.aiplatform_v1.EvaluationServiceAsyncClient.GetIamPolicy",
1067
+ extra={
1068
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1069
+ "rpcName": "GetIamPolicy",
1070
+ "httpResponse": http_response,
1071
+ "metadata": http_response["headers"],
1072
+ },
1073
+ )
1074
+ return resp
1075
+
1076
+ @property
1077
+ def set_iam_policy(self):
1078
+ return self._SetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
1079
+
1080
+ class _SetIamPolicy(
1081
+ _BaseEvaluationServiceRestTransport._BaseSetIamPolicy, EvaluationServiceRestStub
1082
+ ):
1083
+ def __hash__(self):
1084
+ return hash("EvaluationServiceRestTransport.SetIamPolicy")
1085
+
1086
+ @staticmethod
1087
+ def _get_response(
1088
+ host,
1089
+ metadata,
1090
+ query_params,
1091
+ session,
1092
+ timeout,
1093
+ transcoded_request,
1094
+ body=None,
1095
+ ):
1096
+
1097
+ uri = transcoded_request["uri"]
1098
+ method = transcoded_request["method"]
1099
+ headers = dict(metadata)
1100
+ headers["Content-Type"] = "application/json"
1101
+ response = getattr(session, method)(
1102
+ "{host}{uri}".format(host=host, uri=uri),
1103
+ timeout=timeout,
1104
+ headers=headers,
1105
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1106
+ data=body,
1107
+ )
1108
+ return response
1109
+
1110
+ def __call__(
1111
+ self,
1112
+ request: iam_policy_pb2.SetIamPolicyRequest,
1113
+ *,
1114
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1115
+ timeout: Optional[float] = None,
1116
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1117
+ ) -> policy_pb2.Policy:
1118
+ r"""Call the set iam policy method over HTTP.
1119
+
1120
+ Args:
1121
+ request (iam_policy_pb2.SetIamPolicyRequest):
1122
+ The request object for SetIamPolicy method.
1123
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1124
+ should be retried.
1125
+ timeout (float): The timeout for this request.
1126
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1127
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1128
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1129
+ be of type `bytes`.
1130
+
1131
+ Returns:
1132
+ policy_pb2.Policy: Response from SetIamPolicy method.
1133
+ """
1134
+
1135
+ http_options = (
1136
+ _BaseEvaluationServiceRestTransport._BaseSetIamPolicy._get_http_options()
1137
+ )
1138
+
1139
+ request, metadata = self._interceptor.pre_set_iam_policy(request, metadata)
1140
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseSetIamPolicy._get_transcoded_request(
1141
+ http_options, request
1142
+ )
1143
+
1144
+ body = _BaseEvaluationServiceRestTransport._BaseSetIamPolicy._get_request_body_json(
1145
+ transcoded_request
1146
+ )
1147
+
1148
+ # Jsonify the query params
1149
+ query_params = _BaseEvaluationServiceRestTransport._BaseSetIamPolicy._get_query_params_json(
1150
+ transcoded_request
1151
+ )
1152
+
1153
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1154
+ logging.DEBUG
1155
+ ): # pragma: NO COVER
1156
+ request_url = "{host}{uri}".format(
1157
+ host=self._host, uri=transcoded_request["uri"]
1158
+ )
1159
+ method = transcoded_request["method"]
1160
+ try:
1161
+ request_payload = json_format.MessageToJson(request)
1162
+ except:
1163
+ request_payload = None
1164
+ http_request = {
1165
+ "payload": request_payload,
1166
+ "requestMethod": method,
1167
+ "requestUrl": request_url,
1168
+ "headers": dict(metadata),
1169
+ }
1170
+ _LOGGER.debug(
1171
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.SetIamPolicy",
1172
+ extra={
1173
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1174
+ "rpcName": "SetIamPolicy",
1175
+ "httpRequest": http_request,
1176
+ "metadata": http_request["headers"],
1177
+ },
1178
+ )
1179
+
1180
+ # Send the request
1181
+ response = EvaluationServiceRestTransport._SetIamPolicy._get_response(
1182
+ self._host,
1183
+ metadata,
1184
+ query_params,
1185
+ self._session,
1186
+ timeout,
1187
+ transcoded_request,
1188
+ body,
1189
+ )
1190
+
1191
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1192
+ # subclass.
1193
+ if response.status_code >= 400:
1194
+ raise core_exceptions.from_http_response(response)
1195
+
1196
+ content = response.content.decode("utf-8")
1197
+ resp = policy_pb2.Policy()
1198
+ resp = json_format.Parse(content, resp)
1199
+ resp = self._interceptor.post_set_iam_policy(resp)
1200
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1201
+ logging.DEBUG
1202
+ ): # pragma: NO COVER
1203
+ try:
1204
+ response_payload = json_format.MessageToJson(resp)
1205
+ except:
1206
+ response_payload = None
1207
+ http_response = {
1208
+ "payload": response_payload,
1209
+ "headers": dict(response.headers),
1210
+ "status": response.status_code,
1211
+ }
1212
+ _LOGGER.debug(
1213
+ "Received response for google.cloud.aiplatform_v1.EvaluationServiceAsyncClient.SetIamPolicy",
1214
+ extra={
1215
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1216
+ "rpcName": "SetIamPolicy",
1217
+ "httpResponse": http_response,
1218
+ "metadata": http_response["headers"],
1219
+ },
1220
+ )
1221
+ return resp
1222
+
1223
+ @property
1224
+ def test_iam_permissions(self):
1225
+ return self._TestIamPermissions(self._session, self._host, self._interceptor) # type: ignore
1226
+
1227
+ class _TestIamPermissions(
1228
+ _BaseEvaluationServiceRestTransport._BaseTestIamPermissions,
1229
+ EvaluationServiceRestStub,
1230
+ ):
1231
+ def __hash__(self):
1232
+ return hash("EvaluationServiceRestTransport.TestIamPermissions")
1233
+
1234
+ @staticmethod
1235
+ def _get_response(
1236
+ host,
1237
+ metadata,
1238
+ query_params,
1239
+ session,
1240
+ timeout,
1241
+ transcoded_request,
1242
+ body=None,
1243
+ ):
1244
+
1245
+ uri = transcoded_request["uri"]
1246
+ method = transcoded_request["method"]
1247
+ headers = dict(metadata)
1248
+ headers["Content-Type"] = "application/json"
1249
+ response = getattr(session, method)(
1250
+ "{host}{uri}".format(host=host, uri=uri),
1251
+ timeout=timeout,
1252
+ headers=headers,
1253
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1254
+ )
1255
+ return response
1256
+
1257
+ def __call__(
1258
+ self,
1259
+ request: iam_policy_pb2.TestIamPermissionsRequest,
1260
+ *,
1261
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1262
+ timeout: Optional[float] = None,
1263
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1264
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
1265
+ r"""Call the test iam permissions method over HTTP.
1266
+
1267
+ Args:
1268
+ request (iam_policy_pb2.TestIamPermissionsRequest):
1269
+ The request object for TestIamPermissions method.
1270
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1271
+ should be retried.
1272
+ timeout (float): The timeout for this request.
1273
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1274
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1275
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1276
+ be of type `bytes`.
1277
+
1278
+ Returns:
1279
+ iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method.
1280
+ """
1281
+
1282
+ http_options = (
1283
+ _BaseEvaluationServiceRestTransport._BaseTestIamPermissions._get_http_options()
1284
+ )
1285
+
1286
+ request, metadata = self._interceptor.pre_test_iam_permissions(
1287
+ request, metadata
1288
+ )
1289
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseTestIamPermissions._get_transcoded_request(
1290
+ http_options, request
1291
+ )
1292
+
1293
+ # Jsonify the query params
1294
+ query_params = _BaseEvaluationServiceRestTransport._BaseTestIamPermissions._get_query_params_json(
1295
+ transcoded_request
1296
+ )
1297
+
1298
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1299
+ logging.DEBUG
1300
+ ): # pragma: NO COVER
1301
+ request_url = "{host}{uri}".format(
1302
+ host=self._host, uri=transcoded_request["uri"]
1303
+ )
1304
+ method = transcoded_request["method"]
1305
+ try:
1306
+ request_payload = json_format.MessageToJson(request)
1307
+ except:
1308
+ request_payload = None
1309
+ http_request = {
1310
+ "payload": request_payload,
1311
+ "requestMethod": method,
1312
+ "requestUrl": request_url,
1313
+ "headers": dict(metadata),
1314
+ }
1315
+ _LOGGER.debug(
1316
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.TestIamPermissions",
1317
+ extra={
1318
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1319
+ "rpcName": "TestIamPermissions",
1320
+ "httpRequest": http_request,
1321
+ "metadata": http_request["headers"],
1322
+ },
1323
+ )
1324
+
1325
+ # Send the request
1326
+ response = EvaluationServiceRestTransport._TestIamPermissions._get_response(
1327
+ self._host,
1328
+ metadata,
1329
+ query_params,
1330
+ self._session,
1331
+ timeout,
1332
+ transcoded_request,
1333
+ )
1334
+
1335
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1336
+ # subclass.
1337
+ if response.status_code >= 400:
1338
+ raise core_exceptions.from_http_response(response)
1339
+
1340
+ content = response.content.decode("utf-8")
1341
+ resp = iam_policy_pb2.TestIamPermissionsResponse()
1342
+ resp = json_format.Parse(content, resp)
1343
+ resp = self._interceptor.post_test_iam_permissions(resp)
1344
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1345
+ logging.DEBUG
1346
+ ): # pragma: NO COVER
1347
+ try:
1348
+ response_payload = json_format.MessageToJson(resp)
1349
+ except:
1350
+ response_payload = None
1351
+ http_response = {
1352
+ "payload": response_payload,
1353
+ "headers": dict(response.headers),
1354
+ "status": response.status_code,
1355
+ }
1356
+ _LOGGER.debug(
1357
+ "Received response for google.cloud.aiplatform_v1.EvaluationServiceAsyncClient.TestIamPermissions",
1358
+ extra={
1359
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1360
+ "rpcName": "TestIamPermissions",
1361
+ "httpResponse": http_response,
1362
+ "metadata": http_response["headers"],
1363
+ },
1364
+ )
1365
+ return resp
1366
+
1367
+ @property
1368
+ def cancel_operation(self):
1369
+ return self._CancelOperation(self._session, self._host, self._interceptor) # type: ignore
1370
+
1371
+ class _CancelOperation(
1372
+ _BaseEvaluationServiceRestTransport._BaseCancelOperation,
1373
+ EvaluationServiceRestStub,
1374
+ ):
1375
+ def __hash__(self):
1376
+ return hash("EvaluationServiceRestTransport.CancelOperation")
1377
+
1378
+ @staticmethod
1379
+ def _get_response(
1380
+ host,
1381
+ metadata,
1382
+ query_params,
1383
+ session,
1384
+ timeout,
1385
+ transcoded_request,
1386
+ body=None,
1387
+ ):
1388
+
1389
+ uri = transcoded_request["uri"]
1390
+ method = transcoded_request["method"]
1391
+ headers = dict(metadata)
1392
+ headers["Content-Type"] = "application/json"
1393
+ response = getattr(session, method)(
1394
+ "{host}{uri}".format(host=host, uri=uri),
1395
+ timeout=timeout,
1396
+ headers=headers,
1397
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1398
+ )
1399
+ return response
1400
+
1401
+ def __call__(
1402
+ self,
1403
+ request: operations_pb2.CancelOperationRequest,
1404
+ *,
1405
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1406
+ timeout: Optional[float] = None,
1407
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1408
+ ) -> None:
1409
+ r"""Call the cancel operation method over HTTP.
1410
+
1411
+ Args:
1412
+ request (operations_pb2.CancelOperationRequest):
1413
+ The request object for CancelOperation method.
1414
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1415
+ should be retried.
1416
+ timeout (float): The timeout for this request.
1417
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1418
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1419
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1420
+ be of type `bytes`.
1421
+ """
1422
+
1423
+ http_options = (
1424
+ _BaseEvaluationServiceRestTransport._BaseCancelOperation._get_http_options()
1425
+ )
1426
+
1427
+ request, metadata = self._interceptor.pre_cancel_operation(
1428
+ request, metadata
1429
+ )
1430
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseCancelOperation._get_transcoded_request(
1431
+ http_options, request
1432
+ )
1433
+
1434
+ # Jsonify the query params
1435
+ query_params = _BaseEvaluationServiceRestTransport._BaseCancelOperation._get_query_params_json(
1436
+ transcoded_request
1437
+ )
1438
+
1439
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1440
+ logging.DEBUG
1441
+ ): # pragma: NO COVER
1442
+ request_url = "{host}{uri}".format(
1443
+ host=self._host, uri=transcoded_request["uri"]
1444
+ )
1445
+ method = transcoded_request["method"]
1446
+ try:
1447
+ request_payload = json_format.MessageToJson(request)
1448
+ except:
1449
+ request_payload = None
1450
+ http_request = {
1451
+ "payload": request_payload,
1452
+ "requestMethod": method,
1453
+ "requestUrl": request_url,
1454
+ "headers": dict(metadata),
1455
+ }
1456
+ _LOGGER.debug(
1457
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.CancelOperation",
1458
+ extra={
1459
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1460
+ "rpcName": "CancelOperation",
1461
+ "httpRequest": http_request,
1462
+ "metadata": http_request["headers"],
1463
+ },
1464
+ )
1465
+
1466
+ # Send the request
1467
+ response = EvaluationServiceRestTransport._CancelOperation._get_response(
1468
+ self._host,
1469
+ metadata,
1470
+ query_params,
1471
+ self._session,
1472
+ timeout,
1473
+ transcoded_request,
1474
+ )
1475
+
1476
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1477
+ # subclass.
1478
+ if response.status_code >= 400:
1479
+ raise core_exceptions.from_http_response(response)
1480
+
1481
+ return self._interceptor.post_cancel_operation(None)
1482
+
1483
+ @property
1484
+ def delete_operation(self):
1485
+ return self._DeleteOperation(self._session, self._host, self._interceptor) # type: ignore
1486
+
1487
+ class _DeleteOperation(
1488
+ _BaseEvaluationServiceRestTransport._BaseDeleteOperation,
1489
+ EvaluationServiceRestStub,
1490
+ ):
1491
+ def __hash__(self):
1492
+ return hash("EvaluationServiceRestTransport.DeleteOperation")
1493
+
1494
+ @staticmethod
1495
+ def _get_response(
1496
+ host,
1497
+ metadata,
1498
+ query_params,
1499
+ session,
1500
+ timeout,
1501
+ transcoded_request,
1502
+ body=None,
1503
+ ):
1504
+
1505
+ uri = transcoded_request["uri"]
1506
+ method = transcoded_request["method"]
1507
+ headers = dict(metadata)
1508
+ headers["Content-Type"] = "application/json"
1509
+ response = getattr(session, method)(
1510
+ "{host}{uri}".format(host=host, uri=uri),
1511
+ timeout=timeout,
1512
+ headers=headers,
1513
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1514
+ )
1515
+ return response
1516
+
1517
+ def __call__(
1518
+ self,
1519
+ request: operations_pb2.DeleteOperationRequest,
1520
+ *,
1521
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1522
+ timeout: Optional[float] = None,
1523
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1524
+ ) -> None:
1525
+ r"""Call the delete operation method over HTTP.
1526
+
1527
+ Args:
1528
+ request (operations_pb2.DeleteOperationRequest):
1529
+ The request object for DeleteOperation method.
1530
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1531
+ should be retried.
1532
+ timeout (float): The timeout for this request.
1533
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1534
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1535
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1536
+ be of type `bytes`.
1537
+ """
1538
+
1539
+ http_options = (
1540
+ _BaseEvaluationServiceRestTransport._BaseDeleteOperation._get_http_options()
1541
+ )
1542
+
1543
+ request, metadata = self._interceptor.pre_delete_operation(
1544
+ request, metadata
1545
+ )
1546
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseDeleteOperation._get_transcoded_request(
1547
+ http_options, request
1548
+ )
1549
+
1550
+ # Jsonify the query params
1551
+ query_params = _BaseEvaluationServiceRestTransport._BaseDeleteOperation._get_query_params_json(
1552
+ transcoded_request
1553
+ )
1554
+
1555
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1556
+ logging.DEBUG
1557
+ ): # pragma: NO COVER
1558
+ request_url = "{host}{uri}".format(
1559
+ host=self._host, uri=transcoded_request["uri"]
1560
+ )
1561
+ method = transcoded_request["method"]
1562
+ try:
1563
+ request_payload = json_format.MessageToJson(request)
1564
+ except:
1565
+ request_payload = None
1566
+ http_request = {
1567
+ "payload": request_payload,
1568
+ "requestMethod": method,
1569
+ "requestUrl": request_url,
1570
+ "headers": dict(metadata),
1571
+ }
1572
+ _LOGGER.debug(
1573
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.DeleteOperation",
1574
+ extra={
1575
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1576
+ "rpcName": "DeleteOperation",
1577
+ "httpRequest": http_request,
1578
+ "metadata": http_request["headers"],
1579
+ },
1580
+ )
1581
+
1582
+ # Send the request
1583
+ response = EvaluationServiceRestTransport._DeleteOperation._get_response(
1584
+ self._host,
1585
+ metadata,
1586
+ query_params,
1587
+ self._session,
1588
+ timeout,
1589
+ transcoded_request,
1590
+ )
1591
+
1592
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1593
+ # subclass.
1594
+ if response.status_code >= 400:
1595
+ raise core_exceptions.from_http_response(response)
1596
+
1597
+ return self._interceptor.post_delete_operation(None)
1598
+
1599
+ @property
1600
+ def get_operation(self):
1601
+ return self._GetOperation(self._session, self._host, self._interceptor) # type: ignore
1602
+
1603
+ class _GetOperation(
1604
+ _BaseEvaluationServiceRestTransport._BaseGetOperation, EvaluationServiceRestStub
1605
+ ):
1606
+ def __hash__(self):
1607
+ return hash("EvaluationServiceRestTransport.GetOperation")
1608
+
1609
+ @staticmethod
1610
+ def _get_response(
1611
+ host,
1612
+ metadata,
1613
+ query_params,
1614
+ session,
1615
+ timeout,
1616
+ transcoded_request,
1617
+ body=None,
1618
+ ):
1619
+
1620
+ uri = transcoded_request["uri"]
1621
+ method = transcoded_request["method"]
1622
+ headers = dict(metadata)
1623
+ headers["Content-Type"] = "application/json"
1624
+ response = getattr(session, method)(
1625
+ "{host}{uri}".format(host=host, uri=uri),
1626
+ timeout=timeout,
1627
+ headers=headers,
1628
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1629
+ )
1630
+ return response
1631
+
1632
+ def __call__(
1633
+ self,
1634
+ request: operations_pb2.GetOperationRequest,
1635
+ *,
1636
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1637
+ timeout: Optional[float] = None,
1638
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1639
+ ) -> operations_pb2.Operation:
1640
+ r"""Call the get operation method over HTTP.
1641
+
1642
+ Args:
1643
+ request (operations_pb2.GetOperationRequest):
1644
+ The request object for GetOperation method.
1645
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1646
+ should be retried.
1647
+ timeout (float): The timeout for this request.
1648
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1649
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1650
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1651
+ be of type `bytes`.
1652
+
1653
+ Returns:
1654
+ operations_pb2.Operation: Response from GetOperation method.
1655
+ """
1656
+
1657
+ http_options = (
1658
+ _BaseEvaluationServiceRestTransport._BaseGetOperation._get_http_options()
1659
+ )
1660
+
1661
+ request, metadata = self._interceptor.pre_get_operation(request, metadata)
1662
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseGetOperation._get_transcoded_request(
1663
+ http_options, request
1664
+ )
1665
+
1666
+ # Jsonify the query params
1667
+ query_params = _BaseEvaluationServiceRestTransport._BaseGetOperation._get_query_params_json(
1668
+ transcoded_request
1669
+ )
1670
+
1671
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1672
+ logging.DEBUG
1673
+ ): # pragma: NO COVER
1674
+ request_url = "{host}{uri}".format(
1675
+ host=self._host, uri=transcoded_request["uri"]
1676
+ )
1677
+ method = transcoded_request["method"]
1678
+ try:
1679
+ request_payload = json_format.MessageToJson(request)
1680
+ except:
1681
+ request_payload = None
1682
+ http_request = {
1683
+ "payload": request_payload,
1684
+ "requestMethod": method,
1685
+ "requestUrl": request_url,
1686
+ "headers": dict(metadata),
1687
+ }
1688
+ _LOGGER.debug(
1689
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.GetOperation",
1690
+ extra={
1691
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1692
+ "rpcName": "GetOperation",
1693
+ "httpRequest": http_request,
1694
+ "metadata": http_request["headers"],
1695
+ },
1696
+ )
1697
+
1698
+ # Send the request
1699
+ response = EvaluationServiceRestTransport._GetOperation._get_response(
1700
+ self._host,
1701
+ metadata,
1702
+ query_params,
1703
+ self._session,
1704
+ timeout,
1705
+ transcoded_request,
1706
+ )
1707
+
1708
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1709
+ # subclass.
1710
+ if response.status_code >= 400:
1711
+ raise core_exceptions.from_http_response(response)
1712
+
1713
+ content = response.content.decode("utf-8")
1714
+ resp = operations_pb2.Operation()
1715
+ resp = json_format.Parse(content, resp)
1716
+ resp = self._interceptor.post_get_operation(resp)
1717
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1718
+ logging.DEBUG
1719
+ ): # pragma: NO COVER
1720
+ try:
1721
+ response_payload = json_format.MessageToJson(resp)
1722
+ except:
1723
+ response_payload = None
1724
+ http_response = {
1725
+ "payload": response_payload,
1726
+ "headers": dict(response.headers),
1727
+ "status": response.status_code,
1728
+ }
1729
+ _LOGGER.debug(
1730
+ "Received response for google.cloud.aiplatform_v1.EvaluationServiceAsyncClient.GetOperation",
1731
+ extra={
1732
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1733
+ "rpcName": "GetOperation",
1734
+ "httpResponse": http_response,
1735
+ "metadata": http_response["headers"],
1736
+ },
1737
+ )
1738
+ return resp
1739
+
1740
+ @property
1741
+ def list_operations(self):
1742
+ return self._ListOperations(self._session, self._host, self._interceptor) # type: ignore
1743
+
1744
+ class _ListOperations(
1745
+ _BaseEvaluationServiceRestTransport._BaseListOperations,
1746
+ EvaluationServiceRestStub,
1747
+ ):
1748
+ def __hash__(self):
1749
+ return hash("EvaluationServiceRestTransport.ListOperations")
1750
+
1751
+ @staticmethod
1752
+ def _get_response(
1753
+ host,
1754
+ metadata,
1755
+ query_params,
1756
+ session,
1757
+ timeout,
1758
+ transcoded_request,
1759
+ body=None,
1760
+ ):
1761
+
1762
+ uri = transcoded_request["uri"]
1763
+ method = transcoded_request["method"]
1764
+ headers = dict(metadata)
1765
+ headers["Content-Type"] = "application/json"
1766
+ response = getattr(session, method)(
1767
+ "{host}{uri}".format(host=host, uri=uri),
1768
+ timeout=timeout,
1769
+ headers=headers,
1770
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1771
+ )
1772
+ return response
1773
+
1774
+ def __call__(
1775
+ self,
1776
+ request: operations_pb2.ListOperationsRequest,
1777
+ *,
1778
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1779
+ timeout: Optional[float] = None,
1780
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1781
+ ) -> operations_pb2.ListOperationsResponse:
1782
+ r"""Call the list operations method over HTTP.
1783
+
1784
+ Args:
1785
+ request (operations_pb2.ListOperationsRequest):
1786
+ The request object for ListOperations method.
1787
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1788
+ should be retried.
1789
+ timeout (float): The timeout for this request.
1790
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1791
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1792
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1793
+ be of type `bytes`.
1794
+
1795
+ Returns:
1796
+ operations_pb2.ListOperationsResponse: Response from ListOperations method.
1797
+ """
1798
+
1799
+ http_options = (
1800
+ _BaseEvaluationServiceRestTransport._BaseListOperations._get_http_options()
1801
+ )
1802
+
1803
+ request, metadata = self._interceptor.pre_list_operations(request, metadata)
1804
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseListOperations._get_transcoded_request(
1805
+ http_options, request
1806
+ )
1807
+
1808
+ # Jsonify the query params
1809
+ query_params = _BaseEvaluationServiceRestTransport._BaseListOperations._get_query_params_json(
1810
+ transcoded_request
1811
+ )
1812
+
1813
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1814
+ logging.DEBUG
1815
+ ): # pragma: NO COVER
1816
+ request_url = "{host}{uri}".format(
1817
+ host=self._host, uri=transcoded_request["uri"]
1818
+ )
1819
+ method = transcoded_request["method"]
1820
+ try:
1821
+ request_payload = json_format.MessageToJson(request)
1822
+ except:
1823
+ request_payload = None
1824
+ http_request = {
1825
+ "payload": request_payload,
1826
+ "requestMethod": method,
1827
+ "requestUrl": request_url,
1828
+ "headers": dict(metadata),
1829
+ }
1830
+ _LOGGER.debug(
1831
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.ListOperations",
1832
+ extra={
1833
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1834
+ "rpcName": "ListOperations",
1835
+ "httpRequest": http_request,
1836
+ "metadata": http_request["headers"],
1837
+ },
1838
+ )
1839
+
1840
+ # Send the request
1841
+ response = EvaluationServiceRestTransport._ListOperations._get_response(
1842
+ self._host,
1843
+ metadata,
1844
+ query_params,
1845
+ self._session,
1846
+ timeout,
1847
+ transcoded_request,
1848
+ )
1849
+
1850
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1851
+ # subclass.
1852
+ if response.status_code >= 400:
1853
+ raise core_exceptions.from_http_response(response)
1854
+
1855
+ content = response.content.decode("utf-8")
1856
+ resp = operations_pb2.ListOperationsResponse()
1857
+ resp = json_format.Parse(content, resp)
1858
+ resp = self._interceptor.post_list_operations(resp)
1859
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1860
+ logging.DEBUG
1861
+ ): # pragma: NO COVER
1862
+ try:
1863
+ response_payload = json_format.MessageToJson(resp)
1864
+ except:
1865
+ response_payload = None
1866
+ http_response = {
1867
+ "payload": response_payload,
1868
+ "headers": dict(response.headers),
1869
+ "status": response.status_code,
1870
+ }
1871
+ _LOGGER.debug(
1872
+ "Received response for google.cloud.aiplatform_v1.EvaluationServiceAsyncClient.ListOperations",
1873
+ extra={
1874
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1875
+ "rpcName": "ListOperations",
1876
+ "httpResponse": http_response,
1877
+ "metadata": http_response["headers"],
1878
+ },
1879
+ )
1880
+ return resp
1881
+
1882
+ @property
1883
+ def wait_operation(self):
1884
+ return self._WaitOperation(self._session, self._host, self._interceptor) # type: ignore
1885
+
1886
+ class _WaitOperation(
1887
+ _BaseEvaluationServiceRestTransport._BaseWaitOperation,
1888
+ EvaluationServiceRestStub,
1889
+ ):
1890
+ def __hash__(self):
1891
+ return hash("EvaluationServiceRestTransport.WaitOperation")
1892
+
1893
+ @staticmethod
1894
+ def _get_response(
1895
+ host,
1896
+ metadata,
1897
+ query_params,
1898
+ session,
1899
+ timeout,
1900
+ transcoded_request,
1901
+ body=None,
1902
+ ):
1903
+
1904
+ uri = transcoded_request["uri"]
1905
+ method = transcoded_request["method"]
1906
+ headers = dict(metadata)
1907
+ headers["Content-Type"] = "application/json"
1908
+ response = getattr(session, method)(
1909
+ "{host}{uri}".format(host=host, uri=uri),
1910
+ timeout=timeout,
1911
+ headers=headers,
1912
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
1913
+ )
1914
+ return response
1915
+
1916
+ def __call__(
1917
+ self,
1918
+ request: operations_pb2.WaitOperationRequest,
1919
+ *,
1920
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1921
+ timeout: Optional[float] = None,
1922
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1923
+ ) -> operations_pb2.Operation:
1924
+ r"""Call the wait operation method over HTTP.
1925
+
1926
+ Args:
1927
+ request (operations_pb2.WaitOperationRequest):
1928
+ The request object for WaitOperation method.
1929
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
1930
+ should be retried.
1931
+ timeout (float): The timeout for this request.
1932
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1933
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1934
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1935
+ be of type `bytes`.
1936
+
1937
+ Returns:
1938
+ operations_pb2.Operation: Response from WaitOperation method.
1939
+ """
1940
+
1941
+ http_options = (
1942
+ _BaseEvaluationServiceRestTransport._BaseWaitOperation._get_http_options()
1943
+ )
1944
+
1945
+ request, metadata = self._interceptor.pre_wait_operation(request, metadata)
1946
+ transcoded_request = _BaseEvaluationServiceRestTransport._BaseWaitOperation._get_transcoded_request(
1947
+ http_options, request
1948
+ )
1949
+
1950
+ # Jsonify the query params
1951
+ query_params = _BaseEvaluationServiceRestTransport._BaseWaitOperation._get_query_params_json(
1952
+ transcoded_request
1953
+ )
1954
+
1955
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
1956
+ logging.DEBUG
1957
+ ): # pragma: NO COVER
1958
+ request_url = "{host}{uri}".format(
1959
+ host=self._host, uri=transcoded_request["uri"]
1960
+ )
1961
+ method = transcoded_request["method"]
1962
+ try:
1963
+ request_payload = json_format.MessageToJson(request)
1964
+ except:
1965
+ request_payload = None
1966
+ http_request = {
1967
+ "payload": request_payload,
1968
+ "requestMethod": method,
1969
+ "requestUrl": request_url,
1970
+ "headers": dict(metadata),
1971
+ }
1972
+ _LOGGER.debug(
1973
+ f"Sending request for google.cloud.aiplatform_v1.EvaluationServiceClient.WaitOperation",
1974
+ extra={
1975
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
1976
+ "rpcName": "WaitOperation",
1977
+ "httpRequest": http_request,
1978
+ "metadata": http_request["headers"],
1979
+ },
1980
+ )
1981
+
1982
+ # Send the request
1983
+ response = EvaluationServiceRestTransport._WaitOperation._get_response(
1984
+ self._host,
1985
+ metadata,
1986
+ query_params,
1987
+ self._session,
1988
+ timeout,
1989
+ transcoded_request,
1990
+ )
1991
+
1992
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
1993
+ # subclass.
1994
+ if response.status_code >= 400:
1995
+ raise core_exceptions.from_http_response(response)
1996
+
1997
+ content = response.content.decode("utf-8")
1998
+ resp = operations_pb2.Operation()
1999
+ resp = json_format.Parse(content, resp)
2000
+ resp = self._interceptor.post_wait_operation(resp)
2001
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
2002
+ logging.DEBUG
2003
+ ): # pragma: NO COVER
2004
+ try:
2005
+ response_payload = json_format.MessageToJson(resp)
2006
+ except:
2007
+ response_payload = None
2008
+ http_response = {
2009
+ "payload": response_payload,
2010
+ "headers": dict(response.headers),
2011
+ "status": response.status_code,
2012
+ }
2013
+ _LOGGER.debug(
2014
+ "Received response for google.cloud.aiplatform_v1.EvaluationServiceAsyncClient.WaitOperation",
2015
+ extra={
2016
+ "serviceName": "google.cloud.aiplatform.v1.EvaluationService",
2017
+ "rpcName": "WaitOperation",
2018
+ "httpResponse": http_response,
2019
+ "metadata": http_response["headers"],
2020
+ },
2021
+ )
2022
+ return resp
2023
+
2024
+ @property
2025
+ def kind(self) -> str:
2026
+ return "rest"
2027
+
2028
+ def close(self):
2029
+ self._session.close()
2030
+
2031
+
2032
+ __all__ = ("EvaluationServiceRestTransport",)