azblob: rename method to initialize from SAS URL

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2022-10-02 15:03:38 +02:00
parent 8a43486730
commit 2067c5c527
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF

View file

@ -100,7 +100,7 @@ func NewAzBlobFs(connectionID, localTempDir, mountPath string, config AzBlobFsCo
fs.setConfigDefaults()
if fs.config.SASURL.GetPayload() != "" {
return fs.initFsFromSASURL()
return fs.initFromSASURL()
}
credential, err := azblob.NewSharedKeyCredential(fs.config.AccountName, fs.config.AccountKey.GetPayload())
@ -122,7 +122,7 @@ func NewAzBlobFs(connectionID, localTempDir, mountPath string, config AzBlobFsCo
return fs, err
}
func (fs *AzureBlobFs) initFsFromSASURL() (Fs, error) {
func (fs *AzureBlobFs) initFromSASURL() (Fs, error) {
parts, err := azblob.ParseURL(fs.config.SASURL.GetPayload())
if err != nil {
return fs, fmt.Errorf("invalid SAS URL: %w", err)
@ -132,7 +132,7 @@ func (fs *AzureBlobFs) initFsFromSASURL() (Fs, error) {
}
if parts.ContainerName != "" {
if fs.config.Container != "" && fs.config.Container != parts.ContainerName {
return fs, fmt.Errorf("container name in SAS URL %#v and container provided %#v do not match",
return fs, fmt.Errorf("container name in SAS URL %q and container provided %q do not match",
parts.ContainerName, fs.config.Container)
}
svc, err := container.NewClientWithNoCredential(fs.config.SASURL.GetPayload(), getAzContainerClientOptions())