2015-02-15 03:48:15 -05:00
/ *
2018-03-15 16:03:41 -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"
2017-10-22 01:30:34 -04:00
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"
2018-07-12 17:12:40 -04:00
"github.com/minio/minio/pkg/dns"
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"
2018-08-15 06:30:19 -04:00
"github.com/minio/minio/pkg/s3select"
2018-11-14 18:55:10 -05:00
"github.com/minio/minio/pkg/s3select/format"
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
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
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
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
ErrNoSuchBucket
ErrNoSuchBucketPolicy
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
ErrPolicyAlreadyExpired
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
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.
2016-05-08 15:36:16 -04:00
// Minio extended errors.
2016-05-05 23:24:29 -04:00
ErrReadQuorum
ErrWriteQuorum
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-06-09 04:53:56 -04:00
ErrPolicyNesting
2016-07-09 20:11:08 -04:00
ErrInvalidObjectName
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
2017-12-26 23:36:16 -05:00
// Minio storage class error codes
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
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
//S3 Select Errors
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
2015-04-22 19:28:13 -04:00
)
2016-03-10 05:24:52 -05:00
// error code to APIError structure, these fields carry respective
// descriptions for all the error responses.
var errorCodeResponse = map [ APIErrorCode ] APIError {
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 ,
} ,
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
} ,
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 ,
} ,
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 ,
} ,
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 ,
} ,
ErrPolicyAlreadyExpired : {
Code : "AccessDenied" ,
Description : "Invalid according to Policy: Policy expired." ,
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
} ,
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 ,
} ,
2016-07-05 04:04:50 -04:00
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" ,
Description : "Minio server does not support Topic or Cloud Function based notifications." ,
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 ,
} ,
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 ,
} ,
2016-05-08 15:36:16 -04:00
/// Minio extensions.
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
} ,
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 ,
} ,
ErrReadQuorum : {
Code : "XMinioReadQuorum" ,
Description : "Multiple disk failures, unable to reconstruct data." ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
ErrWriteQuorum : {
Code : "XMinioWriteQuorum" ,
Description : "Multiple disks failures, unable to write data." ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2016-06-09 04:53:56 -04:00
ErrPolicyNesting : {
Code : "XMinioPolicyNesting" ,
2016-11-23 20:31:11 -05:00
Description : "New bucket policy conflicts with an existing policy. Please try again with new prefix." ,
2016-06-09 04:53:56 -04:00
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 ,
} ,
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 ,
} ,
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 ,
} ,
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
}
2016-11-21 16:51:05 -05:00
2016-05-05 23:24:29 -04:00
// 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
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
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 . ErrInvalidCustomerKey :
2018-02-02 21:18:52 -05:00
apiErr = ErrInvalidSSECustomerKey
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
}
2018-08-15 06:30:19 -04:00
switch err {
case s3select . ErrBusy :
apiErr = ErrBusy
case s3select . ErrUnauthorizedAccess :
apiErr = ErrUnauthorizedAccess
case s3select . ErrExpressionTooLong :
apiErr = ErrExpressionTooLong
case s3select . ErrIllegalSQLFunctionArgument :
apiErr = ErrIllegalSQLFunctionArgument
case s3select . ErrInvalidKeyPath :
apiErr = ErrInvalidKeyPath
case s3select . ErrInvalidCompressionFormat :
apiErr = ErrInvalidCompressionFormat
case s3select . ErrInvalidFileHeaderInfo :
apiErr = ErrInvalidFileHeaderInfo
case s3select . ErrInvalidJSONType :
apiErr = ErrInvalidJSONType
case s3select . ErrInvalidQuoteFields :
apiErr = ErrInvalidQuoteFields
case s3select . ErrInvalidRequestParameter :
apiErr = ErrInvalidRequestParameter
case s3select . ErrInvalidDataType :
apiErr = ErrInvalidDataType
case s3select . ErrInvalidTextEncoding :
apiErr = ErrInvalidTextEncoding
case s3select . ErrInvalidTableAlias :
apiErr = ErrInvalidTableAlias
case s3select . ErrMissingRequiredParameter :
apiErr = ErrMissingRequiredParameter
case s3select . ErrObjectSerializationConflict :
apiErr = ErrObjectSerializationConflict
case s3select . ErrUnsupportedSQLOperation :
apiErr = ErrUnsupportedSQLOperation
case s3select . ErrUnsupportedSQLStructure :
apiErr = ErrUnsupportedSQLStructure
case s3select . ErrUnsupportedSyntax :
apiErr = ErrUnsupportedSyntax
case s3select . ErrUnsupportedRangeHeader :
apiErr = ErrUnsupportedRangeHeader
case s3select . ErrLexerInvalidChar :
apiErr = ErrLexerInvalidChar
case s3select . ErrLexerInvalidOperator :
apiErr = ErrLexerInvalidOperator
case s3select . ErrLexerInvalidLiteral :
apiErr = ErrLexerInvalidLiteral
case s3select . ErrLexerInvalidIONLiteral :
apiErr = ErrLexerInvalidIONLiteral
case s3select . ErrParseExpectedDatePart :
apiErr = ErrParseExpectedDatePart
case s3select . ErrParseExpectedKeyword :
apiErr = ErrParseExpectedKeyword
case s3select . ErrParseExpectedTokenType :
apiErr = ErrParseExpectedTokenType
case s3select . ErrParseExpected2TokenTypes :
apiErr = ErrParseExpected2TokenTypes
case s3select . ErrParseExpectedNumber :
apiErr = ErrParseExpectedNumber
case s3select . ErrParseExpectedRightParenBuiltinFunctionCall :
apiErr = ErrParseExpectedRightParenBuiltinFunctionCall
case s3select . ErrParseExpectedTypeName :
apiErr = ErrParseExpectedTypeName
case s3select . ErrParseExpectedWhenClause :
apiErr = ErrParseExpectedWhenClause
case s3select . ErrParseUnsupportedToken :
apiErr = ErrParseUnsupportedToken
case s3select . ErrParseUnsupportedLiteralsGroupBy :
apiErr = ErrParseUnsupportedLiteralsGroupBy
case s3select . ErrParseExpectedMember :
apiErr = ErrParseExpectedMember
case s3select . ErrParseUnsupportedSelect :
apiErr = ErrParseUnsupportedSelect
case s3select . ErrParseUnsupportedCase :
apiErr = ErrParseUnsupportedCase
case s3select . ErrParseUnsupportedCaseClause :
apiErr = ErrParseUnsupportedCaseClause
case s3select . ErrParseUnsupportedAlias :
apiErr = ErrParseUnsupportedAlias
case s3select . ErrParseUnsupportedSyntax :
apiErr = ErrParseUnsupportedSyntax
case s3select . ErrParseUnknownOperator :
apiErr = ErrParseUnknownOperator
case s3select . ErrParseMissingIdentAfterAt :
apiErr = ErrParseMissingIdentAfterAt
case s3select . ErrParseUnexpectedOperator :
apiErr = ErrParseUnexpectedOperator
case s3select . ErrParseUnexpectedTerm :
apiErr = ErrParseUnexpectedTerm
case s3select . ErrParseUnexpectedToken :
apiErr = ErrParseUnexpectedToken
case s3select . ErrParseUnexpectedKeyword :
apiErr = ErrParseUnexpectedKeyword
case s3select . ErrParseExpectedExpression :
apiErr = ErrParseExpectedExpression
case s3select . ErrParseExpectedLeftParenAfterCast :
apiErr = ErrParseExpectedLeftParenAfterCast
case s3select . ErrParseExpectedLeftParenValueConstructor :
apiErr = ErrParseExpectedLeftParenValueConstructor
case s3select . ErrParseExpectedLeftParenBuiltinFunctionCall :
apiErr = ErrParseExpectedLeftParenBuiltinFunctionCall
case s3select . ErrParseExpectedArgumentDelimiter :
apiErr = ErrParseExpectedArgumentDelimiter
case s3select . ErrParseCastArity :
apiErr = ErrParseCastArity
case s3select . ErrParseInvalidTypeParam :
apiErr = ErrParseInvalidTypeParam
case s3select . ErrParseEmptySelect :
apiErr = ErrParseEmptySelect
case s3select . ErrParseSelectMissingFrom :
apiErr = ErrParseSelectMissingFrom
case s3select . ErrParseExpectedIdentForGroupName :
apiErr = ErrParseExpectedIdentForGroupName
case s3select . ErrParseExpectedIdentForAlias :
apiErr = ErrParseExpectedIdentForAlias
case s3select . ErrParseUnsupportedCallWithStar :
apiErr = ErrParseUnsupportedCallWithStar
case s3select . ErrParseNonUnaryAgregateFunctionCall :
apiErr = ErrParseNonUnaryAgregateFunctionCall
case s3select . ErrParseMalformedJoin :
apiErr = ErrParseMalformedJoin
case s3select . ErrParseExpectedIdentForAt :
apiErr = ErrParseExpectedIdentForAt
case s3select . ErrParseAsteriskIsNotAloneInSelectList :
apiErr = ErrParseAsteriskIsNotAloneInSelectList
case s3select . ErrParseCannotMixSqbAndWildcardInSelectList :
apiErr = ErrParseCannotMixSqbAndWildcardInSelectList
case s3select . ErrParseInvalidContextForWildcardInSelectList :
apiErr = ErrParseInvalidContextForWildcardInSelectList
case s3select . ErrIncorrectSQLFunctionArgumentType :
apiErr = ErrIncorrectSQLFunctionArgumentType
case s3select . ErrValueParseFailure :
apiErr = ErrValueParseFailure
case s3select . ErrIntegerOverflow :
apiErr = ErrIntegerOverflow
case s3select . ErrLikeInvalidInputs :
apiErr = ErrLikeInvalidInputs
case s3select . ErrCastFailed :
apiErr = ErrCastFailed
case s3select . ErrInvalidCast :
apiErr = ErrInvalidCast
case s3select . ErrEvaluatorInvalidTimestampFormatPattern :
apiErr = ErrEvaluatorInvalidTimestampFormatPattern
case s3select . ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing :
apiErr = ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing
case s3select . ErrEvaluatorTimestampFormatPatternDuplicateFields :
apiErr = ErrEvaluatorTimestampFormatPatternDuplicateFields
case s3select . ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch :
apiErr = ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch
case s3select . ErrEvaluatorUnterminatedTimestampFormatPatternToken :
apiErr = ErrEvaluatorUnterminatedTimestampFormatPatternToken
case s3select . ErrEvaluatorInvalidTimestampFormatPatternToken :
apiErr = ErrEvaluatorInvalidTimestampFormatPatternToken
case s3select . ErrEvaluatorInvalidTimestampFormatPatternSymbol :
apiErr = ErrEvaluatorInvalidTimestampFormatPatternSymbol
case s3select . ErrEvaluatorBindingDoesNotExist :
apiErr = ErrEvaluatorBindingDoesNotExist
case s3select . ErrMissingHeaders :
apiErr = ErrMissingHeaders
2018-11-14 18:55:10 -05:00
case format . ErrParseInvalidPathComponent :
apiErr = ErrMissingHeaders
2018-11-16 13:27:48 -05:00
case format . ErrInvalidColumnIndex :
apiErr = ErrInvalidColumnIndex
2018-08-15 06:30:19 -04:00
}
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
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
2016-05-05 23:24:29 -04:00
case InvalidUploadID :
apiErr = ErrNoSuchUpload
case InvalidPart :
apiErr = ErrInvalidPart
case InsufficientWriteQuorum :
apiErr = ErrWriteQuorum
case InsufficientReadQuorum :
apiErr = ErrReadQuorum
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
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
2018-08-03 19:55:45 -04:00
case crypto . Error :
apiErr = ErrObjectTampered
2016-05-05 23:24:29 -04:00
default :
apiErr = ErrInternalError
2018-11-12 14:07:43 -05:00
// 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
}
2016-03-10 05:24:52 -05:00
// getAPIError provides API Error for input API error code.
func getAPIError ( code APIErrorCode ) APIError {
2018-09-18 19:46:35 -04:00
if apiErr , ok := errorCodeResponse [ code ] ; ok {
return apiErr
}
return errorCodeResponse [ 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
2018-07-20 21:46:32 -04:00
func getAPIErrorResponse ( err APIError , resource , requestid string ) APIErrorResponse {
2017-01-18 15:24:34 -05:00
return APIErrorResponse {
Code : err . Code ,
Message : err . Description ,
Resource : resource ,
2018-07-20 21:46:32 -04:00
RequestID : requestid ,
2017-01-18 15:24:34 -05:00
HostID : "3L137" ,
2015-02-12 01:00:45 -05:00
}
2015-02-11 06:23:15 -05:00
}