Skip to content

Commit a134461

Browse files
gcf-owl-bot[bot]copybara-github
authored andcommitted
Copybara import of the project:
-- 280338d by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: feat: add new FieldBehavior value IDENTIFIER PiperOrigin-RevId: 559119958 Source-Link: googleapis/googleapis@f5987af Source-Link: googleapis/googleapis-gen@cdecadd Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2RlY2FkZGNjNDI1NjU5ZDNmYzJlNDNjYWE4MjBiYTA2NzYwNzk2MSJ9 -- f23c426 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- 519e9c6 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: feat: add UpdatePersistentResourceRequest and add resource_pool_images and head_node_resource_pool_id to RaySpec PiperOrigin-RevId: 561051086 Source-Link: googleapis/googleapis@da9f0be Source-Link: googleapis/googleapis-gen@f7b6581 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjdiNjU4MWZlMzllNzNlZGE0MDcxOTE0Y2U4NTc2OGYyOWEyNTExMSJ9 -- 2d0c690 by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md -- fa277de by yinghsienwu <[email protected]>: revert files -- 66345d5 by yinghsienwu <[email protected]>: revert files COPYBARA_INTEGRATE_REVIEW=#2495 from googleapis:owl-bot-copy 66345d5 PiperOrigin-RevId: 562872013
1 parent 6566529 commit a134461

19 files changed

+986
-5
lines changed

.kokoro/samples/python3.10/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env_vars: {
1414
}
1515

1616
# Declare build specific Cloud project.
17-
env_vars: {
17+
env_vars: {
1818
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
1919
value: "ucaip-sample-tests"
2020
}

.kokoro/samples/python3.11/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env_vars: {
1414
}
1515

1616
# Declare build specific Cloud project.
17-
env_vars: {
17+
env_vars: {
1818
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
1919
value: "ucaip-sample-tests"
2020
}

.kokoro/samples/python3.7/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env_vars: {
1414
}
1515

1616
# Declare build specific Cloud project.
17-
env_vars: {
17+
env_vars: {
1818
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
1919
value: "ucaip-sample-tests"
2020
}

.kokoro/samples/python3.8/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env_vars: {
1414
}
1515

1616
# Declare build specific Cloud project.
17-
env_vars: {
17+
env_vars: {
1818
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
1919
value: "ucaip-sample-tests"
2020
}

.kokoro/samples/python3.9/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ env_vars: {
1414
}
1515

1616
# Declare build specific Cloud project.
17-
env_vars: {
17+
env_vars: {
1818
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
1919
value: "ucaip-sample-tests"
2020
}

google/cloud/aiplatform_v1beta1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@
479479
from .types.persistent_resource_service import GetPersistentResourceRequest
480480
from .types.persistent_resource_service import ListPersistentResourcesRequest
481481
from .types.persistent_resource_service import ListPersistentResourcesResponse
482+
from .types.persistent_resource_service import UpdatePersistentResourceOperationMetadata
483+
from .types.persistent_resource_service import UpdatePersistentResourceRequest
482484
from .types.pipeline_failure_policy import PipelineFailurePolicy
483485
from .types.pipeline_job import PipelineJob
484486
from .types.pipeline_job import PipelineJobDetail
@@ -1188,6 +1190,8 @@
11881190
"UpdateModelDeploymentMonitoringJobOperationMetadata",
11891191
"UpdateModelDeploymentMonitoringJobRequest",
11901192
"UpdateModelRequest",
1193+
"UpdatePersistentResourceOperationMetadata",
1194+
"UpdatePersistentResourceRequest",
11911195
"UpdateScheduleRequest",
11921196
"UpdateSpecialistPoolOperationMetadata",
11931197
"UpdateSpecialistPoolRequest",

google/cloud/aiplatform_v1beta1/gapic_metadata.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,11 @@
17611761
"methods": [
17621762
"list_persistent_resources"
17631763
]
1764+
},
1765+
"UpdatePersistentResource": {
1766+
"methods": [
1767+
"update_persistent_resource"
1768+
]
17641769
}
17651770
}
17661771
},
@@ -1786,6 +1791,11 @@
17861791
"methods": [
17871792
"list_persistent_resources"
17881793
]
1794+
},
1795+
"UpdatePersistentResource": {
1796+
"methods": [
1797+
"update_persistent_resource"
1798+
]
17891799
}
17901800
}
17911801
}

google/cloud/aiplatform_v1beta1/services/persistent_resource_service/async_client.py

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from google.iam.v1 import policy_pb2 # type: ignore
5858
from google.longrunning import operations_pb2
5959
from google.protobuf import empty_pb2 # type: ignore
60+
from google.protobuf import field_mask_pb2 # type: ignore
6061
from google.protobuf import timestamp_pb2 # type: ignore
6162
from google.rpc import status_pb2 # type: ignore
6263
from .transports.base import PersistentResourceServiceTransport, DEFAULT_CLIENT_INFO
@@ -748,6 +749,143 @@ async def sample_delete_persistent_resource():
748749
# Done; return the response.
749750
return response
750751

752+
async def update_persistent_resource(
753+
self,
754+
request: Optional[
755+
Union[persistent_resource_service.UpdatePersistentResourceRequest, dict]
756+
] = None,
757+
*,
758+
persistent_resource: Optional[
759+
gca_persistent_resource.PersistentResource
760+
] = None,
761+
update_mask: Optional[field_mask_pb2.FieldMask] = None,
762+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
763+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
764+
metadata: Sequence[Tuple[str, str]] = (),
765+
) -> operation_async.AsyncOperation:
766+
r"""Updates a PersistentResource.
767+
768+
.. code-block:: python
769+
770+
# This snippet has been automatically generated and should be regarded as a
771+
# code template only.
772+
# It will require modifications to work:
773+
# - It may require correct/in-range values for request initialization.
774+
# - It may require specifying regional endpoints when creating the service
775+
# client as shown in:
776+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
777+
from google.cloud import aiplatform_v1beta1
778+
779+
async def sample_update_persistent_resource():
780+
# Create a client
781+
client = aiplatform_v1beta1.PersistentResourceServiceAsyncClient()
782+
783+
# Initialize request argument(s)
784+
request = aiplatform_v1beta1.UpdatePersistentResourceRequest(
785+
)
786+
787+
# Make the request
788+
operation = client.update_persistent_resource(request=request)
789+
790+
print("Waiting for operation to complete...")
791+
792+
response = (await operation).result()
793+
794+
# Handle the response
795+
print(response)
796+
797+
Args:
798+
request (Optional[Union[google.cloud.aiplatform_v1beta1.types.UpdatePersistentResourceRequest, dict]]):
799+
The request object. Request message for
800+
UpdatePersistentResource method.
801+
persistent_resource (:class:`google.cloud.aiplatform_v1beta1.types.PersistentResource`):
802+
Required. The PersistentResource to update.
803+
804+
The PersistentResource's ``name`` field is used to
805+
identify the PersistentResource to update. Format:
806+
``projects/{project}/locations/{location}/persistentResources/{persistent_resource}``
807+
808+
This corresponds to the ``persistent_resource`` field
809+
on the ``request`` instance; if ``request`` is provided, this
810+
should not be set.
811+
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
812+
Required. Specify the fields to be
813+
overwritten in the PersistentResource by
814+
the update method.
815+
816+
This corresponds to the ``update_mask`` field
817+
on the ``request`` instance; if ``request`` is provided, this
818+
should not be set.
819+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
820+
should be retried.
821+
timeout (float): The timeout for this request.
822+
metadata (Sequence[Tuple[str, str]]): Strings which should be
823+
sent along with the request as metadata.
824+
825+
Returns:
826+
google.api_core.operation_async.AsyncOperation:
827+
An object representing a long-running operation.
828+
829+
The result type for the operation will be :class:`google.cloud.aiplatform_v1beta1.types.PersistentResource` Represents long-lasting resources that are dedicated to users to runs custom
830+
workloads. A PersistentResource can have multiple
831+
node pools and each node pool can have its own
832+
machine spec.
833+
834+
"""
835+
# Create or coerce a protobuf request object.
836+
# Quick check: If we got a request object, we should *not* have
837+
# gotten any keyword arguments that map to the request.
838+
has_flattened_params = any([persistent_resource, update_mask])
839+
if request is not None and has_flattened_params:
840+
raise ValueError(
841+
"If the `request` argument is set, then none of "
842+
"the individual field arguments should be set."
843+
)
844+
845+
request = persistent_resource_service.UpdatePersistentResourceRequest(request)
846+
847+
# If we have keyword arguments corresponding to fields on the
848+
# request, apply these.
849+
if persistent_resource is not None:
850+
request.persistent_resource = persistent_resource
851+
if update_mask is not None:
852+
request.update_mask = update_mask
853+
854+
# Wrap the RPC method; this adds retry and timeout information,
855+
# and friendly error handling.
856+
rpc = gapic_v1.method_async.wrap_method(
857+
self._client._transport.update_persistent_resource,
858+
default_timeout=None,
859+
client_info=DEFAULT_CLIENT_INFO,
860+
)
861+
862+
# Certain fields should be provided within the metadata header;
863+
# add these here.
864+
metadata = tuple(metadata) + (
865+
gapic_v1.routing_header.to_grpc_metadata(
866+
(("persistent_resource.name", request.persistent_resource.name),)
867+
),
868+
)
869+
870+
# Send the request.
871+
response = await rpc(
872+
request,
873+
retry=retry,
874+
timeout=timeout,
875+
metadata=metadata,
876+
)
877+
878+
# Wrap the response in an operation future.
879+
response = operation_async.from_gapic(
880+
response,
881+
self._client._transport.operations_client,
882+
gca_persistent_resource.PersistentResource,
883+
metadata_type=persistent_resource_service.UpdatePersistentResourceOperationMetadata,
884+
)
885+
886+
# Done; return the response.
887+
return response
888+
751889
async def list_operations(
752890
self,
753891
request: Optional[operations_pb2.ListOperationsRequest] = None,

google/cloud/aiplatform_v1beta1/services/persistent_resource_service/client.py

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
from google.iam.v1 import policy_pb2 # type: ignore
6262
from google.longrunning import operations_pb2
6363
from google.protobuf import empty_pb2 # type: ignore
64+
from google.protobuf import field_mask_pb2 # type: ignore
6465
from google.protobuf import timestamp_pb2 # type: ignore
6566
from google.rpc import status_pb2 # type: ignore
6667
from .transports.base import PersistentResourceServiceTransport, DEFAULT_CLIENT_INFO
@@ -999,6 +1000,149 @@ def sample_delete_persistent_resource():
9991000
# Done; return the response.
10001001
return response
10011002

1003+
def update_persistent_resource(
1004+
self,
1005+
request: Optional[
1006+
Union[persistent_resource_service.UpdatePersistentResourceRequest, dict]
1007+
] = None,
1008+
*,
1009+
persistent_resource: Optional[
1010+
gca_persistent_resource.PersistentResource
1011+
] = None,
1012+
update_mask: Optional[field_mask_pb2.FieldMask] = None,
1013+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1014+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1015+
metadata: Sequence[Tuple[str, str]] = (),
1016+
) -> gac_operation.Operation:
1017+
r"""Updates a PersistentResource.
1018+
1019+
.. code-block:: python
1020+
1021+
# This snippet has been automatically generated and should be regarded as a
1022+
# code template only.
1023+
# It will require modifications to work:
1024+
# - It may require correct/in-range values for request initialization.
1025+
# - It may require specifying regional endpoints when creating the service
1026+
# client as shown in:
1027+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1028+
from google.cloud import aiplatform_v1beta1
1029+
1030+
def sample_update_persistent_resource():
1031+
# Create a client
1032+
client = aiplatform_v1beta1.PersistentResourceServiceClient()
1033+
1034+
# Initialize request argument(s)
1035+
request = aiplatform_v1beta1.UpdatePersistentResourceRequest(
1036+
)
1037+
1038+
# Make the request
1039+
operation = client.update_persistent_resource(request=request)
1040+
1041+
print("Waiting for operation to complete...")
1042+
1043+
response = operation.result()
1044+
1045+
# Handle the response
1046+
print(response)
1047+
1048+
Args:
1049+
request (Union[google.cloud.aiplatform_v1beta1.types.UpdatePersistentResourceRequest, dict]):
1050+
The request object. Request message for
1051+
UpdatePersistentResource method.
1052+
persistent_resource (google.cloud.aiplatform_v1beta1.types.PersistentResource):
1053+
Required. The PersistentResource to update.
1054+
1055+
The PersistentResource's ``name`` field is used to
1056+
identify the PersistentResource to update. Format:
1057+
``projects/{project}/locations/{location}/persistentResources/{persistent_resource}``
1058+
1059+
This corresponds to the ``persistent_resource`` field
1060+
on the ``request`` instance; if ``request`` is provided, this
1061+
should not be set.
1062+
update_mask (google.protobuf.field_mask_pb2.FieldMask):
1063+
Required. Specify the fields to be
1064+
overwritten in the PersistentResource by
1065+
the update method.
1066+
1067+
This corresponds to the ``update_mask`` field
1068+
on the ``request`` instance; if ``request`` is provided, this
1069+
should not be set.
1070+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1071+
should be retried.
1072+
timeout (float): The timeout for this request.
1073+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1074+
sent along with the request as metadata.
1075+
1076+
Returns:
1077+
google.api_core.operation.Operation:
1078+
An object representing a long-running operation.
1079+
1080+
The result type for the operation will be :class:`google.cloud.aiplatform_v1beta1.types.PersistentResource` Represents long-lasting resources that are dedicated to users to runs custom
1081+
workloads. A PersistentResource can have multiple
1082+
node pools and each node pool can have its own
1083+
machine spec.
1084+
1085+
"""
1086+
# Create or coerce a protobuf request object.
1087+
# Quick check: If we got a request object, we should *not* have
1088+
# gotten any keyword arguments that map to the request.
1089+
has_flattened_params = any([persistent_resource, update_mask])
1090+
if request is not None and has_flattened_params:
1091+
raise ValueError(
1092+
"If the `request` argument is set, then none of "
1093+
"the individual field arguments should be set."
1094+
)
1095+
1096+
# Minor optimization to avoid making a copy if the user passes
1097+
# in a persistent_resource_service.UpdatePersistentResourceRequest.
1098+
# There's no risk of modifying the input as we've already verified
1099+
# there are no flattened fields.
1100+
if not isinstance(
1101+
request, persistent_resource_service.UpdatePersistentResourceRequest
1102+
):
1103+
request = persistent_resource_service.UpdatePersistentResourceRequest(
1104+
request
1105+
)
1106+
# If we have keyword arguments corresponding to fields on the
1107+
# request, apply these.
1108+
if persistent_resource is not None:
1109+
request.persistent_resource = persistent_resource
1110+
if update_mask is not None:
1111+
request.update_mask = update_mask
1112+
1113+
# Wrap the RPC method; this adds retry and timeout information,
1114+
# and friendly error handling.
1115+
rpc = self._transport._wrapped_methods[
1116+
self._transport.update_persistent_resource
1117+
]
1118+
1119+
# Certain fields should be provided within the metadata header;
1120+
# add these here.
1121+
metadata = tuple(metadata) + (
1122+
gapic_v1.routing_header.to_grpc_metadata(
1123+
(("persistent_resource.name", request.persistent_resource.name),)
1124+
),
1125+
)
1126+
1127+
# Send the request.
1128+
response = rpc(
1129+
request,
1130+
retry=retry,
1131+
timeout=timeout,
1132+
metadata=metadata,
1133+
)
1134+
1135+
# Wrap the response in an operation future.
1136+
response = gac_operation.from_gapic(
1137+
response,
1138+
self._transport.operations_client,
1139+
gca_persistent_resource.PersistentResource,
1140+
metadata_type=persistent_resource_service.UpdatePersistentResourceOperationMetadata,
1141+
)
1142+
1143+
# Done; return the response.
1144+
return response
1145+
10021146
def __enter__(self) -> "PersistentResourceServiceClient":
10031147
return self
10041148

0 commit comments

Comments
 (0)