storage.proto 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  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.storage.v2;
  16. import "google/api/client.proto";
  17. import "google/api/field_behavior.proto";
  18. import "google/api/resource.proto";
  19. import "google/iam/v1/iam_policy.proto";
  20. import "google/iam/v1/policy.proto";
  21. import "google/protobuf/empty.proto";
  22. import "google/protobuf/field_mask.proto";
  23. import "google/protobuf/timestamp.proto";
  24. import "google/type/date.proto";
  25. option go_package = "google.golang.org/genproto/googleapis/storage/v2;storage";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "StorageProto";
  28. option java_package = "com.google.storage.v2";
  29. option (google.api.resource_definition) = {
  30. type: "cloudkms.googleapis.com/CryptoKey"
  31. pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}"
  32. };
  33. // Manages Google Cloud Storage resources.
  34. service Storage {
  35. option (google.api.default_host) = "storage.googleapis.com";
  36. option (google.api.oauth_scopes) =
  37. "https://www.googleapis.com/auth/cloud-platform,"
  38. "https://www.googleapis.com/auth/cloud-platform.read-only,"
  39. "https://www.googleapis.com/auth/devstorage.full_control,"
  40. "https://www.googleapis.com/auth/devstorage.read_only,"
  41. "https://www.googleapis.com/auth/devstorage.read_write";
  42. // Reads an object's data.
  43. rpc ReadObject(ReadObjectRequest) returns (stream ReadObjectResponse) {
  44. option (google.api.method_signature) = "bucket,object";
  45. option (google.api.method_signature) = "bucket,object,generation";
  46. }
  47. // Stores a new object and metadata.
  48. //
  49. // An object can be written either in a single message stream or in a
  50. // resumable sequence of message streams. To write using a single stream,
  51. // the client should include in the first message of the stream an
  52. // `WriteObjectSpec` describing the destination bucket, object, and any
  53. // preconditions. Additionally, the final message must set 'finish_write' to
  54. // true, or else it is an error.
  55. //
  56. // For a resumable write, the client should instead call
  57. // `StartResumableWrite()` and provide that method an `WriteObjectSpec.`
  58. // They should then attach the returned `upload_id` to the first message of
  59. // each following call to `Create`. If there is an error or the connection is
  60. // broken during the resumable `Create()`, the client should check the status
  61. // of the `Create()` by calling `QueryWriteStatus()` and continue writing from
  62. // the returned `committed_size`. This may be less than the amount of data the
  63. // client previously sent.
  64. //
  65. // The service will not view the object as complete until the client has
  66. // sent a `WriteObjectRequest` with `finish_write` set to `true`. Sending any
  67. // requests on a stream after sending a request with `finish_write` set to
  68. // `true` will cause an error. The client **should** check the response it
  69. // receives to determine how much data the service was able to commit and
  70. // whether the service views the object as complete.
  71. rpc WriteObject(stream WriteObjectRequest) returns (WriteObjectResponse) {
  72. }
  73. // Starts a resumable write. How long the write operation remains valid, and
  74. // what happens when the write operation becomes invalid, are
  75. // service-dependent.
  76. rpc StartResumableWrite(StartResumableWriteRequest) returns (StartResumableWriteResponse) {
  77. }
  78. // Determines the `committed_size` for an object that is being written, which
  79. // can then be used as the `write_offset` for the next `Write()` call.
  80. //
  81. // If the object does not exist (i.e., the object has been deleted, or the
  82. // first `Write()` has not yet reached the service), this method returns the
  83. // error `NOT_FOUND`.
  84. //
  85. // The client **may** call `QueryWriteStatus()` at any time to determine how
  86. // much data has been processed for this object. This is useful if the
  87. // client is buffering data and needs to know which data can be safely
  88. // evicted. For any sequence of `QueryWriteStatus()` calls for a given
  89. // object name, the sequence of returned `committed_size` values will be
  90. // non-decreasing.
  91. rpc QueryWriteStatus(QueryWriteStatusRequest) returns (QueryWriteStatusResponse) {
  92. option (google.api.method_signature) = "upload_id";
  93. }
  94. }
  95. // Request message for ReadObject.
  96. message ReadObjectRequest {
  97. // The name of the bucket containing the object to read.
  98. string bucket = 1;
  99. // The name of the object to read.
  100. string object = 2;
  101. // If present, selects a specific revision of this object (as opposed
  102. // to the latest version, the default).
  103. int64 generation = 3;
  104. // The offset for the first byte to return in the read, relative to the start
  105. // of the object.
  106. //
  107. // A negative `read_offset` value will be interpreted as the number of bytes
  108. // back from the end of the object to be returned. For example, if an object's
  109. // length is 15 bytes, a ReadObjectRequest with `read_offset` = -5 and
  110. // `read_limit` = 3 would return bytes 10 through 12 of the object. Requesting
  111. // a negative offset whose magnitude is larger than the size of the object
  112. // will result in an error.
  113. int64 read_offset = 4;
  114. // The maximum number of `data` bytes the server is allowed to return in the
  115. // sum of all `Object` messages. A `read_limit` of zero indicates that there
  116. // is no limit, and a negative `read_limit` will cause an error.
  117. //
  118. // If the stream returns fewer bytes than allowed by the `read_limit` and no
  119. // error occurred, the stream includes all data from the `read_offset` to the
  120. // end of the resource.
  121. int64 read_limit = 5;
  122. // Makes the operation conditional on whether the object's current generation
  123. // matches the given value. Setting to 0 makes the operation succeed only if
  124. // there are no live versions of the object.
  125. optional int64 if_generation_match = 6;
  126. // Makes the operation conditional on whether the object's current generation
  127. // does not match the given value. If no live object exists, the precondition
  128. // fails. Setting to 0 makes the operation succeed only if there is a live
  129. // version of the object.
  130. optional int64 if_generation_not_match = 7;
  131. // Makes the operation conditional on whether the object's current
  132. // metageneration matches the given value.
  133. optional int64 if_metageneration_match = 8;
  134. // Makes the operation conditional on whether the object's current
  135. // metageneration does not match the given value.
  136. optional int64 if_metageneration_not_match = 9;
  137. // A set of parameters common to Storage API requests concerning an object.
  138. CommonObjectRequestParams common_object_request_params = 10;
  139. // A set of parameters common to all Storage API requests.
  140. CommonRequestParams common_request_params = 11;
  141. // Mask specifying which fields to read.
  142. // The checksummed_data field and its children will always be present.
  143. // If no mask is specified, will default to all fields except metadata.owner
  144. // and metadata.acl.
  145. // * may be used to mean "all fields".
  146. optional google.protobuf.FieldMask read_mask = 12;
  147. }
  148. // Response message for GetObject.
  149. message ReadObjectResponse {
  150. // A portion of the data for the object. The service **may** leave `data`
  151. // empty for any given `ReadResponse`. This enables the service to inform the
  152. // client that the request is still live while it is running an operation to
  153. // generate more data.
  154. ChecksummedData checksummed_data = 1;
  155. // The checksums of the complete object. The client should compute one of
  156. // these checksums over the downloaded object and compare it against the value
  157. // provided here.
  158. ObjectChecksums object_checksums = 2;
  159. // If read_offset and or read_limit was specified on the
  160. // ReadObjectRequest, ContentRange will be populated on the first
  161. // ReadObjectResponse message of the read stream.
  162. ContentRange content_range = 3;
  163. // Metadata of the object whose media is being returned.
  164. // Only populated in the first response in the stream.
  165. Object metadata = 4;
  166. }
  167. // Describes an attempt to insert an object, possibly over multiple requests.
  168. message WriteObjectSpec {
  169. // Destination object, including its name and its metadata.
  170. Object resource = 1;
  171. // Apply a predefined set of access controls to this object.
  172. PredefinedObjectAcl predefined_acl = 2;
  173. // Makes the operation conditional on whether the object's current
  174. // generation matches the given value. Setting to 0 makes the operation
  175. // succeed only if there are no live versions of the object.
  176. optional int64 if_generation_match = 3;
  177. // Makes the operation conditional on whether the object's current
  178. // generation does not match the given value. If no live object exists, the
  179. // precondition fails. Setting to 0 makes the operation succeed only if
  180. // there is a live version of the object.
  181. optional int64 if_generation_not_match = 4;
  182. // Makes the operation conditional on whether the object's current
  183. // metageneration matches the given value.
  184. optional int64 if_metageneration_match = 5;
  185. // Makes the operation conditional on whether the object's current
  186. // metageneration does not match the given value.
  187. optional int64 if_metageneration_not_match = 6;
  188. }
  189. // Request message for WriteObject.
  190. message WriteObjectRequest {
  191. // The first message of each stream should set one of the following.
  192. oneof first_message {
  193. // For resumable uploads. This should be the `upload_id` returned from a
  194. // call to `StartResumableWriteResponse`.
  195. string upload_id = 1;
  196. // For non-resumable uploads. Describes the overall upload, including the
  197. // destination bucket and object name, preconditions, etc.
  198. WriteObjectSpec write_object_spec = 2;
  199. }
  200. // Required. The offset from the beginning of the object at which the data should be
  201. // written.
  202. //
  203. // In the first `WriteObjectRequest` of a `WriteObject()` action, it
  204. // indicates the initial offset for the `Write()` call. The value **must** be
  205. // equal to the `committed_size` that a call to `QueryWriteStatus()` would
  206. // return (0 if this is the first write to the object).
  207. //
  208. // On subsequent calls, this value **must** be no larger than the sum of the
  209. // first `write_offset` and the sizes of all `data` chunks sent previously on
  210. // this stream.
  211. //
  212. // An incorrect value will cause an error.
  213. int64 write_offset = 3 [(google.api.field_behavior) = REQUIRED];
  214. // A portion of the data for the object.
  215. oneof data {
  216. // The data to insert. If a crc32c checksum is provided that doesn't match
  217. // the checksum computed by the service, the request will fail.
  218. ChecksummedData checksummed_data = 4;
  219. }
  220. // Checksums for the complete object. If the checksums computed by the service
  221. // don't match the specifified checksums the call will fail. May only be
  222. // provided in the first or last request (either with first_message, or
  223. // finish_write set).
  224. ObjectChecksums object_checksums = 6;
  225. // If `true`, this indicates that the write is complete. Sending any
  226. // `WriteObjectRequest`s subsequent to one in which `finish_write` is `true`
  227. // will cause an error.
  228. // For a non-resumable write (where the upload_id was not set in the first
  229. // message), it is an error not to set this field in the final message of the
  230. // stream.
  231. bool finish_write = 7;
  232. // A set of parameters common to Storage API requests concerning an object.
  233. CommonObjectRequestParams common_object_request_params = 8;
  234. // A set of parameters common to all Storage API requests.
  235. CommonRequestParams common_request_params = 9;
  236. }
  237. // Response message for WriteObject.
  238. message WriteObjectResponse {
  239. // The response will set one of the following.
  240. oneof write_status {
  241. // The total number of bytes that have been processed for the given object
  242. // from all `WriteObject` calls. Only set if the upload has not finalized.
  243. int64 committed_size = 1;
  244. // A resource containing the metadata for the uploaded object. Only set if
  245. // the upload has finalized.
  246. Object resource = 2;
  247. }
  248. }
  249. // Request object for `QueryWriteStatus`.
  250. message QueryWriteStatusRequest {
  251. // Required. The name of the resume token for the object whose write status is being
  252. // requested.
  253. string upload_id = 1 [(google.api.field_behavior) = REQUIRED];
  254. // A set of parameters common to Storage API requests concerning an object.
  255. CommonObjectRequestParams common_object_request_params = 2;
  256. // A set of parameters common to all Storage API requests.
  257. CommonRequestParams common_request_params = 3;
  258. }
  259. // Response object for `QueryWriteStatus`.
  260. message QueryWriteStatusResponse {
  261. // The response will set one of the following.
  262. oneof write_status {
  263. // The total number of bytes that have been processed for the given object
  264. // from all `WriteObject` calls. This is the correct value for the
  265. // 'write_offset' field to use when resuming the `WriteObject` operation.
  266. // Only set if the upload has not finalized.
  267. int64 committed_size = 1;
  268. // A resource containing the metadata for the uploaded object. Only set if
  269. // the upload has finalized.
  270. Object resource = 2;
  271. }
  272. }
  273. // Request message StartResumableWrite.
  274. message StartResumableWriteRequest {
  275. // The destination bucket, object, and metadata, as well as any preconditions.
  276. WriteObjectSpec write_object_spec = 1;
  277. // A set of parameters common to Storage API requests concerning an object.
  278. CommonObjectRequestParams common_object_request_params = 3;
  279. // A set of parameters common to all Storage API requests.
  280. CommonRequestParams common_request_params = 4;
  281. }
  282. // Response object for `StartResumableWrite`.
  283. message StartResumableWriteResponse {
  284. // The upload_id of the newly started resumable write operation. This
  285. // value should be copied into the `WriteObjectRequest.upload_id` field.
  286. string upload_id = 1;
  287. }
  288. // Parameters that can be passed to any object request.
  289. message CommonObjectRequestParams {
  290. // Encryption algorithm used with Customer-Supplied Encryption Keys feature.
  291. string encryption_algorithm = 1;
  292. // Encryption key used with Customer-Supplied Encryption Keys feature.
  293. // In raw bytes format (not base64-encoded).
  294. bytes encryption_key_bytes = 4;
  295. // SHA256 hash of encryption key used with Customer-Supplied Encryption Keys
  296. // feature.
  297. bytes encryption_key_sha256_bytes = 5;
  298. }
  299. // Parameters that can be passed to any request.
  300. message CommonRequestParams {
  301. // Required. Required when using buckets with Requestor Pays feature enabled.
  302. // Example: `projects/123456`.
  303. string user_project = 1 [
  304. (google.api.field_behavior) = REQUIRED,
  305. (google.api.resource_reference) = {
  306. type: "cloudresourcemanager.googleapis.com/Project"
  307. }
  308. ];
  309. }
  310. // Shared constants.
  311. message ServiceConstants {
  312. // A collection of constant values meaningful to the Storage API.
  313. enum Values {
  314. option allow_alias = true;
  315. // Unused. Proto3 requires first enum to be 0.
  316. VALUES_UNSPECIFIED = 0;
  317. // The maximum size chunk that can will be returned in a single
  318. // ReadRequest.
  319. // 2 MiB.
  320. MAX_READ_CHUNK_BYTES = 2097152;
  321. // The maximum size chunk that can be sent in a single WriteObjectRequest.
  322. // 2 MiB.
  323. MAX_WRITE_CHUNK_BYTES = 2097152;
  324. // The maximum size of an object in MB - whether written in a single stream
  325. // or composed from multiple other objects.
  326. // 5 TiB.
  327. MAX_OBJECT_SIZE_MB = 5242880;
  328. // The maximum length field name that can be sent in a single
  329. // custom metadata field.
  330. // 1 KiB.
  331. MAX_CUSTOM_METADATA_FIELD_NAME_BYTES = 1024;
  332. // The maximum length field value that can be sent in a single
  333. // custom_metadata field.
  334. // 4 KiB.
  335. MAX_CUSTOM_METADATA_FIELD_VALUE_BYTES = 4096;
  336. // The maximum total bytes that can be populated into all field names and
  337. // values of the custom_metadata for one object.
  338. // 8 KiB.
  339. MAX_CUSTOM_METADATA_TOTAL_SIZE_BYTES = 8192;
  340. // The maximum total bytes that can be populated into all bucket metadata
  341. // fields.
  342. // 20 KiB.
  343. MAX_BUCKET_METADATA_TOTAL_SIZE_BYTES = 20480;
  344. // The maximum number of NotificationConfigs that can be registered
  345. // for a given bucket.
  346. MAX_NOTIFICATION_CONFIGS_PER_BUCKET = 100;
  347. // The maximum number of LifecycleRules that can be registered for a given
  348. // bucket.
  349. MAX_LIFECYCLE_RULES_PER_BUCKET = 100;
  350. // The maximum number of custom attributes per NotificationConfigs.
  351. MAX_NOTIFICATION_CUSTOM_ATTRIBUTES = 5;
  352. // The maximum length of a custom attribute key included in
  353. // NotificationConfig.
  354. MAX_NOTIFICATION_CUSTOM_ATTRIBUTE_KEY_LENGTH = 256;
  355. // The maximum length of a custom attribute value included in a
  356. // NotificationConfig.
  357. MAX_NOTIFICATION_CUSTOM_ATTRIBUTE_VALUE_LENGTH = 1024;
  358. // The maximum number of key/value entries per bucket label.
  359. MAX_LABELS_ENTRIES_COUNT = 64;
  360. // The maximum character length of the key or value in a bucket
  361. // label map.
  362. MAX_LABELS_KEY_VALUE_LENGTH = 63;
  363. // The maximum byte size of the key or value in a bucket label
  364. // map.
  365. MAX_LABELS_KEY_VALUE_BYTES = 128;
  366. // The maximum number of object IDs that can be included in a
  367. // DeleteObjectsRequest.
  368. MAX_OBJECT_IDS_PER_DELETE_OBJECTS_REQUEST = 1000;
  369. // The maximum number of days for which a token returned by the
  370. // GetListObjectsSplitPoints RPC is valid.
  371. SPLIT_TOKEN_MAX_VALID_DAYS = 14;
  372. }
  373. }
  374. // A bucket.
  375. message Bucket {
  376. option (google.api.resource) = {
  377. type: "storage.googleapis.com/Bucket"
  378. pattern: "projects/{project}/buckets/{bucket}"
  379. };
  380. // Billing properties of a bucket.
  381. message Billing {
  382. // When set to true, Requester Pays is enabled for this bucket.
  383. bool requester_pays = 1;
  384. }
  385. // Cross-Origin Response sharing (CORS) properties for a bucket.
  386. // For more on Cloud Storage and CORS, see
  387. // https://cloud.google.com/storage/docs/cross-origin.
  388. // For more on CORS in general, see https://tools.ietf.org/html/rfc6454.
  389. message Cors {
  390. // The list of Origins eligible to receive CORS response headers. See
  391. // [https://tools.ietf.org/html/rfc6454][RFC 6454] for more on origins.
  392. // Note: "*" is permitted in the list of origins, and means "any Origin".
  393. repeated string origin = 1;
  394. // The list of HTTP methods on which to include CORS response headers,
  395. // (`GET`, `OPTIONS`, `POST`, etc) Note: "*" is permitted in the list of
  396. // methods, and means "any method".
  397. repeated string method = 2;
  398. // The list of HTTP headers other than the
  399. // [https://www.w3.org/TR/cors/#simple-response-header][simple response
  400. // headers] to give permission for the user-agent to share across domains.
  401. repeated string response_header = 3;
  402. // The value, in seconds, to return in the
  403. // [https://www.w3.org/TR/cors/#access-control-max-age-response-header][Access-Control-Max-Age
  404. // header] used in preflight responses.
  405. int32 max_age_seconds = 4;
  406. }
  407. // Encryption properties of a bucket.
  408. message Encryption {
  409. // A Cloud KMS key that will be used to encrypt objects inserted into this
  410. // bucket, if no encryption method is specified.
  411. string default_kms_key = 1 [(google.api.resource_reference) = {
  412. type: "cloudkms.googleapis.com/CryptoKey"
  413. }];
  414. }
  415. // Bucket restriction options.
  416. message IamConfig {
  417. // Settings for Uniform Bucket level access.
  418. // See https://cloud.google.com/storage/docs/uniform-bucket-level-access.
  419. message UniformBucketLevelAccess {
  420. // If set, access checks only use bucket-level IAM policies or above.
  421. bool enabled = 1;
  422. // The deadline time for changing
  423. // `iamConfig.uniformBucketLevelAccess.enabled` from
  424. // true to false in [RFC 3339](https://tools.ietf.org/html/rfc3339).
  425. // Mutable until the specified deadline is reached, but not afterward.
  426. google.protobuf.Timestamp lock_time = 2;
  427. }
  428. // Public Access Prevention config values.
  429. enum PublicAccessPrevention {
  430. // Does not prevent access from being granted to public members 'allUsers'
  431. // or 'allAuthenticatedUsers'. This setting may be enforced by Org Policy
  432. // at the project/folder/organization level.
  433. PUBLIC_ACCESS_PREVENTION_UNSPECIFIED = 0;
  434. // Prevents access from being granted to public members 'allUsers' and
  435. // 'allAuthenticatedUsers'. Prevents attempts to grant new access to
  436. // public members.
  437. ENFORCED = 1;
  438. }
  439. // Bucket restriction options currently enforced on the bucket.
  440. UniformBucketLevelAccess uniform_bucket_level_access = 1;
  441. // Whether IAM will enforce public access prevention.
  442. PublicAccessPrevention public_access_prevention = 2;
  443. }
  444. // Lifecycle properties of a bucket.
  445. // For more information, see https://cloud.google.com/storage/docs/lifecycle.
  446. message Lifecycle {
  447. // A lifecycle Rule, combining an action to take on an object and a
  448. // condition which will trigger that action.
  449. message Rule {
  450. // An action to take on an object.
  451. message Action {
  452. // Type of the action. Currently, only `Delete` and
  453. // `SetStorageClass` are supported.
  454. string type = 1;
  455. // Target storage class. Required iff the type of the action is
  456. // SetStorageClass.
  457. string storage_class = 2;
  458. }
  459. // A condition of an object which triggers some action.
  460. message Condition {
  461. // Age of an object (in days). This condition is satisfied when an
  462. // object reaches the specified age.
  463. // A value of 0 indicates that all objects immediately match this
  464. // condition.
  465. optional int32 age_days = 1;
  466. // This condition is satisfied when an object is created before midnight
  467. // of the specified date in UTC.
  468. google.type.Date created_before = 2;
  469. // Relevant only for versioned objects. If the value is
  470. // `true`, this condition matches live objects; if the value
  471. // is `false`, it matches archived objects.
  472. optional bool is_live = 3;
  473. // Relevant only for versioned objects. If the value is N, this
  474. // condition is satisfied when there are at least N versions (including
  475. // the live version) newer than this version of the object.
  476. optional int32 num_newer_versions = 4;
  477. // Objects having any of the storage classes specified by this condition
  478. // will be matched. Values include `MULTI_REGIONAL`, `REGIONAL`,
  479. // `NEARLINE`, `COLDLINE`, `STANDARD`, and
  480. // `DURABLE_REDUCED_AVAILABILITY`.
  481. repeated string matches_storage_class = 5;
  482. // Number of days that have elapsed since the custom timestamp set on an
  483. // object.
  484. // The value of the field must be a nonnegative integer.
  485. optional int32 days_since_custom_time = 7;
  486. // An object matches this condition if the custom timestamp set on the
  487. // object is before the specified date in UTC.
  488. google.type.Date custom_time_before = 8;
  489. // This condition is relevant only for versioned objects. An object
  490. // version satisfies this condition only if these many days have been
  491. // passed since it became noncurrent. The value of the field must be a
  492. // nonnegative integer. If it's zero, the object version will become
  493. // eligible for Lifecycle action as soon as it becomes noncurrent.
  494. optional int32 days_since_noncurrent_time = 9;
  495. // This condition is relevant only for versioned objects. An object
  496. // version satisfies this condition only if it became noncurrent before
  497. // the specified date in UTC.
  498. google.type.Date noncurrent_time_before = 10;
  499. }
  500. // The action to take.
  501. Action action = 1;
  502. // The condition(s) under which the action will be taken.
  503. Condition condition = 2;
  504. }
  505. // A lifecycle management rule, which is made of an action to take and the
  506. // condition(s) under which the action will be taken.
  507. repeated Rule rule = 1;
  508. }
  509. // Logging-related properties of a bucket.
  510. message Logging {
  511. // The destination bucket where the current bucket's logs should be placed.
  512. string log_bucket = 1;
  513. // A prefix for log object names.
  514. string log_object_prefix = 2;
  515. }
  516. // Retention policy properties of a bucket.
  517. message RetentionPolicy {
  518. // Server-determined value that indicates the time from which policy was
  519. // enforced and effective. This value is in
  520. // [https://tools.ietf.org/html/rfc3339][RFC 3339] format.
  521. google.protobuf.Timestamp effective_time = 1;
  522. // Once locked, an object retention policy cannot be modified.
  523. bool is_locked = 2;
  524. // The duration in seconds that objects need to be retained. Retention
  525. // duration must be greater than zero and less than 100 years. Note that
  526. // enforcement of retention periods less than a day is not guaranteed. Such
  527. // periods should only be used for testing purposes.
  528. int64 retention_period = 3;
  529. }
  530. // Properties of a bucket related to versioning.
  531. // For more on Cloud Storage versioning, see
  532. // https://cloud.google.com/storage/docs/object-versioning.
  533. message Versioning {
  534. // While set to true, versioning is fully enabled for this bucket.
  535. bool enabled = 1;
  536. }
  537. // Properties of a bucket related to accessing the contents as a static
  538. // website. For more on hosting a static website via Cloud Storage, see
  539. // https://cloud.google.com/storage/docs/hosting-static-website.
  540. message Website {
  541. // If the requested object path is missing, the service will ensure the path
  542. // has a trailing '/', append this suffix, and attempt to retrieve the
  543. // resulting object. This allows the creation of `index.html`
  544. // objects to represent directory pages.
  545. string main_page_suffix = 1;
  546. // If the requested object path is missing, and any
  547. // `mainPageSuffix` object is missing, if applicable, the service
  548. // will return the named object from this bucket as the content for a
  549. // [https://tools.ietf.org/html/rfc7231#section-6.5.4][404 Not Found]
  550. // result.
  551. string not_found_page = 2;
  552. }
  553. // Immutable. The name of the bucket.
  554. // Global buckets will be of the format `projects/{project}/buckets/{bucket}`.
  555. // Other sorts of buckets in the future are not guaranteed to follow this
  556. // pattern.
  557. // For globally unique bucket names, a `_` may be substituted for the project
  558. // ID.
  559. string name = 1 [(google.api.field_behavior) = IMMUTABLE];
  560. // Output only. The user-chosen part of the bucket name. The `{bucket}` portion of the
  561. // `name` field. For globally unique buckets, this is equal to the "bucket
  562. // name" of other Cloud Storage APIs. Example: "pub".
  563. string bucket_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  564. // Immutable. The project which owns this bucket.
  565. // Format: projects/{project_number}
  566. // Example: `projects/123456`.
  567. string project = 3 [
  568. (google.api.field_behavior) = IMMUTABLE,
  569. (google.api.resource_reference) = {
  570. type: "cloudresourcemanager.googleapis.com/Project"
  571. }
  572. ];
  573. // Output only. The metadata generation of this bucket.
  574. // Attempting to set or update this field will result in a
  575. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  576. int64 metageneration = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  577. // Immutable. The location of the bucket. Object data for objects in the bucket resides
  578. // in physical storage within this region. Defaults to `US`. See the
  579. // [https://developers.google.com/storage/docs/concepts-techniques#specifyinglocations"][developer's
  580. // guide] for the authoritative list. Attempting to update this field after
  581. // the bucket is created will result in an error.
  582. string location = 5 [(google.api.field_behavior) = IMMUTABLE];
  583. // Output only. The location type of the bucket (region, dual-region, multi-region, etc).
  584. string location_type = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  585. // The bucket's default storage class, used whenever no storageClass is
  586. // specified for a newly-created object. This defines how objects in the
  587. // bucket are stored and determines the SLA and the cost of storage.
  588. // If this value is not specified when the bucket is created, it will default
  589. // to `STANDARD`. For more information, see
  590. // https://developers.google.com/storage/docs/storage-classes.
  591. string storage_class = 7;
  592. // Access controls on the bucket.
  593. // If iamConfig.uniformBucketLevelAccess is enabled on this bucket,
  594. // requests to set, read, or modify acl is an error.
  595. repeated BucketAccessControl acl = 8;
  596. // Default access controls to apply to new objects when no ACL is provided.
  597. // If iamConfig.uniformBucketLevelAccess is enabled on this bucket,
  598. // requests to set, read, or modify acl is an error.
  599. repeated ObjectAccessControl default_object_acl = 9;
  600. // The bucket's lifecycle config. See
  601. // [https://developers.google.com/storage/docs/lifecycle]Lifecycle Management]
  602. // for more information.
  603. Lifecycle lifecycle = 10;
  604. // Output only. The creation time of the bucket in
  605. // [https://tools.ietf.org/html/rfc3339][RFC 3339] format.
  606. // Attempting to set or update this field will result in a
  607. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  608. google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
  609. // The bucket's [https://www.w3.org/TR/cors/][Cross-Origin Resource Sharing]
  610. // (CORS) config.
  611. repeated Cors cors = 12;
  612. // Output only. The modification time of the bucket.
  613. // Attempting to set or update this field will result in a
  614. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  615. google.protobuf.Timestamp update_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
  616. // The default value for event-based hold on newly created objects in this
  617. // bucket. Event-based hold is a way to retain objects indefinitely until an
  618. // event occurs, signified by the
  619. // hold's release. After being released, such objects will be subject to
  620. // bucket-level retention (if any). One sample use case of this flag is for
  621. // banks to hold loan documents for at least 3 years after loan is paid in
  622. // full. Here, bucket-level retention is 3 years and the event is loan being
  623. // paid in full. In this example, these objects will be held intact for any
  624. // number of years until the event has occurred (event-based hold on the
  625. // object is released) and then 3 more years after that. That means retention
  626. // duration of the objects begins from the moment event-based hold
  627. // transitioned from true to false. Objects under event-based hold cannot be
  628. // deleted, overwritten or archived until the hold is removed.
  629. bool default_event_based_hold = 14;
  630. // User-provided labels, in key/value pairs.
  631. map<string, string> labels = 15;
  632. // The bucket's website config, controlling how the service behaves
  633. // when accessing bucket contents as a web site. See the
  634. // [https://cloud.google.com/storage/docs/static-website][Static Website
  635. // Examples] for more information.
  636. Website website = 16;
  637. // The bucket's versioning config.
  638. Versioning versioning = 17;
  639. // The bucket's logging config, which defines the destination bucket
  640. // and name prefix (if any) for the current bucket's logs.
  641. Logging logging = 18;
  642. // Output only. The owner of the bucket. This is always the project team's owner group.
  643. Owner owner = 19 [(google.api.field_behavior) = OUTPUT_ONLY];
  644. // Encryption config for a bucket.
  645. Encryption encryption = 20;
  646. // The bucket's billing config.
  647. Billing billing = 21;
  648. // The bucket's retention policy. The retention policy enforces a minimum
  649. // retention time for all objects contained in the bucket, based on their
  650. // creation time. Any attempt to overwrite or delete objects younger than the
  651. // retention period will result in a PERMISSION_DENIED error. An unlocked
  652. // retention policy can be modified or removed from the bucket via a
  653. // storage.buckets.update operation. A locked retention policy cannot be
  654. // removed or shortened in duration for the lifetime of the bucket.
  655. // Attempting to remove or decrease period of a locked retention policy will
  656. // result in a PERMISSION_DENIED error.
  657. RetentionPolicy retention_policy = 22;
  658. // The bucket's IAM config.
  659. IamConfig iam_config = 23;
  660. // Immutable. The zone or zones from which the bucket is intended to use zonal quota.
  661. // Requests for data from outside the specified affinities are still allowed
  662. // but won't be able to use zonal quota. The values are case-insensitive.
  663. // Attempting to update this field after bucket is created will result in an
  664. // error.
  665. repeated string zone_affinity = 24 [(google.api.field_behavior) = IMMUTABLE];
  666. // Reserved for future use.
  667. bool satisfies_pzs = 25;
  668. }
  669. // An access-control entry.
  670. message BucketAccessControl {
  671. // The access permission for the entity.
  672. string role = 1;
  673. // The ID of the access-control entry.
  674. string id = 2;
  675. // The entity holding the permission, in one of the following forms:
  676. // * `user-{userid}`
  677. // * `user-{email}`
  678. // * `group-{groupid}`
  679. // * `group-{email}`
  680. // * `domain-{domain}`
  681. // * `project-{team-projectid}`
  682. // * `allUsers`
  683. // * `allAuthenticatedUsers`
  684. // Examples:
  685. // * The user `liz@example.com` would be `user-liz@example.com`.
  686. // * The group `example@googlegroups.com` would be
  687. // `group-example@googlegroups.com`
  688. // * All members of the Google Apps for Business domain `example.com` would be
  689. // `domain-example.com`
  690. string entity = 3;
  691. // The ID for the entity, if any.
  692. string entity_id = 4;
  693. // The email address associated with the entity, if any.
  694. string email = 5;
  695. // The domain associated with the entity, if any.
  696. string domain = 6;
  697. // The project team associated with the entity, if any.
  698. ProjectTeam project_team = 7;
  699. }
  700. // Message used to convey content being read or written, along with an optional
  701. // checksum.
  702. message ChecksummedData {
  703. // The data.
  704. bytes content = 1;
  705. // If set, the CRC32C digest of the content field.
  706. optional fixed32 crc32c = 2;
  707. }
  708. // Message used for storing full (not subrange) object checksums.
  709. message ObjectChecksums {
  710. // CRC32C digest of the object data. Computed by the Cloud Storage service for
  711. // all written objects.
  712. // If set in an WriteObjectRequest, service will validate that the stored
  713. // object matches this checksum.
  714. optional fixed32 crc32c = 1;
  715. // 128 bit MD5 hash of the object data.
  716. // For more information about using the MD5 hash, see
  717. // [https://cloud.google.com/storage/docs/hashes-etags#json-api][Hashes and
  718. // ETags: Best Practices].
  719. // Not all objects will provide an MD5 hash. For example, composite objects
  720. // provide only crc32c hashes.
  721. // This value is equivalent to running `cat object.txt | openssl md5 -binary`
  722. bytes md5_hash = 2;
  723. }
  724. // An object.
  725. message Object {
  726. // Describes the customer-specified mechanism used to store the data at rest.
  727. message CustomerEncryption {
  728. // The encryption algorithm.
  729. string encryption_algorithm = 1;
  730. // SHA256 hash value of the encryption key.
  731. string key_sha256 = 2;
  732. }
  733. // Immutable. The name of this object. Nearly any sequence of unicode characters is
  734. // valid. See
  735. // [Guidelines](https://cloud.google.com/storage/docs/naming-objects).
  736. // Example: `test.txt`
  737. // The `name` field by itself does not uniquely identify a Cloud Storage
  738. // object. A Cloud Storage object is uniquely identified by the tuple of
  739. // (bucket, object, generation).
  740. string name = 1 [(google.api.field_behavior) = IMMUTABLE];
  741. // Immutable. The name of the bucket containing this object.
  742. // Example: `projects/_/buckets/foo`.
  743. string bucket = 2 [
  744. (google.api.field_behavior) = IMMUTABLE,
  745. (google.api.resource_reference) = {
  746. type: "storage.googleapis.com/Bucket"
  747. }
  748. ];
  749. // Immutable. The content generation of this object. Used for object versioning.
  750. // Attempting to set or update this field will result in a
  751. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  752. int64 generation = 3 [(google.api.field_behavior) = IMMUTABLE];
  753. // Output only. The version of the metadata for this generation of this object. Used for
  754. // preconditions and for detecting changes in metadata. A metageneration
  755. // number is only meaningful in the context of a particular generation of a
  756. // particular object.
  757. // Attempting to set or update this field will result in a
  758. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  759. int64 metageneration = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  760. // Storage class of the object.
  761. string storage_class = 5;
  762. // Output only. Content-Length of the object data in bytes, matching
  763. // [https://tools.ietf.org/html/rfc7230#section-3.3.2][RFC 7230 §3.3.2].
  764. // Attempting to set or update this field will result in a
  765. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  766. int64 size = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  767. // Content-Encoding of the object data, matching
  768. // [https://tools.ietf.org/html/rfc7231#section-3.1.2.2][RFC 7231 §3.1.2.2]
  769. string content_encoding = 7;
  770. // Content-Disposition of the object data, matching
  771. // [https://tools.ietf.org/html/rfc6266][RFC 6266].
  772. string content_disposition = 8;
  773. // Cache-Control directive for the object data, matching
  774. // [https://tools.ietf.org/html/rfc7234#section-5.2"][RFC 7234 §5.2].
  775. // If omitted, and the object is accessible to all anonymous users, the
  776. // default will be `public, max-age=3600`.
  777. string cache_control = 9;
  778. // Access controls on the object.
  779. // If iamConfig.uniformBucketLevelAccess is enabled on the parent
  780. // bucket, requests to set, read, or modify acl is an error.
  781. repeated ObjectAccessControl acl = 10;
  782. // Content-Language of the object data, matching
  783. // [https://tools.ietf.org/html/rfc7231#section-3.1.3.2][RFC 7231 §3.1.3.2].
  784. string content_language = 11;
  785. // Output only. The deletion time of the object. Will be returned if and only if this
  786. // version of the object has been deleted.
  787. // Attempting to set or update this field will result in a
  788. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  789. google.protobuf.Timestamp delete_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
  790. // Content-Type of the object data, matching
  791. // [https://tools.ietf.org/html/rfc7231#section-3.1.1.5][RFC 7231 §3.1.1.5].
  792. // If an object is stored without a Content-Type, it is served as
  793. // `application/octet-stream`.
  794. string content_type = 13;
  795. // Output only. The creation time of the object.
  796. // Attempting to set or update this field will result in a
  797. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  798. google.protobuf.Timestamp create_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY];
  799. // Output only. Number of underlying components that make up this object. Components are
  800. // accumulated by compose operations.
  801. // Attempting to set or update this field will result in a
  802. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  803. int32 component_count = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
  804. // Output only. Hashes for the data part of this object.
  805. ObjectChecksums checksums = 16 [(google.api.field_behavior) = OUTPUT_ONLY];
  806. // Output only. The modification time of the object metadata.
  807. // Attempting to set or update this field will result in a
  808. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  809. google.protobuf.Timestamp update_time = 17 [(google.api.field_behavior) = OUTPUT_ONLY];
  810. // Cloud KMS Key used to encrypt this object, if the object is encrypted by
  811. // such a key.
  812. string kms_key = 18 [(google.api.resource_reference) = {
  813. type: "cloudkms.googleapis.com/CryptoKey"
  814. }];
  815. // Output only. The time at which the object's storage class was last changed. When the
  816. // object is initially created, it will be set to time_created.
  817. // Attempting to set or update this field will result in a
  818. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  819. google.protobuf.Timestamp update_storage_class_time = 19 [(google.api.field_behavior) = OUTPUT_ONLY];
  820. // Whether an object is under temporary hold. While this flag is set to true,
  821. // the object is protected against deletion and overwrites. A common use case
  822. // of this flag is regulatory investigations where objects need to be retained
  823. // while the investigation is ongoing. Note that unlike event-based hold,
  824. // temporary hold does not impact retention expiration time of an object.
  825. bool temporary_hold = 20;
  826. // A server-determined value that specifies the earliest time that the
  827. // object's retention period expires. This value is in
  828. // [https://tools.ietf.org/html/rfc3339][RFC 3339] format.
  829. // Note 1: This field is not provided for objects with an active event-based
  830. // hold, since retention expiration is unknown until the hold is removed.
  831. // Note 2: This value can be provided even when temporary hold is set (so that
  832. // the user can reason about policy without having to first unset the
  833. // temporary hold).
  834. google.protobuf.Timestamp retention_expire_time = 21;
  835. // User-provided metadata, in key/value pairs.
  836. map<string, string> metadata = 22;
  837. // Whether an object is under event-based hold.
  838. // An event-based hold is a way to force the retention of an object until
  839. // after some event occurs. Once the hold is released by explicitly setting
  840. // this field to false, the object will become subject to any bucket-level
  841. // retention policy, except that the retention duration will be calculated
  842. // from the time the event based hold was lifted, rather than the time the
  843. // object was created.
  844. //
  845. // In a WriteObject request, not setting this field implies that the value
  846. // should be taken from the parent bucket's "default_event_based_hold" field.
  847. // In a response, this field will always be set to true or false.
  848. optional bool event_based_hold = 23;
  849. // Output only. The owner of the object. This will always be the uploader of the object.
  850. // Attempting to set or update this field will result in a
  851. // [FieldViolation][google.rpc.BadRequest.FieldViolation].
  852. Owner owner = 24 [(google.api.field_behavior) = OUTPUT_ONLY];
  853. // Metadata of customer-supplied encryption key, if the object is encrypted by
  854. // such a key.
  855. CustomerEncryption customer_encryption = 25;
  856. // A user-specified timestamp set on an object.
  857. google.protobuf.Timestamp custom_time = 26;
  858. }
  859. // An access-control entry.
  860. message ObjectAccessControl {
  861. // The access permission for the entity.
  862. string role = 1;
  863. // The ID of the access-control entry.
  864. string id = 2;
  865. // The entity holding the permission, in one of the following forms:
  866. // * `user-{userid}`
  867. // * `user-{email}`
  868. // * `group-{groupid}`
  869. // * `group-{email}`
  870. // * `domain-{domain}`
  871. // * `project-{team-projectid}`
  872. // * `allUsers`
  873. // * `allAuthenticatedUsers`
  874. // Examples:
  875. // * The user `liz@example.com` would be `user-liz@example.com`.
  876. // * The group `example@googlegroups.com` would be
  877. // `group-example@googlegroups.com`.
  878. // * All members of the Google Apps for Business domain `example.com` would be
  879. // `domain-example.com`.
  880. string entity = 3;
  881. // The ID for the entity, if any.
  882. string entity_id = 4;
  883. // The email address associated with the entity, if any.
  884. string email = 5;
  885. // The domain associated with the entity, if any.
  886. string domain = 6;
  887. // The project team associated with the entity, if any.
  888. ProjectTeam project_team = 7;
  889. }
  890. // Represents the Viewers, Editors, or Owners of a given project.
  891. message ProjectTeam {
  892. // The project number.
  893. string project_number = 1;
  894. // The team.
  895. string team = 2;
  896. }
  897. // The owner of a specific resource.
  898. message Owner {
  899. // The entity, in the form `user-`*userId*.
  900. string entity = 1;
  901. // The ID for the entity.
  902. string entity_id = 2;
  903. }
  904. // Specifies a requested range of bytes to download.
  905. message ContentRange {
  906. // The starting offset of the object data.
  907. int64 start = 1;
  908. // The ending offset of the object data.
  909. int64 end = 2;
  910. // The complete length of the object data.
  911. int64 complete_length = 3;
  912. }
  913. // Predefined or "canned" aliases for sets of specific object ACL entries.
  914. enum PredefinedObjectAcl {
  915. // No predefined ACL.
  916. PREDEFINED_OBJECT_ACL_UNSPECIFIED = 0;
  917. // Object owner gets `OWNER` access, and
  918. // `allAuthenticatedUsers` get `READER` access.
  919. OBJECT_ACL_AUTHENTICATED_READ = 1;
  920. // Object owner gets `OWNER` access, and project team owners get
  921. // `OWNER` access.
  922. OBJECT_ACL_BUCKET_OWNER_FULL_CONTROL = 2;
  923. // Object owner gets `OWNER` access, and project team owners get
  924. // `READER` access.
  925. OBJECT_ACL_BUCKET_OWNER_READ = 3;
  926. // Object owner gets `OWNER` access.
  927. OBJECT_ACL_PRIVATE = 4;
  928. // Object owner gets `OWNER` access, and project team members get
  929. // access according to their roles.
  930. OBJECT_ACL_PROJECT_PRIVATE = 5;
  931. // Object owner gets `OWNER` access, and `allUsers`
  932. // get `READER` access.
  933. OBJECT_ACL_PUBLIC_READ = 6;
  934. }