rls.pb.swift 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. //
  4. // Generated by the Swift generator plugin for the protocol buffer compiler.
  5. // Source: grpc/lookup/v1/rls.proto
  6. //
  7. // For information on using the generated types, please see the documentation:
  8. // https://github.com/apple/swift-protobuf/
  9. // Copyright 2020 The gRPC Authors
  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. struct Grpc_Lookup_V1_RouteLookupRequest {
  34. // SwiftProtobuf.Message conformance is added in an extension below. See the
  35. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  36. // methods supported on all messages.
  37. /// Target type allows the client to specify what kind of target format it
  38. /// would like from RLS to allow it to find the regional server, e.g. "grpc".
  39. var targetType: String = String()
  40. /// Reason for making this request.
  41. var reason: Grpc_Lookup_V1_RouteLookupRequest.Reason = .unknown
  42. /// For REASON_STALE, the header_data from the stale response, if any.
  43. var staleHeaderData: String = String()
  44. /// Map of key values extracted via key builders for the gRPC or HTTP request.
  45. var keyMap: Dictionary<String,String> = [:]
  46. /// Application-specific optional extensions.
  47. var extensions: [SwiftProtobuf.Google_Protobuf_Any] = []
  48. var unknownFields = SwiftProtobuf.UnknownStorage()
  49. /// Possible reasons for making a request.
  50. enum Reason: SwiftProtobuf.Enum {
  51. typealias RawValue = Int
  52. /// Unused
  53. case unknown // = 0
  54. /// No data available in local cache
  55. case miss // = 1
  56. /// Data in local cache is stale
  57. case stale // = 2
  58. case UNRECOGNIZED(Int)
  59. init() {
  60. self = .unknown
  61. }
  62. init?(rawValue: Int) {
  63. switch rawValue {
  64. case 0: self = .unknown
  65. case 1: self = .miss
  66. case 2: self = .stale
  67. default: self = .UNRECOGNIZED(rawValue)
  68. }
  69. }
  70. var rawValue: Int {
  71. switch self {
  72. case .unknown: return 0
  73. case .miss: return 1
  74. case .stale: return 2
  75. case .UNRECOGNIZED(let i): return i
  76. }
  77. }
  78. }
  79. init() {}
  80. }
  81. #if swift(>=4.2)
  82. extension Grpc_Lookup_V1_RouteLookupRequest.Reason: CaseIterable {
  83. // The compiler won't synthesize support with the UNRECOGNIZED case.
  84. static let allCases: [Grpc_Lookup_V1_RouteLookupRequest.Reason] = [
  85. .unknown,
  86. .miss,
  87. .stale,
  88. ]
  89. }
  90. #endif // swift(>=4.2)
  91. struct Grpc_Lookup_V1_RouteLookupResponse {
  92. // SwiftProtobuf.Message conformance is added in an extension below. See the
  93. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  94. // methods supported on all messages.
  95. /// Prioritized list (best one first) of addressable entities to use
  96. /// for routing, using syntax requested by the request target_type.
  97. /// The targets will be tried in order until a healthy one is found.
  98. var targets: [String] = []
  99. /// Optional header value to pass along to AFE in the X-Google-RLS-Data header.
  100. /// Cached with "target" and sent with all requests that match the request key.
  101. /// Allows the RLS to pass its work product to the eventual target.
  102. var headerData: String = String()
  103. /// Application-specific optional extensions.
  104. var extensions: [SwiftProtobuf.Google_Protobuf_Any] = []
  105. var unknownFields = SwiftProtobuf.UnknownStorage()
  106. init() {}
  107. }
  108. #if swift(>=5.5) && canImport(_Concurrency)
  109. extension Grpc_Lookup_V1_RouteLookupRequest: @unchecked Sendable {}
  110. extension Grpc_Lookup_V1_RouteLookupRequest.Reason: @unchecked Sendable {}
  111. extension Grpc_Lookup_V1_RouteLookupResponse: @unchecked Sendable {}
  112. #endif // swift(>=5.5) && canImport(_Concurrency)
  113. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  114. fileprivate let _protobuf_package = "grpc.lookup.v1"
  115. extension Grpc_Lookup_V1_RouteLookupRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  116. static let protoMessageName: String = _protobuf_package + ".RouteLookupRequest"
  117. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  118. 3: .standard(proto: "target_type"),
  119. 5: .same(proto: "reason"),
  120. 6: .standard(proto: "stale_header_data"),
  121. 4: .standard(proto: "key_map"),
  122. 7: .same(proto: "extensions"),
  123. ]
  124. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  125. while let fieldNumber = try decoder.nextFieldNumber() {
  126. // The use of inline closures is to circumvent an issue where the compiler
  127. // allocates stack space for every case branch when no optimizations are
  128. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  129. switch fieldNumber {
  130. case 3: try { try decoder.decodeSingularStringField(value: &self.targetType) }()
  131. case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: &self.keyMap) }()
  132. case 5: try { try decoder.decodeSingularEnumField(value: &self.reason) }()
  133. case 6: try { try decoder.decodeSingularStringField(value: &self.staleHeaderData) }()
  134. case 7: try { try decoder.decodeRepeatedMessageField(value: &self.extensions) }()
  135. default: break
  136. }
  137. }
  138. }
  139. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  140. if !self.targetType.isEmpty {
  141. try visitor.visitSingularStringField(value: self.targetType, fieldNumber: 3)
  142. }
  143. if !self.keyMap.isEmpty {
  144. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: self.keyMap, fieldNumber: 4)
  145. }
  146. if self.reason != .unknown {
  147. try visitor.visitSingularEnumField(value: self.reason, fieldNumber: 5)
  148. }
  149. if !self.staleHeaderData.isEmpty {
  150. try visitor.visitSingularStringField(value: self.staleHeaderData, fieldNumber: 6)
  151. }
  152. if !self.extensions.isEmpty {
  153. try visitor.visitRepeatedMessageField(value: self.extensions, fieldNumber: 7)
  154. }
  155. try unknownFields.traverse(visitor: &visitor)
  156. }
  157. static func ==(lhs: Grpc_Lookup_V1_RouteLookupRequest, rhs: Grpc_Lookup_V1_RouteLookupRequest) -> Bool {
  158. if lhs.targetType != rhs.targetType {return false}
  159. if lhs.reason != rhs.reason {return false}
  160. if lhs.staleHeaderData != rhs.staleHeaderData {return false}
  161. if lhs.keyMap != rhs.keyMap {return false}
  162. if lhs.extensions != rhs.extensions {return false}
  163. if lhs.unknownFields != rhs.unknownFields {return false}
  164. return true
  165. }
  166. }
  167. extension Grpc_Lookup_V1_RouteLookupRequest.Reason: SwiftProtobuf._ProtoNameProviding {
  168. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  169. 0: .same(proto: "REASON_UNKNOWN"),
  170. 1: .same(proto: "REASON_MISS"),
  171. 2: .same(proto: "REASON_STALE"),
  172. ]
  173. }
  174. extension Grpc_Lookup_V1_RouteLookupResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  175. static let protoMessageName: String = _protobuf_package + ".RouteLookupResponse"
  176. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  177. 3: .same(proto: "targets"),
  178. 2: .standard(proto: "header_data"),
  179. 4: .same(proto: "extensions"),
  180. ]
  181. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  182. while let fieldNumber = try decoder.nextFieldNumber() {
  183. // The use of inline closures is to circumvent an issue where the compiler
  184. // allocates stack space for every case branch when no optimizations are
  185. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  186. switch fieldNumber {
  187. case 2: try { try decoder.decodeSingularStringField(value: &self.headerData) }()
  188. case 3: try { try decoder.decodeRepeatedStringField(value: &self.targets) }()
  189. case 4: try { try decoder.decodeRepeatedMessageField(value: &self.extensions) }()
  190. default: break
  191. }
  192. }
  193. }
  194. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  195. if !self.headerData.isEmpty {
  196. try visitor.visitSingularStringField(value: self.headerData, fieldNumber: 2)
  197. }
  198. if !self.targets.isEmpty {
  199. try visitor.visitRepeatedStringField(value: self.targets, fieldNumber: 3)
  200. }
  201. if !self.extensions.isEmpty {
  202. try visitor.visitRepeatedMessageField(value: self.extensions, fieldNumber: 4)
  203. }
  204. try unknownFields.traverse(visitor: &visitor)
  205. }
  206. static func ==(lhs: Grpc_Lookup_V1_RouteLookupResponse, rhs: Grpc_Lookup_V1_RouteLookupResponse) -> Bool {
  207. if lhs.targets != rhs.targets {return false}
  208. if lhs.headerData != rhs.headerData {return false}
  209. if lhs.extensions != rhs.extensions {return false}
  210. if lhs.unknownFields != rhs.unknownFields {return false}
  211. return true
  212. }
  213. }