code.pb.swift 10 KB

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