Passed
Pull Request — master (#1691)
by
unknown
03:16
created

basev1.file_base_v1_health_proto_init   D

Complexity

Conditions 13

Size

Total Lines 49
Code Lines 42

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 13
eloc 42
nop 0
dl 0
loc 49
rs 4.2
c 0
b 0
f 0

How to fix   Complexity   

Complexity

Complex classes like basev1.file_base_v1_health_proto_init often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
// Code generated by protoc-gen-go. DO NOT EDIT.
2
// versions:
3
// 	protoc-gen-go v1.34.2
4
// 	protoc        (unknown)
5
// source: base/v1/health.proto
6
7
package basev1
8
9
import (
10
	_ "github.com/envoyproxy/protoc-gen-validate/validate"
11
	_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
12
	_ "google.golang.org/genproto/googleapis/api/annotations"
13
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
14
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
15
	reflect "reflect"
16
	sync "sync"
17
)
18
19
const (
20
	// Verify that this generated code is sufficiently up-to-date.
21
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
22
	// Verify that runtime/protoimpl is sufficiently up-to-date.
23
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
24
)
25
26
type HealthCheckResponse_ServingStatus int32
27
28
const (
29
	HealthCheckResponse_UNKNOWN         HealthCheckResponse_ServingStatus = 0
30
	HealthCheckResponse_SERVING         HealthCheckResponse_ServingStatus = 1
31
	HealthCheckResponse_NOT_SERVING     HealthCheckResponse_ServingStatus = 2
32
	HealthCheckResponse_SERVICE_UNKNOWN HealthCheckResponse_ServingStatus = 3 // Used only by the Watch method.
33
)
34
35
// Enum value maps for HealthCheckResponse_ServingStatus.
36
var (
37
	HealthCheckResponse_ServingStatus_name = map[int32]string{
38
		0: "UNKNOWN",
39
		1: "SERVING",
40
		2: "NOT_SERVING",
41
		3: "SERVICE_UNKNOWN",
42
	}
43
	HealthCheckResponse_ServingStatus_value = map[string]int32{
44
		"UNKNOWN":         0,
45
		"SERVING":         1,
46
		"NOT_SERVING":     2,
47
		"SERVICE_UNKNOWN": 3,
48
	}
49
)
50
51
func (x HealthCheckResponse_ServingStatus) Enum() *HealthCheckResponse_ServingStatus {
52
	p := new(HealthCheckResponse_ServingStatus)
53
	*p = x
54
	return p
55
}
56
57
func (x HealthCheckResponse_ServingStatus) String() string {
58
	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
59
}
60
61
func (HealthCheckResponse_ServingStatus) Descriptor() protoreflect.EnumDescriptor {
62
	return file_base_v1_health_proto_enumTypes[0].Descriptor()
63
}
64
65
func (HealthCheckResponse_ServingStatus) Type() protoreflect.EnumType {
66
	return &file_base_v1_health_proto_enumTypes[0]
67
}
68
69
func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber {
70
	return protoreflect.EnumNumber(x)
71
}
72
73
// Deprecated: Use HealthCheckResponse_ServingStatus.Descriptor instead.
74
func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) {
75
	return file_base_v1_health_proto_rawDescGZIP(), []int{1, 0}
76
}
77
78
type HealthCheckRequest struct {
79
	state         protoimpl.MessageState
80
	sizeCache     protoimpl.SizeCache
81
	unknownFields protoimpl.UnknownFields
82
83
	Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
84
}
85
86
func (x *HealthCheckRequest) Reset() {
87
	*x = HealthCheckRequest{}
88
	if protoimpl.UnsafeEnabled {
89
		mi := &file_base_v1_health_proto_msgTypes[0]
90
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
91
		ms.StoreMessageInfo(mi)
92
	}
93
}
94
95
func (x *HealthCheckRequest) String() string {
96
	return protoimpl.X.MessageStringOf(x)
97
}
98
99
func (*HealthCheckRequest) ProtoMessage() {}
100
101
func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message {
102
	mi := &file_base_v1_health_proto_msgTypes[0]
103
	if protoimpl.UnsafeEnabled && x != nil {
104
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
105
		if ms.LoadMessageInfo() == nil {
106
			ms.StoreMessageInfo(mi)
107
		}
108
		return ms
109
	}
110
	return mi.MessageOf(x)
111
}
112
113
// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.
114
func (*HealthCheckRequest) Descriptor() ([]byte, []int) {
115
	return file_base_v1_health_proto_rawDescGZIP(), []int{0}
116
}
117
118
func (x *HealthCheckRequest) GetService() string {
119
	if x != nil {
120
		return x.Service
121
	}
122
	return ""
123
}
124
125
type HealthCheckResponse struct {
126
	state         protoimpl.MessageState
127
	sizeCache     protoimpl.SizeCache
128
	unknownFields protoimpl.UnknownFields
129
130
	Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=base.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"`
131
}
132
133
func (x *HealthCheckResponse) Reset() {
134
	*x = HealthCheckResponse{}
135
	if protoimpl.UnsafeEnabled {
136
		mi := &file_base_v1_health_proto_msgTypes[1]
137
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
138
		ms.StoreMessageInfo(mi)
139
	}
140
}
141
142
func (x *HealthCheckResponse) String() string {
143
	return protoimpl.X.MessageStringOf(x)
144
}
145
146
func (*HealthCheckResponse) ProtoMessage() {}
147
148
func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message {
149
	mi := &file_base_v1_health_proto_msgTypes[1]
150
	if protoimpl.UnsafeEnabled && x != nil {
151
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
152
		if ms.LoadMessageInfo() == nil {
153
			ms.StoreMessageInfo(mi)
154
		}
155
		return ms
156
	}
157
	return mi.MessageOf(x)
158
}
159
160
// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.
161
func (*HealthCheckResponse) Descriptor() ([]byte, []int) {
162
	return file_base_v1_health_proto_rawDescGZIP(), []int{1}
163
}
164
165
func (x *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus {
166
	if x != nil {
167
		return x.Status
168
	}
169
	return HealthCheckResponse_UNKNOWN
170
}
171
172
var File_base_v1_health_proto protoreflect.FileDescriptor
173
174
var file_base_v1_health_proto_rawDesc = []byte{
175
	0x0a, 0x14, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68,
176
	0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x1a,
177
	0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f,
178
	0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70,
179
	0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70,
180
	0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f,
181
	0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76,
182
	0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65,
183
	0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2e, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68,
184
	0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07,
185
	0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73,
186
	0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74,
187
	0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42,
188
	0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a,
189
	0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43,
190
	0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72,
191
	0x76, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
192
	0x75, 0x73, 0x22, 0x4f, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61,
193
	0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00,
194
	0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0f, 0x0a,
195
	0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x13,
196
	0x0a, 0x0f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57,
197
	0x4e, 0x10, 0x03, 0x32, 0xe5, 0x02, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x94,
198
	0x02, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1b, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e,
199
	0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65,
200
	0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
201
	0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f,
202
	0x6e, 0x73, 0x65, 0x22, 0xcf, 0x01, 0x92, 0x41, 0xbb, 0x01, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x6c,
203
	0x74, 0x68, 0x12, 0x0a, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x20, 0x61, 0x70, 0x69, 0x2a, 0x0c,
204
	0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x6a, 0x96, 0x01, 0x0a,
205
	0x0d, 0x78, 0x2d, 0x63, 0x6f, 0x64, 0x65, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x12, 0x84,
206
	0x01, 0x32, 0x81, 0x01, 0x0a, 0x29, 0x2a, 0x27, 0x0a, 0x0b, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65,
207
	0x6c, 0x12, 0x02, 0x1a, 0x00, 0x0a, 0x0a, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x02, 0x1a,
208
	0x00, 0x0a, 0x0c, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x02, 0x1a, 0x00, 0x0a,
209
	0x29, 0x2a, 0x27, 0x0a, 0x0b, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x02, 0x1a, 0x00,
210
	0x0a, 0x0a, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x02, 0x1a, 0x00, 0x0a, 0x0c, 0x0a, 0x06,
211
	0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x02, 0x1a, 0x00, 0x0a, 0x29, 0x2a, 0x27, 0x0a, 0x0b,
212
	0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x02, 0x1a, 0x00, 0x0a, 0x0a, 0x0a, 0x04, 0x6c,
213
	0x61, 0x6e, 0x67, 0x12, 0x02, 0x1a, 0x00, 0x0a, 0x0c, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63,
214
	0x65, 0x12, 0x02, 0x1a, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f, 0x68, 0x65,
215
	0x61, 0x6c, 0x74, 0x68, 0x7a, 0x12, 0x44, 0x0a, 0x05, 0x57, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1b,
216
	0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43,
217
	0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x62, 0x61,
218
	0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63,
219
	0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x89, 0x01, 0x0a, 0x0b,
220
	0x63, 0x6f, 0x6d, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x48, 0x65, 0x61,
221
	0x6c, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68,
222
	0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x66, 0x79, 0x2f, 0x70,
223
	0x65, 0x72, 0x6d, 0x69, 0x66, 0x79, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x62, 0x2f, 0x62, 0x61,
224
	0x73, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x61, 0x73, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x42,
225
	0x58, 0x58, 0xaa, 0x02, 0x07, 0x42, 0x61, 0x73, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x07, 0x42,
226
	0x61, 0x73, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x13, 0x42, 0x61, 0x73, 0x65, 0x5c, 0x56, 0x31,
227
	0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x08, 0x42,
228
	0x61, 0x73, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
229
}
230
231
var (
232
	file_base_v1_health_proto_rawDescOnce sync.Once
233
	file_base_v1_health_proto_rawDescData = file_base_v1_health_proto_rawDesc
234
)
235
236
func file_base_v1_health_proto_rawDescGZIP() []byte {
237
	file_base_v1_health_proto_rawDescOnce.Do(func() {
238
		file_base_v1_health_proto_rawDescData = protoimpl.X.CompressGZIP(file_base_v1_health_proto_rawDescData)
239
	})
240
	return file_base_v1_health_proto_rawDescData
241
}
242
243
var file_base_v1_health_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
244
var file_base_v1_health_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
245
var file_base_v1_health_proto_goTypes = []any{
246
	(HealthCheckResponse_ServingStatus)(0), // 0: base.v1.HealthCheckResponse.ServingStatus
247
	(*HealthCheckRequest)(nil),             // 1: base.v1.HealthCheckRequest
248
	(*HealthCheckResponse)(nil),            // 2: base.v1.HealthCheckResponse
249
}
250
var file_base_v1_health_proto_depIdxs = []int32{
251
	0, // 0: base.v1.HealthCheckResponse.status:type_name -> base.v1.HealthCheckResponse.ServingStatus
252
	1, // 1: base.v1.Health.Check:input_type -> base.v1.HealthCheckRequest
253
	1, // 2: base.v1.Health.Watch:input_type -> base.v1.HealthCheckRequest
254
	2, // 3: base.v1.Health.Check:output_type -> base.v1.HealthCheckResponse
255
	2, // 4: base.v1.Health.Watch:output_type -> base.v1.HealthCheckResponse
256
	3, // [3:5] is the sub-list for method output_type
257
	1, // [1:3] is the sub-list for method input_type
258
	1, // [1:1] is the sub-list for extension type_name
259
	1, // [1:1] is the sub-list for extension extendee
260
	0, // [0:1] is the sub-list for field type_name
261
}
262
263
func init() { file_base_v1_health_proto_init() }
264
func file_base_v1_health_proto_init() {
265
	if File_base_v1_health_proto != nil {
266
		return
267
	}
268
	if !protoimpl.UnsafeEnabled {
269
		file_base_v1_health_proto_msgTypes[0].Exporter = func(v any, i int) any {
270
			switch v := v.(*HealthCheckRequest); i {
271
			case 0:
272
				return &v.state
273
			case 1:
274
				return &v.sizeCache
275
			case 2:
276
				return &v.unknownFields
277
			default:
278
				return nil
279
			}
280
		}
281
		file_base_v1_health_proto_msgTypes[1].Exporter = func(v any, i int) any {
282
			switch v := v.(*HealthCheckResponse); i {
283
			case 0:
284
				return &v.state
285
			case 1:
286
				return &v.sizeCache
287
			case 2:
288
				return &v.unknownFields
289
			default:
290
				return nil
291
			}
292
		}
293
	}
294
	type x struct{}
295
	out := protoimpl.TypeBuilder{
296
		File: protoimpl.DescBuilder{
297
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
298
			RawDescriptor: file_base_v1_health_proto_rawDesc,
299
			NumEnums:      1,
300
			NumMessages:   2,
301
			NumExtensions: 0,
302
			NumServices:   1,
303
		},
304
		GoTypes:           file_base_v1_health_proto_goTypes,
305
		DependencyIndexes: file_base_v1_health_proto_depIdxs,
306
		EnumInfos:         file_base_v1_health_proto_enumTypes,
307
		MessageInfos:      file_base_v1_health_proto_msgTypes,
308
	}.Build()
309
	File_base_v1_health_proto = out.File
310
	file_base_v1_health_proto_rawDesc = nil
311
	file_base_v1_health_proto_goTypes = nil
312
	file_base_v1_health_proto_depIdxs = nil
313
}
314
315