Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.10/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env_vars: {
}

# Declare build specific Cloud project.
env_vars: {
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "ucaip-sample-tests"
}
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.11/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env_vars: {
}

# Declare build specific Cloud project.
env_vars: {
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "ucaip-sample-tests"
}
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.7/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env_vars: {
}

# Declare build specific Cloud project.
env_vars: {
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "ucaip-sample-tests"
}
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.8/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env_vars: {
}

# Declare build specific Cloud project.
env_vars: {
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "ucaip-sample-tests"
}
Expand Down
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.9/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env_vars: {
}

# Declare build specific Cloud project.
env_vars: {
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "ucaip-sample-tests"
}
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/aiplatform_v1beta1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@
from .types.persistent_resource_service import GetPersistentResourceRequest
from .types.persistent_resource_service import ListPersistentResourcesRequest
from .types.persistent_resource_service import ListPersistentResourcesResponse
from .types.persistent_resource_service import UpdatePersistentResourceOperationMetadata
from .types.persistent_resource_service import UpdatePersistentResourceRequest
from .types.pipeline_failure_policy import PipelineFailurePolicy
from .types.pipeline_job import PipelineJob
from .types.pipeline_job import PipelineJobDetail
Expand Down Expand Up @@ -1188,6 +1190,8 @@
"UpdateModelDeploymentMonitoringJobOperationMetadata",
"UpdateModelDeploymentMonitoringJobRequest",
"UpdateModelRequest",
"UpdatePersistentResourceOperationMetadata",
"UpdatePersistentResourceRequest",
"UpdateScheduleRequest",
"UpdateSpecialistPoolOperationMetadata",
"UpdateSpecialistPoolRequest",
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/aiplatform_v1beta1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,11 @@
"methods": [
"list_persistent_resources"
]
},
"UpdatePersistentResource": {
"methods": [
"update_persistent_resource"
]
}
}
},
Expand All @@ -1786,6 +1791,11 @@
"methods": [
"list_persistent_resources"
]
},
"UpdatePersistentResource": {
"methods": [
"update_persistent_resource"
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
from google.iam.v1 import policy_pb2 # type: ignore
from google.longrunning import operations_pb2
from google.protobuf import empty_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
from .transports.base import PersistentResourceServiceTransport, DEFAULT_CLIENT_INFO
Expand Down Expand Up @@ -748,6 +749,143 @@ async def sample_delete_persistent_resource():
# Done; return the response.
return response

async def update_persistent_resource(
self,
request: Optional[
Union[persistent_resource_service.UpdatePersistentResourceRequest, dict]
] = None,
*,
persistent_resource: Optional[
gca_persistent_resource.PersistentResource
] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Updates a PersistentResource.

.. code-block:: python

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import aiplatform_v1beta1

async def sample_update_persistent_resource():
# Create a client
client = aiplatform_v1beta1.PersistentResourceServiceAsyncClient()

# Initialize request argument(s)
request = aiplatform_v1beta1.UpdatePersistentResourceRequest(
)

# Make the request
operation = client.update_persistent_resource(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()

# Handle the response
print(response)

Args:
request (Optional[Union[google.cloud.aiplatform_v1beta1.types.UpdatePersistentResourceRequest, dict]]):
The request object. Request message for
UpdatePersistentResource method.
persistent_resource (:class:`google.cloud.aiplatform_v1beta1.types.PersistentResource`):
Required. The PersistentResource to update.

The PersistentResource's ``name`` field is used to
identify the PersistentResource to update. Format:
``projects/{project}/locations/{location}/persistentResources/{persistent_resource}``

This corresponds to the ``persistent_resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. Specify the fields to be
overwritten in the PersistentResource by
the update method.

This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.

Returns:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.

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
workloads. A PersistentResource can have multiple
node pools and each node pool can have its own
machine spec.

"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([persistent_resource, update_mask])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = persistent_resource_service.UpdatePersistentResourceRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if persistent_resource is not None:
request.persistent_resource = persistent_resource
if update_mask is not None:
request.update_mask = update_mask

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.update_persistent_resource,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("persistent_resource.name", request.persistent_resource.name),)
),
)

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

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
gca_persistent_resource.PersistentResource,
metadata_type=persistent_resource_service.UpdatePersistentResourceOperationMetadata,
)

# Done; return the response.
return response

async def list_operations(
self,
request: Optional[operations_pb2.ListOperationsRequest] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
from google.iam.v1 import policy_pb2 # type: ignore
from google.longrunning import operations_pb2
from google.protobuf import empty_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
from .transports.base import PersistentResourceServiceTransport, DEFAULT_CLIENT_INFO
Expand Down Expand Up @@ -999,6 +1000,149 @@ def sample_delete_persistent_resource():
# Done; return the response.
return response

def update_persistent_resource(
self,
request: Optional[
Union[persistent_resource_service.UpdatePersistentResourceRequest, dict]
] = None,
*,
persistent_resource: Optional[
gca_persistent_resource.PersistentResource
] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> gac_operation.Operation:
r"""Updates a PersistentResource.

.. code-block:: python

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import aiplatform_v1beta1

def sample_update_persistent_resource():
# Create a client
client = aiplatform_v1beta1.PersistentResourceServiceClient()

# Initialize request argument(s)
request = aiplatform_v1beta1.UpdatePersistentResourceRequest(
)

# Make the request
operation = client.update_persistent_resource(request=request)

print("Waiting for operation to complete...")

response = operation.result()

# Handle the response
print(response)

Args:
request (Union[google.cloud.aiplatform_v1beta1.types.UpdatePersistentResourceRequest, dict]):
The request object. Request message for
UpdatePersistentResource method.
persistent_resource (google.cloud.aiplatform_v1beta1.types.PersistentResource):
Required. The PersistentResource to update.

The PersistentResource's ``name`` field is used to
identify the PersistentResource to update. Format:
``projects/{project}/locations/{location}/persistentResources/{persistent_resource}``

This corresponds to the ``persistent_resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
Required. Specify the fields to be
overwritten in the PersistentResource by
the update method.

This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.

Returns:
google.api_core.operation.Operation:
An object representing a long-running operation.

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
workloads. A PersistentResource can have multiple
node pools and each node pool can have its own
machine spec.

"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([persistent_resource, update_mask])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# Minor optimization to avoid making a copy if the user passes
# in a persistent_resource_service.UpdatePersistentResourceRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(
request, persistent_resource_service.UpdatePersistentResourceRequest
):
request = persistent_resource_service.UpdatePersistentResourceRequest(
request
)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if persistent_resource is not None:
request.persistent_resource = persistent_resource
if update_mask is not None:
request.update_mask = update_mask

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[
self._transport.update_persistent_resource
]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("persistent_resource.name", request.persistent_resource.name),)
),
)

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

# Wrap the response in an operation future.
response = gac_operation.from_gapic(
response,
self._transport.operations_client,
gca_persistent_resource.PersistentResource,
metadata_type=persistent_resource_service.UpdatePersistentResourceOperationMetadata,
)

# Done; return the response.
return response

def __enter__(self) -> "PersistentResourceServiceClient":
return self

Expand Down
Loading