Skip to content

chore: Update gapic-generator-python to v1.22.1 #4950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions google/cloud/aiplatform_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,12 @@
from .types.model_service import ListModelEvaluationsResponse
from .types.model_service import ListModelsRequest
from .types.model_service import ListModelsResponse
from .types.model_service import ListModelVersionCheckpointsRequest
from .types.model_service import ListModelVersionCheckpointsResponse
from .types.model_service import ListModelVersionsRequest
from .types.model_service import ListModelVersionsResponse
from .types.model_service import MergeVersionAliasesRequest
from .types.model_service import ModelVersionCheckpoint
from .types.model_service import UpdateExplanationDatasetOperationMetadata
from .types.model_service import UpdateExplanationDatasetRequest
from .types.model_service import UpdateExplanationDatasetResponse
Expand Down Expand Up @@ -755,6 +758,8 @@
from .types.notebook_service import UpgradeNotebookRuntimeRequest
from .types.notebook_service import UpgradeNotebookRuntimeResponse
from .types.notebook_service import NotebookExecutionJobView
from .types.notebook_software_config import NotebookSoftwareConfig
from .types.notebook_software_config import PostStartupScriptConfig
from .types.openapi import Schema
from .types.openapi import Type
from .types.operation import DeleteOperationMetadata
Expand Down Expand Up @@ -1534,6 +1539,8 @@
"ListModelEvaluationSlicesResponse",
"ListModelEvaluationsRequest",
"ListModelEvaluationsResponse",
"ListModelVersionCheckpointsRequest",
"ListModelVersionCheckpointsResponse",
"ListModelVersionsRequest",
"ListModelVersionsResponse",
"ListModelsRequest",
Expand Down Expand Up @@ -1620,6 +1627,7 @@
"ModelMonitoringStatsAnomalies",
"ModelServiceClient",
"ModelSourceInfo",
"ModelVersionCheckpoint",
"MutateDeployedIndexOperationMetadata",
"MutateDeployedIndexRequest",
"MutateDeployedIndexResponse",
Expand All @@ -1646,6 +1654,7 @@
"NotebookRuntimeTemplateRef",
"NotebookRuntimeType",
"NotebookServiceClient",
"NotebookSoftwareConfig",
"PSCAutomationConfig",
"PairwiseChoice",
"PairwiseMetricInput",
Expand Down Expand Up @@ -1679,6 +1688,7 @@
"PointwiseMetricResult",
"PointwiseMetricSpec",
"Port",
"PostStartupScriptConfig",
"PredefinedSplit",
"PredictRequest",
"PredictRequestResponseLoggingConfig",
Expand Down
15 changes: 15 additions & 0 deletions google/cloud/aiplatform_v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3191,6 +3191,11 @@
"list_model_evaluations"
]
},
"ListModelVersionCheckpoints": {
"methods": [
"list_model_version_checkpoints"
]
},
"ListModelVersions": {
"methods": [
"list_model_versions"
Expand Down Expand Up @@ -3286,6 +3291,11 @@
"list_model_evaluations"
]
},
"ListModelVersionCheckpoints": {
"methods": [
"list_model_version_checkpoints"
]
},
"ListModelVersions": {
"methods": [
"list_model_versions"
Expand Down Expand Up @@ -3381,6 +3391,11 @@
"list_model_evaluations"
]
},
"ListModelVersionCheckpoints": {
"methods": [
"list_model_version_checkpoints"
]
},
"ListModelVersions": {
"methods": [
"list_model_versions"
Expand Down
205 changes: 133 additions & 72 deletions google/cloud/aiplatform_v1/services/dataset_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# limitations under the License.
#
from collections import OrderedDict
from http import HTTPStatus
import json
import logging as std_logging
import os
import re
Expand Down Expand Up @@ -641,6 +643,33 @@ def _validate_universe_domain(self):
# NOTE (b/349488459): universe validation is disabled until further notice.
return True

def _add_cred_info_for_auth_errors(
self, error: core_exceptions.GoogleAPICallError
) -> None:
"""Adds credential info string to error details for 401/403/404 errors.

Args:
error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
"""
if error.code not in [
HTTPStatus.UNAUTHORIZED,
HTTPStatus.FORBIDDEN,
HTTPStatus.NOT_FOUND,
]:
return

cred = self._transport._credentials

# get_cred_info is only available in google-auth>=2.35.0
if not hasattr(cred, "get_cred_info"):
return

# ignore the type check since pypy test fails when get_cred_info
# is not available
cred_info = cred.get_cred_info() # type: ignore
if cred_info and hasattr(error._details, "append"):
error._details.append(json.dumps(cred_info))

@property
def api_endpoint(self):
"""Return the API endpoint used by the client instance.
Expand Down Expand Up @@ -3248,16 +3277,20 @@ def list_operations(
# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
try:
# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response
# Done; return the response.
return response
except core_exceptions.GoogleAPICallError as e:
self._add_cred_info_for_auth_errors(e)
raise e

def get_operation(
self,
Expand Down Expand Up @@ -3303,16 +3336,20 @@ def get_operation(
# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
try:
# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response
# Done; return the response.
return response
except core_exceptions.GoogleAPICallError as e:
self._add_cred_info_for_auth_errors(e)
raise e

def delete_operation(
self,
Expand Down Expand Up @@ -3475,16 +3512,20 @@ def wait_operation(
# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
try:
# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response
# Done; return the response.
return response
except core_exceptions.GoogleAPICallError as e:
self._add_cred_info_for_auth_errors(e)
raise e

def set_iam_policy(
self,
Expand Down Expand Up @@ -3596,16 +3637,20 @@ def set_iam_policy(
# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
try:
# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response
# Done; return the response.
return response
except core_exceptions.GoogleAPICallError as e:
self._add_cred_info_for_auth_errors(e)
raise e

def get_iam_policy(
self,
Expand Down Expand Up @@ -3718,16 +3763,20 @@ def get_iam_policy(
# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
try:
# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response
# Done; return the response.
return response
except core_exceptions.GoogleAPICallError as e:
self._add_cred_info_for_auth_errors(e)
raise e

def test_iam_permissions(
self,
Expand Down Expand Up @@ -3778,16 +3827,20 @@ def test_iam_permissions(
# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
try:
# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response
# Done; return the response.
return response
except core_exceptions.GoogleAPICallError as e:
self._add_cred_info_for_auth_errors(e)
raise e

def get_location(
self,
Expand Down Expand Up @@ -3833,16 +3886,20 @@ def get_location(
# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
try:
# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response
# Done; return the response.
return response
except core_exceptions.GoogleAPICallError as e:
self._add_cred_info_for_auth_errors(e)
raise e

def list_locations(
self,
Expand Down Expand Up @@ -3888,16 +3945,20 @@ def list_locations(
# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
try:
# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response
# Done; return the response.
return response
except core_exceptions.GoogleAPICallError as e:
self._add_cred_info_for_auth_errors(e)
raise e


DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
Expand Down
Loading