|
| 1 | +// DO NOT EDIT. |
| 2 | +// swift-format-ignore-file |
| 3 | +// swiftlint:disable all |
| 4 | +// |
| 5 | +// Generated by the Swift generator plugin for the protocol buffer compiler. |
| 6 | +// Source: code.proto |
| 7 | +// |
| 8 | +// For information on using the generated types, please see the documentation: |
| 9 | +// https://github.com/apple/swift-protobuf/ |
| 10 | + |
| 11 | +// Copyright 2024 Google LLC |
| 12 | +// |
| 13 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 14 | +// you may not use this file except in compliance with the License. |
| 15 | +// You may obtain a copy of the License at |
| 16 | +// |
| 17 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 18 | +// |
| 19 | +// Unless required by applicable law or agreed to in writing, software |
| 20 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 21 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 22 | +// See the License for the specific language governing permissions and |
| 23 | +// limitations under the License. |
| 24 | + |
| 25 | +internal import SwiftProtobuf |
| 26 | + |
| 27 | +// If the compiler emits an error on this type, it is because this file |
| 28 | +// was generated by a version of the `protoc` Swift plug-in that is |
| 29 | +// incompatible with the version of SwiftProtobuf to which you are linking. |
| 30 | +// Please ensure that you are building against the same version of the API |
| 31 | +// that was used to generate this file. |
| 32 | +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { |
| 33 | + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} |
| 34 | + typealias Version = _2 |
| 35 | +} |
| 36 | + |
| 37 | +/// The canonical error codes for gRPC APIs. |
| 38 | +/// |
| 39 | +/// |
| 40 | +/// Sometimes multiple error codes may apply. Services should return |
| 41 | +/// the most specific error code that applies. For example, prefer |
| 42 | +/// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply. |
| 43 | +/// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`. |
| 44 | +enum Google_Rpc_Code: SwiftProtobuf.Enum, Swift.CaseIterable { |
| 45 | + typealias RawValue = Int |
| 46 | + |
| 47 | + /// Not an error; returned on success. |
| 48 | + /// |
| 49 | + /// HTTP Mapping: 200 OK |
| 50 | + case ok // = 0 |
| 51 | + |
| 52 | + /// The operation was cancelled, typically by the caller. |
| 53 | + /// |
| 54 | + /// HTTP Mapping: 499 Client Closed Request |
| 55 | + case cancelled // = 1 |
| 56 | + |
| 57 | + /// Unknown error. For example, this error may be returned when |
| 58 | + /// a `Status` value received from another address space belongs to |
| 59 | + /// an error space that is not known in this address space. Also |
| 60 | + /// errors raised by APIs that do not return enough error information |
| 61 | + /// may be converted to this error. |
| 62 | + /// |
| 63 | + /// HTTP Mapping: 500 Internal Server Error |
| 64 | + case unknown // = 2 |
| 65 | + |
| 66 | + /// The client specified an invalid argument. Note that this differs |
| 67 | + /// from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments |
| 68 | + /// that are problematic regardless of the state of the system |
| 69 | + /// (e.g., a malformed file name). |
| 70 | + /// |
| 71 | + /// HTTP Mapping: 400 Bad Request |
| 72 | + case invalidArgument // = 3 |
| 73 | + |
| 74 | + /// The deadline expired before the operation could complete. For operations |
| 75 | + /// that change the state of the system, this error may be returned |
| 76 | + /// even if the operation has completed successfully. For example, a |
| 77 | + /// successful response from a server could have been delayed long |
| 78 | + /// enough for the deadline to expire. |
| 79 | + /// |
| 80 | + /// HTTP Mapping: 504 Gateway Timeout |
| 81 | + case deadlineExceeded // = 4 |
| 82 | + |
| 83 | + /// Some requested entity (e.g., file or directory) was not found. |
| 84 | + /// |
| 85 | + /// Note to server developers: if a request is denied for an entire class |
| 86 | + /// of users, such as gradual feature rollout or undocumented allowlist, |
| 87 | + /// `NOT_FOUND` may be used. If a request is denied for some users within |
| 88 | + /// a class of users, such as user-based access control, `PERMISSION_DENIED` |
| 89 | + /// must be used. |
| 90 | + /// |
| 91 | + /// HTTP Mapping: 404 Not Found |
| 92 | + case notFound // = 5 |
| 93 | + |
| 94 | + /// The entity that a client attempted to create (e.g., file or directory) |
| 95 | + /// already exists. |
| 96 | + /// |
| 97 | + /// HTTP Mapping: 409 Conflict |
| 98 | + case alreadyExists // = 6 |
| 99 | + |
| 100 | + /// The caller does not have permission to execute the specified |
| 101 | + /// operation. `PERMISSION_DENIED` must not be used for rejections |
| 102 | + /// caused by exhausting some resource (use `RESOURCE_EXHAUSTED` |
| 103 | + /// instead for those errors). `PERMISSION_DENIED` must not be |
| 104 | + /// used if the caller can not be identified (use `UNAUTHENTICATED` |
| 105 | + /// instead for those errors). This error code does not imply the |
| 106 | + /// request is valid or the requested entity exists or satisfies |
| 107 | + /// other pre-conditions. |
| 108 | + /// |
| 109 | + /// HTTP Mapping: 403 Forbidden |
| 110 | + case permissionDenied // = 7 |
| 111 | + |
| 112 | + /// The request does not have valid authentication credentials for the |
| 113 | + /// operation. |
| 114 | + /// |
| 115 | + /// HTTP Mapping: 401 Unauthorized |
| 116 | + case unauthenticated // = 16 |
| 117 | + |
| 118 | + /// Some resource has been exhausted, perhaps a per-user quota, or |
| 119 | + /// perhaps the entire file system is out of space. |
| 120 | + /// |
| 121 | + /// HTTP Mapping: 429 Too Many Requests |
| 122 | + case resourceExhausted // = 8 |
| 123 | + |
| 124 | + /// The operation was rejected because the system is not in a state |
| 125 | + /// required for the operation's execution. For example, the directory |
| 126 | + /// to be deleted is non-empty, an rmdir operation is applied to |
| 127 | + /// a non-directory, etc. |
| 128 | + /// |
| 129 | + /// Service implementors can use the following guidelines to decide |
| 130 | + /// between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: |
| 131 | + /// (a) Use `UNAVAILABLE` if the client can retry just the failing call. |
| 132 | + /// (b) Use `ABORTED` if the client should retry at a higher level. For |
| 133 | + /// example, when a client-specified test-and-set fails, indicating the |
| 134 | + /// client should restart a read-modify-write sequence. |
| 135 | + /// (c) Use `FAILED_PRECONDITION` if the client should not retry until |
| 136 | + /// the system state has been explicitly fixed. For example, if an "rmdir" |
| 137 | + /// fails because the directory is non-empty, `FAILED_PRECONDITION` |
| 138 | + /// should be returned since the client should not retry unless |
| 139 | + /// the files are deleted from the directory. |
| 140 | + /// |
| 141 | + /// HTTP Mapping: 400 Bad Request |
| 142 | + case failedPrecondition // = 9 |
| 143 | + |
| 144 | + /// The operation was aborted, typically due to a concurrency issue such as |
| 145 | + /// a sequencer check failure or transaction abort. |
| 146 | + /// |
| 147 | + /// See the guidelines above for deciding between `FAILED_PRECONDITION`, |
| 148 | + /// `ABORTED`, and `UNAVAILABLE`. |
| 149 | + /// |
| 150 | + /// HTTP Mapping: 409 Conflict |
| 151 | + case aborted // = 10 |
| 152 | + |
| 153 | + /// The operation was attempted past the valid range. E.g., seeking or |
| 154 | + /// reading past end-of-file. |
| 155 | + /// |
| 156 | + /// Unlike `INVALID_ARGUMENT`, this error indicates a problem that may |
| 157 | + /// be fixed if the system state changes. For example, a 32-bit file |
| 158 | + /// system will generate `INVALID_ARGUMENT` if asked to read at an |
| 159 | + /// offset that is not in the range [0,2^32-1], but it will generate |
| 160 | + /// `OUT_OF_RANGE` if asked to read from an offset past the current |
| 161 | + /// file size. |
| 162 | + /// |
| 163 | + /// There is a fair bit of overlap between `FAILED_PRECONDITION` and |
| 164 | + /// `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific |
| 165 | + /// error) when it applies so that callers who are iterating through |
| 166 | + /// a space can easily look for an `OUT_OF_RANGE` error to detect when |
| 167 | + /// they are done. |
| 168 | + /// |
| 169 | + /// HTTP Mapping: 400 Bad Request |
| 170 | + case outOfRange // = 11 |
| 171 | + |
| 172 | + /// The operation is not implemented or is not supported/enabled in this |
| 173 | + /// service. |
| 174 | + /// |
| 175 | + /// HTTP Mapping: 501 Not Implemented |
| 176 | + case unimplemented // = 12 |
| 177 | + |
| 178 | + /// Internal errors. This means that some invariants expected by the |
| 179 | + /// underlying system have been broken. This error code is reserved |
| 180 | + /// for serious errors. |
| 181 | + /// |
| 182 | + /// HTTP Mapping: 500 Internal Server Error |
| 183 | + case `internal` // = 13 |
| 184 | + |
| 185 | + /// The service is currently unavailable. This is most likely a |
| 186 | + /// transient condition, which can be corrected by retrying with |
| 187 | + /// a backoff. Note that it is not always safe to retry |
| 188 | + /// non-idempotent operations. |
| 189 | + /// |
| 190 | + /// See the guidelines above for deciding between `FAILED_PRECONDITION`, |
| 191 | + /// `ABORTED`, and `UNAVAILABLE`. |
| 192 | + /// |
| 193 | + /// HTTP Mapping: 503 Service Unavailable |
| 194 | + case unavailable // = 14 |
| 195 | + |
| 196 | + /// Unrecoverable data loss or corruption. |
| 197 | + /// |
| 198 | + /// HTTP Mapping: 500 Internal Server Error |
| 199 | + case dataLoss // = 15 |
| 200 | + case UNRECOGNIZED(Int) |
| 201 | + |
| 202 | + init() { |
| 203 | + self = .ok |
| 204 | + } |
| 205 | + |
| 206 | + init?(rawValue: Int) { |
| 207 | + switch rawValue { |
| 208 | + case 0: self = .ok |
| 209 | + case 1: self = .cancelled |
| 210 | + case 2: self = .unknown |
| 211 | + case 3: self = .invalidArgument |
| 212 | + case 4: self = .deadlineExceeded |
| 213 | + case 5: self = .notFound |
| 214 | + case 6: self = .alreadyExists |
| 215 | + case 7: self = .permissionDenied |
| 216 | + case 8: self = .resourceExhausted |
| 217 | + case 9: self = .failedPrecondition |
| 218 | + case 10: self = .aborted |
| 219 | + case 11: self = .outOfRange |
| 220 | + case 12: self = .unimplemented |
| 221 | + case 13: self = .internal |
| 222 | + case 14: self = .unavailable |
| 223 | + case 15: self = .dataLoss |
| 224 | + case 16: self = .unauthenticated |
| 225 | + default: self = .UNRECOGNIZED(rawValue) |
| 226 | + } |
| 227 | + } |
| 228 | + |
| 229 | + var rawValue: Int { |
| 230 | + switch self { |
| 231 | + case .ok: return 0 |
| 232 | + case .cancelled: return 1 |
| 233 | + case .unknown: return 2 |
| 234 | + case .invalidArgument: return 3 |
| 235 | + case .deadlineExceeded: return 4 |
| 236 | + case .notFound: return 5 |
| 237 | + case .alreadyExists: return 6 |
| 238 | + case .permissionDenied: return 7 |
| 239 | + case .resourceExhausted: return 8 |
| 240 | + case .failedPrecondition: return 9 |
| 241 | + case .aborted: return 10 |
| 242 | + case .outOfRange: return 11 |
| 243 | + case .unimplemented: return 12 |
| 244 | + case .internal: return 13 |
| 245 | + case .unavailable: return 14 |
| 246 | + case .dataLoss: return 15 |
| 247 | + case .unauthenticated: return 16 |
| 248 | + case .UNRECOGNIZED(let i): return i |
| 249 | + } |
| 250 | + } |
| 251 | + |
| 252 | + // The compiler won't synthesize support with the UNRECOGNIZED case. |
| 253 | + static let allCases: [Google_Rpc_Code] = [ |
| 254 | + .ok, |
| 255 | + .cancelled, |
| 256 | + .unknown, |
| 257 | + .invalidArgument, |
| 258 | + .deadlineExceeded, |
| 259 | + .notFound, |
| 260 | + .alreadyExists, |
| 261 | + .permissionDenied, |
| 262 | + .unauthenticated, |
| 263 | + .resourceExhausted, |
| 264 | + .failedPrecondition, |
| 265 | + .aborted, |
| 266 | + .outOfRange, |
| 267 | + .unimplemented, |
| 268 | + .internal, |
| 269 | + .unavailable, |
| 270 | + .dataLoss, |
| 271 | + ] |
| 272 | + |
| 273 | +} |
| 274 | + |
| 275 | +// MARK: - Code below here is support for the SwiftProtobuf runtime. |
| 276 | + |
| 277 | +extension Google_Rpc_Code: SwiftProtobuf._ProtoNameProviding { |
| 278 | + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ |
| 279 | + 0: .same(proto: "OK"), |
| 280 | + 1: .same(proto: "CANCELLED"), |
| 281 | + 2: .same(proto: "UNKNOWN"), |
| 282 | + 3: .same(proto: "INVALID_ARGUMENT"), |
| 283 | + 4: .same(proto: "DEADLINE_EXCEEDED"), |
| 284 | + 5: .same(proto: "NOT_FOUND"), |
| 285 | + 6: .same(proto: "ALREADY_EXISTS"), |
| 286 | + 7: .same(proto: "PERMISSION_DENIED"), |
| 287 | + 8: .same(proto: "RESOURCE_EXHAUSTED"), |
| 288 | + 9: .same(proto: "FAILED_PRECONDITION"), |
| 289 | + 10: .same(proto: "ABORTED"), |
| 290 | + 11: .same(proto: "OUT_OF_RANGE"), |
| 291 | + 12: .same(proto: "UNIMPLEMENTED"), |
| 292 | + 13: .same(proto: "INTERNAL"), |
| 293 | + 14: .same(proto: "UNAVAILABLE"), |
| 294 | + 15: .same(proto: "DATA_LOSS"), |
| 295 | + 16: .same(proto: "UNAUTHENTICATED"), |
| 296 | + ] |
| 297 | +} |
0 commit comments