|
| 1 | +package com.openshift.cloud.api.kas; |
| 2 | + |
| 3 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 4 | +import com.fasterxml.jackson.annotation.JsonValue; |
| 5 | + |
| 6 | +/** |
| 7 | + * Contains the possible error codes returned by API |
| 8 | + */ |
| 9 | +public enum ApiErrorType { |
| 10 | + |
| 11 | + /** Forbidden to perform this action*/ |
| 12 | + ERROR_4("KAFKAS-MGMT-4"), |
| 13 | + |
| 14 | + /** Forbidden to create more instances than the maximum allowed*/ |
| 15 | + ERROR_5("KAFKAS-MGMT-5"), |
| 16 | + |
| 17 | + /** An entity with the specified unique values already exists*/ |
| 18 | + ERROR_6("KAFKAS-MGMT-6"), |
| 19 | + |
| 20 | + /** Resource not found*/ |
| 21 | + ERROR_7("KAFKAS-MGMT-7"), |
| 22 | + |
| 23 | + /** General validation failure*/ |
| 24 | + ERROR_8("KAFKAS-MGMT-8"), |
| 25 | + |
| 26 | + /** Unspecified error*/ |
| 27 | + ERROR_9("KAFKAS-MGMT-9"), |
| 28 | + |
| 29 | + /** HTTP Method not implemented for this endpoint*/ |
| 30 | + ERROR_10("KAFKAS-MGMT-10"), |
| 31 | + |
| 32 | + /** Account is unauthorized to perform this action*/ |
| 33 | + ERROR_11("KAFKAS-MGMT-11"), |
| 34 | + |
| 35 | + /** Required terms have not been accepted*/ |
| 36 | + ERROR_12("KAFKAS-MGMT-12"), |
| 37 | + |
| 38 | + /** Account authentication could not be verified*/ |
| 39 | + ERROR_15("KAFKAS-MGMT-15"), |
| 40 | + |
| 41 | + /** Unable to read request body*/ |
| 42 | + ERROR_17("KAFKAS-MGMT-17"), |
| 43 | + |
| 44 | + /** Bad request*/ |
| 45 | + ERROR_21("KAFKAS-MGMT-21"), |
| 46 | + |
| 47 | + /** Failed to parse search query*/ |
| 48 | + ERROR_23("KAFKAS-MGMT-23"), |
| 49 | + |
| 50 | + /** The maximum number of allowed kafka instances has been reached*/ |
| 51 | + ERROR_24("KAFKAS-MGMT-24"), |
| 52 | + |
| 53 | + /** Resource gone*/ |
| 54 | + ERROR_25("KAFKAS-MGMT-25"), |
| 55 | + |
| 56 | + /** Provider not supported*/ |
| 57 | + ERROR_30("KAFKAS-MGMT-30"), |
| 58 | + |
| 59 | + /** Region not supported*/ |
| 60 | + ERROR_31("KAFKAS-MGMT-31"), |
| 61 | + |
| 62 | + /** Kafka cluster name is invalid*/ |
| 63 | + ERROR_32("KAFKAS-MGMT-32"), |
| 64 | + |
| 65 | + /** Minimum field length not reached*/ |
| 66 | + ERROR_33("KAFKAS-MGMT-33"), |
| 67 | + |
| 68 | + /** Maximum field length has been depassed*/ |
| 69 | + ERROR_34("KAFKAS-MGMT-34"), |
| 70 | + |
| 71 | + /** Only multiAZ Kafkas are supported, use multi_az=true*/ |
| 72 | + ERROR_35("KAFKAS-MGMT-35"), |
| 73 | + |
| 74 | + /** Kafka cluster name is already used*/ |
| 75 | + ERROR_36("KAFKAS-MGMT-36"), |
| 76 | + |
| 77 | + /** Field validation failed*/ |
| 78 | + ERROR_37("KAFKAS-MGMT-37"), |
| 79 | + |
| 80 | + /** Service account name is invalid*/ |
| 81 | + ERROR_38("KAFKAS-MGMT-38"), |
| 82 | + |
| 83 | + /** Service account desc is invalid*/ |
| 84 | + ERROR_39("KAFKAS-MGMT-39"), |
| 85 | + |
| 86 | + /** Service account id is invalid*/ |
| 87 | + ERROR_40("KAFKAS-MGMT-40"), |
| 88 | + |
| 89 | + /** Instance Type not supported*/ |
| 90 | + ERROR_41("KAFKAS-MGMT-41"), |
| 91 | + |
| 92 | + /** Synchronous action is not supported, use async=true parameter*/ |
| 93 | + ERROR_103("KAFKAS-MGMT-103"), |
| 94 | + |
| 95 | + /** Failed to create kafka client in the mas sso*/ |
| 96 | + ERROR_106("KAFKAS-MGMT-106"), |
| 97 | + |
| 98 | + /** Failed to get kafka client secret from the mas sso*/ |
| 99 | + ERROR_107("KAFKAS-MGMT-107"), |
| 100 | + |
| 101 | + /** Failed to get kafka client from the mas sso*/ |
| 102 | + ERROR_108("KAFKAS-MGMT-108"), |
| 103 | + |
| 104 | + /** Failed to delete kafka client from the mas sso*/ |
| 105 | + ERROR_109("KAFKAS-MGMT-109"), |
| 106 | + |
| 107 | + /** Failed to create service account*/ |
| 108 | + ERROR_110("KAFKAS-MGMT-110"), |
| 109 | + |
| 110 | + /** Failed to get service account*/ |
| 111 | + ERROR_111("KAFKAS-MGMT-111"), |
| 112 | + |
| 113 | + /** Failed to delete service account*/ |
| 114 | + ERROR_112("KAFKAS-MGMT-112"), |
| 115 | + |
| 116 | + /** Failed to find service account*/ |
| 117 | + ERROR_113("KAFKAS-MGMT-113"), |
| 118 | + |
| 119 | + /** Insufficient quota*/ |
| 120 | + ERROR_120("KAFKAS-MGMT-120"), |
| 121 | + |
| 122 | + /** Failed to check quota*/ |
| 123 | + ERROR_121("KAFKAS-MGMT-121"), |
| 124 | + |
| 125 | + /** Too Many requests*/ |
| 126 | + ERROR_429("KAFKAS-MGMT-429"), |
| 127 | + |
| 128 | + /** An unexpected error happened, please check the log of the service for details*/ |
| 129 | + ERROR_1000("KAFKAS-MGMT-1000"); |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + private String value; |
| 134 | + |
| 135 | + ApiErrorType(String value) { |
| 136 | + this.value = value; |
| 137 | + } |
| 138 | + |
| 139 | + @JsonValue |
| 140 | + public String getValue() { |
| 141 | + return value; |
| 142 | + } |
| 143 | + |
| 144 | + @Override |
| 145 | + public String toString() { |
| 146 | + return String.valueOf(value); |
| 147 | + } |
| 148 | + |
| 149 | + @JsonCreator |
| 150 | + public static ApiErrorType fromValue(String value) { |
| 151 | + for (ApiErrorType b : ApiErrorType.values()) { |
| 152 | + if (b.value.equals(value)) { |
| 153 | + return b; |
| 154 | + } |
| 155 | + } |
| 156 | + throw new IllegalArgumentException("Unexpected value '" + value + "'"); |
| 157 | + } |
| 158 | +} |
| 159 | + |
0 commit comments