2015-02-15 03:48:15 -05:00
/ *
2019-04-09 14:39:42 -04:00
* MinIO Cloud Storage , ( C ) 2015 , 2016 , 2017 , 2018 MinIO , Inc .
2015-02-15 03:48:15 -05:00
*
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
* /
2016-08-18 19:23:42 -04:00
package cmd
2015-02-11 06:23:15 -05:00
import (
2018-02-02 21:18:52 -05:00
"context"
2015-02-11 06:23:15 -05:00
"encoding/xml"
2018-01-11 02:06:36 -05:00
"fmt"
2015-02-11 06:23:15 -05:00
"net/http"
2020-02-11 22:38:02 -05:00
"net/url"
2019-03-07 19:11:28 -05:00
"strings"
2017-10-22 01:30:34 -04:00
2019-12-02 12:32:19 -05:00
"github.com/Azure/azure-storage-blob-go/azblob"
2019-02-12 04:25:52 -05:00
"github.com/aliyun/aliyun-oss-go-sdk/oss"
"google.golang.org/api/googleapi"
2019-05-29 19:35:12 -04:00
minio "github.com/minio/minio-go/v6"
2019-11-25 19:33:34 -05:00
"github.com/minio/minio/cmd/config/etcd/dns"
2018-08-03 19:55:45 -04:00
"github.com/minio/minio/cmd/crypto"
2018-11-12 14:07:43 -05:00
"github.com/minio/minio/cmd/logger"
2017-10-31 14:54:32 -04:00
"github.com/minio/minio/pkg/auth"
2020-02-06 02:50:10 -05:00
"github.com/minio/minio/pkg/bucket/lifecycle"
2020-01-27 17:12:34 -05:00
objectlock "github.com/minio/minio/pkg/bucket/object/lock"
"github.com/minio/minio/pkg/bucket/object/tagging"
"github.com/minio/minio/pkg/bucket/policy"
2018-03-15 16:03:41 -04:00
"github.com/minio/minio/pkg/event"
2017-10-22 01:30:34 -04:00
"github.com/minio/minio/pkg/hash"
2015-02-11 06:23:15 -05:00
)
2015-09-19 03:52:01 -04:00
// APIError structure
type APIError struct {
2015-02-11 06:23:15 -05:00
Code string
Description string
2015-03-06 00:07:19 -05:00
HTTPStatusCode int
2015-02-11 06:23:15 -05:00
}
2015-09-19 03:52:01 -04:00
// APIErrorResponse - error response format
type APIErrorResponse struct {
2015-12-09 18:38:40 -05:00
XMLName xml . Name ` xml:"Error" json:"-" `
Code string
Message string
2018-07-23 04:39:09 -04:00
Key string ` xml:"Key,omitempty" json:"Key,omitempty" `
BucketName string ` xml:"BucketName,omitempty" json:"BucketName,omitempty" `
2015-12-09 18:38:40 -05:00
Resource string
2019-06-05 19:28:21 -04:00
Region string ` xml:"Region,omitempty" json:"Region,omitempty" `
2018-01-22 17:54:55 -05:00
RequestID string ` xml:"RequestId" json:"RequestId" `
HostID string ` xml:"HostId" json:"HostId" `
2015-02-11 06:23:15 -05:00
}
2016-03-10 05:24:52 -05:00
// APIErrorCode type of error status.
type APIErrorCode int
2015-04-22 19:28:13 -04:00
// Error codes, non exhaustive list - http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
2015-02-11 06:23:15 -05:00
const (
2016-03-10 05:24:52 -05:00
ErrNone APIErrorCode = iota
ErrAccessDenied
ErrBadDigest
ErrEntityTooSmall
ErrEntityTooLarge
2019-04-22 04:23:54 -04:00
ErrPolicyTooLarge
2016-03-10 05:24:52 -05:00
ErrIncompleteBody
ErrInternalError
ErrInvalidAccessKeyID
ErrInvalidBucketName
ErrInvalidDigest
ErrInvalidRange
2017-03-03 19:32:04 -05:00
ErrInvalidCopyPartRange
ErrInvalidCopyPartRangeSource
2016-03-10 05:24:52 -05:00
ErrInvalidMaxKeys
2019-02-24 01:14:24 -05:00
ErrInvalidEncodingMethod
2016-03-10 05:24:52 -05:00
ErrInvalidMaxUploads
ErrInvalidMaxParts
ErrInvalidPartNumberMarker
ErrInvalidRequestBody
ErrInvalidCopySource
2016-12-26 19:29:26 -05:00
ErrInvalidMetadataDirective
2016-03-10 05:24:52 -05:00
ErrInvalidCopyDest
ErrInvalidPolicyDocument
2016-10-20 19:09:55 -04:00
ErrInvalidObjectState
2016-03-10 05:24:52 -05:00
ErrMalformedXML
ErrMissingContentLength
ErrMissingContentMD5
ErrMissingRequestBodyError
2020-02-16 01:07:52 -05:00
ErrMissingSecurityHeader
2016-03-10 05:24:52 -05:00
ErrNoSuchBucket
ErrNoSuchBucketPolicy
2019-07-19 16:20:33 -04:00
ErrNoSuchBucketLifecycle
2020-02-08 06:16:59 -05:00
ErrNoSuchLifecycleConfiguration
2020-02-05 04:42:34 -05:00
ErrNoSuchBucketSSEConfig
2016-03-10 05:24:52 -05:00
ErrNoSuchKey
ErrNoSuchUpload
2018-12-12 14:43:44 -05:00
ErrNoSuchVersion
2016-03-10 05:24:52 -05:00
ErrNotImplemented
2016-06-28 04:18:18 -04:00
ErrPreconditionFailed
2016-03-10 05:24:52 -05:00
ErrRequestTimeTooSkewed
ErrSignatureDoesNotMatch
ErrMethodNotAllowed
ErrInvalidPart
ErrInvalidPartOrder
ErrAuthorizationHeaderMalformed
ErrMalformedPOSTRequest
2017-02-09 15:37:32 -05:00
ErrPOSTFileRequired
2016-03-10 05:24:52 -05:00
ErrSignatureVersionNotSupported
ErrBucketNotEmpty
ErrAllAccessDisabled
ErrMalformedPolicy
2016-03-30 23:04:51 -04:00
ErrMissingFields
ErrMissingCredTag
ErrCredMalformed
ErrInvalidRegion
ErrInvalidService
ErrInvalidRequestVersion
ErrMissingSignTag
ErrMissingSignHeadersTag
ErrMalformedDate
2016-08-09 12:13:15 -04:00
ErrMalformedPresignedDate
ErrMalformedCredentialDate
ErrMalformedCredentialRegion
2016-03-30 23:04:51 -04:00
ErrMalformedExpires
2016-08-09 12:13:15 -04:00
ErrNegativeExpires
2016-03-30 23:04:51 -04:00
ErrAuthHeaderEmpty
ErrExpiredPresignRequest
2016-09-10 03:38:07 -04:00
ErrRequestNotReadyYet
2016-08-09 12:13:15 -04:00
ErrUnsignedHeaders
2016-03-30 23:04:51 -04:00
ErrMissingDateHeader
ErrInvalidQuerySignatureAlgo
ErrInvalidQueryParams
2016-05-03 06:19:04 -04:00
ErrBucketAlreadyOwnedByYou
2017-01-04 02:39:22 -05:00
ErrInvalidDuration
2017-05-08 17:53:47 -04:00
ErrBucketAlreadyExists
2017-08-22 19:53:35 -04:00
ErrMetadataTooLarge
2017-09-12 19:14:41 -04:00
ErrUnsupportedMetadata
2017-11-13 15:54:03 -05:00
ErrMaximumExpires
2017-12-20 03:00:14 -05:00
ErrSlowDown
2018-01-18 17:39:39 -05:00
ErrInvalidPrefixMarker
2018-08-18 00:07:19 -04:00
ErrBadRequest
2019-07-12 00:38:12 -04:00
ErrKeyTooLongError
2019-11-20 16:18:09 -05:00
ErrInvalidBucketObjectLockConfiguration
2020-01-08 18:36:23 -05:00
ErrObjectLockConfigurationNotAllowed
2019-11-20 16:18:09 -05:00
ErrObjectLocked
ErrInvalidRetentionDate
ErrPastObjectLockRetainDate
ErrUnknownWORMModeDirective
ErrObjectLockInvalidHeaders
2020-01-20 11:45:59 -05:00
ErrInvalidTagDirective
2016-03-10 05:24:52 -05:00
// Add new error codes here.
2016-04-20 20:23:23 -04:00
2018-08-03 19:55:45 -04:00
// SSE-S3 related API errors
ErrInvalidEncryptionMethod
2017-11-07 18:18:59 -05:00
// Server-Side-Encryption (with Customer provided key) related API errors.
ErrInsecureSSECustomerRequest
2018-03-01 14:37:57 -05:00
ErrSSEMultipartEncrypted
2017-11-07 18:18:59 -05:00
ErrSSEEncryptedObject
ErrInvalidEncryptionParameters
ErrInvalidSSECustomerAlgorithm
ErrInvalidSSECustomerKey
ErrMissingSSECustomerKey
ErrMissingSSECustomerKeyMD5
ErrSSECustomerKeyMD5Mismatch
2018-04-06 17:15:23 -04:00
ErrInvalidSSECustomerParameters
2018-08-17 15:52:14 -04:00
ErrIncompatibleEncryptionMethod
ErrKMSNotConfigured
ErrKMSAuthFailure
2017-11-07 18:18:59 -05:00
2018-11-07 09:40:03 -05:00
ErrNoAccessKey
ErrInvalidToken
2016-07-24 01:51:12 -04:00
// Bucket notification related errors.
ErrEventNotification
ErrARNNotification
ErrRegionNotification
ErrOverlappingFilterNotification
2016-07-25 20:53:55 -04:00
ErrFilterNameInvalid
ErrFilterNamePrefix
ErrFilterNameSuffix
2016-08-18 15:00:01 -04:00
ErrFilterValueInvalid
2016-08-23 21:42:30 -04:00
ErrOverlappingConfigs
2017-08-23 18:58:02 -04:00
ErrUnsupportedNotification
2016-07-24 01:51:12 -04:00
2016-07-05 04:04:50 -04:00
// S3 extended errors.
ErrContentSHA256Mismatch
2016-07-20 15:40:20 -04:00
2016-07-05 04:04:50 -04:00
// Add new extended error codes here.
2019-04-09 14:39:42 -04:00
// MinIO extended errors.
2016-05-05 23:24:29 -04:00
ErrReadQuorum
ErrWriteQuorum
2019-03-20 16:06:53 -04:00
ErrParentIsObject
2016-05-08 15:36:16 -04:00
ErrStorageFull
2018-01-22 17:54:55 -05:00
ErrRequestBodyParse
2016-05-08 15:36:16 -04:00
ErrObjectExistsAsDirectory
2016-07-09 20:11:08 -04:00
ErrInvalidObjectName
2019-07-12 00:38:12 -04:00
ErrInvalidObjectNamePrefixSlash
2017-04-24 21:13:46 -04:00
ErrInvalidResourceName
2016-08-10 21:47:49 -04:00
ErrServerNotInitialized
2017-08-31 14:29:22 -04:00
ErrOperationTimedOut
2017-11-14 19:56:24 -05:00
ErrInvalidRequest
2019-04-09 14:39:42 -04:00
// MinIO storage class error codes
2017-12-26 23:36:16 -05:00
ErrInvalidStorageClass
2018-03-28 17:14:06 -04:00
ErrBackendDown
2016-07-05 04:04:50 -04:00
// Add new extended error codes here.
// Please open a https://github.com/minio/minio/issues before adding
// new error codes here.
2017-01-17 17:25:59 -05:00
2018-01-22 17:54:55 -05:00
ErrMalformedJSON
2018-10-16 15:48:19 -04:00
ErrAdminNoSuchUser
2019-08-02 17:25:00 -04:00
ErrAdminNoSuchGroup
ErrAdminGroupNotEmpty
2018-10-16 15:48:19 -04:00
ErrAdminNoSuchPolicy
ErrAdminInvalidArgument
2017-01-17 17:25:59 -05:00
ErrAdminInvalidAccessKey
ErrAdminInvalidSecretKey
2017-02-27 14:40:27 -05:00
ErrAdminConfigNoQuorum
2018-01-11 02:06:36 -05:00
ErrAdminConfigTooLarge
ErrAdminConfigBadJSON
2018-10-09 17:00:01 -04:00
ErrAdminConfigDuplicateKeys
2017-09-07 14:16:13 -04:00
ErrAdminCredentialsMismatch
2017-05-31 23:33:13 -04:00
ErrInsecureClientRequest
2017-11-07 18:18:59 -05:00
ErrObjectTampered
2018-08-15 06:30:19 -04:00
2018-01-11 13:21:41 -05:00
ErrHealNotImplemented
2018-01-22 17:54:55 -05:00
ErrHealNoSuchProcess
ErrHealInvalidClientToken
ErrHealMissingBucket
ErrHealAlreadyRunning
ErrHealOverlappingPaths
2018-06-25 15:35:43 -04:00
ErrIncorrectContinuationToken
2018-08-15 06:30:19 -04:00
2019-02-12 04:25:52 -05:00
// S3 Select Errors
2018-08-15 06:30:19 -04:00
ErrEmptyRequestBody
ErrUnsupportedFunction
ErrInvalidExpressionType
ErrBusy
ErrUnauthorizedAccess
ErrExpressionTooLong
ErrIllegalSQLFunctionArgument
ErrInvalidKeyPath
ErrInvalidCompressionFormat
ErrInvalidFileHeaderInfo
ErrInvalidJSONType
ErrInvalidQuoteFields
ErrInvalidRequestParameter
ErrInvalidDataType
ErrInvalidTextEncoding
ErrInvalidDataSource
ErrInvalidTableAlias
ErrMissingRequiredParameter
ErrObjectSerializationConflict
ErrUnsupportedSQLOperation
ErrUnsupportedSQLStructure
ErrUnsupportedSyntax
ErrUnsupportedRangeHeader
ErrLexerInvalidChar
ErrLexerInvalidOperator
ErrLexerInvalidLiteral
ErrLexerInvalidIONLiteral
ErrParseExpectedDatePart
ErrParseExpectedKeyword
ErrParseExpectedTokenType
ErrParseExpected2TokenTypes
ErrParseExpectedNumber
ErrParseExpectedRightParenBuiltinFunctionCall
ErrParseExpectedTypeName
ErrParseExpectedWhenClause
ErrParseUnsupportedToken
ErrParseUnsupportedLiteralsGroupBy
ErrParseExpectedMember
ErrParseUnsupportedSelect
ErrParseUnsupportedCase
ErrParseUnsupportedCaseClause
ErrParseUnsupportedAlias
ErrParseUnsupportedSyntax
ErrParseUnknownOperator
ErrParseMissingIdentAfterAt
ErrParseUnexpectedOperator
ErrParseUnexpectedTerm
ErrParseUnexpectedToken
ErrParseUnexpectedKeyword
ErrParseExpectedExpression
ErrParseExpectedLeftParenAfterCast
ErrParseExpectedLeftParenValueConstructor
ErrParseExpectedLeftParenBuiltinFunctionCall
ErrParseExpectedArgumentDelimiter
ErrParseCastArity
ErrParseInvalidTypeParam
ErrParseEmptySelect
ErrParseSelectMissingFrom
ErrParseExpectedIdentForGroupName
ErrParseExpectedIdentForAlias
ErrParseUnsupportedCallWithStar
ErrParseNonUnaryAgregateFunctionCall
ErrParseMalformedJoin
ErrParseExpectedIdentForAt
ErrParseAsteriskIsNotAloneInSelectList
ErrParseCannotMixSqbAndWildcardInSelectList
ErrParseInvalidContextForWildcardInSelectList
ErrIncorrectSQLFunctionArgumentType
ErrValueParseFailure
ErrEvaluatorInvalidArguments
ErrIntegerOverflow
ErrLikeInvalidInputs
ErrCastFailed
ErrInvalidCast
ErrEvaluatorInvalidTimestampFormatPattern
ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing
ErrEvaluatorTimestampFormatPatternDuplicateFields
ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch
ErrEvaluatorUnterminatedTimestampFormatPatternToken
ErrEvaluatorInvalidTimestampFormatPatternToken
ErrEvaluatorInvalidTimestampFormatPatternSymbol
ErrEvaluatorBindingDoesNotExist
ErrMissingHeaders
2018-11-16 13:27:48 -05:00
ErrInvalidColumnIndex
2018-09-06 11:03:18 -04:00
ErrAdminConfigNotificationTargetsFailed
2018-09-27 13:34:37 -04:00
ErrAdminProfilerNotEnabled
2018-09-27 23:36:17 -04:00
ErrInvalidDecompressedSize
2019-02-07 20:25:58 -05:00
ErrAddUserInvalidArgument
2019-09-22 17:20:49 -04:00
ErrPostPolicyConditionInvalidFormat
2015-04-22 19:28:13 -04:00
)
2019-02-12 04:25:52 -05:00
type errorCodeMap map [ APIErrorCode ] APIError
func ( e errorCodeMap ) ToAPIErr ( errCode APIErrorCode ) APIError {
apiErr , ok := e [ errCode ]
if ! ok {
return e [ ErrInternalError ]
}
return apiErr
}
2016-03-10 05:24:52 -05:00
// error code to APIError structure, these fields carry respective
// descriptions for all the error responses.
2019-02-12 04:25:52 -05:00
var errorCodes = errorCodeMap {
2016-03-10 05:24:52 -05:00
ErrInvalidCopyDest : {
2016-02-27 06:04:52 -05:00
Code : "InvalidRequest" ,
2016-12-26 19:29:26 -05:00
Description : "This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes." ,
2016-02-27 06:04:52 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidCopySource : {
2016-02-27 06:04:52 -05:00
Code : "InvalidArgument" ,
Description : "Copy Source must mention the source bucket and key: sourcebucket/sourcekey." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-12-26 19:29:26 -05:00
ErrInvalidMetadataDirective : {
Code : "InvalidArgument" ,
Description : "Unknown metadata directive." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-12-26 23:36:16 -05:00
ErrInvalidStorageClass : {
Code : "InvalidStorageClass" ,
Description : "Invalid storage class." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidRequestBody : {
2016-02-27 06:04:52 -05:00
Code : "InvalidArgument" ,
Description : "Body shouldn't be set for this request." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidMaxUploads : {
2015-07-16 20:22:45 -04:00
Code : "InvalidArgument" ,
2016-07-05 04:06:30 -04:00
Description : "Argument max-uploads must be an integer between 0 and 2147483647" ,
2015-07-16 20:22:45 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidMaxKeys : {
2015-07-16 20:22:45 -04:00
Code : "InvalidArgument" ,
2016-07-05 04:06:30 -04:00
Description : "Argument maxKeys must be an integer between 0 and 2147483647" ,
2015-07-16 20:22:45 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-02-24 01:14:24 -05:00
ErrInvalidEncodingMethod : {
Code : "InvalidArgument" ,
Description : "Invalid Encoding Method specified in Request" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidMaxParts : {
2015-07-16 20:22:45 -04:00
Code : "InvalidArgument" ,
2016-07-05 04:06:30 -04:00
Description : "Argument max-parts must be an integer between 0 and 2147483647" ,
2015-07-16 20:22:45 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidPartNumberMarker : {
2015-07-16 20:22:45 -04:00
Code : "InvalidArgument" ,
2015-09-18 17:48:01 -04:00
Description : "Argument partNumberMarker must be an integer." ,
2015-07-16 20:22:45 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidPolicyDocument : {
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
Code : "InvalidPolicyDocument" ,
Description : "The content of the form does not meet the conditions specified in the policy document." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrAccessDenied : {
2015-02-11 06:23:15 -05:00
Code : "AccessDenied" ,
2015-09-18 17:48:01 -04:00
Description : "Access Denied." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusForbidden ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrBadDigest : {
2015-02-11 06:23:15 -05:00
Code : "BadDigest" ,
2016-03-05 19:43:48 -05:00
Description : "The Content-Md5 you specified did not match what we received." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrEntityTooSmall : {
2015-02-11 06:23:15 -05:00
Code : "EntityTooSmall" ,
Description : "Your proposed upload is smaller than the minimum allowed object size." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrEntityTooLarge : {
2015-02-11 06:23:15 -05:00
Code : "EntityTooLarge" ,
Description : "Your proposed upload exceeds the maximum allowed object size." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2019-04-22 04:23:54 -04:00
ErrPolicyTooLarge : {
Code : "PolicyTooLarge" ,
Description : "Policy exceeds the maximum allowed document size." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrIncompleteBody : {
2015-02-11 06:23:15 -05:00
Code : "IncompleteBody" ,
2015-09-18 17:48:01 -04:00
Description : "You did not provide the number of bytes specified by the Content-Length HTTP header." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrInternalError : {
2015-02-11 06:23:15 -05:00
Code : "InternalError" ,
Description : "We encountered an internal error, please try again." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusInternalServerError ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidAccessKeyID : {
2017-05-23 23:07:52 -04:00
Code : "InvalidAccessKeyId" ,
2015-03-06 00:07:19 -05:00
Description : "The access key ID you provided does not exist in our records." ,
HTTPStatusCode : http . StatusForbidden ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidBucketName : {
2015-02-11 06:23:15 -05:00
Code : "InvalidBucketName" ,
Description : "The specified bucket is not valid." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidDigest : {
2015-02-11 06:23:15 -05:00
Code : "InvalidDigest" ,
2016-03-05 19:43:48 -05:00
Description : "The Content-Md5 you specified is not valid." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidRange : {
2015-02-11 06:23:15 -05:00
Code : "InvalidRange" ,
2016-07-05 04:06:30 -04:00
Description : "The requested range is not satisfiable" ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusRequestedRangeNotSatisfiable ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrMalformedXML : {
2015-02-11 06:23:15 -05:00
Code : "MalformedXML" ,
Description : "The XML you provided was not well-formed or did not validate against our published schema." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrMissingContentLength : {
2015-02-11 06:23:15 -05:00
Code : "MissingContentLength" ,
Description : "You must provide the Content-Length HTTP header." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusLengthRequired ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrMissingContentMD5 : {
2016-03-05 19:43:48 -05:00
Code : "MissingContentMD5" ,
Description : "Missing required header for this request: Content-Md5." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-02-16 01:07:52 -05:00
ErrMissingSecurityHeader : {
Code : "MissingSecurityHeader" ,
Description : "Your request was missing a required header" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrMissingRequestBodyError : {
2015-02-11 06:23:15 -05:00
Code : "MissingRequestBodyError" ,
Description : "Request body is empty." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusLengthRequired ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrNoSuchBucket : {
2015-02-11 06:23:15 -05:00
Code : "NoSuchBucket" ,
2016-07-05 04:06:30 -04:00
Description : "The specified bucket does not exist" ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusNotFound ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrNoSuchBucketPolicy : {
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
Code : "NoSuchBucketPolicy" ,
2016-09-06 05:18:02 -04:00
Description : "The bucket policy does not exist" ,
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
HTTPStatusCode : http . StatusNotFound ,
} ,
2019-07-19 16:20:33 -04:00
ErrNoSuchBucketLifecycle : {
Code : "NoSuchBucketLifecycle" ,
Description : "The bucket lifecycle configuration does not exist" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2020-02-08 06:16:59 -05:00
ErrNoSuchLifecycleConfiguration : {
Code : "NoSuchLifecycleConfiguration" ,
Description : "The lifecycle configuration does not exist" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2020-02-05 04:42:34 -05:00
ErrNoSuchBucketSSEConfig : {
Code : "ServerSideEncryptionConfigurationNotFoundError" ,
Description : "The server side encryption configuration was not found" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2016-03-10 05:24:52 -05:00
ErrNoSuchKey : {
2015-02-11 06:23:15 -05:00
Code : "NoSuchKey" ,
Description : "The specified key does not exist." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusNotFound ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrNoSuchUpload : {
2015-02-11 06:23:15 -05:00
Code : "NoSuchUpload" ,
2016-07-22 20:05:40 -04:00
Description : "The specified multipart upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusNotFound ,
2018-12-12 14:43:44 -05:00
} ,
ErrNoSuchVersion : {
Code : "NoSuchVersion" ,
Description : "Indicates that the version ID specified in the request does not match an existing version." ,
HTTPStatusCode : http . StatusNotFound ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrNotImplemented : {
2015-02-11 06:23:15 -05:00
Code : "NotImplemented" ,
2016-07-05 04:06:30 -04:00
Description : "A header you provided implies functionality that is not implemented" ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusNotImplemented ,
2015-02-11 06:23:15 -05:00
} ,
2016-06-28 04:18:18 -04:00
ErrPreconditionFailed : {
Code : "PreconditionFailed" ,
2016-07-09 15:13:40 -04:00
Description : "At least one of the pre-conditions you specified did not hold" ,
2016-06-28 04:18:18 -04:00
HTTPStatusCode : http . StatusPreconditionFailed ,
} ,
2016-03-10 05:24:52 -05:00
ErrRequestTimeTooSkewed : {
2015-02-11 06:23:15 -05:00
Code : "RequestTimeTooSkewed" ,
Description : "The difference between the request time and the server's time is too large." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusForbidden ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrSignatureDoesNotMatch : {
2015-02-11 06:23:15 -05:00
Code : "SignatureDoesNotMatch" ,
2016-06-21 15:10:18 -04:00
Description : "The request signature we calculated does not match the signature you provided. Check your key and signing method." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusForbidden ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrMethodNotAllowed : {
2015-04-27 06:54:49 -04:00
Code : "MethodNotAllowed" ,
Description : "The specified method is not allowed against this resource." ,
HTTPStatusCode : http . StatusMethodNotAllowed ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidPart : {
2015-05-08 01:43:19 -04:00
Code : "InvalidPart" ,
2017-06-17 14:20:39 -04:00
Description : "One or more of the specified parts could not be found. The part may not have been uploaded, or the specified entity tag may not match the part's entity tag." ,
2015-05-08 01:43:19 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidPartOrder : {
2015-05-08 05:02:51 -04:00
Code : "InvalidPartOrder" ,
Description : "The list of parts was not in ascending order. The parts list must be specified in order by part number." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-10-20 19:09:55 -04:00
ErrInvalidObjectState : {
Code : "InvalidObjectState" ,
Description : "The operation is not valid for the current state of the object." ,
HTTPStatusCode : http . StatusForbidden ,
} ,
2016-03-10 05:24:52 -05:00
ErrAuthorizationHeaderMalformed : {
2015-09-18 17:48:01 -04:00
Code : "AuthorizationHeaderMalformed" ,
2015-11-23 16:39:57 -05:00
Description : "The authorization header is malformed; the region is wrong; expecting 'us-east-1'." ,
2015-09-18 17:48:01 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrMalformedPOSTRequest : {
2015-10-02 02:51:17 -04:00
Code : "MalformedPOSTRequest" ,
Description : "The body of your POST request is not well-formed multipart/form-data." ,
HTTPStatusCode : http . StatusBadRequest ,
2015-12-09 18:38:40 -05:00
} ,
2017-02-09 15:37:32 -05:00
ErrPOSTFileRequired : {
Code : "InvalidArgument" ,
Description : "POST requires exactly one file upload per request." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrSignatureVersionNotSupported : {
2015-12-09 18:38:40 -05:00
Code : "InvalidRequest" ,
Description : "The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256." ,
HTTPStatusCode : http . StatusBadRequest ,
2015-10-02 02:51:17 -04:00
} ,
2016-03-10 05:24:52 -05:00
ErrBucketNotEmpty : {
2015-10-16 14:26:01 -04:00
Code : "BucketNotEmpty" ,
2016-09-06 05:18:02 -04:00
Description : "The bucket you tried to delete is not empty" ,
2015-10-16 14:26:01 -04:00
HTTPStatusCode : http . StatusConflict ,
} ,
2017-05-11 20:33:01 -04:00
ErrBucketAlreadyExists : {
Code : "BucketAlreadyExists" ,
Description : "The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again." ,
HTTPStatusCode : http . StatusConflict ,
} ,
2016-03-10 05:24:52 -05:00
ErrAllAccessDisabled : {
2016-02-16 21:50:36 -05:00
Code : "AllAccessDisabled" ,
Description : "All access to this bucket has been disabled." ,
HTTPStatusCode : http . StatusForbidden ,
} ,
2016-03-10 05:24:52 -05:00
ErrMalformedPolicy : {
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
Code : "MalformedPolicy" ,
2016-03-30 23:04:51 -04:00
Description : "Policy has invalid resource." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingFields : {
Code : "MissingFields" ,
Description : "Missing fields in request." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingCredTag : {
Code : "InvalidRequest" ,
Description : "Missing Credential field for this request." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrCredMalformed : {
2016-08-09 12:13:15 -04:00
Code : "AuthorizationQueryParametersError" ,
Description : "Error parsing the X-Amz-Credential parameter; the Credential is mal-formed; expecting \"<YOUR-AKID>/YYYYMMDD/REGION/SERVICE/aws4_request\"." ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMalformedDate : {
Code : "MalformedDate" ,
Description : "Invalid date format header, expected to be in ISO8601, RFC1123 or RFC1123Z time format." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-09 12:13:15 -04:00
ErrMalformedPresignedDate : {
Code : "AuthorizationQueryParametersError" ,
Description : "X-Amz-Date must be in the ISO8601 Long Format \"yyyyMMdd'T'HHmmss'Z'\"" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
// FIXME: Should contain the invalid param set as seen in https://github.com/minio/minio/issues/2385.
// right Description: "Error parsing the X-Amz-Credential parameter; incorrect date format \"%s\". This date in the credential must be in the format \"yyyyMMdd\".",
// Need changes to make sure variable messages can be constructed.
ErrMalformedCredentialDate : {
Code : "AuthorizationQueryParametersError" ,
Description : "Error parsing the X-Amz-Credential parameter; incorrect date format \"%s\". This date in the credential must be in the format \"yyyyMMdd\"." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
// FIXME: Should contain the invalid param set as seen in https://github.com/minio/minio/issues/2385.
// right Description: "Error parsing the X-Amz-Credential parameter; the region 'us-east-' is wrong; expecting 'us-east-1'".
// Need changes to make sure variable messages can be constructed.
ErrMalformedCredentialRegion : {
Code : "AuthorizationQueryParametersError" ,
Description : "Error parsing the X-Amz-Credential parameter; the region is wrong;" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-30 23:04:51 -04:00
ErrInvalidRegion : {
Code : "InvalidRegion" ,
Description : "Region does not match." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-09 12:13:15 -04:00
// FIXME: Should contain the invalid param set as seen in https://github.com/minio/minio/issues/2385.
// right Description: "Error parsing the X-Amz-Credential parameter; incorrect service \"s4\". This endpoint belongs to \"s3\".".
// Need changes to make sure variable messages can be constructed.
2016-03-30 23:04:51 -04:00
ErrInvalidService : {
2016-08-09 12:13:15 -04:00
Code : "AuthorizationQueryParametersError" ,
Description : "Error parsing the X-Amz-Credential parameter; incorrect service. This endpoint belongs to \"s3\"." ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-09 12:13:15 -04:00
// FIXME: Should contain the invalid param set as seen in https://github.com/minio/minio/issues/2385.
// Description: "Error parsing the X-Amz-Credential parameter; incorrect terminal "aws4_reque". This endpoint uses "aws4_request".
// Need changes to make sure variable messages can be constructed.
2016-03-30 23:04:51 -04:00
ErrInvalidRequestVersion : {
2016-08-09 12:13:15 -04:00
Code : "AuthorizationQueryParametersError" ,
Description : "Error parsing the X-Amz-Credential parameter; incorrect terminal. This endpoint uses \"aws4_request\"." ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingSignTag : {
Code : "AccessDenied" ,
Description : "Signature header missing Signature field." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingSignHeadersTag : {
Code : "InvalidArgument" ,
Description : "Signature header missing SignedHeaders field." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMalformedExpires : {
2016-08-09 12:13:15 -04:00
Code : "AuthorizationQueryParametersError" ,
Description : "X-Amz-Expires should be a number" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrNegativeExpires : {
Code : "AuthorizationQueryParametersError" ,
Description : "X-Amz-Expires must be non-negative" ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrAuthHeaderEmpty : {
Code : "InvalidArgument" ,
Description : "Authorization header is invalid -- one and only one ' ' (space) required." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingDateHeader : {
Code : "AccessDenied" ,
Description : "AWS authentication requires a valid Date or x-amz-date header" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidQuerySignatureAlgo : {
Code : "AuthorizationQueryParametersError" ,
Description : "X-Amz-Algorithm only supports \"AWS4-HMAC-SHA256\"." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrExpiredPresignRequest : {
Code : "AccessDenied" ,
2016-08-09 12:13:15 -04:00
Description : "Request has expired" ,
2016-09-06 05:18:02 -04:00
HTTPStatusCode : http . StatusForbidden ,
2016-08-09 12:13:15 -04:00
} ,
2016-09-10 03:38:07 -04:00
ErrRequestNotReadyYet : {
Code : "AccessDenied" ,
Description : "Request is not valid yet" ,
HTTPStatusCode : http . StatusForbidden ,
} ,
2017-12-20 03:00:14 -05:00
ErrSlowDown : {
Code : "SlowDown" ,
Description : "Please reduce your request" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2018-01-18 17:39:39 -05:00
ErrInvalidPrefixMarker : {
Code : "InvalidPrefixMarker" ,
Description : "Invalid marker prefix combination" ,
HTTPStatusCode : http . StatusBadRequest ,
2018-08-18 00:07:19 -04:00
} ,
ErrBadRequest : {
Code : "BadRequest" ,
Description : "400 BadRequest" ,
HTTPStatusCode : http . StatusBadRequest ,
2018-01-18 17:39:39 -05:00
} ,
2019-07-12 00:38:12 -04:00
ErrKeyTooLongError : {
Code : "KeyTooLongError" ,
Description : "Your key is too long" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-01-18 17:39:39 -05:00
2016-08-21 02:10:08 -04:00
// FIXME: Actual XML error response also contains the header which missed in list of signed header parameters.
2016-08-09 12:13:15 -04:00
ErrUnsignedHeaders : {
Code : "AccessDenied" ,
Description : "There were headers present in the request which were not signed" ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidQueryParams : {
Code : "AuthorizationQueryParametersError" ,
Description : "Query-string authentication version 4 requires the X-Amz-Algorithm, X-Amz-Credential, X-Amz-Signature, X-Amz-Date, X-Amz-SignedHeaders, and X-Amz-Expires parameters." ,
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-05-03 06:19:04 -04:00
ErrBucketAlreadyOwnedByYou : {
Code : "BucketAlreadyOwnedByYou" ,
Description : "Your previous request to create the named bucket succeeded and you already own it." ,
HTTPStatusCode : http . StatusConflict ,
} ,
2017-01-04 02:39:22 -05:00
ErrInvalidDuration : {
Code : "InvalidDuration" ,
2017-02-01 14:17:30 -05:00
Description : "Duration provided in the request is invalid." ,
2017-01-04 02:39:22 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-11-20 16:18:09 -05:00
ErrInvalidBucketObjectLockConfiguration : {
Code : "InvalidRequest" ,
Description : "Bucket is missing ObjectLockConfiguration" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-01-08 18:36:23 -05:00
ErrObjectLockConfigurationNotAllowed : {
Code : "InvalidBucketState" ,
Description : "Object Lock configuration cannot be enabled on existing buckets." ,
HTTPStatusCode : http . StatusConflict ,
} ,
2019-11-20 16:18:09 -05:00
ErrObjectLocked : {
Code : "InvalidRequest" ,
Description : "Object is WORM protected and cannot be overwritten" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidRetentionDate : {
Code : "InvalidRequest" ,
Description : "Date must be provided in ISO 8601 format" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrPastObjectLockRetainDate : {
Code : "InvalidRequest" ,
Description : "the retain until date must be in the future" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnknownWORMModeDirective : {
Code : "InvalidRequest" ,
Description : "unknown wormMode directive" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrObjectLockInvalidHeaders : {
Code : "InvalidRequest" ,
Description : "x-amz-object-lock-retain-until-date and x-amz-object-lock-mode must both be supplied" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-07-24 01:51:12 -04:00
/// Bucket notification related errors.
ErrEventNotification : {
Code : "InvalidArgument" ,
Description : "A specified event is not supported for notifications." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrARNNotification : {
Code : "InvalidArgument" ,
Description : "A specified destination ARN does not exist or is not well-formed. Verify the destination ARN." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrRegionNotification : {
Code : "InvalidArgument" ,
Description : "A specified destination is in a different region than the bucket. You must use a destination that resides in the same region as the bucket." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrOverlappingFilterNotification : {
Code : "InvalidArgument" ,
Description : "An object key name filtering rule defined with overlapping prefixes, overlapping suffixes, or overlapping combinations of prefixes and suffixes for the same event types." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-07-25 20:53:55 -04:00
ErrFilterNameInvalid : {
Code : "InvalidArgument" ,
Description : "filter rule name must be either prefix or suffix" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrFilterNamePrefix : {
Code : "InvalidArgument" ,
Description : "Cannot specify more than one prefix rule in a filter." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrFilterNameSuffix : {
Code : "InvalidArgument" ,
Description : "Cannot specify more than one suffix rule in a filter." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-18 15:00:01 -04:00
ErrFilterValueInvalid : {
2016-07-25 20:53:55 -04:00
Code : "InvalidArgument" ,
2016-08-18 15:00:01 -04:00
Description : "Size of filter rule value cannot exceed 1024 bytes in UTF-8 representation" ,
2016-07-25 20:53:55 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-23 21:42:30 -04:00
ErrOverlappingConfigs : {
Code : "InvalidArgument" ,
Description : "Configurations overlap. Configurations on the same bucket cannot share a common event type." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-08-23 18:58:02 -04:00
ErrUnsupportedNotification : {
Code : "UnsupportedNotification" ,
2019-04-09 14:39:42 -04:00
Description : "MinIO server does not support Topic or Cloud Function based notifications." ,
2017-08-23 18:58:02 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-03-03 19:32:04 -05:00
ErrInvalidCopyPartRange : {
Code : "InvalidArgument" ,
Description : "The x-amz-copy-source-range value must be of the form bytes=first-last where first and last are the zero-based offsets of the first and last bytes to copy" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidCopyPartRangeSource : {
Code : "InvalidArgument" ,
Description : "Range specified is not valid for source object" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-11-07 18:18:59 -05:00
ErrMetadataTooLarge : {
Code : "InvalidArgument" ,
Description : "Your metadata headers exceed the maximum allowed metadata size." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-01-20 11:45:59 -05:00
ErrInvalidTagDirective : {
Code : "InvalidArgument" ,
Description : "Unknown tag directive." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-08-03 19:55:45 -04:00
ErrInvalidEncryptionMethod : {
Code : "InvalidRequest" ,
Description : "The encryption method specified is not supported" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-11-07 18:18:59 -05:00
ErrInsecureSSECustomerRequest : {
Code : "InvalidRequest" ,
2018-04-06 17:15:23 -04:00
Description : "Requests specifying Server Side Encryption with Customer provided keys must be made over a secure connection." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-03-01 14:37:57 -05:00
ErrSSEMultipartEncrypted : {
Code : "InvalidRequest" ,
Description : "The multipart upload initiate requested encryption. Subsequent part requests must include the appropriate encryption parameters." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-11-07 18:18:59 -05:00
ErrSSEEncryptedObject : {
Code : "InvalidRequest" ,
2018-04-06 17:15:23 -04:00
Description : "The object was stored using a form of Server Side Encryption. The correct parameters must be provided to retrieve the object." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidEncryptionParameters : {
Code : "InvalidRequest" ,
Description : "The encryption parameters are not applicable to this object." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidSSECustomerAlgorithm : {
Code : "InvalidArgument" ,
2018-04-06 17:15:23 -04:00
Description : "Requests specifying Server Side Encryption with Customer provided keys must provide a valid encryption algorithm." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidSSECustomerKey : {
Code : "InvalidArgument" ,
2018-04-06 17:15:23 -04:00
Description : "The secret key was invalid for the specified algorithm." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingSSECustomerKey : {
Code : "InvalidArgument" ,
2018-04-06 17:15:23 -04:00
Description : "Requests specifying Server Side Encryption with Customer provided keys must provide an appropriate secret key." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingSSECustomerKeyMD5 : {
Code : "InvalidArgument" ,
2018-04-06 17:15:23 -04:00
Description : "Requests specifying Server Side Encryption with Customer provided keys must provide the client calculated MD5 of the secret key." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrSSECustomerKeyMD5Mismatch : {
Code : "InvalidArgument" ,
2018-04-06 17:15:23 -04:00
Description : "The calculated MD5 hash of the key did not match the hash that was provided." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidSSECustomerParameters : {
Code : "InvalidArgument" ,
Description : "The provided encryption parameters did not match the ones used originally." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-08-17 15:52:14 -04:00
ErrIncompatibleEncryptionMethod : {
Code : "InvalidArgument" ,
Description : "Server side encryption specified with both SSE-C and SSE-S3 headers" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrKMSNotConfigured : {
Code : "InvalidArgument" ,
Description : "Server side encryption specified but KMS is not configured" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrKMSAuthFailure : {
Code : "InvalidArgument" ,
Description : "Server side encryption specified but KMS authorization failed" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-11-07 09:40:03 -05:00
ErrNoAccessKey : {
Code : "AccessDenied" ,
Description : "No AWSAccessKey was presented" ,
HTTPStatusCode : http . StatusForbidden ,
} ,
ErrInvalidToken : {
Code : "InvalidTokenId" ,
Description : "The security token included in the request is invalid" ,
HTTPStatusCode : http . StatusForbidden ,
} ,
2016-07-24 01:51:12 -04:00
2016-07-05 04:04:50 -04:00
/// S3 extensions.
ErrContentSHA256Mismatch : {
Code : "XAmzContentSHA256Mismatch" ,
Description : "The provided 'x-amz-content-sha256' header does not match what was computed." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-04-09 14:39:42 -04:00
/// MinIO extensions.
2016-05-08 15:36:16 -04:00
ErrStorageFull : {
Code : "XMinioStorageFull" ,
2017-09-03 16:53:03 -04:00
Description : "Storage backend has reached its minimum free disk threshold. Please delete a few objects to proceed." ,
2018-07-03 12:40:14 -04:00
HTTPStatusCode : http . StatusInsufficientStorage ,
2016-05-08 15:36:16 -04:00
} ,
2019-03-20 16:06:53 -04:00
ErrParentIsObject : {
Code : "XMinioParentIsObject" ,
Description : "Object-prefix is already an object, please choose a different object-prefix name." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-01-22 17:54:55 -05:00
ErrRequestBodyParse : {
Code : "XMinioRequestBodyParse" ,
Description : "The request body failed to parse." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-05-08 15:36:16 -04:00
ErrObjectExistsAsDirectory : {
Code : "XMinioObjectExistsAsDirectory" ,
Description : "Object name already exists as a directory." ,
HTTPStatusCode : http . StatusConflict ,
} ,
2016-07-09 20:11:08 -04:00
ErrInvalidObjectName : {
Code : "XMinioInvalidObjectName" ,
2017-04-24 21:13:46 -04:00
Description : "Object name contains unsupported characters." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-07-12 00:38:12 -04:00
ErrInvalidObjectNamePrefixSlash : {
Code : "XMinioInvalidObjectName" ,
Description : "Object name contains a leading slash." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-04-24 21:13:46 -04:00
ErrInvalidResourceName : {
Code : "XMinioInvalidResourceName" ,
Description : "Resource name contains bad components such as \"..\" or \".\"." ,
2016-07-09 20:11:08 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-10 21:47:49 -04:00
ErrServerNotInitialized : {
Code : "XMinioServerNotInitialized" ,
Description : "Server not initialized, please try again." ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2018-01-22 17:54:55 -05:00
ErrMalformedJSON : {
Code : "XMinioMalformedJSON" ,
Description : "The JSON you provided was not well-formed or did not validate against our published format." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-10-16 15:48:19 -04:00
ErrAdminNoSuchUser : {
Code : "XMinioAdminNoSuchUser" ,
Description : "The specified user does not exist." ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2019-08-02 17:25:00 -04:00
ErrAdminNoSuchGroup : {
Code : "XMinioAdminNoSuchGroup" ,
Description : "The specified group does not exist." ,
HTTPStatusCode : http . StatusNotFound ,
} ,
ErrAdminGroupNotEmpty : {
Code : "XMinioAdminGroupNotEmpty" ,
Description : "The specified group is not empty - cannot remove it." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-10-16 15:48:19 -04:00
ErrAdminNoSuchPolicy : {
Code : "XMinioAdminNoSuchPolicy" ,
Description : "The canned policy does not exist." ,
HTTPStatusCode : http . StatusNotFound ,
} ,
ErrAdminInvalidArgument : {
Code : "XMinioAdminInvalidArgument" ,
Description : "Invalid arguments specified." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-01-17 17:25:59 -05:00
ErrAdminInvalidAccessKey : {
Code : "XMinioAdminInvalidAccessKey" ,
Description : "The access key is invalid." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrAdminInvalidSecretKey : {
Code : "XMinioAdminInvalidSecretKey" ,
Description : "The secret key is invalid." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-02-27 14:40:27 -05:00
ErrAdminConfigNoQuorum : {
Code : "XMinioAdminConfigNoQuorum" ,
Description : "Configuration update failed because server quorum was not met" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2018-01-11 02:06:36 -05:00
ErrAdminConfigTooLarge : {
Code : "XMinioAdminConfigTooLarge" ,
Description : fmt . Sprintf ( "Configuration data provided exceeds the allowed maximum of %d bytes" ,
2018-10-09 17:00:01 -04:00
maxEConfigJSONSize ) ,
2018-01-11 02:06:36 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrAdminConfigBadJSON : {
Code : "XMinioAdminConfigBadJSON" ,
2018-10-09 17:00:01 -04:00
Description : "JSON configuration provided is of incorrect format" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrAdminConfigDuplicateKeys : {
Code : "XMinioAdminConfigDuplicateKeys" ,
2018-01-11 02:06:36 -05:00
Description : "JSON configuration provided has objects with duplicate keys" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-09-06 11:03:18 -04:00
ErrAdminConfigNotificationTargetsFailed : {
Code : "XMinioAdminNotificationTargetsTestFailed" ,
Description : "Configuration update failed due an unsuccessful attempt to connect to one or more notification servers" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-09-27 13:34:37 -04:00
ErrAdminProfilerNotEnabled : {
Code : "XMinioAdminProfilerNotEnabled" ,
Description : "Unable to perform the requested operation because profiling is not enabled" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-09-07 14:16:13 -04:00
ErrAdminCredentialsMismatch : {
Code : "XMinioAdminCredentialsMismatch" ,
Description : "Credentials in config mismatch with server environment variables" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2017-05-31 23:33:13 -04:00
ErrInsecureClientRequest : {
Code : "XMinioInsecureClientRequest" ,
Description : "Cannot respond to plain-text request from TLS-encrypted server" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-08-31 14:29:22 -04:00
ErrOperationTimedOut : {
Code : "XMinioServerTimedOut" ,
Description : "A timeout occurred while trying to lock a resource" ,
HTTPStatusCode : http . StatusRequestTimeout ,
} ,
2017-09-12 19:14:41 -04:00
ErrUnsupportedMetadata : {
Code : "InvalidArgument" ,
Description : "Your metadata headers are not supported." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-11-07 18:18:59 -05:00
ErrObjectTampered : {
Code : "XMinioObjectTampered" ,
Description : errObjectTampered . Error ( ) ,
HTTPStatusCode : http . StatusPartialContent ,
} ,
2017-11-13 15:54:03 -05:00
ErrMaximumExpires : {
Code : "AuthorizationQueryParametersError" ,
Description : "X-Amz-Expires must be less than a week (in seconds); that is, the given X-Amz-Expires must be less than 604800 seconds" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-08-15 06:30:19 -04:00
2017-11-14 19:56:24 -05:00
// Generic Invalid-Request error. Should be used for response errors only for unlikely
2018-04-05 18:04:40 -04:00
// corner case errors for which introducing new APIErrorCode is not worth it. LogIf()
2017-11-14 19:56:24 -05:00
// should be used to log the error at the source of the error for debugging purposes.
ErrInvalidRequest : {
Code : "InvalidRequest" ,
Description : "Invalid Request" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-01-22 17:54:55 -05:00
ErrHealNotImplemented : {
Code : "XMinioHealNotImplemented" ,
Description : "This server does not implement heal functionality." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrHealNoSuchProcess : {
Code : "XMinioHealNoSuchProcess" ,
Description : "No such heal process is running on the server" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrHealInvalidClientToken : {
Code : "XMinioHealInvalidClientToken" ,
Description : "Client token mismatch" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrHealMissingBucket : {
Code : "XMinioHealMissingBucket" ,
Description : "A heal start request with a non-empty object-prefix parameter requires a bucket to be specified." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrHealAlreadyRunning : {
Code : "XMinioHealAlreadyRunning" ,
Description : "" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrHealOverlappingPaths : {
Code : "XMinioHealOverlappingPaths" ,
Description : "" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-03-28 17:14:06 -04:00
ErrBackendDown : {
Code : "XMinioBackendDown" ,
Description : "Object storage backend is unreachable" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2018-06-25 15:35:43 -04:00
ErrIncorrectContinuationToken : {
Code : "InvalidArgument" ,
Description : "The continuation token provided is incorrect" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-08-15 06:30:19 -04:00
//S3 Select API Errors
ErrEmptyRequestBody : {
Code : "EmptyRequestBody" ,
Description : "Request body cannot be empty." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnsupportedFunction : {
Code : "UnsupportedFunction" ,
Description : "Encountered an unsupported SQL function." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidDataSource : {
Code : "InvalidDataSource" ,
Description : "Invalid data source type. Only CSV and JSON are supported at this time." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidExpressionType : {
Code : "InvalidExpressionType" ,
Description : "The ExpressionType is invalid. Only SQL expressions are supported at this time." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrBusy : {
Code : "Busy" ,
Description : "The service is unavailable. Please retry." ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
ErrUnauthorizedAccess : {
Code : "UnauthorizedAccess" ,
Description : "You are not authorized to perform this operation" ,
HTTPStatusCode : http . StatusUnauthorized ,
} ,
ErrExpressionTooLong : {
Code : "ExpressionTooLong" ,
Description : "The SQL expression is too long: The maximum byte-length for the SQL expression is 256 KB." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrIllegalSQLFunctionArgument : {
Code : "IllegalSqlFunctionArgument" ,
Description : "Illegal argument was used in the SQL function." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidKeyPath : {
Code : "InvalidKeyPath" ,
Description : "Key path in the SQL expression is invalid." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidCompressionFormat : {
Code : "InvalidCompressionFormat" ,
Description : "The file is not in a supported compression format. Only GZIP is supported at this time." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidFileHeaderInfo : {
Code : "InvalidFileHeaderInfo" ,
Description : "The FileHeaderInfo is invalid. Only NONE, USE, and IGNORE are supported." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidJSONType : {
Code : "InvalidJsonType" ,
Description : "The JsonType is invalid. Only DOCUMENT and LINES are supported at this time." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidQuoteFields : {
Code : "InvalidQuoteFields" ,
Description : "The QuoteFields is invalid. Only ALWAYS and ASNEEDED are supported." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidRequestParameter : {
Code : "InvalidRequestParameter" ,
Description : "The value of a parameter in SelectRequest element is invalid. Check the service API documentation and try again." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidDataType : {
Code : "InvalidDataType" ,
Description : "The SQL expression contains an invalid data type." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidTextEncoding : {
Code : "InvalidTextEncoding" ,
Description : "Invalid encoding type. Only UTF-8 encoding is supported at this time." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidTableAlias : {
Code : "InvalidTableAlias" ,
Description : "The SQL expression contains an invalid table alias." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingRequiredParameter : {
Code : "MissingRequiredParameter" ,
Description : "The SelectRequest entity is missing a required parameter. Check the service documentation and try again." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrObjectSerializationConflict : {
Code : "ObjectSerializationConflict" ,
Description : "The SelectRequest entity can only contain one of CSV or JSON. Check the service documentation and try again." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnsupportedSQLOperation : {
Code : "UnsupportedSqlOperation" ,
Description : "Encountered an unsupported SQL operation." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnsupportedSQLStructure : {
Code : "UnsupportedSqlStructure" ,
Description : "Encountered an unsupported SQL structure. Check the SQL Reference." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnsupportedSyntax : {
Code : "UnsupportedSyntax" ,
Description : "Encountered invalid syntax." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnsupportedRangeHeader : {
Code : "UnsupportedRangeHeader" ,
Description : "Range header is not supported for this operation." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLexerInvalidChar : {
Code : "LexerInvalidChar" ,
Description : "The SQL expression contains an invalid character." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLexerInvalidOperator : {
Code : "LexerInvalidOperator" ,
Description : "The SQL expression contains an invalid literal." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLexerInvalidLiteral : {
Code : "LexerInvalidLiteral" ,
Description : "The SQL expression contains an invalid operator." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLexerInvalidIONLiteral : {
Code : "LexerInvalidIONLiteral" ,
Description : "The SQL expression contains an invalid operator." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedDatePart : {
Code : "ParseExpectedDatePart" ,
Description : "Did not find the expected date part in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedKeyword : {
Code : "ParseExpectedKeyword" ,
Description : "Did not find the expected keyword in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedTokenType : {
Code : "ParseExpectedTokenType" ,
Description : "Did not find the expected token in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpected2TokenTypes : {
Code : "ParseExpected2TokenTypes" ,
Description : "Did not find the expected token in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedNumber : {
Code : "ParseExpectedNumber" ,
Description : "Did not find the expected number in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedRightParenBuiltinFunctionCall : {
Code : "ParseExpectedRightParenBuiltinFunctionCall" ,
Description : "Did not find the expected right parenthesis character in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedTypeName : {
Code : "ParseExpectedTypeName" ,
Description : "Did not find the expected type name in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedWhenClause : {
Code : "ParseExpectedWhenClause" ,
Description : "Did not find the expected WHEN clause in the SQL expression. CASE is not supported." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedToken : {
Code : "ParseUnsupportedToken" ,
Description : "The SQL expression contains an unsupported token." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedLiteralsGroupBy : {
Code : "ParseUnsupportedLiteralsGroupBy" ,
Description : "The SQL expression contains an unsupported use of GROUP BY." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedMember : {
Code : "ParseExpectedMember" ,
Description : "The SQL expression contains an unsupported use of MEMBER." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedSelect : {
Code : "ParseUnsupportedSelect" ,
Description : "The SQL expression contains an unsupported use of SELECT." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedCase : {
Code : "ParseUnsupportedCase" ,
Description : "The SQL expression contains an unsupported use of CASE." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedCaseClause : {
Code : "ParseUnsupportedCaseClause" ,
Description : "The SQL expression contains an unsupported use of CASE." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedAlias : {
Code : "ParseUnsupportedAlias" ,
Description : "The SQL expression contains an unsupported use of ALIAS." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedSyntax : {
Code : "ParseUnsupportedSyntax" ,
Description : "The SQL expression contains unsupported syntax." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnknownOperator : {
Code : "ParseUnknownOperator" ,
Description : "The SQL expression contains an invalid operator." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseMissingIdentAfterAt : {
Code : "ParseMissingIdentAfterAt" ,
Description : "Did not find the expected identifier after the @ symbol in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnexpectedOperator : {
Code : "ParseUnexpectedOperator" ,
Description : "The SQL expression contains an unexpected operator." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnexpectedTerm : {
Code : "ParseUnexpectedTerm" ,
Description : "The SQL expression contains an unexpected term." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnexpectedToken : {
Code : "ParseUnexpectedToken" ,
Description : "The SQL expression contains an unexpected token." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnexpectedKeyword : {
Code : "ParseUnexpectedKeyword" ,
Description : "The SQL expression contains an unexpected keyword." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedExpression : {
Code : "ParseExpectedExpression" ,
Description : "Did not find the expected SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedLeftParenAfterCast : {
Code : "ParseExpectedLeftParenAfterCast" ,
Description : "Did not find expected the left parenthesis in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedLeftParenValueConstructor : {
Code : "ParseExpectedLeftParenValueConstructor" ,
Description : "Did not find expected the left parenthesis in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedLeftParenBuiltinFunctionCall : {
Code : "ParseExpectedLeftParenBuiltinFunctionCall" ,
Description : "Did not find the expected left parenthesis in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedArgumentDelimiter : {
Code : "ParseExpectedArgumentDelimiter" ,
Description : "Did not find the expected argument delimiter in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseCastArity : {
Code : "ParseCastArity" ,
Description : "The SQL expression CAST has incorrect arity." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseInvalidTypeParam : {
Code : "ParseInvalidTypeParam" ,
Description : "The SQL expression contains an invalid parameter value." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseEmptySelect : {
Code : "ParseEmptySelect" ,
Description : "The SQL expression contains an empty SELECT." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseSelectMissingFrom : {
Code : "ParseSelectMissingFrom" ,
Description : "GROUP is not supported in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedIdentForGroupName : {
Code : "ParseExpectedIdentForGroupName" ,
Description : "GROUP is not supported in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedIdentForAlias : {
Code : "ParseExpectedIdentForAlias" ,
Description : "Did not find the expected identifier for the alias in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedCallWithStar : {
Code : "ParseUnsupportedCallWithStar" ,
Description : "Only COUNT with (*) as a parameter is supported in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseNonUnaryAgregateFunctionCall : {
Code : "ParseNonUnaryAgregateFunctionCall" ,
Description : "Only one argument is supported for aggregate functions in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseMalformedJoin : {
Code : "ParseMalformedJoin" ,
Description : "JOIN is not supported in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedIdentForAt : {
Code : "ParseExpectedIdentForAt" ,
Description : "Did not find the expected identifier for AT name in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseAsteriskIsNotAloneInSelectList : {
Code : "ParseAsteriskIsNotAloneInSelectList" ,
Description : "Other expressions are not allowed in the SELECT list when '*' is used without dot notation in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseCannotMixSqbAndWildcardInSelectList : {
Code : "ParseCannotMixSqbAndWildcardInSelectList" ,
Description : "Cannot mix [] and * in the same expression in a SELECT list in SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseInvalidContextForWildcardInSelectList : {
Code : "ParseInvalidContextForWildcardInSelectList" ,
Description : "Invalid use of * in SELECT list in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrIncorrectSQLFunctionArgumentType : {
Code : "IncorrectSqlFunctionArgumentType" ,
Description : "Incorrect type of arguments in function call in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrValueParseFailure : {
Code : "ValueParseFailure" ,
Description : "Time stamp parse failure in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorInvalidArguments : {
Code : "EvaluatorInvalidArguments" ,
Description : "Incorrect number of arguments in the function call in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrIntegerOverflow : {
Code : "IntegerOverflow" ,
Description : "Int overflow or underflow in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLikeInvalidInputs : {
Code : "LikeInvalidInputs" ,
Description : "Invalid argument given to the LIKE clause in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrCastFailed : {
Code : "CastFailed" ,
Description : "Attempt to convert from one data type to another using CAST failed in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidCast : {
Code : "InvalidCast" ,
Description : "Attempt to convert from one data type to another using CAST failed in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorInvalidTimestampFormatPattern : {
Code : "EvaluatorInvalidTimestampFormatPattern" ,
Description : "Time stamp format pattern requires additional fields in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing : {
Code : "EvaluatorInvalidTimestampFormatPatternSymbolForParsing" ,
Description : "Time stamp format pattern contains a valid format symbol that cannot be applied to time stamp parsing in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorTimestampFormatPatternDuplicateFields : {
Code : "EvaluatorTimestampFormatPatternDuplicateFields" ,
Description : "Time stamp format pattern contains multiple format specifiers representing the time stamp field in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch : {
Code : "EvaluatorUnterminatedTimestampFormatPatternToken" ,
Description : "Time stamp format pattern contains unterminated token in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorUnterminatedTimestampFormatPatternToken : {
Code : "EvaluatorInvalidTimestampFormatPatternToken" ,
Description : "Time stamp format pattern contains an invalid token in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorInvalidTimestampFormatPatternToken : {
Code : "EvaluatorInvalidTimestampFormatPatternToken" ,
Description : "Time stamp format pattern contains an invalid token in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorInvalidTimestampFormatPatternSymbol : {
Code : "EvaluatorInvalidTimestampFormatPatternSymbol" ,
Description : "Time stamp format pattern contains an invalid symbol in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorBindingDoesNotExist : {
Code : "ErrEvaluatorBindingDoesNotExist" ,
Description : "A column name or a path provided does not exist in the SQL expression" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingHeaders : {
Code : "MissingHeaders" ,
Description : "Some headers in the query are missing from the file. Check the file and try again." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-11-16 13:27:48 -05:00
ErrInvalidColumnIndex : {
Code : "InvalidColumnIndex" ,
Description : "The column index is invalid. Please check the service documentation and try again." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-09-27 23:36:17 -04:00
ErrInvalidDecompressedSize : {
Code : "XMinioInvalidDecompressedSize" ,
Description : "The data provided is unfit for decompression" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-02-07 20:25:58 -05:00
ErrAddUserInvalidArgument : {
Code : "XMinioInvalidIAMCredentials" ,
Description : "User is not allowed to be same as admin access key" ,
HTTPStatusCode : http . StatusConflict ,
} ,
2019-09-22 17:20:49 -04:00
ErrPostPolicyConditionInvalidFormat : {
Code : "PostPolicyInvalidKeyName" ,
Description : "Invalid according to Policy: Policy Condition failed" ,
HTTPStatusCode : http . StatusForbidden ,
} ,
2016-03-10 05:24:52 -05:00
// Add your error structure here.
2015-02-11 06:23:15 -05:00
}
2016-05-05 23:24:29 -04:00
// toAPIErrorCode - Converts embedded errors. Convenience
// function written to handle all cases where we have known types of
// errors returned by underlying layers.
2018-11-12 14:07:43 -05:00
func toAPIErrorCode ( ctx context . Context , err error ) ( apiErr APIErrorCode ) {
2016-05-05 23:24:29 -04:00
if err == nil {
return ErrNone
}
// Verify if the underlying error is signature mismatch.
2016-07-05 04:04:50 -04:00
switch err {
2018-10-16 15:48:19 -04:00
case errInvalidArgument :
apiErr = ErrAdminInvalidArgument
case errNoSuchUser :
apiErr = ErrAdminNoSuchUser
2019-08-02 17:25:00 -04:00
case errNoSuchGroup :
apiErr = ErrAdminNoSuchGroup
case errGroupNotEmpty :
apiErr = ErrAdminGroupNotEmpty
2018-10-16 15:48:19 -04:00
case errNoSuchPolicy :
apiErr = ErrAdminNoSuchPolicy
2016-07-05 04:04:50 -04:00
case errSignatureMismatch :
apiErr = ErrSignatureDoesNotMatch
2018-10-02 15:48:51 -04:00
case errInvalidRange :
apiErr = ErrInvalidRange
2017-01-30 18:44:42 -05:00
case errDataTooLarge :
apiErr = ErrEntityTooLarge
case errDataTooSmall :
apiErr = ErrEntityTooSmall
2019-08-20 23:43:15 -04:00
case errAuthentication :
apiErr = ErrAccessDenied
2017-10-31 14:54:32 -04:00
case auth . ErrInvalidAccessKeyLength :
2017-02-07 15:51:43 -05:00
apiErr = ErrAdminInvalidAccessKey
2017-10-31 14:54:32 -04:00
case auth . ErrInvalidSecretKeyLength :
2017-02-07 15:51:43 -05:00
apiErr = ErrAdminInvalidSecretKey
2018-02-02 21:18:52 -05:00
// SSE errors
2018-10-16 15:27:34 -04:00
case errInvalidEncryptionParameters :
apiErr = ErrInvalidEncryptionParameters
2018-08-03 19:55:45 -04:00
case crypto . ErrInvalidEncryptionMethod :
apiErr = ErrInvalidEncryptionMethod
2018-08-17 15:52:14 -04:00
case crypto . ErrInvalidCustomerAlgorithm :
2018-02-02 21:18:52 -05:00
apiErr = ErrInvalidSSECustomerAlgorithm
2018-08-17 15:52:14 -04:00
case crypto . ErrMissingCustomerKey :
2018-02-02 21:18:52 -05:00
apiErr = ErrMissingSSECustomerKey
2018-08-17 15:52:14 -04:00
case crypto . ErrMissingCustomerKeyMD5 :
2018-02-02 21:18:52 -05:00
apiErr = ErrMissingSSECustomerKeyMD5
2018-08-17 15:52:14 -04:00
case crypto . ErrCustomerKeyMD5Mismatch :
2018-02-02 21:18:52 -05:00
apiErr = ErrSSECustomerKeyMD5Mismatch
2017-11-07 18:18:59 -05:00
case errObjectTampered :
2018-02-02 21:18:52 -05:00
apiErr = ErrObjectTampered
2017-11-07 18:18:59 -05:00
case errEncryptedObject :
2018-02-02 21:18:52 -05:00
apiErr = ErrSSEEncryptedObject
2018-04-06 17:15:23 -04:00
case errInvalidSSEParameters :
2018-02-02 21:18:52 -05:00
apiErr = ErrInvalidSSECustomerParameters
2018-09-06 15:31:12 -04:00
case crypto . ErrInvalidCustomerKey , crypto . ErrSecretKeyMismatch :
2018-02-02 21:18:52 -05:00
apiErr = ErrAccessDenied // no access without correct key
2018-08-17 15:52:14 -04:00
case crypto . ErrIncompatibleEncryptionMethod :
apiErr = ErrIncompatibleEncryptionMethod
case errKMSNotConfigured :
apiErr = ErrKMSNotConfigured
case crypto . ErrKMSAuthLogin :
apiErr = ErrKMSAuthFailure
2018-09-06 11:03:18 -04:00
case errOperationTimedOut , context . Canceled , context . DeadlineExceeded :
2018-02-02 21:18:52 -05:00
apiErr = ErrOperationTimedOut
2019-05-29 13:21:47 -04:00
case errDiskNotFound :
2019-05-02 10:09:57 -04:00
apiErr = ErrSlowDown
2020-01-16 18:41:56 -05:00
case objectlock . ErrInvalidRetentionDate :
2019-11-20 16:18:09 -05:00
apiErr = ErrInvalidRetentionDate
2020-01-16 18:41:56 -05:00
case objectlock . ErrPastObjectLockRetainDate :
2019-11-20 16:18:09 -05:00
apiErr = ErrPastObjectLockRetainDate
2020-01-16 18:41:56 -05:00
case objectlock . ErrUnknownWORMModeDirective :
2019-11-20 16:18:09 -05:00
apiErr = ErrUnknownWORMModeDirective
2020-01-16 18:41:56 -05:00
case objectlock . ErrObjectLockInvalidHeaders :
2019-11-20 16:18:09 -05:00
apiErr = ErrObjectLockInvalidHeaders
2020-01-16 18:41:56 -05:00
case objectlock . ErrMalformedXML :
apiErr = ErrMalformedXML
2018-02-02 21:18:52 -05:00
}
2018-09-27 23:36:17 -04:00
// Compression errors
switch err {
case errInvalidDecompressedSize :
apiErr = ErrInvalidDecompressedSize
}
2018-02-02 21:18:52 -05:00
if apiErr != ErrNone {
// If there was a match in the above switch case.
return apiErr
}
// etcd specific errors, a key is always a bucket for us return
// ErrNoSuchBucket in such a case.
2018-07-12 17:12:40 -04:00
if err == dns . ErrNoEntriesFound {
return ErrNoSuchBucket
2017-11-07 18:18:59 -05:00
}
2016-05-05 23:24:29 -04:00
switch err . ( type ) {
case StorageFull :
apiErr = ErrStorageFull
2017-10-22 01:30:34 -04:00
case hash . BadDigest :
2016-05-05 23:24:29 -04:00
apiErr = ErrBadDigest
2017-05-05 21:49:08 -04:00
case AllAccessDisabled :
apiErr = ErrAllAccessDisabled
2016-05-05 23:24:29 -04:00
case IncompleteBody :
apiErr = ErrIncompleteBody
2016-05-08 15:36:16 -04:00
case ObjectExistsAsDirectory :
apiErr = ErrObjectExistsAsDirectory
2016-10-20 19:09:55 -04:00
case PrefixAccessDenied :
apiErr = ErrAccessDenied
2019-03-20 16:06:53 -04:00
case ParentIsObject :
apiErr = ErrParentIsObject
2016-05-05 23:24:29 -04:00
case BucketNameInvalid :
apiErr = ErrInvalidBucketName
case BucketNotFound :
apiErr = ErrNoSuchBucket
2017-04-27 14:26:00 -04:00
case BucketAlreadyOwnedByYou :
apiErr = ErrBucketAlreadyOwnedByYou
2016-05-05 23:24:29 -04:00
case BucketNotEmpty :
apiErr = ErrBucketNotEmpty
2017-05-08 17:53:47 -04:00
case BucketAlreadyExists :
apiErr = ErrBucketAlreadyExists
2016-05-05 23:24:29 -04:00
case BucketExists :
apiErr = ErrBucketAlreadyOwnedByYou
case ObjectNotFound :
apiErr = ErrNoSuchKey
2018-03-27 19:44:45 -04:00
case ObjectAlreadyExists :
apiErr = ErrMethodNotAllowed
2016-05-05 23:24:29 -04:00
case ObjectNameInvalid :
2016-07-09 20:11:08 -04:00
apiErr = ErrInvalidObjectName
2019-07-12 00:38:12 -04:00
case ObjectNamePrefixAsSlash :
apiErr = ErrInvalidObjectNamePrefixSlash
2016-05-05 23:24:29 -04:00
case InvalidUploadID :
apiErr = ErrNoSuchUpload
case InvalidPart :
apiErr = ErrInvalidPart
case InsufficientWriteQuorum :
2019-05-29 13:21:47 -04:00
apiErr = ErrSlowDown
2016-05-05 23:24:29 -04:00
case InsufficientReadQuorum :
2019-05-29 13:21:47 -04:00
apiErr = ErrSlowDown
2016-09-15 04:44:19 -04:00
case UnsupportedDelimiter :
apiErr = ErrNotImplemented
case InvalidMarkerPrefixCombination :
apiErr = ErrNotImplemented
case InvalidUploadIDKeyCombination :
apiErr = ErrNotImplemented
case MalformedUploadID :
apiErr = ErrNoSuchUpload
2016-05-08 15:06:05 -04:00
case PartTooSmall :
apiErr = ErrEntityTooSmall
2017-05-10 19:52:38 -04:00
case SignatureDoesNotMatch :
apiErr = ErrSignatureDoesNotMatch
2017-10-22 01:30:34 -04:00
case hash . SHA256Mismatch :
2016-10-02 18:51:49 -04:00
apiErr = ErrContentSHA256Mismatch
2016-10-22 12:05:01 -04:00
case ObjectTooLarge :
apiErr = ErrEntityTooLarge
2016-11-21 07:15:26 -05:00
case ObjectTooSmall :
apiErr = ErrEntityTooSmall
2017-03-16 15:21:58 -04:00
case NotImplemented :
apiErr = ErrNotImplemented
2017-07-12 19:42:14 -04:00
case PartTooBig :
apiErr = ErrEntityTooLarge
2017-09-12 19:14:41 -04:00
case UnsupportedMetadata :
apiErr = ErrUnsupportedMetadata
2017-10-27 19:14:06 -04:00
case BucketPolicyNotFound :
apiErr = ErrNoSuchBucketPolicy
2019-07-19 16:20:33 -04:00
case BucketLifecycleNotFound :
2020-02-08 06:16:59 -05:00
apiErr = ErrNoSuchLifecycleConfiguration
2020-02-05 04:42:34 -05:00
case BucketSSEConfigNotFound :
apiErr = ErrNoSuchBucketSSEConfig
2018-03-15 16:03:41 -04:00
case * event . ErrInvalidEventName :
apiErr = ErrEventNotification
case * event . ErrInvalidARN :
apiErr = ErrARNNotification
case * event . ErrARNNotFound :
apiErr = ErrARNNotification
case * event . ErrUnknownRegion :
apiErr = ErrRegionNotification
case * event . ErrInvalidFilterName :
apiErr = ErrFilterNameInvalid
case * event . ErrFilterNamePrefix :
apiErr = ErrFilterNamePrefix
case * event . ErrFilterNameSuffix :
apiErr = ErrFilterNameSuffix
case * event . ErrInvalidFilterValue :
apiErr = ErrFilterValueInvalid
case * event . ErrDuplicateEventName :
apiErr = ErrOverlappingConfigs
case * event . ErrDuplicateQueueConfiguration :
apiErr = ErrOverlappingFilterNotification
case * event . ErrUnsupportedConfiguration :
apiErr = ErrUnsupportedNotification
2018-03-28 17:14:06 -04:00
case BackendDown :
apiErr = ErrBackendDown
2019-07-12 00:38:12 -04:00
case ObjectNameTooLong :
apiErr = ErrKeyTooLongError
2016-05-05 23:24:29 -04:00
default :
2019-03-07 19:11:28 -05:00
var ie , iw int
// This work-around is to handle the issue golang/go#30648
if _ , ferr := fmt . Fscanf ( strings . NewReader ( err . Error ( ) ) ,
"request declared a Content-Length of %d but only wrote %d bytes" ,
& ie , & iw ) ; ferr != nil {
apiErr = ErrInternalError
// Make sure to log the errors which we cannot translate
// to a meaningful S3 API errors. This is added to aid in
// debugging unexpected/unhandled errors.
logger . LogIf ( ctx , err )
} else if ie > iw {
apiErr = ErrIncompleteBody
} else {
apiErr = ErrInternalError
// Make sure to log the errors which we cannot translate
// to a meaningful S3 API errors. This is added to aid in
// debugging unexpected/unhandled errors.
logger . LogIf ( ctx , err )
}
2016-05-05 23:24:29 -04:00
}
2016-11-21 16:51:05 -05:00
2016-05-05 23:24:29 -04:00
return apiErr
}
2019-02-12 04:25:52 -05:00
var noError = APIError { }
// toAPIError - Converts embedded errors. Convenience
// function written to handle all cases where we have known types of
// errors returned by underlying layers.
func toAPIError ( ctx context . Context , err error ) APIError {
if err == nil {
return noError
}
var apiErr = errorCodes . ToAPIErr ( toAPIErrorCode ( ctx , err ) )
if apiErr . Code == "InternalError" {
// If we see an internal error try to interpret
// any underlying errors if possible depending on
// their internal error types. This code is only
// useful with gateway implementations.
switch e := err . ( type ) {
2020-02-16 01:07:52 -05:00
case * xml . SyntaxError :
apiErr = APIError {
Code : "MalformedXML" ,
Description : fmt . Sprintf ( "%s (%s)" , errorCodes [ ErrMalformedXML ] . Description ,
e . Error ( ) ) ,
HTTPStatusCode : errorCodes [ ErrMalformedXML ] . HTTPStatusCode ,
}
2020-02-11 22:38:02 -05:00
case url . EscapeError :
apiErr = APIError {
Code : "XMinioInvalidObjectName" ,
Description : fmt . Sprintf ( "%s (%s)" , errorCodes [ ErrInvalidObjectName ] . Description ,
e . Error ( ) ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
2020-02-06 02:50:10 -05:00
case lifecycle . Error :
apiErr = APIError {
Code : "InvalidRequest" ,
Description : e . Error ( ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
2020-01-20 11:45:59 -05:00
case tagging . Error :
apiErr = APIError {
2020-02-11 20:42:28 -05:00
Code : e . Code ( ) ,
2020-01-20 11:45:59 -05:00
Description : e . Error ( ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
2020-01-03 14:28:52 -05:00
case policy . Error :
apiErr = APIError {
Code : "MalformedPolicy" ,
Description : e . Error ( ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
2019-09-22 04:12:51 -04:00
case crypto . Error :
apiErr = APIError {
2020-01-06 19:15:22 -05:00
Code : "XMinIOEncryptionError" ,
2019-09-22 04:12:51 -04:00
Description : e . Error ( ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
2019-02-12 04:25:52 -05:00
case minio . ErrorResponse :
apiErr = APIError {
Code : e . Code ,
Description : e . Message ,
HTTPStatusCode : e . StatusCode ,
}
case * googleapi . Error :
apiErr = APIError {
Code : "XGCSInternalError" ,
Description : e . Message ,
HTTPStatusCode : e . Code ,
}
// GCS may send multiple errors, just pick the first one
// since S3 only sends one Error XML response.
if len ( e . Errors ) >= 1 {
apiErr . Code = e . Errors [ 0 ] . Reason
}
2019-12-02 12:32:19 -05:00
case azblob . StorageError :
2019-02-12 04:25:52 -05:00
apiErr = APIError {
2019-12-02 12:32:19 -05:00
Code : string ( e . ServiceCode ( ) ) ,
Description : e . Error ( ) ,
HTTPStatusCode : e . Response ( ) . StatusCode ,
2019-02-12 04:25:52 -05:00
}
case oss . ServiceError :
apiErr = APIError {
Code : e . Code ,
Description : e . Message ,
HTTPStatusCode : e . StatusCode ,
}
// Add more Gateway SDKs here if any in future.
}
}
return apiErr
}
2016-03-10 05:24:52 -05:00
// getAPIError provides API Error for input API error code.
func getAPIError ( code APIErrorCode ) APIError {
2019-02-12 04:25:52 -05:00
if apiErr , ok := errorCodes [ code ] ; ok {
2018-09-18 19:46:35 -04:00
return apiErr
}
2019-02-12 04:25:52 -05:00
return errorCodes . ToAPIErr ( ErrInternalError )
2015-02-11 06:23:15 -05:00
}
2015-02-23 19:46:48 -05:00
// getErrorResponse gets in standard error and resource value and
// provides a encodable populated response values
2019-02-13 19:07:21 -05:00
func getAPIErrorResponse ( ctx context . Context , err APIError , resource , requestID , hostID string ) APIErrorResponse {
reqInfo := logger . GetReqInfo ( ctx )
2017-01-18 15:24:34 -05:00
return APIErrorResponse {
2019-02-13 19:07:21 -05:00
Code : err . Code ,
Message : err . Description ,
BucketName : reqInfo . BucketName ,
Key : reqInfo . ObjectName ,
Resource : resource ,
2019-10-23 01:59:13 -04:00
Region : globalServerRegion ,
2019-02-13 19:07:21 -05:00
RequestID : requestID ,
HostID : hostID ,
2015-02-12 01:00:45 -05:00
}
2015-02-11 06:23:15 -05:00
}