+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
package main
import (
type AzureBlobVolume struct {
StorageAccountName string
StorageAccountKeyFile string
+ StorageBaseURL string // "" means default, "core.windows.net"
ContainerName string
AzureReplication int
ReadOnly bool
AzureReplication: 3,
RequestTimeout: azureDefaultRequestTimeout,
},
+ &AzureBlobVolume{
+ StorageAccountName: "cn-account-name",
+ StorageAccountKeyFile: "/etc/azure_cn_storage_account_key.txt",
+ StorageBaseURL: "core.chinacloudapi.cn",
+ ContainerName: "cn-container-name",
+ AzureReplication: 3,
+ RequestTimeout: azureDefaultRequestTimeout,
+ },
}
}
if err != nil {
return err
}
- v.azClient, err = storage.NewBasicClient(v.StorageAccountName, accountKey)
+ if v.StorageBaseURL == "" {
+ v.StorageBaseURL = storage.DefaultBaseURL
+ }
+ v.azClient, err = storage.NewClient(v.StorageAccountName, accountKey, v.StorageBaseURL, storage.DefaultAPIVersion, true)
if err != nil {
return fmt.Errorf("creating Azure storage client: %s", err)
}
return nil
}
+// DeviceID returns a globally unique ID for the storage container.
+func (v *AzureBlobVolume) DeviceID() string {
+ return "azure://" + v.StorageBaseURL + "/" + v.StorageAccountName + "/" + v.ContainerName
+}
+
// Return true if expires_at metadata attribute is found on the block
func (v *AzureBlobVolume) checkTrashed(loc string) (bool, map[string]string, error) {
metadata, err := v.bsClient.GetBlobMetadata(v.ContainerName, loc)