From 18dee6a333bab1f32b5bda1ad4401938294e5f9f Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 31 Mar 2021 09:30:52 -0700 Subject: [PATCH] add stringer for ErrorCodes (#11933) --- cmd/api-errors.go | 2 + cmd/apierrorcode_string.go | 296 +++++++++++++++++++++++++++++++++++++ cmd/sts-errors.go | 2 + cmd/stserrorcode_string.go | 32 ++++ 4 files changed, 332 insertions(+) create mode 100644 cmd/apierrorcode_string.go create mode 100644 cmd/stserrorcode_string.go diff --git a/cmd/api-errors.go b/cmd/api-errors.go index 3ebbf42e9..6b4d86759 100644 --- a/cmd/api-errors.go +++ b/cmd/api-errors.go @@ -66,6 +66,8 @@ type APIErrorResponse struct { // APIErrorCode type of error status. type APIErrorCode int +//go:generate stringer -type=APIErrorCode -trimprefix=Err $GOFILE + // Error codes, non exhaustive list - http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html const ( ErrNone APIErrorCode = iota diff --git a/cmd/apierrorcode_string.go b/cmd/apierrorcode_string.go new file mode 100644 index 000000000..e4b6d49ea --- /dev/null +++ b/cmd/apierrorcode_string.go @@ -0,0 +1,296 @@ +// Code generated by "stringer -type=APIErrorCode -trimprefix=Err api-errors.go"; DO NOT EDIT. + +package cmd + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ErrNone-0] + _ = x[ErrAccessDenied-1] + _ = x[ErrBadDigest-2] + _ = x[ErrEntityTooSmall-3] + _ = x[ErrEntityTooLarge-4] + _ = x[ErrPolicyTooLarge-5] + _ = x[ErrIncompleteBody-6] + _ = x[ErrInternalError-7] + _ = x[ErrInvalidAccessKeyID-8] + _ = x[ErrInvalidBucketName-9] + _ = x[ErrInvalidDigest-10] + _ = x[ErrInvalidRange-11] + _ = x[ErrInvalidCopyPartRange-12] + _ = x[ErrInvalidCopyPartRangeSource-13] + _ = x[ErrInvalidMaxKeys-14] + _ = x[ErrInvalidEncodingMethod-15] + _ = x[ErrInvalidMaxUploads-16] + _ = x[ErrInvalidMaxParts-17] + _ = x[ErrInvalidPartNumberMarker-18] + _ = x[ErrInvalidPartNumber-19] + _ = x[ErrInvalidRequestBody-20] + _ = x[ErrInvalidCopySource-21] + _ = x[ErrInvalidMetadataDirective-22] + _ = x[ErrInvalidCopyDest-23] + _ = x[ErrInvalidPolicyDocument-24] + _ = x[ErrInvalidObjectState-25] + _ = x[ErrMalformedXML-26] + _ = x[ErrMissingContentLength-27] + _ = x[ErrMissingContentMD5-28] + _ = x[ErrMissingRequestBodyError-29] + _ = x[ErrMissingSecurityHeader-30] + _ = x[ErrNoSuchBucket-31] + _ = x[ErrNoSuchBucketPolicy-32] + _ = x[ErrNoSuchBucketLifecycle-33] + _ = x[ErrNoSuchLifecycleConfiguration-34] + _ = x[ErrNoSuchBucketSSEConfig-35] + _ = x[ErrNoSuchCORSConfiguration-36] + _ = x[ErrNoSuchWebsiteConfiguration-37] + _ = x[ErrReplicationConfigurationNotFoundError-38] + _ = x[ErrRemoteDestinationNotFoundError-39] + _ = x[ErrReplicationDestinationMissingLock-40] + _ = x[ErrRemoteTargetNotFoundError-41] + _ = x[ErrReplicationRemoteConnectionError-42] + _ = x[ErrBucketRemoteIdenticalToSource-43] + _ = x[ErrBucketRemoteAlreadyExists-44] + _ = x[ErrBucketRemoteLabelInUse-45] + _ = x[ErrBucketRemoteArnTypeInvalid-46] + _ = x[ErrBucketRemoteArnInvalid-47] + _ = x[ErrBucketRemoteRemoveDisallowed-48] + _ = x[ErrRemoteTargetNotVersionedError-49] + _ = x[ErrReplicationSourceNotVersionedError-50] + _ = x[ErrReplicationNeedsVersioningError-51] + _ = x[ErrReplicationBucketNeedsVersioningError-52] + _ = x[ErrObjectRestoreAlreadyInProgress-53] + _ = x[ErrNoSuchKey-54] + _ = x[ErrNoSuchUpload-55] + _ = x[ErrInvalidVersionID-56] + _ = x[ErrNoSuchVersion-57] + _ = x[ErrNotImplemented-58] + _ = x[ErrPreconditionFailed-59] + _ = x[ErrRequestTimeTooSkewed-60] + _ = x[ErrSignatureDoesNotMatch-61] + _ = x[ErrMethodNotAllowed-62] + _ = x[ErrInvalidPart-63] + _ = x[ErrInvalidPartOrder-64] + _ = x[ErrAuthorizationHeaderMalformed-65] + _ = x[ErrMalformedPOSTRequest-66] + _ = x[ErrPOSTFileRequired-67] + _ = x[ErrSignatureVersionNotSupported-68] + _ = x[ErrBucketNotEmpty-69] + _ = x[ErrAllAccessDisabled-70] + _ = x[ErrMalformedPolicy-71] + _ = x[ErrMissingFields-72] + _ = x[ErrMissingCredTag-73] + _ = x[ErrCredMalformed-74] + _ = x[ErrInvalidRegion-75] + _ = x[ErrInvalidServiceS3-76] + _ = x[ErrInvalidServiceSTS-77] + _ = x[ErrInvalidRequestVersion-78] + _ = x[ErrMissingSignTag-79] + _ = x[ErrMissingSignHeadersTag-80] + _ = x[ErrMalformedDate-81] + _ = x[ErrMalformedPresignedDate-82] + _ = x[ErrMalformedCredentialDate-83] + _ = x[ErrMalformedCredentialRegion-84] + _ = x[ErrMalformedExpires-85] + _ = x[ErrNegativeExpires-86] + _ = x[ErrAuthHeaderEmpty-87] + _ = x[ErrExpiredPresignRequest-88] + _ = x[ErrRequestNotReadyYet-89] + _ = x[ErrUnsignedHeaders-90] + _ = x[ErrMissingDateHeader-91] + _ = x[ErrInvalidQuerySignatureAlgo-92] + _ = x[ErrInvalidQueryParams-93] + _ = x[ErrBucketAlreadyOwnedByYou-94] + _ = x[ErrInvalidDuration-95] + _ = x[ErrBucketAlreadyExists-96] + _ = x[ErrMetadataTooLarge-97] + _ = x[ErrUnsupportedMetadata-98] + _ = x[ErrMaximumExpires-99] + _ = x[ErrSlowDown-100] + _ = x[ErrInvalidPrefixMarker-101] + _ = x[ErrBadRequest-102] + _ = x[ErrKeyTooLongError-103] + _ = x[ErrInvalidBucketObjectLockConfiguration-104] + _ = x[ErrObjectLockConfigurationNotFound-105] + _ = x[ErrObjectLockConfigurationNotAllowed-106] + _ = x[ErrNoSuchObjectLockConfiguration-107] + _ = x[ErrObjectLocked-108] + _ = x[ErrInvalidRetentionDate-109] + _ = x[ErrPastObjectLockRetainDate-110] + _ = x[ErrUnknownWORMModeDirective-111] + _ = x[ErrBucketTaggingNotFound-112] + _ = x[ErrObjectLockInvalidHeaders-113] + _ = x[ErrInvalidTagDirective-114] + _ = x[ErrInvalidEncryptionMethod-115] + _ = x[ErrInsecureSSECustomerRequest-116] + _ = x[ErrSSEMultipartEncrypted-117] + _ = x[ErrSSEEncryptedObject-118] + _ = x[ErrInvalidEncryptionParameters-119] + _ = x[ErrInvalidSSECustomerAlgorithm-120] + _ = x[ErrInvalidSSECustomerKey-121] + _ = x[ErrMissingSSECustomerKey-122] + _ = x[ErrMissingSSECustomerKeyMD5-123] + _ = x[ErrSSECustomerKeyMD5Mismatch-124] + _ = x[ErrInvalidSSECustomerParameters-125] + _ = x[ErrIncompatibleEncryptionMethod-126] + _ = x[ErrKMSNotConfigured-127] + _ = x[ErrKMSAuthFailure-128] + _ = x[ErrNoAccessKey-129] + _ = x[ErrInvalidToken-130] + _ = x[ErrEventNotification-131] + _ = x[ErrARNNotification-132] + _ = x[ErrRegionNotification-133] + _ = x[ErrOverlappingFilterNotification-134] + _ = x[ErrFilterNameInvalid-135] + _ = x[ErrFilterNamePrefix-136] + _ = x[ErrFilterNameSuffix-137] + _ = x[ErrFilterValueInvalid-138] + _ = x[ErrOverlappingConfigs-139] + _ = x[ErrUnsupportedNotification-140] + _ = x[ErrContentSHA256Mismatch-141] + _ = x[ErrReadQuorum-142] + _ = x[ErrWriteQuorum-143] + _ = x[ErrParentIsObject-144] + _ = x[ErrStorageFull-145] + _ = x[ErrRequestBodyParse-146] + _ = x[ErrObjectExistsAsDirectory-147] + _ = x[ErrInvalidObjectName-148] + _ = x[ErrInvalidObjectNamePrefixSlash-149] + _ = x[ErrInvalidResourceName-150] + _ = x[ErrServerNotInitialized-151] + _ = x[ErrOperationTimedOut-152] + _ = x[ErrClientDisconnected-153] + _ = x[ErrOperationMaxedOut-154] + _ = x[ErrInvalidRequest-155] + _ = x[ErrInvalidStorageClass-156] + _ = x[ErrBackendDown-157] + _ = x[ErrMalformedJSON-158] + _ = x[ErrAdminNoSuchUser-159] + _ = x[ErrAdminNoSuchGroup-160] + _ = x[ErrAdminGroupNotEmpty-161] + _ = x[ErrAdminNoSuchPolicy-162] + _ = x[ErrAdminInvalidArgument-163] + _ = x[ErrAdminInvalidAccessKey-164] + _ = x[ErrAdminInvalidSecretKey-165] + _ = x[ErrAdminConfigNoQuorum-166] + _ = x[ErrAdminConfigTooLarge-167] + _ = x[ErrAdminConfigBadJSON-168] + _ = x[ErrAdminConfigDuplicateKeys-169] + _ = x[ErrAdminCredentialsMismatch-170] + _ = x[ErrInsecureClientRequest-171] + _ = x[ErrObjectTampered-172] + _ = x[ErrAdminBucketQuotaExceeded-173] + _ = x[ErrAdminNoSuchQuotaConfiguration-174] + _ = x[ErrHealNotImplemented-175] + _ = x[ErrHealNoSuchProcess-176] + _ = x[ErrHealInvalidClientToken-177] + _ = x[ErrHealMissingBucket-178] + _ = x[ErrHealAlreadyRunning-179] + _ = x[ErrHealOverlappingPaths-180] + _ = x[ErrIncorrectContinuationToken-181] + _ = x[ErrEmptyRequestBody-182] + _ = x[ErrUnsupportedFunction-183] + _ = x[ErrInvalidExpressionType-184] + _ = x[ErrBusy-185] + _ = x[ErrUnauthorizedAccess-186] + _ = x[ErrExpressionTooLong-187] + _ = x[ErrIllegalSQLFunctionArgument-188] + _ = x[ErrInvalidKeyPath-189] + _ = x[ErrInvalidCompressionFormat-190] + _ = x[ErrInvalidFileHeaderInfo-191] + _ = x[ErrInvalidJSONType-192] + _ = x[ErrInvalidQuoteFields-193] + _ = x[ErrInvalidRequestParameter-194] + _ = x[ErrInvalidDataType-195] + _ = x[ErrInvalidTextEncoding-196] + _ = x[ErrInvalidDataSource-197] + _ = x[ErrInvalidTableAlias-198] + _ = x[ErrMissingRequiredParameter-199] + _ = x[ErrObjectSerializationConflict-200] + _ = x[ErrUnsupportedSQLOperation-201] + _ = x[ErrUnsupportedSQLStructure-202] + _ = x[ErrUnsupportedSyntax-203] + _ = x[ErrUnsupportedRangeHeader-204] + _ = x[ErrLexerInvalidChar-205] + _ = x[ErrLexerInvalidOperator-206] + _ = x[ErrLexerInvalidLiteral-207] + _ = x[ErrLexerInvalidIONLiteral-208] + _ = x[ErrParseExpectedDatePart-209] + _ = x[ErrParseExpectedKeyword-210] + _ = x[ErrParseExpectedTokenType-211] + _ = x[ErrParseExpected2TokenTypes-212] + _ = x[ErrParseExpectedNumber-213] + _ = x[ErrParseExpectedRightParenBuiltinFunctionCall-214] + _ = x[ErrParseExpectedTypeName-215] + _ = x[ErrParseExpectedWhenClause-216] + _ = x[ErrParseUnsupportedToken-217] + _ = x[ErrParseUnsupportedLiteralsGroupBy-218] + _ = x[ErrParseExpectedMember-219] + _ = x[ErrParseUnsupportedSelect-220] + _ = x[ErrParseUnsupportedCase-221] + _ = x[ErrParseUnsupportedCaseClause-222] + _ = x[ErrParseUnsupportedAlias-223] + _ = x[ErrParseUnsupportedSyntax-224] + _ = x[ErrParseUnknownOperator-225] + _ = x[ErrParseMissingIdentAfterAt-226] + _ = x[ErrParseUnexpectedOperator-227] + _ = x[ErrParseUnexpectedTerm-228] + _ = x[ErrParseUnexpectedToken-229] + _ = x[ErrParseUnexpectedKeyword-230] + _ = x[ErrParseExpectedExpression-231] + _ = x[ErrParseExpectedLeftParenAfterCast-232] + _ = x[ErrParseExpectedLeftParenValueConstructor-233] + _ = x[ErrParseExpectedLeftParenBuiltinFunctionCall-234] + _ = x[ErrParseExpectedArgumentDelimiter-235] + _ = x[ErrParseCastArity-236] + _ = x[ErrParseInvalidTypeParam-237] + _ = x[ErrParseEmptySelect-238] + _ = x[ErrParseSelectMissingFrom-239] + _ = x[ErrParseExpectedIdentForGroupName-240] + _ = x[ErrParseExpectedIdentForAlias-241] + _ = x[ErrParseUnsupportedCallWithStar-242] + _ = x[ErrParseNonUnaryAgregateFunctionCall-243] + _ = x[ErrParseMalformedJoin-244] + _ = x[ErrParseExpectedIdentForAt-245] + _ = x[ErrParseAsteriskIsNotAloneInSelectList-246] + _ = x[ErrParseCannotMixSqbAndWildcardInSelectList-247] + _ = x[ErrParseInvalidContextForWildcardInSelectList-248] + _ = x[ErrIncorrectSQLFunctionArgumentType-249] + _ = x[ErrValueParseFailure-250] + _ = x[ErrEvaluatorInvalidArguments-251] + _ = x[ErrIntegerOverflow-252] + _ = x[ErrLikeInvalidInputs-253] + _ = x[ErrCastFailed-254] + _ = x[ErrInvalidCast-255] + _ = x[ErrEvaluatorInvalidTimestampFormatPattern-256] + _ = x[ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing-257] + _ = x[ErrEvaluatorTimestampFormatPatternDuplicateFields-258] + _ = x[ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch-259] + _ = x[ErrEvaluatorUnterminatedTimestampFormatPatternToken-260] + _ = x[ErrEvaluatorInvalidTimestampFormatPatternToken-261] + _ = x[ErrEvaluatorInvalidTimestampFormatPatternSymbol-262] + _ = x[ErrEvaluatorBindingDoesNotExist-263] + _ = x[ErrMissingHeaders-264] + _ = x[ErrInvalidColumnIndex-265] + _ = x[ErrAdminConfigNotificationTargetsFailed-266] + _ = x[ErrAdminProfilerNotEnabled-267] + _ = x[ErrInvalidDecompressedSize-268] + _ = x[ErrAddUserInvalidArgument-269] + _ = x[ErrAdminAccountNotEligible-270] + _ = x[ErrAccountNotEligible-271] + _ = x[ErrServiceAccountNotFound-272] + _ = x[ErrPostPolicyConditionInvalidFormat-273] +} + +const _APIErrorCode_name = "NoneAccessDeniedBadDigestEntityTooSmallEntityTooLargePolicyTooLargeIncompleteBodyInternalErrorInvalidAccessKeyIDInvalidBucketNameInvalidDigestInvalidRangeInvalidCopyPartRangeInvalidCopyPartRangeSourceInvalidMaxKeysInvalidEncodingMethodInvalidMaxUploadsInvalidMaxPartsInvalidPartNumberMarkerInvalidPartNumberInvalidRequestBodyInvalidCopySourceInvalidMetadataDirectiveInvalidCopyDestInvalidPolicyDocumentInvalidObjectStateMalformedXMLMissingContentLengthMissingContentMD5MissingRequestBodyErrorMissingSecurityHeaderNoSuchBucketNoSuchBucketPolicyNoSuchBucketLifecycleNoSuchLifecycleConfigurationNoSuchBucketSSEConfigNoSuchCORSConfigurationNoSuchWebsiteConfigurationReplicationConfigurationNotFoundErrorRemoteDestinationNotFoundErrorReplicationDestinationMissingLockRemoteTargetNotFoundErrorReplicationRemoteConnectionErrorBucketRemoteIdenticalToSourceBucketRemoteAlreadyExistsBucketRemoteLabelInUseBucketRemoteArnTypeInvalidBucketRemoteArnInvalidBucketRemoteRemoveDisallowedRemoteTargetNotVersionedErrorReplicationSourceNotVersionedErrorReplicationNeedsVersioningErrorReplicationBucketNeedsVersioningErrorObjectRestoreAlreadyInProgressNoSuchKeyNoSuchUploadInvalidVersionIDNoSuchVersionNotImplementedPreconditionFailedRequestTimeTooSkewedSignatureDoesNotMatchMethodNotAllowedInvalidPartInvalidPartOrderAuthorizationHeaderMalformedMalformedPOSTRequestPOSTFileRequiredSignatureVersionNotSupportedBucketNotEmptyAllAccessDisabledMalformedPolicyMissingFieldsMissingCredTagCredMalformedInvalidRegionInvalidServiceS3InvalidServiceSTSInvalidRequestVersionMissingSignTagMissingSignHeadersTagMalformedDateMalformedPresignedDateMalformedCredentialDateMalformedCredentialRegionMalformedExpiresNegativeExpiresAuthHeaderEmptyExpiredPresignRequestRequestNotReadyYetUnsignedHeadersMissingDateHeaderInvalidQuerySignatureAlgoInvalidQueryParamsBucketAlreadyOwnedByYouInvalidDurationBucketAlreadyExistsMetadataTooLargeUnsupportedMetadataMaximumExpiresSlowDownInvalidPrefixMarkerBadRequestKeyTooLongErrorInvalidBucketObjectLockConfigurationObjectLockConfigurationNotFoundObjectLockConfigurationNotAllowedNoSuchObjectLockConfigurationObjectLockedInvalidRetentionDatePastObjectLockRetainDateUnknownWORMModeDirectiveBucketTaggingNotFoundObjectLockInvalidHeadersInvalidTagDirectiveInvalidEncryptionMethodInsecureSSECustomerRequestSSEMultipartEncryptedSSEEncryptedObjectInvalidEncryptionParametersInvalidSSECustomerAlgorithmInvalidSSECustomerKeyMissingSSECustomerKeyMissingSSECustomerKeyMD5SSECustomerKeyMD5MismatchInvalidSSECustomerParametersIncompatibleEncryptionMethodKMSNotConfiguredKMSAuthFailureNoAccessKeyInvalidTokenEventNotificationARNNotificationRegionNotificationOverlappingFilterNotificationFilterNameInvalidFilterNamePrefixFilterNameSuffixFilterValueInvalidOverlappingConfigsUnsupportedNotificationContentSHA256MismatchReadQuorumWriteQuorumParentIsObjectStorageFullRequestBodyParseObjectExistsAsDirectoryInvalidObjectNameInvalidObjectNamePrefixSlashInvalidResourceNameServerNotInitializedOperationTimedOutClientDisconnectedOperationMaxedOutInvalidRequestInvalidStorageClassBackendDownMalformedJSONAdminNoSuchUserAdminNoSuchGroupAdminGroupNotEmptyAdminNoSuchPolicyAdminInvalidArgumentAdminInvalidAccessKeyAdminInvalidSecretKeyAdminConfigNoQuorumAdminConfigTooLargeAdminConfigBadJSONAdminConfigDuplicateKeysAdminCredentialsMismatchInsecureClientRequestObjectTamperedAdminBucketQuotaExceededAdminNoSuchQuotaConfigurationHealNotImplementedHealNoSuchProcessHealInvalidClientTokenHealMissingBucketHealAlreadyRunningHealOverlappingPathsIncorrectContinuationTokenEmptyRequestBodyUnsupportedFunctionInvalidExpressionTypeBusyUnauthorizedAccessExpressionTooLongIllegalSQLFunctionArgumentInvalidKeyPathInvalidCompressionFormatInvalidFileHeaderInfoInvalidJSONTypeInvalidQuoteFieldsInvalidRequestParameterInvalidDataTypeInvalidTextEncodingInvalidDataSourceInvalidTableAliasMissingRequiredParameterObjectSerializationConflictUnsupportedSQLOperationUnsupportedSQLStructureUnsupportedSyntaxUnsupportedRangeHeaderLexerInvalidCharLexerInvalidOperatorLexerInvalidLiteralLexerInvalidIONLiteralParseExpectedDatePartParseExpectedKeywordParseExpectedTokenTypeParseExpected2TokenTypesParseExpectedNumberParseExpectedRightParenBuiltinFunctionCallParseExpectedTypeNameParseExpectedWhenClauseParseUnsupportedTokenParseUnsupportedLiteralsGroupByParseExpectedMemberParseUnsupportedSelectParseUnsupportedCaseParseUnsupportedCaseClauseParseUnsupportedAliasParseUnsupportedSyntaxParseUnknownOperatorParseMissingIdentAfterAtParseUnexpectedOperatorParseUnexpectedTermParseUnexpectedTokenParseUnexpectedKeywordParseExpectedExpressionParseExpectedLeftParenAfterCastParseExpectedLeftParenValueConstructorParseExpectedLeftParenBuiltinFunctionCallParseExpectedArgumentDelimiterParseCastArityParseInvalidTypeParamParseEmptySelectParseSelectMissingFromParseExpectedIdentForGroupNameParseExpectedIdentForAliasParseUnsupportedCallWithStarParseNonUnaryAgregateFunctionCallParseMalformedJoinParseExpectedIdentForAtParseAsteriskIsNotAloneInSelectListParseCannotMixSqbAndWildcardInSelectListParseInvalidContextForWildcardInSelectListIncorrectSQLFunctionArgumentTypeValueParseFailureEvaluatorInvalidArgumentsIntegerOverflowLikeInvalidInputsCastFailedInvalidCastEvaluatorInvalidTimestampFormatPatternEvaluatorInvalidTimestampFormatPatternSymbolForParsingEvaluatorTimestampFormatPatternDuplicateFieldsEvaluatorTimestampFormatPatternHourClockAmPmMismatchEvaluatorUnterminatedTimestampFormatPatternTokenEvaluatorInvalidTimestampFormatPatternTokenEvaluatorInvalidTimestampFormatPatternSymbolEvaluatorBindingDoesNotExistMissingHeadersInvalidColumnIndexAdminConfigNotificationTargetsFailedAdminProfilerNotEnabledInvalidDecompressedSizeAddUserInvalidArgumentAdminAccountNotEligibleAccountNotEligibleServiceAccountNotFoundPostPolicyConditionInvalidFormat" + +var _APIErrorCode_index = [...]uint16{0, 4, 16, 25, 39, 53, 67, 81, 94, 112, 129, 142, 154, 174, 200, 214, 235, 252, 267, 290, 307, 325, 342, 366, 381, 402, 420, 432, 452, 469, 492, 513, 525, 543, 564, 592, 613, 636, 662, 699, 729, 762, 787, 819, 848, 873, 895, 921, 943, 971, 1000, 1034, 1065, 1102, 1132, 1141, 1153, 1169, 1182, 1196, 1214, 1234, 1255, 1271, 1282, 1298, 1326, 1346, 1362, 1390, 1404, 1421, 1436, 1449, 1463, 1476, 1489, 1505, 1522, 1543, 1557, 1578, 1591, 1613, 1636, 1661, 1677, 1692, 1707, 1728, 1746, 1761, 1778, 1803, 1821, 1844, 1859, 1878, 1894, 1913, 1927, 1935, 1954, 1964, 1979, 2015, 2046, 2079, 2108, 2120, 2140, 2164, 2188, 2209, 2233, 2252, 2275, 2301, 2322, 2340, 2367, 2394, 2415, 2436, 2460, 2485, 2513, 2541, 2557, 2571, 2582, 2594, 2611, 2626, 2644, 2673, 2690, 2706, 2722, 2740, 2758, 2781, 2802, 2812, 2823, 2837, 2848, 2864, 2887, 2904, 2932, 2951, 2971, 2988, 3006, 3023, 3037, 3056, 3067, 3080, 3095, 3111, 3129, 3146, 3166, 3187, 3208, 3227, 3246, 3264, 3288, 3312, 3333, 3347, 3371, 3400, 3418, 3435, 3457, 3474, 3492, 3512, 3538, 3554, 3573, 3594, 3598, 3616, 3633, 3659, 3673, 3697, 3718, 3733, 3751, 3774, 3789, 3808, 3825, 3842, 3866, 3893, 3916, 3939, 3956, 3978, 3994, 4014, 4033, 4055, 4076, 4096, 4118, 4142, 4161, 4203, 4224, 4247, 4268, 4299, 4318, 4340, 4360, 4386, 4407, 4429, 4449, 4473, 4496, 4515, 4535, 4557, 4580, 4611, 4649, 4690, 4720, 4734, 4755, 4771, 4793, 4823, 4849, 4877, 4910, 4928, 4951, 4986, 5026, 5068, 5100, 5117, 5142, 5157, 5174, 5184, 5195, 5233, 5287, 5333, 5385, 5433, 5476, 5520, 5548, 5562, 5580, 5616, 5639, 5662, 5684, 5707, 5725, 5747, 5779} + +func (i APIErrorCode) String() string { + if i < 0 || i >= APIErrorCode(len(_APIErrorCode_index)-1) { + return "APIErrorCode(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _APIErrorCode_name[_APIErrorCode_index[i]:_APIErrorCode_index[i+1]] +} diff --git a/cmd/sts-errors.go b/cmd/sts-errors.go index 351923e41..b17995466 100644 --- a/cmd/sts-errors.go +++ b/cmd/sts-errors.go @@ -80,6 +80,8 @@ type STSErrorResponse struct { // STSErrorCode type of error status. type STSErrorCode int +//go:generate stringer -type=STSErrorCode -trimprefix=Err $GOFILE + // Error codes, non exhaustive list - http://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithSAML.html const ( ErrSTSNone STSErrorCode = iota diff --git a/cmd/stserrorcode_string.go b/cmd/stserrorcode_string.go new file mode 100644 index 000000000..8b96ab7a5 --- /dev/null +++ b/cmd/stserrorcode_string.go @@ -0,0 +1,32 @@ +// Code generated by "stringer -type=STSErrorCode -trimprefix=Err sts-errors.go"; DO NOT EDIT. + +package cmd + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[ErrSTSNone-0] + _ = x[ErrSTSAccessDenied-1] + _ = x[ErrSTSMissingParameter-2] + _ = x[ErrSTSInvalidParameterValue-3] + _ = x[ErrSTSWebIdentityExpiredToken-4] + _ = x[ErrSTSClientGrantsExpiredToken-5] + _ = x[ErrSTSInvalidClientGrantsToken-6] + _ = x[ErrSTSMalformedPolicyDocument-7] + _ = x[ErrSTSNotInitialized-8] + _ = x[ErrSTSInternalError-9] +} + +const _STSErrorCode_name = "STSNoneSTSAccessDeniedSTSMissingParameterSTSInvalidParameterValueSTSWebIdentityExpiredTokenSTSClientGrantsExpiredTokenSTSInvalidClientGrantsTokenSTSMalformedPolicyDocumentSTSNotInitializedSTSInternalError" + +var _STSErrorCode_index = [...]uint8{0, 7, 22, 41, 65, 91, 118, 145, 171, 188, 204} + +func (i STSErrorCode) String() string { + if i < 0 || i >= STSErrorCode(len(_STSErrorCode_index)-1) { + return "STSErrorCode(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _STSErrorCode_name[_STSErrorCode_index[i]:_STSErrorCode_index[i+1]] +}