1// Copyright 2022 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.firestore.admin.v1; 18 19import "google/api/field_behavior.proto"; 20import "google/api/resource.proto"; 21import "google/firestore/admin/v1/index.proto"; 22 23option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; 24option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb"; 25option java_multiple_files = true; 26option java_outer_classname = "FieldProto"; 27option java_package = "com.google.firestore.admin.v1"; 28option objc_class_prefix = "GCFS"; 29option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; 30option ruby_package = "Google::Cloud::Firestore::Admin::V1"; 31 32// Represents a single field in the database. 33// 34// Fields are grouped by their "Collection Group", which represent all 35// collections in the database with the same id. 36message Field { 37 option (google.api.resource) = { 38 type: "firestore.googleapis.com/Field" 39 pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}" 40 }; 41 42 // The index configuration for this field. 43 message IndexConfig { 44 // The indexes supported for this field. 45 repeated Index indexes = 1; 46 47 // Output only. When true, the `Field`'s index configuration is set from the 48 // configuration specified by the `ancestor_field`. 49 // When false, the `Field`'s index configuration is defined explicitly. 50 bool uses_ancestor_config = 2; 51 52 // Output only. Specifies the resource name of the `Field` from which this field's 53 // index configuration is set (when `uses_ancestor_config` is true), 54 // or from which it *would* be set if this field had no index configuration 55 // (when `uses_ancestor_config` is false). 56 string ancestor_field = 3; 57 58 // Output only 59 // When true, the `Field`'s index configuration is in the process of being 60 // reverted. Once complete, the index config will transition to the same 61 // state as the field specified by `ancestor_field`, at which point 62 // `uses_ancestor_config` will be `true` and `reverting` will be `false`. 63 bool reverting = 4; 64 } 65 66 // The TTL (time-to-live) configuration for documents that have this `Field` 67 // set. 68 // Storing a timestamp value into a TTL-enabled field will be treated as 69 // the document's absolute expiration time. Using any other data type or 70 // leaving the field absent will disable the TTL for the individual document. 71 message TtlConfig { 72 // The state of applying the TTL configuration to all documents. 73 enum State { 74 // The state is unspecified or unknown. 75 STATE_UNSPECIFIED = 0; 76 77 // The TTL is being applied. There is an active long-running operation to 78 // track the change. Newly written documents will have TTLs applied as 79 // requested. Requested TTLs on existing documents are still being 80 // processed. When TTLs on all existing documents have been processed, the 81 // state will move to 'ACTIVE'. 82 CREATING = 1; 83 84 // The TTL is active for all documents. 85 ACTIVE = 2; 86 87 // The TTL configuration could not be enabled for all existing documents. 88 // Newly written documents will continue to have their TTL applied. 89 // The LRO returned when last attempting to enable TTL for this `Field` 90 // has failed, and may have more details. 91 NEEDS_REPAIR = 3; 92 } 93 94 // Output only. The state of the TTL configuration. 95 State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 96 } 97 98 // Required. A field name of the form 99 // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}` 100 // 101 // A field path may be a simple field name, e.g. `address` or a path to fields 102 // within map_value , e.g. `address.city`, 103 // or a special field path. The only valid special field is `*`, which 104 // represents any field. 105 // 106 // Field paths may be quoted using ` (backtick). The only character that needs 107 // to be escaped within a quoted field path is the backtick character itself, 108 // escaped using a backslash. Special characters in field paths that 109 // must be quoted include: `*`, `.`, 110 // ``` (backtick), `[`, `]`, as well as any ascii symbolic characters. 111 // 112 // Examples: 113 // (Note: Comments here are written in markdown syntax, so there is an 114 // additional layer of backticks to represent a code block) 115 // `\`address.city\`` represents a field named `address.city`, not the map key 116 // `city` in the field `address`. 117 // `\`*\`` represents a field named `*`, not any field. 118 // 119 // A special `Field` contains the default indexing settings for all fields. 120 // This field's resource name is: 121 // `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*` 122 // Indexes defined on this `Field` will be applied to all fields which do not 123 // have their own `Field` index configuration. 124 string name = 1 [(google.api.field_behavior) = REQUIRED]; 125 126 // The index configuration for this field. If unset, field indexing will 127 // revert to the configuration defined by the `ancestor_field`. To 128 // explicitly remove all indexes for this field, specify an index config 129 // with an empty list of indexes. 130 IndexConfig index_config = 2; 131 132 // The TTL configuration for this `Field`. 133 // Setting or unsetting this will enable or disable the TTL for 134 // documents that have this `Field`. 135 TtlConfig ttl_config = 3; 136} 137