health.pb.swift 6.6 KB

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