Skip to content

Commit

Permalink
Update to new Azure code after dep update
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferai committed Apr 17, 2017
1 parent f698db4 commit 56de4b2
Show file tree
Hide file tree
Showing 25 changed files with 99 additions and 231 deletions.
22 changes: 17 additions & 5 deletions physical/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

log "github.com/mgutz/logxi/v1"

"github.com/Azure/azure-sdk-for-go/storage"
"github.com/Azure/azure-storage-go"
"github.com/armon/go-metrics"
"github.com/hashicorp/errwrap"
)
Expand Down Expand Up @@ -59,12 +59,23 @@ func newAzureBackend(conf map[string]string, logger log.Logger) (Backend, error)
}

client, err := storage.NewBasicClient(accountName, accountKey)

if err != nil {
return nil, fmt.Errorf("Failed to create Azure client: %v", err)
return nil, fmt.Errorf("failed to create Azure client: %v", err)
}

client.GetBlobService().CreateContainerIfNotExists(container, storage.ContainerAccessTypePrivate)
contObj := client.GetBlobService().GetContainerReference(container)
created, err := contObj.CreateIfNotExists()
if err != nil {
return nil, fmt.Errorf("failed to upsert container: %v", err)
}
if created {
err = contObj.SetPermissions(storage.ContainerPermissions{
AccessType: storage.ContainerAccessTypePrivate,
}, 0, "")
if err != nil {
return nil, fmt.Errorf("failed to set permissions on newly-created container: %v", err)
}
}

maxParStr, ok := conf["max_parallel"]
var maxParInt int
Expand Down Expand Up @@ -156,7 +167,8 @@ func (a *AzureBackend) List(prefix string) ([]string, error) {
a.permitPool.Acquire()
defer a.permitPool.Release()

list, err := a.client.ListBlobs(a.container, storage.ListBlobsParameters{Prefix: prefix})
contObj := a.client.GetContainerReference(a.container)
list, err := contObj.ListBlobs(storage.ListBlobsParameters{Prefix: prefix})

if err != nil {
// Break early.
Expand Down
202 changes: 0 additions & 202 deletions vendor/github.com/Azure/azure-sdk-for-go/LICENSE

This file was deleted.

21 changes: 21 additions & 0 deletions vendor/github.com/Azure/azure-storage-go/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions vendor/github.com/Azure/azure-storage-go/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/github.com/Azure/azure-storage-go/glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vendor/github.com/Azure/azure-storage-go/glide.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 56de4b2

Please sign in to comment.