Skip to content

Commit 8d03ef8

Browse files
lukesneeringerLuke Sneeringer
authored andcommitted
Firestore v1beta1 (#420)
1 parent 776ed95 commit 8d03ef8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+22681
-22
lines changed

.circleci/config.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ jobs:
1616
else
1717
echo "No credentials. System tests will not run."
1818
fi
19+
- run:
20+
name: Decrypt Firestore credentials
21+
command: |
22+
if [ -n "$FIRESTORE_APPLICATION_CREDENTIALS" ]; then
23+
openssl aes-256-cbc -d -a -k "$FIRESTORE_CREDENTIALS_PASSPHRASE" \
24+
-in /var/code/gcp/firestore/tests/credentials.json.enc \
25+
-out "$FIRESTORE_APPLICATION_CREDENTIALS"
26+
else
27+
echo "No Firestore credentials. Firestore system tests will not run."
28+
fi
1929
- run:
2030
name: Add GitHub public key to known hosts
2131
command: |
@@ -66,6 +76,12 @@ jobs:
6676
if [[ -n $(grep error_reporting ~/target_packages) ]]; then
6777
nox -f error_reporting/nox.py
6878
fi
79+
- run:
80+
name: Run tests - google.cloud.firestore
81+
command: |
82+
if [[ -n $(grep firestore ~/target_packages) ]]; then
83+
nox -f firestore/nox.py
84+
fi
6985
- run:
7086
name: Run tests - google.cloud.language
7187
command: |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
https://github.com/googleapis/googleapis-private/
2+
d8c8145fae660d678934024a5e155897efc540e6 (firestore-config branch)
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
// Copyright 2017 Google Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.firestore.admin.v1beta1;
18+
19+
import "google/api/annotations.proto";
20+
import "google/firestore/admin/v1beta1/index.proto";
21+
import "google/longrunning/operations.proto";
22+
import "google/protobuf/empty.proto";
23+
import "google/protobuf/timestamp.proto";
24+
25+
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta1";
26+
option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1beta1;admin";
27+
option java_multiple_files = true;
28+
option java_outer_classname = "FirestoreAdminProto";
29+
option java_package = "com.google.firestore.admin.v1beta1";
30+
option objc_class_prefix = "GCFS";
31+
32+
33+
// The Cloud Firestore Admin API.
34+
//
35+
// This API provides several administrative services for Cloud Firestore.
36+
//
37+
// # Concepts
38+
//
39+
// Project, Database, Namespace, Collection, and Document are used as defined in
40+
// the Google Cloud Firestore API.
41+
//
42+
// Operation: An Operation represents work being performed in the background.
43+
//
44+
//
45+
// # Services
46+
//
47+
// ## Index
48+
//
49+
// The index service manages Cloud Firestore indexes.
50+
//
51+
// Index creation is performed asynchronously.
52+
// An Operation resource is created for each such asynchronous operation.
53+
// The state of the operation (including any errors encountered)
54+
// may be queried via the Operation resource.
55+
//
56+
// ## Metadata
57+
//
58+
// Provides metadata and statistical information about data in Cloud Firestore.
59+
// The data provided as part of this API may be stale.
60+
//
61+
// ## Operation
62+
//
63+
// The Operations collection provides a record of actions performed for the
64+
// specified Project (including any Operations in progress). Operations are not
65+
// created directly but through calls on other collections or resources.
66+
//
67+
// An Operation that is not yet done may be cancelled. The request to cancel is
68+
// asynchronous and the Operation may continue to run for some time after the
69+
// request to cancel is made.
70+
//
71+
// An Operation that is done may be deleted so that it is no longer listed as
72+
// part of the Operation collection.
73+
//
74+
// Operations are created by service `FirestoreAdmin`, but are accessed via
75+
// service `google.longrunning.Operations`.
76+
service FirestoreAdmin {
77+
// Creates the specified index.
78+
// A newly created index's initial state is `CREATING`. On completion of the
79+
// returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`.
80+
// If the index already exists, the call will return an `ALREADY_EXISTS`
81+
// status.
82+
//
83+
// During creation, the process could result in an error, in which case the
84+
// index will move to the `ERROR` state. The process can be recovered by
85+
// fixing the data that caused the error, removing the index with
86+
// [delete][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex], then re-creating the index with
87+
// [create][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex].
88+
//
89+
// Indexes with a single field cannot be created.
90+
rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) {
91+
option (google.api.http) = { post: "/v1beta1/{parent=projects/*/databases/*}/indexes" body: "index" };
92+
}
93+
94+
// Lists the indexes that match the specified filters.
95+
rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) {
96+
option (google.api.http) = { get: "/v1beta1/{parent=projects/*/databases/*}/indexes" };
97+
}
98+
99+
// Gets an index.
100+
rpc GetIndex(GetIndexRequest) returns (Index) {
101+
option (google.api.http) = { get: "/v1beta1/{name=projects/*/databases/*/indexes/*}" };
102+
}
103+
104+
// Deletes an index.
105+
rpc DeleteIndex(DeleteIndexRequest) returns (google.protobuf.Empty) {
106+
option (google.api.http) = { delete: "/v1beta1/{name=projects/*/databases/*/indexes/*}" };
107+
}
108+
}
109+
110+
// Metadata for index operations. This metadata populates
111+
// the metadata field of [google.longrunning.Operation][google.longrunning.Operation].
112+
message IndexOperationMetadata {
113+
// The type of index operation.
114+
enum OperationType {
115+
// Unspecified. Never set by server.
116+
OPERATION_TYPE_UNSPECIFIED = 0;
117+
118+
// The operation is creating the index. Initiated by a `CreateIndex` call.
119+
CREATING_INDEX = 1;
120+
}
121+
122+
// The time that work began on the operation.
123+
google.protobuf.Timestamp start_time = 1;
124+
125+
// The time the operation ended, either successfully or otherwise. Unset if
126+
// the operation is still active.
127+
google.protobuf.Timestamp end_time = 2;
128+
129+
// The index resource that this operation is acting on. For example:
130+
// `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
131+
string index = 3;
132+
133+
// The type of index operation.
134+
OperationType operation_type = 4;
135+
136+
// True if the [google.longrunning.Operation] was cancelled. If the
137+
// cancellation is in progress, cancelled will be true but
138+
// [google.longrunning.Operation.done][google.longrunning.Operation.done] will be false.
139+
bool cancelled = 5;
140+
141+
// Progress of the existing operation, measured in number of documents.
142+
Progress document_progress = 6;
143+
}
144+
145+
// Measures the progress of a particular metric.
146+
message Progress {
147+
// An estimate of how much work has been completed. Note that this may be
148+
// greater than `work_estimated`.
149+
int64 work_completed = 1;
150+
151+
// An estimate of how much work needs to be performed. Zero if the
152+
// work estimate is unavailable. May change as work progresses.
153+
int64 work_estimated = 2;
154+
}
155+
156+
// The request for [FirestoreAdmin.CreateIndex][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex].
157+
message CreateIndexRequest {
158+
// The name of the database this index will apply to. For example:
159+
// `projects/{project_id}/databases/{database_id}`
160+
string parent = 1;
161+
162+
// The index to create. The name and state should not be specified.
163+
// Certain single field indexes cannot be created or deleted.
164+
Index index = 2;
165+
}
166+
167+
// The request for [FirestoreAdmin.GetIndex][google.firestore.admin.v1beta1.FirestoreAdmin.GetIndex].
168+
message GetIndexRequest {
169+
// The name of the index. For example:
170+
// `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
171+
string name = 1;
172+
}
173+
174+
// The request for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta1.FirestoreAdmin.ListIndexes].
175+
message ListIndexesRequest {
176+
// The database name. For example:
177+
// `projects/{project_id}/databases/{database_id}`
178+
string parent = 1;
179+
180+
string filter = 2;
181+
182+
// The standard List page size.
183+
int32 page_size = 3;
184+
185+
// The standard List page token.
186+
string page_token = 4;
187+
}
188+
189+
// The request for [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex].
190+
message DeleteIndexRequest {
191+
// The index name. For example:
192+
// `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
193+
string name = 1;
194+
}
195+
196+
// The response for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta1.FirestoreAdmin.ListIndexes].
197+
message ListIndexesResponse {
198+
// The indexes.
199+
repeated Index indexes = 1;
200+
201+
// The standard List next-page token.
202+
string next_page_token = 2;
203+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// Copyright 2017 Google Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.firestore.admin.v1beta1;
18+
19+
import "google/api/annotations.proto";
20+
21+
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta1";
22+
option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1beta1;admin";
23+
option java_multiple_files = true;
24+
option java_outer_classname = "IndexProto";
25+
option java_package = "com.google.firestore.admin.v1beta1";
26+
option objc_class_prefix = "GCFS";
27+
28+
29+
// A field of an index.
30+
message IndexField {
31+
// The mode determines how a field is indexed.
32+
enum Mode {
33+
// The mode is unspecified.
34+
MODE_UNSPECIFIED = 0;
35+
36+
// The field's values are indexed so as to support sequencing in
37+
// ascending order and also query by <, >, <=, >=, and =.
38+
ASCENDING = 2;
39+
40+
// The field's values are indexed so as to support sequencing in
41+
// descending order and also query by <, >, <=, >=, and =.
42+
DESCENDING = 3;
43+
}
44+
45+
// The path of the field. Must match the field path specification described
46+
// by [google.firestore.v1beta1.Document.fields][fields].
47+
// Special field path `__name__` may be used by itself or at the end of a
48+
// path. `__type__` may be used only at the end of path.
49+
string field_path = 1;
50+
51+
// The field's mode.
52+
Mode mode = 2;
53+
}
54+
55+
// An index definition.
56+
message Index {
57+
// The state of an index. During index creation, an index will be in the
58+
// `CREATING` state. If the index is created successfully, it will transition
59+
// to the `READY` state. If the index is not able to be created, it will
60+
// transition to the `ERROR` state.
61+
enum State {
62+
// The state is unspecified.
63+
STATE_UNSPECIFIED = 0;
64+
65+
// The index is being created.
66+
// There is an active long-running operation for the index.
67+
// The index is updated when writing a document.
68+
// Some index data may exist.
69+
CREATING = 3;
70+
71+
// The index is ready to be used.
72+
// The index is updated when writing a document.
73+
// The index is fully populated from all stored documents it applies to.
74+
READY = 2;
75+
76+
// The index was being created, but something went wrong.
77+
// There is no active long-running operation for the index,
78+
// and the most recently finished long-running operation failed.
79+
// The index is not updated when writing a document.
80+
// Some index data may exist.
81+
ERROR = 5;
82+
}
83+
84+
// The resource name of the index.
85+
string name = 1;
86+
87+
// The collection ID to which this index applies. Required.
88+
string collection_id = 2;
89+
90+
// The fields to index.
91+
repeated IndexField fields = 3;
92+
93+
// The state of the index.
94+
// The state is read-only.
95+
// @OutputOnly
96+
State state = 6;
97+
}

0 commit comments

Comments
 (0)