Skip to content

Commit cc4a856

Browse files
Google APIscopybara-github
authored andcommitted
feat: Added methods for creating and deleting composite indexes
feat: Populated php_namespace PiperOrigin-RevId: 359094122
1 parent 8fbbcbc commit cc4a856

3 files changed

Lines changed: 137 additions & 20 deletions

File tree

google/datastore/admin/v1/datastore_admin.proto

Lines changed: 85 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ option go_package = "google.golang.org/genproto/googleapis/datastore/admin/v1;ad
2828
option java_multiple_files = true;
2929
option java_outer_classname = "DatastoreAdminProto";
3030
option java_package = "com.google.datastore.admin.v1";
31+
option php_namespace = "Google\\Cloud\\Datastore\\Admin\\V1";
3132
option ruby_package = "Google::Cloud::Datastore::Admin::V1";
3233

3334
// Google Cloud Datastore Admin API
@@ -134,6 +135,51 @@ service DatastoreAdmin {
134135
};
135136
}
136137

138+
// Creates the specified index.
139+
// A newly created index's initial state is `CREATING`. On completion of the
140+
// returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`.
141+
// If the index already exists, the call will return an `ALREADY_EXISTS`
142+
// status.
143+
//
144+
// During index creation, the process could result in an error, in which
145+
// case the index will move to the `ERROR` state. The process can be recovered
146+
// by fixing the data that caused the error, removing the index with
147+
// [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex], then
148+
// re-creating the index with [create]
149+
// [google.datastore.admin.v1.DatastoreAdmin.CreateIndex].
150+
//
151+
// Indexes with a single property cannot be created.
152+
rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) {
153+
option (google.api.http) = {
154+
post: "/v1/projects/{project_id}/indexes"
155+
body: "index"
156+
};
157+
option (google.longrunning.operation_info) = {
158+
response_type: "Index"
159+
metadata_type: "IndexOperationMetadata"
160+
};
161+
}
162+
163+
// Deletes an existing index.
164+
// An index can only be deleted if it is in a `READY` or `ERROR` state. On
165+
// successful execution of the request, the index will be in a `DELETING`
166+
// [state][google.datastore.admin.v1.Index.State]. And on completion of the
167+
// returned [google.longrunning.Operation][google.longrunning.Operation], the index will be removed.
168+
//
169+
// During index deletion, the process could result in an error, in which
170+
// case the index will move to the `ERROR` state. The process can be recovered
171+
// by fixing the data that caused the error, followed by calling
172+
// [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex] again.
173+
rpc DeleteIndex(DeleteIndexRequest) returns (google.longrunning.Operation) {
174+
option (google.api.http) = {
175+
delete: "/v1/projects/{project_id}/indexes/{index_id}"
176+
};
177+
option (google.longrunning.operation_info) = {
178+
response_type: "Index"
179+
metadata_type: "IndexOperationMetadata"
180+
};
181+
}
182+
137183
// Gets an index.
138184
rpc GetIndex(GetIndexRequest) returns (Index) {
139185
option (google.api.http) = {
@@ -200,24 +246,6 @@ message CommonMetadata {
200246
State state = 5;
201247
}
202248

203-
// Operation types.
204-
enum OperationType {
205-
// Unspecified.
206-
OPERATION_TYPE_UNSPECIFIED = 0;
207-
208-
// ExportEntities.
209-
EXPORT_ENTITIES = 1;
210-
211-
// ImportEntities.
212-
IMPORT_ENTITIES = 2;
213-
214-
// CreateIndex.
215-
CREATE_INDEX = 3;
216-
217-
// DeleteIndex.
218-
DELETE_INDEX = 4;
219-
}
220-
221249
// Measures the progress of a particular metric.
222250
message Progress {
223251
// The amount of work that has been completed. Note that this may be greater
@@ -325,6 +353,24 @@ message ExportEntitiesMetadata {
325353
string output_url_prefix = 5;
326354
}
327355

356+
// Operation types.
357+
enum OperationType {
358+
// Unspecified.
359+
OPERATION_TYPE_UNSPECIFIED = 0;
360+
361+
// ExportEntities.
362+
EXPORT_ENTITIES = 1;
363+
364+
// ImportEntities.
365+
IMPORT_ENTITIES = 2;
366+
367+
// CreateIndex.
368+
CREATE_INDEX = 3;
369+
370+
// DeleteIndex.
371+
DELETE_INDEX = 4;
372+
}
373+
328374
// Metadata for ImportEntities operations.
329375
message ImportEntitiesMetadata {
330376
// Metadata common to all Datastore Admin operations.
@@ -377,6 +423,27 @@ message EntityFilter {
377423
repeated string namespace_ids = 2;
378424
}
379425

426+
// The request for
427+
// [google.datastore.admin.v1.DatastoreAdmin.CreateIndex][google.datastore.admin.v1.DatastoreAdmin.CreateIndex].
428+
message CreateIndexRequest {
429+
// Project ID against which to make the request.
430+
string project_id = 1;
431+
432+
// The index to create. The name and state fields are output only and will be
433+
// ignored. Single property indexes cannot be created or deleted.
434+
Index index = 3;
435+
}
436+
437+
// The request for
438+
// [google.datastore.admin.v1.DatastoreAdmin.DeleteIndex][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex].
439+
message DeleteIndexRequest {
440+
// Project ID against which to make the request.
441+
string project_id = 1;
442+
443+
// The resource ID of the index to delete.
444+
string index_id = 3;
445+
}
446+
380447
// The request for [google.datastore.admin.v1.DatastoreAdmin.GetIndex][google.datastore.admin.v1.DatastoreAdmin.GetIndex].
381448
message GetIndexRequest {
382449
// Project ID against which to make the request.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
type: google.api.Service
2+
config_version: 3
3+
name: datastore.googleapis.com
4+
title: Cloud Datastore API
5+
6+
apis:
7+
- name: google.datastore.admin.v1.DatastoreAdmin
8+
9+
types:
10+
- name: google.datastore.admin.v1.ExportEntitiesMetadata
11+
- name: google.datastore.admin.v1.ExportEntitiesResponse
12+
- name: google.datastore.admin.v1.ImportEntitiesMetadata
13+
- name: google.datastore.admin.v1.IndexOperationMetadata
14+
15+
documentation:
16+
summary: |-
17+
Accesses the schemaless NoSQL database to provide fully managed, robust,
18+
scalable storage for your application.
19+
20+
backend:
21+
rules:
22+
- selector: 'google.datastore.admin.v1.DatastoreAdmin.*'
23+
deadline: 295.0
24+
- selector: 'google.longrunning.Operations.*'
25+
deadline: 295.0
26+
27+
http:
28+
rules:
29+
- selector: google.longrunning.Operations.CancelOperation
30+
post: '/v1/{name=projects/*/operations/*}:cancel'
31+
- selector: google.longrunning.Operations.DeleteOperation
32+
delete: '/v1/{name=projects/*/operations/*}'
33+
- selector: google.longrunning.Operations.GetOperation
34+
get: '/v1/{name=projects/*/operations/*}'
35+
- selector: google.longrunning.Operations.ListOperations
36+
get: '/v1/{name=projects/*}/operations'
37+
38+
authentication:
39+
rules:
40+
- selector: 'google.datastore.admin.v1.DatastoreAdmin.*'
41+
oauth:
42+
canonical_scopes: |-
43+
https://www.googleapis.com/auth/cloud-platform,
44+
https://www.googleapis.com/auth/datastore
45+
- selector: 'google.longrunning.Operations.*'
46+
oauth:
47+
canonical_scopes: |-
48+
https://www.googleapis.com/auth/cloud-platform,
49+
https://www.googleapis.com/auth/datastore

google/datastore/admin/v1/index.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC.
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -24,9 +24,10 @@ option go_package = "google.golang.org/genproto/googleapis/datastore/admin/v1;ad
2424
option java_multiple_files = true;
2525
option java_outer_classname = "IndexProto";
2626
option java_package = "com.google.datastore.admin.v1";
27+
option php_namespace = "Google\\Cloud\\Datastore\\Admin\\V1";
2728
option ruby_package = "Google::Cloud::Datastore::Admin::V1";
2829

29-
// A minimal index definition.
30+
// Datastore composite index definition.
3031
message Index {
3132
// A property of an index.
3233
message IndexedProperty {

0 commit comments

Comments
 (0)