rls.pb.swift 9.2 KB

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