health.pb.swift 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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: health.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Copyright 2015 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. // The canonical version of this proto can be found at
  24. // https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
  25. import Foundation
  26. import SwiftProtobuf
  27. // If the compiler emits an error on this type, it is because this file
  28. // was generated by a version of the `protoc` Swift plug-in that is
  29. // incompatible with the version of SwiftProtobuf to which you are linking.
  30. // Please ensure that you are building against the same version of the API
  31. // that was used to generate this file.
  32. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  33. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  34. typealias Version = _2
  35. }
  36. package struct Grpc_Health_V1_HealthCheckRequest: Sendable {
  37. // SwiftProtobuf.Message conformance is added in an extension below. See the
  38. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  39. // methods supported on all messages.
  40. package var service: String = String()
  41. package var unknownFields = SwiftProtobuf.UnknownStorage()
  42. package init() {}
  43. }
  44. package struct Grpc_Health_V1_HealthCheckResponse: Sendable {
  45. // SwiftProtobuf.Message conformance is added in an extension below. See the
  46. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  47. // methods supported on all messages.
  48. package var status: Grpc_Health_V1_HealthCheckResponse.ServingStatus = .unknown
  49. package var unknownFields = SwiftProtobuf.UnknownStorage()
  50. package enum ServingStatus: SwiftProtobuf.Enum, Swift.CaseIterable {
  51. package typealias RawValue = Int
  52. case unknown // = 0
  53. case serving // = 1
  54. case notServing // = 2
  55. /// Used only by the Watch method.
  56. case serviceUnknown // = 3
  57. case UNRECOGNIZED(Int)
  58. package init() {
  59. self = .unknown
  60. }
  61. package init?(rawValue: Int) {
  62. switch rawValue {
  63. case 0: self = .unknown
  64. case 1: self = .serving
  65. case 2: self = .notServing
  66. case 3: self = .serviceUnknown
  67. default: self = .UNRECOGNIZED(rawValue)
  68. }
  69. }
  70. package var rawValue: Int {
  71. switch self {
  72. case .unknown: return 0
  73. case .serving: return 1
  74. case .notServing: return 2
  75. case .serviceUnknown: return 3
  76. case .UNRECOGNIZED(let i): return i
  77. }
  78. }
  79. // The compiler won't synthesize support with the UNRECOGNIZED case.
  80. package static let allCases: [Grpc_Health_V1_HealthCheckResponse.ServingStatus] = [
  81. .unknown,
  82. .serving,
  83. .notServing,
  84. .serviceUnknown,
  85. ]
  86. }
  87. package init() {}
  88. }
  89. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  90. fileprivate let _protobuf_package = "grpc.health.v1"
  91. extension Grpc_Health_V1_HealthCheckRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  92. package static let protoMessageName: String = _protobuf_package + ".HealthCheckRequest"
  93. package static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  94. 1: .same(proto: "service"),
  95. ]
  96. package mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  97. while let fieldNumber = try decoder.nextFieldNumber() {
  98. // The use of inline closures is to circumvent an issue where the compiler
  99. // allocates stack space for every case branch when no optimizations are
  100. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  101. switch fieldNumber {
  102. case 1: try { try decoder.decodeSingularStringField(value: &self.service) }()
  103. default: break
  104. }
  105. }
  106. }
  107. package func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  108. if !self.service.isEmpty {
  109. try visitor.visitSingularStringField(value: self.service, fieldNumber: 1)
  110. }
  111. try unknownFields.traverse(visitor: &visitor)
  112. }
  113. package static func ==(lhs: Grpc_Health_V1_HealthCheckRequest, rhs: Grpc_Health_V1_HealthCheckRequest) -> Bool {
  114. if lhs.service != rhs.service {return false}
  115. if lhs.unknownFields != rhs.unknownFields {return false}
  116. return true
  117. }
  118. }
  119. extension Grpc_Health_V1_HealthCheckResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  120. package static let protoMessageName: String = _protobuf_package + ".HealthCheckResponse"
  121. package static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  122. 1: .same(proto: "status"),
  123. ]
  124. package 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 1: try { try decoder.decodeSingularEnumField(value: &self.status) }()
  131. default: break
  132. }
  133. }
  134. }
  135. package func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  136. if self.status != .unknown {
  137. try visitor.visitSingularEnumField(value: self.status, fieldNumber: 1)
  138. }
  139. try unknownFields.traverse(visitor: &visitor)
  140. }
  141. package static func ==(lhs: Grpc_Health_V1_HealthCheckResponse, rhs: Grpc_Health_V1_HealthCheckResponse) -> Bool {
  142. if lhs.status != rhs.status {return false}
  143. if lhs.unknownFields != rhs.unknownFields {return false}
  144. return true
  145. }
  146. }
  147. extension Grpc_Health_V1_HealthCheckResponse.ServingStatus: SwiftProtobuf._ProtoNameProviding {
  148. package static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  149. 0: .same(proto: "UNKNOWN"),
  150. 1: .same(proto: "SERVING"),
  151. 2: .same(proto: "NOT_SERVING"),
  152. 3: .same(proto: "SERVICE_UNKNOWN"),
  153. ]
  154. }