azure: fix for breaking change in blob.GetSASURI

Signed-off-by: Steve Kriss <steve@heptio.com>
pull/799/head
Steve Kriss 2018-08-23 16:14:37 -07:00
parent a440029c2f
commit cd4e9f5336
1 changed files with 10 additions and 3 deletions

View File

@ -147,8 +147,6 @@ func (o *objectStore) DeleteObject(bucket string, key string) error {
return errors.WithStack(blob.Delete(nil)) return errors.WithStack(blob.Delete(nil))
} }
const sasURIReadPermission = "r"
func (o *objectStore) CreateSignedURL(bucket, key string, ttl time.Duration) (string, error) { func (o *objectStore) CreateSignedURL(bucket, key string, ttl time.Duration) (string, error) {
container, err := getContainerReference(o.blobClient, bucket) container, err := getContainerReference(o.blobClient, bucket)
if err != nil { if err != nil {
@ -160,7 +158,16 @@ func (o *objectStore) CreateSignedURL(bucket, key string, ttl time.Duration) (st
return "", err return "", err
} }
return blob.GetSASURI(time.Now().Add(ttl), sasURIReadPermission) opts := storage.BlobSASOptions{
SASOptions: storage.SASOptions{
Expiry: time.Now().Add(ttl),
},
BlobServiceSASPermissions: storage.BlobServiceSASPermissions{
Read: true,
},
}
return blob.GetSASURI(opts)
} }
func getContainerReference(blobClient *storage.BlobStorageClient, bucket string) (*storage.Container, error) { func getContainerReference(blobClient *storage.BlobStorageClient, bucket string) (*storage.Container, error) {