Skip to content

Commit 9a506ee

Browse files
feat: add deleteFeatureValues in aiplatform v1beta1 featurestore_service.proto (#1670)
* feat: add deleteFeatureValues in aiplatform v1beta1 featurestore_service.proto PiperOrigin-RevId: 474635535 Source-Link: googleapis/googleapis@39c28bf Source-Link: googleapis/googleapis-gen@71f2abf Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzFmMmFiZmIzNDM1NjJjZTQwYjc5YzNiNTZmYzk3ZWM1YTBkY2NiMSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Add Secure Boot support to TPU v2alpha1 API PiperOrigin-RevId: 474644226 Source-Link: googleapis/googleapis@f90b329 Source-Link: googleapis/googleapis-gen@4ad8763 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGFkODc2M2JkZTY3NmY5MmEzZWI3MDc1M2FlMWNmZWQwZTgxMzg3ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 95855a2 commit 9a506ee

File tree

17 files changed

+1062
-50
lines changed

17 files changed

+1062
-50
lines changed

google/cloud/aiplatform_v1/services/migration_service/client.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,40 +218,40 @@ def parse_dataset_path(path: str) -> Dict[str, str]:
218218
@staticmethod
219219
def dataset_path(
220220
project: str,
221+
location: str,
221222
dataset: str,
222223
) -> str:
223224
"""Returns a fully-qualified dataset string."""
224-
return "projects/{project}/datasets/{dataset}".format(
225+
return "projects/{project}/locations/{location}/datasets/{dataset}".format(
225226
project=project,
227+
location=location,
226228
dataset=dataset,
227229
)
228230

229231
@staticmethod
230232
def parse_dataset_path(path: str) -> Dict[str, str]:
231233
"""Parses a dataset path into its component segments."""
232-
m = re.match(r"^projects/(?P<project>.+?)/datasets/(?P<dataset>.+?)$", path)
234+
m = re.match(
235+
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/datasets/(?P<dataset>.+?)$",
236+
path,
237+
)
233238
return m.groupdict() if m else {}
234239

235240
@staticmethod
236241
def dataset_path(
237242
project: str,
238-
location: str,
239243
dataset: str,
240244
) -> str:
241245
"""Returns a fully-qualified dataset string."""
242-
return "projects/{project}/locations/{location}/datasets/{dataset}".format(
246+
return "projects/{project}/datasets/{dataset}".format(
243247
project=project,
244-
location=location,
245248
dataset=dataset,
246249
)
247250

248251
@staticmethod
249252
def parse_dataset_path(path: str) -> Dict[str, str]:
250253
"""Parses a dataset path into its component segments."""
251-
m = re.match(
252-
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/datasets/(?P<dataset>.+?)$",
253-
path,
254-
)
254+
m = re.match(r"^projects/(?P<project>.+?)/datasets/(?P<dataset>.+?)$", path)
255255
return m.groupdict() if m else {}
256256

257257
@staticmethod

google/cloud/aiplatform_v1beta1/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@
182182
from .types.featurestore_service import DeleteEntityTypeRequest
183183
from .types.featurestore_service import DeleteFeatureRequest
184184
from .types.featurestore_service import DeleteFeaturestoreRequest
185+
from .types.featurestore_service import DeleteFeatureValuesOperationMetadata
186+
from .types.featurestore_service import DeleteFeatureValuesRequest
187+
from .types.featurestore_service import DeleteFeatureValuesResponse
185188
from .types.featurestore_service import DestinationFeatureSetting
189+
from .types.featurestore_service import EntityIdSelector
186190
from .types.featurestore_service import ExportFeatureValuesOperationMetadata
187191
from .types.featurestore_service import ExportFeatureValuesRequest
188192
from .types.featurestore_service import ExportFeatureValuesResponse
@@ -663,6 +667,9 @@
663667
"DeleteEntityTypeRequest",
664668
"DeleteExecutionRequest",
665669
"DeleteFeatureRequest",
670+
"DeleteFeatureValuesOperationMetadata",
671+
"DeleteFeatureValuesRequest",
672+
"DeleteFeatureValuesResponse",
666673
"DeleteFeaturestoreRequest",
667674
"DeleteHyperparameterTuningJobRequest",
668675
"DeleteIndexEndpointRequest",
@@ -701,6 +708,7 @@
701708
"EncryptionSpec",
702709
"Endpoint",
703710
"EndpointServiceClient",
711+
"EntityIdSelector",
704712
"EntityType",
705713
"EnvVar",
706714
"Event",

google/cloud/aiplatform_v1beta1/gapic_metadata.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,11 @@
361361
"delete_feature"
362362
]
363363
},
364+
"DeleteFeatureValues": {
365+
"methods": [
366+
"delete_feature_values"
367+
]
368+
},
364369
"DeleteFeaturestore": {
365370
"methods": [
366371
"delete_featurestore"
@@ -466,6 +471,11 @@
466471
"delete_feature"
467472
]
468473
},
474+
"DeleteFeatureValues": {
475+
"methods": [
476+
"delete_feature_values"
477+
]
478+
},
469479
"DeleteFeaturestore": {
470480
"methods": [
471481
"delete_featurestore"

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

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2710,6 +2710,140 @@ async def sample_export_feature_values():
27102710
# Done; return the response.
27112711
return response
27122712

2713+
async def delete_feature_values(
2714+
self,
2715+
request: Union[featurestore_service.DeleteFeatureValuesRequest, dict] = None,
2716+
*,
2717+
entity_type: str = None,
2718+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2719+
timeout: float = None,
2720+
metadata: Sequence[Tuple[str, str]] = (),
2721+
) -> operation_async.AsyncOperation:
2722+
r"""Delete Feature values from Featurestore.
2723+
The progress of the deletion is tracked by the returned
2724+
operation. The deleted feature values are guaranteed to
2725+
be invisible to subsequent read operations after the
2726+
operation is marked as successfully done.
2727+
If a delete feature values operation fails, the feature
2728+
values returned from reads and exports may be
2729+
inconsistent. If consistency is required, the caller
2730+
must retry the same delete request again and wait till
2731+
the new operation returned is marked as successfully
2732+
done.
2733+
2734+
.. code-block:: python
2735+
2736+
# This snippet has been automatically generated and should be regarded as a
2737+
# code template only.
2738+
# It will require modifications to work:
2739+
# - It may require correct/in-range values for request initialization.
2740+
# - It may require specifying regional endpoints when creating the service
2741+
# client as shown in:
2742+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
2743+
from google.cloud import aiplatform_v1beta1
2744+
2745+
async def sample_delete_feature_values():
2746+
# Create a client
2747+
client = aiplatform_v1beta1.FeaturestoreServiceAsyncClient()
2748+
2749+
# Initialize request argument(s)
2750+
select_entity = aiplatform_v1beta1.SelectEntity()
2751+
select_entity.entity_id_selector.csv_source.gcs_source.uris = ['uris_value1', 'uris_value2']
2752+
2753+
request = aiplatform_v1beta1.DeleteFeatureValuesRequest(
2754+
select_entity=select_entity,
2755+
entity_type="entity_type_value",
2756+
)
2757+
2758+
# Make the request
2759+
operation = client.delete_feature_values(request=request)
2760+
2761+
print("Waiting for operation to complete...")
2762+
2763+
response = await operation.result()
2764+
2765+
# Handle the response
2766+
print(response)
2767+
2768+
Args:
2769+
request (Union[google.cloud.aiplatform_v1beta1.types.DeleteFeatureValuesRequest, dict]):
2770+
The request object. Request message for
2771+
[FeaturestoreService.DeleteFeatureValues][google.cloud.aiplatform.v1beta1.FeaturestoreService.DeleteFeatureValues].
2772+
entity_type (:class:`str`):
2773+
Required. The resource name of the EntityType grouping
2774+
the Features for which values are being deleted from.
2775+
Format:
2776+
``projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}``
2777+
2778+
This corresponds to the ``entity_type`` field
2779+
on the ``request`` instance; if ``request`` is provided, this
2780+
should not be set.
2781+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
2782+
should be retried.
2783+
timeout (float): The timeout for this request.
2784+
metadata (Sequence[Tuple[str, str]]): Strings which should be
2785+
sent along with the request as metadata.
2786+
2787+
Returns:
2788+
google.api_core.operation_async.AsyncOperation:
2789+
An object representing a long-running operation.
2790+
2791+
The result type for the operation will be :class:`google.cloud.aiplatform_v1beta1.types.DeleteFeatureValuesResponse` Response message for
2792+
[FeaturestoreService.DeleteFeatureValues][google.cloud.aiplatform.v1beta1.FeaturestoreService.DeleteFeatureValues].
2793+
2794+
"""
2795+
# Create or coerce a protobuf request object.
2796+
# Quick check: If we got a request object, we should *not* have
2797+
# gotten any keyword arguments that map to the request.
2798+
has_flattened_params = any([entity_type])
2799+
if request is not None and has_flattened_params:
2800+
raise ValueError(
2801+
"If the `request` argument is set, then none of "
2802+
"the individual field arguments should be set."
2803+
)
2804+
2805+
request = featurestore_service.DeleteFeatureValuesRequest(request)
2806+
2807+
# If we have keyword arguments corresponding to fields on the
2808+
# request, apply these.
2809+
if entity_type is not None:
2810+
request.entity_type = entity_type
2811+
2812+
# Wrap the RPC method; this adds retry and timeout information,
2813+
# and friendly error handling.
2814+
rpc = gapic_v1.method_async.wrap_method(
2815+
self._client._transport.delete_feature_values,
2816+
default_timeout=None,
2817+
client_info=DEFAULT_CLIENT_INFO,
2818+
)
2819+
2820+
# Certain fields should be provided within the metadata header;
2821+
# add these here.
2822+
metadata = tuple(metadata) + (
2823+
gapic_v1.routing_header.to_grpc_metadata(
2824+
(("entity_type", request.entity_type),)
2825+
),
2826+
)
2827+
2828+
# Send the request.
2829+
response = await rpc(
2830+
request,
2831+
retry=retry,
2832+
timeout=timeout,
2833+
metadata=metadata,
2834+
)
2835+
2836+
# Wrap the response in an operation future.
2837+
response = operation_async.from_gapic(
2838+
response,
2839+
self._client._transport.operations_client,
2840+
featurestore_service.DeleteFeatureValuesResponse,
2841+
metadata_type=featurestore_service.DeleteFeatureValuesOperationMetadata,
2842+
)
2843+
2844+
# Done; return the response.
2845+
return response
2846+
27132847
async def search_features(
27142848
self,
27152849
request: Union[featurestore_service.SearchFeaturesRequest, dict] = None,

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

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2978,6 +2978,140 @@ def sample_export_feature_values():
29782978
# Done; return the response.
29792979
return response
29802980

2981+
def delete_feature_values(
2982+
self,
2983+
request: Union[featurestore_service.DeleteFeatureValuesRequest, dict] = None,
2984+
*,
2985+
entity_type: str = None,
2986+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2987+
timeout: float = None,
2988+
metadata: Sequence[Tuple[str, str]] = (),
2989+
) -> gac_operation.Operation:
2990+
r"""Delete Feature values from Featurestore.
2991+
The progress of the deletion is tracked by the returned
2992+
operation. The deleted feature values are guaranteed to
2993+
be invisible to subsequent read operations after the
2994+
operation is marked as successfully done.
2995+
If a delete feature values operation fails, the feature
2996+
values returned from reads and exports may be
2997+
inconsistent. If consistency is required, the caller
2998+
must retry the same delete request again and wait till
2999+
the new operation returned is marked as successfully
3000+
done.
3001+
3002+
.. code-block:: python
3003+
3004+
# This snippet has been automatically generated and should be regarded as a
3005+
# code template only.
3006+
# It will require modifications to work:
3007+
# - It may require correct/in-range values for request initialization.
3008+
# - It may require specifying regional endpoints when creating the service
3009+
# client as shown in:
3010+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
3011+
from google.cloud import aiplatform_v1beta1
3012+
3013+
def sample_delete_feature_values():
3014+
# Create a client
3015+
client = aiplatform_v1beta1.FeaturestoreServiceClient()
3016+
3017+
# Initialize request argument(s)
3018+
select_entity = aiplatform_v1beta1.SelectEntity()
3019+
select_entity.entity_id_selector.csv_source.gcs_source.uris = ['uris_value1', 'uris_value2']
3020+
3021+
request = aiplatform_v1beta1.DeleteFeatureValuesRequest(
3022+
select_entity=select_entity,
3023+
entity_type="entity_type_value",
3024+
)
3025+
3026+
# Make the request
3027+
operation = client.delete_feature_values(request=request)
3028+
3029+
print("Waiting for operation to complete...")
3030+
3031+
response = operation.result()
3032+
3033+
# Handle the response
3034+
print(response)
3035+
3036+
Args:
3037+
request (Union[google.cloud.aiplatform_v1beta1.types.DeleteFeatureValuesRequest, dict]):
3038+
The request object. Request message for
3039+
[FeaturestoreService.DeleteFeatureValues][google.cloud.aiplatform.v1beta1.FeaturestoreService.DeleteFeatureValues].
3040+
entity_type (str):
3041+
Required. The resource name of the EntityType grouping
3042+
the Features for which values are being deleted from.
3043+
Format:
3044+
``projects/{project}/locations/{location}/featurestores/{featurestore}/entityTypes/{entityType}``
3045+
3046+
This corresponds to the ``entity_type`` field
3047+
on the ``request`` instance; if ``request`` is provided, this
3048+
should not be set.
3049+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
3050+
should be retried.
3051+
timeout (float): The timeout for this request.
3052+
metadata (Sequence[Tuple[str, str]]): Strings which should be
3053+
sent along with the request as metadata.
3054+
3055+
Returns:
3056+
google.api_core.operation.Operation:
3057+
An object representing a long-running operation.
3058+
3059+
The result type for the operation will be :class:`google.cloud.aiplatform_v1beta1.types.DeleteFeatureValuesResponse` Response message for
3060+
[FeaturestoreService.DeleteFeatureValues][google.cloud.aiplatform.v1beta1.FeaturestoreService.DeleteFeatureValues].
3061+
3062+
"""
3063+
# Create or coerce a protobuf request object.
3064+
# Quick check: If we got a request object, we should *not* have
3065+
# gotten any keyword arguments that map to the request.
3066+
has_flattened_params = any([entity_type])
3067+
if request is not None and has_flattened_params:
3068+
raise ValueError(
3069+
"If the `request` argument is set, then none of "
3070+
"the individual field arguments should be set."
3071+
)
3072+
3073+
# Minor optimization to avoid making a copy if the user passes
3074+
# in a featurestore_service.DeleteFeatureValuesRequest.
3075+
# There's no risk of modifying the input as we've already verified
3076+
# there are no flattened fields.
3077+
if not isinstance(request, featurestore_service.DeleteFeatureValuesRequest):
3078+
request = featurestore_service.DeleteFeatureValuesRequest(request)
3079+
# If we have keyword arguments corresponding to fields on the
3080+
# request, apply these.
3081+
if entity_type is not None:
3082+
request.entity_type = entity_type
3083+
3084+
# Wrap the RPC method; this adds retry and timeout information,
3085+
# and friendly error handling.
3086+
rpc = self._transport._wrapped_methods[self._transport.delete_feature_values]
3087+
3088+
# Certain fields should be provided within the metadata header;
3089+
# add these here.
3090+
metadata = tuple(metadata) + (
3091+
gapic_v1.routing_header.to_grpc_metadata(
3092+
(("entity_type", request.entity_type),)
3093+
),
3094+
)
3095+
3096+
# Send the request.
3097+
response = rpc(
3098+
request,
3099+
retry=retry,
3100+
timeout=timeout,
3101+
metadata=metadata,
3102+
)
3103+
3104+
# Wrap the response in an operation future.
3105+
response = gac_operation.from_gapic(
3106+
response,
3107+
self._transport.operations_client,
3108+
featurestore_service.DeleteFeatureValuesResponse,
3109+
metadata_type=featurestore_service.DeleteFeatureValuesOperationMetadata,
3110+
)
3111+
3112+
# Done; return the response.
3113+
return response
3114+
29813115
def search_features(
29823116
self,
29833117
request: Union[featurestore_service.SearchFeaturesRequest, dict] = None,

0 commit comments

Comments
 (0)