rls.pb.swift 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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: grpc/lookup/v1/rls.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Copyright 2020 The gRPC Authors
  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 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: Sendable {
  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, Swift.CaseIterable {
  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. // The compiler won't synthesize support with the UNRECOGNIZED case.
  79. static let allCases: [Grpc_Lookup_V1_RouteLookupRequest.Reason] = [
  80. .unknown,
  81. .miss,
  82. .stale,
  83. ]
  84. }
  85. init() {}
  86. }
  87. struct Grpc_Lookup_V1_RouteLookupResponse: Sendable {
  88. // SwiftProtobuf.Message conformance is added in an extension below. See the
  89. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  90. // methods supported on all messages.
  91. /// Prioritized list (best one first) of addressable entities to use
  92. /// for routing, using syntax requested by the request target_type.
  93. /// The targets will be tried in order until a healthy one is found.
  94. var targets: [String] = []
  95. /// Optional header value to pass along to AFE in the X-Google-RLS-Data header.
  96. /// Cached with "target" and sent with all requests that match the request key.
  97. /// Allows the RLS to pass its work product to the eventual target.
  98. var headerData: String = String()
  99. /// Application-specific optional extensions.
  100. var extensions: [SwiftProtobuf.Google_Protobuf_Any] = []
  101. var unknownFields = SwiftProtobuf.UnknownStorage()
  102. init() {}
  103. }
  104. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  105. fileprivate let _protobuf_package = "grpc.lookup.v1"
  106. extension Grpc_Lookup_V1_RouteLookupRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  107. static let protoMessageName: String = _protobuf_package + ".RouteLookupRequest"
  108. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  109. 3: .standard(proto: "target_type"),
  110. 5: .same(proto: "reason"),
  111. 6: .standard(proto: "stale_header_data"),
  112. 4: .standard(proto: "key_map"),
  113. 7: .same(proto: "extensions"),
  114. ]
  115. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  116. while let fieldNumber = try decoder.nextFieldNumber() {
  117. // The use of inline closures is to circumvent an issue where the compiler
  118. // allocates stack space for every case branch when no optimizations are
  119. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  120. switch fieldNumber {
  121. case 3: try { try decoder.decodeSingularStringField(value: &self.targetType) }()
  122. case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: &self.keyMap) }()
  123. case 5: try { try decoder.decodeSingularEnumField(value: &self.reason) }()
  124. case 6: try { try decoder.decodeSingularStringField(value: &self.staleHeaderData) }()
  125. case 7: try { try decoder.decodeRepeatedMessageField(value: &self.extensions) }()
  126. default: break
  127. }
  128. }
  129. }
  130. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  131. if !self.targetType.isEmpty {
  132. try visitor.visitSingularStringField(value: self.targetType, fieldNumber: 3)
  133. }
  134. if !self.keyMap.isEmpty {
  135. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: self.keyMap, fieldNumber: 4)
  136. }
  137. if self.reason != .unknown {
  138. try visitor.visitSingularEnumField(value: self.reason, fieldNumber: 5)
  139. }
  140. if !self.staleHeaderData.isEmpty {
  141. try visitor.visitSingularStringField(value: self.staleHeaderData, fieldNumber: 6)
  142. }
  143. if !self.extensions.isEmpty {
  144. try visitor.visitRepeatedMessageField(value: self.extensions, fieldNumber: 7)
  145. }
  146. try unknownFields.traverse(visitor: &visitor)
  147. }
  148. static func ==(lhs: Grpc_Lookup_V1_RouteLookupRequest, rhs: Grpc_Lookup_V1_RouteLookupRequest) -> Bool {
  149. if lhs.targetType != rhs.targetType {return false}
  150. if lhs.reason != rhs.reason {return false}
  151. if lhs.staleHeaderData != rhs.staleHeaderData {return false}
  152. if lhs.keyMap != rhs.keyMap {return false}
  153. if lhs.extensions != rhs.extensions {return false}
  154. if lhs.unknownFields != rhs.unknownFields {return false}
  155. return true
  156. }
  157. }
  158. extension Grpc_Lookup_V1_RouteLookupRequest.Reason: SwiftProtobuf._ProtoNameProviding {
  159. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  160. 0: .same(proto: "REASON_UNKNOWN"),
  161. 1: .same(proto: "REASON_MISS"),
  162. 2: .same(proto: "REASON_STALE"),
  163. ]
  164. }
  165. extension Grpc_Lookup_V1_RouteLookupResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  166. static let protoMessageName: String = _protobuf_package + ".RouteLookupResponse"
  167. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  168. 3: .same(proto: "targets"),
  169. 2: .standard(proto: "header_data"),
  170. 4: .same(proto: "extensions"),
  171. ]
  172. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  173. while let fieldNumber = try decoder.nextFieldNumber() {
  174. // The use of inline closures is to circumvent an issue where the compiler
  175. // allocates stack space for every case branch when no optimizations are
  176. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  177. switch fieldNumber {
  178. case 2: try { try decoder.decodeSingularStringField(value: &self.headerData) }()
  179. case 3: try { try decoder.decodeRepeatedStringField(value: &self.targets) }()
  180. case 4: try { try decoder.decodeRepeatedMessageField(value: &self.extensions) }()
  181. default: break
  182. }
  183. }
  184. }
  185. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  186. if !self.headerData.isEmpty {
  187. try visitor.visitSingularStringField(value: self.headerData, fieldNumber: 2)
  188. }
  189. if !self.targets.isEmpty {
  190. try visitor.visitRepeatedStringField(value: self.targets, fieldNumber: 3)
  191. }
  192. if !self.extensions.isEmpty {
  193. try visitor.visitRepeatedMessageField(value: self.extensions, fieldNumber: 4)
  194. }
  195. try unknownFields.traverse(visitor: &visitor)
  196. }
  197. static func ==(lhs: Grpc_Lookup_V1_RouteLookupResponse, rhs: Grpc_Lookup_V1_RouteLookupResponse) -> Bool {
  198. if lhs.targets != rhs.targets {return false}
  199. if lhs.headerData != rhs.headerData {return false}
  200. if lhs.extensions != rhs.extensions {return false}
  201. if lhs.unknownFields != rhs.unknownFields {return false}
  202. return true
  203. }
  204. }