-
Notifications
You must be signed in to change notification settings - Fork 836
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
22 changed files
with
1,078 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"AssetsRepo": "Azure/azure-sdk-assets", | ||
"AssetsRepoPrefixPath": "go", | ||
"TagPrefix": "go/storage/azfile", | ||
"Tag": "go/storage/azfile_33b8efd383" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
//go:build go1.18 | ||
// +build go1.18 | ||
|
||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
package fileerror | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/Azure/azure-sdk-for-go/sdk/azcore" | ||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azfile/internal/generated" | ||
) | ||
|
||
// HasCode returns true if the provided error is an *azcore.ResponseError | ||
// with its ErrorCode field equal to one of the specified Codes. | ||
func HasCode(err error, codes ...Code) bool { | ||
var respErr *azcore.ResponseError | ||
if !errors.As(err, &respErr) { | ||
return false | ||
} | ||
|
||
for _, code := range codes { | ||
if respErr.ErrorCode == string(code) { | ||
return true | ||
} | ||
} | ||
|
||
return false | ||
} | ||
|
||
// Code - Error codes returned by the service | ||
type Code = generated.StorageErrorCode | ||
|
||
const ( | ||
AccountAlreadyExists Code = "AccountAlreadyExists" | ||
AccountBeingCreated Code = "AccountBeingCreated" | ||
AccountIsDisabled Code = "AccountIsDisabled" | ||
AuthenticationFailed Code = "AuthenticationFailed" | ||
AuthorizationFailure Code = "AuthorizationFailure" | ||
AuthorizationPermissionMismatch Code = "AuthorizationPermissionMismatch" | ||
AuthorizationProtocolMismatch Code = "AuthorizationProtocolMismatch" | ||
AuthorizationResourceTypeMismatch Code = "AuthorizationResourceTypeMismatch" | ||
AuthorizationServiceMismatch Code = "AuthorizationServiceMismatch" | ||
AuthorizationSourceIPMismatch Code = "AuthorizationSourceIPMismatch" | ||
CannotDeleteFileOrDirectory Code = "CannotDeleteFileOrDirectory" | ||
ClientCacheFlushDelay Code = "ClientCacheFlushDelay" | ||
ConditionHeadersNotSupported Code = "ConditionHeadersNotSupported" | ||
ConditionNotMet Code = "ConditionNotMet" | ||
DeletePending Code = "DeletePending" | ||
DirectoryNotEmpty Code = "DirectoryNotEmpty" | ||
EmptyMetadataKey Code = "EmptyMetadataKey" | ||
FeatureVersionMismatch Code = "FeatureVersionMismatch" | ||
FileLockConflict Code = "FileLockConflict" | ||
InsufficientAccountPermissions Code = "InsufficientAccountPermissions" | ||
InternalError Code = "InternalError" | ||
InvalidAuthenticationInfo Code = "InvalidAuthenticationInfo" | ||
InvalidFileOrDirectoryPathName Code = "InvalidFileOrDirectoryPathName" | ||
InvalidHTTPVerb Code = "InvalidHttpVerb" | ||
InvalidHeaderValue Code = "InvalidHeaderValue" | ||
InvalidInput Code = "InvalidInput" | ||
InvalidMD5 Code = "InvalidMd5" | ||
InvalidMetadata Code = "InvalidMetadata" | ||
InvalidQueryParameterValue Code = "InvalidQueryParameterValue" | ||
InvalidRange Code = "InvalidRange" | ||
InvalidResourceName Code = "InvalidResourceName" | ||
InvalidURI Code = "InvalidUri" | ||
InvalidXMLDocument Code = "InvalidXmlDocument" | ||
InvalidXMLNodeValue Code = "InvalidXmlNodeValue" | ||
MD5Mismatch Code = "Md5Mismatch" | ||
MetadataTooLarge Code = "MetadataTooLarge" | ||
MissingContentLengthHeader Code = "MissingContentLengthHeader" | ||
MissingRequiredHeader Code = "MissingRequiredHeader" | ||
MissingRequiredQueryParameter Code = "MissingRequiredQueryParameter" | ||
MissingRequiredXMLNode Code = "MissingRequiredXmlNode" | ||
MultipleConditionHeadersNotSupported Code = "MultipleConditionHeadersNotSupported" | ||
OperationTimedOut Code = "OperationTimedOut" | ||
OutOfRangeInput Code = "OutOfRangeInput" | ||
OutOfRangeQueryParameterValue Code = "OutOfRangeQueryParameterValue" | ||
ParentNotFound Code = "ParentNotFound" | ||
ReadOnlyAttribute Code = "ReadOnlyAttribute" | ||
RequestBodyTooLarge Code = "RequestBodyTooLarge" | ||
RequestURLFailedToParse Code = "RequestUrlFailedToParse" | ||
ResourceAlreadyExists Code = "ResourceAlreadyExists" | ||
ResourceNotFound Code = "ResourceNotFound" | ||
ResourceTypeMismatch Code = "ResourceTypeMismatch" | ||
ServerBusy Code = "ServerBusy" | ||
ShareAlreadyExists Code = "ShareAlreadyExists" | ||
ShareBeingDeleted Code = "ShareBeingDeleted" | ||
ShareDisabled Code = "ShareDisabled" | ||
ShareHasSnapshots Code = "ShareHasSnapshots" | ||
ShareNotFound Code = "ShareNotFound" | ||
ShareSnapshotCountExceeded Code = "ShareSnapshotCountExceeded" | ||
ShareSnapshotInProgress Code = "ShareSnapshotInProgress" | ||
ShareSnapshotOperationNotSupported Code = "ShareSnapshotOperationNotSupported" | ||
SharingViolation Code = "SharingViolation" | ||
UnsupportedHTTPVerb Code = "UnsupportedHttpVerb" | ||
UnsupportedHeader Code = "UnsupportedHeader" | ||
UnsupportedQueryParameter Code = "UnsupportedQueryParameter" | ||
UnsupportedXMLNode Code = "UnsupportedXmlNode" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.