table.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. // Copyright 2021 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.bigtable.admin.v2;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/duration.proto";
  19. import "google/protobuf/timestamp.proto";
  20. import "google/rpc/status.proto";
  21. option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2";
  22. option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin";
  23. option java_multiple_files = true;
  24. option java_outer_classname = "TableProto";
  25. option java_package = "com.google.bigtable.admin.v2";
  26. option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2";
  27. option ruby_package = "Google::Cloud::Bigtable::Admin::V2";
  28. option (google.api.resource_definition) = {
  29. type: "cloudkms.googleapis.com/CryptoKeyVersion"
  30. pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}"
  31. };
  32. // Indicates the type of the restore source.
  33. enum RestoreSourceType {
  34. // No restore associated.
  35. RESTORE_SOURCE_TYPE_UNSPECIFIED = 0;
  36. // A backup was used as the source of the restore.
  37. BACKUP = 1;
  38. }
  39. // Information about a table restore.
  40. message RestoreInfo {
  41. // The type of the restore source.
  42. RestoreSourceType source_type = 1;
  43. // Information about the source used to restore the table.
  44. oneof source_info {
  45. // Information about the backup used to restore the table. The backup
  46. // may no longer exist.
  47. BackupInfo backup_info = 2;
  48. }
  49. }
  50. // A collection of user data indexed by row, column, and timestamp.
  51. // Each table is served using the resources of its parent cluster.
  52. message Table {
  53. option (google.api.resource) = {
  54. type: "bigtable.googleapis.com/Table"
  55. pattern: "projects/{project}/instances/{instance}/tables/{table}"
  56. };
  57. // The state of a table's data in a particular cluster.
  58. message ClusterState {
  59. // Table replication states.
  60. enum ReplicationState {
  61. // The replication state of the table is unknown in this cluster.
  62. STATE_NOT_KNOWN = 0;
  63. // The cluster was recently created, and the table must finish copying
  64. // over pre-existing data from other clusters before it can begin
  65. // receiving live replication updates and serving Data API requests.
  66. INITIALIZING = 1;
  67. // The table is temporarily unable to serve Data API requests from this
  68. // cluster due to planned internal maintenance.
  69. PLANNED_MAINTENANCE = 2;
  70. // The table is temporarily unable to serve Data API requests from this
  71. // cluster due to unplanned or emergency maintenance.
  72. UNPLANNED_MAINTENANCE = 3;
  73. // The table can serve Data API requests from this cluster. Depending on
  74. // replication delay, reads may not immediately reflect the state of the
  75. // table in other clusters.
  76. READY = 4;
  77. // The table is fully created and ready for use after a restore, and is
  78. // being optimized for performance. When optimizations are complete, the
  79. // table will transition to `READY` state.
  80. READY_OPTIMIZING = 5;
  81. }
  82. // Output only. The state of replication for the table in this cluster.
  83. ReplicationState replication_state = 1;
  84. // Output only. The encryption information for the table in this cluster.
  85. // If the encryption key protecting this resource is customer managed, then
  86. // its version can be rotated in Cloud Key Management Service (Cloud KMS).
  87. // The primary version of the key and its status will be reflected here when
  88. // changes propagate from Cloud KMS.
  89. repeated EncryptionInfo encryption_info = 2
  90. [(google.api.field_behavior) = OUTPUT_ONLY];
  91. }
  92. // Possible timestamp granularities to use when keeping multiple versions
  93. // of data in a table.
  94. enum TimestampGranularity {
  95. // The user did not specify a granularity. Should not be returned.
  96. // When specified during table creation, MILLIS will be used.
  97. TIMESTAMP_GRANULARITY_UNSPECIFIED = 0;
  98. // The table keeps data versioned at a granularity of 1ms.
  99. MILLIS = 1;
  100. }
  101. // Defines a view over a table's fields.
  102. enum View {
  103. // Uses the default view for each method as documented in its request.
  104. VIEW_UNSPECIFIED = 0;
  105. // Only populates `name`.
  106. NAME_ONLY = 1;
  107. // Only populates `name` and fields related to the table's schema.
  108. SCHEMA_VIEW = 2;
  109. // Only populates `name` and fields related to the table's replication
  110. // state.
  111. REPLICATION_VIEW = 3;
  112. // Only populates 'name' and fields related to the table's encryption state.
  113. ENCRYPTION_VIEW = 5;
  114. // Populates all fields.
  115. FULL = 4;
  116. }
  117. // The unique name of the table. Values are of the form
  118. // `projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`.
  119. // Views: `NAME_ONLY`, `SCHEMA_VIEW`, `REPLICATION_VIEW`, `FULL`
  120. string name = 1;
  121. // Output only. Map from cluster ID to per-cluster table state.
  122. // If it could not be determined whether or not the table has data in a
  123. // particular cluster (for example, if its zone is unavailable), then
  124. // there will be an entry for the cluster with UNKNOWN `replication_status`.
  125. // Views: `REPLICATION_VIEW`, `ENCRYPTION_VIEW`, `FULL`
  126. map<string, ClusterState> cluster_states = 2;
  127. // (`CreationOnly`)
  128. // The column families configured for this table, mapped by column family ID.
  129. // Views: `SCHEMA_VIEW`, `FULL`
  130. map<string, ColumnFamily> column_families = 3;
  131. // (`CreationOnly`)
  132. // The granularity (i.e. `MILLIS`) at which timestamps are stored in
  133. // this table. Timestamps not matching the granularity will be rejected.
  134. // If unspecified at creation time, the value will be set to `MILLIS`.
  135. // Views: `SCHEMA_VIEW`, `FULL`.
  136. TimestampGranularity granularity = 4;
  137. // Output only. If this table was restored from another data source (e.g. a
  138. // backup), this field will be populated with information about the restore.
  139. RestoreInfo restore_info = 6;
  140. }
  141. // A set of columns within a table which share a common configuration.
  142. message ColumnFamily {
  143. // Garbage collection rule specified as a protobuf.
  144. // Must serialize to at most 500 bytes.
  145. //
  146. // NOTE: Garbage collection executes opportunistically in the background, and
  147. // so it's possible for reads to return a cell even if it matches the active
  148. // GC expression for its family.
  149. GcRule gc_rule = 1;
  150. }
  151. // Rule for determining which cells to delete during garbage collection.
  152. message GcRule {
  153. // A GcRule which deletes cells matching all of the given rules.
  154. message Intersection {
  155. // Only delete cells which would be deleted by every element of `rules`.
  156. repeated GcRule rules = 1;
  157. }
  158. // A GcRule which deletes cells matching any of the given rules.
  159. message Union {
  160. // Delete cells which would be deleted by any element of `rules`.
  161. repeated GcRule rules = 1;
  162. }
  163. // Garbage collection rules.
  164. oneof rule {
  165. // Delete all cells in a column except the most recent N.
  166. int32 max_num_versions = 1;
  167. // Delete cells in a column older than the given age.
  168. // Values must be at least one millisecond, and will be truncated to
  169. // microsecond granularity.
  170. google.protobuf.Duration max_age = 2;
  171. // Delete cells that would be deleted by every nested rule.
  172. Intersection intersection = 3;
  173. // Delete cells that would be deleted by any nested rule.
  174. Union union = 4;
  175. }
  176. }
  177. // Encryption information for a given resource.
  178. // If this resource is protected with customer managed encryption, the in-use
  179. // Cloud Key Management Service (Cloud KMS) key version is specified along with
  180. // its status.
  181. message EncryptionInfo {
  182. // Possible encryption types for a resource.
  183. enum EncryptionType {
  184. // Encryption type was not specified, though data at rest remains encrypted.
  185. ENCRYPTION_TYPE_UNSPECIFIED = 0;
  186. // The data backing this resource is encrypted at rest with a key that is
  187. // fully managed by Google. No key version or status will be populated.
  188. // This is the default state.
  189. GOOGLE_DEFAULT_ENCRYPTION = 1;
  190. // The data backing this resource is encrypted at rest with a key that is
  191. // managed by the customer.
  192. // The in-use version of the key and its status are populated for
  193. // CMEK-protected tables.
  194. // CMEK-protected backups are pinned to the key version that was in use at
  195. // the time the backup was taken. This key version is populated but its
  196. // status is not tracked and is reported as `UNKNOWN`.
  197. CUSTOMER_MANAGED_ENCRYPTION = 2;
  198. }
  199. // Output only. The type of encryption used to protect this resource.
  200. EncryptionType encryption_type = 3
  201. [(google.api.field_behavior) = OUTPUT_ONLY];
  202. // Output only. The status of encrypt/decrypt calls on underlying data for
  203. // this resource. Regardless of status, the existing data is always encrypted
  204. // at rest.
  205. google.rpc.Status encryption_status = 4
  206. [(google.api.field_behavior) = OUTPUT_ONLY];
  207. // Output only. The version of the Cloud KMS key specified in the parent
  208. // cluster that is in use for the data underlying this table.
  209. string kms_key_version = 2 [
  210. (google.api.field_behavior) = OUTPUT_ONLY,
  211. (google.api.resource_reference) = {
  212. type: "cloudkms.googleapis.com/CryptoKeyVersion"
  213. }
  214. ];
  215. }
  216. // A snapshot of a table at a particular time. A snapshot can be used as a
  217. // checkpoint for data restoration or a data source for a new table.
  218. //
  219. // Note: This is a private alpha release of Cloud Bigtable snapshots. This
  220. // feature is not currently available to most Cloud Bigtable customers. This
  221. // feature might be changed in backward-incompatible ways and is not recommended
  222. // for production use. It is not subject to any SLA or deprecation policy.
  223. message Snapshot {
  224. option (google.api.resource) = {
  225. type: "bigtable.googleapis.com/Snapshot"
  226. pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}"
  227. };
  228. // Possible states of a snapshot.
  229. enum State {
  230. // The state of the snapshot could not be determined.
  231. STATE_NOT_KNOWN = 0;
  232. // The snapshot has been successfully created and can serve all requests.
  233. READY = 1;
  234. // The snapshot is currently being created, and may be destroyed if the
  235. // creation process encounters an error. A snapshot may not be restored to a
  236. // table while it is being created.
  237. CREATING = 2;
  238. }
  239. // Output only. The unique name of the snapshot.
  240. // Values are of the form
  241. // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
  242. string name = 1;
  243. // Output only. The source table at the time the snapshot was taken.
  244. Table source_table = 2;
  245. // Output only. The size of the data in the source table at the time the
  246. // snapshot was taken. In some cases, this value may be computed
  247. // asynchronously via a background process and a placeholder of 0 will be used
  248. // in the meantime.
  249. int64 data_size_bytes = 3;
  250. // Output only. The time when the snapshot is created.
  251. google.protobuf.Timestamp create_time = 4;
  252. // Output only. The time when the snapshot will be deleted. The maximum amount
  253. // of time a snapshot can stay active is 365 days. If 'ttl' is not specified,
  254. // the default maximum of 365 days will be used.
  255. google.protobuf.Timestamp delete_time = 5;
  256. // Output only. The current state of the snapshot.
  257. State state = 6;
  258. // Output only. Description of the snapshot.
  259. string description = 7;
  260. }
  261. // A backup of a Cloud Bigtable table.
  262. message Backup {
  263. option (google.api.resource) = {
  264. type: "bigtable.googleapis.com/Backup"
  265. pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}"
  266. };
  267. // Indicates the current state of the backup.
  268. enum State {
  269. // Not specified.
  270. STATE_UNSPECIFIED = 0;
  271. // The pending backup is still being created. Operations on the
  272. // backup may fail with `FAILED_PRECONDITION` in this state.
  273. CREATING = 1;
  274. // The backup is complete and ready for use.
  275. READY = 2;
  276. }
  277. // Output only. A globally unique identifier for the backup which cannot be
  278. // changed. Values are of the form
  279. // `projects/{project}/instances/{instance}/clusters/{cluster}/
  280. // backups/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`
  281. // The final segment of the name must be between 1 and 50 characters
  282. // in length.
  283. //
  284. // The backup is stored in the cluster identified by the prefix of the backup
  285. // name of the form
  286. // `projects/{project}/instances/{instance}/clusters/{cluster}`.
  287. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  288. // Required. Immutable. Name of the table from which this backup was created.
  289. // This needs to be in the same instance as the backup. Values are of the form
  290. // `projects/{project}/instances/{instance}/tables/{source_table}`.
  291. string source_table = 2 [
  292. (google.api.field_behavior) = IMMUTABLE,
  293. (google.api.field_behavior) = REQUIRED
  294. ];
  295. // Required. The expiration time of the backup, with microseconds
  296. // granularity that must be at least 6 hours and at most 30 days
  297. // from the time the request is received. Once the `expire_time`
  298. // has passed, Cloud Bigtable will delete the backup and free the
  299. // resources used by the backup.
  300. google.protobuf.Timestamp expire_time = 3
  301. [(google.api.field_behavior) = REQUIRED];
  302. // Output only. `start_time` is the time that the backup was started
  303. // (i.e. approximately the time the
  304. // [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup]
  305. // request is received). The row data in this backup will be no older than
  306. // this timestamp.
  307. google.protobuf.Timestamp start_time = 4
  308. [(google.api.field_behavior) = OUTPUT_ONLY];
  309. // Output only. `end_time` is the time that the backup was finished. The row
  310. // data in the backup will be no newer than this timestamp.
  311. google.protobuf.Timestamp end_time = 5
  312. [(google.api.field_behavior) = OUTPUT_ONLY];
  313. // Output only. Size of the backup in bytes.
  314. int64 size_bytes = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  315. // Output only. The current state of the backup.
  316. State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  317. // Output only. The encryption information for the backup.
  318. EncryptionInfo encryption_info = 9
  319. [(google.api.field_behavior) = OUTPUT_ONLY];
  320. }
  321. // Information about a backup.
  322. message BackupInfo {
  323. // Output only. Name of the backup.
  324. string backup = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  325. // Output only. The time that the backup was started. Row data in the backup
  326. // will be no older than this timestamp.
  327. google.protobuf.Timestamp start_time = 2
  328. [(google.api.field_behavior) = OUTPUT_ONLY];
  329. // Output only. This time that the backup was finished. Row data in the
  330. // backup will be no newer than this timestamp.
  331. google.protobuf.Timestamp end_time = 3
  332. [(google.api.field_behavior) = OUTPUT_ONLY];
  333. // Output only. Name of the table the backup was created from.
  334. string source_table = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  335. }