@miradorlabs/web-grpc 2.18.0 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1757 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v3.21.12
5
+ // source: proto/gateway/web/v1/slo_gateway.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { Metadata } from "@grpc/grpc-js";
10
+ import { Timestamp } from "../../../../google/protobuf/timestamp";
11
+ import { ResponseStatus } from "../../common/v1/status";
12
+
13
+ export const protobufPackage = "gateway.web.v1";
14
+
15
+ export enum SloComparator {
16
+ SLO_COMPARATOR_UNSPECIFIED = 0,
17
+ SLO_COMPARATOR_GREATER_THAN = 1,
18
+ SLO_COMPARATOR_GREATER_THAN_OR_EQUAL = 2,
19
+ SLO_COMPARATOR_LESS_THAN = 3,
20
+ SLO_COMPARATOR_LESS_THAN_OR_EQUAL = 4,
21
+ UNRECOGNIZED = -1,
22
+ }
23
+
24
+ export function sloComparatorFromJSON(object: any): SloComparator {
25
+ switch (object) {
26
+ case 0:
27
+ case "SLO_COMPARATOR_UNSPECIFIED":
28
+ return SloComparator.SLO_COMPARATOR_UNSPECIFIED;
29
+ case 1:
30
+ case "SLO_COMPARATOR_GREATER_THAN":
31
+ return SloComparator.SLO_COMPARATOR_GREATER_THAN;
32
+ case 2:
33
+ case "SLO_COMPARATOR_GREATER_THAN_OR_EQUAL":
34
+ return SloComparator.SLO_COMPARATOR_GREATER_THAN_OR_EQUAL;
35
+ case 3:
36
+ case "SLO_COMPARATOR_LESS_THAN":
37
+ return SloComparator.SLO_COMPARATOR_LESS_THAN;
38
+ case 4:
39
+ case "SLO_COMPARATOR_LESS_THAN_OR_EQUAL":
40
+ return SloComparator.SLO_COMPARATOR_LESS_THAN_OR_EQUAL;
41
+ case -1:
42
+ case "UNRECOGNIZED":
43
+ default:
44
+ return SloComparator.UNRECOGNIZED;
45
+ }
46
+ }
47
+
48
+ export function sloComparatorToJSON(object: SloComparator): string {
49
+ switch (object) {
50
+ case SloComparator.SLO_COMPARATOR_UNSPECIFIED:
51
+ return "SLO_COMPARATOR_UNSPECIFIED";
52
+ case SloComparator.SLO_COMPARATOR_GREATER_THAN:
53
+ return "SLO_COMPARATOR_GREATER_THAN";
54
+ case SloComparator.SLO_COMPARATOR_GREATER_THAN_OR_EQUAL:
55
+ return "SLO_COMPARATOR_GREATER_THAN_OR_EQUAL";
56
+ case SloComparator.SLO_COMPARATOR_LESS_THAN:
57
+ return "SLO_COMPARATOR_LESS_THAN";
58
+ case SloComparator.SLO_COMPARATOR_LESS_THAN_OR_EQUAL:
59
+ return "SLO_COMPARATOR_LESS_THAN_OR_EQUAL";
60
+ case SloComparator.UNRECOGNIZED:
61
+ default:
62
+ return "UNRECOGNIZED";
63
+ }
64
+ }
65
+
66
+ export interface Slo {
67
+ id: string;
68
+ organizationId: string;
69
+ projectId: string;
70
+ name: string;
71
+ description: string;
72
+ enabled: boolean;
73
+ objective: SloObjective | undefined;
74
+ createdAt: Date | undefined;
75
+ updatedAt: Date | undefined;
76
+ }
77
+
78
+ /**
79
+ * SloObjective is the measurement: over the rolling window, at least `target` of the
80
+ * eligible samples of `metric_name` (split into one row per `group_by` combination) must be
81
+ * "good". What counts as good is the SLI in the oneof.
82
+ */
83
+ export interface SloObjective {
84
+ metricName: string;
85
+ groupBy: string[];
86
+ target: number;
87
+ windowSeconds: number;
88
+ gaugeThreshold?: GaugeThresholdSli | undefined;
89
+ }
90
+
91
+ /** GaugeThresholdSli: a gauge sample is "good" when value <comparator> threshold. */
92
+ export interface GaugeThresholdSli {
93
+ comparator: SloComparator;
94
+ threshold: number;
95
+ }
96
+
97
+ export interface CreateSloRequest {
98
+ organizationId: string;
99
+ projectId: string;
100
+ name: string;
101
+ description: string;
102
+ enabled: boolean;
103
+ objective: SloObjective | undefined;
104
+ }
105
+
106
+ export interface CreateSloResponse {
107
+ status: ResponseStatus | undefined;
108
+ slo: Slo | undefined;
109
+ }
110
+
111
+ export interface GetSloRequest {
112
+ organizationId: string;
113
+ projectId: string;
114
+ sloId: string;
115
+ }
116
+
117
+ export interface GetSloResponse {
118
+ status: ResponseStatus | undefined;
119
+ slo: Slo | undefined;
120
+ }
121
+
122
+ export interface ListSlosRequest {
123
+ organizationId: string;
124
+ projectId: string;
125
+ }
126
+
127
+ export interface ListSlosResponse {
128
+ status: ResponseStatus | undefined;
129
+ slos: Slo[];
130
+ }
131
+
132
+ export interface UpdateSloRequest {
133
+ organizationId: string;
134
+ projectId: string;
135
+ sloId: string;
136
+ updates: UpdateSloRequest_SloUpdates | undefined;
137
+ }
138
+
139
+ export interface UpdateSloRequest_SloUpdates {
140
+ name?: string | undefined;
141
+ description?: string | undefined;
142
+ enabled?:
143
+ | boolean
144
+ | undefined;
145
+ /** If set, replaces the whole objective. */
146
+ objective: SloObjective | undefined;
147
+ }
148
+
149
+ export interface UpdateSloResponse {
150
+ status: ResponseStatus | undefined;
151
+ slo: Slo | undefined;
152
+ }
153
+
154
+ export interface DeleteSloRequest {
155
+ organizationId: string;
156
+ projectId: string;
157
+ sloId: string;
158
+ }
159
+
160
+ export interface DeleteSloResponse {
161
+ status: ResponseStatus | undefined;
162
+ }
163
+
164
+ function createBaseSlo(): Slo {
165
+ return {
166
+ id: "",
167
+ organizationId: "",
168
+ projectId: "",
169
+ name: "",
170
+ description: "",
171
+ enabled: false,
172
+ objective: undefined,
173
+ createdAt: undefined,
174
+ updatedAt: undefined,
175
+ };
176
+ }
177
+
178
+ export const Slo: MessageFns<Slo> = {
179
+ encode(message: Slo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
180
+ if (message.id !== "") {
181
+ writer.uint32(10).string(message.id);
182
+ }
183
+ if (message.organizationId !== "") {
184
+ writer.uint32(18).string(message.organizationId);
185
+ }
186
+ if (message.projectId !== "") {
187
+ writer.uint32(26).string(message.projectId);
188
+ }
189
+ if (message.name !== "") {
190
+ writer.uint32(34).string(message.name);
191
+ }
192
+ if (message.description !== "") {
193
+ writer.uint32(42).string(message.description);
194
+ }
195
+ if (message.enabled !== false) {
196
+ writer.uint32(48).bool(message.enabled);
197
+ }
198
+ if (message.objective !== undefined) {
199
+ SloObjective.encode(message.objective, writer.uint32(58).fork()).join();
200
+ }
201
+ if (message.createdAt !== undefined) {
202
+ Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(66).fork()).join();
203
+ }
204
+ if (message.updatedAt !== undefined) {
205
+ Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(74).fork()).join();
206
+ }
207
+ return writer;
208
+ },
209
+
210
+ decode(input: BinaryReader | Uint8Array, length?: number): Slo {
211
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
212
+ const end = length === undefined ? reader.len : reader.pos + length;
213
+ const message = createBaseSlo();
214
+ while (reader.pos < end) {
215
+ const tag = reader.uint32();
216
+ switch (tag >>> 3) {
217
+ case 1: {
218
+ if (tag !== 10) {
219
+ break;
220
+ }
221
+
222
+ message.id = reader.string();
223
+ continue;
224
+ }
225
+ case 2: {
226
+ if (tag !== 18) {
227
+ break;
228
+ }
229
+
230
+ message.organizationId = reader.string();
231
+ continue;
232
+ }
233
+ case 3: {
234
+ if (tag !== 26) {
235
+ break;
236
+ }
237
+
238
+ message.projectId = reader.string();
239
+ continue;
240
+ }
241
+ case 4: {
242
+ if (tag !== 34) {
243
+ break;
244
+ }
245
+
246
+ message.name = reader.string();
247
+ continue;
248
+ }
249
+ case 5: {
250
+ if (tag !== 42) {
251
+ break;
252
+ }
253
+
254
+ message.description = reader.string();
255
+ continue;
256
+ }
257
+ case 6: {
258
+ if (tag !== 48) {
259
+ break;
260
+ }
261
+
262
+ message.enabled = reader.bool();
263
+ continue;
264
+ }
265
+ case 7: {
266
+ if (tag !== 58) {
267
+ break;
268
+ }
269
+
270
+ message.objective = SloObjective.decode(reader, reader.uint32());
271
+ continue;
272
+ }
273
+ case 8: {
274
+ if (tag !== 66) {
275
+ break;
276
+ }
277
+
278
+ message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
279
+ continue;
280
+ }
281
+ case 9: {
282
+ if (tag !== 74) {
283
+ break;
284
+ }
285
+
286
+ message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
287
+ continue;
288
+ }
289
+ }
290
+ if ((tag & 7) === 4 || tag === 0) {
291
+ break;
292
+ }
293
+ reader.skip(tag & 7);
294
+ }
295
+ return message;
296
+ },
297
+
298
+ fromJSON(object: any): Slo {
299
+ return {
300
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
301
+ organizationId: isSet(object.organizationId)
302
+ ? globalThis.String(object.organizationId)
303
+ : isSet(object.organization_id)
304
+ ? globalThis.String(object.organization_id)
305
+ : "",
306
+ projectId: isSet(object.projectId)
307
+ ? globalThis.String(object.projectId)
308
+ : isSet(object.project_id)
309
+ ? globalThis.String(object.project_id)
310
+ : "",
311
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
312
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
313
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
314
+ objective: isSet(object.objective) ? SloObjective.fromJSON(object.objective) : undefined,
315
+ createdAt: isSet(object.createdAt)
316
+ ? fromJsonTimestamp(object.createdAt)
317
+ : isSet(object.created_at)
318
+ ? fromJsonTimestamp(object.created_at)
319
+ : undefined,
320
+ updatedAt: isSet(object.updatedAt)
321
+ ? fromJsonTimestamp(object.updatedAt)
322
+ : isSet(object.updated_at)
323
+ ? fromJsonTimestamp(object.updated_at)
324
+ : undefined,
325
+ };
326
+ },
327
+
328
+ toJSON(message: Slo): unknown {
329
+ const obj: any = {};
330
+ if (message.id !== "") {
331
+ obj.id = message.id;
332
+ }
333
+ if (message.organizationId !== "") {
334
+ obj.organizationId = message.organizationId;
335
+ }
336
+ if (message.projectId !== "") {
337
+ obj.projectId = message.projectId;
338
+ }
339
+ if (message.name !== "") {
340
+ obj.name = message.name;
341
+ }
342
+ if (message.description !== "") {
343
+ obj.description = message.description;
344
+ }
345
+ if (message.enabled !== false) {
346
+ obj.enabled = message.enabled;
347
+ }
348
+ if (message.objective !== undefined) {
349
+ obj.objective = SloObjective.toJSON(message.objective);
350
+ }
351
+ if (message.createdAt !== undefined) {
352
+ obj.createdAt = message.createdAt.toISOString();
353
+ }
354
+ if (message.updatedAt !== undefined) {
355
+ obj.updatedAt = message.updatedAt.toISOString();
356
+ }
357
+ return obj;
358
+ },
359
+
360
+ create<I extends Exact<DeepPartial<Slo>, I>>(base?: I): Slo {
361
+ return Slo.fromPartial(base ?? ({} as any));
362
+ },
363
+ fromPartial<I extends Exact<DeepPartial<Slo>, I>>(object: I): Slo {
364
+ const message = createBaseSlo();
365
+ message.id = object.id ?? "";
366
+ message.organizationId = object.organizationId ?? "";
367
+ message.projectId = object.projectId ?? "";
368
+ message.name = object.name ?? "";
369
+ message.description = object.description ?? "";
370
+ message.enabled = object.enabled ?? false;
371
+ message.objective = (object.objective !== undefined && object.objective !== null)
372
+ ? SloObjective.fromPartial(object.objective)
373
+ : undefined;
374
+ message.createdAt = object.createdAt ?? undefined;
375
+ message.updatedAt = object.updatedAt ?? undefined;
376
+ return message;
377
+ },
378
+ };
379
+
380
+ function createBaseSloObjective(): SloObjective {
381
+ return { metricName: "", groupBy: [], target: 0, windowSeconds: 0, gaugeThreshold: undefined };
382
+ }
383
+
384
+ export const SloObjective: MessageFns<SloObjective> = {
385
+ encode(message: SloObjective, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
386
+ if (message.metricName !== "") {
387
+ writer.uint32(10).string(message.metricName);
388
+ }
389
+ for (const v of message.groupBy) {
390
+ writer.uint32(18).string(v!);
391
+ }
392
+ if (message.target !== 0) {
393
+ writer.uint32(25).double(message.target);
394
+ }
395
+ if (message.windowSeconds !== 0) {
396
+ writer.uint32(32).int64(message.windowSeconds);
397
+ }
398
+ if (message.gaugeThreshold !== undefined) {
399
+ GaugeThresholdSli.encode(message.gaugeThreshold, writer.uint32(42).fork()).join();
400
+ }
401
+ return writer;
402
+ },
403
+
404
+ decode(input: BinaryReader | Uint8Array, length?: number): SloObjective {
405
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
406
+ const end = length === undefined ? reader.len : reader.pos + length;
407
+ const message = createBaseSloObjective();
408
+ while (reader.pos < end) {
409
+ const tag = reader.uint32();
410
+ switch (tag >>> 3) {
411
+ case 1: {
412
+ if (tag !== 10) {
413
+ break;
414
+ }
415
+
416
+ message.metricName = reader.string();
417
+ continue;
418
+ }
419
+ case 2: {
420
+ if (tag !== 18) {
421
+ break;
422
+ }
423
+
424
+ message.groupBy.push(reader.string());
425
+ continue;
426
+ }
427
+ case 3: {
428
+ if (tag !== 25) {
429
+ break;
430
+ }
431
+
432
+ message.target = reader.double();
433
+ continue;
434
+ }
435
+ case 4: {
436
+ if (tag !== 32) {
437
+ break;
438
+ }
439
+
440
+ message.windowSeconds = longToNumber(reader.int64());
441
+ continue;
442
+ }
443
+ case 5: {
444
+ if (tag !== 42) {
445
+ break;
446
+ }
447
+
448
+ message.gaugeThreshold = GaugeThresholdSli.decode(reader, reader.uint32());
449
+ continue;
450
+ }
451
+ }
452
+ if ((tag & 7) === 4 || tag === 0) {
453
+ break;
454
+ }
455
+ reader.skip(tag & 7);
456
+ }
457
+ return message;
458
+ },
459
+
460
+ fromJSON(object: any): SloObjective {
461
+ return {
462
+ metricName: isSet(object.metricName)
463
+ ? globalThis.String(object.metricName)
464
+ : isSet(object.metric_name)
465
+ ? globalThis.String(object.metric_name)
466
+ : "",
467
+ groupBy: globalThis.Array.isArray(object?.groupBy)
468
+ ? object.groupBy.map((e: any) => globalThis.String(e))
469
+ : globalThis.Array.isArray(object?.group_by)
470
+ ? object.group_by.map((e: any) => globalThis.String(e))
471
+ : [],
472
+ target: isSet(object.target) ? globalThis.Number(object.target) : 0,
473
+ windowSeconds: isSet(object.windowSeconds)
474
+ ? globalThis.Number(object.windowSeconds)
475
+ : isSet(object.window_seconds)
476
+ ? globalThis.Number(object.window_seconds)
477
+ : 0,
478
+ gaugeThreshold: isSet(object.gaugeThreshold)
479
+ ? GaugeThresholdSli.fromJSON(object.gaugeThreshold)
480
+ : isSet(object.gauge_threshold)
481
+ ? GaugeThresholdSli.fromJSON(object.gauge_threshold)
482
+ : undefined,
483
+ };
484
+ },
485
+
486
+ toJSON(message: SloObjective): unknown {
487
+ const obj: any = {};
488
+ if (message.metricName !== "") {
489
+ obj.metricName = message.metricName;
490
+ }
491
+ if (message.groupBy?.length) {
492
+ obj.groupBy = message.groupBy;
493
+ }
494
+ if (message.target !== 0) {
495
+ obj.target = message.target;
496
+ }
497
+ if (message.windowSeconds !== 0) {
498
+ obj.windowSeconds = Math.round(message.windowSeconds);
499
+ }
500
+ if (message.gaugeThreshold !== undefined) {
501
+ obj.gaugeThreshold = GaugeThresholdSli.toJSON(message.gaugeThreshold);
502
+ }
503
+ return obj;
504
+ },
505
+
506
+ create<I extends Exact<DeepPartial<SloObjective>, I>>(base?: I): SloObjective {
507
+ return SloObjective.fromPartial(base ?? ({} as any));
508
+ },
509
+ fromPartial<I extends Exact<DeepPartial<SloObjective>, I>>(object: I): SloObjective {
510
+ const message = createBaseSloObjective();
511
+ message.metricName = object.metricName ?? "";
512
+ message.groupBy = object.groupBy?.map((e) => e) || [];
513
+ message.target = object.target ?? 0;
514
+ message.windowSeconds = object.windowSeconds ?? 0;
515
+ message.gaugeThreshold = (object.gaugeThreshold !== undefined && object.gaugeThreshold !== null)
516
+ ? GaugeThresholdSli.fromPartial(object.gaugeThreshold)
517
+ : undefined;
518
+ return message;
519
+ },
520
+ };
521
+
522
+ function createBaseGaugeThresholdSli(): GaugeThresholdSli {
523
+ return { comparator: 0, threshold: 0 };
524
+ }
525
+
526
+ export const GaugeThresholdSli: MessageFns<GaugeThresholdSli> = {
527
+ encode(message: GaugeThresholdSli, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
528
+ if (message.comparator !== 0) {
529
+ writer.uint32(8).int32(message.comparator);
530
+ }
531
+ if (message.threshold !== 0) {
532
+ writer.uint32(17).double(message.threshold);
533
+ }
534
+ return writer;
535
+ },
536
+
537
+ decode(input: BinaryReader | Uint8Array, length?: number): GaugeThresholdSli {
538
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
539
+ const end = length === undefined ? reader.len : reader.pos + length;
540
+ const message = createBaseGaugeThresholdSli();
541
+ while (reader.pos < end) {
542
+ const tag = reader.uint32();
543
+ switch (tag >>> 3) {
544
+ case 1: {
545
+ if (tag !== 8) {
546
+ break;
547
+ }
548
+
549
+ message.comparator = reader.int32() as any;
550
+ continue;
551
+ }
552
+ case 2: {
553
+ if (tag !== 17) {
554
+ break;
555
+ }
556
+
557
+ message.threshold = reader.double();
558
+ continue;
559
+ }
560
+ }
561
+ if ((tag & 7) === 4 || tag === 0) {
562
+ break;
563
+ }
564
+ reader.skip(tag & 7);
565
+ }
566
+ return message;
567
+ },
568
+
569
+ fromJSON(object: any): GaugeThresholdSli {
570
+ return {
571
+ comparator: isSet(object.comparator) ? sloComparatorFromJSON(object.comparator) : 0,
572
+ threshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0,
573
+ };
574
+ },
575
+
576
+ toJSON(message: GaugeThresholdSli): unknown {
577
+ const obj: any = {};
578
+ if (message.comparator !== 0) {
579
+ obj.comparator = sloComparatorToJSON(message.comparator);
580
+ }
581
+ if (message.threshold !== 0) {
582
+ obj.threshold = message.threshold;
583
+ }
584
+ return obj;
585
+ },
586
+
587
+ create<I extends Exact<DeepPartial<GaugeThresholdSli>, I>>(base?: I): GaugeThresholdSli {
588
+ return GaugeThresholdSli.fromPartial(base ?? ({} as any));
589
+ },
590
+ fromPartial<I extends Exact<DeepPartial<GaugeThresholdSli>, I>>(object: I): GaugeThresholdSli {
591
+ const message = createBaseGaugeThresholdSli();
592
+ message.comparator = object.comparator ?? 0;
593
+ message.threshold = object.threshold ?? 0;
594
+ return message;
595
+ },
596
+ };
597
+
598
+ function createBaseCreateSloRequest(): CreateSloRequest {
599
+ return { organizationId: "", projectId: "", name: "", description: "", enabled: false, objective: undefined };
600
+ }
601
+
602
+ export const CreateSloRequest: MessageFns<CreateSloRequest> = {
603
+ encode(message: CreateSloRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
604
+ if (message.organizationId !== "") {
605
+ writer.uint32(10).string(message.organizationId);
606
+ }
607
+ if (message.projectId !== "") {
608
+ writer.uint32(18).string(message.projectId);
609
+ }
610
+ if (message.name !== "") {
611
+ writer.uint32(26).string(message.name);
612
+ }
613
+ if (message.description !== "") {
614
+ writer.uint32(34).string(message.description);
615
+ }
616
+ if (message.enabled !== false) {
617
+ writer.uint32(40).bool(message.enabled);
618
+ }
619
+ if (message.objective !== undefined) {
620
+ SloObjective.encode(message.objective, writer.uint32(50).fork()).join();
621
+ }
622
+ return writer;
623
+ },
624
+
625
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateSloRequest {
626
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
627
+ const end = length === undefined ? reader.len : reader.pos + length;
628
+ const message = createBaseCreateSloRequest();
629
+ while (reader.pos < end) {
630
+ const tag = reader.uint32();
631
+ switch (tag >>> 3) {
632
+ case 1: {
633
+ if (tag !== 10) {
634
+ break;
635
+ }
636
+
637
+ message.organizationId = reader.string();
638
+ continue;
639
+ }
640
+ case 2: {
641
+ if (tag !== 18) {
642
+ break;
643
+ }
644
+
645
+ message.projectId = reader.string();
646
+ continue;
647
+ }
648
+ case 3: {
649
+ if (tag !== 26) {
650
+ break;
651
+ }
652
+
653
+ message.name = reader.string();
654
+ continue;
655
+ }
656
+ case 4: {
657
+ if (tag !== 34) {
658
+ break;
659
+ }
660
+
661
+ message.description = reader.string();
662
+ continue;
663
+ }
664
+ case 5: {
665
+ if (tag !== 40) {
666
+ break;
667
+ }
668
+
669
+ message.enabled = reader.bool();
670
+ continue;
671
+ }
672
+ case 6: {
673
+ if (tag !== 50) {
674
+ break;
675
+ }
676
+
677
+ message.objective = SloObjective.decode(reader, reader.uint32());
678
+ continue;
679
+ }
680
+ }
681
+ if ((tag & 7) === 4 || tag === 0) {
682
+ break;
683
+ }
684
+ reader.skip(tag & 7);
685
+ }
686
+ return message;
687
+ },
688
+
689
+ fromJSON(object: any): CreateSloRequest {
690
+ return {
691
+ organizationId: isSet(object.organizationId)
692
+ ? globalThis.String(object.organizationId)
693
+ : isSet(object.organization_id)
694
+ ? globalThis.String(object.organization_id)
695
+ : "",
696
+ projectId: isSet(object.projectId)
697
+ ? globalThis.String(object.projectId)
698
+ : isSet(object.project_id)
699
+ ? globalThis.String(object.project_id)
700
+ : "",
701
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
702
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
703
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
704
+ objective: isSet(object.objective) ? SloObjective.fromJSON(object.objective) : undefined,
705
+ };
706
+ },
707
+
708
+ toJSON(message: CreateSloRequest): unknown {
709
+ const obj: any = {};
710
+ if (message.organizationId !== "") {
711
+ obj.organizationId = message.organizationId;
712
+ }
713
+ if (message.projectId !== "") {
714
+ obj.projectId = message.projectId;
715
+ }
716
+ if (message.name !== "") {
717
+ obj.name = message.name;
718
+ }
719
+ if (message.description !== "") {
720
+ obj.description = message.description;
721
+ }
722
+ if (message.enabled !== false) {
723
+ obj.enabled = message.enabled;
724
+ }
725
+ if (message.objective !== undefined) {
726
+ obj.objective = SloObjective.toJSON(message.objective);
727
+ }
728
+ return obj;
729
+ },
730
+
731
+ create<I extends Exact<DeepPartial<CreateSloRequest>, I>>(base?: I): CreateSloRequest {
732
+ return CreateSloRequest.fromPartial(base ?? ({} as any));
733
+ },
734
+ fromPartial<I extends Exact<DeepPartial<CreateSloRequest>, I>>(object: I): CreateSloRequest {
735
+ const message = createBaseCreateSloRequest();
736
+ message.organizationId = object.organizationId ?? "";
737
+ message.projectId = object.projectId ?? "";
738
+ message.name = object.name ?? "";
739
+ message.description = object.description ?? "";
740
+ message.enabled = object.enabled ?? false;
741
+ message.objective = (object.objective !== undefined && object.objective !== null)
742
+ ? SloObjective.fromPartial(object.objective)
743
+ : undefined;
744
+ return message;
745
+ },
746
+ };
747
+
748
+ function createBaseCreateSloResponse(): CreateSloResponse {
749
+ return { status: undefined, slo: undefined };
750
+ }
751
+
752
+ export const CreateSloResponse: MessageFns<CreateSloResponse> = {
753
+ encode(message: CreateSloResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
754
+ if (message.status !== undefined) {
755
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
756
+ }
757
+ if (message.slo !== undefined) {
758
+ Slo.encode(message.slo, writer.uint32(18).fork()).join();
759
+ }
760
+ return writer;
761
+ },
762
+
763
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateSloResponse {
764
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
765
+ const end = length === undefined ? reader.len : reader.pos + length;
766
+ const message = createBaseCreateSloResponse();
767
+ while (reader.pos < end) {
768
+ const tag = reader.uint32();
769
+ switch (tag >>> 3) {
770
+ case 1: {
771
+ if (tag !== 10) {
772
+ break;
773
+ }
774
+
775
+ message.status = ResponseStatus.decode(reader, reader.uint32());
776
+ continue;
777
+ }
778
+ case 2: {
779
+ if (tag !== 18) {
780
+ break;
781
+ }
782
+
783
+ message.slo = Slo.decode(reader, reader.uint32());
784
+ continue;
785
+ }
786
+ }
787
+ if ((tag & 7) === 4 || tag === 0) {
788
+ break;
789
+ }
790
+ reader.skip(tag & 7);
791
+ }
792
+ return message;
793
+ },
794
+
795
+ fromJSON(object: any): CreateSloResponse {
796
+ return {
797
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
798
+ slo: isSet(object.slo) ? Slo.fromJSON(object.slo) : undefined,
799
+ };
800
+ },
801
+
802
+ toJSON(message: CreateSloResponse): unknown {
803
+ const obj: any = {};
804
+ if (message.status !== undefined) {
805
+ obj.status = ResponseStatus.toJSON(message.status);
806
+ }
807
+ if (message.slo !== undefined) {
808
+ obj.slo = Slo.toJSON(message.slo);
809
+ }
810
+ return obj;
811
+ },
812
+
813
+ create<I extends Exact<DeepPartial<CreateSloResponse>, I>>(base?: I): CreateSloResponse {
814
+ return CreateSloResponse.fromPartial(base ?? ({} as any));
815
+ },
816
+ fromPartial<I extends Exact<DeepPartial<CreateSloResponse>, I>>(object: I): CreateSloResponse {
817
+ const message = createBaseCreateSloResponse();
818
+ message.status = (object.status !== undefined && object.status !== null)
819
+ ? ResponseStatus.fromPartial(object.status)
820
+ : undefined;
821
+ message.slo = (object.slo !== undefined && object.slo !== null) ? Slo.fromPartial(object.slo) : undefined;
822
+ return message;
823
+ },
824
+ };
825
+
826
+ function createBaseGetSloRequest(): GetSloRequest {
827
+ return { organizationId: "", projectId: "", sloId: "" };
828
+ }
829
+
830
+ export const GetSloRequest: MessageFns<GetSloRequest> = {
831
+ encode(message: GetSloRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
832
+ if (message.organizationId !== "") {
833
+ writer.uint32(10).string(message.organizationId);
834
+ }
835
+ if (message.projectId !== "") {
836
+ writer.uint32(18).string(message.projectId);
837
+ }
838
+ if (message.sloId !== "") {
839
+ writer.uint32(26).string(message.sloId);
840
+ }
841
+ return writer;
842
+ },
843
+
844
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSloRequest {
845
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
846
+ const end = length === undefined ? reader.len : reader.pos + length;
847
+ const message = createBaseGetSloRequest();
848
+ while (reader.pos < end) {
849
+ const tag = reader.uint32();
850
+ switch (tag >>> 3) {
851
+ case 1: {
852
+ if (tag !== 10) {
853
+ break;
854
+ }
855
+
856
+ message.organizationId = reader.string();
857
+ continue;
858
+ }
859
+ case 2: {
860
+ if (tag !== 18) {
861
+ break;
862
+ }
863
+
864
+ message.projectId = reader.string();
865
+ continue;
866
+ }
867
+ case 3: {
868
+ if (tag !== 26) {
869
+ break;
870
+ }
871
+
872
+ message.sloId = reader.string();
873
+ continue;
874
+ }
875
+ }
876
+ if ((tag & 7) === 4 || tag === 0) {
877
+ break;
878
+ }
879
+ reader.skip(tag & 7);
880
+ }
881
+ return message;
882
+ },
883
+
884
+ fromJSON(object: any): GetSloRequest {
885
+ return {
886
+ organizationId: isSet(object.organizationId)
887
+ ? globalThis.String(object.organizationId)
888
+ : isSet(object.organization_id)
889
+ ? globalThis.String(object.organization_id)
890
+ : "",
891
+ projectId: isSet(object.projectId)
892
+ ? globalThis.String(object.projectId)
893
+ : isSet(object.project_id)
894
+ ? globalThis.String(object.project_id)
895
+ : "",
896
+ sloId: isSet(object.sloId)
897
+ ? globalThis.String(object.sloId)
898
+ : isSet(object.slo_id)
899
+ ? globalThis.String(object.slo_id)
900
+ : "",
901
+ };
902
+ },
903
+
904
+ toJSON(message: GetSloRequest): unknown {
905
+ const obj: any = {};
906
+ if (message.organizationId !== "") {
907
+ obj.organizationId = message.organizationId;
908
+ }
909
+ if (message.projectId !== "") {
910
+ obj.projectId = message.projectId;
911
+ }
912
+ if (message.sloId !== "") {
913
+ obj.sloId = message.sloId;
914
+ }
915
+ return obj;
916
+ },
917
+
918
+ create<I extends Exact<DeepPartial<GetSloRequest>, I>>(base?: I): GetSloRequest {
919
+ return GetSloRequest.fromPartial(base ?? ({} as any));
920
+ },
921
+ fromPartial<I extends Exact<DeepPartial<GetSloRequest>, I>>(object: I): GetSloRequest {
922
+ const message = createBaseGetSloRequest();
923
+ message.organizationId = object.organizationId ?? "";
924
+ message.projectId = object.projectId ?? "";
925
+ message.sloId = object.sloId ?? "";
926
+ return message;
927
+ },
928
+ };
929
+
930
+ function createBaseGetSloResponse(): GetSloResponse {
931
+ return { status: undefined, slo: undefined };
932
+ }
933
+
934
+ export const GetSloResponse: MessageFns<GetSloResponse> = {
935
+ encode(message: GetSloResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
936
+ if (message.status !== undefined) {
937
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
938
+ }
939
+ if (message.slo !== undefined) {
940
+ Slo.encode(message.slo, writer.uint32(18).fork()).join();
941
+ }
942
+ return writer;
943
+ },
944
+
945
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSloResponse {
946
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
947
+ const end = length === undefined ? reader.len : reader.pos + length;
948
+ const message = createBaseGetSloResponse();
949
+ while (reader.pos < end) {
950
+ const tag = reader.uint32();
951
+ switch (tag >>> 3) {
952
+ case 1: {
953
+ if (tag !== 10) {
954
+ break;
955
+ }
956
+
957
+ message.status = ResponseStatus.decode(reader, reader.uint32());
958
+ continue;
959
+ }
960
+ case 2: {
961
+ if (tag !== 18) {
962
+ break;
963
+ }
964
+
965
+ message.slo = Slo.decode(reader, reader.uint32());
966
+ continue;
967
+ }
968
+ }
969
+ if ((tag & 7) === 4 || tag === 0) {
970
+ break;
971
+ }
972
+ reader.skip(tag & 7);
973
+ }
974
+ return message;
975
+ },
976
+
977
+ fromJSON(object: any): GetSloResponse {
978
+ return {
979
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
980
+ slo: isSet(object.slo) ? Slo.fromJSON(object.slo) : undefined,
981
+ };
982
+ },
983
+
984
+ toJSON(message: GetSloResponse): unknown {
985
+ const obj: any = {};
986
+ if (message.status !== undefined) {
987
+ obj.status = ResponseStatus.toJSON(message.status);
988
+ }
989
+ if (message.slo !== undefined) {
990
+ obj.slo = Slo.toJSON(message.slo);
991
+ }
992
+ return obj;
993
+ },
994
+
995
+ create<I extends Exact<DeepPartial<GetSloResponse>, I>>(base?: I): GetSloResponse {
996
+ return GetSloResponse.fromPartial(base ?? ({} as any));
997
+ },
998
+ fromPartial<I extends Exact<DeepPartial<GetSloResponse>, I>>(object: I): GetSloResponse {
999
+ const message = createBaseGetSloResponse();
1000
+ message.status = (object.status !== undefined && object.status !== null)
1001
+ ? ResponseStatus.fromPartial(object.status)
1002
+ : undefined;
1003
+ message.slo = (object.slo !== undefined && object.slo !== null) ? Slo.fromPartial(object.slo) : undefined;
1004
+ return message;
1005
+ },
1006
+ };
1007
+
1008
+ function createBaseListSlosRequest(): ListSlosRequest {
1009
+ return { organizationId: "", projectId: "" };
1010
+ }
1011
+
1012
+ export const ListSlosRequest: MessageFns<ListSlosRequest> = {
1013
+ encode(message: ListSlosRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1014
+ if (message.organizationId !== "") {
1015
+ writer.uint32(10).string(message.organizationId);
1016
+ }
1017
+ if (message.projectId !== "") {
1018
+ writer.uint32(18).string(message.projectId);
1019
+ }
1020
+ return writer;
1021
+ },
1022
+
1023
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSlosRequest {
1024
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1025
+ const end = length === undefined ? reader.len : reader.pos + length;
1026
+ const message = createBaseListSlosRequest();
1027
+ while (reader.pos < end) {
1028
+ const tag = reader.uint32();
1029
+ switch (tag >>> 3) {
1030
+ case 1: {
1031
+ if (tag !== 10) {
1032
+ break;
1033
+ }
1034
+
1035
+ message.organizationId = reader.string();
1036
+ continue;
1037
+ }
1038
+ case 2: {
1039
+ if (tag !== 18) {
1040
+ break;
1041
+ }
1042
+
1043
+ message.projectId = reader.string();
1044
+ continue;
1045
+ }
1046
+ }
1047
+ if ((tag & 7) === 4 || tag === 0) {
1048
+ break;
1049
+ }
1050
+ reader.skip(tag & 7);
1051
+ }
1052
+ return message;
1053
+ },
1054
+
1055
+ fromJSON(object: any): ListSlosRequest {
1056
+ return {
1057
+ organizationId: isSet(object.organizationId)
1058
+ ? globalThis.String(object.organizationId)
1059
+ : isSet(object.organization_id)
1060
+ ? globalThis.String(object.organization_id)
1061
+ : "",
1062
+ projectId: isSet(object.projectId)
1063
+ ? globalThis.String(object.projectId)
1064
+ : isSet(object.project_id)
1065
+ ? globalThis.String(object.project_id)
1066
+ : "",
1067
+ };
1068
+ },
1069
+
1070
+ toJSON(message: ListSlosRequest): unknown {
1071
+ const obj: any = {};
1072
+ if (message.organizationId !== "") {
1073
+ obj.organizationId = message.organizationId;
1074
+ }
1075
+ if (message.projectId !== "") {
1076
+ obj.projectId = message.projectId;
1077
+ }
1078
+ return obj;
1079
+ },
1080
+
1081
+ create<I extends Exact<DeepPartial<ListSlosRequest>, I>>(base?: I): ListSlosRequest {
1082
+ return ListSlosRequest.fromPartial(base ?? ({} as any));
1083
+ },
1084
+ fromPartial<I extends Exact<DeepPartial<ListSlosRequest>, I>>(object: I): ListSlosRequest {
1085
+ const message = createBaseListSlosRequest();
1086
+ message.organizationId = object.organizationId ?? "";
1087
+ message.projectId = object.projectId ?? "";
1088
+ return message;
1089
+ },
1090
+ };
1091
+
1092
+ function createBaseListSlosResponse(): ListSlosResponse {
1093
+ return { status: undefined, slos: [] };
1094
+ }
1095
+
1096
+ export const ListSlosResponse: MessageFns<ListSlosResponse> = {
1097
+ encode(message: ListSlosResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1098
+ if (message.status !== undefined) {
1099
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1100
+ }
1101
+ for (const v of message.slos) {
1102
+ Slo.encode(v!, writer.uint32(18).fork()).join();
1103
+ }
1104
+ return writer;
1105
+ },
1106
+
1107
+ decode(input: BinaryReader | Uint8Array, length?: number): ListSlosResponse {
1108
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1109
+ const end = length === undefined ? reader.len : reader.pos + length;
1110
+ const message = createBaseListSlosResponse();
1111
+ while (reader.pos < end) {
1112
+ const tag = reader.uint32();
1113
+ switch (tag >>> 3) {
1114
+ case 1: {
1115
+ if (tag !== 10) {
1116
+ break;
1117
+ }
1118
+
1119
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1120
+ continue;
1121
+ }
1122
+ case 2: {
1123
+ if (tag !== 18) {
1124
+ break;
1125
+ }
1126
+
1127
+ message.slos.push(Slo.decode(reader, reader.uint32()));
1128
+ continue;
1129
+ }
1130
+ }
1131
+ if ((tag & 7) === 4 || tag === 0) {
1132
+ break;
1133
+ }
1134
+ reader.skip(tag & 7);
1135
+ }
1136
+ return message;
1137
+ },
1138
+
1139
+ fromJSON(object: any): ListSlosResponse {
1140
+ return {
1141
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1142
+ slos: globalThis.Array.isArray(object?.slos) ? object.slos.map((e: any) => Slo.fromJSON(e)) : [],
1143
+ };
1144
+ },
1145
+
1146
+ toJSON(message: ListSlosResponse): unknown {
1147
+ const obj: any = {};
1148
+ if (message.status !== undefined) {
1149
+ obj.status = ResponseStatus.toJSON(message.status);
1150
+ }
1151
+ if (message.slos?.length) {
1152
+ obj.slos = message.slos.map((e) => Slo.toJSON(e));
1153
+ }
1154
+ return obj;
1155
+ },
1156
+
1157
+ create<I extends Exact<DeepPartial<ListSlosResponse>, I>>(base?: I): ListSlosResponse {
1158
+ return ListSlosResponse.fromPartial(base ?? ({} as any));
1159
+ },
1160
+ fromPartial<I extends Exact<DeepPartial<ListSlosResponse>, I>>(object: I): ListSlosResponse {
1161
+ const message = createBaseListSlosResponse();
1162
+ message.status = (object.status !== undefined && object.status !== null)
1163
+ ? ResponseStatus.fromPartial(object.status)
1164
+ : undefined;
1165
+ message.slos = object.slos?.map((e) => Slo.fromPartial(e)) || [];
1166
+ return message;
1167
+ },
1168
+ };
1169
+
1170
+ function createBaseUpdateSloRequest(): UpdateSloRequest {
1171
+ return { organizationId: "", projectId: "", sloId: "", updates: undefined };
1172
+ }
1173
+
1174
+ export const UpdateSloRequest: MessageFns<UpdateSloRequest> = {
1175
+ encode(message: UpdateSloRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1176
+ if (message.organizationId !== "") {
1177
+ writer.uint32(10).string(message.organizationId);
1178
+ }
1179
+ if (message.projectId !== "") {
1180
+ writer.uint32(18).string(message.projectId);
1181
+ }
1182
+ if (message.sloId !== "") {
1183
+ writer.uint32(26).string(message.sloId);
1184
+ }
1185
+ if (message.updates !== undefined) {
1186
+ UpdateSloRequest_SloUpdates.encode(message.updates, writer.uint32(34).fork()).join();
1187
+ }
1188
+ return writer;
1189
+ },
1190
+
1191
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateSloRequest {
1192
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1193
+ const end = length === undefined ? reader.len : reader.pos + length;
1194
+ const message = createBaseUpdateSloRequest();
1195
+ while (reader.pos < end) {
1196
+ const tag = reader.uint32();
1197
+ switch (tag >>> 3) {
1198
+ case 1: {
1199
+ if (tag !== 10) {
1200
+ break;
1201
+ }
1202
+
1203
+ message.organizationId = reader.string();
1204
+ continue;
1205
+ }
1206
+ case 2: {
1207
+ if (tag !== 18) {
1208
+ break;
1209
+ }
1210
+
1211
+ message.projectId = reader.string();
1212
+ continue;
1213
+ }
1214
+ case 3: {
1215
+ if (tag !== 26) {
1216
+ break;
1217
+ }
1218
+
1219
+ message.sloId = reader.string();
1220
+ continue;
1221
+ }
1222
+ case 4: {
1223
+ if (tag !== 34) {
1224
+ break;
1225
+ }
1226
+
1227
+ message.updates = UpdateSloRequest_SloUpdates.decode(reader, reader.uint32());
1228
+ continue;
1229
+ }
1230
+ }
1231
+ if ((tag & 7) === 4 || tag === 0) {
1232
+ break;
1233
+ }
1234
+ reader.skip(tag & 7);
1235
+ }
1236
+ return message;
1237
+ },
1238
+
1239
+ fromJSON(object: any): UpdateSloRequest {
1240
+ return {
1241
+ organizationId: isSet(object.organizationId)
1242
+ ? globalThis.String(object.organizationId)
1243
+ : isSet(object.organization_id)
1244
+ ? globalThis.String(object.organization_id)
1245
+ : "",
1246
+ projectId: isSet(object.projectId)
1247
+ ? globalThis.String(object.projectId)
1248
+ : isSet(object.project_id)
1249
+ ? globalThis.String(object.project_id)
1250
+ : "",
1251
+ sloId: isSet(object.sloId)
1252
+ ? globalThis.String(object.sloId)
1253
+ : isSet(object.slo_id)
1254
+ ? globalThis.String(object.slo_id)
1255
+ : "",
1256
+ updates: isSet(object.updates) ? UpdateSloRequest_SloUpdates.fromJSON(object.updates) : undefined,
1257
+ };
1258
+ },
1259
+
1260
+ toJSON(message: UpdateSloRequest): unknown {
1261
+ const obj: any = {};
1262
+ if (message.organizationId !== "") {
1263
+ obj.organizationId = message.organizationId;
1264
+ }
1265
+ if (message.projectId !== "") {
1266
+ obj.projectId = message.projectId;
1267
+ }
1268
+ if (message.sloId !== "") {
1269
+ obj.sloId = message.sloId;
1270
+ }
1271
+ if (message.updates !== undefined) {
1272
+ obj.updates = UpdateSloRequest_SloUpdates.toJSON(message.updates);
1273
+ }
1274
+ return obj;
1275
+ },
1276
+
1277
+ create<I extends Exact<DeepPartial<UpdateSloRequest>, I>>(base?: I): UpdateSloRequest {
1278
+ return UpdateSloRequest.fromPartial(base ?? ({} as any));
1279
+ },
1280
+ fromPartial<I extends Exact<DeepPartial<UpdateSloRequest>, I>>(object: I): UpdateSloRequest {
1281
+ const message = createBaseUpdateSloRequest();
1282
+ message.organizationId = object.organizationId ?? "";
1283
+ message.projectId = object.projectId ?? "";
1284
+ message.sloId = object.sloId ?? "";
1285
+ message.updates = (object.updates !== undefined && object.updates !== null)
1286
+ ? UpdateSloRequest_SloUpdates.fromPartial(object.updates)
1287
+ : undefined;
1288
+ return message;
1289
+ },
1290
+ };
1291
+
1292
+ function createBaseUpdateSloRequest_SloUpdates(): UpdateSloRequest_SloUpdates {
1293
+ return { name: undefined, description: undefined, enabled: undefined, objective: undefined };
1294
+ }
1295
+
1296
+ export const UpdateSloRequest_SloUpdates: MessageFns<UpdateSloRequest_SloUpdates> = {
1297
+ encode(message: UpdateSloRequest_SloUpdates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1298
+ if (message.name !== undefined) {
1299
+ writer.uint32(10).string(message.name);
1300
+ }
1301
+ if (message.description !== undefined) {
1302
+ writer.uint32(18).string(message.description);
1303
+ }
1304
+ if (message.enabled !== undefined) {
1305
+ writer.uint32(24).bool(message.enabled);
1306
+ }
1307
+ if (message.objective !== undefined) {
1308
+ SloObjective.encode(message.objective, writer.uint32(34).fork()).join();
1309
+ }
1310
+ return writer;
1311
+ },
1312
+
1313
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateSloRequest_SloUpdates {
1314
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1315
+ const end = length === undefined ? reader.len : reader.pos + length;
1316
+ const message = createBaseUpdateSloRequest_SloUpdates();
1317
+ while (reader.pos < end) {
1318
+ const tag = reader.uint32();
1319
+ switch (tag >>> 3) {
1320
+ case 1: {
1321
+ if (tag !== 10) {
1322
+ break;
1323
+ }
1324
+
1325
+ message.name = reader.string();
1326
+ continue;
1327
+ }
1328
+ case 2: {
1329
+ if (tag !== 18) {
1330
+ break;
1331
+ }
1332
+
1333
+ message.description = reader.string();
1334
+ continue;
1335
+ }
1336
+ case 3: {
1337
+ if (tag !== 24) {
1338
+ break;
1339
+ }
1340
+
1341
+ message.enabled = reader.bool();
1342
+ continue;
1343
+ }
1344
+ case 4: {
1345
+ if (tag !== 34) {
1346
+ break;
1347
+ }
1348
+
1349
+ message.objective = SloObjective.decode(reader, reader.uint32());
1350
+ continue;
1351
+ }
1352
+ }
1353
+ if ((tag & 7) === 4 || tag === 0) {
1354
+ break;
1355
+ }
1356
+ reader.skip(tag & 7);
1357
+ }
1358
+ return message;
1359
+ },
1360
+
1361
+ fromJSON(object: any): UpdateSloRequest_SloUpdates {
1362
+ return {
1363
+ name: isSet(object.name) ? globalThis.String(object.name) : undefined,
1364
+ description: isSet(object.description) ? globalThis.String(object.description) : undefined,
1365
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : undefined,
1366
+ objective: isSet(object.objective) ? SloObjective.fromJSON(object.objective) : undefined,
1367
+ };
1368
+ },
1369
+
1370
+ toJSON(message: UpdateSloRequest_SloUpdates): unknown {
1371
+ const obj: any = {};
1372
+ if (message.name !== undefined) {
1373
+ obj.name = message.name;
1374
+ }
1375
+ if (message.description !== undefined) {
1376
+ obj.description = message.description;
1377
+ }
1378
+ if (message.enabled !== undefined) {
1379
+ obj.enabled = message.enabled;
1380
+ }
1381
+ if (message.objective !== undefined) {
1382
+ obj.objective = SloObjective.toJSON(message.objective);
1383
+ }
1384
+ return obj;
1385
+ },
1386
+
1387
+ create<I extends Exact<DeepPartial<UpdateSloRequest_SloUpdates>, I>>(base?: I): UpdateSloRequest_SloUpdates {
1388
+ return UpdateSloRequest_SloUpdates.fromPartial(base ?? ({} as any));
1389
+ },
1390
+ fromPartial<I extends Exact<DeepPartial<UpdateSloRequest_SloUpdates>, I>>(object: I): UpdateSloRequest_SloUpdates {
1391
+ const message = createBaseUpdateSloRequest_SloUpdates();
1392
+ message.name = object.name ?? undefined;
1393
+ message.description = object.description ?? undefined;
1394
+ message.enabled = object.enabled ?? undefined;
1395
+ message.objective = (object.objective !== undefined && object.objective !== null)
1396
+ ? SloObjective.fromPartial(object.objective)
1397
+ : undefined;
1398
+ return message;
1399
+ },
1400
+ };
1401
+
1402
+ function createBaseUpdateSloResponse(): UpdateSloResponse {
1403
+ return { status: undefined, slo: undefined };
1404
+ }
1405
+
1406
+ export const UpdateSloResponse: MessageFns<UpdateSloResponse> = {
1407
+ encode(message: UpdateSloResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1408
+ if (message.status !== undefined) {
1409
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1410
+ }
1411
+ if (message.slo !== undefined) {
1412
+ Slo.encode(message.slo, writer.uint32(18).fork()).join();
1413
+ }
1414
+ return writer;
1415
+ },
1416
+
1417
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateSloResponse {
1418
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1419
+ const end = length === undefined ? reader.len : reader.pos + length;
1420
+ const message = createBaseUpdateSloResponse();
1421
+ while (reader.pos < end) {
1422
+ const tag = reader.uint32();
1423
+ switch (tag >>> 3) {
1424
+ case 1: {
1425
+ if (tag !== 10) {
1426
+ break;
1427
+ }
1428
+
1429
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1430
+ continue;
1431
+ }
1432
+ case 2: {
1433
+ if (tag !== 18) {
1434
+ break;
1435
+ }
1436
+
1437
+ message.slo = Slo.decode(reader, reader.uint32());
1438
+ continue;
1439
+ }
1440
+ }
1441
+ if ((tag & 7) === 4 || tag === 0) {
1442
+ break;
1443
+ }
1444
+ reader.skip(tag & 7);
1445
+ }
1446
+ return message;
1447
+ },
1448
+
1449
+ fromJSON(object: any): UpdateSloResponse {
1450
+ return {
1451
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1452
+ slo: isSet(object.slo) ? Slo.fromJSON(object.slo) : undefined,
1453
+ };
1454
+ },
1455
+
1456
+ toJSON(message: UpdateSloResponse): unknown {
1457
+ const obj: any = {};
1458
+ if (message.status !== undefined) {
1459
+ obj.status = ResponseStatus.toJSON(message.status);
1460
+ }
1461
+ if (message.slo !== undefined) {
1462
+ obj.slo = Slo.toJSON(message.slo);
1463
+ }
1464
+ return obj;
1465
+ },
1466
+
1467
+ create<I extends Exact<DeepPartial<UpdateSloResponse>, I>>(base?: I): UpdateSloResponse {
1468
+ return UpdateSloResponse.fromPartial(base ?? ({} as any));
1469
+ },
1470
+ fromPartial<I extends Exact<DeepPartial<UpdateSloResponse>, I>>(object: I): UpdateSloResponse {
1471
+ const message = createBaseUpdateSloResponse();
1472
+ message.status = (object.status !== undefined && object.status !== null)
1473
+ ? ResponseStatus.fromPartial(object.status)
1474
+ : undefined;
1475
+ message.slo = (object.slo !== undefined && object.slo !== null) ? Slo.fromPartial(object.slo) : undefined;
1476
+ return message;
1477
+ },
1478
+ };
1479
+
1480
+ function createBaseDeleteSloRequest(): DeleteSloRequest {
1481
+ return { organizationId: "", projectId: "", sloId: "" };
1482
+ }
1483
+
1484
+ export const DeleteSloRequest: MessageFns<DeleteSloRequest> = {
1485
+ encode(message: DeleteSloRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1486
+ if (message.organizationId !== "") {
1487
+ writer.uint32(10).string(message.organizationId);
1488
+ }
1489
+ if (message.projectId !== "") {
1490
+ writer.uint32(18).string(message.projectId);
1491
+ }
1492
+ if (message.sloId !== "") {
1493
+ writer.uint32(26).string(message.sloId);
1494
+ }
1495
+ return writer;
1496
+ },
1497
+
1498
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteSloRequest {
1499
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1500
+ const end = length === undefined ? reader.len : reader.pos + length;
1501
+ const message = createBaseDeleteSloRequest();
1502
+ while (reader.pos < end) {
1503
+ const tag = reader.uint32();
1504
+ switch (tag >>> 3) {
1505
+ case 1: {
1506
+ if (tag !== 10) {
1507
+ break;
1508
+ }
1509
+
1510
+ message.organizationId = reader.string();
1511
+ continue;
1512
+ }
1513
+ case 2: {
1514
+ if (tag !== 18) {
1515
+ break;
1516
+ }
1517
+
1518
+ message.projectId = reader.string();
1519
+ continue;
1520
+ }
1521
+ case 3: {
1522
+ if (tag !== 26) {
1523
+ break;
1524
+ }
1525
+
1526
+ message.sloId = reader.string();
1527
+ continue;
1528
+ }
1529
+ }
1530
+ if ((tag & 7) === 4 || tag === 0) {
1531
+ break;
1532
+ }
1533
+ reader.skip(tag & 7);
1534
+ }
1535
+ return message;
1536
+ },
1537
+
1538
+ fromJSON(object: any): DeleteSloRequest {
1539
+ return {
1540
+ organizationId: isSet(object.organizationId)
1541
+ ? globalThis.String(object.organizationId)
1542
+ : isSet(object.organization_id)
1543
+ ? globalThis.String(object.organization_id)
1544
+ : "",
1545
+ projectId: isSet(object.projectId)
1546
+ ? globalThis.String(object.projectId)
1547
+ : isSet(object.project_id)
1548
+ ? globalThis.String(object.project_id)
1549
+ : "",
1550
+ sloId: isSet(object.sloId)
1551
+ ? globalThis.String(object.sloId)
1552
+ : isSet(object.slo_id)
1553
+ ? globalThis.String(object.slo_id)
1554
+ : "",
1555
+ };
1556
+ },
1557
+
1558
+ toJSON(message: DeleteSloRequest): unknown {
1559
+ const obj: any = {};
1560
+ if (message.organizationId !== "") {
1561
+ obj.organizationId = message.organizationId;
1562
+ }
1563
+ if (message.projectId !== "") {
1564
+ obj.projectId = message.projectId;
1565
+ }
1566
+ if (message.sloId !== "") {
1567
+ obj.sloId = message.sloId;
1568
+ }
1569
+ return obj;
1570
+ },
1571
+
1572
+ create<I extends Exact<DeepPartial<DeleteSloRequest>, I>>(base?: I): DeleteSloRequest {
1573
+ return DeleteSloRequest.fromPartial(base ?? ({} as any));
1574
+ },
1575
+ fromPartial<I extends Exact<DeepPartial<DeleteSloRequest>, I>>(object: I): DeleteSloRequest {
1576
+ const message = createBaseDeleteSloRequest();
1577
+ message.organizationId = object.organizationId ?? "";
1578
+ message.projectId = object.projectId ?? "";
1579
+ message.sloId = object.sloId ?? "";
1580
+ return message;
1581
+ },
1582
+ };
1583
+
1584
+ function createBaseDeleteSloResponse(): DeleteSloResponse {
1585
+ return { status: undefined };
1586
+ }
1587
+
1588
+ export const DeleteSloResponse: MessageFns<DeleteSloResponse> = {
1589
+ encode(message: DeleteSloResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1590
+ if (message.status !== undefined) {
1591
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1592
+ }
1593
+ return writer;
1594
+ },
1595
+
1596
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteSloResponse {
1597
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1598
+ const end = length === undefined ? reader.len : reader.pos + length;
1599
+ const message = createBaseDeleteSloResponse();
1600
+ while (reader.pos < end) {
1601
+ const tag = reader.uint32();
1602
+ switch (tag >>> 3) {
1603
+ case 1: {
1604
+ if (tag !== 10) {
1605
+ break;
1606
+ }
1607
+
1608
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1609
+ continue;
1610
+ }
1611
+ }
1612
+ if ((tag & 7) === 4 || tag === 0) {
1613
+ break;
1614
+ }
1615
+ reader.skip(tag & 7);
1616
+ }
1617
+ return message;
1618
+ },
1619
+
1620
+ fromJSON(object: any): DeleteSloResponse {
1621
+ return { status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined };
1622
+ },
1623
+
1624
+ toJSON(message: DeleteSloResponse): unknown {
1625
+ const obj: any = {};
1626
+ if (message.status !== undefined) {
1627
+ obj.status = ResponseStatus.toJSON(message.status);
1628
+ }
1629
+ return obj;
1630
+ },
1631
+
1632
+ create<I extends Exact<DeepPartial<DeleteSloResponse>, I>>(base?: I): DeleteSloResponse {
1633
+ return DeleteSloResponse.fromPartial(base ?? ({} as any));
1634
+ },
1635
+ fromPartial<I extends Exact<DeepPartial<DeleteSloResponse>, I>>(object: I): DeleteSloResponse {
1636
+ const message = createBaseDeleteSloResponse();
1637
+ message.status = (object.status !== undefined && object.status !== null)
1638
+ ? ResponseStatus.fromPartial(object.status)
1639
+ : undefined;
1640
+ return message;
1641
+ },
1642
+ };
1643
+
1644
+ /** SloGatewayService provides web client access to SLO definitions. */
1645
+ export interface SloGatewayService {
1646
+ CreateSlo(request: CreateSloRequest, metadata?: Metadata): Promise<CreateSloResponse>;
1647
+ GetSlo(request: GetSloRequest, metadata?: Metadata): Promise<GetSloResponse>;
1648
+ ListSlos(request: ListSlosRequest, metadata?: Metadata): Promise<ListSlosResponse>;
1649
+ UpdateSlo(request: UpdateSloRequest, metadata?: Metadata): Promise<UpdateSloResponse>;
1650
+ DeleteSlo(request: DeleteSloRequest, metadata?: Metadata): Promise<DeleteSloResponse>;
1651
+ }
1652
+
1653
+ export const SloGatewayServiceServiceName = "gateway.web.v1.SloGatewayService";
1654
+ export class SloGatewayServiceClientImpl implements SloGatewayService {
1655
+ private readonly rpc: Rpc;
1656
+ private readonly service: string;
1657
+ constructor(rpc: Rpc, opts?: { service?: string }) {
1658
+ this.service = opts?.service || SloGatewayServiceServiceName;
1659
+ this.rpc = rpc;
1660
+ this.CreateSlo = this.CreateSlo.bind(this);
1661
+ this.GetSlo = this.GetSlo.bind(this);
1662
+ this.ListSlos = this.ListSlos.bind(this);
1663
+ this.UpdateSlo = this.UpdateSlo.bind(this);
1664
+ this.DeleteSlo = this.DeleteSlo.bind(this);
1665
+ }
1666
+ CreateSlo(request: CreateSloRequest, metadata?: Metadata): Promise<CreateSloResponse> {
1667
+ const data = CreateSloRequest.encode(request).finish();
1668
+ const promise = this.rpc.request(this.service, "CreateSlo", data, metadata);
1669
+ return promise.then((data) => CreateSloResponse.decode(new BinaryReader(data)));
1670
+ }
1671
+
1672
+ GetSlo(request: GetSloRequest, metadata?: Metadata): Promise<GetSloResponse> {
1673
+ const data = GetSloRequest.encode(request).finish();
1674
+ const promise = this.rpc.request(this.service, "GetSlo", data, metadata);
1675
+ return promise.then((data) => GetSloResponse.decode(new BinaryReader(data)));
1676
+ }
1677
+
1678
+ ListSlos(request: ListSlosRequest, metadata?: Metadata): Promise<ListSlosResponse> {
1679
+ const data = ListSlosRequest.encode(request).finish();
1680
+ const promise = this.rpc.request(this.service, "ListSlos", data, metadata);
1681
+ return promise.then((data) => ListSlosResponse.decode(new BinaryReader(data)));
1682
+ }
1683
+
1684
+ UpdateSlo(request: UpdateSloRequest, metadata?: Metadata): Promise<UpdateSloResponse> {
1685
+ const data = UpdateSloRequest.encode(request).finish();
1686
+ const promise = this.rpc.request(this.service, "UpdateSlo", data, metadata);
1687
+ return promise.then((data) => UpdateSloResponse.decode(new BinaryReader(data)));
1688
+ }
1689
+
1690
+ DeleteSlo(request: DeleteSloRequest, metadata?: Metadata): Promise<DeleteSloResponse> {
1691
+ const data = DeleteSloRequest.encode(request).finish();
1692
+ const promise = this.rpc.request(this.service, "DeleteSlo", data, metadata);
1693
+ return promise.then((data) => DeleteSloResponse.decode(new BinaryReader(data)));
1694
+ }
1695
+ }
1696
+
1697
+ interface Rpc {
1698
+ request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
1699
+ }
1700
+
1701
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
1702
+
1703
+ export type DeepPartial<T> = T extends Builtin ? T
1704
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
1705
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
1706
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
1707
+ : Partial<T>;
1708
+
1709
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
1710
+ export type Exact<P, I extends P> = P extends Builtin ? P
1711
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
1712
+
1713
+ function toTimestamp(date: Date): Timestamp {
1714
+ const seconds = Math.trunc(date.getTime() / 1_000);
1715
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
1716
+ return { seconds, nanos };
1717
+ }
1718
+
1719
+ function fromTimestamp(t: Timestamp): Date {
1720
+ let millis = (t.seconds || 0) * 1_000;
1721
+ millis += (t.nanos || 0) / 1_000_000;
1722
+ return new globalThis.Date(millis);
1723
+ }
1724
+
1725
+ function fromJsonTimestamp(o: any): Date {
1726
+ if (o instanceof globalThis.Date) {
1727
+ return o;
1728
+ } else if (typeof o === "string") {
1729
+ return new globalThis.Date(o);
1730
+ } else {
1731
+ return fromTimestamp(Timestamp.fromJSON(o));
1732
+ }
1733
+ }
1734
+
1735
+ function longToNumber(int64: { toString(): string }): number {
1736
+ const num = globalThis.Number(int64.toString());
1737
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
1738
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
1739
+ }
1740
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
1741
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
1742
+ }
1743
+ return num;
1744
+ }
1745
+
1746
+ function isSet(value: any): boolean {
1747
+ return value !== null && value !== undefined;
1748
+ }
1749
+
1750
+ export interface MessageFns<T> {
1751
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
1752
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
1753
+ fromJSON(object: any): T;
1754
+ toJSON(message: T): unknown;
1755
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
1756
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
1757
+ }