code.pb.swift 11 KB

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