Updating MSOpenTech/azure-sdk-for-go to latest master
Signed-off-by: Frederick F. Kautz IV <fkautz@alumni.cmu.edu>
This commit is contained in:
parent
60dedc5178
commit
11db8185bc
14 changed files with 20 additions and 18 deletions
|
@ -56,33 +56,35 @@ type StorageServiceError struct {
|
|||
|
||||
// NewBasicClient constructs a StorageClient with given storage service name
|
||||
// and key.
|
||||
func NewBasicClient(accountName, accountKey string) (*StorageClient, error) {
|
||||
func NewBasicClient(accountName, accountKey string) (StorageClient, error) {
|
||||
return NewClient(accountName, accountKey, DefaultBaseUrl, DefaultApiVersion, defaultUseHttps)
|
||||
}
|
||||
|
||||
// NewClient constructs a StorageClient. This should be used if the caller
|
||||
// wants to specify whether to use HTTPS, a specific REST API version or a
|
||||
// custom storage endpoint than Azure Public Cloud.
|
||||
func NewClient(accountName, accountKey, blobServiceBaseUrl, apiVersion string, useHttps bool) (*StorageClient, error) {
|
||||
func NewClient(accountName, accountKey, blobServiceBaseUrl, apiVersion string, useHttps bool) (StorageClient, error) {
|
||||
var c StorageClient
|
||||
if accountName == "" {
|
||||
return nil, fmt.Errorf("azure: account name required")
|
||||
return c, fmt.Errorf("azure: account name required")
|
||||
} else if accountKey == "" {
|
||||
return nil, fmt.Errorf("azure: account key required")
|
||||
return c, fmt.Errorf("azure: account key required")
|
||||
} else if blobServiceBaseUrl == "" {
|
||||
return nil, fmt.Errorf("azure: base storage service url required")
|
||||
return c, fmt.Errorf("azure: base storage service url required")
|
||||
}
|
||||
|
||||
key, err := base64.StdEncoding.DecodeString(accountKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return c, err
|
||||
}
|
||||
|
||||
return &StorageClient{
|
||||
return StorageClient{
|
||||
accountName: accountName,
|
||||
accountKey: key,
|
||||
useHttps: useHttps,
|
||||
baseUrl: blobServiceBaseUrl,
|
||||
apiVersion: apiVersion}, nil
|
||||
apiVersion: apiVersion,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c StorageClient) getBaseUrl(service string) string {
|
Loading…
Add table
Add a link
Reference in a new issue