-
Notifications
You must be signed in to change notification settings - Fork 850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provide missing SetBlobProperties function and add missing properties to GetBlobProperties #374
Conversation
Hi @schreibe72, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
@schreibe72 thank you for your pull request, please ping me once you signed the CLA and I'll review. |
@ahmetalpbalkan I have signed the CLA and send via DocuSign. |
@schreibe72 I guess there is a processing delay in that case, we can come back to that later. I'll leave some comments now. |
@@ -122,6 +125,16 @@ type BlobProperties struct { | |||
LeaseStatus string `xml:"LeaseStatus"` | |||
} | |||
|
|||
// ContentSetting contains various properties of a blob and is an entry | |||
// in SetBlobProperties | |||
type ContentSetting struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe call this BlobHeaders? (more about this below)
It looks like Set Blob Properties and Get Blob Properties (+List Blobs) work a bit weird as in "Set" accepts x-ms-* headers and "Get/List" return XML fields named properly. Therefore it appears like using the same struct both on response deserialization path from 'Get/List' and as headers in 'Set' is going to be a bit challenging. |
@schreibe72 just got this crazy idea. What if we annotate this This way:
|
extract struct to map conversion to an extra function headersFromStruct
@@ -590,6 +602,8 @@ func (b BlobStorageClient) GetBlobProperties(container, name string) (*BlobPrope | |||
ContentLength: contentLength, | |||
ContentEncoding: resp.headers.Get("Content-Encoding"), | |||
ContentType: resp.headers.Get("Content-Type"), | |||
CacheControl: resp.headers.Get("Cache-Control"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schreibe72 thanks for making the changes. I think we should somehow embed BlobHeaders struct into BlobProperties struct and have some deserializer that does map-->struct. I feel like it might be a lot of work whereas this patch is probably solving your problem. What do you think?
i would split this in to two pull requests. One is for the new function setBlobProperties, the other for refactoring getBlobProperties. |
@schreibe72 fair point. Thanks. |
Add following properties to GetBlobProperties:
Add function SetBlobProperties to set ContentSettings like:
Add Test for SetBlobProperties.