field.proto 5.8 KB

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