diff --git a/google/datastore/admin/datastore_admin.yaml b/google/datastore/admin/datastore_admin.yaml index 0e8c32f8..112229c5 100644 --- a/google/datastore/admin/datastore_admin.yaml +++ b/google/datastore/admin/datastore_admin.yaml @@ -10,6 +10,7 @@ types: - name: google.datastore.admin.v1.ExportEntitiesMetadata - name: google.datastore.admin.v1.ExportEntitiesResponse - name: google.datastore.admin.v1.ImportEntitiesMetadata +- name: google.datastore.admin.v1.IndexOperationMetadata documentation: summary: |- diff --git a/google/datastore/admin/v1/datastore_admin.proto b/google/datastore/admin/v1/datastore_admin.proto index 44139f3d..f8eb3a1c 100644 --- a/google/datastore/admin/v1/datastore_admin.proto +++ b/google/datastore/admin/v1/datastore_admin.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ syntax = "proto3"; package google.datastore.admin.v1; import "google/api/annotations.proto"; +import "google/datastore/admin/v1/index.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/timestamp.proto"; @@ -26,7 +27,6 @@ option java_multiple_files = true; option java_outer_classname = "DatastoreAdminProto"; option java_package = "com.google.datastore.admin.v1"; - // Google Cloud Datastore Admin API // // The Datastore Admin API provides several admin services for Cloud Datastore. @@ -61,6 +61,15 @@ option java_package = "com.google.datastore.admin.v1"; // created for each export/import. The state (including any errors encountered) // of the export/import may be queried via the Operation resource. // +// # Index +// +// The index service manages Cloud Datastore composite indexes. +// +// Index creation and deletion are performed asynchronously. +// An Operation resource is created for each such asynchronous operation. +// The state of the operation (including any errors encountered) +// may be queried via the Operation resource. +// // # Operation // // The Operations collection provides a record of actions performed for the @@ -105,6 +114,22 @@ service DatastoreAdmin { body: "*" }; } + + // Gets an index. + rpc GetIndex(GetIndexRequest) returns (Index) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/indexes/{index_id}" + }; + } + + // Lists the indexes that match the specified filters. Datastore uses an + // eventually consistent query to fetch the list of indexes and may + // occasionally return stale results. + rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) { + option (google.api.http) = { + get: "/v1/projects/{project_id}/indexes" + }; + } } // Metadata common to all Datastore Admin operations. @@ -315,6 +340,54 @@ message EntityFilter { repeated string namespace_ids = 2; } +// The request for +// [google.datastore.admin.v1.DatastoreAdmin.GetIndex][google.datastore.admin.v1.DatastoreAdmin.GetIndex]. +message GetIndexRequest { + // Project ID against which to make the request. + string project_id = 1; + + // The resource ID of the index to get. + string index_id = 3; +} + +// The request for +// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes]. +message ListIndexesRequest { + // Project ID against which to make the request. + string project_id = 1; + + string filter = 3; + + // The maximum number of items to return. If zero, then all results will be + // returned. + int32 page_size = 4; + + // The next_page_token value returned from a previous List request, if any. + string page_token = 5; +} + +// The response for +// [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes]. +message ListIndexesResponse { + // The indexes. + repeated Index indexes = 1; + + // The standard List next-page token. + string next_page_token = 2; +} + +// Metadata for Index operations. +message IndexOperationMetadata { + // Metadata common to all Datastore Admin operations. + CommonMetadata common = 1; + + // An estimate of the number of entities processed. + Progress progress_entities = 2; + + // The index resource ID that this operation is acting on. + string index_id = 3; +} + // Operation types. enum OperationType { // Unspecified. @@ -325,4 +398,10 @@ enum OperationType { // ImportEntities. IMPORT_ENTITIES = 2; + + // CreateIndex. + CREATE_INDEX = 3; + + // DeleteIndex. + DELETE_INDEX = 4; } diff --git a/google/datastore/admin/v1/index.proto b/google/datastore/admin/v1/index.proto new file mode 100644 index 00000000..15013d55 --- /dev/null +++ b/google/datastore/admin/v1/index.proto @@ -0,0 +1,122 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.datastore.admin.v1; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Datastore.Admin.V1"; +option go_package = "google.golang.org/genproto/googleapis/datastore/admin/v1;admin"; +option java_multiple_files = true; +option java_outer_classname = "IndexProto"; +option java_package = "com.google.datastore.admin.v1"; + +// A minimal index definition. +// Next tag: 8 +message Index { + // Next tag: 3 + message IndexedProperty { + // The property name to index. + // Required. + string name = 1; + + // The indexed property's direction. Must not be DIRECTION_UNSPECIFIED. + // Required. + Direction direction = 2; + } + + // For an ordered index, specifies whether each of the entity's ancestors + // will be included. + enum AncestorMode { + // The ancestor mode is unspecified. + ANCESTOR_MODE_UNSPECIFIED = 0; + + // Do not include the entity's ancestors in the index. + NONE = 1; + + // Include all the entity's ancestors in the index. + ALL_ANCESTORS = 2; + } + + // The direction determines how a property is indexed. + enum Direction { + // The direction is unspecified. + DIRECTION_UNSPECIFIED = 0; + + // The property's values are indexed so as to support sequencing in + // ascending order and also query by <, >, <=, >=, and =. + ASCENDING = 1; + + // The property's values are indexed so as to support sequencing in + // descending order and also query by <, >, <=, >=, and =. + DESCENDING = 2; + } + + // The possible set of states of an index. + enum State { + // The state is unspecified. + STATE_UNSPECIFIED = 0; + + // The index is being created, and cannot be used by queries. + // There is an active long-running operation for the index. + // The index is updated when writing an entity. + // Some index data may exist. + CREATING = 1; + + // The index is ready to be used. + // The index is updated when writing an entity. + // The index is fully populated from all stored entities it applies to. + READY = 2; + + // The index is being deleted, and cannot be used by queries. + // There is an active long-running operation for the index. + // The index is not updated when writing an entity. + // Some index data may exist. + DELETING = 3; + + // The index was being created or deleted, but something went wrong. + // The index cannot by used by queries. + // There is no active long-running operation for the index, + // and the most recently finished long-running operation failed. + // The index is not updated when writing an entity. + // Some index data may exist. + ERROR = 4; + } + + // Project ID. + // Output only. + string project_id = 1; + + // The resource ID of the index. + // Output only. + string index_id = 3; + + // The entity kind to which this index applies. + // Required. + string kind = 4; + + // The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED. + // Required. + AncestorMode ancestor = 5; + + // An ordered sequence of property names and their index attributes. + // Required. + repeated IndexedProperty properties = 6; + + // The state of the index. + // Output only. + State state = 7; +}