@miradorlabs/web-grpc 2.19.0 → 2.21.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.
@@ -63,6 +63,51 @@ export function sloComparatorToJSON(object: SloComparator): string {
63
63
  }
64
64
  }
65
65
 
66
+ export enum SloCorridorState {
67
+ SLO_CORRIDOR_STATE_UNSPECIFIED = 0,
68
+ SLO_CORRIDOR_STATE_OK = 1,
69
+ SLO_CORRIDOR_STATE_BREACHED = 2,
70
+ SLO_CORRIDOR_STATE_NO_DATA = 3,
71
+ UNRECOGNIZED = -1,
72
+ }
73
+
74
+ export function sloCorridorStateFromJSON(object: any): SloCorridorState {
75
+ switch (object) {
76
+ case 0:
77
+ case "SLO_CORRIDOR_STATE_UNSPECIFIED":
78
+ return SloCorridorState.SLO_CORRIDOR_STATE_UNSPECIFIED;
79
+ case 1:
80
+ case "SLO_CORRIDOR_STATE_OK":
81
+ return SloCorridorState.SLO_CORRIDOR_STATE_OK;
82
+ case 2:
83
+ case "SLO_CORRIDOR_STATE_BREACHED":
84
+ return SloCorridorState.SLO_CORRIDOR_STATE_BREACHED;
85
+ case 3:
86
+ case "SLO_CORRIDOR_STATE_NO_DATA":
87
+ return SloCorridorState.SLO_CORRIDOR_STATE_NO_DATA;
88
+ case -1:
89
+ case "UNRECOGNIZED":
90
+ default:
91
+ return SloCorridorState.UNRECOGNIZED;
92
+ }
93
+ }
94
+
95
+ export function sloCorridorStateToJSON(object: SloCorridorState): string {
96
+ switch (object) {
97
+ case SloCorridorState.SLO_CORRIDOR_STATE_UNSPECIFIED:
98
+ return "SLO_CORRIDOR_STATE_UNSPECIFIED";
99
+ case SloCorridorState.SLO_CORRIDOR_STATE_OK:
100
+ return "SLO_CORRIDOR_STATE_OK";
101
+ case SloCorridorState.SLO_CORRIDOR_STATE_BREACHED:
102
+ return "SLO_CORRIDOR_STATE_BREACHED";
103
+ case SloCorridorState.SLO_CORRIDOR_STATE_NO_DATA:
104
+ return "SLO_CORRIDOR_STATE_NO_DATA";
105
+ case SloCorridorState.UNRECOGNIZED:
106
+ default:
107
+ return "UNRECOGNIZED";
108
+ }
109
+ }
110
+
66
111
  export interface Slo {
67
112
  id: string;
68
113
  organizationId: string;
@@ -161,6 +206,87 @@ export interface DeleteSloResponse {
161
206
  status: ResponseStatus | undefined;
162
207
  }
163
208
 
209
+ export interface GetSloStatusRequest {
210
+ organizationId: string;
211
+ projectId: string;
212
+ sloId: string;
213
+ /** evaluation_time: the instant the rolling window ends at. Unset = server now(). */
214
+ evaluationTime: Date | undefined;
215
+ }
216
+
217
+ export interface GetSloStatusResponse {
218
+ status: ResponseStatus | undefined;
219
+ sloStatus: SloStatus | undefined;
220
+ }
221
+
222
+ /**
223
+ * SloStatus is one SLO's live compliance over its rolling window, one row per
224
+ * observed corridor. A disabled SLO returns no corridors (nothing is evaluated).
225
+ */
226
+ export interface SloStatus {
227
+ sloId: string;
228
+ enabled: boolean;
229
+ windowSeconds: number;
230
+ windowStart: Date | undefined;
231
+ windowEnd: Date | undefined;
232
+ corridors: SloCorridorStatus[];
233
+ }
234
+
235
+ /**
236
+ * SloCorridorStatus is one group_by combination's compliance. group_values is
237
+ * parallel to the objective's group_by (empty for a project-wide SLO).
238
+ */
239
+ export interface SloCorridorStatus {
240
+ groupValues: string[];
241
+ eligibleCount: number;
242
+ goodCount: number;
243
+ /** compliance: good/eligible in [0,1]; 0 and state NO_DATA when eligible_count is 0. */
244
+ compliance: number;
245
+ /** budget_remaining: 1 - (1 - compliance)/(1 - target); may be negative when overspent. */
246
+ budgetRemaining: number;
247
+ state: SloCorridorState;
248
+ }
249
+
250
+ export interface GetSloTimelineRequest {
251
+ organizationId: string;
252
+ projectId: string;
253
+ sloId: string;
254
+ /** end_time: the timeline's right edge; truncated down to the UTC hour. Unset = now(). */
255
+ endTime:
256
+ | Date
257
+ | undefined;
258
+ /** bucket_count: number of trailing 1-hour buckets (0 = default 168 = 7d; max 2000). */
259
+ bucketCount: number;
260
+ }
261
+
262
+ export interface GetSloTimelineResponse {
263
+ status: ResponseStatus | undefined;
264
+ timeline: SloTimeline | undefined;
265
+ }
266
+
267
+ /**
268
+ * SloTimeline is one SLO's per-hour health over a trailing window of completed UTC
269
+ * hours. Buckets are SPARSE: an hour with no eligible sample is omitted (render it
270
+ * no-data). Each bucket is the worst (lowest-compliance) corridor that hour.
271
+ */
272
+ export interface SloTimeline {
273
+ sloId: string;
274
+ enabled: boolean;
275
+ target: number;
276
+ bucketSeconds: number;
277
+ windowStart: Date | undefined;
278
+ windowEnd: Date | undefined;
279
+ buckets: SloTimelineBucket[];
280
+ }
281
+
282
+ export interface SloTimelineBucket {
283
+ bucketStart: Date | undefined;
284
+ eligibleCount: number;
285
+ goodCount: number;
286
+ compliance: number;
287
+ state: SloCorridorState;
288
+ }
289
+
164
290
  function createBaseSlo(): Slo {
165
291
  return {
166
292
  id: "",
@@ -1641,56 +1767,1136 @@ export const DeleteSloResponse: MessageFns<DeleteSloResponse> = {
1641
1767
  },
1642
1768
  };
1643
1769
 
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>;
1770
+ function createBaseGetSloStatusRequest(): GetSloStatusRequest {
1771
+ return { organizationId: "", projectId: "", sloId: "", evaluationTime: undefined };
1651
1772
  }
1652
1773
 
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
- }
1774
+ export const GetSloStatusRequest: MessageFns<GetSloStatusRequest> = {
1775
+ encode(message: GetSloStatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1776
+ if (message.organizationId !== "") {
1777
+ writer.uint32(10).string(message.organizationId);
1778
+ }
1779
+ if (message.projectId !== "") {
1780
+ writer.uint32(18).string(message.projectId);
1781
+ }
1782
+ if (message.sloId !== "") {
1783
+ writer.uint32(26).string(message.sloId);
1784
+ }
1785
+ if (message.evaluationTime !== undefined) {
1786
+ Timestamp.encode(toTimestamp(message.evaluationTime), writer.uint32(34).fork()).join();
1787
+ }
1788
+ return writer;
1789
+ },
1671
1790
 
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
- }
1791
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSloStatusRequest {
1792
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1793
+ const end = length === undefined ? reader.len : reader.pos + length;
1794
+ const message = createBaseGetSloStatusRequest();
1795
+ while (reader.pos < end) {
1796
+ const tag = reader.uint32();
1797
+ switch (tag >>> 3) {
1798
+ case 1: {
1799
+ if (tag !== 10) {
1800
+ break;
1801
+ }
1677
1802
 
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
- }
1803
+ message.organizationId = reader.string();
1804
+ continue;
1805
+ }
1806
+ case 2: {
1807
+ if (tag !== 18) {
1808
+ break;
1809
+ }
1683
1810
 
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
- }
1811
+ message.projectId = reader.string();
1812
+ continue;
1813
+ }
1814
+ case 3: {
1815
+ if (tag !== 26) {
1816
+ break;
1817
+ }
1689
1818
 
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)));
1819
+ message.sloId = reader.string();
1820
+ continue;
1821
+ }
1822
+ case 4: {
1823
+ if (tag !== 34) {
1824
+ break;
1825
+ }
1826
+
1827
+ message.evaluationTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1828
+ continue;
1829
+ }
1830
+ }
1831
+ if ((tag & 7) === 4 || tag === 0) {
1832
+ break;
1833
+ }
1834
+ reader.skip(tag & 7);
1835
+ }
1836
+ return message;
1837
+ },
1838
+
1839
+ fromJSON(object: any): GetSloStatusRequest {
1840
+ return {
1841
+ organizationId: isSet(object.organizationId)
1842
+ ? globalThis.String(object.organizationId)
1843
+ : isSet(object.organization_id)
1844
+ ? globalThis.String(object.organization_id)
1845
+ : "",
1846
+ projectId: isSet(object.projectId)
1847
+ ? globalThis.String(object.projectId)
1848
+ : isSet(object.project_id)
1849
+ ? globalThis.String(object.project_id)
1850
+ : "",
1851
+ sloId: isSet(object.sloId)
1852
+ ? globalThis.String(object.sloId)
1853
+ : isSet(object.slo_id)
1854
+ ? globalThis.String(object.slo_id)
1855
+ : "",
1856
+ evaluationTime: isSet(object.evaluationTime)
1857
+ ? fromJsonTimestamp(object.evaluationTime)
1858
+ : isSet(object.evaluation_time)
1859
+ ? fromJsonTimestamp(object.evaluation_time)
1860
+ : undefined,
1861
+ };
1862
+ },
1863
+
1864
+ toJSON(message: GetSloStatusRequest): unknown {
1865
+ const obj: any = {};
1866
+ if (message.organizationId !== "") {
1867
+ obj.organizationId = message.organizationId;
1868
+ }
1869
+ if (message.projectId !== "") {
1870
+ obj.projectId = message.projectId;
1871
+ }
1872
+ if (message.sloId !== "") {
1873
+ obj.sloId = message.sloId;
1874
+ }
1875
+ if (message.evaluationTime !== undefined) {
1876
+ obj.evaluationTime = message.evaluationTime.toISOString();
1877
+ }
1878
+ return obj;
1879
+ },
1880
+
1881
+ create<I extends Exact<DeepPartial<GetSloStatusRequest>, I>>(base?: I): GetSloStatusRequest {
1882
+ return GetSloStatusRequest.fromPartial(base ?? ({} as any));
1883
+ },
1884
+ fromPartial<I extends Exact<DeepPartial<GetSloStatusRequest>, I>>(object: I): GetSloStatusRequest {
1885
+ const message = createBaseGetSloStatusRequest();
1886
+ message.organizationId = object.organizationId ?? "";
1887
+ message.projectId = object.projectId ?? "";
1888
+ message.sloId = object.sloId ?? "";
1889
+ message.evaluationTime = object.evaluationTime ?? undefined;
1890
+ return message;
1891
+ },
1892
+ };
1893
+
1894
+ function createBaseGetSloStatusResponse(): GetSloStatusResponse {
1895
+ return { status: undefined, sloStatus: undefined };
1896
+ }
1897
+
1898
+ export const GetSloStatusResponse: MessageFns<GetSloStatusResponse> = {
1899
+ encode(message: GetSloStatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1900
+ if (message.status !== undefined) {
1901
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1902
+ }
1903
+ if (message.sloStatus !== undefined) {
1904
+ SloStatus.encode(message.sloStatus, writer.uint32(18).fork()).join();
1905
+ }
1906
+ return writer;
1907
+ },
1908
+
1909
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSloStatusResponse {
1910
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1911
+ const end = length === undefined ? reader.len : reader.pos + length;
1912
+ const message = createBaseGetSloStatusResponse();
1913
+ while (reader.pos < end) {
1914
+ const tag = reader.uint32();
1915
+ switch (tag >>> 3) {
1916
+ case 1: {
1917
+ if (tag !== 10) {
1918
+ break;
1919
+ }
1920
+
1921
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1922
+ continue;
1923
+ }
1924
+ case 2: {
1925
+ if (tag !== 18) {
1926
+ break;
1927
+ }
1928
+
1929
+ message.sloStatus = SloStatus.decode(reader, reader.uint32());
1930
+ continue;
1931
+ }
1932
+ }
1933
+ if ((tag & 7) === 4 || tag === 0) {
1934
+ break;
1935
+ }
1936
+ reader.skip(tag & 7);
1937
+ }
1938
+ return message;
1939
+ },
1940
+
1941
+ fromJSON(object: any): GetSloStatusResponse {
1942
+ return {
1943
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1944
+ sloStatus: isSet(object.sloStatus)
1945
+ ? SloStatus.fromJSON(object.sloStatus)
1946
+ : isSet(object.slo_status)
1947
+ ? SloStatus.fromJSON(object.slo_status)
1948
+ : undefined,
1949
+ };
1950
+ },
1951
+
1952
+ toJSON(message: GetSloStatusResponse): unknown {
1953
+ const obj: any = {};
1954
+ if (message.status !== undefined) {
1955
+ obj.status = ResponseStatus.toJSON(message.status);
1956
+ }
1957
+ if (message.sloStatus !== undefined) {
1958
+ obj.sloStatus = SloStatus.toJSON(message.sloStatus);
1959
+ }
1960
+ return obj;
1961
+ },
1962
+
1963
+ create<I extends Exact<DeepPartial<GetSloStatusResponse>, I>>(base?: I): GetSloStatusResponse {
1964
+ return GetSloStatusResponse.fromPartial(base ?? ({} as any));
1965
+ },
1966
+ fromPartial<I extends Exact<DeepPartial<GetSloStatusResponse>, I>>(object: I): GetSloStatusResponse {
1967
+ const message = createBaseGetSloStatusResponse();
1968
+ message.status = (object.status !== undefined && object.status !== null)
1969
+ ? ResponseStatus.fromPartial(object.status)
1970
+ : undefined;
1971
+ message.sloStatus = (object.sloStatus !== undefined && object.sloStatus !== null)
1972
+ ? SloStatus.fromPartial(object.sloStatus)
1973
+ : undefined;
1974
+ return message;
1975
+ },
1976
+ };
1977
+
1978
+ function createBaseSloStatus(): SloStatus {
1979
+ return { sloId: "", enabled: false, windowSeconds: 0, windowStart: undefined, windowEnd: undefined, corridors: [] };
1980
+ }
1981
+
1982
+ export const SloStatus: MessageFns<SloStatus> = {
1983
+ encode(message: SloStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1984
+ if (message.sloId !== "") {
1985
+ writer.uint32(10).string(message.sloId);
1986
+ }
1987
+ if (message.enabled !== false) {
1988
+ writer.uint32(16).bool(message.enabled);
1989
+ }
1990
+ if (message.windowSeconds !== 0) {
1991
+ writer.uint32(24).int64(message.windowSeconds);
1992
+ }
1993
+ if (message.windowStart !== undefined) {
1994
+ Timestamp.encode(toTimestamp(message.windowStart), writer.uint32(34).fork()).join();
1995
+ }
1996
+ if (message.windowEnd !== undefined) {
1997
+ Timestamp.encode(toTimestamp(message.windowEnd), writer.uint32(42).fork()).join();
1998
+ }
1999
+ for (const v of message.corridors) {
2000
+ SloCorridorStatus.encode(v!, writer.uint32(50).fork()).join();
2001
+ }
2002
+ return writer;
2003
+ },
2004
+
2005
+ decode(input: BinaryReader | Uint8Array, length?: number): SloStatus {
2006
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2007
+ const end = length === undefined ? reader.len : reader.pos + length;
2008
+ const message = createBaseSloStatus();
2009
+ while (reader.pos < end) {
2010
+ const tag = reader.uint32();
2011
+ switch (tag >>> 3) {
2012
+ case 1: {
2013
+ if (tag !== 10) {
2014
+ break;
2015
+ }
2016
+
2017
+ message.sloId = reader.string();
2018
+ continue;
2019
+ }
2020
+ case 2: {
2021
+ if (tag !== 16) {
2022
+ break;
2023
+ }
2024
+
2025
+ message.enabled = reader.bool();
2026
+ continue;
2027
+ }
2028
+ case 3: {
2029
+ if (tag !== 24) {
2030
+ break;
2031
+ }
2032
+
2033
+ message.windowSeconds = longToNumber(reader.int64());
2034
+ continue;
2035
+ }
2036
+ case 4: {
2037
+ if (tag !== 34) {
2038
+ break;
2039
+ }
2040
+
2041
+ message.windowStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2042
+ continue;
2043
+ }
2044
+ case 5: {
2045
+ if (tag !== 42) {
2046
+ break;
2047
+ }
2048
+
2049
+ message.windowEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2050
+ continue;
2051
+ }
2052
+ case 6: {
2053
+ if (tag !== 50) {
2054
+ break;
2055
+ }
2056
+
2057
+ message.corridors.push(SloCorridorStatus.decode(reader, reader.uint32()));
2058
+ continue;
2059
+ }
2060
+ }
2061
+ if ((tag & 7) === 4 || tag === 0) {
2062
+ break;
2063
+ }
2064
+ reader.skip(tag & 7);
2065
+ }
2066
+ return message;
2067
+ },
2068
+
2069
+ fromJSON(object: any): SloStatus {
2070
+ return {
2071
+ sloId: isSet(object.sloId)
2072
+ ? globalThis.String(object.sloId)
2073
+ : isSet(object.slo_id)
2074
+ ? globalThis.String(object.slo_id)
2075
+ : "",
2076
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
2077
+ windowSeconds: isSet(object.windowSeconds)
2078
+ ? globalThis.Number(object.windowSeconds)
2079
+ : isSet(object.window_seconds)
2080
+ ? globalThis.Number(object.window_seconds)
2081
+ : 0,
2082
+ windowStart: isSet(object.windowStart)
2083
+ ? fromJsonTimestamp(object.windowStart)
2084
+ : isSet(object.window_start)
2085
+ ? fromJsonTimestamp(object.window_start)
2086
+ : undefined,
2087
+ windowEnd: isSet(object.windowEnd)
2088
+ ? fromJsonTimestamp(object.windowEnd)
2089
+ : isSet(object.window_end)
2090
+ ? fromJsonTimestamp(object.window_end)
2091
+ : undefined,
2092
+ corridors: globalThis.Array.isArray(object?.corridors)
2093
+ ? object.corridors.map((e: any) => SloCorridorStatus.fromJSON(e))
2094
+ : [],
2095
+ };
2096
+ },
2097
+
2098
+ toJSON(message: SloStatus): unknown {
2099
+ const obj: any = {};
2100
+ if (message.sloId !== "") {
2101
+ obj.sloId = message.sloId;
2102
+ }
2103
+ if (message.enabled !== false) {
2104
+ obj.enabled = message.enabled;
2105
+ }
2106
+ if (message.windowSeconds !== 0) {
2107
+ obj.windowSeconds = Math.round(message.windowSeconds);
2108
+ }
2109
+ if (message.windowStart !== undefined) {
2110
+ obj.windowStart = message.windowStart.toISOString();
2111
+ }
2112
+ if (message.windowEnd !== undefined) {
2113
+ obj.windowEnd = message.windowEnd.toISOString();
2114
+ }
2115
+ if (message.corridors?.length) {
2116
+ obj.corridors = message.corridors.map((e) => SloCorridorStatus.toJSON(e));
2117
+ }
2118
+ return obj;
2119
+ },
2120
+
2121
+ create<I extends Exact<DeepPartial<SloStatus>, I>>(base?: I): SloStatus {
2122
+ return SloStatus.fromPartial(base ?? ({} as any));
2123
+ },
2124
+ fromPartial<I extends Exact<DeepPartial<SloStatus>, I>>(object: I): SloStatus {
2125
+ const message = createBaseSloStatus();
2126
+ message.sloId = object.sloId ?? "";
2127
+ message.enabled = object.enabled ?? false;
2128
+ message.windowSeconds = object.windowSeconds ?? 0;
2129
+ message.windowStart = object.windowStart ?? undefined;
2130
+ message.windowEnd = object.windowEnd ?? undefined;
2131
+ message.corridors = object.corridors?.map((e) => SloCorridorStatus.fromPartial(e)) || [];
2132
+ return message;
2133
+ },
2134
+ };
2135
+
2136
+ function createBaseSloCorridorStatus(): SloCorridorStatus {
2137
+ return { groupValues: [], eligibleCount: 0, goodCount: 0, compliance: 0, budgetRemaining: 0, state: 0 };
2138
+ }
2139
+
2140
+ export const SloCorridorStatus: MessageFns<SloCorridorStatus> = {
2141
+ encode(message: SloCorridorStatus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2142
+ for (const v of message.groupValues) {
2143
+ writer.uint32(10).string(v!);
2144
+ }
2145
+ if (message.eligibleCount !== 0) {
2146
+ writer.uint32(16).uint64(message.eligibleCount);
2147
+ }
2148
+ if (message.goodCount !== 0) {
2149
+ writer.uint32(24).uint64(message.goodCount);
2150
+ }
2151
+ if (message.compliance !== 0) {
2152
+ writer.uint32(33).double(message.compliance);
2153
+ }
2154
+ if (message.budgetRemaining !== 0) {
2155
+ writer.uint32(41).double(message.budgetRemaining);
2156
+ }
2157
+ if (message.state !== 0) {
2158
+ writer.uint32(48).int32(message.state);
2159
+ }
2160
+ return writer;
2161
+ },
2162
+
2163
+ decode(input: BinaryReader | Uint8Array, length?: number): SloCorridorStatus {
2164
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2165
+ const end = length === undefined ? reader.len : reader.pos + length;
2166
+ const message = createBaseSloCorridorStatus();
2167
+ while (reader.pos < end) {
2168
+ const tag = reader.uint32();
2169
+ switch (tag >>> 3) {
2170
+ case 1: {
2171
+ if (tag !== 10) {
2172
+ break;
2173
+ }
2174
+
2175
+ message.groupValues.push(reader.string());
2176
+ continue;
2177
+ }
2178
+ case 2: {
2179
+ if (tag !== 16) {
2180
+ break;
2181
+ }
2182
+
2183
+ message.eligibleCount = longToNumber(reader.uint64());
2184
+ continue;
2185
+ }
2186
+ case 3: {
2187
+ if (tag !== 24) {
2188
+ break;
2189
+ }
2190
+
2191
+ message.goodCount = longToNumber(reader.uint64());
2192
+ continue;
2193
+ }
2194
+ case 4: {
2195
+ if (tag !== 33) {
2196
+ break;
2197
+ }
2198
+
2199
+ message.compliance = reader.double();
2200
+ continue;
2201
+ }
2202
+ case 5: {
2203
+ if (tag !== 41) {
2204
+ break;
2205
+ }
2206
+
2207
+ message.budgetRemaining = reader.double();
2208
+ continue;
2209
+ }
2210
+ case 6: {
2211
+ if (tag !== 48) {
2212
+ break;
2213
+ }
2214
+
2215
+ message.state = reader.int32() as any;
2216
+ continue;
2217
+ }
2218
+ }
2219
+ if ((tag & 7) === 4 || tag === 0) {
2220
+ break;
2221
+ }
2222
+ reader.skip(tag & 7);
2223
+ }
2224
+ return message;
2225
+ },
2226
+
2227
+ fromJSON(object: any): SloCorridorStatus {
2228
+ return {
2229
+ groupValues: globalThis.Array.isArray(object?.groupValues)
2230
+ ? object.groupValues.map((e: any) => globalThis.String(e))
2231
+ : globalThis.Array.isArray(object?.group_values)
2232
+ ? object.group_values.map((e: any) => globalThis.String(e))
2233
+ : [],
2234
+ eligibleCount: isSet(object.eligibleCount)
2235
+ ? globalThis.Number(object.eligibleCount)
2236
+ : isSet(object.eligible_count)
2237
+ ? globalThis.Number(object.eligible_count)
2238
+ : 0,
2239
+ goodCount: isSet(object.goodCount)
2240
+ ? globalThis.Number(object.goodCount)
2241
+ : isSet(object.good_count)
2242
+ ? globalThis.Number(object.good_count)
2243
+ : 0,
2244
+ compliance: isSet(object.compliance) ? globalThis.Number(object.compliance) : 0,
2245
+ budgetRemaining: isSet(object.budgetRemaining)
2246
+ ? globalThis.Number(object.budgetRemaining)
2247
+ : isSet(object.budget_remaining)
2248
+ ? globalThis.Number(object.budget_remaining)
2249
+ : 0,
2250
+ state: isSet(object.state) ? sloCorridorStateFromJSON(object.state) : 0,
2251
+ };
2252
+ },
2253
+
2254
+ toJSON(message: SloCorridorStatus): unknown {
2255
+ const obj: any = {};
2256
+ if (message.groupValues?.length) {
2257
+ obj.groupValues = message.groupValues;
2258
+ }
2259
+ if (message.eligibleCount !== 0) {
2260
+ obj.eligibleCount = Math.round(message.eligibleCount);
2261
+ }
2262
+ if (message.goodCount !== 0) {
2263
+ obj.goodCount = Math.round(message.goodCount);
2264
+ }
2265
+ if (message.compliance !== 0) {
2266
+ obj.compliance = message.compliance;
2267
+ }
2268
+ if (message.budgetRemaining !== 0) {
2269
+ obj.budgetRemaining = message.budgetRemaining;
2270
+ }
2271
+ if (message.state !== 0) {
2272
+ obj.state = sloCorridorStateToJSON(message.state);
2273
+ }
2274
+ return obj;
2275
+ },
2276
+
2277
+ create<I extends Exact<DeepPartial<SloCorridorStatus>, I>>(base?: I): SloCorridorStatus {
2278
+ return SloCorridorStatus.fromPartial(base ?? ({} as any));
2279
+ },
2280
+ fromPartial<I extends Exact<DeepPartial<SloCorridorStatus>, I>>(object: I): SloCorridorStatus {
2281
+ const message = createBaseSloCorridorStatus();
2282
+ message.groupValues = object.groupValues?.map((e) => e) || [];
2283
+ message.eligibleCount = object.eligibleCount ?? 0;
2284
+ message.goodCount = object.goodCount ?? 0;
2285
+ message.compliance = object.compliance ?? 0;
2286
+ message.budgetRemaining = object.budgetRemaining ?? 0;
2287
+ message.state = object.state ?? 0;
2288
+ return message;
2289
+ },
2290
+ };
2291
+
2292
+ function createBaseGetSloTimelineRequest(): GetSloTimelineRequest {
2293
+ return { organizationId: "", projectId: "", sloId: "", endTime: undefined, bucketCount: 0 };
2294
+ }
2295
+
2296
+ export const GetSloTimelineRequest: MessageFns<GetSloTimelineRequest> = {
2297
+ encode(message: GetSloTimelineRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2298
+ if (message.organizationId !== "") {
2299
+ writer.uint32(10).string(message.organizationId);
2300
+ }
2301
+ if (message.projectId !== "") {
2302
+ writer.uint32(18).string(message.projectId);
2303
+ }
2304
+ if (message.sloId !== "") {
2305
+ writer.uint32(26).string(message.sloId);
2306
+ }
2307
+ if (message.endTime !== undefined) {
2308
+ Timestamp.encode(toTimestamp(message.endTime), writer.uint32(34).fork()).join();
2309
+ }
2310
+ if (message.bucketCount !== 0) {
2311
+ writer.uint32(40).uint32(message.bucketCount);
2312
+ }
2313
+ return writer;
2314
+ },
2315
+
2316
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSloTimelineRequest {
2317
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2318
+ const end = length === undefined ? reader.len : reader.pos + length;
2319
+ const message = createBaseGetSloTimelineRequest();
2320
+ while (reader.pos < end) {
2321
+ const tag = reader.uint32();
2322
+ switch (tag >>> 3) {
2323
+ case 1: {
2324
+ if (tag !== 10) {
2325
+ break;
2326
+ }
2327
+
2328
+ message.organizationId = reader.string();
2329
+ continue;
2330
+ }
2331
+ case 2: {
2332
+ if (tag !== 18) {
2333
+ break;
2334
+ }
2335
+
2336
+ message.projectId = reader.string();
2337
+ continue;
2338
+ }
2339
+ case 3: {
2340
+ if (tag !== 26) {
2341
+ break;
2342
+ }
2343
+
2344
+ message.sloId = reader.string();
2345
+ continue;
2346
+ }
2347
+ case 4: {
2348
+ if (tag !== 34) {
2349
+ break;
2350
+ }
2351
+
2352
+ message.endTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2353
+ continue;
2354
+ }
2355
+ case 5: {
2356
+ if (tag !== 40) {
2357
+ break;
2358
+ }
2359
+
2360
+ message.bucketCount = reader.uint32();
2361
+ continue;
2362
+ }
2363
+ }
2364
+ if ((tag & 7) === 4 || tag === 0) {
2365
+ break;
2366
+ }
2367
+ reader.skip(tag & 7);
2368
+ }
2369
+ return message;
2370
+ },
2371
+
2372
+ fromJSON(object: any): GetSloTimelineRequest {
2373
+ return {
2374
+ organizationId: isSet(object.organizationId)
2375
+ ? globalThis.String(object.organizationId)
2376
+ : isSet(object.organization_id)
2377
+ ? globalThis.String(object.organization_id)
2378
+ : "",
2379
+ projectId: isSet(object.projectId)
2380
+ ? globalThis.String(object.projectId)
2381
+ : isSet(object.project_id)
2382
+ ? globalThis.String(object.project_id)
2383
+ : "",
2384
+ sloId: isSet(object.sloId)
2385
+ ? globalThis.String(object.sloId)
2386
+ : isSet(object.slo_id)
2387
+ ? globalThis.String(object.slo_id)
2388
+ : "",
2389
+ endTime: isSet(object.endTime)
2390
+ ? fromJsonTimestamp(object.endTime)
2391
+ : isSet(object.end_time)
2392
+ ? fromJsonTimestamp(object.end_time)
2393
+ : undefined,
2394
+ bucketCount: isSet(object.bucketCount)
2395
+ ? globalThis.Number(object.bucketCount)
2396
+ : isSet(object.bucket_count)
2397
+ ? globalThis.Number(object.bucket_count)
2398
+ : 0,
2399
+ };
2400
+ },
2401
+
2402
+ toJSON(message: GetSloTimelineRequest): unknown {
2403
+ const obj: any = {};
2404
+ if (message.organizationId !== "") {
2405
+ obj.organizationId = message.organizationId;
2406
+ }
2407
+ if (message.projectId !== "") {
2408
+ obj.projectId = message.projectId;
2409
+ }
2410
+ if (message.sloId !== "") {
2411
+ obj.sloId = message.sloId;
2412
+ }
2413
+ if (message.endTime !== undefined) {
2414
+ obj.endTime = message.endTime.toISOString();
2415
+ }
2416
+ if (message.bucketCount !== 0) {
2417
+ obj.bucketCount = Math.round(message.bucketCount);
2418
+ }
2419
+ return obj;
2420
+ },
2421
+
2422
+ create<I extends Exact<DeepPartial<GetSloTimelineRequest>, I>>(base?: I): GetSloTimelineRequest {
2423
+ return GetSloTimelineRequest.fromPartial(base ?? ({} as any));
2424
+ },
2425
+ fromPartial<I extends Exact<DeepPartial<GetSloTimelineRequest>, I>>(object: I): GetSloTimelineRequest {
2426
+ const message = createBaseGetSloTimelineRequest();
2427
+ message.organizationId = object.organizationId ?? "";
2428
+ message.projectId = object.projectId ?? "";
2429
+ message.sloId = object.sloId ?? "";
2430
+ message.endTime = object.endTime ?? undefined;
2431
+ message.bucketCount = object.bucketCount ?? 0;
2432
+ return message;
2433
+ },
2434
+ };
2435
+
2436
+ function createBaseGetSloTimelineResponse(): GetSloTimelineResponse {
2437
+ return { status: undefined, timeline: undefined };
2438
+ }
2439
+
2440
+ export const GetSloTimelineResponse: MessageFns<GetSloTimelineResponse> = {
2441
+ encode(message: GetSloTimelineResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2442
+ if (message.status !== undefined) {
2443
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2444
+ }
2445
+ if (message.timeline !== undefined) {
2446
+ SloTimeline.encode(message.timeline, writer.uint32(18).fork()).join();
2447
+ }
2448
+ return writer;
2449
+ },
2450
+
2451
+ decode(input: BinaryReader | Uint8Array, length?: number): GetSloTimelineResponse {
2452
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2453
+ const end = length === undefined ? reader.len : reader.pos + length;
2454
+ const message = createBaseGetSloTimelineResponse();
2455
+ while (reader.pos < end) {
2456
+ const tag = reader.uint32();
2457
+ switch (tag >>> 3) {
2458
+ case 1: {
2459
+ if (tag !== 10) {
2460
+ break;
2461
+ }
2462
+
2463
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2464
+ continue;
2465
+ }
2466
+ case 2: {
2467
+ if (tag !== 18) {
2468
+ break;
2469
+ }
2470
+
2471
+ message.timeline = SloTimeline.decode(reader, reader.uint32());
2472
+ continue;
2473
+ }
2474
+ }
2475
+ if ((tag & 7) === 4 || tag === 0) {
2476
+ break;
2477
+ }
2478
+ reader.skip(tag & 7);
2479
+ }
2480
+ return message;
2481
+ },
2482
+
2483
+ fromJSON(object: any): GetSloTimelineResponse {
2484
+ return {
2485
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2486
+ timeline: isSet(object.timeline) ? SloTimeline.fromJSON(object.timeline) : undefined,
2487
+ };
2488
+ },
2489
+
2490
+ toJSON(message: GetSloTimelineResponse): unknown {
2491
+ const obj: any = {};
2492
+ if (message.status !== undefined) {
2493
+ obj.status = ResponseStatus.toJSON(message.status);
2494
+ }
2495
+ if (message.timeline !== undefined) {
2496
+ obj.timeline = SloTimeline.toJSON(message.timeline);
2497
+ }
2498
+ return obj;
2499
+ },
2500
+
2501
+ create<I extends Exact<DeepPartial<GetSloTimelineResponse>, I>>(base?: I): GetSloTimelineResponse {
2502
+ return GetSloTimelineResponse.fromPartial(base ?? ({} as any));
2503
+ },
2504
+ fromPartial<I extends Exact<DeepPartial<GetSloTimelineResponse>, I>>(object: I): GetSloTimelineResponse {
2505
+ const message = createBaseGetSloTimelineResponse();
2506
+ message.status = (object.status !== undefined && object.status !== null)
2507
+ ? ResponseStatus.fromPartial(object.status)
2508
+ : undefined;
2509
+ message.timeline = (object.timeline !== undefined && object.timeline !== null)
2510
+ ? SloTimeline.fromPartial(object.timeline)
2511
+ : undefined;
2512
+ return message;
2513
+ },
2514
+ };
2515
+
2516
+ function createBaseSloTimeline(): SloTimeline {
2517
+ return {
2518
+ sloId: "",
2519
+ enabled: false,
2520
+ target: 0,
2521
+ bucketSeconds: 0,
2522
+ windowStart: undefined,
2523
+ windowEnd: undefined,
2524
+ buckets: [],
2525
+ };
2526
+ }
2527
+
2528
+ export const SloTimeline: MessageFns<SloTimeline> = {
2529
+ encode(message: SloTimeline, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2530
+ if (message.sloId !== "") {
2531
+ writer.uint32(10).string(message.sloId);
2532
+ }
2533
+ if (message.enabled !== false) {
2534
+ writer.uint32(16).bool(message.enabled);
2535
+ }
2536
+ if (message.target !== 0) {
2537
+ writer.uint32(25).double(message.target);
2538
+ }
2539
+ if (message.bucketSeconds !== 0) {
2540
+ writer.uint32(32).int64(message.bucketSeconds);
2541
+ }
2542
+ if (message.windowStart !== undefined) {
2543
+ Timestamp.encode(toTimestamp(message.windowStart), writer.uint32(42).fork()).join();
2544
+ }
2545
+ if (message.windowEnd !== undefined) {
2546
+ Timestamp.encode(toTimestamp(message.windowEnd), writer.uint32(50).fork()).join();
2547
+ }
2548
+ for (const v of message.buckets) {
2549
+ SloTimelineBucket.encode(v!, writer.uint32(58).fork()).join();
2550
+ }
2551
+ return writer;
2552
+ },
2553
+
2554
+ decode(input: BinaryReader | Uint8Array, length?: number): SloTimeline {
2555
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2556
+ const end = length === undefined ? reader.len : reader.pos + length;
2557
+ const message = createBaseSloTimeline();
2558
+ while (reader.pos < end) {
2559
+ const tag = reader.uint32();
2560
+ switch (tag >>> 3) {
2561
+ case 1: {
2562
+ if (tag !== 10) {
2563
+ break;
2564
+ }
2565
+
2566
+ message.sloId = reader.string();
2567
+ continue;
2568
+ }
2569
+ case 2: {
2570
+ if (tag !== 16) {
2571
+ break;
2572
+ }
2573
+
2574
+ message.enabled = reader.bool();
2575
+ continue;
2576
+ }
2577
+ case 3: {
2578
+ if (tag !== 25) {
2579
+ break;
2580
+ }
2581
+
2582
+ message.target = reader.double();
2583
+ continue;
2584
+ }
2585
+ case 4: {
2586
+ if (tag !== 32) {
2587
+ break;
2588
+ }
2589
+
2590
+ message.bucketSeconds = longToNumber(reader.int64());
2591
+ continue;
2592
+ }
2593
+ case 5: {
2594
+ if (tag !== 42) {
2595
+ break;
2596
+ }
2597
+
2598
+ message.windowStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2599
+ continue;
2600
+ }
2601
+ case 6: {
2602
+ if (tag !== 50) {
2603
+ break;
2604
+ }
2605
+
2606
+ message.windowEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2607
+ continue;
2608
+ }
2609
+ case 7: {
2610
+ if (tag !== 58) {
2611
+ break;
2612
+ }
2613
+
2614
+ message.buckets.push(SloTimelineBucket.decode(reader, reader.uint32()));
2615
+ continue;
2616
+ }
2617
+ }
2618
+ if ((tag & 7) === 4 || tag === 0) {
2619
+ break;
2620
+ }
2621
+ reader.skip(tag & 7);
2622
+ }
2623
+ return message;
2624
+ },
2625
+
2626
+ fromJSON(object: any): SloTimeline {
2627
+ return {
2628
+ sloId: isSet(object.sloId)
2629
+ ? globalThis.String(object.sloId)
2630
+ : isSet(object.slo_id)
2631
+ ? globalThis.String(object.slo_id)
2632
+ : "",
2633
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
2634
+ target: isSet(object.target) ? globalThis.Number(object.target) : 0,
2635
+ bucketSeconds: isSet(object.bucketSeconds)
2636
+ ? globalThis.Number(object.bucketSeconds)
2637
+ : isSet(object.bucket_seconds)
2638
+ ? globalThis.Number(object.bucket_seconds)
2639
+ : 0,
2640
+ windowStart: isSet(object.windowStart)
2641
+ ? fromJsonTimestamp(object.windowStart)
2642
+ : isSet(object.window_start)
2643
+ ? fromJsonTimestamp(object.window_start)
2644
+ : undefined,
2645
+ windowEnd: isSet(object.windowEnd)
2646
+ ? fromJsonTimestamp(object.windowEnd)
2647
+ : isSet(object.window_end)
2648
+ ? fromJsonTimestamp(object.window_end)
2649
+ : undefined,
2650
+ buckets: globalThis.Array.isArray(object?.buckets)
2651
+ ? object.buckets.map((e: any) => SloTimelineBucket.fromJSON(e))
2652
+ : [],
2653
+ };
2654
+ },
2655
+
2656
+ toJSON(message: SloTimeline): unknown {
2657
+ const obj: any = {};
2658
+ if (message.sloId !== "") {
2659
+ obj.sloId = message.sloId;
2660
+ }
2661
+ if (message.enabled !== false) {
2662
+ obj.enabled = message.enabled;
2663
+ }
2664
+ if (message.target !== 0) {
2665
+ obj.target = message.target;
2666
+ }
2667
+ if (message.bucketSeconds !== 0) {
2668
+ obj.bucketSeconds = Math.round(message.bucketSeconds);
2669
+ }
2670
+ if (message.windowStart !== undefined) {
2671
+ obj.windowStart = message.windowStart.toISOString();
2672
+ }
2673
+ if (message.windowEnd !== undefined) {
2674
+ obj.windowEnd = message.windowEnd.toISOString();
2675
+ }
2676
+ if (message.buckets?.length) {
2677
+ obj.buckets = message.buckets.map((e) => SloTimelineBucket.toJSON(e));
2678
+ }
2679
+ return obj;
2680
+ },
2681
+
2682
+ create<I extends Exact<DeepPartial<SloTimeline>, I>>(base?: I): SloTimeline {
2683
+ return SloTimeline.fromPartial(base ?? ({} as any));
2684
+ },
2685
+ fromPartial<I extends Exact<DeepPartial<SloTimeline>, I>>(object: I): SloTimeline {
2686
+ const message = createBaseSloTimeline();
2687
+ message.sloId = object.sloId ?? "";
2688
+ message.enabled = object.enabled ?? false;
2689
+ message.target = object.target ?? 0;
2690
+ message.bucketSeconds = object.bucketSeconds ?? 0;
2691
+ message.windowStart = object.windowStart ?? undefined;
2692
+ message.windowEnd = object.windowEnd ?? undefined;
2693
+ message.buckets = object.buckets?.map((e) => SloTimelineBucket.fromPartial(e)) || [];
2694
+ return message;
2695
+ },
2696
+ };
2697
+
2698
+ function createBaseSloTimelineBucket(): SloTimelineBucket {
2699
+ return { bucketStart: undefined, eligibleCount: 0, goodCount: 0, compliance: 0, state: 0 };
2700
+ }
2701
+
2702
+ export const SloTimelineBucket: MessageFns<SloTimelineBucket> = {
2703
+ encode(message: SloTimelineBucket, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2704
+ if (message.bucketStart !== undefined) {
2705
+ Timestamp.encode(toTimestamp(message.bucketStart), writer.uint32(10).fork()).join();
2706
+ }
2707
+ if (message.eligibleCount !== 0) {
2708
+ writer.uint32(16).uint64(message.eligibleCount);
2709
+ }
2710
+ if (message.goodCount !== 0) {
2711
+ writer.uint32(24).uint64(message.goodCount);
2712
+ }
2713
+ if (message.compliance !== 0) {
2714
+ writer.uint32(33).double(message.compliance);
2715
+ }
2716
+ if (message.state !== 0) {
2717
+ writer.uint32(40).int32(message.state);
2718
+ }
2719
+ return writer;
2720
+ },
2721
+
2722
+ decode(input: BinaryReader | Uint8Array, length?: number): SloTimelineBucket {
2723
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2724
+ const end = length === undefined ? reader.len : reader.pos + length;
2725
+ const message = createBaseSloTimelineBucket();
2726
+ while (reader.pos < end) {
2727
+ const tag = reader.uint32();
2728
+ switch (tag >>> 3) {
2729
+ case 1: {
2730
+ if (tag !== 10) {
2731
+ break;
2732
+ }
2733
+
2734
+ message.bucketStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
2735
+ continue;
2736
+ }
2737
+ case 2: {
2738
+ if (tag !== 16) {
2739
+ break;
2740
+ }
2741
+
2742
+ message.eligibleCount = longToNumber(reader.uint64());
2743
+ continue;
2744
+ }
2745
+ case 3: {
2746
+ if (tag !== 24) {
2747
+ break;
2748
+ }
2749
+
2750
+ message.goodCount = longToNumber(reader.uint64());
2751
+ continue;
2752
+ }
2753
+ case 4: {
2754
+ if (tag !== 33) {
2755
+ break;
2756
+ }
2757
+
2758
+ message.compliance = reader.double();
2759
+ continue;
2760
+ }
2761
+ case 5: {
2762
+ if (tag !== 40) {
2763
+ break;
2764
+ }
2765
+
2766
+ message.state = reader.int32() as any;
2767
+ continue;
2768
+ }
2769
+ }
2770
+ if ((tag & 7) === 4 || tag === 0) {
2771
+ break;
2772
+ }
2773
+ reader.skip(tag & 7);
2774
+ }
2775
+ return message;
2776
+ },
2777
+
2778
+ fromJSON(object: any): SloTimelineBucket {
2779
+ return {
2780
+ bucketStart: isSet(object.bucketStart)
2781
+ ? fromJsonTimestamp(object.bucketStart)
2782
+ : isSet(object.bucket_start)
2783
+ ? fromJsonTimestamp(object.bucket_start)
2784
+ : undefined,
2785
+ eligibleCount: isSet(object.eligibleCount)
2786
+ ? globalThis.Number(object.eligibleCount)
2787
+ : isSet(object.eligible_count)
2788
+ ? globalThis.Number(object.eligible_count)
2789
+ : 0,
2790
+ goodCount: isSet(object.goodCount)
2791
+ ? globalThis.Number(object.goodCount)
2792
+ : isSet(object.good_count)
2793
+ ? globalThis.Number(object.good_count)
2794
+ : 0,
2795
+ compliance: isSet(object.compliance) ? globalThis.Number(object.compliance) : 0,
2796
+ state: isSet(object.state) ? sloCorridorStateFromJSON(object.state) : 0,
2797
+ };
2798
+ },
2799
+
2800
+ toJSON(message: SloTimelineBucket): unknown {
2801
+ const obj: any = {};
2802
+ if (message.bucketStart !== undefined) {
2803
+ obj.bucketStart = message.bucketStart.toISOString();
2804
+ }
2805
+ if (message.eligibleCount !== 0) {
2806
+ obj.eligibleCount = Math.round(message.eligibleCount);
2807
+ }
2808
+ if (message.goodCount !== 0) {
2809
+ obj.goodCount = Math.round(message.goodCount);
2810
+ }
2811
+ if (message.compliance !== 0) {
2812
+ obj.compliance = message.compliance;
2813
+ }
2814
+ if (message.state !== 0) {
2815
+ obj.state = sloCorridorStateToJSON(message.state);
2816
+ }
2817
+ return obj;
2818
+ },
2819
+
2820
+ create<I extends Exact<DeepPartial<SloTimelineBucket>, I>>(base?: I): SloTimelineBucket {
2821
+ return SloTimelineBucket.fromPartial(base ?? ({} as any));
2822
+ },
2823
+ fromPartial<I extends Exact<DeepPartial<SloTimelineBucket>, I>>(object: I): SloTimelineBucket {
2824
+ const message = createBaseSloTimelineBucket();
2825
+ message.bucketStart = object.bucketStart ?? undefined;
2826
+ message.eligibleCount = object.eligibleCount ?? 0;
2827
+ message.goodCount = object.goodCount ?? 0;
2828
+ message.compliance = object.compliance ?? 0;
2829
+ message.state = object.state ?? 0;
2830
+ return message;
2831
+ },
2832
+ };
2833
+
2834
+ /** SloGatewayService provides web client access to SLO definitions. */
2835
+ export interface SloGatewayService {
2836
+ CreateSlo(request: CreateSloRequest, metadata?: Metadata): Promise<CreateSloResponse>;
2837
+ GetSlo(request: GetSloRequest, metadata?: Metadata): Promise<GetSloResponse>;
2838
+ ListSlos(request: ListSlosRequest, metadata?: Metadata): Promise<ListSlosResponse>;
2839
+ UpdateSlo(request: UpdateSloRequest, metadata?: Metadata): Promise<UpdateSloResponse>;
2840
+ DeleteSlo(request: DeleteSloRequest, metadata?: Metadata): Promise<DeleteSloResponse>;
2841
+ GetSloStatus(request: GetSloStatusRequest, metadata?: Metadata): Promise<GetSloStatusResponse>;
2842
+ GetSloTimeline(request: GetSloTimelineRequest, metadata?: Metadata): Promise<GetSloTimelineResponse>;
2843
+ }
2844
+
2845
+ export const SloGatewayServiceServiceName = "gateway.web.v1.SloGatewayService";
2846
+ export class SloGatewayServiceClientImpl implements SloGatewayService {
2847
+ private readonly rpc: Rpc;
2848
+ private readonly service: string;
2849
+ constructor(rpc: Rpc, opts?: { service?: string }) {
2850
+ this.service = opts?.service || SloGatewayServiceServiceName;
2851
+ this.rpc = rpc;
2852
+ this.CreateSlo = this.CreateSlo.bind(this);
2853
+ this.GetSlo = this.GetSlo.bind(this);
2854
+ this.ListSlos = this.ListSlos.bind(this);
2855
+ this.UpdateSlo = this.UpdateSlo.bind(this);
2856
+ this.DeleteSlo = this.DeleteSlo.bind(this);
2857
+ this.GetSloStatus = this.GetSloStatus.bind(this);
2858
+ this.GetSloTimeline = this.GetSloTimeline.bind(this);
2859
+ }
2860
+ CreateSlo(request: CreateSloRequest, metadata?: Metadata): Promise<CreateSloResponse> {
2861
+ const data = CreateSloRequest.encode(request).finish();
2862
+ const promise = this.rpc.request(this.service, "CreateSlo", data, metadata);
2863
+ return promise.then((data) => CreateSloResponse.decode(new BinaryReader(data)));
2864
+ }
2865
+
2866
+ GetSlo(request: GetSloRequest, metadata?: Metadata): Promise<GetSloResponse> {
2867
+ const data = GetSloRequest.encode(request).finish();
2868
+ const promise = this.rpc.request(this.service, "GetSlo", data, metadata);
2869
+ return promise.then((data) => GetSloResponse.decode(new BinaryReader(data)));
2870
+ }
2871
+
2872
+ ListSlos(request: ListSlosRequest, metadata?: Metadata): Promise<ListSlosResponse> {
2873
+ const data = ListSlosRequest.encode(request).finish();
2874
+ const promise = this.rpc.request(this.service, "ListSlos", data, metadata);
2875
+ return promise.then((data) => ListSlosResponse.decode(new BinaryReader(data)));
2876
+ }
2877
+
2878
+ UpdateSlo(request: UpdateSloRequest, metadata?: Metadata): Promise<UpdateSloResponse> {
2879
+ const data = UpdateSloRequest.encode(request).finish();
2880
+ const promise = this.rpc.request(this.service, "UpdateSlo", data, metadata);
2881
+ return promise.then((data) => UpdateSloResponse.decode(new BinaryReader(data)));
2882
+ }
2883
+
2884
+ DeleteSlo(request: DeleteSloRequest, metadata?: Metadata): Promise<DeleteSloResponse> {
2885
+ const data = DeleteSloRequest.encode(request).finish();
2886
+ const promise = this.rpc.request(this.service, "DeleteSlo", data, metadata);
2887
+ return promise.then((data) => DeleteSloResponse.decode(new BinaryReader(data)));
2888
+ }
2889
+
2890
+ GetSloStatus(request: GetSloStatusRequest, metadata?: Metadata): Promise<GetSloStatusResponse> {
2891
+ const data = GetSloStatusRequest.encode(request).finish();
2892
+ const promise = this.rpc.request(this.service, "GetSloStatus", data, metadata);
2893
+ return promise.then((data) => GetSloStatusResponse.decode(new BinaryReader(data)));
2894
+ }
2895
+
2896
+ GetSloTimeline(request: GetSloTimelineRequest, metadata?: Metadata): Promise<GetSloTimelineResponse> {
2897
+ const data = GetSloTimelineRequest.encode(request).finish();
2898
+ const promise = this.rpc.request(this.service, "GetSloTimeline", data, metadata);
2899
+ return promise.then((data) => GetSloTimelineResponse.decode(new BinaryReader(data)));
1694
2900
  }
1695
2901
  }
1696
2902