Skip to content

Commit fd69d38

Browse files
feat: [VectorSearch] Added CMEK support (#9101)
* feat: Added CMEK support feat: Added UpdateIndex support docs: Updated documentation for listing locations docs: Updated documentation for Collection.data_schema PiperOrigin-RevId: 898465628 Source-Link: googleapis/googleapis@8d0f6d8 Source-Link: googleapis/googleapis-gen@1965238 Copy-Tag: eyJwIjoiVmVjdG9yU2VhcmNoLy5Pd2xCb3QueWFtbCIsImgiOiIxOTY1MjM4NTMzY2ZjZTNiOTlkNDEzODhlOWUxOWRkMjJjMzQ5MGUwIn0= * 🦉 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 4e5a72c commit fd69d38

17 files changed

Lines changed: 843 additions & 37 deletions

VectorSearch/metadata/V1/EncryptionSpec.php

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

VectorSearch/metadata/V1/VectorsearchService.php

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

VectorSearch/samples/V1/DataObjectSearchServiceClient/list_locations.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,22 @@
3131

3232
/**
3333
* Lists information about the supported locations for this service.
34-
This method can be called in two ways:
3534
36-
* **List all public locations:** Use the path `GET /v1/locations`.
37-
* **List project-visible locations:** Use the path
38-
`GET /v1/projects/{project_id}/locations`. This may include public
39-
locations as well as private or other locations specifically visible
40-
to the project.
35+
This method lists locations based on the resource scope provided in
36+
the [ListLocationsRequest.name] field:
37+
38+
* **Global locations**: If `name` is empty, the method lists the
39+
public locations available to all projects. * **Project-specific
40+
locations**: If `name` follows the format
41+
`projects/{project}`, the method lists locations visible to that
42+
specific project. This includes public, private, or other
43+
project-specific locations enabled for the project.
44+
45+
For gRPC and client library implementations, the resource name is
46+
passed as the `name` field. For direct service calls, the resource
47+
name is
48+
incorporated into the request path based on the specific service
49+
implementation and version.
4150
*
4251
* This sample has been automatically generated and should be regarded as a code
4352
* template only. It will require modifications to work:

VectorSearch/samples/V1/DataObjectServiceClient/list_locations.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,22 @@
3131

3232
/**
3333
* Lists information about the supported locations for this service.
34-
This method can be called in two ways:
3534
36-
* **List all public locations:** Use the path `GET /v1/locations`.
37-
* **List project-visible locations:** Use the path
38-
`GET /v1/projects/{project_id}/locations`. This may include public
39-
locations as well as private or other locations specifically visible
40-
to the project.
35+
This method lists locations based on the resource scope provided in
36+
the [ListLocationsRequest.name] field:
37+
38+
* **Global locations**: If `name` is empty, the method lists the
39+
public locations available to all projects. * **Project-specific
40+
locations**: If `name` follows the format
41+
`projects/{project}`, the method lists locations visible to that
42+
specific project. This includes public, private, or other
43+
project-specific locations enabled for the project.
44+
45+
For gRPC and client library implementations, the resource name is
46+
passed as the `name` field. For direct service calls, the resource
47+
name is
48+
incorporated into the request path based on the specific service
49+
implementation and version.
4150
*
4251
* This sample has been automatically generated and should be regarded as a code
4352
* template only. It will require modifications to work:

VectorSearch/samples/V1/VectorSearchServiceClient/list_locations.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,22 @@
3131

3232
/**
3333
* Lists information about the supported locations for this service.
34-
This method can be called in two ways:
3534
36-
* **List all public locations:** Use the path `GET /v1/locations`.
37-
* **List project-visible locations:** Use the path
38-
`GET /v1/projects/{project_id}/locations`. This may include public
39-
locations as well as private or other locations specifically visible
40-
to the project.
35+
This method lists locations based on the resource scope provided in
36+
the [ListLocationsRequest.name] field:
37+
38+
* **Global locations**: If `name` is empty, the method lists the
39+
public locations available to all projects. * **Project-specific
40+
locations**: If `name` follows the format
41+
`projects/{project}`, the method lists locations visible to that
42+
specific project. This includes public, private, or other
43+
project-specific locations enabled for the project.
44+
45+
For gRPC and client library implementations, the resource name is
46+
passed as the `name` field. For direct service calls, the resource
47+
name is
48+
incorporated into the request path based on the specific service
49+
implementation and version.
4150
*
4251
* This sample has been automatically generated and should be regarded as a code
4352
* template only. It will require modifications to work:
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
/*
3+
* Copyright 2026 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START vectorsearch_v1_generated_VectorSearchService_UpdateIndex_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\OperationResponse;
28+
use Google\Cloud\VectorSearch\V1\Client\VectorSearchServiceClient;
29+
use Google\Cloud\VectorSearch\V1\Index;
30+
use Google\Cloud\VectorSearch\V1\UpdateIndexRequest;
31+
use Google\Rpc\Status;
32+
33+
/**
34+
* Updates the parameters of a single Index.
35+
*
36+
* @param string $indexIndexField The collection schema field to index.
37+
*/
38+
function update_index_sample(string $indexIndexField): void
39+
{
40+
// Create a client.
41+
$vectorSearchServiceClient = new VectorSearchServiceClient();
42+
43+
// Prepare the request message.
44+
$index = (new Index())
45+
->setIndexField($indexIndexField);
46+
$request = (new UpdateIndexRequest())
47+
->setIndex($index);
48+
49+
// Call the API and handle any network failures.
50+
try {
51+
/** @var OperationResponse $response */
52+
$response = $vectorSearchServiceClient->updateIndex($request);
53+
$response->pollUntilComplete();
54+
55+
if ($response->operationSucceeded()) {
56+
/** @var Index $result */
57+
$result = $response->getResult();
58+
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
59+
} else {
60+
/** @var Status $error */
61+
$error = $response->getError();
62+
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
63+
}
64+
} catch (ApiException $ex) {
65+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
66+
}
67+
}
68+
69+
/**
70+
* Helper to execute the sample.
71+
*
72+
* This sample has been automatically generated and should be regarded as a code
73+
* template only. It will require modifications to work:
74+
* - It may require correct/in-range values for request initialization.
75+
* - It may require specifying regional endpoints when creating the service client,
76+
* please see the apiEndpoint client configuration option for more details.
77+
*/
78+
function callSample(): void
79+
{
80+
$indexIndexField = '[INDEX_FIELD]';
81+
82+
update_index_sample($indexIndexField);
83+
}
84+
// [END vectorsearch_v1_generated_VectorSearchService_UpdateIndex_sync]

VectorSearch/src/V1/Client/DataObjectSearchServiceClient.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,22 @@ public function getLocation(GetLocationRequest $request, array $callOptions = []
401401

402402
/**
403403
* Lists information about the supported locations for this service.
404-
This method can be called in two ways:
405404
406-
* **List all public locations:** Use the path `GET /v1/locations`.
407-
* **List project-visible locations:** Use the path
408-
`GET /v1/projects/{project_id}/locations`. This may include public
409-
locations as well as private or other locations specifically visible
410-
to the project.
405+
This method lists locations based on the resource scope provided in
406+
the [ListLocationsRequest.name] field:
407+
408+
* **Global locations**: If `name` is empty, the method lists the
409+
public locations available to all projects. * **Project-specific
410+
locations**: If `name` follows the format
411+
`projects/{project}`, the method lists locations visible to that
412+
specific project. This includes public, private, or other
413+
project-specific locations enabled for the project.
414+
415+
For gRPC and client library implementations, the resource name is
416+
passed as the `name` field. For direct service calls, the resource
417+
name is
418+
incorporated into the request path based on the specific service
419+
implementation and version.
411420
*
412421
* The async variant is {@see DataObjectSearchServiceClient::listLocationsAsync()}
413422
* .

VectorSearch/src/V1/Client/DataObjectServiceClient.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,13 +484,22 @@ public function getLocation(GetLocationRequest $request, array $callOptions = []
484484

485485
/**
486486
* Lists information about the supported locations for this service.
487-
This method can be called in two ways:
488487
489-
* **List all public locations:** Use the path `GET /v1/locations`.
490-
* **List project-visible locations:** Use the path
491-
`GET /v1/projects/{project_id}/locations`. This may include public
492-
locations as well as private or other locations specifically visible
493-
to the project.
488+
This method lists locations based on the resource scope provided in
489+
the [ListLocationsRequest.name] field:
490+
491+
* **Global locations**: If `name` is empty, the method lists the
492+
public locations available to all projects. * **Project-specific
493+
locations**: If `name` follows the format
494+
`projects/{project}`, the method lists locations visible to that
495+
specific project. This includes public, private, or other
496+
project-specific locations enabled for the project.
497+
498+
For gRPC and client library implementations, the resource name is
499+
passed as the `name` field. For direct service calls, the resource
500+
name is
501+
incorporated into the request path based on the specific service
502+
implementation and version.
494503
*
495504
* The async variant is {@see DataObjectServiceClient::listLocationsAsync()} .
496505
*

VectorSearch/src/V1/Client/VectorSearchServiceClient.php

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
use Google\Cloud\VectorSearch\V1\ListCollectionsRequest;
5454
use Google\Cloud\VectorSearch\V1\ListIndexesRequest;
5555
use Google\Cloud\VectorSearch\V1\UpdateCollectionRequest;
56+
use Google\Cloud\VectorSearch\V1\UpdateIndexRequest;
5657
use Google\LongRunning\Client\OperationsClient;
5758
use Google\LongRunning\Operation;
5859
use GuzzleHttp\Promise\PromiseInterface;
@@ -84,6 +85,7 @@
8485
* @method PromiseInterface<PagedListResponse> listCollectionsAsync(ListCollectionsRequest $request, array $optionalArgs = [])
8586
* @method PromiseInterface<PagedListResponse> listIndexesAsync(ListIndexesRequest $request, array $optionalArgs = [])
8687
* @method PromiseInterface<OperationResponse> updateCollectionAsync(UpdateCollectionRequest $request, array $optionalArgs = [])
88+
* @method PromiseInterface<OperationResponse> updateIndexAsync(UpdateIndexRequest $request, array $optionalArgs = [])
8789
* @method PromiseInterface<Location> getLocationAsync(GetLocationRequest $request, array $optionalArgs = [])
8890
* @method PromiseInterface<PagedListResponse> listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = [])
8991
*/
@@ -202,6 +204,27 @@ public static function collectionName(string $project, string $location, string
202204
]);
203205
}
204206

207+
/**
208+
* Formats a string containing the fully-qualified path to represent a crypto_key
209+
* resource.
210+
*
211+
* @param string $project
212+
* @param string $location
213+
* @param string $keyRing
214+
* @param string $cryptoKey
215+
*
216+
* @return string The formatted crypto_key resource.
217+
*/
218+
public static function cryptoKeyName(string $project, string $location, string $keyRing, string $cryptoKey): string
219+
{
220+
return self::getPathTemplate('cryptoKey')->render([
221+
'project' => $project,
222+
'location' => $location,
223+
'key_ring' => $keyRing,
224+
'crypto_key' => $cryptoKey,
225+
]);
226+
}
227+
205228
/**
206229
* Formats a string containing the fully-qualified path to represent a index
207230
* resource.
@@ -245,6 +268,7 @@ public static function locationName(string $project, string $location): string
245268
* The following name formats are supported:
246269
* Template: Pattern
247270
* - collection: projects/{project}/locations/{location}/collections/{collection}
271+
* - cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}
248272
* - index: projects/{project}/locations/{location}/collections/{collection}/indexes/{index}
249273
* - location: projects/{project}/locations/{location}
250274
*
@@ -640,6 +664,32 @@ public function updateCollection(UpdateCollectionRequest $request, array $callOp
640664
return $this->startApiCall('UpdateCollection', $request, $callOptions)->wait();
641665
}
642666

667+
/**
668+
* Updates the parameters of a single Index.
669+
*
670+
* The async variant is {@see VectorSearchServiceClient::updateIndexAsync()} .
671+
*
672+
* @example samples/V1/VectorSearchServiceClient/update_index.php
673+
*
674+
* @param UpdateIndexRequest $request A request to house fields associated with the call.
675+
* @param array $callOptions {
676+
* Optional.
677+
*
678+
* @type RetrySettings|array $retrySettings
679+
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
680+
* associative array of retry settings parameters. See the documentation on
681+
* {@see RetrySettings} for example usage.
682+
* }
683+
*
684+
* @return OperationResponse<Index>
685+
*
686+
* @throws ApiException Thrown if the API call fails.
687+
*/
688+
public function updateIndex(UpdateIndexRequest $request, array $callOptions = []): OperationResponse
689+
{
690+
return $this->startApiCall('UpdateIndex', $request, $callOptions)->wait();
691+
}
692+
643693
/**
644694
* Gets information about a location.
645695
*
@@ -668,13 +718,22 @@ public function getLocation(GetLocationRequest $request, array $callOptions = []
668718

669719
/**
670720
* Lists information about the supported locations for this service.
671-
This method can be called in two ways:
672721
673-
* **List all public locations:** Use the path `GET /v1/locations`.
674-
* **List project-visible locations:** Use the path
675-
`GET /v1/projects/{project_id}/locations`. This may include public
676-
locations as well as private or other locations specifically visible
677-
to the project.
722+
This method lists locations based on the resource scope provided in
723+
the [ListLocationsRequest.name] field:
724+
725+
* **Global locations**: If `name` is empty, the method lists the
726+
public locations available to all projects. * **Project-specific
727+
locations**: If `name` follows the format
728+
`projects/{project}`, the method lists locations visible to that
729+
specific project. This includes public, private, or other
730+
project-specific locations enabled for the project.
731+
732+
For gRPC and client library implementations, the resource name is
733+
passed as the `name` field. For direct service calls, the resource
734+
name is
735+
incorporated into the request path based on the specific service
736+
implementation and version.
678737
*
679738
* The async variant is {@see VectorSearchServiceClient::listLocationsAsync()} .
680739
*

0 commit comments

Comments
 (0)