firestore: publish annotated protos and new retry config

PiperOrigin-RevId: 283565148
This commit is contained in:
Google APIs 2019-12-03 09:52:26 -08:00 committed by Copybara-Service
parent 38dc36a2a4
commit 27ab0db610
4 changed files with 214 additions and 49 deletions

View File

@ -18,6 +18,8 @@ syntax = "proto3";
package google.firestore.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/firestore/v1/common.proto";
import "google/firestore/v1/document.proto";
import "google/firestore/v1/query.proto";
@ -25,7 +27,6 @@ import "google/firestore/v1/write.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/status.proto";
import "google/api/client.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore";
@ -87,6 +88,7 @@ service Firestore {
patch: "/v1/{document.name=projects/*/databases/*/documents/*/**}"
body: "document"
};
option (google.api.method_signature) = "document,update_mask";
}
// Deletes a document.
@ -94,6 +96,7 @@ service Firestore {
option (google.api.http) = {
delete: "/v1/{name=projects/*/databases/*/documents/*/**}"
};
option (google.api.method_signature) = "name";
}
// Gets multiple documents.
@ -113,6 +116,7 @@ service Firestore {
post: "/v1/{database=projects/*/databases/*}/documents:beginTransaction"
body: "*"
};
option (google.api.method_signature) = "database";
}
// Commits a transaction, while optionally updating documents.
@ -121,6 +125,7 @@ service Firestore {
post: "/v1/{database=projects/*/databases/*}/documents:commit"
body: "*"
};
option (google.api.method_signature) = "database,writes";
}
// Rolls back a transaction.
@ -129,6 +134,7 @@ service Firestore {
post: "/v1/{database=projects/*/databases/*}/documents:rollback"
body: "*"
};
option (google.api.method_signature) = "database,transaction";
}
// Runs a query.
@ -169,14 +175,15 @@ service Firestore {
body: "*"
}
};
option (google.api.method_signature) = "parent";
}
}
// The request for [Firestore.GetDocument][google.firestore.v1.Firestore.GetDocument].
message GetDocumentRequest {
// The resource name of the Document to get. In the format:
// Required. The resource name of the Document to get. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string name = 1;
string name = 1 [(google.api.field_behavior) = REQUIRED];
// The fields to return. If not set, returns all fields.
//
@ -198,17 +205,17 @@ message GetDocumentRequest {
// The request for [Firestore.ListDocuments][google.firestore.v1.Firestore.ListDocuments].
message ListDocumentsRequest {
// The parent resource name. In the format:
// Required. The parent resource name. In the format:
// `projects/{project_id}/databases/{database_id}/documents` or
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// For example:
// `projects/my-project/databases/my-database/documents` or
// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
string parent = 1;
string parent = 1 [(google.api.field_behavior) = REQUIRED];
// The collection ID, relative to `parent`, to list. For example: `chatrooms`
// Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`
// or `messages`.
string collection_id = 2;
string collection_id = 2 [(google.api.field_behavior) = REQUIRED];
// The maximum number of documents to return.
int32 page_size = 3;
@ -257,21 +264,21 @@ message ListDocumentsResponse {
// The request for [Firestore.CreateDocument][google.firestore.v1.Firestore.CreateDocument].
message CreateDocumentRequest {
// The parent resource. For example:
// Required. The parent resource. For example:
// `projects/{project_id}/databases/{database_id}/documents` or
// `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
string parent = 1;
string parent = 1 [(google.api.field_behavior) = REQUIRED];
// The collection ID, relative to `parent`, to list. For example: `chatrooms`.
string collection_id = 2;
// Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`.
string collection_id = 2 [(google.api.field_behavior) = REQUIRED];
// The client-assigned document ID to use for this document.
//
// Optional. If not specified, an ID will be assigned by the service.
string document_id = 3;
// The document to create. `name` must not be set.
Document document = 4;
// Required. The document to create. `name` must not be set.
Document document = 4 [(google.api.field_behavior) = REQUIRED];
// The fields to return. If not set, returns all fields.
//
@ -282,9 +289,9 @@ message CreateDocumentRequest {
// The request for [Firestore.UpdateDocument][google.firestore.v1.Firestore.UpdateDocument].
message UpdateDocumentRequest {
// The updated document.
// Required. The updated document.
// Creates the document if it does not already exist.
Document document = 1;
Document document = 1 [(google.api.field_behavior) = REQUIRED];
// The fields to update.
// None of the field paths in the mask may contain a reserved name.
@ -308,9 +315,9 @@ message UpdateDocumentRequest {
// The request for [Firestore.DeleteDocument][google.firestore.v1.Firestore.DeleteDocument].
message DeleteDocumentRequest {
// The resource name of the Document to delete. In the format:
// Required. The resource name of the Document to delete. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string name = 1;
string name = 1 [(google.api.field_behavior) = REQUIRED];
// An optional precondition on the document.
// The request will fail if this is set and not met by the target document.
@ -319,9 +326,9 @@ message DeleteDocumentRequest {
// The request for [Firestore.BatchGetDocuments][google.firestore.v1.Firestore.BatchGetDocuments].
message BatchGetDocumentsRequest {
// The database name. In the format:
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1;
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The names of the documents to retrieve. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
@ -380,9 +387,9 @@ message BatchGetDocumentsResponse {
// The request for [Firestore.BeginTransaction][google.firestore.v1.Firestore.BeginTransaction].
message BeginTransactionRequest {
// The database name. In the format:
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1;
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The options for the transaction.
// Defaults to a read-write transaction.
@ -397,9 +404,9 @@ message BeginTransactionResponse {
// The request for [Firestore.Commit][google.firestore.v1.Firestore.Commit].
message CommitRequest {
// The database name. In the format:
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1;
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The writes to apply.
//
@ -424,23 +431,23 @@ message CommitResponse {
// The request for [Firestore.Rollback][google.firestore.v1.Firestore.Rollback].
message RollbackRequest {
// The database name. In the format:
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1;
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The transaction to roll back.
bytes transaction = 2;
// Required. The transaction to roll back.
bytes transaction = 2 [(google.api.field_behavior) = REQUIRED];
}
// The request for [Firestore.RunQuery][google.firestore.v1.Firestore.RunQuery].
message RunQueryRequest {
// The parent resource name. In the format:
// Required. The parent resource name. In the format:
// `projects/{project_id}/databases/{database_id}/documents` or
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// For example:
// `projects/my-project/databases/my-database/documents` or
// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
string parent = 1;
string parent = 1 [(google.api.field_behavior) = REQUIRED];
// The query to run.
oneof query_type {
@ -503,10 +510,10 @@ message RunQueryResponse {
// given token, then a response containing only an up-to-date token, to use in
// the next request.
message WriteRequest {
// The database name. In the format:
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
// This is only required in the first message.
string database = 1;
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The ID of the write stream to resume.
// This may only be set in the first message. When left empty, a new write
@ -565,9 +572,9 @@ message WriteResponse {
// A request for [Firestore.Listen][google.firestore.v1.Firestore.Listen]
message ListenRequest {
// The database name. In the format:
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1;
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The supported target changes.
oneof target_change {
@ -734,11 +741,11 @@ message TargetChange {
// The request for [Firestore.ListCollectionIds][google.firestore.v1.Firestore.ListCollectionIds].
message ListCollectionIdsRequest {
// The parent document. In the format:
// Required. The parent document. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// For example:
// `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
string parent = 1;
string parent = 1 [(google.api.field_behavior) = REQUIRED];
// The maximum number of results to return.
int32 page_size = 2;

View File

@ -0,0 +1,114 @@
{
"methodConfig": [
{
"name": [
{
"service": "google.firestore.v1.Firestore",
"method": "CreateDocument"
},
{
"service": "google.firestore.v1.Firestore",
"method": "UpdateDocument"
},
{
"service": "google.firestore.v1.Firestore",
"method": "Commit"
}
],
"timeout": "60s"
},
{
"name": [
{
"service": "google.firestore.v1.Firestore",
"method": "BatchGetDocuments"
},
{
"service": "google.firestore.v1.Firestore",
"method": "RunQuery"
}
],
"timeout": "300s",
"retryPolicy": {
"maxAttempts": 5,
"initialBackoff": "0.100s",
"maxBackoff": "60s",
"backoffMultiplier": 1.3,
"retryableStatusCodes": [
"UNAVAILABLE",
"INTERNAL",
"DEADLINE_EXCEEDED"
]
}
},
{
"name": [
{
"service": "google.firestore.v1.Firestore",
"method": "Listen"
}
],
"timeout": "86400s",
"retryPolicy": {
"maxAttempts": 5,
"initialBackoff": "0.100s",
"maxBackoff": "60s",
"backoffMultiplier": 1.3,
"retryableStatusCodes": [
"UNAVAILABLE",
"INTERNAL",
"DEADLINE_EXCEEDED"
]
}
},
{
"name": [
{
"service": "google.firestore.v1.Firestore",
"method": "Write"
}
],
"timeout": "86400s"
},
{
"name": [
{
"service": "google.firestore.v1.Firestore",
"method": "GetDocument"
},
{
"service": "google.firestore.v1.Firestore",
"method": "ListDocuments"
},
{
"service": "google.firestore.v1.Firestore",
"method": "DeleteDocument"
},
{
"service": "google.firestore.v1.Firestore",
"method": "BeginTransaction"
},
{
"service": "google.firestore.v1.Firestore",
"method": "Rollback"
},
{
"service": "google.firestore.v1.Firestore",
"method": "ListCollectionIds"
}
],
"timeout": "60s",
"retryPolicy": {
"maxAttempts": 5,
"initialBackoff": "0.100s",
"maxBackoff": "60s",
"backoffMultiplier": 1.3,
"retryableStatusCodes": [
"UNAVAILABLE",
"INTERNAL",
"DEADLINE_EXCEEDED"
]
}
}
]
}

View File

@ -0,0 +1,44 @@
type: google.api.Service
config_version: 3
name: firestore.googleapis.com
title: Cloud Firestore API
apis:
- name: google.firestore.v1.Firestore
documentation:
summary: |-
Accesses the NoSQL document database built for automatic scaling, high
performance, and ease of application development.
backend:
rules:
- selector: 'google.firestore.v1.Firestore.*'
deadline: 295.0
- selector: 'google.longrunning.Operations.*'
deadline: 295.0
http:
rules:
- selector: google.longrunning.Operations.CancelOperation
post: '/v1/{name=projects/*/databases/*/operations/*}:cancel'
body: '*'
- selector: google.longrunning.Operations.DeleteOperation
delete: '/v1/{name=projects/*/databases/*/operations/*}'
- selector: google.longrunning.Operations.GetOperation
get: '/v1/{name=projects/*/databases/*/operations/*}'
- selector: google.longrunning.Operations.ListOperations
get: '/v1/{name=projects/*/databases/*}/operations'
authentication:
rules:
- selector: 'google.firestore.v1.Firestore.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform,
https://www.googleapis.com/auth/datastore
- selector: 'google.longrunning.Operations.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform,
https://www.googleapis.com/auth/datastore

View File

@ -146,15 +146,6 @@ message StructuredQuery {
}
}
// The projection of document's fields to return.
message Projection {
// The fields to return.
//
// If empty, all fields are returned. To only return the name
// of the document, use `['__name__']`.
repeated FieldReference fields = 2;
}
// An order on a field.
message Order {
// The field to order by.
@ -164,11 +155,6 @@ message StructuredQuery {
Direction direction = 2;
}
// A reference to a field, such as `max(messages.time) as max_time`.
message FieldReference {
string field_path = 2;
}
// A sort direction.
enum Direction {
// Unspecified.
@ -181,6 +167,20 @@ message StructuredQuery {
DESCENDING = 2;
}
// A reference to a field, such as `max(messages.time) as max_time`.
message FieldReference {
string field_path = 2;
}
// The projection of document's fields to return.
message Projection {
// The fields to return.
//
// If empty, all fields are returned. To only return the name
// of the document, use `['__name__']`.
repeated FieldReference fields = 2;
}
// The projection to return.
Projection select = 1;