Azure / azure-storage-blob-go

Microsoft Azure Blob Storage Library for Go
MIT License
157 stars 102 forks source link

serviceURL.SetProperties always fails for non-empty properties #302

Open landrew3 opened 3 years ago

landrew3 commented 3 years ago

Which version of the SDK was used?

v0.14.0

Which platform are you using? (ex: Windows, Linux, Debian)

Centos 7

What problem was encountered?

Attempting to Set Blob Service Properties will fail with any set of properties except an empty one. Note, this is the same issue as #166 ,which was said to be fixed in a version after v0.8.0. Error message Produced:

        validation failed: parameter=storageServiceProperties.Logging.RetentionPolicy constraint=Null value=azblob.RetentionPolicy{Enabled:true, Days:(*int32)(0xc0058426c8), AllowPermanentDelete:(*bool)(nil)} details: field "storageServiceProperties.Logging.RetentionPolicy" doesn't exist 

How can we reproduce the problem in the simplest way?

days := int32(5)
serviceProperties := azblob.StorageServiceProperties{Logging: &azblob.Logging{Version: "1.0", Read: true, Write: true, Delete: true, RetentionPolicy: azblob.RetentionPolicy{Enabled: true, Days: &days}}}

_, err := serviceURL.SetProperties(context.Background(), serviceProperties)
if err != nil {
    return fmt.Printf("Error setting account Properties: %v\n", err)
}

Have you found a mitigation/solution?

SetProperties will succeed with serviceProperties=azblob.StorageServiceProperties{} but that is obviously not very useful.