Skip to content

Commit 3cb050e

Browse files
feat: add a v1 UpdateEndpointLongRunning API
PiperOrigin-RevId: 697715678 Source-Link: googleapis/googleapis@4ab02f3 Source-Link: googleapis/googleapis-gen@829605e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODI5NjA1ZTE2ZGVlMWQ4ZDc5NWQ0ZGVhNDViNGMxMmQ4ZDk4M2ExYyJ9
1 parent 5798569 commit 3cb050e

21 files changed

+1762
-23
lines changed

owl-bot-staging/v1/google/cloud/aiplatform/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163
from google.cloud.aiplatform_v1.types.deployment_resource_pool_service import UpdateDeploymentResourcePoolOperationMetadata
164164
from google.cloud.aiplatform_v1.types.deployment_resource_pool_service import UpdateDeploymentResourcePoolRequest
165165
from google.cloud.aiplatform_v1.types.encryption_spec import EncryptionSpec
166+
from google.cloud.aiplatform_v1.types.endpoint import ClientConnectionConfig
166167
from google.cloud.aiplatform_v1.types.endpoint import DeployedModel
167168
from google.cloud.aiplatform_v1.types.endpoint import Endpoint
168169
from google.cloud.aiplatform_v1.types.endpoint import FasterDeploymentConfig
@@ -183,6 +184,8 @@
183184
from google.cloud.aiplatform_v1.types.endpoint_service import UndeployModelOperationMetadata
184185
from google.cloud.aiplatform_v1.types.endpoint_service import UndeployModelRequest
185186
from google.cloud.aiplatform_v1.types.endpoint_service import UndeployModelResponse
187+
from google.cloud.aiplatform_v1.types.endpoint_service import UpdateEndpointLongRunningRequest
188+
from google.cloud.aiplatform_v1.types.endpoint_service import UpdateEndpointOperationMetadata
186189
from google.cloud.aiplatform_v1.types.endpoint_service import UpdateEndpointRequest
187190
from google.cloud.aiplatform_v1.types.entity_type import EntityType
188191
from google.cloud.aiplatform_v1.types.env_var import EnvVar
@@ -1048,6 +1051,7 @@
10481051
'UpdateDeploymentResourcePoolOperationMetadata',
10491052
'UpdateDeploymentResourcePoolRequest',
10501053
'EncryptionSpec',
1054+
'ClientConnectionConfig',
10511055
'DeployedModel',
10521056
'Endpoint',
10531057
'FasterDeploymentConfig',
@@ -1068,6 +1072,8 @@
10681072
'UndeployModelOperationMetadata',
10691073
'UndeployModelRequest',
10701074
'UndeployModelResponse',
1075+
'UpdateEndpointLongRunningRequest',
1076+
'UpdateEndpointOperationMetadata',
10711077
'UpdateEndpointRequest',
10721078
'EntityType',
10731079
'EnvVar',

owl-bot-staging/v1/google/cloud/aiplatform_v1/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163
from .types.deployment_resource_pool_service import UpdateDeploymentResourcePoolOperationMetadata
164164
from .types.deployment_resource_pool_service import UpdateDeploymentResourcePoolRequest
165165
from .types.encryption_spec import EncryptionSpec
166+
from .types.endpoint import ClientConnectionConfig
166167
from .types.endpoint import DeployedModel
167168
from .types.endpoint import Endpoint
168169
from .types.endpoint import FasterDeploymentConfig
@@ -183,6 +184,8 @@
183184
from .types.endpoint_service import UndeployModelOperationMetadata
184185
from .types.endpoint_service import UndeployModelRequest
185186
from .types.endpoint_service import UndeployModelResponse
187+
from .types.endpoint_service import UpdateEndpointLongRunningRequest
188+
from .types.endpoint_service import UpdateEndpointOperationMetadata
186189
from .types.endpoint_service import UpdateEndpointRequest
187190
from .types.entity_type import EntityType
188191
from .types.env_var import EnvVar
@@ -1000,6 +1003,7 @@
10001003
'CheckTrialEarlyStoppingStateResponse',
10011004
'Citation',
10021005
'CitationMetadata',
1006+
'ClientConnectionConfig',
10031007
'CoherenceInput',
10041008
'CoherenceInstance',
10051009
'CoherenceResult',
@@ -1734,6 +1738,8 @@
17341738
'UpdateDatasetVersionRequest',
17351739
'UpdateDeploymentResourcePoolOperationMetadata',
17361740
'UpdateDeploymentResourcePoolRequest',
1741+
'UpdateEndpointLongRunningRequest',
1742+
'UpdateEndpointOperationMetadata',
17371743
'UpdateEndpointRequest',
17381744
'UpdateEntityTypeRequest',
17391745
'UpdateExecutionRequest',

owl-bot-staging/v1/google/cloud/aiplatform_v1/gapic_metadata.json

+15
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,11 @@
462462
"methods": [
463463
"update_endpoint"
464464
]
465+
},
466+
"UpdateEndpointLongRunning": {
467+
"methods": [
468+
"update_endpoint_long_running"
469+
]
465470
}
466471
}
467472
},
@@ -507,6 +512,11 @@
507512
"methods": [
508513
"update_endpoint"
509514
]
515+
},
516+
"UpdateEndpointLongRunning": {
517+
"methods": [
518+
"update_endpoint_long_running"
519+
]
510520
}
511521
}
512522
},
@@ -552,6 +562,11 @@
552562
"methods": [
553563
"update_endpoint"
554564
]
565+
},
566+
"UpdateEndpointLongRunning": {
567+
"methods": [
568+
"update_endpoint_long_running"
569+
]
555570
}
556571
}
557572
}

owl-bot-staging/v1/google/cloud/aiplatform_v1/services/endpoint_service/async_client.py

+122
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,128 @@ async def sample_update_endpoint():
744744
# Done; return the response.
745745
return response
746746

747+
async def update_endpoint_long_running(self,
748+
request: Optional[Union[endpoint_service.UpdateEndpointLongRunningRequest, dict]] = None,
749+
*,
750+
endpoint: Optional[gca_endpoint.Endpoint] = None,
751+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
752+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
753+
metadata: Sequence[Tuple[str, str]] = (),
754+
) -> operation_async.AsyncOperation:
755+
r"""Updates an Endpoint with a long running operation.
756+
757+
.. code-block:: python
758+
759+
# This snippet has been automatically generated and should be regarded as a
760+
# code template only.
761+
# It will require modifications to work:
762+
# - It may require correct/in-range values for request initialization.
763+
# - It may require specifying regional endpoints when creating the service
764+
# client as shown in:
765+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
766+
from google.cloud import aiplatform_v1
767+
768+
async def sample_update_endpoint_long_running():
769+
# Create a client
770+
client = aiplatform_v1.EndpointServiceAsyncClient()
771+
772+
# Initialize request argument(s)
773+
endpoint = aiplatform_v1.Endpoint()
774+
endpoint.display_name = "display_name_value"
775+
776+
request = aiplatform_v1.UpdateEndpointLongRunningRequest(
777+
endpoint=endpoint,
778+
)
779+
780+
# Make the request
781+
operation = client.update_endpoint_long_running(request=request)
782+
783+
print("Waiting for operation to complete...")
784+
785+
response = (await operation).result()
786+
787+
# Handle the response
788+
print(response)
789+
790+
Args:
791+
request (Optional[Union[google.cloud.aiplatform_v1.types.UpdateEndpointLongRunningRequest, dict]]):
792+
The request object. Request message for
793+
[EndpointService.UpdateEndpointLongRunning][google.cloud.aiplatform.v1.EndpointService.UpdateEndpointLongRunning].
794+
endpoint (:class:`google.cloud.aiplatform_v1.types.Endpoint`):
795+
Required. The Endpoint which replaces the resource on
796+
the server. Currently we only support updating the
797+
``client_connection_config`` field, all the other
798+
fields' update will be blocked.
799+
800+
This corresponds to the ``endpoint`` field
801+
on the ``request`` instance; if ``request`` is provided, this
802+
should not be set.
803+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
804+
should be retried.
805+
timeout (float): The timeout for this request.
806+
metadata (Sequence[Tuple[str, str]]): Strings which should be
807+
sent along with the request as metadata.
808+
809+
Returns:
810+
google.api_core.operation_async.AsyncOperation:
811+
An object representing a long-running operation.
812+
813+
The result type for the operation will be :class:`google.cloud.aiplatform_v1.types.Endpoint` Models are deployed into it, and afterwards Endpoint is called to obtain
814+
predictions and explanations.
815+
816+
"""
817+
# Create or coerce a protobuf request object.
818+
# - Quick check: If we got a request object, we should *not* have
819+
# gotten any keyword arguments that map to the request.
820+
has_flattened_params = any([endpoint])
821+
if request is not None and has_flattened_params:
822+
raise ValueError("If the `request` argument is set, then none of "
823+
"the individual field arguments should be set.")
824+
825+
# - Use the request object if provided (there's no risk of modifying the input as
826+
# there are no flattened fields), or create one.
827+
if not isinstance(request, endpoint_service.UpdateEndpointLongRunningRequest):
828+
request = endpoint_service.UpdateEndpointLongRunningRequest(request)
829+
830+
# If we have keyword arguments corresponding to fields on the
831+
# request, apply these.
832+
if endpoint is not None:
833+
request.endpoint = endpoint
834+
835+
# Wrap the RPC method; this adds retry and timeout information,
836+
# and friendly error handling.
837+
rpc = self._client._transport._wrapped_methods[self._client._transport.update_endpoint_long_running]
838+
839+
# Certain fields should be provided within the metadata header;
840+
# add these here.
841+
metadata = tuple(metadata) + (
842+
gapic_v1.routing_header.to_grpc_metadata((
843+
("endpoint.name", request.endpoint.name),
844+
)),
845+
)
846+
847+
# Validate the universe domain.
848+
self._client._validate_universe_domain()
849+
850+
# Send the request.
851+
response = await rpc(
852+
request,
853+
retry=retry,
854+
timeout=timeout,
855+
metadata=metadata,
856+
)
857+
858+
# Wrap the response in an operation future.
859+
response = operation_async.from_gapic(
860+
response,
861+
self._client._transport.operations_client,
862+
gca_endpoint.Endpoint,
863+
metadata_type=endpoint_service.UpdateEndpointOperationMetadata,
864+
)
865+
866+
# Done; return the response.
867+
return response
868+
747869
async def delete_endpoint(self,
748870
request: Optional[Union[endpoint_service.DeleteEndpointRequest, dict]] = None,
749871
*,

owl-bot-staging/v1/google/cloud/aiplatform_v1/services/endpoint_service/client.py

+121
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,127 @@ def sample_update_endpoint():
11341134
# Done; return the response.
11351135
return response
11361136

1137+
def update_endpoint_long_running(self,
1138+
request: Optional[Union[endpoint_service.UpdateEndpointLongRunningRequest, dict]] = None,
1139+
*,
1140+
endpoint: Optional[gca_endpoint.Endpoint] = None,
1141+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1142+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1143+
metadata: Sequence[Tuple[str, str]] = (),
1144+
) -> gac_operation.Operation:
1145+
r"""Updates an Endpoint with a long running operation.
1146+
1147+
.. code-block:: python
1148+
1149+
# This snippet has been automatically generated and should be regarded as a
1150+
# code template only.
1151+
# It will require modifications to work:
1152+
# - It may require correct/in-range values for request initialization.
1153+
# - It may require specifying regional endpoints when creating the service
1154+
# client as shown in:
1155+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1156+
from google.cloud import aiplatform_v1
1157+
1158+
def sample_update_endpoint_long_running():
1159+
# Create a client
1160+
client = aiplatform_v1.EndpointServiceClient()
1161+
1162+
# Initialize request argument(s)
1163+
endpoint = aiplatform_v1.Endpoint()
1164+
endpoint.display_name = "display_name_value"
1165+
1166+
request = aiplatform_v1.UpdateEndpointLongRunningRequest(
1167+
endpoint=endpoint,
1168+
)
1169+
1170+
# Make the request
1171+
operation = client.update_endpoint_long_running(request=request)
1172+
1173+
print("Waiting for operation to complete...")
1174+
1175+
response = operation.result()
1176+
1177+
# Handle the response
1178+
print(response)
1179+
1180+
Args:
1181+
request (Union[google.cloud.aiplatform_v1.types.UpdateEndpointLongRunningRequest, dict]):
1182+
The request object. Request message for
1183+
[EndpointService.UpdateEndpointLongRunning][google.cloud.aiplatform.v1.EndpointService.UpdateEndpointLongRunning].
1184+
endpoint (google.cloud.aiplatform_v1.types.Endpoint):
1185+
Required. The Endpoint which replaces the resource on
1186+
the server. Currently we only support updating the
1187+
``client_connection_config`` field, all the other
1188+
fields' update will be blocked.
1189+
1190+
This corresponds to the ``endpoint`` field
1191+
on the ``request`` instance; if ``request`` is provided, this
1192+
should not be set.
1193+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1194+
should be retried.
1195+
timeout (float): The timeout for this request.
1196+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1197+
sent along with the request as metadata.
1198+
1199+
Returns:
1200+
google.api_core.operation.Operation:
1201+
An object representing a long-running operation.
1202+
1203+
The result type for the operation will be :class:`google.cloud.aiplatform_v1.types.Endpoint` Models are deployed into it, and afterwards Endpoint is called to obtain
1204+
predictions and explanations.
1205+
1206+
"""
1207+
# Create or coerce a protobuf request object.
1208+
# - Quick check: If we got a request object, we should *not* have
1209+
# gotten any keyword arguments that map to the request.
1210+
has_flattened_params = any([endpoint])
1211+
if request is not None and has_flattened_params:
1212+
raise ValueError('If the `request` argument is set, then none of '
1213+
'the individual field arguments should be set.')
1214+
1215+
# - Use the request object if provided (there's no risk of modifying the input as
1216+
# there are no flattened fields), or create one.
1217+
if not isinstance(request, endpoint_service.UpdateEndpointLongRunningRequest):
1218+
request = endpoint_service.UpdateEndpointLongRunningRequest(request)
1219+
# If we have keyword arguments corresponding to fields on the
1220+
# request, apply these.
1221+
if endpoint is not None:
1222+
request.endpoint = endpoint
1223+
1224+
# Wrap the RPC method; this adds retry and timeout information,
1225+
# and friendly error handling.
1226+
rpc = self._transport._wrapped_methods[self._transport.update_endpoint_long_running]
1227+
1228+
# Certain fields should be provided within the metadata header;
1229+
# add these here.
1230+
metadata = tuple(metadata) + (
1231+
gapic_v1.routing_header.to_grpc_metadata((
1232+
("endpoint.name", request.endpoint.name),
1233+
)),
1234+
)
1235+
1236+
# Validate the universe domain.
1237+
self._validate_universe_domain()
1238+
1239+
# Send the request.
1240+
response = rpc(
1241+
request,
1242+
retry=retry,
1243+
timeout=timeout,
1244+
metadata=metadata,
1245+
)
1246+
1247+
# Wrap the response in an operation future.
1248+
response = gac_operation.from_gapic(
1249+
response,
1250+
self._transport.operations_client,
1251+
gca_endpoint.Endpoint,
1252+
metadata_type=endpoint_service.UpdateEndpointOperationMetadata,
1253+
)
1254+
1255+
# Done; return the response.
1256+
return response
1257+
11371258
def delete_endpoint(self,
11381259
request: Optional[Union[endpoint_service.DeleteEndpointRequest, dict]] = None,
11391260
*,

owl-bot-staging/v1/google/cloud/aiplatform_v1/services/endpoint_service/transports/base.py

+14
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ def _prep_wrapped_messages(self, client_info):
146146
default_timeout=None,
147147
client_info=client_info,
148148
),
149+
self.update_endpoint_long_running: gapic_v1.method.wrap_method(
150+
self.update_endpoint_long_running,
151+
default_timeout=None,
152+
client_info=client_info,
153+
),
149154
self.delete_endpoint: gapic_v1.method.wrap_method(
150155
self.delete_endpoint,
151156
default_timeout=None,
@@ -268,6 +273,15 @@ def update_endpoint(self) -> Callable[
268273
]]:
269274
raise NotImplementedError()
270275

276+
@property
277+
def update_endpoint_long_running(self) -> Callable[
278+
[endpoint_service.UpdateEndpointLongRunningRequest],
279+
Union[
280+
operations_pb2.Operation,
281+
Awaitable[operations_pb2.Operation]
282+
]]:
283+
raise NotImplementedError()
284+
271285
@property
272286
def delete_endpoint(self) -> Callable[
273287
[endpoint_service.DeleteEndpointRequest],

0 commit comments

Comments
 (0)