table.proto 16 KB

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