Skip to content

Commit

Permalink
Updates service error metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
stevapple committed Oct 6, 2023
1 parent 3502d0d commit bc226d2
Show file tree
Hide file tree
Showing 17 changed files with 152 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ extension TCCdbError {
case timeoutError = "FailedOperation.TimeoutError"
case typeInConflict = "FailedOperation.TypeInConflict"
case vpcIpInUseError = "FailedOperation.VpcIpInUseError"
case vpcIpInvalidError = "FailedOperation.VpcIpInvalidError"
case vpcIpNotInSubnetError = "FailedOperation.VpcIpNotInSubnetError"
case other = "FailedOperation"
}
Expand Down Expand Up @@ -246,6 +247,11 @@ extension TCCdbError {
FailedOperation(.vpcIpInUseError)
}

/// 无效IP
public static var vpcIpInvalidError: FailedOperation {
FailedOperation(.vpcIpInvalidError)
}

/// 子网中不存在该IP
public static var vpcIpNotInSubnetError: FailedOperation {
FailedOperation(.vpcIpNotInSubnetError)
Expand Down Expand Up @@ -325,6 +331,8 @@ extension TCCdbError {
code = .failedOperation_TypeInConflict
case .vpcIpInUseError:
code = .failedOperation_VpcIpInUseError
case .vpcIpInvalidError:
code = .failedOperation_VpcIpInvalidError
case .vpcIpNotInSubnetError:
code = .failedOperation_VpcIpNotInSubnetError
case .other:
Expand Down
6 changes: 6 additions & 0 deletions Sources/Teco/Cdb/V20170320/errors/CdbError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public struct TCCdbError: TCCdbErrorType {
case failedOperation_TimeoutError = "FailedOperation.TimeoutError"
case failedOperation_TypeInConflict = "FailedOperation.TypeInConflict"
case failedOperation_VpcIpInUseError = "FailedOperation.VpcIpInUseError"
case failedOperation_VpcIpInvalidError = "FailedOperation.VpcIpInvalidError"
case failedOperation_VpcIpNotInSubnetError = "FailedOperation.VpcIpNotInSubnetError"
case internalError = "InternalError"
case internalError_AsyncRequestError = "InternalError.AsyncRequestError"
Expand Down Expand Up @@ -469,6 +470,11 @@ public struct TCCdbError: TCCdbErrorType {
TCCdbError(.failedOperation_VpcIpInUseError)
}

/// 无效IP
public static var failedOperation_VpcIpInvalidError: TCCdbError {
TCCdbError(.failedOperation_VpcIpInvalidError)
}

/// 子网中不存在该IP
public static var failedOperation_VpcIpNotInSubnetError: TCCdbError {
TCCdbError(.failedOperation_VpcIpNotInSubnetError)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ extension TCCvmError {
case tagKeyReserved = "FailedOperation.TagKeyReserved"
case tatAgentNotSupport = "FailedOperation.TatAgentNotSupport"
case unreturnable = "FailedOperation.Unreturnable"
case zoneInconsistent = "FailedOperation.ZoneInconsistent"
}

private let error: Code
Expand Down Expand Up @@ -187,6 +188,11 @@ extension TCCvmError {
FailedOperation(.unreturnable)
}

/// 给定实例所在可用区不相同,请给定相同可用区的实例。
public static var zoneInconsistent: FailedOperation {
FailedOperation(.zoneInconsistent)
}

public func asCvmError() -> TCCvmError {
let code: TCCvmError.Code
switch self.error {
Expand Down Expand Up @@ -238,6 +244,8 @@ extension TCCvmError {
code = .failedOperation_TatAgentNotSupport
case .unreturnable:
code = .failedOperation_Unreturnable
case .zoneInconsistent:
code = .failedOperation_ZoneInconsistent
}
return TCCvmError(code, context: self.context)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extension TCCvmError {
public struct ResourceInsufficient: TCCvmErrorType {
enum Code: String {
case availabilityZoneSoldOut = "ResourceInsufficient.AvailabilityZoneSoldOut"
case cidrBlock = "ResourceInsufficient.CidrBlock"
case cloudDiskSoldOut = "ResourceInsufficient.CloudDiskSoldOut"
case cloudDiskUnavailable = "ResourceInsufficient.CloudDiskUnavailable"
case disasterRecoverGroupCvmQuota = "ResourceInsufficient.DisasterRecoverGroupCvmQuota"
Expand Down Expand Up @@ -55,6 +56,11 @@ extension TCCvmError {
ResourceInsufficient(.availabilityZoneSoldOut)
}

/// 网段资源不足。
public static var cidrBlock: ResourceInsufficient {
ResourceInsufficient(.cidrBlock)
}

/// 指定的云盘规格已售罄
public static var cloudDiskSoldOut: ResourceInsufficient {
ResourceInsufficient(.cloudDiskSoldOut)
Expand Down Expand Up @@ -90,6 +96,8 @@ extension TCCvmError {
switch self.error {
case .availabilityZoneSoldOut:
code = .resourceInsufficient_AvailabilityZoneSoldOut
case .cidrBlock:
code = .resourceInsufficient_CidrBlock
case .cloudDiskSoldOut:
code = .resourceInsufficient_CloudDiskSoldOut
case .cloudDiskUnavailable:
Expand Down
12 changes: 12 additions & 0 deletions Sources/Teco/Cvm/V20170312/errors/CvmError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public struct TCCvmError: TCCvmErrorType {
case failedOperation_TagKeyReserved = "FailedOperation.TagKeyReserved"
case failedOperation_TatAgentNotSupport = "FailedOperation.TatAgentNotSupport"
case failedOperation_Unreturnable = "FailedOperation.Unreturnable"
case failedOperation_ZoneInconsistent = "FailedOperation.ZoneInconsistent"
case imageQuotaLimitExceeded = "ImageQuotaLimitExceeded"
case instancesQuotaLimitExceeded = "InstancesQuotaLimitExceeded"
case internalError = "InternalError"
Expand Down Expand Up @@ -256,6 +257,7 @@ public struct TCCvmError: TCCvmErrorType {
case resourceInUse_DiskRollbacking = "ResourceInUse.DiskRollbacking"
case resourceInUse_HpcCluster = "ResourceInUse.HpcCluster"
case resourceInsufficient_AvailabilityZoneSoldOut = "ResourceInsufficient.AvailabilityZoneSoldOut"
case resourceInsufficient_CidrBlock = "ResourceInsufficient.CidrBlock"
case resourceInsufficient_CloudDiskSoldOut = "ResourceInsufficient.CloudDiskSoldOut"
case resourceInsufficient_CloudDiskUnavailable = "ResourceInsufficient.CloudDiskUnavailable"
case resourceInsufficient_DisasterRecoverGroupCvmQuota = "ResourceInsufficient.DisasterRecoverGroupCvmQuota"
Expand Down Expand Up @@ -577,6 +579,11 @@ public struct TCCvmError: TCCvmErrorType {
TCCvmError(.failedOperation_Unreturnable)
}

/// 给定实例所在可用区不相同,请给定相同可用区的实例。
public static var failedOperation_ZoneInconsistent: TCCvmError {
TCCvmError(.failedOperation_ZoneInconsistent)
}

/// 镜像配额超过了限制。
public static var imageQuotaLimitExceeded: TCCvmError {
TCCvmError(.imageQuotaLimitExceeded)
Expand Down Expand Up @@ -1605,6 +1612,11 @@ public struct TCCvmError: TCCvmErrorType {
TCCvmError(.resourceInsufficient_AvailabilityZoneSoldOut)
}

/// 网段资源不足。
public static var resourceInsufficient_CidrBlock: TCCvmError {
TCCvmError(.resourceInsufficient_CidrBlock)
}

/// 指定的云盘规格已售罄
public static var resourceInsufficient_CloudDiskSoldOut: TCCvmError {
TCCvmError(.resourceInsufficient_CloudDiskSoldOut)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import TecoCore
extension TCEmrError {
public struct UnsupportedOperation: TCEmrErrorType {
enum Code: String {
case notInWhiteList = "UnsupportedOperation.NotInWhiteList"
case serviceNotSupport = "UnsupportedOperation.ServiceNotSupport"
case other = "UnsupportedOperation"
}
Expand All @@ -45,6 +46,11 @@ extension TCEmrError {
self.context = context
}

/// 该功能白名单支持。
public static var notInWhiteList: UnsupportedOperation {
UnsupportedOperation(.notInWhiteList)
}

/// 该服务不支持此操作。
public static var serviceNotSupport: UnsupportedOperation {
UnsupportedOperation(.serviceNotSupport)
Expand All @@ -58,6 +64,8 @@ extension TCEmrError {
public func asEmrError() -> TCEmrError {
let code: TCEmrError.Code
switch self.error {
case .notInWhiteList:
code = .unsupportedOperation_NotInWhiteList
case .serviceNotSupport:
code = .unsupportedOperation_ServiceNotSupport
case .other:
Expand Down
6 changes: 6 additions & 0 deletions Sources/Teco/Emr/V20190103/errors/EmrError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public struct TCEmrError: TCEmrErrorType {
case unauthorizedOperation_CheckCamAuth = "UnauthorizedOperation.CheckCamAuth"
case unknownParameter = "UnknownParameter"
case unsupportedOperation = "UnsupportedOperation"
case unsupportedOperation_NotInWhiteList = "UnsupportedOperation.NotInWhiteList"
case unsupportedOperation_ServiceNotSupport = "UnsupportedOperation.ServiceNotSupport"
}

Expand Down Expand Up @@ -879,6 +880,11 @@ public struct TCEmrError: TCEmrErrorType {
TCEmrError(.unsupportedOperation)
}

/// 该功能白名单支持。
public static var unsupportedOperation_NotInWhiteList: TCEmrError {
TCEmrError(.unsupportedOperation_NotInWhiteList)
}

/// 该服务不支持此操作。
public static var unsupportedOperation_ServiceNotSupport: TCEmrError {
TCEmrError(.unsupportedOperation_ServiceNotSupport)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ extension TCFacefusionError {
case rpcFail = "FailedOperation.RpcFail"
case serverError = "FailedOperation.ServerError"
case templateFaceIDNotExist = "FailedOperation.TemplateFaceIDNotExist"
case unknown = "FailedOperation.Unknown"
case other = "FailedOperation"
}

Expand Down Expand Up @@ -212,6 +213,11 @@ extension TCFacefusionError {
FailedOperation(.templateFaceIDNotExist)
}

/// 未知错误。
public static var unknown: FailedOperation {
FailedOperation(.unknown)
}

/// 操作失败。
public static var other: FailedOperation {
FailedOperation(.other)
Expand Down Expand Up @@ -276,6 +282,8 @@ extension TCFacefusionError {
code = .failedOperation_ServerError
case .templateFaceIDNotExist:
code = .failedOperation_TemplateFaceIDNotExist
case .unknown:
code = .failedOperation_Unknown
case .other:
code = .failedOperation
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public struct TCFacefusionError: TCFacefusionErrorType {
case failedOperation_RpcFail = "FailedOperation.RpcFail"
case failedOperation_ServerError = "FailedOperation.ServerError"
case failedOperation_TemplateFaceIDNotExist = "FailedOperation.TemplateFaceIDNotExist"
case failedOperation_Unknown = "FailedOperation.Unknown"
case invalidParameterValue_ActivityIdNotFound = "InvalidParameterValue.ActivityIdNotFound"
case invalidParameterValue_FaceRectParameterValueError = "InvalidParameterValue.FaceRectParameterValueError"
case invalidParameterValue_ImageEmpty = "InvalidParameterValue.ImageEmpty"
Expand Down Expand Up @@ -247,6 +248,11 @@ public struct TCFacefusionError: TCFacefusionErrorType {
TCFacefusionError(.failedOperation_TemplateFaceIDNotExist)
}

/// 未知错误。
public static var failedOperation_Unknown: TCFacefusionError {
TCFacefusionError(.failedOperation_Unknown)
}

/// 未查找到活动id。
public static var invalidParameterValue_ActivityIdNotFound: TCFacefusionError {
TCFacefusionError(.invalidParameterValue_ActivityIdNotFound)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ extension TCTemError {
case minMaxNumNull = "MissingParameter.MinMaxNumNull"
case namespaceIdNull = "MissingParameter.NamespaceIdNull"
case pkgNameNull = "MissingParameter.PkgNameNull"
case repoServerNull = "MissingParameter.RepoServerNull"
case scalerIdNull = "MissingParameter.ScalerIdNull"
case serviceIdNull = "MissingParameter.ServiceIdNull"
case svcRepoNotReady = "MissingParameter.SvcRepoNotReady"
Expand Down Expand Up @@ -102,6 +103,11 @@ extension TCTemError {
MissingParameter(.pkgNameNull)
}

/// 镜像仓库服务器不能为空。
public static var repoServerNull: MissingParameter {
MissingParameter(.repoServerNull)
}

/// 弹性规则ID不能为空。
public static var scalerIdNull: MissingParameter {
MissingParameter(.scalerIdNull)
Expand Down Expand Up @@ -150,6 +156,8 @@ extension TCTemError {
code = .missingParameter_NamespaceIdNull
case .pkgNameNull:
code = .missingParameter_PkgNameNull
case .repoServerNull:
code = .missingParameter_RepoServerNull
case .scalerIdNull:
code = .missingParameter_ScalerIdNull
case .serviceIdNull:
Expand Down
6 changes: 6 additions & 0 deletions Sources/Teco/Tem/V20210701/errors/TemError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public struct TCTemError: TCTemErrorType {
case missingParameter_MinMaxNumNull = "MissingParameter.MinMaxNumNull"
case missingParameter_NamespaceIdNull = "MissingParameter.NamespaceIdNull"
case missingParameter_PkgNameNull = "MissingParameter.PkgNameNull"
case missingParameter_RepoServerNull = "MissingParameter.RepoServerNull"
case missingParameter_ScalerIdNull = "MissingParameter.ScalerIdNull"
case missingParameter_ServiceIdNull = "MissingParameter.ServiceIdNull"
case missingParameter_SvcRepoNotReady = "MissingParameter.SvcRepoNotReady"
Expand Down Expand Up @@ -759,6 +760,11 @@ public struct TCTemError: TCTemErrorType {
TCTemError(.missingParameter_PkgNameNull)
}

/// 镜像仓库服务器不能为空。
public static var missingParameter_RepoServerNull: TCTemError {
TCTemError(.missingParameter_RepoServerNull)
}

/// 弹性规则ID不能为空。
public static var missingParameter_ScalerIdNull: TCTemError {
TCTemError(.missingParameter_ScalerIdNull)
Expand Down
24 changes: 24 additions & 0 deletions Sources/Teco/Teo/V20220901/errors/TeoError.InvalidParameter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ extension TCTeoError {
enum Code: String {
case actionInProgress = "InvalidParameter.ActionInProgress"
case aliasDomainNotSupportSMCert = "InvalidParameter.AliasDomainNotSupportSMCert"
case cacheKeyQueryStringRequiresFullUrlCacheOff = "InvalidParameter.CacheKeyQueryStringRequiresFullUrlCacheOff"
case cacheKeyQueryStringTooManyValue = "InvalidParameter.CacheKeyQueryStringTooManyValue"
case certNotMatchDomain = "InvalidParameter.CertNotMatchDomain"
case certSystemError = "InvalidParameter.CertSystemError"
Expand Down Expand Up @@ -82,6 +83,7 @@ extension TCTeoError {
case invalidDynamicRoutineBilling = "InvalidParameter.InvalidDynamicRoutineBilling"
case invalidErrorPage = "InvalidParameter.InvalidErrorPage"
case invalidErrorPageRedirectUrl = "InvalidParameter.InvalidErrorPageRedirectUrl"
case invalidForceRedirectType = "InvalidParameter.InvalidForceRedirectType"
case invalidHttps = "InvalidParameter.InvalidHttps"
case invalidHttpsCertInfo = "InvalidParameter.InvalidHttpsCertInfo"
case invalidHttpsCipherSuiteAndTlsVersion = "InvalidParameter.InvalidHttpsCipherSuiteAndTlsVersion"
Expand Down Expand Up @@ -132,6 +134,7 @@ extension TCTeoError {
case target = "InvalidParameter.Target"
case taskNotGenerated = "InvalidParameter.TaskNotGenerated"
case taskSystemError = "InvalidParameter.TaskSystemError"
case tooManyFilterValues = "InvalidParameter.TooManyFilterValues"
case uploadUrl = "InvalidParameter.UploadUrl"
case zoneHasBeenBound = "InvalidParameter.ZoneHasBeenBound"
case zoneIsGrayPublishing = "InvalidParameter.ZoneIsGrayPublishing"
Expand Down Expand Up @@ -170,6 +173,11 @@ extension TCTeoError {
InvalidParameter(.aliasDomainNotSupportSMCert)
}

/// 无效的查询字符串。
public static var cacheKeyQueryStringRequiresFullUrlCacheOff: InvalidParameter {
InvalidParameter(.cacheKeyQueryStringRequiresFullUrlCacheOff)
}

/// 查询字符串规则超过了限制。
public static var cacheKeyQueryStringTooManyValue: InvalidParameter {
InvalidParameter(.cacheKeyQueryStringTooManyValue)
Expand Down Expand Up @@ -475,6 +483,11 @@ extension TCTeoError {
InvalidParameter(.invalidErrorPageRedirectUrl)
}

/// 无效的强制HTTPS跳转。
public static var invalidForceRedirectType: InvalidParameter {
InvalidParameter(.invalidForceRedirectType)
}

/// 无效的HTTPS。
public static var invalidHttps: InvalidParameter {
InvalidParameter(.invalidHttps)
Expand Down Expand Up @@ -722,6 +735,11 @@ extension TCTeoError {
InvalidParameter(.taskSystemError)
}

/// 过滤值过多。
public static var tooManyFilterValues: InvalidParameter {
InvalidParameter(.tooManyFilterValues)
}

/// 文件上传链接存在问题。
public static var uploadUrl: InvalidParameter {
InvalidParameter(.uploadUrl)
Expand Down Expand Up @@ -754,6 +772,8 @@ extension TCTeoError {
code = .invalidParameter_ActionInProgress
case .aliasDomainNotSupportSMCert:
code = .invalidParameter_AliasDomainNotSupportSMCert
case .cacheKeyQueryStringRequiresFullUrlCacheOff:
code = .invalidParameter_CacheKeyQueryStringRequiresFullUrlCacheOff
case .cacheKeyQueryStringTooManyValue:
code = .invalidParameter_CacheKeyQueryStringTooManyValue
case .certNotMatchDomain:
Expand Down Expand Up @@ -876,6 +896,8 @@ extension TCTeoError {
code = .invalidParameter_InvalidErrorPage
case .invalidErrorPageRedirectUrl:
code = .invalidParameter_InvalidErrorPageRedirectUrl
case .invalidForceRedirectType:
code = .invalidParameter_InvalidForceRedirectType
case .invalidHttps:
code = .invalidParameter_InvalidHttps
case .invalidHttpsCertInfo:
Expand Down Expand Up @@ -976,6 +998,8 @@ extension TCTeoError {
code = .invalidParameter_TaskNotGenerated
case .taskSystemError:
code = .invalidParameter_TaskSystemError
case .tooManyFilterValues:
code = .invalidParameter_TooManyFilterValues
case .uploadUrl:
code = .invalidParameter_UploadUrl
case .zoneHasBeenBound:
Expand Down
Loading

0 comments on commit bc226d2

Please sign in to comment.