// DO NOT EDIT. // swift-format-ignore-file // swiftlint:disable all // // Generated by the Swift generator plugin for the protocol buffer compiler. // Source: grpc/lookup/v1/rls.proto // // For information on using the generated types, please see the documentation: // https://github.com/apple/swift-protobuf/ // Copyright 2020 The gRPC Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. import SwiftProtobuf // If the compiler emits an error on this type, it is because this file // was generated by a version of the `protoc` Swift plug-in that is // incompatible with the version of SwiftProtobuf to which you are linking. // Please ensure that you are building against the same version of the API // that was used to generate this file. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} typealias Version = _2 } struct Grpc_Lookup_V1_RouteLookupRequest: Sendable { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// Target type allows the client to specify what kind of target format it /// would like from RLS to allow it to find the regional server, e.g. "grpc". var targetType: String = String() /// Reason for making this request. var reason: Grpc_Lookup_V1_RouteLookupRequest.Reason = .unknown /// For REASON_STALE, the header_data from the stale response, if any. var staleHeaderData: String = String() /// Map of key values extracted via key builders for the gRPC or HTTP request. var keyMap: Dictionary = [:] /// Application-specific optional extensions. var extensions: [SwiftProtobuf.Google_Protobuf_Any] = [] var unknownFields = SwiftProtobuf.UnknownStorage() /// Possible reasons for making a request. enum Reason: SwiftProtobuf.Enum, Swift.CaseIterable { typealias RawValue = Int /// Unused case unknown // = 0 /// No data available in local cache case miss // = 1 /// Data in local cache is stale case stale // = 2 case UNRECOGNIZED(Int) init() { self = .unknown } init?(rawValue: Int) { switch rawValue { case 0: self = .unknown case 1: self = .miss case 2: self = .stale default: self = .UNRECOGNIZED(rawValue) } } var rawValue: Int { switch self { case .unknown: return 0 case .miss: return 1 case .stale: return 2 case .UNRECOGNIZED(let i): return i } } // The compiler won't synthesize support with the UNRECOGNIZED case. static let allCases: [Grpc_Lookup_V1_RouteLookupRequest.Reason] = [ .unknown, .miss, .stale, ] } init() {} } struct Grpc_Lookup_V1_RouteLookupResponse: Sendable { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for // methods supported on all messages. /// Prioritized list (best one first) of addressable entities to use /// for routing, using syntax requested by the request target_type. /// The targets will be tried in order until a healthy one is found. var targets: [String] = [] /// Optional header value to pass along to AFE in the X-Google-RLS-Data header. /// Cached with "target" and sent with all requests that match the request key. /// Allows the RLS to pass its work product to the eventual target. var headerData: String = String() /// Application-specific optional extensions. var extensions: [SwiftProtobuf.Google_Protobuf_Any] = [] var unknownFields = SwiftProtobuf.UnknownStorage() init() {} } // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "grpc.lookup.v1" extension Grpc_Lookup_V1_RouteLookupRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".RouteLookupRequest" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 3: .standard(proto: "target_type"), 5: .same(proto: "reason"), 6: .standard(proto: "stale_header_data"), 4: .standard(proto: "key_map"), 7: .same(proto: "extensions"), ] mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 3: try { try decoder.decodeSingularStringField(value: &self.targetType) }() case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.keyMap) }() case 5: try { try decoder.decodeSingularEnumField(value: &self.reason) }() case 6: try { try decoder.decodeSingularStringField(value: &self.staleHeaderData) }() case 7: try { try decoder.decodeRepeatedMessageField(value: &self.extensions) }() default: break } } } func traverse(visitor: inout V) throws { if !self.targetType.isEmpty { try visitor.visitSingularStringField(value: self.targetType, fieldNumber: 3) } if !self.keyMap.isEmpty { try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.keyMap, fieldNumber: 4) } if self.reason != .unknown { try visitor.visitSingularEnumField(value: self.reason, fieldNumber: 5) } if !self.staleHeaderData.isEmpty { try visitor.visitSingularStringField(value: self.staleHeaderData, fieldNumber: 6) } if !self.extensions.isEmpty { try visitor.visitRepeatedMessageField(value: self.extensions, fieldNumber: 7) } try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Grpc_Lookup_V1_RouteLookupRequest, rhs: Grpc_Lookup_V1_RouteLookupRequest) -> Bool { if lhs.targetType != rhs.targetType {return false} if lhs.reason != rhs.reason {return false} if lhs.staleHeaderData != rhs.staleHeaderData {return false} if lhs.keyMap != rhs.keyMap {return false} if lhs.extensions != rhs.extensions {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } } extension Grpc_Lookup_V1_RouteLookupRequest.Reason: SwiftProtobuf._ProtoNameProviding { static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "REASON_UNKNOWN"), 1: .same(proto: "REASON_MISS"), 2: .same(proto: "REASON_STALE"), ] } extension Grpc_Lookup_V1_RouteLookupResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { static let protoMessageName: String = _protobuf_package + ".RouteLookupResponse" static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 3: .same(proto: "targets"), 2: .standard(proto: "header_data"), 4: .same(proto: "extensions"), ] mutating func decodeMessage(decoder: inout D) throws { while let fieldNumber = try decoder.nextFieldNumber() { // The use of inline closures is to circumvent an issue where the compiler // allocates stack space for every case branch when no optimizations are // enabled. https://github.com/apple/swift-protobuf/issues/1034 switch fieldNumber { case 2: try { try decoder.decodeSingularStringField(value: &self.headerData) }() case 3: try { try decoder.decodeRepeatedStringField(value: &self.targets) }() case 4: try { try decoder.decodeRepeatedMessageField(value: &self.extensions) }() default: break } } } func traverse(visitor: inout V) throws { if !self.headerData.isEmpty { try visitor.visitSingularStringField(value: self.headerData, fieldNumber: 2) } if !self.targets.isEmpty { try visitor.visitRepeatedStringField(value: self.targets, fieldNumber: 3) } if !self.extensions.isEmpty { try visitor.visitRepeatedMessageField(value: self.extensions, fieldNumber: 4) } try unknownFields.traverse(visitor: &visitor) } static func ==(lhs: Grpc_Lookup_V1_RouteLookupResponse, rhs: Grpc_Lookup_V1_RouteLookupResponse) -> Bool { if lhs.targets != rhs.targets {return false} if lhs.headerData != rhs.headerData {return false} if lhs.extensions != rhs.extensions {return false} if lhs.unknownFields != rhs.unknownFields {return false} return true } }