Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (raw rawBenchmarkCmdArgs) appendVirtualDir(target, virtualDir string) (stri
p.BlobName = virtualDir
return p.String(), err

case common.ELocation.File(), common.ELocation.FileNFS():
case common.ELocation.FileSMB(), common.ELocation.FileNFS():
p, err := sharefile.ParseURL(target)
if err != nil {
return "", fmt.Errorf("error parsing the url %s. Failed with error %s", target, err.Error())
Expand Down Expand Up @@ -229,8 +229,8 @@ func (raw rawBenchmarkCmdArgs) createCleanupJobArgs(benchmarkDest common.Resourc
switch InferArgumentLocation(rc.src) {
case common.ELocation.Blob():
rc.fromTo = common.EFromTo.BlobTrash().String()
case common.ELocation.File(), common.ELocation.FileNFS():
rc.fromTo = common.EFromTo.FileTrash().String()
case common.ELocation.FileSMB(), common.ELocation.FileNFS():
rc.fromTo = common.EFromTo.FileSMBTrash().String()
case common.ELocation.BlobFS():
rc.fromTo = common.EFromTo.BlobFSTrash().String()
default:
Expand Down
4 changes: 2 additions & 2 deletions cmd/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ func (raw *rawCopyCmdArgs) setMandatoryDefaults() {
}

func validateForceIfReadOnly(toForce bool, fromTo common.FromTo) error {
targetIsFiles := (fromTo.To() == common.ELocation.File() || fromTo.To() == common.ELocation.FileNFS()) ||
fromTo == common.EFromTo.FileTrash()
targetIsFiles := (fromTo.To() == common.ELocation.FileSMB() || fromTo.To() == common.ELocation.FileNFS()) ||
fromTo == common.EFromTo.FileSMBTrash()
targetIsWindowsFS := fromTo.To() == common.ELocation.Local() &&
runtime.GOOS == "windows"
targetIsOK := targetIsFiles || targetIsWindowsFS
Expand Down
8 changes: 4 additions & 4 deletions cmd/copyEnumeratorInit.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func (cca *CookedCopyCmdArgs) createDstContainer(containerName string, dstWithSA
return nil
}
return err
case common.ELocation.File(), common.ELocation.FileNFS():
case common.ELocation.FileSMB(), common.ELocation.FileNFS():
fsc, _ := sc.FileServiceClient()
sc := fsc.NewShareClient(containerName)

Expand Down Expand Up @@ -614,7 +614,7 @@ func pathEncodeRules(path string, fromTo common.FromTo, disableAutoDecoding bool

// If downloading on Windows or uploading to files, encode unsafe characters.
if (loc == common.ELocation.Local() && !source && runtime.GOOS == "windows") ||
(!source && (loc == common.ELocation.File() || loc == common.ELocation.FileNFS())) {
(!source && (loc == common.ELocation.FileSMB() || loc == common.ELocation.FileNFS())) {
// invalidChars := `<>\/:"|?*` + string(0x00)

for k, c := range encodedInvalidCharacters {
Expand All @@ -625,7 +625,7 @@ func pathEncodeRules(path string, fromTo common.FromTo, disableAutoDecoding bool

// If uploading from Windows or downloading from files, decode unsafe chars if user enables decoding
} else if ((!source && fromTo.From() == common.ELocation.Local() && runtime.GOOS == "windows") ||
(!source && (fromTo.From() == common.ELocation.File() || fromTo.From() == common.ELocation.FileNFS()))) && !disableAutoDecoding {
(!source && (fromTo.From() == common.ELocation.FileSMB() || fromTo.From() == common.ELocation.FileNFS()))) && !disableAutoDecoding {

for encoded, c := range reverseEncodedChars {
for k, p := range pathParts {
Expand Down Expand Up @@ -739,7 +739,7 @@ func NewFolderPropertyOption(fromTo common.FromTo, recursive, stripTopDir bool,
}

bothFolderAware := (fromTo.AreBothFolderAware() || preservePosixProperties || preservePermissions || includeDirectoryStubs) && !isDstNull
isRemoveFromFolderAware := fromTo == common.EFromTo.FileTrash()
isRemoveFromFolderAware := fromTo == common.EFromTo.FileSMBTrash()
if bothFolderAware || isRemoveFromFolderAware {
if !recursive {
return common.EFolderPropertiesOption.NoFolders(), // doesn't make sense to move folders when not recursive. E.g. if invoked with /* and WITHOUT recursive
Expand Down
12 changes: 6 additions & 6 deletions cmd/copyValidation.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (cooked *CookedCopyCmdArgs) validate() (err error) {
return err
}

allowAutoDecompress := cooked.FromTo == common.EFromTo.BlobLocal() || cooked.FromTo == common.EFromTo.FileLocal() || cooked.FromTo == common.EFromTo.FileNFSLocal()
allowAutoDecompress := cooked.FromTo == common.EFromTo.BlobLocal() || cooked.FromTo == common.EFromTo.FileSMBLocal() || cooked.FromTo == common.EFromTo.FileNFSLocal()
if cooked.autoDecompress && !allowAutoDecompress {
return errors.New("automatic decompression is only supported for downloads from Blob and Azure Files") // as at Sept 2019, our ADLS Gen 2 Swagger does not include content-encoding for directory (path) listings so we can't support it there
}
Expand Down Expand Up @@ -159,7 +159,7 @@ func (cooked *CookedCopyCmdArgs) validate() (err error) {
if cooked.s2sSourceChangeValidation {
return fmt.Errorf("s2s-detect-source-changed is not supported while uploading to Blob Storage")
}
case common.EFromTo.LocalFile(), common.EFromTo.LocalFileNFS():
case common.EFromTo.LocalFileSMB(), common.EFromTo.LocalFileNFS():
if cooked.preserveLastModifiedTime {
return fmt.Errorf("preserve-last-modified-time is not supported while uploading")
}
Expand All @@ -183,7 +183,7 @@ func (cooked *CookedCopyCmdArgs) validate() (err error) {
return fmt.Errorf("blob-type is not supported on Azure File")
}
case common.EFromTo.BlobLocal(),
common.EFromTo.FileLocal(),
common.EFromTo.FileSMBLocal(),
common.EFromTo.FileNFSLocal(),
common.EFromTo.BlobFSLocal():
if cooked.SymlinkHandling.Follow() {
Expand Down Expand Up @@ -211,11 +211,11 @@ func (cooked *CookedCopyCmdArgs) validate() (err error) {
if cooked.s2sSourceChangeValidation {
return fmt.Errorf("s2s-detect-source-changed is not supported while downloading")
}
case common.EFromTo.BlobFile(),
case common.EFromTo.BlobFileSMB(),
common.EFromTo.S3Blob(),
common.EFromTo.BlobBlob(),
common.EFromTo.FileBlob(),
common.EFromTo.FileFile(),
common.EFromTo.FileSMBBlob(),
common.EFromTo.FileSMBFileSMB(),
common.EFromTo.GCPBlob(),
common.EFromTo.FileNFSFileNFS():

Expand Down
4 changes: 2 additions & 2 deletions cmd/credentialUtil.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func checkAuthSafeForTarget(ct common.CredentialType, resource, extraSuffixesAAD
common.ECredentialType.MDOAuthToken(),
common.ECredentialType.SharedKey():
// Files doesn't currently support OAuth, but it's a valid azure endpoint anyway, so it'll pass the check.
if resourceType != common.ELocation.Blob() && resourceType != common.ELocation.BlobFS() && resourceType != common.ELocation.File() && resourceType != common.ELocation.FileNFS() {
if resourceType != common.ELocation.Blob() && resourceType != common.ELocation.BlobFS() && resourceType != common.ELocation.FileSMB() && resourceType != common.ELocation.FileNFS() {
// There may be a reason for files->blob to specify this.
if resourceType == common.ELocation.Local() {
return nil
Expand Down Expand Up @@ -552,7 +552,7 @@ func getCredentialType(ctx context.Context, raw rawFromToInfo, cpkOptions common
credType, _, err = getCredentialTypeForLocation(ctx, raw.fromTo.To(), raw.destination, false, common.CpkOptions{})
case raw.fromTo == common.EFromTo.BlobTrash() ||
raw.fromTo == common.EFromTo.BlobFSTrash() ||
raw.fromTo == common.EFromTo.FileTrash():
raw.fromTo == common.EFromTo.FileSMBTrash():
// For to Trash direction, use source as resource URL
// Also, by setting isSource=false we inform getCredentialTypeForLocation() that resource
// being deleted cannot be public.
Expand Down
22 changes: 11 additions & 11 deletions cmd/flagsValidation.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ func validatePreserveSMBPropertyOption(toPreserve bool, fromTo common.FromTo, fl
(fromTo == common.EFromTo.BlobBlob() || fromTo == common.EFromTo.BlobFSBlob() || fromTo == common.EFromTo.BlobBlobFS() || fromTo == common.EFromTo.BlobFSBlobFS()) {
// the user probably knows what they're doing if they're trying to persist permissions between blob-type endpoints.
return nil
} else if toPreserve && !(fromTo == common.EFromTo.LocalFile() ||
fromTo == common.EFromTo.FileLocal() ||
fromTo == common.EFromTo.FileFile()) {
} else if toPreserve && !(fromTo == common.EFromTo.LocalFileSMB() ||
fromTo == common.EFromTo.FileSMBLocal() ||
fromTo == common.EFromTo.FileSMBFileSMB()) {
return fmt.Errorf("%s is set but the job is not between %s-aware resources", flagName, common.Iff(flagName == PreservePermissionsFlag, "permission", "SMB"))
}

Expand Down Expand Up @@ -94,9 +94,9 @@ func areBothLocationsSMBAware(fromTo common.FromTo) bool {
// 2. Download (Azure File -> Windows/Linux)
// 3. S2S (Azure File -> Azure File)
if (runtime.GOOS == "windows" || runtime.GOOS == "linux") &&
(fromTo == common.EFromTo.LocalFile() || fromTo == common.EFromTo.FileLocal()) {
(fromTo == common.EFromTo.LocalFileSMB() || fromTo == common.EFromTo.FileSMBLocal()) {
return true
} else if fromTo == common.EFromTo.FileFile() {
} else if fromTo == common.EFromTo.FileSMBFileSMB() {
return true
} else {
return false
Expand Down Expand Up @@ -279,20 +279,20 @@ func validateShareProtocolCompatibility(
return nil
}

direction := "from"
location, direction := "source", "from"
if !isSource {
direction = "to"
location, direction = "destination", "to"
}

// We can ignore the error if we fail to get the share properties.
shareProtocol, _ := getShareProtocolType(ctx, serviceClient, resource, protocol)

if shareProtocol == "SMB" && common.IsNFSCopy() {
return fmt.Errorf("The %s share has SMB protocol enabled. To copy %s a SMB share, use the appropriate --from-to flag value", direction, direction)
return fmt.Errorf("The %s share has SMB protocol enabled. To copy %s a SMB share, use the appropriate --from-to flag value", location, direction)
}

if shareProtocol == "NFS" && !common.IsNFSCopy() {
return fmt.Errorf("The %s share has NFS protocol enabled. To copy %s a NFS share, use the appropriate --from-to flag value", direction, direction)
return fmt.Errorf("The %s share has NFS protocol enabled. To copy %s a NFS share, use the appropriate --from-to flag value", location, direction)
}

return nil
Expand Down Expand Up @@ -337,7 +337,7 @@ func validateProtocolCompatibility(ctx context.Context, fromTo common.FromTo, sr

getUploadDownloadProtocol := func(fromTo common.FromTo) string {
switch fromTo {
case common.EFromTo.LocalFile(), common.EFromTo.FileLocal():
case common.EFromTo.LocalFileSMB(), common.EFromTo.FileSMBLocal():
return "SMB"
case common.EFromTo.LocalFileNFS(), common.EFromTo.FileNFSLocal():
return "NFS"
Expand All @@ -351,7 +351,7 @@ func validateProtocolCompatibility(ctx context.Context, fromTo common.FromTo, sr
// S2S Transfers
if fromTo.IsS2S() {
switch fromTo {
case common.EFromTo.FileFile():
case common.EFromTo.FileSMBFileSMB():
protocol = "SMB"
case common.EFromTo.FileNFSFileNFS():
protocol = "NFS"
Expand Down
6 changes: 3 additions & 3 deletions cmd/jobsResume.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func (rca resumeCmdArgs) getSourceAndDestinationServiceClients(
}

var fileSrcClientOptions any
if fromTo.From() == common.ELocation.File() || fromTo.From() == common.ELocation.FileNFS() {
if fromTo.From() == common.ELocation.FileSMB() || fromTo.From() == common.ELocation.FileNFS() {
fileSrcClientOptions = &common.FileClientOptions{
AllowTrailingDot: getJobDetailsResponse.TrailingDot.IsEnabled(), //Access the trailingDot option of the job
}
Expand All @@ -334,9 +334,9 @@ func (rca resumeCmdArgs) getSourceAndDestinationServiceClients(
}
options = createClientOptions(common.AzcopyCurrentJobLogger, srcCred, common.Iff(dstCredType.IsAzureOAuth(), reauthTok, nil))
var fileClientOptions any
if fromTo.To() == common.ELocation.File() || fromTo.To() == common.ELocation.FileNFS() {
if fromTo.To() == common.ELocation.FileSMB() || fromTo.To() == common.ELocation.FileNFS() {
fileClientOptions = &common.FileClientOptions{
AllowSourceTrailingDot: getJobDetailsResponse.TrailingDot.IsEnabled() && fromTo.From() == common.ELocation.File(),
AllowSourceTrailingDot: getJobDetailsResponse.TrailingDot.IsEnabled() && fromTo.From() == common.ELocation.FileSMB(),
AllowTrailingDot: getJobDetailsResponse.TrailingDot.IsEnabled(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (raw rawListCmdArgs) cook() (cookedListCmdArgs, error) {
// Only support listing for Azure locations
switch cooked.location {
case common.ELocation.Blob():
case common.ELocation.File(),common.ELocation.FileNFS():
case common.ELocation.FileSMB(), common.ELocation.FileNFS():
case common.ELocation.BlobFS():
break
default:
Expand Down
2 changes: 1 addition & 1 deletion cmd/make.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (cookedArgs cookedMakeCmdArgs) process() (err error) {
// print the ugly error if unexpected
return err
}
case common.ELocation.File(), common.ELocation.FileNFS():
case common.ELocation.FileSMB(), common.ELocation.FileNFS():
var shareClient *share.Client
shareClient, err = share.NewClientWithNoCredential(resourceURL, &share.ClientOptions{ClientOptions: options})
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions cmd/pathUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func DetermineLocationLevel(location string, locationType common.Location, sourc
return ELocationLevel.Object(), nil // we always benchmark to a subfolder, not the container root

case common.ELocation.Blob(),
common.ELocation.File(),
common.ELocation.FileSMB(),
common.ELocation.FileNFS(),
common.ELocation.BlobFS(),
common.ELocation.S3(),
Expand Down Expand Up @@ -125,7 +125,7 @@ func GetResourceRoot(resource string, location common.Location) (resourceBase st
return bURLParts.String(), nil

//noinspection GoNilness
case common.ELocation.File(), common.ELocation.FileNFS():
case common.ELocation.FileSMB(), common.ELocation.FileNFS():
fURLParts, err := filesas.ParseURL(resource)
if err != nil {
return resource, err
Expand Down Expand Up @@ -251,7 +251,7 @@ func splitAuthTokenFromResource(resource string, location common.Location) (reso
bURLParts.SAS = blobsas.QueryParameters{} // clear the SAS token and drop the raw, base URL
resourceBase = bURLParts.String()
return
case common.ELocation.File(), common.ELocation.FileNFS():
case common.ELocation.FileSMB(), common.ELocation.FileNFS():
var fURLParts filesas.URLParts
fURLParts, err = filesas.ParseURL(resource)
if err != nil {
Expand Down Expand Up @@ -325,7 +325,7 @@ func GetAccountRoot(resource common.ResourceString, location common.Location) (s
case common.ELocation.Local():
panic("attempted to get account root on local location")
case common.ELocation.Blob(),
common.ELocation.File(),
common.ELocation.FileSMB(),
common.ELocation.FileNFS(),
common.ELocation.BlobFS():
baseURL, err := resource.String()
Expand Down Expand Up @@ -355,7 +355,7 @@ func GetContainerName(path string, location common.Location) (string, error) {
case common.ELocation.Local():
panic("attempted to get container name on local location")
case common.ELocation.Blob(),
common.ELocation.File(),
common.ELocation.FileSMB(),
common.ELocation.FileNFS(),
common.ELocation.BlobFS():
bURLParts, err := blobsas.ParseURL(path)
Expand Down
4 changes: 2 additions & 2 deletions cmd/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func init() {
switch srcLocationType {
case common.ELocation.Blob():
raw.fromTo = common.EFromTo.BlobTrash().String()
case common.ELocation.File(), common.ELocation.FileNFS():
raw.fromTo = common.EFromTo.FileTrash().String()
case common.ELocation.FileSMB(), common.ELocation.FileNFS():
raw.fromTo = common.EFromTo.FileSMBTrash().String()
case common.ELocation.BlobFS():
raw.fromTo = common.EFromTo.BlobFSTrash().String()
default:
Expand Down
4 changes: 2 additions & 2 deletions cmd/setProperties.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func init() {
raw.fromTo = common.EFromTo.BlobNone().String()
case common.ELocation.BlobFS():
raw.fromTo = common.EFromTo.BlobFSNone().String()
case common.ELocation.File(), common.ELocation.FileNFS():
raw.fromTo = common.EFromTo.FileNone().String()
case common.ELocation.FileSMB(), common.ELocation.FileNFS():
raw.fromTo = common.EFromTo.FileSMBNone().String()
default:
return fmt.Errorf("invalid source type %s. azcopy supports set-properties of blobs/files/adls gen2", srcLocationType.String())
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/setPropertiesEnumerator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func setPropertiesEnumerator(cca *CookedCopyCmdArgs) (enumerator *CopyEnumerator
if srcCredInfo, _, err = GetCredentialInfoForLocation(ctx, cca.FromTo.From(), cca.Source, true, cca.CpkOptions); err != nil {
return nil, err
}
if cca.FromTo == common.EFromTo.FileNone() && (srcCredInfo.CredentialType == common.ECredentialType.Anonymous() && cca.Source.SAS == "") {
if cca.FromTo == common.EFromTo.FileSMBNone() && (srcCredInfo.CredentialType == common.ECredentialType.Anonymous() && cca.Source.SAS == "") {
return nil, errors.New("a SAS token (or S3 access key) is required as a part of the input for set-properties on File Storage")
}

Expand Down
8 changes: 4 additions & 4 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ func (raw rawSyncCmdArgs) toOptions() (cooked cookedSyncCmdArgs, err error) {
switch cooked.fromTo {
case common.EFromTo.Unknown():
return cooked, fmt.Errorf("unable to infer the source '%s' / destination '%s'. ", raw.src, raw.dst)
case common.EFromTo.LocalBlob(), common.EFromTo.LocalFile(), common.EFromTo.LocalBlobFS(), common.EFromTo.LocalFileNFS():
case common.EFromTo.LocalBlob(), common.EFromTo.LocalFileSMB(), common.EFromTo.LocalBlobFS(), common.EFromTo.LocalFileNFS():
cooked.destination, err = SplitResourceString(raw.dst, cooked.fromTo.To())
common.PanicIfErr(err)
case common.EFromTo.BlobLocal(), common.EFromTo.FileLocal(), common.EFromTo.BlobFSLocal(), common.EFromTo.FileNFSLocal():
case common.EFromTo.BlobLocal(), common.EFromTo.FileSMBLocal(), common.EFromTo.BlobFSLocal(), common.EFromTo.FileNFSLocal():
cooked.source, err = SplitResourceString(raw.src, cooked.fromTo.From())
common.PanicIfErr(err)
case common.EFromTo.BlobBlob(), common.EFromTo.FileFile(), common.EFromTo.FileNFSFileNFS(), common.EFromTo.BlobFile(), common.EFromTo.FileBlob(), common.EFromTo.BlobFSBlobFS(), common.EFromTo.BlobFSBlob(), common.EFromTo.BlobFSFile(), common.EFromTo.BlobBlobFS(), common.EFromTo.FileBlobFS():
case common.EFromTo.BlobBlob(), common.EFromTo.FileSMBFileSMB(), common.EFromTo.FileNFSFileNFS(), common.EFromTo.BlobFileSMB(), common.EFromTo.FileSMBBlob(), common.EFromTo.BlobFSBlobFS(), common.EFromTo.BlobFSBlob(), common.EFromTo.BlobFSFileSMB(), common.EFromTo.BlobBlobFS(), common.EFromTo.FileSMBBlobFS():
cooked.destination, err = SplitResourceString(raw.dst, cooked.fromTo.To())
common.PanicIfErr(err)
cooked.source, err = SplitResourceString(raw.src, cooked.fromTo.From())
Expand Down Expand Up @@ -346,7 +346,7 @@ func (cooked *cookedSyncCmdArgs) processArgs() (err error) {

// display a warning message to console and job log file if there is a sync operation being performed from local to file share.
// Reference : https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-files#synchronize-files
if cooked.fromTo == common.EFromTo.LocalFile() {
if cooked.fromTo == common.EFromTo.LocalFileSMB() {

glcm.Warn(LocalToFileShareWarnMsg)
common.LogToJobLogWithPrefix(LocalToFileShareWarnMsg, common.LogWarning)
Expand Down
Loading
Loading