googleapis / googleapis/google-cloud-go
storage: return ETag, Storage Class, and possibly Metadata in the Reader
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 109
Description
Related Issue: https://github.com/googleapis/google-cloud-go/issues/1105
**Is your feature request related to a problem? Please describe.**
Please expose `ETag` and `Storage Class` in the Reader. These two information is returned in the original JSON and XML API response when downloading an object. XML API response in particular is even nicer as it contains the `Last-Modified` and `Metadata` information which are not available in the JSON API response.
However, these information is missing from `ReaderObjectAttrs`. Calling an extra API call to get the full information would be inefficient and unnecessary as these information is already available from the response headers.
Thanks!
#### JSON API
```
< HTTP/1.1 200 OK
< X-GUploader-UploadID: [REDACTED]
< Content-Type: text/plain
< X-Goog-Generation: [REDACTED]
< X-Goog-Metageneration: 1
< X-Goog-Storage-Class: STANDARD
< Pragma: no-cache
< Expires: Mon, 01 Jan 1990 00:00:00 GMT
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< X-Goog-Hash: [REDACTED]
< ETag: [REDACTED]
< Content-Disposition: attachment
< Date: Thu, 13 Aug 2020 23:52:13 GMT
< Vary: Origin
< Vary: X-Origin
< Content-Length: 26
< Server: UploadServer
...
```
#### XML API
```< HTTP/1.1 200 OK
< X-GUploader-UploadID: [REDACTED]
< Expires: Fri, 14 Aug 2020 00:09:53 GMT
< Date: Fri, 14 Aug 2020 00:09:53 GMT
< Cache-Control: private, max-age=0
< Last-Modified: Thu, 13 Aug 2020 23:51:45 GMT
< ETag: [REDACTED]
< x-goog-generation: [REDACTED]
< x-goog-metageneration: 1
< x-goog-stored-content-encoding: identity
< x-goog-stored-content-length: 26
< x-goog-meta-foo: bar
< x-goog-meta-bar: baz
< Content-Type: text/plain
< x-goog-hash: [REDACTED]
< x-goog-hash: [REDACTED]
< x-goog-storage-class: STANDARD
< Accept-Ranges: bytes
< Content-Length: 26
< Server: UploadServer
...
```
**Describe the solution you'd like**
Support returning important object information in `ReaderObjectAttrs` if this info is readily available without having to make an extra API call.
Contributor guide
Assessment
This issue has not been assessed yet.