initial commit

This commit is contained in:
2025-09-01 22:12:29 +02:00
parent b1873f9c1d
commit 02a54f61c0
5598 changed files with 903558 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,120 @@
// Copyright 2020 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.
//
// This file defines the format of Firestore bundle file/stream. It is not a part of the
// Firestore API, only a specification used by Server and Client SDK to write and read
// bundles.
syntax = "proto3";
package firestore;
import "google/firestore/v1/document.proto";
import "google/firestore/v1/query.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Firestore.Proto";
option go_package = "google.golang.org/genproto/firestore/proto;firestore";
option java_multiple_files = true;
option java_outer_classname = "BundleProto";
option java_package = "com.google.firestore.proto";
option objc_class_prefix = "FSTPB";
option php_namespace = "Firestore\\Proto";
// Encodes a query saved in the bundle.
message BundledQuery {
// The parent resource name.
string parent = 1;
// The query to run.
oneof query_type {
// A structured query.
google.firestore.v1.StructuredQuery structured_query = 2;
}
// If the query is a limit query, should the limit be applied to the beginning or
// the end of results.
enum LimitType {
FIRST = 0;
LAST = 1;
}
LimitType limit_type = 3;
}
// A Query associated with a name, created as part of the bundle file, and can be read
// by client SDKs once the bundle containing them is loaded.
message NamedQuery {
// Name of the query, such that client can use the name to load this query
// from bundle, and resume from when the query results are materialized
// into this bundle.
string name = 1;
// The query saved in the bundle.
BundledQuery bundled_query = 2;
// The read time of the query, when it is used to build the bundle. This is useful to
// resume the query from the bundle, once it is loaded by client SDKs.
google.protobuf.Timestamp read_time = 3;
}
// Metadata describing a Firestore document saved in the bundle.
message BundledDocumentMetadata {
// The document key of a bundled document.
string name = 1;
// The snapshot version of the document data bundled.
google.protobuf.Timestamp read_time = 2;
// Whether the document exists.
bool exists = 3;
// The names of the queries in this bundle that this document matches to.
repeated string queries = 4;
}
// Metadata describing the bundle file/stream.
message BundleMetadata {
// The ID of the bundle.
string id = 1;
// Time at which the documents snapshot is taken for this bundle.
google.protobuf.Timestamp create_time = 2;
// The schema version of the bundle.
uint32 version = 3;
// The number of documents in the bundle.
uint32 total_documents = 4;
// The size of the bundle in bytes, excluding this `BundleMetadata`.
uint64 total_bytes = 5;
}
// A Firestore bundle is a length-prefixed stream of JSON representations of
// `BundleElement`.
// Only one `BundleMetadata` is expected, and it should be the first element.
// The named queries follow after `metadata`. Every `document_metadata` is
// immediately followed by a `document`.
message BundleElement {
oneof element_type {
BundleMetadata metadata = 1;
NamedQuery named_query = 2;
BundledDocumentMetadata document_metadata = 3;
google.firestore.v1.Document document = 4;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,31 @@
// Copyright 2024 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.api;
import "google/api/http.proto";
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}

View File

@@ -0,0 +1,480 @@
// Copyright 2024 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.api;
import "google/api/launch_stage.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/duration.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "ClientProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.MethodOptions {
// A definition of a client library method signature.
//
// In client libraries, each proto RPC corresponds to one or more methods
// which the end user is able to call, and calls the underlying RPC.
// Normally, this method receives a single argument (a struct or instance
// corresponding to the RPC request object). Defining this field will
// add one or more overloads providing flattened or simpler method signatures
// in some languages.
//
// The fields on the method signature are provided as a comma-separated
// string.
//
// For example, the proto RPC and annotation:
//
// rpc CreateSubscription(CreateSubscriptionRequest)
// returns (Subscription) {
// option (google.api.method_signature) = "name,topic";
// }
//
// Would add the following Java overload (in addition to the method accepting
// the request object):
//
// public final Subscription createSubscription(String name, String topic)
//
// The following backwards-compatibility guidelines apply:
//
// * Adding this annotation to an unannotated method is backwards
// compatible.
// * Adding this annotation to a method which already has existing
// method signature annotations is backwards compatible if and only if
// the new method signature annotation is last in the sequence.
// * Modifying or removing an existing method signature annotation is
// a breaking change.
// * Re-ordering existing method signature annotations is a breaking
// change.
repeated string method_signature = 1051;
}
extend google.protobuf.ServiceOptions {
// The hostname for this service.
// This should be specified with no prefix or protocol.
//
// Example:
//
// service Foo {
// option (google.api.default_host) = "foo.googleapi.com";
// ...
// }
string default_host = 1049;
// OAuth scopes needed for the client.
//
// Example:
//
// service Foo {
// option (google.api.oauth_scopes) = \
// "https://www.googleapis.com/auth/cloud-platform";
// ...
// }
//
// If there is more than one scope, use a comma-separated string:
//
// Example:
//
// service Foo {
// option (google.api.oauth_scopes) = \
// "https://www.googleapis.com/auth/cloud-platform,"
// "https://www.googleapis.com/auth/monitoring";
// ...
// }
string oauth_scopes = 1050;
// The API version of this service, which should be sent by version-aware
// clients to the service. This allows services to abide by the schema and
// behavior of the service at the time this API version was deployed.
// The format of the API version must be treated as opaque by clients.
// Services may use a format with an apparent structure, but clients must
// not rely on this to determine components within an API version, or attempt
// to construct other valid API versions. Note that this is for upcoming
// functionality and may not be implemented for all services.
//
// Example:
//
// service Foo {
// option (google.api.api_version) = "v1_20230821_preview";
// }
string api_version = 525000001;
}
// Required information for every language.
message CommonLanguageSettings {
// Link to automatically generated reference documentation. Example:
// https://cloud.google.com/nodejs/docs/reference/asset/latest
string reference_docs_uri = 1 [deprecated = true];
// The destination where API teams want this client library to be published.
repeated ClientLibraryDestination destinations = 2;
// Configuration for which RPCs should be generated in the GAPIC client.
SelectiveGapicGeneration selective_gapic_generation = 3;
}
// Details about how and where to publish client libraries.
message ClientLibrarySettings {
// Version of the API to apply these settings to. This is the full protobuf
// package for the API, ending in the version element.
// Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1".
string version = 1;
// Launch stage of this version of the API.
LaunchStage launch_stage = 2;
// When using transport=rest, the client request will encode enums as
// numbers rather than strings.
bool rest_numeric_enums = 3;
// Settings for legacy Java features, supported in the Service YAML.
JavaSettings java_settings = 21;
// Settings for C++ client libraries.
CppSettings cpp_settings = 22;
// Settings for PHP client libraries.
PhpSettings php_settings = 23;
// Settings for Python client libraries.
PythonSettings python_settings = 24;
// Settings for Node client libraries.
NodeSettings node_settings = 25;
// Settings for .NET client libraries.
DotnetSettings dotnet_settings = 26;
// Settings for Ruby client libraries.
RubySettings ruby_settings = 27;
// Settings for Go client libraries.
GoSettings go_settings = 28;
}
// This message configures the settings for publishing [Google Cloud Client
// libraries](https://cloud.google.com/apis/docs/cloud-client-libraries)
// generated from the service config.
message Publishing {
// A list of API method settings, e.g. the behavior for methods that use the
// long-running operation pattern.
repeated MethodSettings method_settings = 2;
// Link to a *public* URI where users can report issues. Example:
// https://issuetracker.google.com/issues/new?component=190865&template=1161103
string new_issue_uri = 101;
// Link to product home page. Example:
// https://cloud.google.com/asset-inventory/docs/overview
string documentation_uri = 102;
// Used as a tracking tag when collecting data about the APIs developer
// relations artifacts like docs, packages delivered to package managers,
// etc. Example: "speech".
string api_short_name = 103;
// GitHub label to apply to issues and pull requests opened for this API.
string github_label = 104;
// GitHub teams to be added to CODEOWNERS in the directory in GitHub
// containing source code for the client libraries for this API.
repeated string codeowner_github_teams = 105;
// A prefix used in sample code when demarking regions to be included in
// documentation.
string doc_tag_prefix = 106;
// For whom the client library is being published.
ClientLibraryOrganization organization = 107;
// Client library settings. If the same version string appears multiple
// times in this list, then the last one wins. Settings from earlier
// settings with the same version string are discarded.
repeated ClientLibrarySettings library_settings = 109;
// Optional link to proto reference documentation. Example:
// https://cloud.google.com/pubsub/lite/docs/reference/rpc
string proto_reference_documentation_uri = 110;
// Optional link to REST reference documentation. Example:
// https://cloud.google.com/pubsub/lite/docs/reference/rest
string rest_reference_documentation_uri = 111;
}
// Settings for Java client libraries.
message JavaSettings {
// The package name to use in Java. Clobbers the java_package option
// set in the protobuf. This should be used **only** by APIs
// who have already set the language_settings.java.package_name" field
// in gapic.yaml. API teams should use the protobuf java_package option
// where possible.
//
// Example of a YAML configuration::
//
// publishing:
// java_settings:
// library_package: com.google.cloud.pubsub.v1
string library_package = 1;
// Configure the Java class name to use instead of the service's for its
// corresponding generated GAPIC client. Keys are fully-qualified
// service names as they appear in the protobuf (including the full
// the language_settings.java.interface_names" field in gapic.yaml. API
// teams should otherwise use the service name as it appears in the
// protobuf.
//
// Example of a YAML configuration::
//
// publishing:
// java_settings:
// service_class_names:
// - google.pubsub.v1.Publisher: TopicAdmin
// - google.pubsub.v1.Subscriber: SubscriptionAdmin
map<string, string> service_class_names = 2;
// Some settings.
CommonLanguageSettings common = 3;
}
// Settings for C++ client libraries.
message CppSettings {
// Some settings.
CommonLanguageSettings common = 1;
}
// Settings for Php client libraries.
message PhpSettings {
// Some settings.
CommonLanguageSettings common = 1;
}
// Settings for Python client libraries.
message PythonSettings {
// Experimental features to be included during client library generation.
// These fields will be deprecated once the feature graduates and is enabled
// by default.
message ExperimentalFeatures {
// Enables generation of asynchronous REST clients if `rest` transport is
// enabled. By default, asynchronous REST clients will not be generated.
// This feature will be enabled by default 1 month after launching the
// feature in preview packages.
bool rest_async_io_enabled = 1;
// Enables generation of protobuf code using new types that are more
// Pythonic which are included in `protobuf>=5.29.x`. This feature will be
// enabled by default 1 month after launching the feature in preview
// packages.
bool protobuf_pythonic_types_enabled = 2;
}
// Some settings.
CommonLanguageSettings common = 1;
// Experimental features to be included during client library generation.
ExperimentalFeatures experimental_features = 2;
}
// Settings for Node client libraries.
message NodeSettings {
// Some settings.
CommonLanguageSettings common = 1;
}
// Settings for Dotnet client libraries.
message DotnetSettings {
// Some settings.
CommonLanguageSettings common = 1;
// Map from original service names to renamed versions.
// This is used when the default generated types
// would cause a naming conflict. (Neither name is
// fully-qualified.)
// Example: Subscriber to SubscriberServiceApi.
map<string, string> renamed_services = 2;
// Map from full resource types to the effective short name
// for the resource. This is used when otherwise resource
// named from different services would cause naming collisions.
// Example entry:
// "datalabeling.googleapis.com/Dataset": "DataLabelingDataset"
map<string, string> renamed_resources = 3;
// List of full resource types to ignore during generation.
// This is typically used for API-specific Location resources,
// which should be handled by the generator as if they were actually
// the common Location resources.
// Example entry: "documentai.googleapis.com/Location"
repeated string ignored_resources = 4;
// Namespaces which must be aliased in snippets due to
// a known (but non-generator-predictable) naming collision
repeated string forced_namespace_aliases = 5;
// Method signatures (in the form "service.method(signature)")
// which are provided separately, so shouldn't be generated.
// Snippets *calling* these methods are still generated, however.
repeated string handwritten_signatures = 6;
}
// Settings for Ruby client libraries.
message RubySettings {
// Some settings.
CommonLanguageSettings common = 1;
}
// Settings for Go client libraries.
message GoSettings {
// Some settings.
CommonLanguageSettings common = 1;
// Map of service names to renamed services. Keys are the package relative
// service names and values are the name to be used for the service client
// and call options.
//
// publishing:
// go_settings:
// renamed_services:
// Publisher: TopicAdmin
map<string, string> renamed_services = 2;
}
// Describes the generator configuration for a method.
message MethodSettings {
// Describes settings to use when generating API methods that use the
// long-running operation pattern.
// All default values below are from those used in the client library
// generators (e.g.
// [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)).
message LongRunning {
// Initial delay after which the first poll request will be made.
// Default value: 5 seconds.
google.protobuf.Duration initial_poll_delay = 1;
// Multiplier to gradually increase delay between subsequent polls until it
// reaches max_poll_delay.
// Default value: 1.5.
float poll_delay_multiplier = 2;
// Maximum time between two subsequent poll requests.
// Default value: 45 seconds.
google.protobuf.Duration max_poll_delay = 3;
// Total polling timeout.
// Default value: 5 minutes.
google.protobuf.Duration total_poll_timeout = 4;
}
// The fully qualified name of the method, for which the options below apply.
// This is used to find the method to apply the options.
//
// Example:
//
// publishing:
// method_settings:
// - selector: google.storage.control.v2.StorageControl.CreateFolder
// # method settings for CreateFolder...
string selector = 1;
// Describes settings to use for long-running operations when generating
// API methods for RPCs. Complements RPCs that use the annotations in
// google/longrunning/operations.proto.
//
// Example of a YAML configuration::
//
// publishing:
// method_settings:
// - selector: google.cloud.speech.v2.Speech.BatchRecognize
// long_running:
// initial_poll_delay: 60s # 1 minute
// poll_delay_multiplier: 1.5
// max_poll_delay: 360s # 6 minutes
// total_poll_timeout: 54000s # 90 minutes
LongRunning long_running = 2;
// List of top-level fields of the request message, that should be
// automatically populated by the client libraries based on their
// (google.api.field_info).format. Currently supported format: UUID4.
//
// Example of a YAML configuration:
//
// publishing:
// method_settings:
// - selector: google.example.v1.ExampleService.CreateExample
// auto_populated_fields:
// - request_id
repeated string auto_populated_fields = 3;
}
// The organization for which the client libraries are being published.
// Affects the url where generated docs are published, etc.
enum ClientLibraryOrganization {
// Not useful.
CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0;
// Google Cloud Platform Org.
CLOUD = 1;
// Ads (Advertising) Org.
ADS = 2;
// Photos Org.
PHOTOS = 3;
// Street View Org.
STREET_VIEW = 4;
// Shopping Org.
SHOPPING = 5;
// Geo Org.
GEO = 6;
// Generative AI - https://developers.generativeai.google
GENERATIVE_AI = 7;
}
// To where should client libraries be published?
enum ClientLibraryDestination {
// Client libraries will neither be generated nor published to package
// managers.
CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0;
// Generate the client library in a repo under github.com/googleapis,
// but don't publish it to package managers.
GITHUB = 10;
// Publish the library to package managers like nuget.org and npmjs.com.
PACKAGE_MANAGER = 20;
}
// This message is used to configure the generation of a subset of the RPCs in
// a service for client libraries.
message SelectiveGapicGeneration {
// An allowlist of the fully qualified names of RPCs that should be included
// on public client surfaces.
repeated string methods = 1;
// Setting this to true indicates to the client generators that methods
// that would be excluded from the generation should instead be generated
// in a way that indicates these methods should not be consumed by
// end users. How this is expressed is up to individual language
// implementations to decide. Some examples may be: added annotations,
// obfuscated identifiers, or other language idiomatic patterns.
bool generate_omitted_as_internal = 2;
}

View File

@@ -0,0 +1,104 @@
// Copyright 2024 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.api;
import "google/protobuf/descriptor.proto";
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "FieldBehaviorProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.FieldOptions {
// A designation of a specific field behavior (required, output only, etc.)
// in protobuf messages.
//
// Examples:
//
// string name = 1 [(google.api.field_behavior) = REQUIRED];
// State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// google.protobuf.Duration ttl = 1
// [(google.api.field_behavior) = INPUT_ONLY];
// google.protobuf.Timestamp expire_time = 1
// [(google.api.field_behavior) = OUTPUT_ONLY,
// (google.api.field_behavior) = IMMUTABLE];
repeated google.api.FieldBehavior field_behavior = 1052 [packed = false];
}
// An indicator of the behavior of a given field (for example, that a field
// is required in requests, or given as output but ignored as input).
// This **does not** change the behavior in protocol buffers itself; it only
// denotes the behavior and may affect how API tooling handles the field.
//
// Note: This enum **may** receive new values in the future.
enum FieldBehavior {
// Conventional default for enums. Do not use this.
FIELD_BEHAVIOR_UNSPECIFIED = 0;
// Specifically denotes a field as optional.
// While all fields in protocol buffers are optional, this may be specified
// for emphasis if appropriate.
OPTIONAL = 1;
// Denotes a field as required.
// This indicates that the field **must** be provided as part of the request,
// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
REQUIRED = 2;
// Denotes a field as output only.
// This indicates that the field is provided in responses, but including the
// field in a request does nothing (the server *must* ignore it and
// *must not* throw an error as a result of the field's presence).
OUTPUT_ONLY = 3;
// Denotes a field as input only.
// This indicates that the field is provided in requests, and the
// corresponding field is not included in output.
INPUT_ONLY = 4;
// Denotes a field as immutable.
// This indicates that the field may be set once in a request to create a
// resource, but may not be changed thereafter.
IMMUTABLE = 5;
// Denotes that a (repeated) field is an unordered list.
// This indicates that the service may provide the elements of the list
// in any arbitrary order, rather than the order the user originally
// provided. Additionally, the list's order may or may not be stable.
UNORDERED_LIST = 6;
// Denotes that this field returns a non-empty default value if not set.
// This indicates that if the user provides the empty value in a request,
// a non-empty value will be returned. The user will not be aware of what
// non-empty value to expect.
NON_EMPTY_DEFAULT = 7;
// Denotes that the field in a resource (a message annotated with
// google.api.resource) is used in the resource name to uniquely identify the
// resource. For AIP-compliant APIs, this should only be applied to the
// `name` field on the resource.
//
// This behavior should not be applied to references to other resources within
// the message.
//
// The identifier field of resources often have different field behavior
// depending on the request it is embedded in (e.g. for Create methods name
// is optional and unused, while for Update methods it is required). Instead
// of method-specific annotations, only `IDENTIFIER` is required.
IDENTIFIER = 8;
}

View File

@@ -0,0 +1,371 @@
// Copyright 2024 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.api;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "HttpProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// Defines the HTTP configuration for an API service. It contains a list of
// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
// to one or more HTTP REST API methods.
message Http {
// A list of HTTP configuration rules that apply to individual API methods.
//
// **NOTE:** All service configuration rules follow "last one wins" order.
repeated HttpRule rules = 1;
// When set to true, URL path parameters will be fully URI-decoded except in
// cases of single segment matches in reserved expansion, where "%2F" will be
// left encoded.
//
// The default behavior is to not decode RFC 6570 reserved characters in multi
// segment matches.
bool fully_decode_reserved_expansion = 2;
}
// gRPC Transcoding
//
// gRPC Transcoding is a feature for mapping between a gRPC method and one or
// more HTTP REST endpoints. It allows developers to build a single API service
// that supports both gRPC APIs and REST APIs. Many systems, including [Google
// APIs](https://github.com/googleapis/googleapis),
// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
// and use it for large scale production services.
//
// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
// how different portions of the gRPC request message are mapped to the URL
// path, URL query parameters, and HTTP request body. It also controls how the
// gRPC response message is mapped to the HTTP response body. `HttpRule` is
// typically specified as an `google.api.http` annotation on the gRPC method.
//
// Each mapping specifies a URL path template and an HTTP method. The path
// template may refer to one or more fields in the gRPC request message, as long
// as each field is a non-repeated field with a primitive (non-message) type.
// The path template controls how fields of the request message are mapped to
// the URL path.
//
// Example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get: "/v1/{name=messages/*}"
// };
// }
// }
// message GetMessageRequest {
// string name = 1; // Mapped to URL path.
// }
// message Message {
// string text = 1; // The resource content.
// }
//
// This enables an HTTP REST to gRPC mapping as below:
//
// - HTTP: `GET /v1/messages/123456`
// - gRPC: `GetMessage(name: "messages/123456")`
//
// Any fields in the request message which are not bound by the path template
// automatically become HTTP query parameters if there is no HTTP request body.
// For example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get:"/v1/messages/{message_id}"
// };
// }
// }
// message GetMessageRequest {
// message SubMessage {
// string subfield = 1;
// }
// string message_id = 1; // Mapped to URL path.
// int64 revision = 2; // Mapped to URL query parameter `revision`.
// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
// }
//
// This enables a HTTP JSON to RPC mapping as below:
//
// - HTTP: `GET /v1/messages/123456?revision=2&sub.subfield=foo`
// - gRPC: `GetMessage(message_id: "123456" revision: 2 sub:
// SubMessage(subfield: "foo"))`
//
// Note that fields which are mapped to URL query parameters must have a
// primitive type or a repeated primitive type or a non-repeated message type.
// In the case of a repeated type, the parameter can be repeated in the URL
// as `...?param=A&param=B`. In the case of a message type, each field of the
// message is mapped to a separate parameter, such as
// `...?foo.a=A&foo.b=B&foo.c=C`.
//
// For HTTP methods that allow a request body, the `body` field
// specifies the mapping. Consider a REST update method on the
// message resource collection:
//
// service Messaging {
// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
// option (google.api.http) = {
// patch: "/v1/messages/{message_id}"
// body: "message"
// };
// }
// }
// message UpdateMessageRequest {
// string message_id = 1; // mapped to the URL
// Message message = 2; // mapped to the body
// }
//
// The following HTTP JSON to RPC mapping is enabled, where the
// representation of the JSON in the request body is determined by
// protos JSON encoding:
//
// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
// - gRPC: `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
//
// The special name `*` can be used in the body mapping to define that
// every field not bound by the path template should be mapped to the
// request body. This enables the following alternative definition of
// the update method:
//
// service Messaging {
// rpc UpdateMessage(Message) returns (Message) {
// option (google.api.http) = {
// patch: "/v1/messages/{message_id}"
// body: "*"
// };
// }
// }
// message Message {
// string message_id = 1;
// string text = 2;
// }
//
//
// The following HTTP JSON to RPC mapping is enabled:
//
// - HTTP: `PATCH /v1/messages/123456 { "text": "Hi!" }`
// - gRPC: `UpdateMessage(message_id: "123456" text: "Hi!")`
//
// Note that when using `*` in the body mapping, it is not possible to
// have HTTP parameters, as all fields not bound by the path end in
// the body. This makes this option more rarely used in practice when
// defining REST APIs. The common usage of `*` is in custom methods
// which don't use the URL at all for transferring data.
//
// It is possible to define multiple HTTP methods for one RPC by using
// the `additional_bindings` option. Example:
//
// service Messaging {
// rpc GetMessage(GetMessageRequest) returns (Message) {
// option (google.api.http) = {
// get: "/v1/messages/{message_id}"
// additional_bindings {
// get: "/v1/users/{user_id}/messages/{message_id}"
// }
// };
// }
// }
// message GetMessageRequest {
// string message_id = 1;
// string user_id = 2;
// }
//
// This enables the following two alternative HTTP JSON to RPC mappings:
//
// - HTTP: `GET /v1/messages/123456`
// - gRPC: `GetMessage(message_id: "123456")`
//
// - HTTP: `GET /v1/users/me/messages/123456`
// - gRPC: `GetMessage(user_id: "me" message_id: "123456")`
//
// Rules for HTTP mapping
//
// 1. Leaf request fields (recursive expansion nested messages in the request
// message) are classified into three categories:
// - Fields referred by the path template. They are passed via the URL path.
// - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They
// are passed via the HTTP
// request body.
// - All other fields are passed via the URL query parameters, and the
// parameter name is the field path in the request message. A repeated
// field can be represented as multiple query parameters under the same
// name.
// 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL
// query parameter, all fields
// are passed via URL path and HTTP request body.
// 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP
// request body, all
// fields are passed via URL path and URL query parameters.
//
// Path template syntax
//
// Template = "/" Segments [ Verb ] ;
// Segments = Segment { "/" Segment } ;
// Segment = "*" | "**" | LITERAL | Variable ;
// Variable = "{" FieldPath [ "=" Segments ] "}" ;
// FieldPath = IDENT { "." IDENT } ;
// Verb = ":" LITERAL ;
//
// The syntax `*` matches a single URL path segment. The syntax `**` matches
// zero or more URL path segments, which must be the last part of the URL path
// except the `Verb`.
//
// The syntax `Variable` matches part of the URL path as specified by its
// template. A variable template must not contain other variables. If a variable
// matches a single path segment, its template may be omitted, e.g. `{var}`
// is equivalent to `{var=*}`.
//
// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
// contains any reserved character, such characters should be percent-encoded
// before the matching.
//
// If a variable contains exactly one path segment, such as `"{var}"` or
// `"{var=*}"`, when such a variable is expanded into a URL path on the client
// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
// server side does the reverse decoding. Such variables show up in the
// [Discovery
// Document](https://developers.google.com/discovery/v1/reference/apis) as
// `{var}`.
//
// If a variable contains multiple path segments, such as `"{var=foo/*}"`
// or `"{var=**}"`, when such a variable is expanded into a URL path on the
// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
// The server side does the reverse decoding, except "%2F" and "%2f" are left
// unchanged. Such variables show up in the
// [Discovery
// Document](https://developers.google.com/discovery/v1/reference/apis) as
// `{+var}`.
//
// Using gRPC API Service Configuration
//
// gRPC API Service Configuration (service config) is a configuration language
// for configuring a gRPC service to become a user-facing product. The
// service config is simply the YAML representation of the `google.api.Service`
// proto message.
//
// As an alternative to annotating your proto file, you can configure gRPC
// transcoding in your service config YAML files. You do this by specifying a
// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
// effect as the proto annotation. This can be particularly useful if you
// have a proto that is reused in multiple services. Note that any transcoding
// specified in the service config will override any matching transcoding
// configuration in the proto.
//
// The following example selects a gRPC method and applies an `HttpRule` to it:
//
// http:
// rules:
// - selector: example.v1.Messaging.GetMessage
// get: /v1/messages/{message_id}/{sub.subfield}
//
// Special notes
//
// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
// proto to JSON conversion must follow the [proto3
// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
//
// While the single segment variable follows the semantics of
// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
// Expansion, the multi segment variable **does not** follow RFC 6570 Section
// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
// does not expand special characters like `?` and `#`, which would lead
// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
// for multi segment variables.
//
// The path variables **must not** refer to any repeated or mapped field,
// because client libraries are not capable of handling such variable expansion.
//
// The path variables **must not** capture the leading "/" character. The reason
// is that the most common use case "{var}" does not capture the leading "/"
// character. For consistency, all path variables must share the same behavior.
//
// Repeated message fields must not be mapped to URL query parameters, because
// no client library can support such complicated mapping.
//
// If an API needs to use a JSON array for request or response body, it can map
// the request or response body to a repeated field. However, some gRPC
// Transcoding implementations may not support this feature.
message HttpRule {
// Selects a method to which this rule applies.
//
// Refer to [selector][google.api.DocumentationRule.selector] for syntax
// details.
string selector = 1;
// Determines the URL pattern is matched by this rules. This pattern can be
// used with any of the {get|put|post|delete|patch} methods. A custom method
// can be defined using the 'custom' field.
oneof pattern {
// Maps to HTTP GET. Used for listing and getting information about
// resources.
string get = 2;
// Maps to HTTP PUT. Used for replacing a resource.
string put = 3;
// Maps to HTTP POST. Used for creating a resource or performing an action.
string post = 4;
// Maps to HTTP DELETE. Used for deleting a resource.
string delete = 5;
// Maps to HTTP PATCH. Used for updating a resource.
string patch = 6;
// The custom pattern is used for specifying an HTTP method that is not
// included in the `pattern` field, such as HEAD, or "*" to leave the
// HTTP method unspecified for this rule. The wild-card rule is useful
// for services that provide content to Web (HTML) clients.
CustomHttpPattern custom = 8;
}
// The name of the request field whose value is mapped to the HTTP request
// body, or `*` for mapping all request fields not captured by the path
// pattern to the HTTP body, or omitted for not having any HTTP request body.
//
// NOTE: the referred field must be present at the top-level of the request
// message type.
string body = 7;
// Optional. The name of the response field whose value is mapped to the HTTP
// response body. When omitted, the entire response message will be used
// as the HTTP response body.
//
// NOTE: The referred field must be present at the top-level of the response
// message type.
string response_body = 12;
// Additional HTTP bindings for the selector. Nested bindings must
// not contain an `additional_bindings` field themselves (that is,
// the nesting may only be one level deep).
repeated HttpRule additional_bindings = 11;
}
// A custom pattern is used for defining custom HTTP verb.
message CustomHttpPattern {
// The name of this custom HTTP verb.
string kind = 1;
// The path matched by this custom verb.
string path = 2;
}

View File

@@ -0,0 +1,72 @@
// Copyright 2024 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.api;
option go_package = "google.golang.org/genproto/googleapis/api;api";
option java_multiple_files = true;
option java_outer_classname = "LaunchStageProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
// The launch stage as defined by [Google Cloud Platform
// Launch Stages](https://cloud.google.com/terms/launch-stages).
enum LaunchStage {
// Do not use this default value.
LAUNCH_STAGE_UNSPECIFIED = 0;
// The feature is not yet implemented. Users can not use it.
UNIMPLEMENTED = 6;
// Prelaunch features are hidden from users and are only visible internally.
PRELAUNCH = 7;
// Early Access features are limited to a closed group of testers. To use
// these features, you must sign up in advance and sign a Trusted Tester
// agreement (which includes confidentiality provisions). These features may
// be unstable, changed in backward-incompatible ways, and are not
// guaranteed to be released.
EARLY_ACCESS = 1;
// Alpha is a limited availability test for releases before they are cleared
// for widespread use. By Alpha, all significant design issues are resolved
// and we are in the process of verifying functionality. Alpha customers
// need to apply for access, agree to applicable terms, and have their
// projects allowlisted. Alpha releases don't have to be feature complete,
// no SLAs are provided, and there are no technical support obligations, but
// they will be far enough along that customers can actually use them in
// test environments or for limited-use tests -- just like they would in
// normal production cases.
ALPHA = 2;
// Beta is the point at which we are ready to open a release for any
// customer to use. There are no SLA or technical support obligations in a
// Beta release. Products will be complete from a feature perspective, but
// may have some open outstanding issues. Beta releases are suitable for
// limited production use cases.
BETA = 3;
// GA features are open to all developers and are considered stable and
// fully qualified for production use.
GA = 4;
// Deprecated features are scheduled to be shut down and removed. For more
// information, see the "Deprecation Policy" section of our [Terms of
// Service](https://cloud.google.com/terms/)
// and the [Google Cloud Platform Subject to the Deprecation
// Policy](https://cloud.google.com/terms/deprecation) documentation.
DEPRECATED = 5;
}

View File

@@ -0,0 +1,243 @@
// Copyright 2024 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.api;
import "google/protobuf/descriptor.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
option java_multiple_files = true;
option java_outer_classname = "ResourceProto";
option java_package = "com.google.api";
option objc_class_prefix = "GAPI";
extend google.protobuf.FieldOptions {
// An annotation that describes a resource reference, see
// [ResourceReference][].
google.api.ResourceReference resource_reference = 1055;
}
extend google.protobuf.FileOptions {
// An annotation that describes a resource definition without a corresponding
// message; see [ResourceDescriptor][].
repeated google.api.ResourceDescriptor resource_definition = 1053;
}
extend google.protobuf.MessageOptions {
// An annotation that describes a resource definition, see
// [ResourceDescriptor][].
google.api.ResourceDescriptor resource = 1053;
}
// A simple descriptor of a resource type.
//
// ResourceDescriptor annotates a resource message (either by means of a
// protobuf annotation or use in the service config), and associates the
// resource's schema, the resource type, and the pattern of the resource name.
//
// Example:
//
// message Topic {
// // Indicates this message defines a resource schema.
// // Declares the resource type in the format of {service}/{kind}.
// // For Kubernetes resources, the format is {api group}/{kind}.
// option (google.api.resource) = {
// type: "pubsub.googleapis.com/Topic"
// pattern: "projects/{project}/topics/{topic}"
// };
// }
//
// The ResourceDescriptor Yaml config will look like:
//
// resources:
// - type: "pubsub.googleapis.com/Topic"
// pattern: "projects/{project}/topics/{topic}"
//
// Sometimes, resources have multiple patterns, typically because they can
// live under multiple parents.
//
// Example:
//
// message LogEntry {
// option (google.api.resource) = {
// type: "logging.googleapis.com/LogEntry"
// pattern: "projects/{project}/logs/{log}"
// pattern: "folders/{folder}/logs/{log}"
// pattern: "organizations/{organization}/logs/{log}"
// pattern: "billingAccounts/{billing_account}/logs/{log}"
// };
// }
//
// The ResourceDescriptor Yaml config will look like:
//
// resources:
// - type: 'logging.googleapis.com/LogEntry'
// pattern: "projects/{project}/logs/{log}"
// pattern: "folders/{folder}/logs/{log}"
// pattern: "organizations/{organization}/logs/{log}"
// pattern: "billingAccounts/{billing_account}/logs/{log}"
message ResourceDescriptor {
// A description of the historical or future-looking state of the
// resource pattern.
enum History {
// The "unset" value.
HISTORY_UNSPECIFIED = 0;
// The resource originally had one pattern and launched as such, and
// additional patterns were added later.
ORIGINALLY_SINGLE_PATTERN = 1;
// The resource has one pattern, but the API owner expects to add more
// later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents
// that from being necessary once there are multiple patterns.)
FUTURE_MULTI_PATTERN = 2;
}
// A flag representing a specific style that a resource claims to conform to.
enum Style {
// The unspecified value. Do not use.
STYLE_UNSPECIFIED = 0;
// This resource is intended to be "declarative-friendly".
//
// Declarative-friendly resources must be more strictly consistent, and
// setting this to true communicates to tools that this resource should
// adhere to declarative-friendly expectations.
//
// Note: This is used by the API linter (linter.aip.dev) to enable
// additional checks.
DECLARATIVE_FRIENDLY = 1;
}
// The resource type. It must be in the format of
// {service_name}/{resource_type_kind}. The `resource_type_kind` must be
// singular and must not include version numbers.
//
// Example: `storage.googleapis.com/Bucket`
//
// The value of the resource_type_kind must follow the regular expression
// /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and
// should use PascalCase (UpperCamelCase). The maximum number of
// characters allowed for the `resource_type_kind` is 100.
string type = 1;
// Optional. The relative resource name pattern associated with this resource
// type. The DNS prefix of the full resource name shouldn't be specified here.
//
// The path pattern must follow the syntax, which aligns with HTTP binding
// syntax:
//
// Template = Segment { "/" Segment } ;
// Segment = LITERAL | Variable ;
// Variable = "{" LITERAL "}" ;
//
// Examples:
//
// - "projects/{project}/topics/{topic}"
// - "projects/{project}/knowledgeBases/{knowledge_base}"
//
// The components in braces correspond to the IDs for each resource in the
// hierarchy. It is expected that, if multiple patterns are provided,
// the same component name (e.g. "project") refers to IDs of the same
// type of resource.
repeated string pattern = 2;
// Optional. The field on the resource that designates the resource name
// field. If omitted, this is assumed to be "name".
string name_field = 3;
// Optional. The historical or future-looking state of the resource pattern.
//
// Example:
//
// // The InspectTemplate message originally only supported resource
// // names with organization, and project was added later.
// message InspectTemplate {
// option (google.api.resource) = {
// type: "dlp.googleapis.com/InspectTemplate"
// pattern:
// "organizations/{organization}/inspectTemplates/{inspect_template}"
// pattern: "projects/{project}/inspectTemplates/{inspect_template}"
// history: ORIGINALLY_SINGLE_PATTERN
// };
// }
History history = 4;
// The plural name used in the resource name and permission names, such as
// 'projects' for the resource name of 'projects/{project}' and the permission
// name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception
// to this is for Nested Collections that have stuttering names, as defined
// in [AIP-122](https://google.aip.dev/122#nested-collections), where the
// collection ID in the resource name pattern does not necessarily directly
// match the `plural` value.
//
// It is the same concept of the `plural` field in k8s CRD spec
// https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
//
// Note: The plural form is required even for singleton resources. See
// https://aip.dev/156
string plural = 5;
// The same concept of the `singular` field in k8s CRD spec
// https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
// Such as "project" for the `resourcemanager.googleapis.com/Project` type.
string singular = 6;
// Style flag(s) for this resource.
// These indicate that a resource is expected to conform to a given
// style. See the specific style flags for additional information.
repeated Style style = 10;
}
// Defines a proto annotation that describes a string field that refers to
// an API resource.
message ResourceReference {
// The resource type that the annotated field references.
//
// Example:
//
// message Subscription {
// string topic = 2 [(google.api.resource_reference) = {
// type: "pubsub.googleapis.com/Topic"
// }];
// }
//
// Occasionally, a field may reference an arbitrary resource. In this case,
// APIs use the special value * in their resource reference.
//
// Example:
//
// message GetIamPolicyRequest {
// string resource = 2 [(google.api.resource_reference) = {
// type: "*"
// }];
// }
string type = 1;
// The resource type of a child collection that the annotated field
// references. This is useful for annotating the `parent` field that
// doesn't have a fixed resource type.
//
// Example:
//
// message ListLogEntriesRequest {
// string parent = 1 [(google.api.resource_reference) = {
// child_type: "logging.googleapis.com/LogEntry"
// };
// }
string child_type = 2;
}

View File

@@ -0,0 +1,107 @@
// Copyright 2024 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.firestore.admin.v1;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
option java_multiple_files = true;
option java_outer_classname = "BackupProto";
option java_package = "com.google.firestore.admin.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
// A Backup of a Cloud Firestore Database.
//
// The backup contains all documents and index configurations for the given
// database at a specific point in time.
message Backup {
option (google.api.resource) = {
type: "firestore.googleapis.com/Backup"
pattern: "projects/{project}/locations/{location}/backups/{backup}"
};
// Backup specific statistics.
message Stats {
// Output only. Summation of the size of all documents and index entries in
// the backup, measured in bytes.
int64 size_bytes = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The total number of documents contained in the backup.
int64 document_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The total number of index entries contained in the backup.
int64 index_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// Indicate the current state of the backup.
enum State {
// The state is unspecified.
STATE_UNSPECIFIED = 0;
// The pending backup is still being created. Operations on the
// backup will be rejected in this state.
CREATING = 1;
// The backup is complete and ready to use.
READY = 2;
// The backup is not available at this moment.
NOT_AVAILABLE = 3;
}
// Output only. The unique resource name of the Backup.
//
// Format is `projects/{project}/locations/{location}/backups/{backup}`.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Name of the Firestore database that the backup is from.
//
// Format is `projects/{project}/databases/{database}`.
string database = 2 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}
];
// Output only. The system-generated UUID4 for the Firestore database that the
// backup is from.
string database_uid = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The backup contains an externally consistent copy of the
// database at this time.
google.protobuf.Timestamp snapshot_time = 3
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The timestamp at which this backup expires.
google.protobuf.Timestamp expire_time = 4
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Statistics about the backup.
//
// This data only becomes available after the backup is fully materialized to
// secondary storage. This field will be empty till then.
Stats stats = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The current state of the backup.
State state = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
}

View File

@@ -0,0 +1,321 @@
// Copyright 2024 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.firestore.admin.v1;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
option java_multiple_files = true;
option java_outer_classname = "DatabaseProto";
option java_package = "com.google.firestore.admin.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
option (google.api.resource_definition) = {
type: "firestore.googleapis.com/Operation"
pattern: "projects/{project}/databases/{database}/operations/{operation}"
};
// A Cloud Firestore Database.
message Database {
option (google.api.resource) = {
type: "firestore.googleapis.com/Database"
pattern: "projects/{project}/databases/{database}"
style: DECLARATIVE_FRIENDLY
};
// The type of the database.
// See https://cloud.google.com/datastore/docs/firestore-or-datastore for
// information about how to choose.
//
// Mode changes are only allowed if the database is empty.
enum DatabaseType {
// Not used.
DATABASE_TYPE_UNSPECIFIED = 0;
// Firestore Native Mode
FIRESTORE_NATIVE = 1;
// Firestore in Datastore Mode.
DATASTORE_MODE = 2;
}
// The type of concurrency control mode for transactions.
enum ConcurrencyMode {
// Not used.
CONCURRENCY_MODE_UNSPECIFIED = 0;
// Use optimistic concurrency control by default. This mode is available
// for Cloud Firestore databases.
OPTIMISTIC = 1;
// Use pessimistic concurrency control by default. This mode is available
// for Cloud Firestore databases.
//
// This is the default setting for Cloud Firestore.
PESSIMISTIC = 2;
// Use optimistic concurrency control with entity groups by default.
//
// This is the only available mode for Cloud Datastore.
//
// This mode is also available for Cloud Firestore with Datastore Mode but
// is not recommended.
OPTIMISTIC_WITH_ENTITY_GROUPS = 3;
}
// Point In Time Recovery feature enablement.
enum PointInTimeRecoveryEnablement {
// Not used.
POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED = 0;
// Reads are supported on selected versions of the data from within the past
// 7 days:
//
// * Reads against any timestamp within the past hour
// * Reads against 1-minute snapshots beyond 1 hour and within 7 days
//
// `version_retention_period` and `earliest_version_time` can be
// used to determine the supported versions.
POINT_IN_TIME_RECOVERY_ENABLED = 1;
// Reads are supported on any version of the data from within the past 1
// hour.
POINT_IN_TIME_RECOVERY_DISABLED = 2;
}
// The type of App Engine integration mode.
enum AppEngineIntegrationMode {
// Not used.
APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED = 0;
// If an App Engine application exists in the same region as this database,
// App Engine configuration will impact this database. This includes
// disabling of the application & database, as well as disabling writes to
// the database.
ENABLED = 1;
// App Engine has no effect on the ability of this database to serve
// requests.
//
// This is the default setting for databases created with the Firestore API.
DISABLED = 2;
}
// The delete protection state of the database.
enum DeleteProtectionState {
// The default value. Delete protection type is not specified
DELETE_PROTECTION_STATE_UNSPECIFIED = 0;
// Delete protection is disabled
DELETE_PROTECTION_DISABLED = 1;
// Delete protection is enabled
DELETE_PROTECTION_ENABLED = 2;
}
// The CMEK (Customer Managed Encryption Key) configuration for a Firestore
// database. If not present, the database is secured by the default Google
// encryption key.
message CmekConfig {
// Required. Only keys in the same location as this database are allowed to
// be used for encryption.
//
// For Firestore's nam5 multi-region, this corresponds to Cloud KMS
// multi-region us. For Firestore's eur3 multi-region, this corresponds to
// Cloud KMS multi-region europe. See
// https://cloud.google.com/kms/docs/locations.
//
// The expected format is
// `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
string kms_key_name = 1 [(google.api.field_behavior) = REQUIRED];
// Output only. Currently in-use [KMS key
// versions](https://cloud.google.com/kms/docs/resource-hierarchy#key_versions).
// During [key rotation](https://cloud.google.com/kms/docs/key-rotation),
// there can be multiple in-use key versions.
//
// The expected format is
// `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{key_version}`.
repeated string active_key_version = 2
[(google.api.field_behavior) = OUTPUT_ONLY];
}
// Information about the provenance of this database.
message SourceInfo {
// Information about a backup that was used to restore a database.
message BackupSource {
// The resource name of the backup that was used to restore this
// database. Format:
// `projects/{project}/locations/{location}/backups/{backup}`.
string backup = 1 [(google.api.resource_reference) = {
type: "firestore.googleapis.com/Backup"
}];
}
// The source from which this database is derived.
oneof source {
// If set, this database was restored from the specified backup (or a
// snapshot thereof).
BackupSource backup = 1;
}
// The associated long-running operation. This field may not be set after
// the operation has completed. Format:
// `projects/{project}/databases/{database}/operations/{operation}`.
string operation = 3 [(google.api.resource_reference) = {
type: "firestore.googleapis.com/Operation"
}];
}
// Encryption configuration for a new database being created from another
// source.
//
// The source could be a [Backup][google.firestore.admin.v1.Backup] .
message EncryptionConfig {
// The configuration options for using Google default encryption.
message GoogleDefaultEncryptionOptions {}
// The configuration options for using the same encryption method as the
// source.
message SourceEncryptionOptions {}
// The configuration options for using CMEK (Customer Managed Encryption
// Key) encryption.
message CustomerManagedEncryptionOptions {
// Required. Only keys in the same location as the database are allowed to
// be used for encryption.
//
// For Firestore's nam5 multi-region, this corresponds to Cloud KMS
// multi-region us. For Firestore's eur3 multi-region, this corresponds to
// Cloud KMS multi-region europe. See
// https://cloud.google.com/kms/docs/locations.
//
// The expected format is
// `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
string kms_key_name = 1 [(google.api.field_behavior) = REQUIRED];
}
// The method for encrypting the database.
oneof encryption_type {
// Use Google default encryption.
GoogleDefaultEncryptionOptions google_default_encryption = 1;
// The database will use the same encryption configuration as the source.
SourceEncryptionOptions use_source_encryption = 2;
// Use Customer Managed Encryption Keys (CMEK) for encryption.
CustomerManagedEncryptionOptions customer_managed_encryption = 3;
}
}
// The resource name of the Database.
// Format: `projects/{project}/databases/{database}`
string name = 1;
// Output only. The system-generated UUID4 for this Database.
string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The timestamp at which this database was created. Databases
// created before 2016 do not populate create_time.
google.protobuf.Timestamp create_time = 5
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The timestamp at which this database was most recently
// updated. Note this only includes updates to the database resource and not
// data contained by the database.
google.protobuf.Timestamp update_time = 6
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The timestamp at which this database was deleted. Only set if
// the database has been deleted.
google.protobuf.Timestamp delete_time = 7
[(google.api.field_behavior) = OUTPUT_ONLY];
// The location of the database. Available locations are listed at
// https://cloud.google.com/firestore/docs/locations.
string location_id = 9;
// The type of the database.
// See https://cloud.google.com/datastore/docs/firestore-or-datastore for
// information about how to choose.
DatabaseType type = 10;
// The concurrency control mode to use for this database.
ConcurrencyMode concurrency_mode = 15;
// Output only. The period during which past versions of data are retained in
// the database.
//
// Any [read][google.firestore.v1.GetDocumentRequest.read_time]
// or [query][google.firestore.v1.ListDocumentsRequest.read_time] can specify
// a `read_time` within this window, and will read the state of the database
// at that time.
//
// If the PITR feature is enabled, the retention period is 7 days. Otherwise,
// the retention period is 1 hour.
google.protobuf.Duration version_retention_period = 17
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The earliest timestamp at which older versions of the data can
// be read from the database. See [version_retention_period] above; this field
// is populated with `now - version_retention_period`.
//
// This value is continuously updated, and becomes stale the moment it is
// queried. If you are using this value to recover data, make sure to account
// for the time from the moment when the value is queried to the moment when
// you initiate the recovery.
google.protobuf.Timestamp earliest_version_time = 18
[(google.api.field_behavior) = OUTPUT_ONLY];
// Whether to enable the PITR feature on this database.
PointInTimeRecoveryEnablement point_in_time_recovery_enablement = 21;
// The App Engine integration mode to use for this database.
AppEngineIntegrationMode app_engine_integration_mode = 19;
// Output only. The key_prefix for this database. This key_prefix is used, in
// combination with the project ID ("<key prefix>~<project id>") to construct
// the application ID that is returned from the Cloud Datastore APIs in Google
// App Engine first generation runtimes.
//
// This value may be empty in which case the appid to use for URL-encoded keys
// is the project_id (eg: foo instead of v~foo).
string key_prefix = 20 [(google.api.field_behavior) = OUTPUT_ONLY];
// State of delete protection for the database.
DeleteProtectionState delete_protection_state = 22;
// Optional. Presence indicates CMEK is enabled for this database.
CmekConfig cmek_config = 23 [(google.api.field_behavior) = OPTIONAL];
// Output only. The database resource's prior database ID. This field is only
// populated for deleted databases.
string previous_id = 25 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Information about the provenance of this database.
SourceInfo source_info = 26 [(google.api.field_behavior) = OUTPUT_ONLY];
// This checksum is computed by the server based on the value of other
// fields, and may be sent on update and delete requests to ensure the
// client has an up-to-date value before proceeding.
string etag = 99;
}

View File

@@ -0,0 +1,137 @@
// Copyright 2024 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.firestore.admin.v1;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/firestore/admin/v1/index.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
option java_multiple_files = true;
option java_outer_classname = "FieldProto";
option java_package = "com.google.firestore.admin.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
// Represents a single field in the database.
//
// Fields are grouped by their "Collection Group", which represent all
// collections in the database with the same ID.
message Field {
option (google.api.resource) = {
type: "firestore.googleapis.com/Field"
pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}"
};
// The index configuration for this field.
message IndexConfig {
// The indexes supported for this field.
repeated Index indexes = 1;
// Output only. When true, the `Field`'s index configuration is set from the
// configuration specified by the `ancestor_field`.
// When false, the `Field`'s index configuration is defined explicitly.
bool uses_ancestor_config = 2;
// Output only. Specifies the resource name of the `Field` from which this
// field's index configuration is set (when `uses_ancestor_config` is true),
// or from which it *would* be set if this field had no index configuration
// (when `uses_ancestor_config` is false).
string ancestor_field = 3;
// Output only
// When true, the `Field`'s index configuration is in the process of being
// reverted. Once complete, the index config will transition to the same
// state as the field specified by `ancestor_field`, at which point
// `uses_ancestor_config` will be `true` and `reverting` will be `false`.
bool reverting = 4;
}
// The TTL (time-to-live) configuration for documents that have this `Field`
// set.
//
// Storing a timestamp value into a TTL-enabled field will be treated as
// the document's absolute expiration time. Timestamp values in the past
// indicate that the document is eligible for immediate expiration. Using any
// other data type or leaving the field absent will disable expiration for the
// individual document.
message TtlConfig {
// The state of applying the TTL configuration to all documents.
enum State {
// The state is unspecified or unknown.
STATE_UNSPECIFIED = 0;
// The TTL is being applied. There is an active long-running operation to
// track the change. Newly written documents will have TTLs applied as
// requested. Requested TTLs on existing documents are still being
// processed. When TTLs on all existing documents have been processed, the
// state will move to 'ACTIVE'.
CREATING = 1;
// The TTL is active for all documents.
ACTIVE = 2;
// The TTL configuration could not be enabled for all existing documents.
// Newly written documents will continue to have their TTL applied.
// The LRO returned when last attempting to enable TTL for this `Field`
// has failed, and may have more details.
NEEDS_REPAIR = 3;
}
// Output only. The state of the TTL configuration.
State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// Required. A field name of the form:
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
//
// A field path can be a simple field name, e.g. `address` or a path to fields
// within `map_value` , e.g. `address.city`,
// or a special field path. The only valid special field is `*`, which
// represents any field.
//
// Field paths can be quoted using `` ` `` (backtick). The only character that
// must be escaped within a quoted field path is the backtick character
// itself, escaped using a backslash. Special characters in field paths that
// must be quoted include: `*`, `.`,
// `` ` `` (backtick), `[`, `]`, as well as any ascii symbolic characters.
//
// Examples:
// `` `address.city` `` represents a field named `address.city`, not the map
// key `city` in the field `address`. `` `*` `` represents a field named `*`,
// not any field.
//
// A special `Field` contains the default indexing settings for all fields.
// This field's resource name is:
// `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`
// Indexes defined on this `Field` will be applied to all fields which do not
// have their own `Field` index configuration.
string name = 1 [(google.api.field_behavior) = REQUIRED];
// The index configuration for this field. If unset, field indexing will
// revert to the configuration defined by the `ancestor_field`. To
// explicitly remove all indexes for this field, specify an index config
// with an empty list of indexes.
IndexConfig index_config = 2;
// The TTL configuration for this `Field`.
// Setting or unsetting this will enable or disable the TTL for
// documents that have this `Field`.
TtlConfig ttl_config = 3;
}

View File

@@ -0,0 +1,958 @@
// Copyright 2024 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.firestore.admin.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/firestore/admin/v1/backup.proto";
import "google/firestore/admin/v1/database.proto";
import "google/firestore/admin/v1/field.proto";
import "google/firestore/admin/v1/index.proto";
import "google/firestore/admin/v1/operation.proto";
import "google/firestore/admin/v1/schedule.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
option java_multiple_files = true;
option java_outer_classname = "FirestoreAdminProto";
option java_package = "com.google.firestore.admin.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
option (google.api.resource_definition) = {
type: "firestore.googleapis.com/Location"
pattern: "projects/{project}/locations/{location}"
};
option (google.api.resource_definition) = {
type: "firestore.googleapis.com/CollectionGroup"
pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}"
};
// The Cloud Firestore Admin API.
//
// This API provides several administrative services for Cloud Firestore.
//
// Project, Database, Namespace, Collection, Collection Group, and Document are
// used as defined in the Google Cloud Firestore API.
//
// Operation: An Operation represents work being performed in the background.
//
// The index service manages Cloud Firestore indexes.
//
// Index creation is 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.
//
// The Operations collection provides a record of actions performed for the
// specified Project (including any Operations in progress). Operations are not
// created directly but through calls on other collections or resources.
//
// An Operation that is done may be deleted so that it is no longer listed as
// part of the Operation collection. Operations are garbage collected after
// 30 days. By default, ListOperations will only return in progress and failed
// operations. To list completed operation, issue a ListOperations request with
// the filter `done: true`.
//
// Operations are created by service `FirestoreAdmin`, but are accessed via
// service `google.longrunning.Operations`.
service FirestoreAdmin {
option (google.api.default_host) = "firestore.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/datastore";
// Creates a composite index. This returns a
// [google.longrunning.Operation][google.longrunning.Operation] which may be
// used to track the status of the creation. The metadata for the operation
// will be the type
// [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata].
rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes"
body: "index"
};
option (google.api.method_signature) = "parent,index";
option (google.longrunning.operation_info) = {
response_type: "Index"
metadata_type: "IndexOperationMetadata"
};
}
// Lists composite indexes.
rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes"
};
option (google.api.method_signature) = "parent";
}
// Gets a composite index.
rpc GetIndex(GetIndexRequest) returns (Index) {
option (google.api.http) = {
get: "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}"
};
option (google.api.method_signature) = "name";
}
// Deletes a composite index.
rpc DeleteIndex(DeleteIndexRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}"
};
option (google.api.method_signature) = "name";
}
// Gets the metadata and configuration for a Field.
rpc GetField(GetFieldRequest) returns (Field) {
option (google.api.http) = {
get: "/v1/{name=projects/*/databases/*/collectionGroups/*/fields/*}"
};
option (google.api.method_signature) = "name";
}
// Updates a field configuration. Currently, field updates apply only to
// single field index configuration. However, calls to
// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField]
// should provide a field mask to avoid changing any configuration that the
// caller isn't aware of. The field mask should be specified as: `{ paths:
// "index_config" }`.
//
// This call returns a
// [google.longrunning.Operation][google.longrunning.Operation] which may be
// used to track the status of the field update. The metadata for the
// operation will be the type
// [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata].
//
// To configure the default field settings for the database, use
// the special `Field` with resource name:
// `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
rpc UpdateField(UpdateFieldRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}"
body: "field"
};
option (google.api.method_signature) = "field";
option (google.longrunning.operation_info) = {
response_type: "Field"
metadata_type: "FieldOperationMetadata"
};
}
// Lists the field configuration and metadata for this database.
//
// Currently,
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
// only supports listing fields that have been explicitly overridden. To issue
// this query, call
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
// with the filter set to `indexConfig.usesAncestorConfig:false` or
// `ttlConfig:*`.
rpc ListFields(ListFieldsRequest) returns (ListFieldsResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/fields"
};
option (google.api.method_signature) = "parent";
}
// Exports a copy of all or a subset of documents from Google Cloud Firestore
// to another storage system, such as Google Cloud Storage. Recent updates to
// documents may not be reflected in the export. The export occurs in the
// background and its progress can be monitored and managed via the
// Operation resource that is created. The output of an export may only be
// used once the associated operation is done. If an export operation is
// cancelled before completion it may leave partial data behind in Google
// Cloud Storage.
//
// For more details on export behavior and output format, refer to:
// https://cloud.google.com/firestore/docs/manage-data/export-import
rpc ExportDocuments(ExportDocumentsRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=projects/*/databases/*}:exportDocuments"
body: "*"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "ExportDocumentsResponse"
metadata_type: "ExportDocumentsMetadata"
};
}
// Imports documents into Google Cloud Firestore. Existing documents with the
// same name are overwritten. The import occurs in the background and its
// progress can be monitored and managed via the Operation resource that is
// created. If an ImportDocuments operation is cancelled, it is possible
// that a subset of the data has already been imported to Cloud Firestore.
rpc ImportDocuments(ImportDocumentsRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=projects/*/databases/*}:importDocuments"
body: "*"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "google.protobuf.Empty"
metadata_type: "ImportDocumentsMetadata"
};
}
// Bulk deletes a subset of documents from Google Cloud Firestore.
// Documents created or updated after the underlying system starts to process
// the request will not be deleted. The bulk delete occurs in the background
// and its progress can be monitored and managed via the Operation resource
// that is created.
//
// For more details on bulk delete behavior, refer to:
// https://cloud.google.com/firestore/docs/manage-data/bulk-delete
rpc BulkDeleteDocuments(BulkDeleteDocumentsRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{name=projects/*/databases/*}:bulkDeleteDocuments"
body: "*"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "BulkDeleteDocumentsResponse"
metadata_type: "BulkDeleteDocumentsMetadata"
};
}
// Create a database.
rpc CreateDatabase(CreateDatabaseRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{parent=projects/*}/databases"
body: "database"
};
option (google.api.method_signature) = "parent,database,database_id";
option (google.longrunning.operation_info) = {
response_type: "Database"
metadata_type: "CreateDatabaseMetadata"
};
}
// Gets information about a database.
rpc GetDatabase(GetDatabaseRequest) returns (Database) {
option (google.api.http) = {
get: "/v1/{name=projects/*/databases/*}"
};
option (google.api.method_signature) = "name";
}
// List all the databases in the project.
rpc ListDatabases(ListDatabasesRequest) returns (ListDatabasesResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*}/databases"
};
option (google.api.method_signature) = "parent";
}
// Updates a database.
rpc UpdateDatabase(UpdateDatabaseRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v1/{database.name=projects/*/databases/*}"
body: "database"
};
option (google.api.method_signature) = "database,update_mask";
option (google.longrunning.operation_info) = {
response_type: "Database"
metadata_type: "UpdateDatabaseMetadata"
};
}
// Deletes a database.
rpc DeleteDatabase(DeleteDatabaseRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/databases/*}"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "Database"
metadata_type: "DeleteDatabaseMetadata"
};
}
// Gets information about a backup.
rpc GetBackup(GetBackupRequest) returns (Backup) {
option (google.api.http) = {
get: "/v1/{name=projects/*/locations/*/backups/*}"
};
option (google.api.method_signature) = "name";
}
// Lists all the backups.
rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/locations/*}/backups"
};
option (google.api.method_signature) = "parent";
}
// Deletes a backup.
rpc DeleteBackup(DeleteBackupRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/locations/*/backups/*}"
};
option (google.api.method_signature) = "name";
}
// Creates a new database by restoring from an existing backup.
//
// The new database must be in the same cloud region or multi-region location
// as the existing backup. This behaves similar to
// [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase]
// except instead of creating a new empty database, a new database is created
// with the database type, index configuration, and documents from an existing
// backup.
//
// The [long-running operation][google.longrunning.Operation] can be used to
// track the progress of the restore, with the Operation's
// [metadata][google.longrunning.Operation.metadata] field type being the
// [RestoreDatabaseMetadata][google.firestore.admin.v1.RestoreDatabaseMetadata].
// The [response][google.longrunning.Operation.response] type is the
// [Database][google.firestore.admin.v1.Database] if the restore was
// successful. The new database is not readable or writeable until the LRO has
// completed.
rpc RestoreDatabase(RestoreDatabaseRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v1/{parent=projects/*}/databases:restore"
body: "*"
};
option (google.longrunning.operation_info) = {
response_type: "Database"
metadata_type: "RestoreDatabaseMetadata"
};
}
// Creates a backup schedule on a database.
// At most two backup schedules can be configured on a database, one daily
// backup schedule and one weekly backup schedule.
rpc CreateBackupSchedule(CreateBackupScheduleRequest)
returns (BackupSchedule) {
option (google.api.http) = {
post: "/v1/{parent=projects/*/databases/*}/backupSchedules"
body: "backup_schedule"
};
option (google.api.method_signature) = "parent,backup_schedule";
}
// Gets information about a backup schedule.
rpc GetBackupSchedule(GetBackupScheduleRequest) returns (BackupSchedule) {
option (google.api.http) = {
get: "/v1/{name=projects/*/databases/*/backupSchedules/*}"
};
option (google.api.method_signature) = "name";
}
// List backup schedules.
rpc ListBackupSchedules(ListBackupSchedulesRequest)
returns (ListBackupSchedulesResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/databases/*}/backupSchedules"
};
option (google.api.method_signature) = "parent";
}
// Updates a backup schedule.
rpc UpdateBackupSchedule(UpdateBackupScheduleRequest)
returns (BackupSchedule) {
option (google.api.http) = {
patch: "/v1/{backup_schedule.name=projects/*/databases/*/backupSchedules/*}"
body: "backup_schedule"
};
option (google.api.method_signature) = "backup_schedule,update_mask";
}
// Deletes a backup schedule.
rpc DeleteBackupSchedule(DeleteBackupScheduleRequest)
returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/databases/*/backupSchedules/*}"
};
option (google.api.method_signature) = "name";
}
}
// A request to list the Firestore Databases in all locations for a project.
message ListDatabasesRequest {
// Required. A parent name of the form
// `projects/{project_id}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "firestore.googleapis.com/Database"
}
];
// If true, also returns deleted resources.
bool show_deleted = 4;
}
// The request for
// [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase].
message CreateDatabaseRequest {
// Required. A parent name of the form
// `projects/{project_id}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "firestore.googleapis.com/Database"
}
];
// Required. The Database to create.
Database database = 2 [(google.api.field_behavior) = REQUIRED];
// Required. The ID to use for the database, which will become the final
// component of the database's resource name.
//
// This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/
// with first character a letter and the last a letter or a number. Must not
// be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
//
// "(default)" database ID is also valid.
string database_id = 3 [(google.api.field_behavior) = REQUIRED];
}
// Metadata related to the create database operation.
message CreateDatabaseMetadata {}
// The list of databases for a project.
message ListDatabasesResponse {
// The databases in the project.
repeated Database databases = 1;
// In the event that data about individual databases cannot be listed they
// will be recorded here.
//
// An example entry might be: projects/some_project/locations/some_location
// This can happen if the Cloud Region that the Database resides in is
// currently unavailable. In this case we can't fetch all the details about
// the database. You may be able to get a more detailed error message
// (or possibly fetch the resource) by sending a 'Get' request for the
// resource or a 'List' request for the specific location.
repeated string unreachable = 3;
}
// The request for
// [FirestoreAdmin.GetDatabase][google.firestore.admin.v1.FirestoreAdmin.GetDatabase].
message GetDatabaseRequest {
// Required. A name of the form
// `projects/{project_id}/databases/{database_id}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}
];
}
// The request for
// [FirestoreAdmin.UpdateDatabase][google.firestore.admin.v1.FirestoreAdmin.UpdateDatabase].
message UpdateDatabaseRequest {
// Required. The database to update.
Database database = 1 [(google.api.field_behavior) = REQUIRED];
// The list of fields to be updated.
google.protobuf.FieldMask update_mask = 2;
}
// Metadata related to the update database operation.
message UpdateDatabaseMetadata {}
// The request for
// [FirestoreAdmin.DeleteDatabase][google.firestore.admin.v1.FirestoreAdmin.DeleteDatabase].
message DeleteDatabaseRequest {
// Required. A name of the form
// `projects/{project_id}/databases/{database_id}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}
];
// The current etag of the Database.
// If an etag is provided and does not match the current etag of the database,
// deletion will be blocked and a FAILED_PRECONDITION error will be returned.
string etag = 3;
}
// Metadata related to the delete database operation.
message DeleteDatabaseMetadata {}
// The request for
// [FirestoreAdmin.CreateBackupSchedule][google.firestore.admin.v1.FirestoreAdmin.CreateBackupSchedule].
message CreateBackupScheduleRequest {
// Required. The parent database.
//
// Format `projects/{project}/databases/{database}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}
];
// Required. The backup schedule to create.
BackupSchedule backup_schedule = 2 [(google.api.field_behavior) = REQUIRED];
}
// The request for
// [FirestoreAdmin.GetBackupSchedule][google.firestore.admin.v1.FirestoreAdmin.GetBackupSchedule].
message GetBackupScheduleRequest {
// Required. The name of the backup schedule.
//
// Format
// `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/BackupSchedule"
}
];
}
// The request for
// [FirestoreAdmin.UpdateBackupSchedule][google.firestore.admin.v1.FirestoreAdmin.UpdateBackupSchedule].
message UpdateBackupScheduleRequest {
// Required. The backup schedule to update.
BackupSchedule backup_schedule = 1 [(google.api.field_behavior) = REQUIRED];
// The list of fields to be updated.
google.protobuf.FieldMask update_mask = 2;
}
// The request for
// [FirestoreAdmin.ListBackupSchedules][google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedules].
message ListBackupSchedulesRequest {
// Required. The parent database.
//
// Format is `projects/{project}/databases/{database}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}
];
}
// The response for
// [FirestoreAdmin.ListBackupSchedules][google.firestore.admin.v1.FirestoreAdmin.ListBackupSchedules].
message ListBackupSchedulesResponse {
// List of all backup schedules.
repeated BackupSchedule backup_schedules = 1;
}
// The request for [FirestoreAdmin.DeleteBackupSchedules][].
message DeleteBackupScheduleRequest {
// Required. The name of the backup schedule.
//
// Format
// `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/BackupSchedule"
}
];
}
// The request for
// [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex].
message CreateIndexRequest {
// Required. A parent name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/CollectionGroup"
}
];
// Required. The composite index to create.
Index index = 2 [(google.api.field_behavior) = REQUIRED];
}
// The request for
// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes].
message ListIndexesRequest {
// Required. A parent name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/CollectionGroup"
}
];
// The filter to apply to list results.
string filter = 2;
// The number of results to return.
int32 page_size = 3;
// A page token, returned from a previous call to
// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes],
// that may be used to get the next page of results.
string page_token = 4;
}
// The response for
// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes].
message ListIndexesResponse {
// The requested indexes.
repeated Index indexes = 1;
// A page token that may be used to request another page of results. If blank,
// this is the last page.
string next_page_token = 2;
}
// The request for
// [FirestoreAdmin.GetIndex][google.firestore.admin.v1.FirestoreAdmin.GetIndex].
message GetIndexRequest {
// Required. A name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "firestore.googleapis.com/Index" }
];
}
// The request for
// [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1.FirestoreAdmin.DeleteIndex].
message DeleteIndexRequest {
// Required. A name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "firestore.googleapis.com/Index" }
];
}
// The request for
// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField].
message UpdateFieldRequest {
// Required. The field to be updated.
Field field = 1 [(google.api.field_behavior) = REQUIRED];
// A mask, relative to the field. If specified, only configuration specified
// by this field_mask will be updated in the field.
google.protobuf.FieldMask update_mask = 2;
}
// The request for
// [FirestoreAdmin.GetField][google.firestore.admin.v1.FirestoreAdmin.GetField].
message GetFieldRequest {
// Required. A name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "firestore.googleapis.com/Field" }
];
}
// The request for
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields].
message ListFieldsRequest {
// Required. A parent name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/CollectionGroup"
}
];
// The filter to apply to list results. Currently,
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
// only supports listing fields that have been explicitly overridden. To issue
// this query, call
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
// with a filter that includes `indexConfig.usesAncestorConfig:false` or
// `ttlConfig:*`.
string filter = 2;
// The number of results to return.
int32 page_size = 3;
// A page token, returned from a previous call to
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields],
// that may be used to get the next page of results.
string page_token = 4;
}
// The response for
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields].
message ListFieldsResponse {
// The requested fields.
repeated Field fields = 1;
// A page token that may be used to request another page of results. If blank,
// this is the last page.
string next_page_token = 2;
}
// The request for
// [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments].
message ExportDocumentsRequest {
// Required. Database to export. Should be of the form:
// `projects/{project_id}/databases/{database_id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}
];
// Which collection IDs to export. Unspecified means all collections. Each
// collection ID in this list must be unique.
repeated string collection_ids = 2;
// The output URI. Currently only supports Google Cloud Storage URIs of the
// form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name
// of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional
// Google Cloud Storage namespace path. When
// choosing a name, be sure to consider Google Cloud Storage naming
// guidelines: https://cloud.google.com/storage/docs/naming.
// If the URI is a bucket (without a namespace path), a prefix will be
// generated based on the start time.
string output_uri_prefix = 3;
// An empty list represents all namespaces. This is the preferred
// usage for databases that don't use namespaces.
//
// An empty string element represents the default namespace. This should be
// used if the database has data in non-default namespaces, but doesn't want
// to include them. Each namespace in this list must be unique.
repeated string namespace_ids = 4;
// The timestamp that corresponds to the version of the database to be
// exported. The timestamp must be in the past, rounded to the minute and not
// older than
// [earliestVersionTime][google.firestore.admin.v1.Database.earliest_version_time].
// If specified, then the exported documents will represent a consistent view
// of the database at the provided time. Otherwise, there are no guarantees
// about the consistency of the exported documents.
google.protobuf.Timestamp snapshot_time = 5;
}
// The request for
// [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments].
message ImportDocumentsRequest {
// Required. Database to import into. Should be of the form:
// `projects/{project_id}/databases/{database_id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}
];
// Which collection IDs to import. Unspecified means all collections included
// in the import. Each collection ID in this list must be unique.
repeated string collection_ids = 2;
// Location of the exported files.
// This must match the output_uri_prefix of an ExportDocumentsResponse from
// an export that has completed successfully.
// See:
// [google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix][google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix].
string input_uri_prefix = 3;
// An empty list represents all namespaces. This is the preferred
// usage for databases that don't use namespaces.
//
// An empty string element represents the default namespace. This should be
// used if the database has data in non-default namespaces, but doesn't want
// to include them. Each namespace in this list must be unique.
repeated string namespace_ids = 4;
}
// The request for
// [FirestoreAdmin.BulkDeleteDocuments][google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments].
//
// When both collection_ids and namespace_ids are set, only documents satisfying
// both conditions will be deleted.
//
// Requests with namespace_ids and collection_ids both empty will be rejected.
// Please use
// [FirestoreAdmin.DeleteDatabase][google.firestore.admin.v1.FirestoreAdmin.DeleteDatabase]
// instead.
message BulkDeleteDocumentsRequest {
// Required. Database to operate. Should be of the form:
// `projects/{project_id}/databases/{database_id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}
];
// Optional. IDs of the collection groups to delete. Unspecified means all
// collection groups.
//
// Each collection group in this list must be unique.
repeated string collection_ids = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. Namespaces to delete.
//
// An empty list means all namespaces. This is the recommended
// usage for databases that don't use namespaces.
//
// An empty string element represents the default namespace. This should be
// used if the database has data in non-default namespaces, but doesn't want
// to delete from them.
//
// Each namespace in this list must be unique.
repeated string namespace_ids = 3 [(google.api.field_behavior) = OPTIONAL];
}
// The response for
// [FirestoreAdmin.BulkDeleteDocuments][google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments].
message BulkDeleteDocumentsResponse {}
// The request for
// [FirestoreAdmin.GetBackup][google.firestore.admin.v1.FirestoreAdmin.GetBackup].
message GetBackupRequest {
// Required. Name of the backup to fetch.
//
// Format is `projects/{project}/locations/{location}/backups/{backup}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Backup"
}
];
}
// The request for
// [FirestoreAdmin.ListBackups][google.firestore.admin.v1.FirestoreAdmin.ListBackups].
message ListBackupsRequest {
// Required. The location to list backups from.
//
// Format is `projects/{project}/locations/{location}`.
// Use `{location} = '-'` to list backups from all locations for the given
// project. This allows listing backups from a single location or from all
// locations.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Location"
}
];
// An expression that filters the list of returned backups.
//
// A filter expression consists of a field name, a comparison operator, and a
// value for filtering.
// The value must be a string, a number, or a boolean. The comparison operator
// must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
// Colon `:` is the contains operator. Filter rules are not case sensitive.
//
// The following fields in the [Backup][google.firestore.admin.v1.Backup] are
// eligible for filtering:
//
// * `database_uid` (supports `=` only)
string filter = 2;
}
// The response for
// [FirestoreAdmin.ListBackups][google.firestore.admin.v1.FirestoreAdmin.ListBackups].
message ListBackupsResponse {
// List of all backups for the project.
repeated Backup backups = 1;
// List of locations that existing backups were not able to be fetched from.
//
// Instead of failing the entire requests when a single location is
// unreachable, this response returns a partial result set and list of
// locations unable to be reached here. The request can be retried against a
// single location to get a concrete error.
repeated string unreachable = 3;
}
// The request for
// [FirestoreAdmin.DeleteBackup][google.firestore.admin.v1.FirestoreAdmin.DeleteBackup].
message DeleteBackupRequest {
// Required. Name of the backup to delete.
//
// format is `projects/{project}/locations/{location}/backups/{backup}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Backup"
}
];
}
// The request message for
// [FirestoreAdmin.RestoreDatabase][google.firestore.admin.v1.FirestoreAdmin.RestoreDatabase].
message RestoreDatabaseRequest {
// Required. The project to restore the database in. Format is
// `projects/{project_id}`.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
child_type: "firestore.googleapis.com/Database"
}
];
// Required. The ID to use for the database, which will become the final
// component of the database's resource name. This database ID must not be
// associated with an existing database.
//
// This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/
// with first character a letter and the last a letter or a number. Must not
// be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
//
// "(default)" database ID is also valid.
string database_id = 2 [(google.api.field_behavior) = REQUIRED];
// Required. Backup to restore from. Must be from the same project as the
// parent.
//
// The restored database will be created in the same location as the source
// backup.
//
// Format is: `projects/{project_id}/locations/{location}/backups/{backup}`
string backup = 3 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Backup"
}
];
// Optional. Encryption configuration for the restored database.
//
// If this field is not specified, the restored database will use
// the same encryption configuration as the backup, namely
// [use_source_encryption][google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption].
Database.EncryptionConfig encryption_config = 9
[(google.api.field_behavior) = OPTIONAL];
}

View File

@@ -0,0 +1,198 @@
// Copyright 2024 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.firestore.admin.v1;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
option java_multiple_files = true;
option java_outer_classname = "IndexProto";
option java_package = "com.google.firestore.admin.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
// Cloud Firestore indexes enable simple and complex queries against
// documents in a database.
message Index {
option (google.api.resource) = {
type: "firestore.googleapis.com/Index"
pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}"
};
// Query Scope defines the scope at which a query is run. This is specified on
// a StructuredQuery's `from` field.
enum QueryScope {
// The query scope is unspecified. Not a valid option.
QUERY_SCOPE_UNSPECIFIED = 0;
// Indexes with a collection query scope specified allow queries
// against a collection that is the child of a specific document, specified
// at query time, and that has the collection ID specified by the index.
COLLECTION = 1;
// Indexes with a collection group query scope specified allow queries
// against all collections that has the collection ID specified by the
// index.
COLLECTION_GROUP = 2;
// Include all the collections's ancestor in the index. Only available for
// Datastore Mode databases.
COLLECTION_RECURSIVE = 3;
}
// API Scope defines the APIs (Firestore Native, or Firestore in
// Datastore Mode) that are supported for queries.
enum ApiScope {
// The index can only be used by the Firestore Native query API.
// This is the default.
ANY_API = 0;
// The index can only be used by the Firestore in Datastore Mode query API.
DATASTORE_MODE_API = 1;
}
// A field in an index.
// The field_path describes which field is indexed, the value_mode describes
// how the field value is indexed.
message IndexField {
// The supported orderings.
enum Order {
// The ordering is unspecified. Not a valid option.
ORDER_UNSPECIFIED = 0;
// The field is ordered by ascending field value.
ASCENDING = 1;
// The field is ordered by descending field value.
DESCENDING = 2;
}
// The supported array value configurations.
enum ArrayConfig {
// The index does not support additional array queries.
ARRAY_CONFIG_UNSPECIFIED = 0;
// The index supports array containment queries.
CONTAINS = 1;
}
// The index configuration to support vector search operations
message VectorConfig {
// An index that stores vectors in a flat data structure, and supports
// exhaustive search.
message FlatIndex {}
// Required. The vector dimension this configuration applies to.
//
// The resulting index will only include vectors of this dimension, and
// can be used for vector search with the same dimension.
int32 dimension = 1 [(google.api.field_behavior) = REQUIRED];
// The type of index used.
oneof type {
// Indicates the vector index is a flat index.
FlatIndex flat = 2;
}
}
// Can be __name__.
// For single field indexes, this must match the name of the field or may
// be omitted.
string field_path = 1;
// How the field value is indexed.
oneof value_mode {
// Indicates that this field supports ordering by the specified order or
// comparing using =, !=, <, <=, >, >=.
Order order = 2;
// Indicates that this field supports operations on `array_value`s.
ArrayConfig array_config = 3;
// Indicates that this field supports nearest neighbor and distance
// operations on vector.
VectorConfig vector_config = 4;
}
}
// The state of an index. During index creation, an index will be in the
// `CREATING` state. If the index is created successfully, it will transition
// to the `READY` state. If the index creation encounters a problem, the index
// will transition to the `NEEDS_REPAIR` state.
enum State {
// The state is unspecified.
STATE_UNSPECIFIED = 0;
// The index is being created.
// There is an active long-running operation for the index.
// The index is updated when writing a document.
// Some index data may exist.
CREATING = 1;
// The index is ready to be used.
// The index is updated when writing a document.
// The index is fully populated from all stored documents it applies to.
READY = 2;
// The index was being created, but something went wrong.
// 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 a document.
// Some index data may exist.
// Use the google.longrunning.Operations API to determine why the operation
// that last attempted to create this index failed, then re-create the
// index.
NEEDS_REPAIR = 3;
}
// Output only. A server defined name for this index.
// The form of this name for composite indexes will be:
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}`
// For single field indexes, this field will be empty.
string name = 1;
// Indexes with a collection query scope specified allow queries
// against a collection that is the child of a specific document, specified at
// query time, and that has the same collection ID.
//
// Indexes with a collection group query scope specified allow queries against
// all collections descended from a specific document, specified at query
// time, and that have the same collection ID as this index.
QueryScope query_scope = 2;
// The API scope supported by this index.
ApiScope api_scope = 5;
// The fields supported by this index.
//
// For composite indexes, this requires a minimum of 2 and a maximum of 100
// fields. The last field entry is always for the field path `__name__`. If,
// on creation, `__name__` was not specified as the last field, it will be
// added automatically with the same direction as that of the last field
// defined. If the final field in a composite index is not directional, the
// `__name__` will be ordered ASCENDING (unless explicitly specified).
//
// For single field indexes, this will always be exactly one entry with a
// field path equal to the field path of the associated field.
repeated IndexField fields = 3;
// Output only. The serving state of the index.
State state = 4;
}

View File

@@ -0,0 +1,30 @@
// Copyright 2024 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.firestore.admin.v1;
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
option java_multiple_files = true;
option java_outer_classname = "LocationProto";
option java_package = "com.google.firestore.admin.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
// The metadata message for
// [google.cloud.location.Location.metadata][google.cloud.location.Location.metadata].
message LocationMetadata {}

View File

@@ -0,0 +1,300 @@
// Copyright 2024 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.firestore.admin.v1;
import "google/api/resource.proto";
import "google/firestore/admin/v1/index.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
option java_multiple_files = true;
option java_outer_classname = "OperationProto";
option java_package = "com.google.firestore.admin.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
// results from
// [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex].
message IndexOperationMetadata {
// The time this operation started.
google.protobuf.Timestamp start_time = 1;
// The time this operation completed. Will be unset if operation still in
// progress.
google.protobuf.Timestamp end_time = 2;
// The index resource that this operation is acting on. For example:
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
string index = 3;
// The state of the operation.
OperationState state = 4;
// The progress, in documents, of this operation.
Progress progress_documents = 5;
// The progress, in bytes, of this operation.
Progress progress_bytes = 6;
}
// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
// results from
// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField].
message FieldOperationMetadata {
// Information about an index configuration change.
message IndexConfigDelta {
// Specifies how the index is changing.
enum ChangeType {
// The type of change is not specified or known.
CHANGE_TYPE_UNSPECIFIED = 0;
// The single field index is being added.
ADD = 1;
// The single field index is being removed.
REMOVE = 2;
}
// Specifies how the index is changing.
ChangeType change_type = 1;
// The index being changed.
Index index = 2;
}
// Information about a TTL configuration change.
message TtlConfigDelta {
// Specifies how the TTL config is changing.
enum ChangeType {
// The type of change is not specified or known.
CHANGE_TYPE_UNSPECIFIED = 0;
// The TTL config is being added.
ADD = 1;
// The TTL config is being removed.
REMOVE = 2;
}
// Specifies how the TTL configuration is changing.
ChangeType change_type = 1;
}
// The time this operation started.
google.protobuf.Timestamp start_time = 1;
// The time this operation completed. Will be unset if operation still in
// progress.
google.protobuf.Timestamp end_time = 2;
// The field resource that this operation is acting on. For example:
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
string field = 3;
// A list of
// [IndexConfigDelta][google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta],
// which describe the intent of this operation.
repeated IndexConfigDelta index_config_deltas = 4;
// The state of the operation.
OperationState state = 5;
// The progress, in documents, of this operation.
Progress progress_documents = 6;
// The progress, in bytes, of this operation.
Progress progress_bytes = 7;
// Describes the deltas of TTL configuration.
TtlConfigDelta ttl_config_delta = 8;
}
// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
// results from
// [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments].
message ExportDocumentsMetadata {
// The time this operation started.
google.protobuf.Timestamp start_time = 1;
// The time this operation completed. Will be unset if operation still in
// progress.
google.protobuf.Timestamp end_time = 2;
// The state of the export operation.
OperationState operation_state = 3;
// The progress, in documents, of this operation.
Progress progress_documents = 4;
// The progress, in bytes, of this operation.
Progress progress_bytes = 5;
// Which collection IDs are being exported.
repeated string collection_ids = 6;
// Where the documents are being exported to.
string output_uri_prefix = 7;
// Which namespace IDs are being exported.
repeated string namespace_ids = 8;
// The timestamp that corresponds to the version of the database that is being
// exported. If unspecified, there are no guarantees about the consistency of
// the documents being exported.
google.protobuf.Timestamp snapshot_time = 9;
}
// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
// results from
// [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments].
message ImportDocumentsMetadata {
// The time this operation started.
google.protobuf.Timestamp start_time = 1;
// The time this operation completed. Will be unset if operation still in
// progress.
google.protobuf.Timestamp end_time = 2;
// The state of the import operation.
OperationState operation_state = 3;
// The progress, in documents, of this operation.
Progress progress_documents = 4;
// The progress, in bytes, of this operation.
Progress progress_bytes = 5;
// Which collection IDs are being imported.
repeated string collection_ids = 6;
// The location of the documents being imported.
string input_uri_prefix = 7;
// Which namespace IDs are being imported.
repeated string namespace_ids = 8;
}
// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
// results from
// [FirestoreAdmin.BulkDeleteDocuments][google.firestore.admin.v1.FirestoreAdmin.BulkDeleteDocuments].
message BulkDeleteDocumentsMetadata {
// The time this operation started.
google.protobuf.Timestamp start_time = 1;
// The time this operation completed. Will be unset if operation still in
// progress.
google.protobuf.Timestamp end_time = 2;
// The state of the operation.
OperationState operation_state = 3;
// The progress, in documents, of this operation.
Progress progress_documents = 4;
// The progress, in bytes, of this operation.
Progress progress_bytes = 5;
// The IDs of the collection groups that are being deleted.
repeated string collection_ids = 6;
// Which namespace IDs are being deleted.
repeated string namespace_ids = 7;
// The timestamp that corresponds to the version of the database that is being
// read to get the list of documents to delete. This time can also be used as
// the timestamp of PITR in case of disaster recovery (subject to PITR window
// limit).
google.protobuf.Timestamp snapshot_time = 8;
}
// Returned in the [google.longrunning.Operation][google.longrunning.Operation]
// response field.
message ExportDocumentsResponse {
// Location of the output files. This can be used to begin an import
// into Cloud Firestore (this project or another project) after the operation
// completes successfully.
string output_uri_prefix = 1;
}
// Metadata for the [long-running operation][google.longrunning.Operation] from
// the [RestoreDatabase][google.firestore.admin.v1.RestoreDatabase] request.
message RestoreDatabaseMetadata {
// The time the restore was started.
google.protobuf.Timestamp start_time = 1;
// The time the restore finished, unset for ongoing restores.
google.protobuf.Timestamp end_time = 2;
// The operation state of the restore.
OperationState operation_state = 3;
// The name of the database being restored to.
string database = 4 [(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}];
// The name of the backup restoring from.
string backup = 5 [(google.api.resource_reference) = {
type: "firestore.googleapis.com/Backup"
}];
// How far along the restore is as an estimated percentage of remaining time.
Progress progress_percentage = 8;
}
// Describes the progress of the operation.
// Unit of work is generic and must be interpreted based on where
// [Progress][google.firestore.admin.v1.Progress] is used.
message Progress {
// The amount of work estimated.
int64 estimated_work = 1;
// The amount of work completed.
int64 completed_work = 2;
}
// Describes the state of the operation.
enum OperationState {
// Unspecified.
OPERATION_STATE_UNSPECIFIED = 0;
// Request is being prepared for processing.
INITIALIZING = 1;
// Request is actively being processed.
PROCESSING = 2;
// Request is in the process of being cancelled after user called
// google.longrunning.Operations.CancelOperation on the operation.
CANCELLING = 3;
// Request has been processed and is in its finalization stage.
FINALIZING = 4;
// Request has completed successfully.
SUCCESSFUL = 5;
// Request has finished being processed, but encountered an error.
FAILED = 6;
// Request has finished being cancelled after user called
// google.longrunning.Operations.CancelOperation.
CANCELLED = 7;
}

View File

@@ -0,0 +1,95 @@
// Copyright 2024 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.firestore.admin.v1;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/type/dayofweek.proto";
option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
option java_multiple_files = true;
option java_outer_classname = "ScheduleProto";
option java_package = "com.google.firestore.admin.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
// A backup schedule for a Cloud Firestore Database.
//
// This resource is owned by the database it is backing up, and is deleted along
// with the database. The actual backups are not though.
message BackupSchedule {
option (google.api.resource) = {
type: "firestore.googleapis.com/BackupSchedule"
pattern: "projects/{project}/databases/{database}/backupSchedules/{backup_schedule}"
};
// Output only. The unique backup schedule identifier across all locations and
// databases for the given project.
//
// This will be auto-assigned.
//
// Format is
// `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}`
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The timestamp at which this backup schedule was created and
// effective since.
//
// No backups will be created for this schedule before this time.
google.protobuf.Timestamp create_time = 3
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The timestamp at which this backup schedule was most recently
// updated. When a backup schedule is first created, this is the same as
// create_time.
google.protobuf.Timestamp update_time = 10
[(google.api.field_behavior) = OUTPUT_ONLY];
// At what relative time in the future, compared to its creation time,
// the backup should be deleted, e.g. keep backups for 7 days.
//
// The maximum supported retention period is 14 weeks.
google.protobuf.Duration retention = 6;
// A oneof field to represent when backups will be taken.
oneof recurrence {
// For a schedule that runs daily.
DailyRecurrence daily_recurrence = 7;
// For a schedule that runs weekly on a specific day.
WeeklyRecurrence weekly_recurrence = 8;
}
}
// Represents a recurring schedule that runs every day.
//
// The time zone is UTC.
message DailyRecurrence {}
// Represents a recurring schedule that runs on a specified day of the week.
//
// The time zone is UTC.
message WeeklyRecurrence {
// The day of week to run.
//
// DAY_OF_WEEK_UNSPECIFIED is not allowed.
google.type.DayOfWeek day = 2;
}

View File

@@ -0,0 +1,43 @@
// Copyright 2024 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.firestore.v1;
import "google/firestore/v1/document.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "AggregationResultProto";
option java_package = "com.google.firestore.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1";
option ruby_package = "Google::Cloud::Firestore::V1";
// The result of a single bucket from a Firestore aggregation query.
//
// The keys of `aggregate_fields` are the same for all results in an aggregation
// query, unlike document queries which can have different fields present for
// each result.
message AggregationResult {
// The result of the aggregation functions, ex: `COUNT(*) AS total_docs`.
//
// The key is the
// [alias][google.firestore.v1.StructuredAggregationQuery.Aggregation.alias]
// assigned to the aggregation function on input and the size of this map
// equals the number of aggregation functions in the query.
map<string, Value> aggregate_fields = 2;
}

View File

@@ -0,0 +1,73 @@
// Copyright 2024 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.firestore.v1;
option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "BloomFilterProto";
option java_package = "com.google.firestore.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1";
option ruby_package = "Google::Cloud::Firestore::V1";
// A sequence of bits, encoded in a byte array.
//
// Each byte in the `bitmap` byte array stores 8 bits of the sequence. The only
// exception is the last byte, which may store 8 _or fewer_ bits. The `padding`
// defines the number of bits of the last byte to be ignored as "padding". The
// values of these "padding" bits are unspecified and must be ignored.
//
// To retrieve the first bit, bit 0, calculate: `(bitmap[0] & 0x01) != 0`.
// To retrieve the second bit, bit 1, calculate: `(bitmap[0] & 0x02) != 0`.
// To retrieve the third bit, bit 2, calculate: `(bitmap[0] & 0x04) != 0`.
// To retrieve the fourth bit, bit 3, calculate: `(bitmap[0] & 0x08) != 0`.
// To retrieve bit n, calculate: `(bitmap[n / 8] & (0x01 << (n % 8))) != 0`.
//
// The "size" of a `BitSequence` (the number of bits it contains) is calculated
// by this formula: `(bitmap.length * 8) - padding`.
message BitSequence {
// The bytes that encode the bit sequence.
// May have a length of zero.
bytes bitmap = 1;
// The number of bits of the last byte in `bitmap` to ignore as "padding".
// If the length of `bitmap` is zero, then this value must be `0`.
// Otherwise, this value must be between 0 and 7, inclusive.
int32 padding = 2;
}
// A bloom filter (https://en.wikipedia.org/wiki/Bloom_filter).
//
// The bloom filter hashes the entries with MD5 and treats the resulting 128-bit
// hash as 2 distinct 64-bit hash values, interpreted as unsigned integers
// using 2's complement encoding.
//
// These two hash values, named `h1` and `h2`, are then used to compute the
// `hash_count` hash values using the formula, starting at `i=0`:
//
// h(i) = h1 + (i * h2)
//
// These resulting values are then taken modulo the number of bits in the bloom
// filter to get the bits of the bloom filter to test for the given entry.
message BloomFilter {
// The bloom filter data.
BitSequence bits = 1;
// The number of hashes used by the algorithm.
int32 hash_count = 2;
}

View File

@@ -0,0 +1,90 @@
// Copyright 2024 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.firestore.v1;
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option java_package = "com.google.firestore.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1";
option ruby_package = "Google::Cloud::Firestore::V1";
// A set of field paths on a document.
// Used to restrict a get or update operation on a document to a subset of its
// fields.
// This is different from standard field masks, as this is always scoped to a
// [Document][google.firestore.v1.Document], and takes in account the dynamic
// nature of [Value][google.firestore.v1.Value].
message DocumentMask {
// The list of field paths in the mask. See
// [Document.fields][google.firestore.v1.Document.fields] for a field path
// syntax reference.
repeated string field_paths = 1;
}
// A precondition on a document, used for conditional operations.
message Precondition {
// The type of precondition.
oneof condition_type {
// When set to `true`, the target document must exist.
// When set to `false`, the target document must not exist.
bool exists = 1;
// When set, the target document must exist and have been last updated at
// that time. Timestamp must be microsecond aligned.
google.protobuf.Timestamp update_time = 2;
}
}
// Options for creating a new transaction.
message TransactionOptions {
// Options for a transaction that can be used to read and write documents.
//
// Firestore does not allow 3rd party auth requests to create read-write.
// transactions.
message ReadWrite {
// An optional transaction to retry.
bytes retry_transaction = 1;
}
// Options for a transaction that can only be used to read documents.
message ReadOnly {
// The consistency mode for this transaction. If not set, defaults to strong
// consistency.
oneof consistency_selector {
// Reads documents at the given time.
//
// This must be a microsecond precision timestamp within the past one
// hour, or if Point-in-Time Recovery is enabled, can additionally be a
// whole minute timestamp within the past 7 days.
google.protobuf.Timestamp read_time = 2;
}
}
// The mode of the transaction.
oneof mode {
// The transaction can only be used for read operations.
ReadOnly read_only = 2;
// The transaction can be used for both read and write operations.
ReadWrite read_write = 3;
}
}

View File

@@ -0,0 +1,150 @@
// Copyright 2024 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.firestore.v1;
import "google/api/field_behavior.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/type/latlng.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "DocumentProto";
option java_package = "com.google.firestore.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1";
option ruby_package = "Google::Cloud::Firestore::V1";
// A Firestore document.
//
// Must not exceed 1 MiB - 4 bytes.
message Document {
// The resource name of the document, for example
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string name = 1;
// The document's fields.
//
// The map keys represent field names.
//
// Field names matching the regular expression `__.*__` are reserved. Reserved
// field names are forbidden except in certain documented contexts. The field
// names, represented as UTF-8, must not exceed 1,500 bytes and cannot be
// empty.
//
// Field paths may be used in other contexts to refer to structured fields
// defined here. For `map_value`, the field path is represented by a
// dot-delimited (`.`) string of segments. Each segment is either a simple
// field name (defined below) or a quoted field name. For example, the
// structured field `"foo" : { map_value: { "x&y" : { string_value: "hello"
// }}}` would be represented by the field path `` foo.`x&y` ``.
//
// A simple field name contains only characters `a` to `z`, `A` to `Z`,
// `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
// `foo_bar_17`.
//
// A quoted field name starts and ends with `` ` `` and
// may contain any character. Some characters, including `` ` ``, must be
// escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
// `` `bak\`tik` `` represents `` bak`tik ``.
map<string, Value> fields = 2;
// Output only. The time at which the document was created.
//
// This value increases monotonically when a document is deleted then
// recreated. It can also be compared to values from other documents and
// the `read_time` of a query.
google.protobuf.Timestamp create_time = 3;
// Output only. The time at which the document was last changed.
//
// This value is initially set to the `create_time` then increases
// monotonically with each change to the document. It can also be
// compared to values from other documents and the `read_time` of a query.
google.protobuf.Timestamp update_time = 4;
}
// A message that can hold any of the supported value types.
message Value {
// Must have a value set.
oneof value_type {
// A null value.
google.protobuf.NullValue null_value = 11;
// A boolean value.
bool boolean_value = 1;
// An integer value.
int64 integer_value = 2;
// A double value.
double double_value = 3;
// A timestamp value.
//
// Precise only to microseconds. When stored, any additional precision is
// rounded down.
google.protobuf.Timestamp timestamp_value = 10;
// A string value.
//
// The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes.
// Only the first 1,500 bytes of the UTF-8 representation are considered by
// queries.
string string_value = 17;
// A bytes value.
//
// Must not exceed 1 MiB - 89 bytes.
// Only the first 1,500 bytes are considered by queries.
bytes bytes_value = 18;
// A reference to a document. For example:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string reference_value = 5;
// A geo point value representing a point on the surface of Earth.
google.type.LatLng geo_point_value = 8;
// An array value.
//
// Cannot directly contain another array value, though can contain a
// map which contains another array.
ArrayValue array_value = 9;
// A map value.
MapValue map_value = 6;
}
}
// An array value.
message ArrayValue {
// Values in the array.
repeated Value values = 1;
}
// A map value.
message MapValue {
// The map's fields.
//
// The map keys represent field names. Field names matching the regular
// expression `__.*__` are reserved. Reserved field names are forbidden except
// in certain documented contexts. The map keys, represented as UTF-8, must
// not exceed 1,500 bytes and cannot be empty.
map<string, Value> fields = 1;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,589 @@
// Copyright 2024 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.firestore.v1;
import "google/api/field_behavior.proto";
import "google/firestore/v1/document.proto";
import "google/protobuf/wrappers.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "QueryProto";
option java_package = "com.google.firestore.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1";
option ruby_package = "Google::Cloud::Firestore::V1";
// A Firestore query.
//
// The query stages are executed in the following order:
// 1. from
// 2. where
// 3. select
// 4. order_by + start_at + end_at
// 5. offset
// 6. limit
message StructuredQuery {
// A selection of a collection, such as `messages as m1`.
message CollectionSelector {
// The collection ID.
// When set, selects only collections with this ID.
string collection_id = 2;
// When false, selects only collections that are immediate children of
// the `parent` specified in the containing `RunQueryRequest`.
// When true, selects all descendant collections.
bool all_descendants = 3;
}
// A filter.
message Filter {
// The type of filter.
oneof filter_type {
// A composite filter.
CompositeFilter composite_filter = 1;
// A filter on a document field.
FieldFilter field_filter = 2;
// A filter that takes exactly one argument.
UnaryFilter unary_filter = 3;
}
}
// A filter that merges multiple other filters using the given operator.
message CompositeFilter {
// A composite filter operator.
enum Operator {
// Unspecified. This value must not be used.
OPERATOR_UNSPECIFIED = 0;
// Documents are required to satisfy all of the combined filters.
AND = 1;
// Documents are required to satisfy at least one of the combined filters.
OR = 2;
}
// The operator for combining multiple filters.
Operator op = 1;
// The list of filters to combine.
//
// Requires:
//
// * At least one filter is present.
repeated Filter filters = 2;
}
// A filter on a specific field.
message FieldFilter {
// A field filter operator.
enum Operator {
// Unspecified. This value must not be used.
OPERATOR_UNSPECIFIED = 0;
// The given `field` is less than the given `value`.
//
// Requires:
//
// * That `field` come first in `order_by`.
LESS_THAN = 1;
// The given `field` is less than or equal to the given `value`.
//
// Requires:
//
// * That `field` come first in `order_by`.
LESS_THAN_OR_EQUAL = 2;
// The given `field` is greater than the given `value`.
//
// Requires:
//
// * That `field` come first in `order_by`.
GREATER_THAN = 3;
// The given `field` is greater than or equal to the given `value`.
//
// Requires:
//
// * That `field` come first in `order_by`.
GREATER_THAN_OR_EQUAL = 4;
// The given `field` is equal to the given `value`.
EQUAL = 5;
// The given `field` is not equal to the given `value`.
//
// Requires:
//
// * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
// * That `field` comes first in the `order_by`.
NOT_EQUAL = 6;
// The given `field` is an array that contains the given `value`.
ARRAY_CONTAINS = 7;
// The given `field` is equal to at least one value in the given array.
//
// Requires:
//
// * That `value` is a non-empty `ArrayValue`, subject to disjunction
// limits.
// * No `NOT_IN` filters in the same query.
IN = 8;
// The given `field` is an array that contains any of the values in the
// given array.
//
// Requires:
//
// * That `value` is a non-empty `ArrayValue`, subject to disjunction
// limits.
// * No other `ARRAY_CONTAINS_ANY` filters within the same disjunction.
// * No `NOT_IN` filters in the same query.
ARRAY_CONTAINS_ANY = 9;
// The value of the `field` is not in the given array.
//
// Requires:
//
// * That `value` is a non-empty `ArrayValue` with at most 10 values.
// * No other `OR`, `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`,
// `IS_NOT_NULL`, or `IS_NOT_NAN`.
// * That `field` comes first in the `order_by`.
NOT_IN = 10;
}
// The field to filter by.
FieldReference field = 1;
// The operator to filter by.
Operator op = 2;
// The value to compare to.
Value value = 3;
}
// A filter with a single operand.
message UnaryFilter {
// A unary operator.
enum Operator {
// Unspecified. This value must not be used.
OPERATOR_UNSPECIFIED = 0;
// The given `field` is equal to `NaN`.
IS_NAN = 2;
// The given `field` is equal to `NULL`.
IS_NULL = 3;
// The given `field` is not equal to `NaN`.
//
// Requires:
//
// * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
// * That `field` comes first in the `order_by`.
IS_NOT_NAN = 4;
// The given `field` is not equal to `NULL`.
//
// Requires:
//
// * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
// * That `field` comes first in the `order_by`.
IS_NOT_NULL = 5;
}
// The unary operator to apply.
Operator op = 1;
// The argument to the filter.
oneof operand_type {
// The field to which to apply the operator.
FieldReference field = 2;
}
}
// An order on a field.
message Order {
// The field to order by.
FieldReference field = 1;
// The direction to order by. Defaults to `ASCENDING`.
Direction direction = 2;
}
// A sort direction.
enum Direction {
// Unspecified.
DIRECTION_UNSPECIFIED = 0;
// Ascending.
ASCENDING = 1;
// Descending.
DESCENDING = 2;
}
// A reference to a field in a document, ex: `stats.operations`.
message FieldReference {
// A reference to a field in a document.
//
// Requires:
//
// * MUST be a dot-delimited (`.`) string of segments, where each segment
// conforms to [document field name][google.firestore.v1.Document.fields]
// limitations.
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;
}
// Nearest Neighbors search config. The ordering provided by FindNearest
// supersedes the order_by stage. If multiple documents have the same vector
// distance, the returned document order is not guaranteed to be stable
// between queries.
message FindNearest {
// The distance measure to use when comparing vectors.
enum DistanceMeasure {
// Should not be set.
DISTANCE_MEASURE_UNSPECIFIED = 0;
// Measures the EUCLIDEAN distance between the vectors. See
// [Euclidean](https://en.wikipedia.org/wiki/Euclidean_distance) to learn
// more. The resulting distance decreases the more similar two vectors
// are.
EUCLIDEAN = 1;
// COSINE distance compares vectors based on the angle between them, which
// allows you to measure similarity that isn't based on the vectors
// magnitude. We recommend using DOT_PRODUCT with unit normalized vectors
// instead of COSINE distance, which is mathematically equivalent with
// better performance. See [Cosine
// Similarity](https://en.wikipedia.org/wiki/Cosine_similarity) to learn
// more about COSINE similarity and COSINE distance. The resulting
// COSINE distance decreases the more similar two vectors are.
COSINE = 2;
// Similar to cosine but is affected by the magnitude of the vectors. See
// [Dot Product](https://en.wikipedia.org/wiki/Dot_product) to learn more.
// The resulting distance increases the more similar two vectors are.
DOT_PRODUCT = 3;
}
// Required. An indexed vector field to search upon. Only documents which
// contain vectors whose dimensionality match the query_vector can be
// returned.
FieldReference vector_field = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The query vector that we are searching on. Must be a vector of
// no more than 2048 dimensions.
Value query_vector = 2 [(google.api.field_behavior) = REQUIRED];
// Required. The distance measure to use, required.
DistanceMeasure distance_measure = 3
[(google.api.field_behavior) = REQUIRED];
// Required. The number of nearest neighbors to return. Must be a positive
// integer of no more than 1000.
google.protobuf.Int32Value limit = 4
[(google.api.field_behavior) = REQUIRED];
// Optional. Optional name of the field to output the result of the vector
// distance calculation. Must conform to [document field
// name][google.firestore.v1.Document.fields] limitations.
string distance_result_field = 5 [(google.api.field_behavior) = OPTIONAL];
// Optional. Option to specify a threshold for which no less similar
// documents will be returned. The behavior of the specified
// `distance_measure` will affect the meaning of the distance threshold.
// Since DOT_PRODUCT distances increase when the vectors are more similar,
// the comparison is inverted.
//
// For EUCLIDEAN, COSINE: WHERE distance <= distance_threshold
// For DOT_PRODUCT: WHERE distance >= distance_threshold
google.protobuf.DoubleValue distance_threshold = 6
[(google.api.field_behavior) = OPTIONAL];
}
// Optional sub-set of the fields to return.
//
// This acts as a [DocumentMask][google.firestore.v1.DocumentMask] over the
// documents returned from a query. When not set, assumes that the caller
// wants all fields returned.
Projection select = 1;
// The collections to query.
repeated CollectionSelector from = 2;
// The filter to apply.
Filter where = 3;
// The order to apply to the query results.
//
// Firestore allows callers to provide a full ordering, a partial ordering, or
// no ordering at all. In all cases, Firestore guarantees a stable ordering
// through the following rules:
//
// * The `order_by` is required to reference all fields used with an
// inequality filter.
// * All fields that are required to be in the `order_by` but are not already
// present are appended in lexicographical ordering of the field name.
// * If an order on `__name__` is not specified, it is appended by default.
//
// Fields are appended with the same sort direction as the last order
// specified, or 'ASCENDING' if no order was specified. For example:
//
// * `ORDER BY a` becomes `ORDER BY a ASC, __name__ ASC`
// * `ORDER BY a DESC` becomes `ORDER BY a DESC, __name__ DESC`
// * `WHERE a > 1` becomes `WHERE a > 1 ORDER BY a ASC, __name__ ASC`
// * `WHERE __name__ > ... AND a > 1` becomes
// `WHERE __name__ > ... AND a > 1 ORDER BY a ASC, __name__ ASC`
repeated Order order_by = 4;
// A potential prefix of a position in the result set to start the query at.
//
// The ordering of the result set is based on the `ORDER BY` clause of the
// original query.
//
// ```
// SELECT * FROM k WHERE a = 1 AND b > 2 ORDER BY b ASC, __name__ ASC;
// ```
//
// This query's results are ordered by `(b ASC, __name__ ASC)`.
//
// Cursors can reference either the full ordering or a prefix of the location,
// though it cannot reference more fields than what are in the provided
// `ORDER BY`.
//
// Continuing off the example above, attaching the following start cursors
// will have varying impact:
//
// - `START BEFORE (2, /k/123)`: start the query right before `a = 1 AND
// b > 2 AND __name__ > /k/123`.
// - `START AFTER (10)`: start the query right after `a = 1 AND b > 10`.
//
// Unlike `OFFSET` which requires scanning over the first N results to skip,
// a start cursor allows the query to begin at a logical position. This
// position is not required to match an actual result, it will scan forward
// from this position to find the next document.
//
// Requires:
//
// * The number of values cannot be greater than the number of fields
// specified in the `ORDER BY` clause.
Cursor start_at = 7;
// A potential prefix of a position in the result set to end the query at.
//
// This is similar to `START_AT` but with it controlling the end position
// rather than the start position.
//
// Requires:
//
// * The number of values cannot be greater than the number of fields
// specified in the `ORDER BY` clause.
Cursor end_at = 8;
// The number of documents to skip before returning the first result.
//
// This applies after the constraints specified by the `WHERE`, `START AT`, &
// `END AT` but before the `LIMIT` clause.
//
// Requires:
//
// * The value must be greater than or equal to zero if specified.
int32 offset = 6;
// The maximum number of results to return.
//
// Applies after all other constraints.
//
// Requires:
//
// * The value must be greater than or equal to zero if specified.
google.protobuf.Int32Value limit = 5;
// Optional. A potential nearest neighbors search.
//
// Applies after all other filters and ordering.
//
// Finds the closest vector embeddings to the given query vector.
FindNearest find_nearest = 9 [(google.api.field_behavior) = OPTIONAL];
}
// Firestore query for running an aggregation over a
// [StructuredQuery][google.firestore.v1.StructuredQuery].
message StructuredAggregationQuery {
// Defines an aggregation that produces a single result.
message Aggregation {
// Count of documents that match the query.
//
// The `COUNT(*)` aggregation function operates on the entire document
// so it does not require a field reference.
message Count {
// Optional. Optional constraint on the maximum number of documents to
// count.
//
// This provides a way to set an upper bound on the number of documents
// to scan, limiting latency, and cost.
//
// Unspecified is interpreted as no bound.
//
// High-Level Example:
//
// ```
// AGGREGATE COUNT_UP_TO(1000) OVER ( SELECT * FROM k );
// ```
//
// Requires:
//
// * Must be greater than zero when present.
google.protobuf.Int64Value up_to = 1
[(google.api.field_behavior) = OPTIONAL];
}
// Sum of the values of the requested field.
//
// * Only numeric values will be aggregated. All non-numeric values
// including `NULL` are skipped.
//
// * If the aggregated values contain `NaN`, returns `NaN`. Infinity math
// follows IEEE-754 standards.
//
// * If the aggregated value set is empty, returns 0.
//
// * Returns a 64-bit integer if all aggregated numbers are integers and the
// sum result does not overflow. Otherwise, the result is returned as a
// double. Note that even if all the aggregated values are integers, the
// result is returned as a double if it cannot fit within a 64-bit signed
// integer. When this occurs, the returned value will lose precision.
//
// * When underflow occurs, floating-point aggregation is non-deterministic.
// This means that running the same query repeatedly without any changes to
// the underlying values could produce slightly different results each
// time. In those cases, values should be stored as integers over
// floating-point numbers.
message Sum {
// The field to aggregate on.
StructuredQuery.FieldReference field = 1;
}
// Average of the values of the requested field.
//
// * Only numeric values will be aggregated. All non-numeric values
// including `NULL` are skipped.
//
// * If the aggregated values contain `NaN`, returns `NaN`. Infinity math
// follows IEEE-754 standards.
//
// * If the aggregated value set is empty, returns `NULL`.
//
// * Always returns the result as a double.
message Avg {
// The field to aggregate on.
StructuredQuery.FieldReference field = 1;
}
// The type of aggregation to perform, required.
oneof operator {
// Count aggregator.
Count count = 1;
// Sum aggregator.
Sum sum = 2;
// Average aggregator.
Avg avg = 3;
}
// Optional. Optional name of the field to store the result of the
// aggregation into.
//
// If not provided, Firestore will pick a default name following the format
// `field_<incremental_id++>`. For example:
//
// ```
// AGGREGATE
// COUNT_UP_TO(1) AS count_up_to_1,
// COUNT_UP_TO(2),
// COUNT_UP_TO(3) AS count_up_to_3,
// COUNT(*)
// OVER (
// ...
// );
// ```
//
// becomes:
//
// ```
// AGGREGATE
// COUNT_UP_TO(1) AS count_up_to_1,
// COUNT_UP_TO(2) AS field_1,
// COUNT_UP_TO(3) AS count_up_to_3,
// COUNT(*) AS field_2
// OVER (
// ...
// );
// ```
//
// Requires:
//
// * Must be unique across all aggregation aliases.
// * Conform to [document field name][google.firestore.v1.Document.fields]
// limitations.
string alias = 7 [(google.api.field_behavior) = OPTIONAL];
}
// The base query to aggregate over.
oneof query_type {
// Nested structured query.
StructuredQuery structured_query = 1;
}
// Optional. Series of aggregations to apply over the results of the
// `structured_query`.
//
// Requires:
//
// * A minimum of one and maximum of five aggregations per query.
repeated Aggregation aggregations = 3
[(google.api.field_behavior) = OPTIONAL];
}
// A position in a query result set.
message Cursor {
// The values that represent a position, in the order they appear in
// the order by clause of a query.
//
// Can contain fewer values than specified in the order by clause.
repeated Value values = 1;
// If the position is just before or just after the given values, relative
// to the sort order defined by the query.
bool before = 2;
}

View File

@@ -0,0 +1,92 @@
// Copyright 2024 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.firestore.v1;
import "google/api/field_behavior.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "QueryProfileProto";
option java_package = "com.google.firestore.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1";
option ruby_package = "Google::Cloud::Firestore::V1";
// Specification of the Firestore Query Profile fields.
// Explain options for the query.
message ExplainOptions {
// Optional. Whether to execute this query.
//
// When false (the default), the query will be planned, returning only
// metrics from the planning stages.
//
// When true, the query will be planned and executed, returning the full
// query results along with both planning and execution stage metrics.
bool analyze = 1 [(google.api.field_behavior) = OPTIONAL];
}
// Explain metrics for the query.
message ExplainMetrics {
// Planning phase information for the query.
PlanSummary plan_summary = 1;
// Aggregated stats from the execution of the query. Only present when
// [ExplainOptions.analyze][google.firestore.v1.ExplainOptions.analyze] is set
// to true.
ExecutionStats execution_stats = 2;
}
// Planning phase information for the query.
message PlanSummary {
// The indexes selected for the query. For example:
// [
// {"query_scope": "Collection", "properties": "(foo ASC, __name__ ASC)"},
// {"query_scope": "Collection", "properties": "(bar ASC, __name__ ASC)"}
// ]
repeated google.protobuf.Struct indexes_used = 1;
}
// Execution statistics for the query.
message ExecutionStats {
// Total number of results returned, including documents, projections,
// aggregation results, keys.
int64 results_returned = 1;
// Total time to execute the query in the backend.
google.protobuf.Duration execution_duration = 3;
// Total billable read operations.
int64 read_operations = 4;
// Debugging statistics from the execution of the query. Note that the
// debugging stats are subject to change as Firestore evolves. It could
// include:
// {
// "indexes_entries_scanned": "1000",
// "documents_scanned": "20",
// "billing_details" : {
// "documents_billable": "20",
// "index_entries_billable": "1000",
// "min_query_cost": "0"
// }
// }
google.protobuf.Struct debug_stats = 5;
}

View File

@@ -0,0 +1,286 @@
// Copyright 2024 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.firestore.v1;
import "google/firestore/v1/bloom_filter.proto";
import "google/firestore/v1/common.proto";
import "google/firestore/v1/document.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "WriteProto";
option java_package = "com.google.firestore.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1";
option ruby_package = "Google::Cloud::Firestore::V1";
// A write on a document.
message Write {
// The operation to execute.
oneof operation {
// A document to write.
Document update = 1;
// A document name to delete. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string delete = 2;
// Applies a transformation to a document.
DocumentTransform transform = 6;
}
// The fields to update in this write.
//
// This field can be set only when the operation is `update`.
// If the mask is not set for an `update` and the document exists, any
// existing data will be overwritten.
// If the mask is set and the document on the server has fields not covered by
// the mask, they are left unchanged.
// Fields referenced in the mask, but not present in the input document, are
// deleted from the document on the server.
// The field paths in this mask must not contain a reserved field name.
DocumentMask update_mask = 3;
// The transforms to perform after update.
//
// This field can be set only when the operation is `update`. If present, this
// write is equivalent to performing `update` and `transform` to the same
// document atomically and in order.
repeated DocumentTransform.FieldTransform update_transforms = 7;
// An optional precondition on the document.
//
// The write will fail if this is set and not met by the target document.
Precondition current_document = 4;
}
// A transformation of a document.
message DocumentTransform {
// A transformation of a field of the document.
message FieldTransform {
// A value that is calculated by the server.
enum ServerValue {
// Unspecified. This value must not be used.
SERVER_VALUE_UNSPECIFIED = 0;
// The time at which the server processed the request, with millisecond
// precision. If used on multiple fields (same or different documents) in
// a transaction, all the fields will get the same server timestamp.
REQUEST_TIME = 1;
}
// The path of the field. See
// [Document.fields][google.firestore.v1.Document.fields] for the field path
// syntax reference.
string field_path = 1;
// The transformation to apply on the field.
oneof transform_type {
// Sets the field to the given server value.
ServerValue set_to_server_value = 2;
// Adds the given value to the field's current value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the given value.
// If either of the given value or the current field value are doubles,
// both values will be interpreted as doubles. Double arithmetic and
// representation of double values follow IEEE 754 semantics.
// If there is positive/negative integer overflow, the field is resolved
// to the largest magnitude positive/negative integer.
Value increment = 3;
// Sets the field to the maximum of its current value and the given value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the given value.
// If a maximum operation is applied where the field and the input value
// are of mixed types (that is - one is an integer and one is a double)
// the field takes on the type of the larger operand. If the operands are
// equivalent (e.g. 3 and 3.0), the field does not change.
// 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and
// zero input value is always the stored value.
// The maximum of any numeric value x and NaN is NaN.
Value maximum = 4;
// Sets the field to the minimum of its current value and the given value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the input value.
// If a minimum operation is applied where the field and the input value
// are of mixed types (that is - one is an integer and one is a double)
// the field takes on the type of the smaller operand. If the operands are
// equivalent (e.g. 3 and 3.0), the field does not change.
// 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and
// zero input value is always the stored value.
// The minimum of any numeric value x and NaN is NaN.
Value minimum = 5;
// Append the given elements in order if they are not already present in
// the current field value.
// If the field is not an array, or if the field does not yet exist, it is
// first set to the empty array.
//
// Equivalent numbers of different types (e.g. 3L and 3.0) are
// considered equal when checking if a value is missing.
// NaN is equal to NaN, and Null is equal to Null.
// If the input contains multiple equivalent values, only the first will
// be considered.
//
// The corresponding transform_result will be the null value.
ArrayValue append_missing_elements = 6;
// Remove all of the given elements from the array in the field.
// If the field is not an array, or if the field does not yet exist, it is
// set to the empty array.
//
// Equivalent numbers of the different types (e.g. 3L and 3.0) are
// considered equal when deciding whether an element should be removed.
// NaN is equal to NaN, and Null is equal to Null.
// This will remove all equivalent values if there are duplicates.
//
// The corresponding transform_result will be the null value.
ArrayValue remove_all_from_array = 7;
}
}
// The name of the document to transform.
string document = 1;
// The list of transformations to apply to the fields of the document, in
// order.
// This must not be empty.
repeated FieldTransform field_transforms = 2;
}
// The result of applying a write.
message WriteResult {
// The last update time of the document after applying the write. Not set
// after a `delete`.
//
// If the write did not actually change the document, this will be the
// previous update_time.
google.protobuf.Timestamp update_time = 1;
// The results of applying each
// [DocumentTransform.FieldTransform][google.firestore.v1.DocumentTransform.FieldTransform],
// in the same order.
repeated Value transform_results = 2;
}
// A [Document][google.firestore.v1.Document] has changed.
//
// May be the result of multiple [writes][google.firestore.v1.Write], including
// deletes, that ultimately resulted in a new value for the
// [Document][google.firestore.v1.Document].
//
// Multiple [DocumentChange][google.firestore.v1.DocumentChange] messages may be
// returned for the same logical change, if multiple targets are affected.
message DocumentChange {
// The new state of the [Document][google.firestore.v1.Document].
//
// If `mask` is set, contains only fields that were updated or added.
Document document = 1;
// A set of target IDs of targets that match this document.
repeated int32 target_ids = 5;
// A set of target IDs for targets that no longer match this document.
repeated int32 removed_target_ids = 6;
}
// A [Document][google.firestore.v1.Document] has been deleted.
//
// May be the result of multiple [writes][google.firestore.v1.Write], including
// updates, the last of which deleted the
// [Document][google.firestore.v1.Document].
//
// Multiple [DocumentDelete][google.firestore.v1.DocumentDelete] messages may be
// returned for the same logical delete, if multiple targets are affected.
message DocumentDelete {
// The resource name of the [Document][google.firestore.v1.Document] that was
// deleted.
string document = 1;
// A set of target IDs for targets that previously matched this entity.
repeated int32 removed_target_ids = 6;
// The read timestamp at which the delete was observed.
//
// Greater or equal to the `commit_time` of the delete.
google.protobuf.Timestamp read_time = 4;
}
// A [Document][google.firestore.v1.Document] has been removed from the view of
// the targets.
//
// Sent if the document is no longer relevant to a target and is out of view.
// Can be sent instead of a DocumentDelete or a DocumentChange if the server
// can not send the new value of the document.
//
// Multiple [DocumentRemove][google.firestore.v1.DocumentRemove] messages may be
// returned for the same logical write or delete, if multiple targets are
// affected.
message DocumentRemove {
// The resource name of the [Document][google.firestore.v1.Document] that has
// gone out of view.
string document = 1;
// A set of target IDs for targets that previously matched this document.
repeated int32 removed_target_ids = 2;
// The read timestamp at which the remove was observed.
//
// Greater or equal to the `commit_time` of the change/delete/remove.
google.protobuf.Timestamp read_time = 4;
}
// A digest of all the documents that match a given target.
message ExistenceFilter {
// The target ID to which this filter applies.
int32 target_id = 1;
// The total count of documents that match
// [target_id][google.firestore.v1.ExistenceFilter.target_id].
//
// If different from the count of documents in the client that match, the
// client must manually determine which documents no longer match the target.
//
// The client can use the `unchanged_names` bloom filter to assist with
// this determination by testing ALL the document names against the filter;
// if the document name is NOT in the filter, it means the document no
// longer matches the target.
int32 count = 2;
// A bloom filter that, despite its name, contains the UTF-8 byte encodings of
// the resource names of ALL the documents that match
// [target_id][google.firestore.v1.ExistenceFilter.target_id], in the form
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
//
// This bloom filter may be omitted at the server's discretion, such as if it
// is deemed that the client will not make use of it or if it is too
// computationally expensive to calculate or transmit. Clients must gracefully
// handle this field being absent by falling back to the logic used before
// this field existed; that is, re-add the target without a resume token to
// figure out which documents in the client's cache are out of sync.
BloomFilter unchanged_names = 3;
}

View File

@@ -0,0 +1,82 @@
// Copyright 2024 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.firestore.v1beta1;
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// A set of field paths on a document.
// Used to restrict a get or update operation on a document to a subset of its
// fields.
// This is different from standard field masks, as this is always scoped to a
// [Document][google.firestore.v1beta1.Document], and takes in account the dynamic nature of [Value][google.firestore.v1beta1.Value].
message DocumentMask {
// The list of field paths in the mask. See [Document.fields][google.firestore.v1beta1.Document.fields] for a field
// path syntax reference.
repeated string field_paths = 1;
}
// A precondition on a document, used for conditional operations.
message Precondition {
// The type of precondition.
oneof condition_type {
// When set to `true`, the target document must exist.
// When set to `false`, the target document must not exist.
bool exists = 1;
// When set, the target document must exist and have been last updated at
// that time.
google.protobuf.Timestamp update_time = 2;
}
}
// Options for creating a new transaction.
message TransactionOptions {
// Options for a transaction that can be used to read and write documents.
message ReadWrite {
// An optional transaction to retry.
bytes retry_transaction = 1;
}
// Options for a transaction that can only be used to read documents.
message ReadOnly {
// The consistency mode for this transaction. If not set, defaults to strong
// consistency.
oneof consistency_selector {
// Reads documents at the given time.
// This may not be older than 60 seconds.
google.protobuf.Timestamp read_time = 2;
}
}
// The mode of the transaction.
oneof mode {
// The transaction can only be used for read operations.
ReadOnly read_only = 2;
// The transaction can be used for both read and write operations.
ReadWrite read_write = 3;
}
}

View File

@@ -0,0 +1,149 @@
// Copyright 2024 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.firestore.v1beta1;
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/type/latlng.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "DocumentProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// A Firestore document.
//
// Must not exceed 1 MiB - 4 bytes.
message Document {
// The resource name of the document, for example
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string name = 1;
// The document's fields.
//
// The map keys represent field names.
//
// A simple field name contains only characters `a` to `z`, `A` to `Z`,
// `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
// `foo_bar_17`.
//
// Field names matching the regular expression `__.*__` are reserved. Reserved
// field names are forbidden except in certain documented contexts. The map
// keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
// empty.
//
// Field paths may be used in other contexts to refer to structured fields
// defined here. For `map_value`, the field path is represented by the simple
// or quoted field names of the containing fields, delimited by `.`. For
// example, the structured field
// `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
// represented by the field path `foo.x&y`.
//
// Within a field path, a quoted field name starts and ends with `` ` `` and
// may contain any character. Some characters, including `` ` ``, must be
// escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
// `` `bak\`tik` `` represents `` bak`tik ``.
map<string, Value> fields = 2;
// Output only. The time at which the document was created.
//
// This value increases monotonically when a document is deleted then
// recreated. It can also be compared to values from other documents and
// the `read_time` of a query.
google.protobuf.Timestamp create_time = 3;
// Output only. The time at which the document was last changed.
//
// This value is initially set to the `create_time` then increases
// monotonically with each change to the document. It can also be
// compared to values from other documents and the `read_time` of a query.
google.protobuf.Timestamp update_time = 4;
}
// A message that can hold any of the supported value types.
message Value {
// Must have a value set.
oneof value_type {
// A null value.
google.protobuf.NullValue null_value = 11;
// A boolean value.
bool boolean_value = 1;
// An integer value.
int64 integer_value = 2;
// A double value.
double double_value = 3;
// A timestamp value.
//
// Precise only to microseconds. When stored, any additional precision is
// rounded down.
google.protobuf.Timestamp timestamp_value = 10;
// A string value.
//
// The string, represented as UTF-8, must not exceed 1 MiB - 89 bytes.
// Only the first 1,500 bytes of the UTF-8 representation are considered by
// queries.
string string_value = 17;
// A bytes value.
//
// Must not exceed 1 MiB - 89 bytes.
// Only the first 1,500 bytes are considered by queries.
bytes bytes_value = 18;
// A reference to a document. For example:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string reference_value = 5;
// A geo point value representing a point on the surface of Earth.
google.type.LatLng geo_point_value = 8;
// An array value.
//
// Cannot directly contain another array value, though can contain an
// map which contains another array.
ArrayValue array_value = 9;
// A map value.
MapValue map_value = 6;
}
}
// An array value.
message ArrayValue {
// Values in the array.
repeated Value values = 1;
}
// A map value.
message MapValue {
// The map's fields.
//
// The map keys represent field names. Field names matching the regular
// expression `__.*__` are reserved. Reserved field names are forbidden except
// in certain documented contexts. The map keys, represented as UTF-8, must
// not exceed 1,500 bytes and cannot be empty.
map<string, Value> fields = 1;
}

View File

@@ -0,0 +1,900 @@
// Copyright 2024 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.firestore.v1beta1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/firestore/v1beta1/common.proto";
import "google/firestore/v1beta1/document.proto";
import "google/firestore/v1beta1/query.proto";
import "google/firestore/v1beta1/write.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/status.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "FirestoreProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// Specification of the Firestore API.
// The Cloud Firestore service.
//
// Cloud Firestore is a fast, fully managed, serverless, cloud-native NoSQL
// document database that simplifies storing, syncing, and querying data for
// your mobile, web, and IoT apps at global scale. Its client libraries provide
// live synchronization and offline support, while its security features and
// integrations with Firebase and Google Cloud Platform (GCP) accelerate
// building truly serverless apps.
service Firestore {
option (google.api.default_host) = "firestore.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/datastore";
// Gets a single document.
rpc GetDocument(GetDocumentRequest) returns (Document) {
option (google.api.http) = {
get: "/v1beta1/{name=projects/*/databases/*/documents/*/**}"
};
}
// Lists documents.
rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) {
option (google.api.http) = {
get: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}"
};
}
// Updates or inserts a document.
rpc UpdateDocument(UpdateDocumentRequest) returns (Document) {
option (google.api.http) = {
patch: "/v1beta1/{document.name=projects/*/databases/*/documents/*/**}"
body: "document"
};
option (google.api.method_signature) = "document,update_mask";
}
// Deletes a document.
rpc DeleteDocument(DeleteDocumentRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta1/{name=projects/*/databases/*/documents/*/**}"
};
option (google.api.method_signature) = "name";
}
// Gets multiple documents.
//
// Documents returned by this method are not guaranteed to be returned in the
// same order that they were requested.
rpc BatchGetDocuments(BatchGetDocumentsRequest) returns (stream BatchGetDocumentsResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:batchGet"
body: "*"
};
}
// Starts a new transaction.
rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:beginTransaction"
body: "*"
};
option (google.api.method_signature) = "database";
}
// Commits a transaction, while optionally updating documents.
rpc Commit(CommitRequest) returns (CommitResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:commit"
body: "*"
};
option (google.api.method_signature) = "database,writes";
}
// Rolls back a transaction.
rpc Rollback(RollbackRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:rollback"
body: "*"
};
option (google.api.method_signature) = "database,transaction";
}
// Runs a query.
rpc RunQuery(RunQueryRequest) returns (stream RunQueryResponse) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/databases/*/documents}:runQuery"
body: "*"
additional_bindings {
post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:runQuery"
body: "*"
}
};
}
// Partitions a query by returning partition cursors that can be used to run
// the query in parallel. The returned partition cursors are split points that
// can be used by RunQuery as starting/end points for the query results.
rpc PartitionQuery(PartitionQueryRequest) returns (PartitionQueryResponse) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/databases/*/documents}:partitionQuery"
body: "*"
additional_bindings {
post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:partitionQuery"
body: "*"
}
};
}
// Streams batches of document updates and deletes, in order.
rpc Write(stream WriteRequest) returns (stream WriteResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:write"
body: "*"
};
}
// Listens to changes.
rpc Listen(stream ListenRequest) returns (stream ListenResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:listen"
body: "*"
};
}
// Lists all the collection IDs underneath a document.
rpc ListCollectionIds(ListCollectionIdsRequest) returns (ListCollectionIdsResponse) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/databases/*/documents}:listCollectionIds"
body: "*"
additional_bindings {
post: "/v1beta1/{parent=projects/*/databases/*/documents/*/**}:listCollectionIds"
body: "*"
}
};
option (google.api.method_signature) = "parent";
}
// Applies a batch of write operations.
//
// The BatchWrite method does not apply the write operations atomically
// and can apply them out of order. Method does not allow more than one write
// per document. Each write succeeds or fails independently. See the
// [BatchWriteResponse][google.firestore.v1beta1.BatchWriteResponse] for the success status of each write.
//
// If you require an atomically applied set of writes, use
// [Commit][google.firestore.v1beta1.Firestore.Commit] instead.
rpc BatchWrite(BatchWriteRequest) returns (BatchWriteResponse) {
option (google.api.http) = {
post: "/v1beta1/{database=projects/*/databases/*}/documents:batchWrite"
body: "*"
};
}
// Creates a new document.
rpc CreateDocument(CreateDocumentRequest) returns (Document) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/databases/*/documents/**}/{collection_id}"
body: "document"
};
}
}
// The request for [Firestore.GetDocument][google.firestore.v1beta1.Firestore.GetDocument].
message GetDocumentRequest {
// Required. The resource name of the Document to get. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string name = 1 [(google.api.field_behavior) = REQUIRED];
// The fields to return. If not set, returns all fields.
//
// If the document has a field that is not present in this mask, that field
// will not be returned in the response.
DocumentMask mask = 2;
// The consistency mode for this transaction.
// If not set, defaults to strong consistency.
oneof consistency_selector {
// Reads the document in a transaction.
bytes transaction = 3;
// Reads the version of the document at the given time.
// This may not be older than 270 seconds.
google.protobuf.Timestamp read_time = 5;
}
}
// The request for [Firestore.ListDocuments][google.firestore.v1beta1.Firestore.ListDocuments].
message ListDocumentsRequest {
// 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 [(google.api.field_behavior) = REQUIRED];
// Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`
// or `messages`.
string collection_id = 2 [(google.api.field_behavior) = REQUIRED];
// The maximum number of documents to return.
int32 page_size = 3;
// The `next_page_token` value returned from a previous List request, if any.
string page_token = 4;
// The order to sort results by. For example: `priority desc, name`.
string order_by = 6;
// The fields to return. If not set, returns all fields.
//
// If a document has a field that is not present in this mask, that field
// will not be returned in the response.
DocumentMask mask = 7;
// The consistency mode for this transaction.
// If not set, defaults to strong consistency.
oneof consistency_selector {
// Reads documents in a transaction.
bytes transaction = 8;
// Reads documents as they were at the given time.
// This may not be older than 270 seconds.
google.protobuf.Timestamp read_time = 10;
}
// If the list should show missing documents. A missing document is a
// document that does not exist but has sub-documents. These documents will
// be returned with a key but will not have fields, [Document.create_time][google.firestore.v1beta1.Document.create_time],
// or [Document.update_time][google.firestore.v1beta1.Document.update_time] set.
//
// Requests with `show_missing` may not specify `where` or
// `order_by`.
bool show_missing = 12;
}
// The response for [Firestore.ListDocuments][google.firestore.v1beta1.Firestore.ListDocuments].
message ListDocumentsResponse {
// The Documents found.
repeated Document documents = 1;
// The next page token.
string next_page_token = 2;
}
// The request for [Firestore.CreateDocument][google.firestore.v1beta1.Firestore.CreateDocument].
message CreateDocumentRequest {
// 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 [(google.api.field_behavior) = REQUIRED];
// 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;
// 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.
//
// If the document has a field that is not present in this mask, that field
// will not be returned in the response.
DocumentMask mask = 5;
}
// The request for [Firestore.UpdateDocument][google.firestore.v1beta1.Firestore.UpdateDocument].
message UpdateDocumentRequest {
// Required. The updated document.
// Creates the document if it does not already exist.
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.
//
// If the document exists on the server and has fields not referenced in the
// mask, they are left unchanged.
// Fields referenced in the mask, but not present in the input document, are
// deleted from the document on the server.
DocumentMask update_mask = 2;
// The fields to return. If not set, returns all fields.
//
// If the document has a field that is not present in this mask, that field
// will not be returned in the response.
DocumentMask mask = 3;
// An optional precondition on the document.
// The request will fail if this is set and not met by the target document.
Precondition current_document = 4;
}
// The request for [Firestore.DeleteDocument][google.firestore.v1beta1.Firestore.DeleteDocument].
message DeleteDocumentRequest {
// Required. The resource name of the Document to delete. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
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.
Precondition current_document = 2;
}
// The request for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments].
message BatchGetDocumentsRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
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}`.
// The request will fail if any of the document is not a child resource of the
// given `database`. Duplicate names will be elided.
repeated string documents = 2;
// The fields to return. If not set, returns all fields.
//
// If a document has a field that is not present in this mask, that field will
// not be returned in the response.
DocumentMask mask = 3;
// The consistency mode for this transaction.
// If not set, defaults to strong consistency.
oneof consistency_selector {
// Reads documents in a transaction.
bytes transaction = 4;
// Starts a new transaction and reads the documents.
// Defaults to a read-only transaction.
// The new transaction ID will be returned as the first response in the
// stream.
TransactionOptions new_transaction = 5;
// Reads documents as they were at the given time.
// This may not be older than 270 seconds.
google.protobuf.Timestamp read_time = 7;
}
}
// The streamed response for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments].
message BatchGetDocumentsResponse {
// A single result.
// This can be empty if the server is just returning a transaction.
oneof result {
// A document that was requested.
Document found = 1;
// A document name that was requested but does not exist. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string missing = 2;
}
// The transaction that was started as part of this request.
// Will only be set in the first response, and only if
// [BatchGetDocumentsRequest.new_transaction][google.firestore.v1beta1.BatchGetDocumentsRequest.new_transaction] was set in the request.
bytes transaction = 3;
// The time at which the document was read.
// This may be monotically increasing, in this case the previous documents in
// the result stream are guaranteed not to have changed between their
// read_time and this one.
google.protobuf.Timestamp read_time = 4;
}
// The request for [Firestore.BeginTransaction][google.firestore.v1beta1.Firestore.BeginTransaction].
message BeginTransactionRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The options for the transaction.
// Defaults to a read-write transaction.
TransactionOptions options = 2;
}
// The response for [Firestore.BeginTransaction][google.firestore.v1beta1.Firestore.BeginTransaction].
message BeginTransactionResponse {
// The transaction that was started.
bytes transaction = 1;
}
// The request for [Firestore.Commit][google.firestore.v1beta1.Firestore.Commit].
message CommitRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The writes to apply.
//
// Always executed atomically and in order.
repeated Write writes = 2;
// If set, applies all writes in this transaction, and commits it.
bytes transaction = 3;
}
// The response for [Firestore.Commit][google.firestore.v1beta1.Firestore.Commit].
message CommitResponse {
// The result of applying the writes.
//
// This i-th write result corresponds to the i-th write in the
// request.
repeated WriteResult write_results = 1;
// The time at which the commit occurred. Any read with an equal or greater
// `read_time` is guaranteed to see the effects of the commit.
google.protobuf.Timestamp commit_time = 2;
}
// The request for [Firestore.Rollback][google.firestore.v1beta1.Firestore.Rollback].
message RollbackRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The transaction to roll back.
bytes transaction = 2 [(google.api.field_behavior) = REQUIRED];
}
// The request for [Firestore.RunQuery][google.firestore.v1beta1.Firestore.RunQuery].
message RunQueryRequest {
// 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 [(google.api.field_behavior) = REQUIRED];
// The query to run.
oneof query_type {
// A structured query.
StructuredQuery structured_query = 2;
}
// The consistency mode for this transaction.
// If not set, defaults to strong consistency.
oneof consistency_selector {
// Reads documents in a transaction.
bytes transaction = 5;
// Starts a new transaction and reads the documents.
// Defaults to a read-only transaction.
// The new transaction ID will be returned as the first response in the
// stream.
TransactionOptions new_transaction = 6;
// Reads documents as they were at the given time.
// This may not be older than 270 seconds.
google.protobuf.Timestamp read_time = 7;
}
}
// The response for [Firestore.RunQuery][google.firestore.v1beta1.Firestore.RunQuery].
message RunQueryResponse {
// The transaction that was started as part of this request.
// Can only be set in the first response, and only if
// [RunQueryRequest.new_transaction][google.firestore.v1beta1.RunQueryRequest.new_transaction] was set in the request.
// If set, no other fields will be set in this response.
bytes transaction = 2;
// A query result.
// Not set when reporting partial progress.
Document document = 1;
// The time at which the document was read. This may be monotonically
// increasing; in this case, the previous documents in the result stream are
// guaranteed not to have changed between their `read_time` and this one.
//
// If the query returns no results, a response with `read_time` and no
// `document` will be sent, and this represents the time at which the query
// was run.
google.protobuf.Timestamp read_time = 3;
// The number of results that have been skipped due to an offset between
// the last response and the current response.
int32 skipped_results = 4;
}
// The request for [Firestore.PartitionQuery][google.firestore.v1beta1.Firestore.PartitionQuery].
message PartitionQueryRequest {
// Required. The parent resource name. In the format:
// `projects/{project_id}/databases/{database_id}/documents`.
// Document resource names are not supported; only database resource names
// can be specified.
string parent = 1 [(google.api.field_behavior) = REQUIRED];
// The query to partition.
oneof query_type {
// A structured query.
// Query must specify collection with all descendants and be ordered by name
// ascending. Other filters, order bys, limits, offsets, and start/end
// cursors are not supported.
StructuredQuery structured_query = 2;
}
// The desired maximum number of partition points.
// The partitions may be returned across multiple pages of results.
// The number must be positive. The actual number of partitions
// returned may be fewer.
//
// For example, this may be set to one fewer than the number of parallel
// queries to be run, or in running a data pipeline job, one fewer than the
// number of workers or compute instances available.
int64 partition_count = 3;
// The `next_page_token` value returned from a previous call to
// PartitionQuery that may be used to get an additional set of results.
// There are no ordering guarantees between sets of results. Thus, using
// multiple sets of results will require merging the different result sets.
//
// For example, two subsequent calls using a page_token may return:
//
// * cursor B, cursor M, cursor Q
// * cursor A, cursor U, cursor W
//
// To obtain a complete result set ordered with respect to the results of the
// query supplied to PartitionQuery, the results sets should be merged:
// cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W
string page_token = 4;
// The maximum number of partitions to return in this call, subject to
// `partition_count`.
//
// For example, if `partition_count` = 10 and `page_size` = 8, the first call
// to PartitionQuery will return up to 8 partitions and a `next_page_token`
// if more results exist. A second call to PartitionQuery will return up to
// 2 partitions, to complete the total of 10 specified in `partition_count`.
int32 page_size = 5;
}
// The response for [Firestore.PartitionQuery][google.firestore.v1beta1.Firestore.PartitionQuery].
message PartitionQueryResponse {
// Partition results.
// Each partition is a split point that can be used by RunQuery as a starting
// or end point for the query results. The RunQuery requests must be made with
// the same query supplied to this PartitionQuery request. The partition
// cursors will be ordered according to same ordering as the results of the
// query supplied to PartitionQuery.
//
// For example, if a PartitionQuery request returns partition cursors A and B,
// running the following three queries will return the entire result set of
// the original query:
//
// * query, end_at A
// * query, start_at A, end_at B
// * query, start_at B
//
// An empty result may indicate that the query has too few results to be
// partitioned.
repeated Cursor partitions = 1;
// A page token that may be used to request an additional set of results, up
// to the number specified by `partition_count` in the PartitionQuery request.
// If blank, there are no more results.
string next_page_token = 2;
}
// The request for [Firestore.Write][google.firestore.v1beta1.Firestore.Write].
//
// The first request creates a stream, or resumes an existing one from a token.
//
// When creating a new stream, the server replies with a response containing
// only an ID and a token, to use in the next request.
//
// When resuming a stream, the server first streams any responses later than the
// given token, then a response containing only an up-to-date token, to use in
// the next request.
message WriteRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
// This is only required in the first message.
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
// stream will be created.
string stream_id = 2;
// The writes to apply.
//
// Always executed atomically and in order.
// This must be empty on the first request.
// This may be empty on the last request.
// This must not be empty on all other requests.
repeated Write writes = 3;
// A stream token that was previously sent by the server.
//
// The client should set this field to the token from the most recent
// [WriteResponse][google.firestore.v1beta1.WriteResponse] it has received. This acknowledges that the client has
// received responses up to this token. After sending this token, earlier
// tokens may not be used anymore.
//
// The server may close the stream if there are too many unacknowledged
// responses.
//
// Leave this field unset when creating a new stream. To resume a stream at
// a specific point, set this field and the `stream_id` field.
//
// Leave this field unset when creating a new stream.
bytes stream_token = 4;
// Labels associated with this write request.
map<string, string> labels = 5;
}
// The response for [Firestore.Write][google.firestore.v1beta1.Firestore.Write].
message WriteResponse {
// The ID of the stream.
// Only set on the first message, when a new stream was created.
string stream_id = 1;
// A token that represents the position of this response in the stream.
// This can be used by a client to resume the stream at this point.
//
// This field is always set.
bytes stream_token = 2;
// The result of applying the writes.
//
// This i-th write result corresponds to the i-th write in the
// request.
repeated WriteResult write_results = 3;
// The time at which the commit occurred. Any read with an equal or greater
// `read_time` is guaranteed to see the effects of the write.
google.protobuf.Timestamp commit_time = 4;
}
// A request for [Firestore.Listen][google.firestore.v1beta1.Firestore.Listen]
message ListenRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The supported target changes.
oneof target_change {
// A target to add to this stream.
Target add_target = 2;
// The ID of a target to remove from this stream.
int32 remove_target = 3;
}
// Labels associated with this target change.
map<string, string> labels = 4;
}
// The response for [Firestore.Listen][google.firestore.v1beta1.Firestore.Listen].
message ListenResponse {
// The supported responses.
oneof response_type {
// Targets have changed.
TargetChange target_change = 2;
// A [Document][google.firestore.v1beta1.Document] has changed.
DocumentChange document_change = 3;
// A [Document][google.firestore.v1beta1.Document] has been deleted.
DocumentDelete document_delete = 4;
// A [Document][google.firestore.v1beta1.Document] has been removed from a target (because it is no longer
// relevant to that target).
DocumentRemove document_remove = 6;
// A filter to apply to the set of documents previously returned for the
// given target.
//
// Returned when documents may have been removed from the given target, but
// the exact documents are unknown.
ExistenceFilter filter = 5;
}
}
// A specification of a set of documents to listen to.
message Target {
// A target specified by a set of documents names.
message DocumentsTarget {
// The names of the documents to retrieve. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
// The request will fail if any of the document is not a child resource of
// the given `database`. Duplicate names will be elided.
repeated string documents = 2;
}
// A target specified by a query.
message QueryTarget {
// 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;
// The query to run.
oneof query_type {
// A structured query.
StructuredQuery structured_query = 2;
}
}
// The type of target to listen to.
oneof target_type {
// A target specified by a query.
QueryTarget query = 2;
// A target specified by a set of document names.
DocumentsTarget documents = 3;
}
// When to start listening.
//
// If not specified, all matching Documents are returned before any
// subsequent changes.
oneof resume_type {
// A resume token from a prior [TargetChange][google.firestore.v1beta1.TargetChange] for an identical target.
//
// Using a resume token with a different target is unsupported and may fail.
bytes resume_token = 4;
// Start listening after a specific `read_time`.
//
// The client must know the state of matching documents at this time.
google.protobuf.Timestamp read_time = 11;
}
// The target ID that identifies the target on the stream. Must be a positive
// number and non-zero.
int32 target_id = 5;
// If the target should be removed once it is current and consistent.
bool once = 6;
}
// Targets being watched have changed.
message TargetChange {
// The type of change.
enum TargetChangeType {
// No change has occurred. Used only to send an updated `resume_token`.
NO_CHANGE = 0;
// The targets have been added.
ADD = 1;
// The targets have been removed.
REMOVE = 2;
// The targets reflect all changes committed before the targets were added
// to the stream.
//
// This will be sent after or with a `read_time` that is greater than or
// equal to the time at which the targets were added.
//
// Listeners can wait for this change if read-after-write semantics
// are desired.
CURRENT = 3;
// The targets have been reset, and a new initial state for the targets
// will be returned in subsequent changes.
//
// After the initial state is complete, `CURRENT` will be returned even
// if the target was previously indicated to be `CURRENT`.
RESET = 4;
}
// The type of change that occurred.
TargetChangeType target_change_type = 1;
// The target IDs of targets that have changed.
//
// If empty, the change applies to all targets.
//
// The order of the target IDs is not defined.
repeated int32 target_ids = 2;
// The error that resulted in this change, if applicable.
google.rpc.Status cause = 3;
// A token that can be used to resume the stream for the given `target_ids`,
// or all targets if `target_ids` is empty.
//
// Not set on every target change.
bytes resume_token = 4;
// The consistent `read_time` for the given `target_ids` (omitted when the
// target_ids are not at a consistent snapshot).
//
// The stream is guaranteed to send a `read_time` with `target_ids` empty
// whenever the entire stream reaches a new consistent snapshot. ADD,
// CURRENT, and RESET messages are guaranteed to (eventually) result in a
// new consistent snapshot (while NO_CHANGE and REMOVE messages are not).
//
// For a given stream, `read_time` is guaranteed to be monotonically
// increasing.
google.protobuf.Timestamp read_time = 6;
}
// The request for [Firestore.ListCollectionIds][google.firestore.v1beta1.Firestore.ListCollectionIds].
message ListCollectionIdsRequest {
// 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 [(google.api.field_behavior) = REQUIRED];
// The maximum number of results to return.
int32 page_size = 2;
// A page token. Must be a value from
// [ListCollectionIdsResponse][google.firestore.v1beta1.ListCollectionIdsResponse].
string page_token = 3;
}
// The response from [Firestore.ListCollectionIds][google.firestore.v1beta1.Firestore.ListCollectionIds].
message ListCollectionIdsResponse {
// The collection ids.
repeated string collection_ids = 1;
// A page token that may be used to continue the list.
string next_page_token = 2;
}
// The request for [Firestore.BatchWrite][google.firestore.v1beta1.Firestore.BatchWrite].
message BatchWriteRequest {
// Required. The database name. In the format:
// `projects/{project_id}/databases/{database_id}`.
string database = 1 [(google.api.field_behavior) = REQUIRED];
// The writes to apply.
//
// Method does not apply writes atomically and does not guarantee ordering.
// Each write succeeds or fails independently. You cannot write to the same
// document more than once per request.
repeated Write writes = 2;
// Labels associated with this batch write.
map<string, string> labels = 3;
}
// The response from [Firestore.BatchWrite][google.firestore.v1beta1.Firestore.BatchWrite].
message BatchWriteResponse {
// The result of applying the writes.
//
// This i-th write result corresponds to the i-th write in the
// request.
repeated WriteResult write_results = 1;
// The status of applying the writes.
//
// This i-th write status corresponds to the i-th write in the
// request.
repeated google.rpc.Status status = 2;
}

View File

@@ -0,0 +1,300 @@
// Copyright 2024 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.firestore.v1beta1;
import "google/firestore/v1beta1/document.proto";
import "google/protobuf/wrappers.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "QueryProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// A Firestore query.
message StructuredQuery {
// A selection of a collection, such as `messages as m1`.
message CollectionSelector {
// The collection ID.
// When set, selects only collections with this ID.
string collection_id = 2;
// When false, selects only collections that are immediate children of
// the `parent` specified in the containing `RunQueryRequest`.
// When true, selects all descendant collections.
bool all_descendants = 3;
}
// A filter.
message Filter {
// The type of filter.
oneof filter_type {
// A composite filter.
CompositeFilter composite_filter = 1;
// A filter on a document field.
FieldFilter field_filter = 2;
// A filter that takes exactly one argument.
UnaryFilter unary_filter = 3;
}
}
// A filter that merges multiple other filters using the given operator.
message CompositeFilter {
// A composite filter operator.
enum Operator {
// Unspecified. This value must not be used.
OPERATOR_UNSPECIFIED = 0;
// The results are required to satisfy each of the combined filters.
AND = 1;
}
// The operator for combining multiple filters.
Operator op = 1;
// The list of filters to combine.
// Must contain at least one filter.
repeated Filter filters = 2;
}
// A filter on a specific field.
message FieldFilter {
// A field filter operator.
enum Operator {
// Unspecified. This value must not be used.
OPERATOR_UNSPECIFIED = 0;
// The given `field` is less than the given `value`.
//
// Requires:
//
// * That `field` come first in `order_by`.
LESS_THAN = 1;
// The given `field` is less than or equal to the given `value`.
//
// Requires:
//
// * That `field` come first in `order_by`.
LESS_THAN_OR_EQUAL = 2;
// The given `field` is greater than the given `value`.
//
// Requires:
//
// * That `field` come first in `order_by`.
GREATER_THAN = 3;
// The given `field` is greater than or equal to the given `value`.
//
// Requires:
//
// * That `field` come first in `order_by`.
GREATER_THAN_OR_EQUAL = 4;
// The given `field` is equal to the given `value`.
EQUAL = 5;
// The given `field` is not equal to the given `value`.
//
// Requires:
//
// * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
// * That `field` comes first in the `order_by`.
NOT_EQUAL = 6;
// The given `field` is an array that contains the given `value`.
ARRAY_CONTAINS = 7;
// The given `field` is equal to at least one value in the given array.
//
// Requires:
//
// * That `value` is a non-empty `ArrayValue` with at most 10 values.
// * No other `IN` or `ARRAY_CONTAINS_ANY` or `NOT_IN`.
IN = 8;
// The given `field` is an array that contains any of the values in the
// given array.
//
// Requires:
//
// * That `value` is a non-empty `ArrayValue` with at most 10 values.
// * No other `IN` or `ARRAY_CONTAINS_ANY` or `NOT_IN`.
ARRAY_CONTAINS_ANY = 9;
// The value of the `field` is not in the given array.
//
// Requires:
//
// * That `value` is a non-empty `ArrayValue` with at most 10 values.
// * No other `IN`, `ARRAY_CONTAINS_ANY`, `NOT_IN`, `NOT_EQUAL`,
// `IS_NOT_NULL`, or `IS_NOT_NAN`.
// * That `field` comes first in the `order_by`.
NOT_IN = 10;
}
// The field to filter by.
FieldReference field = 1;
// The operator to filter by.
Operator op = 2;
// The value to compare to.
Value value = 3;
}
// A filter with a single operand.
message UnaryFilter {
// A unary operator.
enum Operator {
// Unspecified. This value must not be used.
OPERATOR_UNSPECIFIED = 0;
// The given `field` is equal to `NaN`.
IS_NAN = 2;
// The given `field` is equal to `NULL`.
IS_NULL = 3;
// The given `field` is not equal to `NaN`.
//
// Requires:
//
// * No other `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
// * That `field` comes first in the `order_by`.
IS_NOT_NAN = 4;
// The given `field` is not equal to `NULL`.
//
// Requires:
//
// * A single `NOT_EQUAL`, `NOT_IN`, `IS_NOT_NULL`, or `IS_NOT_NAN`.
// * That `field` comes first in the `order_by`.
IS_NOT_NULL = 5;
}
// The unary operator to apply.
Operator op = 1;
// The argument to the filter.
oneof operand_type {
// The field to which to apply the operator.
FieldReference field = 2;
}
}
// A reference to a field, such as `max(messages.time) as max_time`.
message FieldReference {
string field_path = 2;
}
// An order on a field.
message Order {
// The field to order by.
FieldReference field = 1;
// The direction to order by. Defaults to `ASCENDING`.
Direction direction = 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;
}
// A sort direction.
enum Direction {
// Unspecified.
DIRECTION_UNSPECIFIED = 0;
// Ascending.
ASCENDING = 1;
// Descending.
DESCENDING = 2;
}
// The projection to return.
Projection select = 1;
// The collections to query.
repeated CollectionSelector from = 2;
// The filter to apply.
Filter where = 3;
// The order to apply to the query results.
//
// Firestore guarantees a stable ordering through the following rules:
//
// * Any field required to appear in `order_by`, that is not already
// specified in `order_by`, is appended to the order in field name order
// by default.
// * If an order on `__name__` is not specified, it is appended by default.
//
// Fields are appended with the same sort direction as the last order
// specified, or 'ASCENDING' if no order was specified. For example:
//
// * `SELECT * FROM Foo ORDER BY A` becomes
// `SELECT * FROM Foo ORDER BY A, __name__`
// * `SELECT * FROM Foo ORDER BY A DESC` becomes
// `SELECT * FROM Foo ORDER BY A DESC, __name__ DESC`
// * `SELECT * FROM Foo WHERE A > 1` becomes
// `SELECT * FROM Foo WHERE A > 1 ORDER BY A, __name__`
repeated Order order_by = 4;
// A starting point for the query results.
Cursor start_at = 7;
// A end point for the query results.
Cursor end_at = 8;
// The number of results to skip.
//
// Applies before limit, but after all other constraints. Must be >= 0 if
// specified.
int32 offset = 6;
// The maximum number of results to return.
//
// Applies after all other constraints.
// Must be >= 0 if specified.
google.protobuf.Int32Value limit = 5;
}
// A position in a query result set.
message Cursor {
// The values that represent a position, in the order they appear in
// the order by clause of a query.
//
// Can contain fewer values than specified in the order by clause.
repeated Value values = 1;
// If the position is just before or just after the given values, relative
// to the sort order defined by the query.
bool before = 2;
}

View File

@@ -0,0 +1,75 @@
// Copyright 2024 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.firestore.v1beta1;
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "UndeliverableFirstGenEventProto";
option java_package = "com.google.firestore.v1beta1";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// A message signifying an event that cannot be delivered to Cloud Functions
// from Firestore using [Cloud Firestore triggers 1st
// gen](https://cloud.google.com/functions/docs/calling/cloud-firestore)
message UndeliverableFirstGenEvent {
// Reason for events being undeliverable.
enum Reason {
// Unspecified.
REASON_UNSPECIFIED = 0;
// Exceeding maximum event size limit
EXCEEDING_SIZE_LIMIT = 1;
}
// Document change type.
enum DocumentChangeType {
// Unspecified.
DOCUMENT_CHANGE_TYPE_UNSPECIFIED = 0;
// Represent creation operation.
CREATE = 1;
// Represent delete operation.
DELETE = 2;
// Represent update operation.
UPDATE = 3;
}
// Error message for events being undeliverable.
string message = 1;
// Reason for events being undeliverable.
Reason reason = 2;
// The resource name of the changed document, in the format of
// `projects/{projectId}/databases/{databaseId}/documents/{document_path}`.
string document_name = 3;
// The type of the document change.
DocumentChangeType document_change_type = 4;
// The names of the functions that were supposed to be triggered.
repeated string function_name = 5;
// The commit time of triggered write operation.
google.protobuf.Timestamp triggered_time = 6;
}

View File

@@ -0,0 +1,258 @@
// Copyright 2024 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.firestore.v1beta1;
import "google/firestore/v1beta1/common.proto";
import "google/firestore/v1beta1/document.proto";
import "google/protobuf/timestamp.proto";
option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
option go_package = "cloud.google.com/go/firestore/apiv1beta1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "WriteProto";
option java_package = "com.google.firestore.v1beta1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
option ruby_package = "Google::Cloud::Firestore::V1beta1";
// A write on a document.
message Write {
// The operation to execute.
oneof operation {
// A document to write.
Document update = 1;
// A document name to delete. In the format:
// `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
string delete = 2;
// Applies a transformation to a document.
DocumentTransform transform = 6;
}
// The fields to update in this write.
//
// This field can be set only when the operation is `update`.
// If the mask is not set for an `update` and the document exists, any
// existing data will be overwritten.
// If the mask is set and the document on the server has fields not covered by
// the mask, they are left unchanged.
// Fields referenced in the mask, but not present in the input document, are
// deleted from the document on the server.
// The field paths in this mask must not contain a reserved field name.
DocumentMask update_mask = 3;
// The transforms to perform after update.
//
// This field can be set only when the operation is `update`. If present, this
// write is equivalent to performing `update` and `transform` to the same
// document atomically and in order.
repeated DocumentTransform.FieldTransform update_transforms = 7;
// An optional precondition on the document.
//
// The write will fail if this is set and not met by the target document.
Precondition current_document = 4;
}
// A transformation of a document.
message DocumentTransform {
// A transformation of a field of the document.
message FieldTransform {
// A value that is calculated by the server.
enum ServerValue {
// Unspecified. This value must not be used.
SERVER_VALUE_UNSPECIFIED = 0;
// The time at which the server processed the request, with millisecond
// precision. If used on multiple fields (same or different documents) in
// a transaction, all the fields will get the same server timestamp.
REQUEST_TIME = 1;
}
// The path of the field. See [Document.fields][google.firestore.v1beta1.Document.fields] for the field path syntax
// reference.
string field_path = 1;
// The transformation to apply on the field.
oneof transform_type {
// Sets the field to the given server value.
ServerValue set_to_server_value = 2;
// Adds the given value to the field's current value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the given value.
// If either of the given value or the current field value are doubles,
// both values will be interpreted as doubles. Double arithmetic and
// representation of double values follow IEEE 754 semantics.
// If there is positive/negative integer overflow, the field is resolved
// to the largest magnitude positive/negative integer.
Value increment = 3;
// Sets the field to the maximum of its current value and the given value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the given value.
// If a maximum operation is applied where the field and the input value
// are of mixed types (that is - one is an integer and one is a double)
// the field takes on the type of the larger operand. If the operands are
// equivalent (e.g. 3 and 3.0), the field does not change.
// 0, 0.0, and -0.0 are all zero. The maximum of a zero stored value and
// zero input value is always the stored value.
// The maximum of any numeric value x and NaN is NaN.
Value maximum = 4;
// Sets the field to the minimum of its current value and the given value.
//
// This must be an integer or a double value.
// If the field is not an integer or double, or if the field does not yet
// exist, the transformation will set the field to the input value.
// If a minimum operation is applied where the field and the input value
// are of mixed types (that is - one is an integer and one is a double)
// the field takes on the type of the smaller operand. If the operands are
// equivalent (e.g. 3 and 3.0), the field does not change.
// 0, 0.0, and -0.0 are all zero. The minimum of a zero stored value and
// zero input value is always the stored value.
// The minimum of any numeric value x and NaN is NaN.
Value minimum = 5;
// Append the given elements in order if they are not already present in
// the current field value.
// If the field is not an array, or if the field does not yet exist, it is
// first set to the empty array.
//
// Equivalent numbers of different types (e.g. 3L and 3.0) are
// considered equal when checking if a value is missing.
// NaN is equal to NaN, and Null is equal to Null.
// If the input contains multiple equivalent values, only the first will
// be considered.
//
// The corresponding transform_result will be the null value.
ArrayValue append_missing_elements = 6;
// Remove all of the given elements from the array in the field.
// If the field is not an array, or if the field does not yet exist, it is
// set to the empty array.
//
// Equivalent numbers of the different types (e.g. 3L and 3.0) are
// considered equal when deciding whether an element should be removed.
// NaN is equal to NaN, and Null is equal to Null.
// This will remove all equivalent values if there are duplicates.
//
// The corresponding transform_result will be the null value.
ArrayValue remove_all_from_array = 7;
}
}
// The name of the document to transform.
string document = 1;
// The list of transformations to apply to the fields of the document, in
// order.
// This must not be empty.
repeated FieldTransform field_transforms = 2;
}
// The result of applying a write.
message WriteResult {
// The last update time of the document after applying the write. Not set
// after a `delete`.
//
// If the write did not actually change the document, this will be the
// previous update_time.
google.protobuf.Timestamp update_time = 1;
// The results of applying each [DocumentTransform.FieldTransform][google.firestore.v1beta1.DocumentTransform.FieldTransform], in the
// same order.
repeated Value transform_results = 2;
}
// A [Document][google.firestore.v1beta1.Document] has changed.
//
// May be the result of multiple [writes][google.firestore.v1beta1.Write], including deletes, that
// ultimately resulted in a new value for the [Document][google.firestore.v1beta1.Document].
//
// Multiple [DocumentChange][google.firestore.v1beta1.DocumentChange] messages may be returned for the same logical
// change, if multiple targets are affected.
message DocumentChange {
// The new state of the [Document][google.firestore.v1beta1.Document].
//
// If `mask` is set, contains only fields that were updated or added.
Document document = 1;
// A set of target IDs of targets that match this document.
repeated int32 target_ids = 5;
// A set of target IDs for targets that no longer match this document.
repeated int32 removed_target_ids = 6;
}
// A [Document][google.firestore.v1beta1.Document] has been deleted.
//
// May be the result of multiple [writes][google.firestore.v1beta1.Write], including updates, the
// last of which deleted the [Document][google.firestore.v1beta1.Document].
//
// Multiple [DocumentDelete][google.firestore.v1beta1.DocumentDelete] messages may be returned for the same logical
// delete, if multiple targets are affected.
message DocumentDelete {
// The resource name of the [Document][google.firestore.v1beta1.Document] that was deleted.
string document = 1;
// A set of target IDs for targets that previously matched this entity.
repeated int32 removed_target_ids = 6;
// The read timestamp at which the delete was observed.
//
// Greater or equal to the `commit_time` of the delete.
google.protobuf.Timestamp read_time = 4;
}
// A [Document][google.firestore.v1beta1.Document] has been removed from the view of the targets.
//
// Sent if the document is no longer relevant to a target and is out of view.
// Can be sent instead of a DocumentDelete or a DocumentChange if the server
// can not send the new value of the document.
//
// Multiple [DocumentRemove][google.firestore.v1beta1.DocumentRemove] messages may be returned for the same logical
// write or delete, if multiple targets are affected.
message DocumentRemove {
// The resource name of the [Document][google.firestore.v1beta1.Document] that has gone out of view.
string document = 1;
// A set of target IDs for targets that previously matched this document.
repeated int32 removed_target_ids = 2;
// The read timestamp at which the remove was observed.
//
// Greater or equal to the `commit_time` of the change/delete/remove.
google.protobuf.Timestamp read_time = 4;
}
// A digest of all the documents that match a given target.
message ExistenceFilter {
// The target ID to which this filter applies.
int32 target_id = 1;
// The total count of documents that match [target_id][google.firestore.v1beta1.ExistenceFilter.target_id].
//
// If different from the count of documents in the client that match, the
// client must manually determine which documents no longer match the target.
int32 count = 2;
}

View File

@@ -0,0 +1,246 @@
// Copyright 2024 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.longrunning;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/protobuf/any.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/rpc/status.proto";
option cc_enable_arenas = true;
option csharp_namespace = "Google.LongRunning";
option go_package = "cloud.google.com/go/longrunning/autogen/longrunningpb;longrunningpb";
option java_multiple_files = true;
option java_outer_classname = "OperationsProto";
option java_package = "com.google.longrunning";
option objc_class_prefix = "GLRUN";
option php_namespace = "Google\\LongRunning";
extend google.protobuf.MethodOptions {
// Additional information regarding long-running operations.
// In particular, this specifies the types that are returned from
// long-running operations.
//
// Required for methods that return `google.longrunning.Operation`; invalid
// otherwise.
google.longrunning.OperationInfo operation_info = 1049;
}
// Manages long-running operations with an API service.
//
// When an API method normally takes long time to complete, it can be designed
// to return [Operation][google.longrunning.Operation] to the client, and the
// client can use this interface to receive the real response asynchronously by
// polling the operation resource, or pass the operation resource to another API
// (such as Pub/Sub API) to receive the response. Any API service that returns
// long-running operations should implement the `Operations` interface so
// developers can have a consistent client experience.
service Operations {
option (google.api.default_host) = "longrunning.googleapis.com";
// Lists operations that match the specified filter in the request. If the
// server doesn't support this method, it returns `UNIMPLEMENTED`.
rpc ListOperations(ListOperationsRequest) returns (ListOperationsResponse) {
option (google.api.http) = {
get: "/v1/{name=operations}"
};
option (google.api.method_signature) = "name,filter";
}
// Gets the latest state of a long-running operation. Clients can use this
// method to poll the operation result at intervals as recommended by the API
// service.
rpc GetOperation(GetOperationRequest) returns (Operation) {
option (google.api.http) = {
get: "/v1/{name=operations/**}"
};
option (google.api.method_signature) = "name";
}
// Deletes a long-running operation. This method indicates that the client is
// no longer interested in the operation result. It does not cancel the
// operation. If the server doesn't support this method, it returns
// `google.rpc.Code.UNIMPLEMENTED`.
rpc DeleteOperation(DeleteOperationRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=operations/**}"
};
option (google.api.method_signature) = "name";
}
// Starts asynchronous cancellation on a long-running operation. The server
// makes a best effort to cancel the operation, but success is not
// guaranteed. If the server doesn't support this method, it returns
// `google.rpc.Code.UNIMPLEMENTED`. Clients can use
// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
// other methods to check whether the cancellation succeeded or whether the
// operation completed despite cancellation. On successful cancellation,
// the operation is not deleted; instead, it becomes an operation with
// an [Operation.error][google.longrunning.Operation.error] value with a
// [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to
// `Code.CANCELLED`.
rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/v1/{name=operations/**}:cancel"
body: "*"
};
option (google.api.method_signature) = "name";
}
// Waits until the specified long-running operation is done or reaches at most
// a specified timeout, returning the latest state. If the operation is
// already done, the latest state is immediately returned. If the timeout
// specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
// timeout is used. If the server does not support this method, it returns
// `google.rpc.Code.UNIMPLEMENTED`.
// Note that this method is on a best-effort basis. It may return the latest
// state before the specified timeout (including immediately), meaning even an
// immediate response is no guarantee that the operation is done.
rpc WaitOperation(WaitOperationRequest) returns (Operation) {}
}
// This resource represents a long-running operation that is the result of a
// network API call.
message Operation {
// The server-assigned name, which is only unique within the same service that
// originally returns it. If you use the default HTTP mapping, the
// `name` should be a resource name ending with `operations/{unique_id}`.
string name = 1;
// Service-specific metadata associated with the operation. It typically
// contains progress information and common metadata such as create time.
// Some services might not provide such metadata. Any method that returns a
// long-running operation should document the metadata type, if any.
google.protobuf.Any metadata = 2;
// If the value is `false`, it means the operation is still in progress.
// If `true`, the operation is completed, and either `error` or `response` is
// available.
bool done = 3;
// The operation result, which can be either an `error` or a valid `response`.
// If `done` == `false`, neither `error` nor `response` is set.
// If `done` == `true`, exactly one of `error` or `response` can be set.
// Some services might not provide the result.
oneof result {
// The error result of the operation in case of failure or cancellation.
google.rpc.Status error = 4;
// The normal, successful response of the operation. If the original
// method returns no data on success, such as `Delete`, the response is
// `google.protobuf.Empty`. If the original method is standard
// `Get`/`Create`/`Update`, the response should be the resource. For other
// methods, the response should have the type `XxxResponse`, where `Xxx`
// is the original method name. For example, if the original method name
// is `TakeSnapshot()`, the inferred response type is
// `TakeSnapshotResponse`.
google.protobuf.Any response = 5;
}
}
// The request message for
// [Operations.GetOperation][google.longrunning.Operations.GetOperation].
message GetOperationRequest {
// The name of the operation resource.
string name = 1;
}
// The request message for
// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
message ListOperationsRequest {
// The name of the operation's parent resource.
string name = 4;
// The standard list filter.
string filter = 1;
// The standard list page size.
int32 page_size = 2;
// The standard list page token.
string page_token = 3;
}
// The response message for
// [Operations.ListOperations][google.longrunning.Operations.ListOperations].
message ListOperationsResponse {
// A list of operations that matches the specified filter in the request.
repeated Operation operations = 1;
// The standard List next-page token.
string next_page_token = 2;
}
// The request message for
// [Operations.CancelOperation][google.longrunning.Operations.CancelOperation].
message CancelOperationRequest {
// The name of the operation resource to be cancelled.
string name = 1;
}
// The request message for
// [Operations.DeleteOperation][google.longrunning.Operations.DeleteOperation].
message DeleteOperationRequest {
// The name of the operation resource to be deleted.
string name = 1;
}
// The request message for
// [Operations.WaitOperation][google.longrunning.Operations.WaitOperation].
message WaitOperationRequest {
// The name of the operation resource to wait on.
string name = 1;
// The maximum duration to wait before timing out. If left blank, the wait
// will be at most the time permitted by the underlying HTTP/RPC protocol.
// If RPC context deadline is also specified, the shorter one will be used.
google.protobuf.Duration timeout = 2;
}
// A message representing the message types used by a long-running operation.
//
// Example:
//
// rpc Export(ExportRequest) returns (google.longrunning.Operation) {
// option (google.longrunning.operation_info) = {
// response_type: "ExportResponse"
// metadata_type: "ExportMetadata"
// };
// }
message OperationInfo {
// Required. The message name of the primary return type for this
// long-running operation.
// This type will be used to deserialize the LRO's response.
//
// If the response is in a different package from the rpc, a fully-qualified
// message name must be used (e.g. `google.protobuf.Struct`).
//
// Note: Altering this value constitutes a breaking change.
string response_type = 1;
// Required. The message name of the metadata type for this long-running
// operation.
//
// If the response is in a different package from the rpc, a fully-qualified
// message name must be used (e.g. `google.protobuf.Struct`).
//
// Note: Altering this value constitutes a breaking change.
string metadata_type = 2;
}

View File

@@ -0,0 +1,162 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package google.protobuf;
option go_package = "google.golang.org/protobuf/types/known/anypb";
option java_package = "com.google.protobuf";
option java_outer_classname = "AnyProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
// `Any` contains an arbitrary serialized protocol buffer message along with a
// URL that describes the type of the serialized message.
//
// Protobuf library provides support to pack/unpack Any values in the form
// of utility functions or additional generated methods of the Any type.
//
// Example 1: Pack and unpack a message in C++.
//
// Foo foo = ...;
// Any any;
// any.PackFrom(foo);
// ...
// if (any.UnpackTo(&foo)) {
// ...
// }
//
// Example 2: Pack and unpack a message in Java.
//
// Foo foo = ...;
// Any any = Any.pack(foo);
// ...
// if (any.is(Foo.class)) {
// foo = any.unpack(Foo.class);
// }
// // or ...
// if (any.isSameTypeAs(Foo.getDefaultInstance())) {
// foo = any.unpack(Foo.getDefaultInstance());
// }
//
// Example 3: Pack and unpack a message in Python.
//
// foo = Foo(...)
// any = Any()
// any.Pack(foo)
// ...
// if any.Is(Foo.DESCRIPTOR):
// any.Unpack(foo)
// ...
//
// Example 4: Pack and unpack a message in Go
//
// foo := &pb.Foo{...}
// any, err := anypb.New(foo)
// if err != nil {
// ...
// }
// ...
// foo := &pb.Foo{}
// if err := any.UnmarshalTo(foo); err != nil {
// ...
// }
//
// The pack methods provided by protobuf library will by default use
// 'type.googleapis.com/full.type.name' as the type URL and the unpack
// methods only use the fully qualified type name after the last '/'
// in the type URL, for example "foo.bar.com/x/y.z" will yield type
// name "y.z".
//
// JSON
// ====
// The JSON representation of an `Any` value uses the regular
// representation of the deserialized, embedded message, with an
// additional field `@type` which contains the type URL. Example:
//
// package google.profile;
// message Person {
// string first_name = 1;
// string last_name = 2;
// }
//
// {
// "@type": "type.googleapis.com/google.profile.Person",
// "firstName": <string>,
// "lastName": <string>
// }
//
// If the embedded message type is well-known and has a custom JSON
// representation, that representation will be embedded adding a field
// `value` which holds the custom JSON in addition to the `@type`
// field. Example (for message [google.protobuf.Duration][]):
//
// {
// "@type": "type.googleapis.com/google.protobuf.Duration",
// "value": "1.212s"
// }
//
message Any {
// A URL/resource name that uniquely identifies the type of the serialized
// protocol buffer message. This string must contain at least
// one "/" character. The last segment of the URL's path must represent
// the fully qualified name of the type (as in
// `path/google.protobuf.Duration`). The name should be in a canonical form
// (e.g., leading "." is not accepted).
//
// In practice, teams usually precompile into the binary all types that they
// expect it to use in the context of Any. However, for URLs which use the
// scheme `http`, `https`, or no scheme, one can optionally set up a type
// server that maps type URLs to message definitions as follows:
//
// * If no scheme is provided, `https` is assumed.
// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
// value in binary format, or produce an error.
// * Applications are allowed to cache lookup results based on the
// URL, or have them precompiled into a binary to avoid any
// lookup. Therefore, binary compatibility needs to be preserved
// on changes to types. (Use versioned type names to manage
// breaking changes.)
//
// Note: this functionality is not currently available in the official
// protobuf release, and it is not used for type URLs beginning with
// type.googleapis.com. As of May 2023, there are no widely used type server
// implementations and no plans to implement one.
//
// Schemes other than `http`, `https` (or the empty scheme) might be
// used with implementation specific semantics.
//
string type_url = 1;
// Must be a valid serialized protocol buffer of the above specified type.
bytes value = 2;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,115 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package google.protobuf;
option cc_enable_arenas = true;
option go_package = "google.golang.org/protobuf/types/known/durationpb";
option java_package = "com.google.protobuf";
option java_outer_classname = "DurationProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
// A Duration represents a signed, fixed-length span of time represented
// as a count of seconds and fractions of seconds at nanosecond
// resolution. It is independent of any calendar and concepts like "day"
// or "month". It is related to Timestamp in that the difference between
// two Timestamp values is a Duration and it can be added or subtracted
// from a Timestamp. Range is approximately +-10,000 years.
//
// # Examples
//
// Example 1: Compute Duration from two Timestamps in pseudo code.
//
// Timestamp start = ...;
// Timestamp end = ...;
// Duration duration = ...;
//
// duration.seconds = end.seconds - start.seconds;
// duration.nanos = end.nanos - start.nanos;
//
// if (duration.seconds < 0 && duration.nanos > 0) {
// duration.seconds += 1;
// duration.nanos -= 1000000000;
// } else if (duration.seconds > 0 && duration.nanos < 0) {
// duration.seconds -= 1;
// duration.nanos += 1000000000;
// }
//
// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
//
// Timestamp start = ...;
// Duration duration = ...;
// Timestamp end = ...;
//
// end.seconds = start.seconds + duration.seconds;
// end.nanos = start.nanos + duration.nanos;
//
// if (end.nanos < 0) {
// end.seconds -= 1;
// end.nanos += 1000000000;
// } else if (end.nanos >= 1000000000) {
// end.seconds += 1;
// end.nanos -= 1000000000;
// }
//
// Example 3: Compute Duration from datetime.timedelta in Python.
//
// td = datetime.timedelta(days=3, minutes=10)
// duration = Duration()
// duration.FromTimedelta(td)
//
// # JSON Mapping
//
// In JSON format, the Duration type is encoded as a string rather than an
// object, where the string ends in the suffix "s" (indicating seconds) and
// is preceded by the number of seconds, with nanoseconds expressed as
// fractional seconds. For example, 3 seconds with 0 nanoseconds should be
// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
// be expressed in JSON format as "3.000000001s", and 3 seconds and 1
// microsecond should be expressed in JSON format as "3.000001s".
//
message Duration {
// Signed seconds of the span of time. Must be from -315,576,000,000
// to +315,576,000,000 inclusive. Note: these bounds are computed from:
// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
int64 seconds = 1;
// Signed fractions of a second at nanosecond resolution of the span
// of time. Durations less than one second are represented with a 0
// `seconds` field and a positive or negative `nanos` field. For durations
// of one second or more, a non-zero value for the `nanos` field must be
// of the same sign as the `seconds` field. Must be from -999,999,999
// to +999,999,999 inclusive.
int32 nanos = 2;
}

View File

@@ -0,0 +1,51 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package google.protobuf;
option go_package = "google.golang.org/protobuf/types/known/emptypb";
option java_package = "com.google.protobuf";
option java_outer_classname = "EmptyProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option cc_enable_arenas = true;
// A generic empty message that you can re-use to avoid defining duplicated
// empty messages in your APIs. A typical example is to use it as the request
// or the response type of an API method. For instance:
//
// service Foo {
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
// }
//
message Empty {}

View File

@@ -0,0 +1,245 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package google.protobuf;
option java_package = "com.google.protobuf";
option java_outer_classname = "FieldMaskProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
option go_package = "google.golang.org/protobuf/types/known/fieldmaskpb";
option cc_enable_arenas = true;
// `FieldMask` represents a set of symbolic field paths, for example:
//
// paths: "f.a"
// paths: "f.b.d"
//
// Here `f` represents a field in some root message, `a` and `b`
// fields in the message found in `f`, and `d` a field found in the
// message in `f.b`.
//
// Field masks are used to specify a subset of fields that should be
// returned by a get operation or modified by an update operation.
// Field masks also have a custom JSON encoding (see below).
//
// # Field Masks in Projections
//
// When used in the context of a projection, a response message or
// sub-message is filtered by the API to only contain those fields as
// specified in the mask. For example, if the mask in the previous
// example is applied to a response message as follows:
//
// f {
// a : 22
// b {
// d : 1
// x : 2
// }
// y : 13
// }
// z: 8
//
// The result will not contain specific values for fields x,y and z
// (their value will be set to the default, and omitted in proto text
// output):
//
//
// f {
// a : 22
// b {
// d : 1
// }
// }
//
// A repeated field is not allowed except at the last position of a
// paths string.
//
// If a FieldMask object is not present in a get operation, the
// operation applies to all fields (as if a FieldMask of all fields
// had been specified).
//
// Note that a field mask does not necessarily apply to the
// top-level response message. In case of a REST get operation, the
// field mask applies directly to the response, but in case of a REST
// list operation, the mask instead applies to each individual message
// in the returned resource list. In case of a REST custom method,
// other definitions may be used. Where the mask applies will be
// clearly documented together with its declaration in the API. In
// any case, the effect on the returned resource/resources is required
// behavior for APIs.
//
// # Field Masks in Update Operations
//
// A field mask in update operations specifies which fields of the
// targeted resource are going to be updated. The API is required
// to only change the values of the fields as specified in the mask
// and leave the others untouched. If a resource is passed in to
// describe the updated values, the API ignores the values of all
// fields not covered by the mask.
//
// If a repeated field is specified for an update operation, new values will
// be appended to the existing repeated field in the target resource. Note that
// a repeated field is only allowed in the last position of a `paths` string.
//
// If a sub-message is specified in the last position of the field mask for an
// update operation, then new value will be merged into the existing sub-message
// in the target resource.
//
// For example, given the target message:
//
// f {
// b {
// d: 1
// x: 2
// }
// c: [1]
// }
//
// And an update message:
//
// f {
// b {
// d: 10
// }
// c: [2]
// }
//
// then if the field mask is:
//
// paths: ["f.b", "f.c"]
//
// then the result will be:
//
// f {
// b {
// d: 10
// x: 2
// }
// c: [1, 2]
// }
//
// An implementation may provide options to override this default behavior for
// repeated and message fields.
//
// In order to reset a field's value to the default, the field must
// be in the mask and set to the default value in the provided resource.
// Hence, in order to reset all fields of a resource, provide a default
// instance of the resource and set all fields in the mask, or do
// not provide a mask as described below.
//
// If a field mask is not present on update, the operation applies to
// all fields (as if a field mask of all fields has been specified).
// Note that in the presence of schema evolution, this may mean that
// fields the client does not know and has therefore not filled into
// the request will be reset to their default. If this is unwanted
// behavior, a specific service may require a client to always specify
// a field mask, producing an error if not.
//
// As with get operations, the location of the resource which
// describes the updated values in the request message depends on the
// operation kind. In any case, the effect of the field mask is
// required to be honored by the API.
//
// ## Considerations for HTTP REST
//
// The HTTP kind of an update operation which uses a field mask must
// be set to PATCH instead of PUT in order to satisfy HTTP semantics
// (PUT must only be used for full updates).
//
// # JSON Encoding of Field Masks
//
// In JSON, a field mask is encoded as a single string where paths are
// separated by a comma. Fields name in each path are converted
// to/from lower-camel naming conventions.
//
// As an example, consider the following message declarations:
//
// message Profile {
// User user = 1;
// Photo photo = 2;
// }
// message User {
// string display_name = 1;
// string address = 2;
// }
//
// In proto a field mask for `Profile` may look as such:
//
// mask {
// paths: "user.display_name"
// paths: "photo"
// }
//
// In JSON, the same mask is represented as below:
//
// {
// mask: "user.displayName,photo"
// }
//
// # Field Masks and Oneof Fields
//
// Field masks treat fields in oneofs just as regular fields. Consider the
// following message:
//
// message SampleMessage {
// oneof test_oneof {
// string name = 4;
// SubMessage sub_message = 9;
// }
// }
//
// The field mask can be:
//
// mask {
// paths: "name"
// }
//
// Or:
//
// mask {
// paths: "sub_message"
// }
//
// Note that oneof type names ("test_oneof" in this case) cannot be used in
// paths.
//
// ## Field Mask Verification
//
// The implementation of any API method which has a FieldMask type field in the
// request should verify the included field paths, and return an
// `INVALID_ARGUMENT` error if any path is unmappable.
message FieldMask {
// The set of field mask paths.
repeated string paths = 1;
}

View File

@@ -0,0 +1,95 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package google.protobuf;
option cc_enable_arenas = true;
option go_package = "google.golang.org/protobuf/types/known/structpb";
option java_package = "com.google.protobuf";
option java_outer_classname = "StructProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
// `Struct` represents a structured data value, consisting of fields
// which map to dynamically typed values. In some languages, `Struct`
// might be supported by a native representation. For example, in
// scripting languages like JS a struct is represented as an
// object. The details of that representation are described together
// with the proto support for the language.
//
// The JSON representation for `Struct` is JSON object.
message Struct {
// Unordered map of dynamically typed values.
map<string, Value> fields = 1;
}
// `Value` represents a dynamically typed value which can be either
// null, a number, a string, a boolean, a recursive struct value, or a
// list of values. A producer of value is expected to set one of these
// variants. Absence of any variant indicates an error.
//
// The JSON representation for `Value` is JSON value.
message Value {
// The kind of value.
oneof kind {
// Represents a null value.
NullValue null_value = 1;
// Represents a double value.
double number_value = 2;
// Represents a string value.
string string_value = 3;
// Represents a boolean value.
bool bool_value = 4;
// Represents a structured value.
Struct struct_value = 5;
// Represents a repeated `Value`.
ListValue list_value = 6;
}
}
// `NullValue` is a singleton enumeration to represent the null value for the
// `Value` type union.
//
// The JSON representation for `NullValue` is JSON `null`.
enum NullValue {
// Null value.
NULL_VALUE = 0;
}
// `ListValue` is a wrapper around a repeated field of values.
//
// The JSON representation for `ListValue` is JSON array.
message ListValue {
// Repeated field of dynamically typed values.
repeated Value values = 1;
}

View File

@@ -0,0 +1,144 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package google.protobuf;
option cc_enable_arenas = true;
option go_package = "google.golang.org/protobuf/types/known/timestamppb";
option java_package = "com.google.protobuf";
option java_outer_classname = "TimestampProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
// A Timestamp represents a point in time independent of any time zone or local
// calendar, encoded as a count of seconds and fractions of seconds at
// nanosecond resolution. The count is relative to an epoch at UTC midnight on
// January 1, 1970, in the proleptic Gregorian calendar which extends the
// Gregorian calendar backwards to year one.
//
// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
// second table is needed for interpretation, using a [24-hour linear
// smear](https://developers.google.com/time/smear).
//
// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
// restricting to that range, we ensure that we can convert to and from [RFC
// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
//
// # Examples
//
// Example 1: Compute Timestamp from POSIX `time()`.
//
// Timestamp timestamp;
// timestamp.set_seconds(time(NULL));
// timestamp.set_nanos(0);
//
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
//
// struct timeval tv;
// gettimeofday(&tv, NULL);
//
// Timestamp timestamp;
// timestamp.set_seconds(tv.tv_sec);
// timestamp.set_nanos(tv.tv_usec * 1000);
//
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
//
// FILETIME ft;
// GetSystemTimeAsFileTime(&ft);
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
//
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
// Timestamp timestamp;
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
//
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
//
// long millis = System.currentTimeMillis();
//
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
// .setNanos((int) ((millis % 1000) * 1000000)).build();
//
// Example 5: Compute Timestamp from Java `Instant.now()`.
//
// Instant now = Instant.now();
//
// Timestamp timestamp =
// Timestamp.newBuilder().setSeconds(now.getEpochSecond())
// .setNanos(now.getNano()).build();
//
// Example 6: Compute Timestamp from current time in Python.
//
// timestamp = Timestamp()
// timestamp.GetCurrentTime()
//
// # JSON Mapping
//
// In JSON format, the Timestamp type is encoded as a string in the
// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
// where {year} is always expressed using four digits while {month}, {day},
// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
// is required. A proto3 JSON serializer should always use UTC (as indicated by
// "Z") when printing the Timestamp type and a proto3 JSON parser should be
// able to accept both UTC and other timezones (as indicated by an offset).
//
// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
// 01:30 UTC on January 15, 2017.
//
// In JavaScript, one can convert a Date object to this format using the
// standard
// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
// method. In Python, a standard `datetime.datetime` object can be converted
// to this format using
// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
// the Joda Time's [`ISODateTimeFormat.dateTime()`](
// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
// ) to obtain a formatter capable of generating timestamps in this format.
//
message Timestamp {
// Represents seconds of UTC time since Unix epoch
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
// 9999-12-31T23:59:59Z inclusive.
int64 seconds = 1;
// Non-negative fractions of a second at nanosecond resolution. Negative
// second values with fractions must still have non-negative nanos values
// that count forward in time. Must be from 0 to 999,999,999
// inclusive.
int32 nanos = 2;
}

View File

@@ -0,0 +1,123 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Wrappers for primitive (non-message) types. These types are useful
// for embedding primitives in the `google.protobuf.Any` type and for places
// where we need to distinguish between the absence of a primitive
// typed field and its default value.
//
// These wrappers have no meaningful use within repeated fields as they lack
// the ability to detect presence on individual elements.
// These wrappers have no meaningful use within a map or a oneof since
// individual entries of a map or fields of a oneof can already detect presence.
syntax = "proto3";
package google.protobuf;
option cc_enable_arenas = true;
option go_package = "google.golang.org/protobuf/types/known/wrapperspb";
option java_package = "com.google.protobuf";
option java_outer_classname = "WrappersProto";
option java_multiple_files = true;
option objc_class_prefix = "GPB";
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
// Wrapper message for `double`.
//
// The JSON representation for `DoubleValue` is JSON number.
message DoubleValue {
// The double value.
double value = 1;
}
// Wrapper message for `float`.
//
// The JSON representation for `FloatValue` is JSON number.
message FloatValue {
// The float value.
float value = 1;
}
// Wrapper message for `int64`.
//
// The JSON representation for `Int64Value` is JSON string.
message Int64Value {
// The int64 value.
int64 value = 1;
}
// Wrapper message for `uint64`.
//
// The JSON representation for `UInt64Value` is JSON string.
message UInt64Value {
// The uint64 value.
uint64 value = 1;
}
// Wrapper message for `int32`.
//
// The JSON representation for `Int32Value` is JSON number.
message Int32Value {
// The int32 value.
int32 value = 1;
}
// Wrapper message for `uint32`.
//
// The JSON representation for `UInt32Value` is JSON number.
message UInt32Value {
// The uint32 value.
uint32 value = 1;
}
// Wrapper message for `bool`.
//
// The JSON representation for `BoolValue` is JSON `true` and `false`.
message BoolValue {
// The bool value.
bool value = 1;
}
// Wrapper message for `string`.
//
// The JSON representation for `StringValue` is JSON string.
message StringValue {
// The string value.
string value = 1;
}
// Wrapper message for `bytes`.
//
// The JSON representation for `BytesValue` is JSON string.
message BytesValue {
// The bytes value.
bytes value = 1;
}

View File

@@ -0,0 +1,49 @@
// Copyright 2024 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.rpc;
import "google/protobuf/any.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/rpc/status;status";
option java_multiple_files = true;
option java_outer_classname = "StatusProto";
option java_package = "com.google.rpc";
option objc_class_prefix = "RPC";
// The `Status` type defines a logical error model that is suitable for
// different programming environments, including REST APIs and RPC APIs. It is
// used by [gRPC](https://github.com/grpc). Each `Status` message contains
// three pieces of data: error code, error message, and error details.
//
// You can find out more about this error model and how to work with it in the
// [API Design Guide](https://cloud.google.com/apis/design/errors).
message Status {
// The status code, which should be an enum value of
// [google.rpc.Code][google.rpc.Code].
int32 code = 1;
// A developer-facing error message, which should be in English. Any
// user-facing error message should be localized and sent in the
// [google.rpc.Status.details][google.rpc.Status.details] field, or localized
// by the client.
string message = 2;
// A list of messages that carry the error details. There is a common set of
// message types for APIs to use.
repeated google.protobuf.Any details = 3;
}

View File

@@ -0,0 +1,50 @@
// Copyright 2024 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.type;
option go_package = "google.golang.org/genproto/googleapis/type/dayofweek;dayofweek";
option java_multiple_files = true;
option java_outer_classname = "DayOfWeekProto";
option java_package = "com.google.type";
option objc_class_prefix = "GTP";
// Represents a day of the week.
enum DayOfWeek {
// The day of the week is unspecified.
DAY_OF_WEEK_UNSPECIFIED = 0;
// Monday
MONDAY = 1;
// Tuesday
TUESDAY = 2;
// Wednesday
WEDNESDAY = 3;
// Thursday
THURSDAY = 4;
// Friday
FRIDAY = 5;
// Saturday
SATURDAY = 6;
// Sunday
SUNDAY = 7;
}

View File

@@ -0,0 +1,37 @@
// Copyright 2024 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.type;
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/type/latlng;latlng";
option java_multiple_files = true;
option java_outer_classname = "LatLngProto";
option java_package = "com.google.type";
option objc_class_prefix = "GTP";
// An object that represents a latitude/longitude pair. This is expressed as a
// pair of doubles to represent degrees latitude and degrees longitude. Unless
// specified otherwise, this must conform to the
// <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
// standard</a>. Values must be within normalized ranges.
message LatLng {
// The latitude in degrees. It must be in the range [-90.0, +90.0].
double latitude = 1;
// The longitude in degrees. It must be in the range [-180.0, +180.0].
double longitude = 2;
}

View File

@@ -0,0 +1,144 @@
#!/bin/bash
# Copyright 2018 Google Inc.
#
# 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.
set -euo pipefail
IFS=$'\n\t'
echo "Running update.sh"
echo $(npm --version)
# Variables
PROTOS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
WORK_DIR=`mktemp -d`
cd ${PROTOS_DIR}
# deletes the temp directory on exit
function cleanup {
rm -rf "$WORK_DIR"
echo "Deleted temp working directory $WORK_DIR"
}
# register the cleanup function to be called on the EXIT signal
trap cleanup EXIT
# Capture location of pbjs / pbts before we pushd.
PBJS="$(npm root)/.bin/pbjs"
PBTS="$(npm root)/.bin/pbts"
# Enter work dir
pushd "$WORK_DIR"
# Clone necessary git repos.
git clone --depth 1 https://github.com/googleapis/googleapis.git
# Protobuf may have breaking changes, so it will be pinned to a specific release.
# TODO(version) nodejs-firestore should maintain the version number of protobuf manually
git clone --single-branch --branch v26.1 --depth 1 https://github.com/google/protobuf.git
# Copy necessary protos.
mkdir -p "${PROTOS_DIR}/google/api"
cp googleapis/google/api/{annotations,client,field_behavior,http,launch_stage,resource}.proto \
"${PROTOS_DIR}/google/api/"
mkdir -p "${PROTOS_DIR}/google/firestore/v1"
cp googleapis/google/firestore/v1/*.proto \
"${PROTOS_DIR}/google/firestore/v1/"
mkdir -p "${PROTOS_DIR}/google/firestore/v1beta1"
cp googleapis/google/firestore/v1beta1/*.proto \
"${PROTOS_DIR}/google/firestore/v1beta1/"
mkdir -p "${PROTOS_DIR}/google/firestore/admin/v1"
cp googleapis/google/firestore/admin/v1/*.proto \
"${PROTOS_DIR}/google/firestore/admin/v1/"
mkdir -p "${PROTOS_DIR}/google/longrunning"
cp googleapis/google/longrunning/operations.proto \
"${PROTOS_DIR}/google/longrunning/"
mkdir -p "${PROTOS_DIR}/google/rpc"
cp googleapis/google/rpc/status.proto \
"${PROTOS_DIR}/google/rpc/"
mkdir -p "${PROTOS_DIR}/google/type"
cp googleapis/google/type/{latlng,dayofweek}.proto \
"${PROTOS_DIR}/google/type/"
mkdir -p "${PROTOS_DIR}/google/protobuf"
cp protobuf/src/google/protobuf/{any,descriptor,empty,field_mask,struct,timestamp,wrappers,duration}.proto \
"${PROTOS_DIR}/google/protobuf/"
popd
# Generate the Protobuf typings
PBJS_ARGS=( -p . \
--js_out=import_style=commonjs,binary:library \
--target=static-module \
--no-create \
--no-encode \
--no-decode \
--no-verify \
--no-delimited \
--force-enum-string)
"${PBJS}" "${PBJS_ARGS[@]}" -o firestore_v1_proto_api.js \
-r firestore_v1 \
"google/firestore/v1/*.proto" \
"firestore/*.proto" \
"google/protobuf/*.proto" "google/type/*.proto" \
"google/rpc/*.proto" "google/api/*.proto" \
"google/longrunning/*.proto"
perl -pi -e 's/number\|Long/number\|string/g' firestore_v1_proto_api.js
"${PBTS}" -o firestore_v1_proto_api.d.ts firestore_v1_proto_api.js
"${PBJS}" "${PBJS_ARGS[@]}" -o firestore_admin_v1_proto_api.js \
-r firestore_admin_v1 \
"google/firestore/admin/v1/*.proto" \
"google/protobuf/*.proto" "google/type/*.proto" \
"google/rpc/*.proto" "google/api/*.proto" \
"google/longrunning/*.proto"
perl -pi -e 's/number\|Long/number\|string/g' firestore_admin_v1_proto_api.js
"${PBTS}" -o firestore_admin_v1_proto_api.d.ts firestore_admin_v1_proto_api.js
"${PBJS}" "${PBJS_ARGS[@]}" -o firestore_v1beta1_proto_api.js \
-r firestore_v1beta1 \
"google/firestore/v1beta1/*.proto" \
"google/protobuf/*.proto" "google/type/*.proto" \
"google/rpc/*.proto" "google/api/*.proto" \
"google/longrunning/*.proto"
perl -pi -e 's/number\|Long/number\|string/g' firestore_v1beta1_proto_api.js
"${PBTS}" -o firestore_v1beta1_proto_api.d.ts firestore_v1beta1_proto_api.js
"${PBJS}" -p . --target=json -o v1.json \
-r firestore_v1 \
"google/firestore/v1/*.proto" \
"google/protobuf/*.proto" "google/type/*.proto" \
"google/rpc/*.proto" "google/api/*.proto"
"${PBJS}" -p . --target=json -o admin_v1.json \
-r firestore_admin_v1 \
"google/firestore/admin/v1/*.proto" \
"google/protobuf/*.proto" "google/type/*.proto" \
"google/rpc/*.proto" "google/api/*.proto" \
"google/longrunning/*.proto"
"${PBJS}" -p . --target=json -o v1beta1.json \
-r firestore_v1beta1 \
"google/firestore/v1beta1/*.proto" \
"google/protobuf/*.proto" "google/type/*.proto" \
"google/rpc/*.proto" "google/api/*.proto"
echo "Finished running update.sh"
node ../../scripts/license.js ../../build ../protos

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long