@nebius/js-sdk 0.2.15 → 0.2.17

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.
Files changed (41) hide show
  1. package/dist/cjs/api/nebius/audit/v2/index.d.ts +31 -0
  2. package/dist/cjs/api/nebius/audit/v2/index.d.ts.map +1 -1
  3. package/dist/cjs/api/nebius/audit/v2/index.js +69 -0
  4. package/dist/cjs/api/nebius/audit/v2/index.js.map +1 -1
  5. package/dist/cjs/api/nebius/billing/v1/index.d.ts +450 -0
  6. package/dist/cjs/api/nebius/billing/v1/index.d.ts.map +1 -0
  7. package/dist/cjs/api/nebius/billing/v1/index.js +2182 -0
  8. package/dist/cjs/api/nebius/billing/v1/index.js.map +1 -0
  9. package/dist/cjs/api/nebius/billing/v1.d.ts +1 -0
  10. package/dist/cjs/api/nebius/billing/v1.js +2 -0
  11. package/dist/cjs/api/nebius/compute/v1/index.d.ts +8 -0
  12. package/dist/cjs/api/nebius/compute/v1/index.d.ts.map +1 -1
  13. package/dist/cjs/api/nebius/compute/v1/index.js +23 -0
  14. package/dist/cjs/api/nebius/compute/v1/index.js.map +1 -1
  15. package/dist/cjs/api/nebius/mk8s/v1/index.d.ts +8 -0
  16. package/dist/cjs/api/nebius/mk8s/v1/index.d.ts.map +1 -1
  17. package/dist/cjs/api/nebius/mk8s/v1/index.js +23 -0
  18. package/dist/cjs/api/nebius/mk8s/v1/index.js.map +1 -1
  19. package/dist/cjs/version.d.ts +1 -1
  20. package/dist/cjs/version.js +1 -1
  21. package/dist/esm/api/nebius/audit/v2/index.d.ts +31 -0
  22. package/dist/esm/api/nebius/audit/v2/index.d.ts.map +1 -1
  23. package/dist/esm/api/nebius/audit/v2/index.js +69 -0
  24. package/dist/esm/api/nebius/audit/v2/index.js.map +1 -1
  25. package/dist/esm/api/nebius/billing/v1/index.d.ts +450 -0
  26. package/dist/esm/api/nebius/billing/v1/index.d.ts.map +1 -0
  27. package/dist/esm/api/nebius/billing/v1/index.js +2178 -0
  28. package/dist/esm/api/nebius/billing/v1/index.js.map +1 -0
  29. package/dist/esm/api/nebius/billing/v1.d.ts +1 -0
  30. package/dist/esm/api/nebius/billing/v1.js +1 -0
  31. package/dist/esm/api/nebius/compute/v1/index.d.ts +8 -0
  32. package/dist/esm/api/nebius/compute/v1/index.d.ts.map +1 -1
  33. package/dist/esm/api/nebius/compute/v1/index.js +23 -0
  34. package/dist/esm/api/nebius/compute/v1/index.js.map +1 -1
  35. package/dist/esm/api/nebius/mk8s/v1/index.d.ts +8 -0
  36. package/dist/esm/api/nebius/mk8s/v1/index.d.ts.map +1 -1
  37. package/dist/esm/api/nebius/mk8s/v1/index.js +23 -0
  38. package/dist/esm/api/nebius/mk8s/v1/index.js.map +1 -1
  39. package/dist/esm/version.d.ts +1 -1
  40. package/dist/esm/version.js +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1,2178 @@
1
+ /* Generated by Nebius TS generator. DO NOT EDIT! */
2
+ import { BinaryReader, BinaryWriter, isSet, wkt, createEnum, unknownFieldsSymbol } from "../../../../runtime/protos/index.js";
3
+ import { inspect } from "util";
4
+ import { protoRegistry } from "../../../protobuf.js";
5
+ import { custom, customJson, inspectJson } from "../../../../runtime/util/logging.js";
6
+ import { makeGenericClientConstructor } from "@grpc/grpc-js";
7
+ import { Request as SDKRequestClass } from "../../../../runtime/request.js";
8
+ import { ResourceMetadata } from "../../common/v1/index.js";
9
+ const __deprecatedWarned = new Set();
10
+ export const EstimateBatchRequest = {
11
+ $type: "nebius.billing.v1.EstimateBatchRequest",
12
+ encode(message, writer = new BinaryWriter()) {
13
+ for (const v of (message.resourceSpecs ?? [])) {
14
+ const w = writer.uint32(10).fork();
15
+ ResourceSpec.encode(v, w);
16
+ w.join();
17
+ }
18
+ if (message.offerTypes?.length) {
19
+ const w = writer.uint32(82).fork();
20
+ for (const v of message.offerTypes)
21
+ w.int32(v?.code | 0);
22
+ w.join();
23
+ }
24
+ if (message.currency !== "") {
25
+ writer.uint32(90).string(message.currency);
26
+ }
27
+ if (message.filterAggregationUnit !== undefined) {
28
+ const w = writer.uint32(162).fork();
29
+ FilterAggregationUnit.encode(message.filterAggregationUnit, w);
30
+ w.join();
31
+ }
32
+ if (message[unknownFieldsSymbol]) {
33
+ writer.raw(message[unknownFieldsSymbol]);
34
+ }
35
+ return writer;
36
+ },
37
+ decode(input, length) {
38
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
39
+ const end = length === undefined ? reader.len : reader.pos + length;
40
+ const message = createBaseEstimateBatchRequest();
41
+ let writer = undefined;
42
+ while (reader.pos < end) {
43
+ const tag = reader.uint32();
44
+ switch (tag >>> 3) {
45
+ case 1: {
46
+ if (tag !== 10)
47
+ break;
48
+ message.resourceSpecs.push(ResourceSpec.decode(reader, reader.uint32()));
49
+ continue;
50
+ }
51
+ case 10: {
52
+ // packed or unpacked repeated enum
53
+ if ((tag & 7) === 2) {
54
+ const end2 = reader.uint32() + reader.pos;
55
+ while (reader.pos < end2) {
56
+ message.offerTypes.push(OfferType.fromNumber(reader.int32()));
57
+ }
58
+ continue;
59
+ }
60
+ else if ((tag & 7) === 0) {
61
+ message.offerTypes.push(OfferType.fromNumber(reader.int32()));
62
+ continue;
63
+ }
64
+ break; // wrong wire type
65
+ }
66
+ case 11: {
67
+ if (tag !== 90)
68
+ break;
69
+ message.currency = reader.string();
70
+ continue;
71
+ }
72
+ case 20: {
73
+ if (tag !== 162)
74
+ break;
75
+ message.filterAggregationUnit = FilterAggregationUnit.decode(reader, reader.uint32());
76
+ continue;
77
+ }
78
+ default:
79
+ break;
80
+ }
81
+ if ((tag & 7) === 4 || tag === 0) {
82
+ break;
83
+ }
84
+ {
85
+ if (!writer)
86
+ writer = new BinaryWriter();
87
+ const skipped = reader.skip(tag & 7, tag >>> 3);
88
+ writer.uint32(tag).raw(skipped);
89
+ }
90
+ }
91
+ if (writer) {
92
+ message[unknownFieldsSymbol] = writer.finish();
93
+ }
94
+ return message;
95
+ },
96
+ fromJSON(object) {
97
+ return applyEstimateBatchRequestCustom({
98
+ $type: "nebius.billing.v1.EstimateBatchRequest",
99
+ resourceSpecs: globalThis.Array.isArray(object?.resourceSpecs ?? object?.resource_specs)
100
+ ? (object.resourceSpecs ?? object.resource_specs).map((e) => ResourceSpec.fromJSON(e))
101
+ : [],
102
+ offerTypes: globalThis.Array.isArray(object?.offerTypes ?? object?.offer_types)
103
+ ? (object.offerTypes ?? object.offer_types).map((e) => OfferType.fromJSON(e))
104
+ : [],
105
+ currency: isSet(object.currency ?? object.currency)
106
+ ? String(object.currency ?? object.currency)
107
+ : "",
108
+ filterAggregationUnit: isSet(object.filterAggregationUnit ?? object.filter_aggregation_unit)
109
+ ? FilterAggregationUnit.fromJSON(object.filterAggregationUnit ?? object.filter_aggregation_unit)
110
+ : undefined,
111
+ });
112
+ },
113
+ toJSON(message, use = "json") {
114
+ const obj = {};
115
+ const pick = (json, pb) => (use === "json" ? json : pb);
116
+ if (message.resourceSpecs?.length) {
117
+ obj[pick("resourceSpecs", "resource_specs")] = message.resourceSpecs.map((e) => e ? ResourceSpec.toJSON(e, use) : undefined);
118
+ }
119
+ if (message.offerTypes?.length) {
120
+ obj[pick("offerTypes", "offer_types")] = message.offerTypes.map((e) => OfferType.toJSON(e));
121
+ }
122
+ if (message.currency !== "") {
123
+ obj[pick("currency", "currency")] = message.currency;
124
+ }
125
+ if (message.filterAggregationUnit !== undefined) {
126
+ obj[pick("filterAggregationUnit", "filter_aggregation_unit")] = message.filterAggregationUnit
127
+ ? FilterAggregationUnit.toJSON(message.filterAggregationUnit, use)
128
+ : undefined;
129
+ }
130
+ return obj;
131
+ },
132
+ create(base) {
133
+ return EstimateBatchRequest.fromPartial(base ?? {});
134
+ },
135
+ fromPartial(object) {
136
+ const message = createBaseEstimateBatchRequest();
137
+ message.resourceSpecs = object.resourceSpecs?.map((e) => ResourceSpec.fromPartial(e)) || [];
138
+ message.offerTypes = object.offerTypes?.map((e) => OfferType.fromJSON(e.name)) || [];
139
+ message.currency = (object.currency !== undefined && object.currency !== null)
140
+ ? object.currency
141
+ : "";
142
+ message.filterAggregationUnit = (object.filterAggregationUnit !== undefined && object.filterAggregationUnit !== null)
143
+ ? FilterAggregationUnit.fromPartial(object.filterAggregationUnit)
144
+ : undefined;
145
+ return message;
146
+ },
147
+ };
148
+ protoRegistry.registerMessage(EstimateBatchRequest);
149
+ function EstimateBatchRequestCustomInspect() {
150
+ const parts = [];
151
+ if ((this.resourceSpecs?.length ?? 0) !== 0)
152
+ parts.push("resourceSpecs" + "=" + inspect(this.resourceSpecs));
153
+ if ((this.offerTypes?.length ?? 0) !== 0)
154
+ parts.push("offerTypes" + "=" + inspect(this.offerTypes));
155
+ if (this.currency !== "")
156
+ parts.push("currency" + "=" + inspect(this.currency));
157
+ if (this.filterAggregationUnit !== undefined)
158
+ parts.push("filterAggregationUnit" + "=" + inspect(this.filterAggregationUnit));
159
+ return `${this.$type}(${parts.join(", ")})`;
160
+ }
161
+ function EstimateBatchRequestCustomJson() {
162
+ const obj = {
163
+ type: this.$type,
164
+ };
165
+ if ((this.resourceSpecs?.length ?? 0) !== 0)
166
+ obj.resourceSpecs = inspectJson(this.resourceSpecs);
167
+ if ((this.offerTypes?.length ?? 0) !== 0)
168
+ obj.offerTypes = inspectJson(this.offerTypes);
169
+ if (this.currency !== "")
170
+ obj.currency = inspectJson(this.currency);
171
+ if (this.filterAggregationUnit !== undefined)
172
+ obj.filterAggregationUnit = inspectJson(this.filterAggregationUnit);
173
+ return obj;
174
+ }
175
+ function applyEstimateBatchRequestCustom(message) {
176
+ message[custom] = EstimateBatchRequestCustomInspect;
177
+ message[customJson] = EstimateBatchRequestCustomJson;
178
+ return message;
179
+ }
180
+ function createBaseEstimateBatchRequest() {
181
+ const message = {
182
+ $type: "nebius.billing.v1.EstimateBatchRequest",
183
+ resourceSpecs: [],
184
+ offerTypes: [],
185
+ currency: "",
186
+ filterAggregationUnit: undefined,
187
+ };
188
+ return applyEstimateBatchRequestCustom(message);
189
+ }
190
+ export const EstimateBatchResponse = {
191
+ $type: "nebius.billing.v1.EstimateBatchResponse",
192
+ encode(message, writer = new BinaryWriter()) {
193
+ for (const v of (message.resourceCosts ?? [])) {
194
+ const w = writer.uint32(10).fork();
195
+ ResourceCost.encode(v, w);
196
+ w.join();
197
+ }
198
+ for (const v of (message.totalCosts ?? [])) {
199
+ const w = writer.uint32(82).fork();
200
+ TotalCost.encode(v, w);
201
+ w.join();
202
+ }
203
+ if (message.currency !== "") {
204
+ writer.uint32(162).string(message.currency);
205
+ }
206
+ if (message[unknownFieldsSymbol]) {
207
+ writer.raw(message[unknownFieldsSymbol]);
208
+ }
209
+ return writer;
210
+ },
211
+ decode(input, length) {
212
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
213
+ const end = length === undefined ? reader.len : reader.pos + length;
214
+ const message = createBaseEstimateBatchResponse();
215
+ let writer = undefined;
216
+ while (reader.pos < end) {
217
+ const tag = reader.uint32();
218
+ switch (tag >>> 3) {
219
+ case 1: {
220
+ if (tag !== 10)
221
+ break;
222
+ message.resourceCosts.push(ResourceCost.decode(reader, reader.uint32()));
223
+ continue;
224
+ }
225
+ case 10: {
226
+ if (tag !== 82)
227
+ break;
228
+ message.totalCosts.push(TotalCost.decode(reader, reader.uint32()));
229
+ continue;
230
+ }
231
+ case 20: {
232
+ if (tag !== 162)
233
+ break;
234
+ message.currency = reader.string();
235
+ continue;
236
+ }
237
+ default:
238
+ break;
239
+ }
240
+ if ((tag & 7) === 4 || tag === 0) {
241
+ break;
242
+ }
243
+ {
244
+ if (!writer)
245
+ writer = new BinaryWriter();
246
+ const skipped = reader.skip(tag & 7, tag >>> 3);
247
+ writer.uint32(tag).raw(skipped);
248
+ }
249
+ }
250
+ if (writer) {
251
+ message[unknownFieldsSymbol] = writer.finish();
252
+ }
253
+ return message;
254
+ },
255
+ fromJSON(object) {
256
+ return applyEstimateBatchResponseCustom({
257
+ $type: "nebius.billing.v1.EstimateBatchResponse",
258
+ resourceCosts: globalThis.Array.isArray(object?.resourceCosts ?? object?.resource_costs)
259
+ ? (object.resourceCosts ?? object.resource_costs).map((e) => ResourceCost.fromJSON(e))
260
+ : [],
261
+ totalCosts: globalThis.Array.isArray(object?.totalCosts ?? object?.total_costs)
262
+ ? (object.totalCosts ?? object.total_costs).map((e) => TotalCost.fromJSON(e))
263
+ : [],
264
+ currency: isSet(object.currency ?? object.currency)
265
+ ? String(object.currency ?? object.currency)
266
+ : "",
267
+ });
268
+ },
269
+ toJSON(message, use = "json") {
270
+ const obj = {};
271
+ const pick = (json, pb) => (use === "json" ? json : pb);
272
+ if (message.resourceCosts?.length) {
273
+ obj[pick("resourceCosts", "resource_costs")] = message.resourceCosts.map((e) => e ? ResourceCost.toJSON(e, use) : undefined);
274
+ }
275
+ if (message.totalCosts?.length) {
276
+ obj[pick("totalCosts", "total_costs")] = message.totalCosts.map((e) => e ? TotalCost.toJSON(e, use) : undefined);
277
+ }
278
+ if (message.currency !== "") {
279
+ obj[pick("currency", "currency")] = message.currency;
280
+ }
281
+ return obj;
282
+ },
283
+ create(base) {
284
+ return EstimateBatchResponse.fromPartial(base ?? {});
285
+ },
286
+ fromPartial(object) {
287
+ const message = createBaseEstimateBatchResponse();
288
+ message.resourceCosts = object.resourceCosts?.map((e) => ResourceCost.fromPartial(e)) || [];
289
+ message.totalCosts = object.totalCosts?.map((e) => TotalCost.fromPartial(e)) || [];
290
+ message.currency = (object.currency !== undefined && object.currency !== null)
291
+ ? object.currency
292
+ : "";
293
+ return message;
294
+ },
295
+ };
296
+ protoRegistry.registerMessage(EstimateBatchResponse);
297
+ function EstimateBatchResponseCustomInspect() {
298
+ const parts = [];
299
+ if ((this.resourceCosts?.length ?? 0) !== 0)
300
+ parts.push("resourceCosts" + "=" + inspect(this.resourceCosts));
301
+ if ((this.totalCosts?.length ?? 0) !== 0)
302
+ parts.push("totalCosts" + "=" + inspect(this.totalCosts));
303
+ if (this.currency !== "")
304
+ parts.push("currency" + "=" + inspect(this.currency));
305
+ return `${this.$type}(${parts.join(", ")})`;
306
+ }
307
+ function EstimateBatchResponseCustomJson() {
308
+ const obj = {
309
+ type: this.$type,
310
+ };
311
+ if ((this.resourceCosts?.length ?? 0) !== 0)
312
+ obj.resourceCosts = inspectJson(this.resourceCosts);
313
+ if ((this.totalCosts?.length ?? 0) !== 0)
314
+ obj.totalCosts = inspectJson(this.totalCosts);
315
+ if (this.currency !== "")
316
+ obj.currency = inspectJson(this.currency);
317
+ return obj;
318
+ }
319
+ function applyEstimateBatchResponseCustom(message) {
320
+ message[custom] = EstimateBatchResponseCustomInspect;
321
+ message[customJson] = EstimateBatchResponseCustomJson;
322
+ return message;
323
+ }
324
+ function createBaseEstimateBatchResponse() {
325
+ const message = {
326
+ $type: "nebius.billing.v1.EstimateBatchResponse",
327
+ resourceCosts: [],
328
+ totalCosts: [],
329
+ currency: "",
330
+ };
331
+ return applyEstimateBatchResponseCustom(message);
332
+ }
333
+ export const CalculatorServiceServiceDescription = {
334
+ estimateBatch: {
335
+ path: "/nebius.billing.v1.CalculatorService/EstimateBatch",
336
+ requestStream: false,
337
+ responseStream: false,
338
+ requestSerialize: (value) => Buffer.from(EstimateBatchRequest.encode(value).finish()),
339
+ sendResetMask: false,
340
+ requestDeserialize: (value) => EstimateBatchRequest.decode(value),
341
+ responseSerialize: (value) => Buffer.from(EstimateBatchResponse.encode(value).finish()),
342
+ responseDeserialize: (value) => EstimateBatchResponse.decode(value),
343
+ },
344
+ };
345
+ export const CalculatorServiceBaseClient = makeGenericClientConstructor(CalculatorServiceServiceDescription, "nebius.billing.v1.CalculatorService");
346
+ export class CalculatorService {
347
+ sdk;
348
+ $type = "nebius.billing.v1.CalculatorService";
349
+ addr;
350
+ spec;
351
+ apiServiceName = "api.calculator.billing-data-plane";
352
+ constructor(sdk) {
353
+ this.sdk = sdk;
354
+ const addr = sdk.getAddressFromServiceName(this.$type, this.apiServiceName);
355
+ this.addr = addr;
356
+ this.spec = CalculatorServiceServiceDescription;
357
+ }
358
+ estimateBatch(...args) {
359
+ const spec = this.spec.estimateBatch;
360
+ const request = args[0];
361
+ const metadata = (args.length > 1 ? args[1] : undefined);
362
+ const options = (args.length > 2 ? args[2] : undefined);
363
+ const deserialize = spec.responseDeserialize;
364
+ return new SDKRequestClass(this.sdk, spec, this.addr, deserialize, request, metadata, options);
365
+ }
366
+ }
367
+ export const FilterAggregationUnit_FilterAggregationUnitValue = createEnum("nebius.billing.v1.FilterAggregationUnit.FilterAggregationUnitValue", {
368
+ FILTER_AGGREGATION_UNIT_UNSPECIFIED: 0,
369
+ FILTER_AGGREGATION_UNIT_MINUTE: 1,
370
+ FILTER_AGGREGATION_UNIT_HOUR: 2,
371
+ FILTER_AGGREGATION_UNIT_DAY: 3,
372
+ FILTER_AGGREGATION_UNIT_WEEK: 4,
373
+ FILTER_AGGREGATION_UNIT_MONTH: 5,
374
+ });
375
+ protoRegistry.registerEnum(FilterAggregationUnit_FilterAggregationUnitValue);
376
+ export const AggregationUnit_UnitType = createEnum("nebius.billing.v1.AggregationUnit.UnitType", {
377
+ UNIT_TYPE_UNSPECIFIED: 0,
378
+ UNIT_TYPE_TIME_BASED: 1,
379
+ UNIT_TYPE_USAGE_BASED: 2,
380
+ });
381
+ protoRegistry.registerEnum(AggregationUnit_UnitType);
382
+ export const ResourceSpec = {
383
+ $type: "nebius.billing.v1.ResourceSpec",
384
+ encode(message, writer = new BinaryWriter()) {
385
+ if (message.spec !== undefined) {
386
+ const w = writer.uint32(10).fork();
387
+ wkt[".google.protobuf.Any"].writeMessage(w, message.spec);
388
+ w.join();
389
+ }
390
+ if (message[unknownFieldsSymbol]) {
391
+ writer.raw(message[unknownFieldsSymbol]);
392
+ }
393
+ return writer;
394
+ },
395
+ decode(input, length) {
396
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
397
+ const end = length === undefined ? reader.len : reader.pos + length;
398
+ const message = createBaseResourceSpec();
399
+ let writer = undefined;
400
+ while (reader.pos < end) {
401
+ const tag = reader.uint32();
402
+ switch (tag >>> 3) {
403
+ case 1: {
404
+ if (tag !== 10)
405
+ break;
406
+ const len = reader.uint32();
407
+ message.spec = wkt[".google.protobuf.Any"].readMessage(reader, len);
408
+ continue;
409
+ }
410
+ default:
411
+ break;
412
+ }
413
+ if ((tag & 7) === 4 || tag === 0) {
414
+ break;
415
+ }
416
+ {
417
+ if (!writer)
418
+ writer = new BinaryWriter();
419
+ const skipped = reader.skip(tag & 7, tag >>> 3);
420
+ writer.uint32(tag).raw(skipped);
421
+ }
422
+ }
423
+ if (writer) {
424
+ message[unknownFieldsSymbol] = writer.finish();
425
+ }
426
+ return message;
427
+ },
428
+ fromJSON(object) {
429
+ return applyResourceSpecCustom({
430
+ $type: "nebius.billing.v1.ResourceSpec",
431
+ spec: isSet(object.spec ?? object.spec)
432
+ ? wkt[".google.protobuf.Any"].fromJSON(object.spec ?? object.spec)
433
+ : undefined,
434
+ });
435
+ },
436
+ toJSON(message, use = "json") {
437
+ const obj = {};
438
+ const pick = (json, pb) => (use === "json" ? json : pb);
439
+ if (message.spec !== undefined) {
440
+ obj[pick("spec", "spec")] = wkt[".google.protobuf.Any"].toJSON(message.spec, use);
441
+ }
442
+ return obj;
443
+ },
444
+ create(base) {
445
+ return ResourceSpec.fromPartial(base ?? {});
446
+ },
447
+ fromPartial(object) {
448
+ const message = createBaseResourceSpec();
449
+ message.spec = (object.spec !== undefined && object.spec !== null)
450
+ ? wkt[".google.protobuf.Any"].fromPartial(object.spec)
451
+ : undefined;
452
+ return message;
453
+ },
454
+ };
455
+ protoRegistry.registerMessage(ResourceSpec);
456
+ function ResourceSpecCustomInspect() {
457
+ const parts = [];
458
+ if (this.spec !== undefined)
459
+ parts.push("spec" + "=" + inspect(this.spec));
460
+ return `${this.$type}(${parts.join(", ")})`;
461
+ }
462
+ function ResourceSpecCustomJson() {
463
+ const obj = {
464
+ type: this.$type,
465
+ };
466
+ if (this.spec !== undefined)
467
+ obj.spec = inspectJson(this.spec);
468
+ return obj;
469
+ }
470
+ function applyResourceSpecCustom(message) {
471
+ message[custom] = ResourceSpecCustomInspect;
472
+ message[customJson] = ResourceSpecCustomJson;
473
+ return message;
474
+ }
475
+ function createBaseResourceSpec() {
476
+ const message = {
477
+ $type: "nebius.billing.v1.ResourceSpec",
478
+ spec: undefined,
479
+ };
480
+ return applyResourceSpecCustom(message);
481
+ }
482
+ export const GeneralTotalCost = {
483
+ $type: "nebius.billing.v1.GeneralTotalCost",
484
+ encode(message, writer = new BinaryWriter()) {
485
+ if (message.total !== undefined) {
486
+ const w = writer.uint32(10).fork();
487
+ CostBreakdown.encode(message.total, w);
488
+ w.join();
489
+ }
490
+ if (message[unknownFieldsSymbol]) {
491
+ writer.raw(message[unknownFieldsSymbol]);
492
+ }
493
+ return writer;
494
+ },
495
+ decode(input, length) {
496
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
497
+ const end = length === undefined ? reader.len : reader.pos + length;
498
+ const message = createBaseGeneralTotalCost();
499
+ let writer = undefined;
500
+ while (reader.pos < end) {
501
+ const tag = reader.uint32();
502
+ switch (tag >>> 3) {
503
+ case 1: {
504
+ if (tag !== 10)
505
+ break;
506
+ message.total = CostBreakdown.decode(reader, reader.uint32());
507
+ continue;
508
+ }
509
+ default:
510
+ break;
511
+ }
512
+ if ((tag & 7) === 4 || tag === 0) {
513
+ break;
514
+ }
515
+ {
516
+ if (!writer)
517
+ writer = new BinaryWriter();
518
+ const skipped = reader.skip(tag & 7, tag >>> 3);
519
+ writer.uint32(tag).raw(skipped);
520
+ }
521
+ }
522
+ if (writer) {
523
+ message[unknownFieldsSymbol] = writer.finish();
524
+ }
525
+ return message;
526
+ },
527
+ fromJSON(object) {
528
+ return applyGeneralTotalCostCustom({
529
+ $type: "nebius.billing.v1.GeneralTotalCost",
530
+ total: isSet(object.total ?? object.total)
531
+ ? CostBreakdown.fromJSON(object.total ?? object.total)
532
+ : undefined,
533
+ });
534
+ },
535
+ toJSON(message, use = "json") {
536
+ const obj = {};
537
+ const pick = (json, pb) => (use === "json" ? json : pb);
538
+ if (message.total !== undefined) {
539
+ obj[pick("total", "total")] = message.total
540
+ ? CostBreakdown.toJSON(message.total, use)
541
+ : undefined;
542
+ }
543
+ return obj;
544
+ },
545
+ create(base) {
546
+ return GeneralTotalCost.fromPartial(base ?? {});
547
+ },
548
+ fromPartial(object) {
549
+ const message = createBaseGeneralTotalCost();
550
+ message.total = (object.total !== undefined && object.total !== null)
551
+ ? CostBreakdown.fromPartial(object.total)
552
+ : undefined;
553
+ return message;
554
+ },
555
+ };
556
+ protoRegistry.registerMessage(GeneralTotalCost);
557
+ function GeneralTotalCostCustomInspect() {
558
+ const parts = [];
559
+ if (this.total !== undefined)
560
+ parts.push("total" + "=" + inspect(this.total));
561
+ return `${this.$type}(${parts.join(", ")})`;
562
+ }
563
+ function GeneralTotalCostCustomJson() {
564
+ const obj = {
565
+ type: this.$type,
566
+ };
567
+ if (this.total !== undefined)
568
+ obj.total = inspectJson(this.total);
569
+ return obj;
570
+ }
571
+ function applyGeneralTotalCostCustom(message) {
572
+ message[custom] = GeneralTotalCostCustomInspect;
573
+ message[customJson] = GeneralTotalCostCustomJson;
574
+ return message;
575
+ }
576
+ function createBaseGeneralTotalCost() {
577
+ const message = {
578
+ $type: "nebius.billing.v1.GeneralTotalCost",
579
+ total: undefined,
580
+ };
581
+ return applyGeneralTotalCostCustom(message);
582
+ }
583
+ export const RangeTotalCost = {
584
+ $type: "nebius.billing.v1.RangeTotalCost",
585
+ encode(message, writer = new BinaryWriter()) {
586
+ if (message.min !== undefined) {
587
+ const w = writer.uint32(10).fork();
588
+ CostBreakdown.encode(message.min, w);
589
+ w.join();
590
+ }
591
+ if (message.max !== undefined) {
592
+ const w = writer.uint32(18).fork();
593
+ CostBreakdown.encode(message.max, w);
594
+ w.join();
595
+ }
596
+ if (message[unknownFieldsSymbol]) {
597
+ writer.raw(message[unknownFieldsSymbol]);
598
+ }
599
+ return writer;
600
+ },
601
+ decode(input, length) {
602
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
603
+ const end = length === undefined ? reader.len : reader.pos + length;
604
+ const message = createBaseRangeTotalCost();
605
+ let writer = undefined;
606
+ while (reader.pos < end) {
607
+ const tag = reader.uint32();
608
+ switch (tag >>> 3) {
609
+ case 1: {
610
+ if (tag !== 10)
611
+ break;
612
+ message.min = CostBreakdown.decode(reader, reader.uint32());
613
+ continue;
614
+ }
615
+ case 2: {
616
+ if (tag !== 18)
617
+ break;
618
+ message.max = CostBreakdown.decode(reader, reader.uint32());
619
+ continue;
620
+ }
621
+ default:
622
+ break;
623
+ }
624
+ if ((tag & 7) === 4 || tag === 0) {
625
+ break;
626
+ }
627
+ {
628
+ if (!writer)
629
+ writer = new BinaryWriter();
630
+ const skipped = reader.skip(tag & 7, tag >>> 3);
631
+ writer.uint32(tag).raw(skipped);
632
+ }
633
+ }
634
+ if (writer) {
635
+ message[unknownFieldsSymbol] = writer.finish();
636
+ }
637
+ return message;
638
+ },
639
+ fromJSON(object) {
640
+ return applyRangeTotalCostCustom({
641
+ $type: "nebius.billing.v1.RangeTotalCost",
642
+ min: isSet(object.min ?? object.min)
643
+ ? CostBreakdown.fromJSON(object.min ?? object.min)
644
+ : undefined,
645
+ max: isSet(object.max ?? object.max)
646
+ ? CostBreakdown.fromJSON(object.max ?? object.max)
647
+ : undefined,
648
+ });
649
+ },
650
+ toJSON(message, use = "json") {
651
+ const obj = {};
652
+ const pick = (json, pb) => (use === "json" ? json : pb);
653
+ if (message.min !== undefined) {
654
+ obj[pick("min", "min")] = message.min
655
+ ? CostBreakdown.toJSON(message.min, use)
656
+ : undefined;
657
+ }
658
+ if (message.max !== undefined) {
659
+ obj[pick("max", "max")] = message.max
660
+ ? CostBreakdown.toJSON(message.max, use)
661
+ : undefined;
662
+ }
663
+ return obj;
664
+ },
665
+ create(base) {
666
+ return RangeTotalCost.fromPartial(base ?? {});
667
+ },
668
+ fromPartial(object) {
669
+ const message = createBaseRangeTotalCost();
670
+ message.min = (object.min !== undefined && object.min !== null)
671
+ ? CostBreakdown.fromPartial(object.min)
672
+ : undefined;
673
+ message.max = (object.max !== undefined && object.max !== null)
674
+ ? CostBreakdown.fromPartial(object.max)
675
+ : undefined;
676
+ return message;
677
+ },
678
+ };
679
+ protoRegistry.registerMessage(RangeTotalCost);
680
+ function RangeTotalCostCustomInspect() {
681
+ const parts = [];
682
+ if (this.min !== undefined)
683
+ parts.push("min" + "=" + inspect(this.min));
684
+ if (this.max !== undefined)
685
+ parts.push("max" + "=" + inspect(this.max));
686
+ return `${this.$type}(${parts.join(", ")})`;
687
+ }
688
+ function RangeTotalCostCustomJson() {
689
+ const obj = {
690
+ type: this.$type,
691
+ };
692
+ if (this.min !== undefined)
693
+ obj.min = inspectJson(this.min);
694
+ if (this.max !== undefined)
695
+ obj.max = inspectJson(this.max);
696
+ return obj;
697
+ }
698
+ function applyRangeTotalCostCustom(message) {
699
+ message[custom] = RangeTotalCostCustomInspect;
700
+ message[customJson] = RangeTotalCostCustomJson;
701
+ return message;
702
+ }
703
+ function createBaseRangeTotalCost() {
704
+ const message = {
705
+ $type: "nebius.billing.v1.RangeTotalCost",
706
+ min: undefined,
707
+ max: undefined,
708
+ };
709
+ return applyRangeTotalCostCustom(message);
710
+ }
711
+ export const ResourceCost = {
712
+ $type: "nebius.billing.v1.ResourceCost",
713
+ encode(message, writer = new BinaryWriter()) {
714
+ if (message.metadata !== undefined) {
715
+ const w = writer.uint32(10).fork();
716
+ ResourceMetadata.encode(message.metadata, w);
717
+ w.join();
718
+ }
719
+ if (message.overrideMetadata !== undefined) {
720
+ const w = writer.uint32(18).fork();
721
+ ResourceMetadata.encode(message.overrideMetadata, w);
722
+ w.join();
723
+ }
724
+ if (message.aggregationUnit !== undefined) {
725
+ const w = writer.uint32(34).fork();
726
+ AggregationUnit.encode(message.aggregationUnit, w);
727
+ w.join();
728
+ }
729
+ if (message.costType?.$case === undefined) { /* noop */ }
730
+ else if (message.costType?.$case === "general") {
731
+ const w = writer.uint32(162).fork();
732
+ GeneralResourceCost.encode(message.costType.general, w);
733
+ w.join();
734
+ }
735
+ else if (message.costType?.$case === "fixedInstance") {
736
+ const w = writer.uint32(170).fork();
737
+ FixedInstanceResourceCost.encode(message.costType.fixedInstance, w);
738
+ w.join();
739
+ }
740
+ else if (message.costType?.$case === "autoscale") {
741
+ const w = writer.uint32(178).fork();
742
+ AutoscaleResourceCost.encode(message.costType.autoscale, w);
743
+ w.join();
744
+ }
745
+ if (message[unknownFieldsSymbol]) {
746
+ writer.raw(message[unknownFieldsSymbol]);
747
+ }
748
+ return writer;
749
+ },
750
+ decode(input, length) {
751
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
752
+ const end = length === undefined ? reader.len : reader.pos + length;
753
+ const message = createBaseResourceCost();
754
+ let writer = undefined;
755
+ while (reader.pos < end) {
756
+ const tag = reader.uint32();
757
+ switch (tag >>> 3) {
758
+ case 1: {
759
+ if (tag !== 10)
760
+ break;
761
+ message.metadata = ResourceMetadata.decode(reader, reader.uint32());
762
+ continue;
763
+ }
764
+ case 2: {
765
+ if (tag !== 18)
766
+ break;
767
+ message.overrideMetadata = ResourceMetadata.decode(reader, reader.uint32());
768
+ continue;
769
+ }
770
+ case 4: {
771
+ if (tag !== 34)
772
+ break;
773
+ message.aggregationUnit = AggregationUnit.decode(reader, reader.uint32());
774
+ continue;
775
+ }
776
+ case 20: {
777
+ if (tag !== 162)
778
+ break;
779
+ message.costType = {
780
+ $case: "general",
781
+ general: GeneralResourceCost.decode(reader, reader.uint32())
782
+ };
783
+ continue;
784
+ }
785
+ case 21: {
786
+ if (tag !== 170)
787
+ break;
788
+ message.costType = {
789
+ $case: "fixedInstance",
790
+ fixedInstance: FixedInstanceResourceCost.decode(reader, reader.uint32())
791
+ };
792
+ continue;
793
+ }
794
+ case 22: {
795
+ if (tag !== 178)
796
+ break;
797
+ message.costType = {
798
+ $case: "autoscale",
799
+ autoscale: AutoscaleResourceCost.decode(reader, reader.uint32())
800
+ };
801
+ continue;
802
+ }
803
+ default:
804
+ break;
805
+ }
806
+ if ((tag & 7) === 4 || tag === 0) {
807
+ break;
808
+ }
809
+ {
810
+ if (!writer)
811
+ writer = new BinaryWriter();
812
+ const skipped = reader.skip(tag & 7, tag >>> 3);
813
+ writer.uint32(tag).raw(skipped);
814
+ }
815
+ }
816
+ if (writer) {
817
+ message[unknownFieldsSymbol] = writer.finish();
818
+ }
819
+ return message;
820
+ },
821
+ fromJSON(object) {
822
+ return applyResourceCostCustom({
823
+ $type: "nebius.billing.v1.ResourceCost",
824
+ metadata: isSet(object.metadata ?? object.metadata)
825
+ ? ResourceMetadata.fromJSON(object.metadata ?? object.metadata)
826
+ : undefined,
827
+ overrideMetadata: isSet(object.overrideMetadata ?? object.override_metadata)
828
+ ? ResourceMetadata.fromJSON(object.overrideMetadata ?? object.override_metadata)
829
+ : undefined,
830
+ aggregationUnit: isSet(object.aggregationUnit ?? object.aggregation_unit)
831
+ ? AggregationUnit.fromJSON(object.aggregationUnit ?? object.aggregation_unit)
832
+ : undefined,
833
+ costType: (() => {
834
+ if (isSet(object.general) || isSet(object.general)) {
835
+ return {
836
+ $case: "general",
837
+ general: GeneralResourceCost.fromJSON(object.general ?? object.general)
838
+ };
839
+ }
840
+ if (isSet(object.fixedInstance) || isSet(object.fixed_instance)) {
841
+ return {
842
+ $case: "fixedInstance",
843
+ fixedInstance: FixedInstanceResourceCost.fromJSON(object.fixedInstance ?? object.fixed_instance)
844
+ };
845
+ }
846
+ if (isSet(object.autoscale) || isSet(object.autoscale)) {
847
+ return {
848
+ $case: "autoscale",
849
+ autoscale: AutoscaleResourceCost.fromJSON(object.autoscale ?? object.autoscale)
850
+ };
851
+ }
852
+ return undefined;
853
+ })(),
854
+ });
855
+ },
856
+ toJSON(message, use = "json") {
857
+ const obj = {};
858
+ const pick = (json, pb) => (use === "json" ? json : pb);
859
+ if (message.metadata !== undefined) {
860
+ obj[pick("metadata", "metadata")] = message.metadata
861
+ ? ResourceMetadata.toJSON(message.metadata, use)
862
+ : undefined;
863
+ }
864
+ if (message.overrideMetadata !== undefined) {
865
+ obj[pick("overrideMetadata", "override_metadata")] = message.overrideMetadata
866
+ ? ResourceMetadata.toJSON(message.overrideMetadata, use)
867
+ : undefined;
868
+ }
869
+ if (message.aggregationUnit !== undefined) {
870
+ obj[pick("aggregationUnit", "aggregation_unit")] = message.aggregationUnit
871
+ ? AggregationUnit.toJSON(message.aggregationUnit, use)
872
+ : undefined;
873
+ }
874
+ switch (message.costType?.$case) {
875
+ case "general": {
876
+ obj[pick("general", "general")] = GeneralResourceCost.toJSON(message.costType.general, use);
877
+ break;
878
+ }
879
+ case "fixedInstance": {
880
+ obj[pick("fixedInstance", "fixed_instance")] = FixedInstanceResourceCost.toJSON(message.costType.fixedInstance, use);
881
+ break;
882
+ }
883
+ case "autoscale": {
884
+ obj[pick("autoscale", "autoscale")] = AutoscaleResourceCost.toJSON(message.costType.autoscale, use);
885
+ break;
886
+ }
887
+ default: break;
888
+ }
889
+ return obj;
890
+ },
891
+ create(base) {
892
+ return ResourceCost.fromPartial(base ?? {});
893
+ },
894
+ fromPartial(object) {
895
+ const message = createBaseResourceCost();
896
+ message.metadata = (object.metadata !== undefined && object.metadata !== null)
897
+ ? ResourceMetadata.fromPartial(object.metadata)
898
+ : undefined;
899
+ message.overrideMetadata = (object.overrideMetadata !== undefined && object.overrideMetadata !== null)
900
+ ? ResourceMetadata.fromPartial(object.overrideMetadata)
901
+ : undefined;
902
+ message.aggregationUnit = (object.aggregationUnit !== undefined && object.aggregationUnit !== null)
903
+ ? AggregationUnit.fromPartial(object.aggregationUnit)
904
+ : undefined;
905
+ switch (object.costType?.$case) {
906
+ case "general": {
907
+ if (object.costType.general !== undefined && object.costType.general !== null) {
908
+ message.costType = {
909
+ $case: "general",
910
+ general: GeneralResourceCost.fromPartial(object.costType.general),
911
+ };
912
+ }
913
+ break;
914
+ }
915
+ case "fixedInstance": {
916
+ if (object.costType.fixedInstance !== undefined && object.costType.fixedInstance !== null) {
917
+ message.costType = {
918
+ $case: "fixedInstance",
919
+ fixedInstance: FixedInstanceResourceCost.fromPartial(object.costType.fixedInstance),
920
+ };
921
+ }
922
+ break;
923
+ }
924
+ case "autoscale": {
925
+ if (object.costType.autoscale !== undefined && object.costType.autoscale !== null) {
926
+ message.costType = {
927
+ $case: "autoscale",
928
+ autoscale: AutoscaleResourceCost.fromPartial(object.costType.autoscale),
929
+ };
930
+ }
931
+ break;
932
+ }
933
+ default: break;
934
+ }
935
+ return message;
936
+ },
937
+ };
938
+ protoRegistry.registerMessage(ResourceCost);
939
+ function ResourceCostCustomInspect() {
940
+ const parts = [];
941
+ if (this.metadata !== undefined)
942
+ parts.push("metadata" + "=" + inspect(this.metadata));
943
+ if (this.overrideMetadata !== undefined)
944
+ parts.push("overrideMetadata" + "=" + inspect(this.overrideMetadata));
945
+ if (this.aggregationUnit !== undefined)
946
+ parts.push("aggregationUnit" + "=" + inspect(this.aggregationUnit));
947
+ return `${this.$type}(${parts.join(", ")})`;
948
+ }
949
+ function ResourceCostCustomJson() {
950
+ const obj = {
951
+ type: this.$type,
952
+ };
953
+ if (this.metadata !== undefined)
954
+ obj.metadata = inspectJson(this.metadata);
955
+ if (this.overrideMetadata !== undefined)
956
+ obj.overrideMetadata = inspectJson(this.overrideMetadata);
957
+ if (this.aggregationUnit !== undefined)
958
+ obj.aggregationUnit = inspectJson(this.aggregationUnit);
959
+ return obj;
960
+ }
961
+ function applyResourceCostCustom(message) {
962
+ message[custom] = ResourceCostCustomInspect;
963
+ message[customJson] = ResourceCostCustomJson;
964
+ return message;
965
+ }
966
+ function createBaseResourceCost() {
967
+ const message = {
968
+ $type: "nebius.billing.v1.ResourceCost",
969
+ metadata: undefined,
970
+ overrideMetadata: undefined,
971
+ aggregationUnit: undefined,
972
+ costType: undefined,
973
+ };
974
+ return applyResourceCostCustom(message);
975
+ }
976
+ export const GeneralResourceCost = {
977
+ $type: "nebius.billing.v1.GeneralResourceCost",
978
+ encode(message, writer = new BinaryWriter()) {
979
+ if (message.total !== undefined) {
980
+ const w = writer.uint32(10).fork();
981
+ CostBreakdown.encode(message.total, w);
982
+ w.join();
983
+ }
984
+ if (message[unknownFieldsSymbol]) {
985
+ writer.raw(message[unknownFieldsSymbol]);
986
+ }
987
+ return writer;
988
+ },
989
+ decode(input, length) {
990
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
991
+ const end = length === undefined ? reader.len : reader.pos + length;
992
+ const message = createBaseGeneralResourceCost();
993
+ let writer = undefined;
994
+ while (reader.pos < end) {
995
+ const tag = reader.uint32();
996
+ switch (tag >>> 3) {
997
+ case 1: {
998
+ if (tag !== 10)
999
+ break;
1000
+ message.total = CostBreakdown.decode(reader, reader.uint32());
1001
+ continue;
1002
+ }
1003
+ default:
1004
+ break;
1005
+ }
1006
+ if ((tag & 7) === 4 || tag === 0) {
1007
+ break;
1008
+ }
1009
+ {
1010
+ if (!writer)
1011
+ writer = new BinaryWriter();
1012
+ const skipped = reader.skip(tag & 7, tag >>> 3);
1013
+ writer.uint32(tag).raw(skipped);
1014
+ }
1015
+ }
1016
+ if (writer) {
1017
+ message[unknownFieldsSymbol] = writer.finish();
1018
+ }
1019
+ return message;
1020
+ },
1021
+ fromJSON(object) {
1022
+ return applyGeneralResourceCostCustom({
1023
+ $type: "nebius.billing.v1.GeneralResourceCost",
1024
+ total: isSet(object.total ?? object.total)
1025
+ ? CostBreakdown.fromJSON(object.total ?? object.total)
1026
+ : undefined,
1027
+ });
1028
+ },
1029
+ toJSON(message, use = "json") {
1030
+ const obj = {};
1031
+ const pick = (json, pb) => (use === "json" ? json : pb);
1032
+ if (message.total !== undefined) {
1033
+ obj[pick("total", "total")] = message.total
1034
+ ? CostBreakdown.toJSON(message.total, use)
1035
+ : undefined;
1036
+ }
1037
+ return obj;
1038
+ },
1039
+ create(base) {
1040
+ return GeneralResourceCost.fromPartial(base ?? {});
1041
+ },
1042
+ fromPartial(object) {
1043
+ const message = createBaseGeneralResourceCost();
1044
+ message.total = (object.total !== undefined && object.total !== null)
1045
+ ? CostBreakdown.fromPartial(object.total)
1046
+ : undefined;
1047
+ return message;
1048
+ },
1049
+ };
1050
+ protoRegistry.registerMessage(GeneralResourceCost);
1051
+ function GeneralResourceCostCustomInspect() {
1052
+ const parts = [];
1053
+ if (this.total !== undefined)
1054
+ parts.push("total" + "=" + inspect(this.total));
1055
+ return `${this.$type}(${parts.join(", ")})`;
1056
+ }
1057
+ function GeneralResourceCostCustomJson() {
1058
+ const obj = {
1059
+ type: this.$type,
1060
+ };
1061
+ if (this.total !== undefined)
1062
+ obj.total = inspectJson(this.total);
1063
+ return obj;
1064
+ }
1065
+ function applyGeneralResourceCostCustom(message) {
1066
+ message[custom] = GeneralResourceCostCustomInspect;
1067
+ message[customJson] = GeneralResourceCostCustomJson;
1068
+ return message;
1069
+ }
1070
+ function createBaseGeneralResourceCost() {
1071
+ const message = {
1072
+ $type: "nebius.billing.v1.GeneralResourceCost",
1073
+ total: undefined,
1074
+ };
1075
+ return applyGeneralResourceCostCustom(message);
1076
+ }
1077
+ export const FixedInstanceResourceCost = {
1078
+ $type: "nebius.billing.v1.FixedInstanceResourceCost",
1079
+ encode(message, writer = new BinaryWriter()) {
1080
+ if (message.total !== undefined) {
1081
+ const w = writer.uint32(10).fork();
1082
+ CostBreakdown.encode(message.total, w);
1083
+ w.join();
1084
+ }
1085
+ if (message.perInstance !== undefined) {
1086
+ const w = writer.uint32(18).fork();
1087
+ CostBreakdown.encode(message.perInstance, w);
1088
+ w.join();
1089
+ }
1090
+ if ((message.instanceCount ?? 0) !== 0) {
1091
+ writer.uint32(24).int32(message.instanceCount);
1092
+ }
1093
+ if (message[unknownFieldsSymbol]) {
1094
+ writer.raw(message[unknownFieldsSymbol]);
1095
+ }
1096
+ return writer;
1097
+ },
1098
+ decode(input, length) {
1099
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1100
+ const end = length === undefined ? reader.len : reader.pos + length;
1101
+ const message = createBaseFixedInstanceResourceCost();
1102
+ let writer = undefined;
1103
+ while (reader.pos < end) {
1104
+ const tag = reader.uint32();
1105
+ switch (tag >>> 3) {
1106
+ case 1: {
1107
+ if (tag !== 10)
1108
+ break;
1109
+ message.total = CostBreakdown.decode(reader, reader.uint32());
1110
+ continue;
1111
+ }
1112
+ case 2: {
1113
+ if (tag !== 18)
1114
+ break;
1115
+ message.perInstance = CostBreakdown.decode(reader, reader.uint32());
1116
+ continue;
1117
+ }
1118
+ case 3: {
1119
+ if (tag !== 24)
1120
+ break;
1121
+ message.instanceCount = reader.int32();
1122
+ continue;
1123
+ }
1124
+ default:
1125
+ break;
1126
+ }
1127
+ if ((tag & 7) === 4 || tag === 0) {
1128
+ break;
1129
+ }
1130
+ {
1131
+ if (!writer)
1132
+ writer = new BinaryWriter();
1133
+ const skipped = reader.skip(tag & 7, tag >>> 3);
1134
+ writer.uint32(tag).raw(skipped);
1135
+ }
1136
+ }
1137
+ if (writer) {
1138
+ message[unknownFieldsSymbol] = writer.finish();
1139
+ }
1140
+ return message;
1141
+ },
1142
+ fromJSON(object) {
1143
+ return applyFixedInstanceResourceCostCustom({
1144
+ $type: "nebius.billing.v1.FixedInstanceResourceCost",
1145
+ total: isSet(object.total ?? object.total)
1146
+ ? CostBreakdown.fromJSON(object.total ?? object.total)
1147
+ : undefined,
1148
+ perInstance: isSet(object.perInstance ?? object.per_instance)
1149
+ ? CostBreakdown.fromJSON(object.perInstance ?? object.per_instance)
1150
+ : undefined,
1151
+ instanceCount: isSet(object.instanceCount ?? object.instance_count)
1152
+ ? Number(object.instanceCount ?? object.instance_count)
1153
+ : 0,
1154
+ });
1155
+ },
1156
+ toJSON(message, use = "json") {
1157
+ const obj = {};
1158
+ const pick = (json, pb) => (use === "json" ? json : pb);
1159
+ if (message.total !== undefined) {
1160
+ obj[pick("total", "total")] = message.total
1161
+ ? CostBreakdown.toJSON(message.total, use)
1162
+ : undefined;
1163
+ }
1164
+ if (message.perInstance !== undefined) {
1165
+ obj[pick("perInstance", "per_instance")] = message.perInstance
1166
+ ? CostBreakdown.toJSON(message.perInstance, use)
1167
+ : undefined;
1168
+ }
1169
+ if ((message.instanceCount ?? 0) !== 0) {
1170
+ obj[pick("instanceCount", "instance_count")] = message.instanceCount;
1171
+ }
1172
+ return obj;
1173
+ },
1174
+ create(base) {
1175
+ return FixedInstanceResourceCost.fromPartial(base ?? {});
1176
+ },
1177
+ fromPartial(object) {
1178
+ const message = createBaseFixedInstanceResourceCost();
1179
+ message.total = (object.total !== undefined && object.total !== null)
1180
+ ? CostBreakdown.fromPartial(object.total)
1181
+ : undefined;
1182
+ message.perInstance = (object.perInstance !== undefined && object.perInstance !== null)
1183
+ ? CostBreakdown.fromPartial(object.perInstance)
1184
+ : undefined;
1185
+ message.instanceCount = (object.instanceCount !== undefined && object.instanceCount !== null)
1186
+ ? object.instanceCount
1187
+ : 0;
1188
+ return message;
1189
+ },
1190
+ };
1191
+ protoRegistry.registerMessage(FixedInstanceResourceCost);
1192
+ function FixedInstanceResourceCostCustomInspect() {
1193
+ const parts = [];
1194
+ if (this.total !== undefined)
1195
+ parts.push("total" + "=" + inspect(this.total));
1196
+ if (this.perInstance !== undefined)
1197
+ parts.push("perInstance" + "=" + inspect(this.perInstance));
1198
+ if ((this.instanceCount ?? 0) !== 0)
1199
+ parts.push("instanceCount" + "=" + inspect(this.instanceCount));
1200
+ return `${this.$type}(${parts.join(", ")})`;
1201
+ }
1202
+ function FixedInstanceResourceCostCustomJson() {
1203
+ const obj = {
1204
+ type: this.$type,
1205
+ };
1206
+ if (this.total !== undefined)
1207
+ obj.total = inspectJson(this.total);
1208
+ if (this.perInstance !== undefined)
1209
+ obj.perInstance = inspectJson(this.perInstance);
1210
+ if ((this.instanceCount ?? 0) !== 0)
1211
+ obj.instanceCount = inspectJson(this.instanceCount);
1212
+ return obj;
1213
+ }
1214
+ function applyFixedInstanceResourceCostCustom(message) {
1215
+ message[custom] = FixedInstanceResourceCostCustomInspect;
1216
+ message[customJson] = FixedInstanceResourceCostCustomJson;
1217
+ return message;
1218
+ }
1219
+ function createBaseFixedInstanceResourceCost() {
1220
+ const message = {
1221
+ $type: "nebius.billing.v1.FixedInstanceResourceCost",
1222
+ total: undefined,
1223
+ perInstance: undefined,
1224
+ instanceCount: 0,
1225
+ };
1226
+ return applyFixedInstanceResourceCostCustom(message);
1227
+ }
1228
+ export const AutoscaleResourceCost = {
1229
+ $type: "nebius.billing.v1.AutoscaleResourceCost",
1230
+ encode(message, writer = new BinaryWriter()) {
1231
+ if (message.minCost !== undefined) {
1232
+ const w = writer.uint32(10).fork();
1233
+ CostBreakdown.encode(message.minCost, w);
1234
+ w.join();
1235
+ }
1236
+ if (message.maxCost !== undefined) {
1237
+ const w = writer.uint32(18).fork();
1238
+ CostBreakdown.encode(message.maxCost, w);
1239
+ w.join();
1240
+ }
1241
+ if (message.perInstance !== undefined) {
1242
+ const w = writer.uint32(26).fork();
1243
+ CostBreakdown.encode(message.perInstance, w);
1244
+ w.join();
1245
+ }
1246
+ if ((message.minInstances ?? 0) !== 0) {
1247
+ writer.uint32(32).int32(message.minInstances);
1248
+ }
1249
+ if ((message.maxInstances ?? 0) !== 0) {
1250
+ writer.uint32(40).int32(message.maxInstances);
1251
+ }
1252
+ if (message[unknownFieldsSymbol]) {
1253
+ writer.raw(message[unknownFieldsSymbol]);
1254
+ }
1255
+ return writer;
1256
+ },
1257
+ decode(input, length) {
1258
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1259
+ const end = length === undefined ? reader.len : reader.pos + length;
1260
+ const message = createBaseAutoscaleResourceCost();
1261
+ let writer = undefined;
1262
+ while (reader.pos < end) {
1263
+ const tag = reader.uint32();
1264
+ switch (tag >>> 3) {
1265
+ case 1: {
1266
+ if (tag !== 10)
1267
+ break;
1268
+ message.minCost = CostBreakdown.decode(reader, reader.uint32());
1269
+ continue;
1270
+ }
1271
+ case 2: {
1272
+ if (tag !== 18)
1273
+ break;
1274
+ message.maxCost = CostBreakdown.decode(reader, reader.uint32());
1275
+ continue;
1276
+ }
1277
+ case 3: {
1278
+ if (tag !== 26)
1279
+ break;
1280
+ message.perInstance = CostBreakdown.decode(reader, reader.uint32());
1281
+ continue;
1282
+ }
1283
+ case 4: {
1284
+ if (tag !== 32)
1285
+ break;
1286
+ message.minInstances = reader.int32();
1287
+ continue;
1288
+ }
1289
+ case 5: {
1290
+ if (tag !== 40)
1291
+ break;
1292
+ message.maxInstances = reader.int32();
1293
+ continue;
1294
+ }
1295
+ default:
1296
+ break;
1297
+ }
1298
+ if ((tag & 7) === 4 || tag === 0) {
1299
+ break;
1300
+ }
1301
+ {
1302
+ if (!writer)
1303
+ writer = new BinaryWriter();
1304
+ const skipped = reader.skip(tag & 7, tag >>> 3);
1305
+ writer.uint32(tag).raw(skipped);
1306
+ }
1307
+ }
1308
+ if (writer) {
1309
+ message[unknownFieldsSymbol] = writer.finish();
1310
+ }
1311
+ return message;
1312
+ },
1313
+ fromJSON(object) {
1314
+ return applyAutoscaleResourceCostCustom({
1315
+ $type: "nebius.billing.v1.AutoscaleResourceCost",
1316
+ minCost: isSet(object.minCost ?? object.min_cost)
1317
+ ? CostBreakdown.fromJSON(object.minCost ?? object.min_cost)
1318
+ : undefined,
1319
+ maxCost: isSet(object.maxCost ?? object.max_cost)
1320
+ ? CostBreakdown.fromJSON(object.maxCost ?? object.max_cost)
1321
+ : undefined,
1322
+ perInstance: isSet(object.perInstance ?? object.per_instance)
1323
+ ? CostBreakdown.fromJSON(object.perInstance ?? object.per_instance)
1324
+ : undefined,
1325
+ minInstances: isSet(object.minInstances ?? object.min_instances)
1326
+ ? Number(object.minInstances ?? object.min_instances)
1327
+ : 0,
1328
+ maxInstances: isSet(object.maxInstances ?? object.max_instances)
1329
+ ? Number(object.maxInstances ?? object.max_instances)
1330
+ : 0,
1331
+ });
1332
+ },
1333
+ toJSON(message, use = "json") {
1334
+ const obj = {};
1335
+ const pick = (json, pb) => (use === "json" ? json : pb);
1336
+ if (message.minCost !== undefined) {
1337
+ obj[pick("minCost", "min_cost")] = message.minCost
1338
+ ? CostBreakdown.toJSON(message.minCost, use)
1339
+ : undefined;
1340
+ }
1341
+ if (message.maxCost !== undefined) {
1342
+ obj[pick("maxCost", "max_cost")] = message.maxCost
1343
+ ? CostBreakdown.toJSON(message.maxCost, use)
1344
+ : undefined;
1345
+ }
1346
+ if (message.perInstance !== undefined) {
1347
+ obj[pick("perInstance", "per_instance")] = message.perInstance
1348
+ ? CostBreakdown.toJSON(message.perInstance, use)
1349
+ : undefined;
1350
+ }
1351
+ if ((message.minInstances ?? 0) !== 0) {
1352
+ obj[pick("minInstances", "min_instances")] = message.minInstances;
1353
+ }
1354
+ if ((message.maxInstances ?? 0) !== 0) {
1355
+ obj[pick("maxInstances", "max_instances")] = message.maxInstances;
1356
+ }
1357
+ return obj;
1358
+ },
1359
+ create(base) {
1360
+ return AutoscaleResourceCost.fromPartial(base ?? {});
1361
+ },
1362
+ fromPartial(object) {
1363
+ const message = createBaseAutoscaleResourceCost();
1364
+ message.minCost = (object.minCost !== undefined && object.minCost !== null)
1365
+ ? CostBreakdown.fromPartial(object.minCost)
1366
+ : undefined;
1367
+ message.maxCost = (object.maxCost !== undefined && object.maxCost !== null)
1368
+ ? CostBreakdown.fromPartial(object.maxCost)
1369
+ : undefined;
1370
+ message.perInstance = (object.perInstance !== undefined && object.perInstance !== null)
1371
+ ? CostBreakdown.fromPartial(object.perInstance)
1372
+ : undefined;
1373
+ message.minInstances = (object.minInstances !== undefined && object.minInstances !== null)
1374
+ ? object.minInstances
1375
+ : 0;
1376
+ message.maxInstances = (object.maxInstances !== undefined && object.maxInstances !== null)
1377
+ ? object.maxInstances
1378
+ : 0;
1379
+ return message;
1380
+ },
1381
+ };
1382
+ protoRegistry.registerMessage(AutoscaleResourceCost);
1383
+ function AutoscaleResourceCostCustomInspect() {
1384
+ const parts = [];
1385
+ if (this.minCost !== undefined)
1386
+ parts.push("minCost" + "=" + inspect(this.minCost));
1387
+ if (this.maxCost !== undefined)
1388
+ parts.push("maxCost" + "=" + inspect(this.maxCost));
1389
+ if (this.perInstance !== undefined)
1390
+ parts.push("perInstance" + "=" + inspect(this.perInstance));
1391
+ if ((this.minInstances ?? 0) !== 0)
1392
+ parts.push("minInstances" + "=" + inspect(this.minInstances));
1393
+ if ((this.maxInstances ?? 0) !== 0)
1394
+ parts.push("maxInstances" + "=" + inspect(this.maxInstances));
1395
+ return `${this.$type}(${parts.join(", ")})`;
1396
+ }
1397
+ function AutoscaleResourceCostCustomJson() {
1398
+ const obj = {
1399
+ type: this.$type,
1400
+ };
1401
+ if (this.minCost !== undefined)
1402
+ obj.minCost = inspectJson(this.minCost);
1403
+ if (this.maxCost !== undefined)
1404
+ obj.maxCost = inspectJson(this.maxCost);
1405
+ if (this.perInstance !== undefined)
1406
+ obj.perInstance = inspectJson(this.perInstance);
1407
+ if ((this.minInstances ?? 0) !== 0)
1408
+ obj.minInstances = inspectJson(this.minInstances);
1409
+ if ((this.maxInstances ?? 0) !== 0)
1410
+ obj.maxInstances = inspectJson(this.maxInstances);
1411
+ return obj;
1412
+ }
1413
+ function applyAutoscaleResourceCostCustom(message) {
1414
+ message[custom] = AutoscaleResourceCostCustomInspect;
1415
+ message[customJson] = AutoscaleResourceCostCustomJson;
1416
+ return message;
1417
+ }
1418
+ function createBaseAutoscaleResourceCost() {
1419
+ const message = {
1420
+ $type: "nebius.billing.v1.AutoscaleResourceCost",
1421
+ minCost: undefined,
1422
+ maxCost: undefined,
1423
+ perInstance: undefined,
1424
+ minInstances: 0,
1425
+ maxInstances: 0,
1426
+ };
1427
+ return applyAutoscaleResourceCostCustom(message);
1428
+ }
1429
+ export const CostBreakdown = {
1430
+ $type: "nebius.billing.v1.CostBreakdown",
1431
+ encode(message, writer = new BinaryWriter()) {
1432
+ for (const v of (message.skuCosts ?? [])) {
1433
+ const w = writer.uint32(10).fork();
1434
+ SkuCost.encode(v, w);
1435
+ w.join();
1436
+ }
1437
+ if (message.cost !== "") {
1438
+ writer.uint32(18).string(message.cost);
1439
+ }
1440
+ if (message.costRounded !== "") {
1441
+ writer.uint32(26).string(message.costRounded);
1442
+ }
1443
+ if (message[unknownFieldsSymbol]) {
1444
+ writer.raw(message[unknownFieldsSymbol]);
1445
+ }
1446
+ return writer;
1447
+ },
1448
+ decode(input, length) {
1449
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1450
+ const end = length === undefined ? reader.len : reader.pos + length;
1451
+ const message = createBaseCostBreakdown();
1452
+ let writer = undefined;
1453
+ while (reader.pos < end) {
1454
+ const tag = reader.uint32();
1455
+ switch (tag >>> 3) {
1456
+ case 1: {
1457
+ if (tag !== 10)
1458
+ break;
1459
+ message.skuCosts.push(SkuCost.decode(reader, reader.uint32()));
1460
+ continue;
1461
+ }
1462
+ case 2: {
1463
+ if (tag !== 18)
1464
+ break;
1465
+ message.cost = reader.string();
1466
+ continue;
1467
+ }
1468
+ case 3: {
1469
+ if (tag !== 26)
1470
+ break;
1471
+ message.costRounded = reader.string();
1472
+ continue;
1473
+ }
1474
+ default:
1475
+ break;
1476
+ }
1477
+ if ((tag & 7) === 4 || tag === 0) {
1478
+ break;
1479
+ }
1480
+ {
1481
+ if (!writer)
1482
+ writer = new BinaryWriter();
1483
+ const skipped = reader.skip(tag & 7, tag >>> 3);
1484
+ writer.uint32(tag).raw(skipped);
1485
+ }
1486
+ }
1487
+ if (writer) {
1488
+ message[unknownFieldsSymbol] = writer.finish();
1489
+ }
1490
+ return message;
1491
+ },
1492
+ fromJSON(object) {
1493
+ return applyCostBreakdownCustom({
1494
+ $type: "nebius.billing.v1.CostBreakdown",
1495
+ skuCosts: globalThis.Array.isArray(object?.skuCosts ?? object?.sku_costs)
1496
+ ? (object.skuCosts ?? object.sku_costs).map((e) => SkuCost.fromJSON(e))
1497
+ : [],
1498
+ cost: isSet(object.cost ?? object.cost)
1499
+ ? String(object.cost ?? object.cost)
1500
+ : "",
1501
+ costRounded: isSet(object.costRounded ?? object.cost_rounded)
1502
+ ? String(object.costRounded ?? object.cost_rounded)
1503
+ : "",
1504
+ });
1505
+ },
1506
+ toJSON(message, use = "json") {
1507
+ const obj = {};
1508
+ const pick = (json, pb) => (use === "json" ? json : pb);
1509
+ if (message.skuCosts?.length) {
1510
+ obj[pick("skuCosts", "sku_costs")] = message.skuCosts.map((e) => e ? SkuCost.toJSON(e, use) : undefined);
1511
+ }
1512
+ if (message.cost !== "") {
1513
+ obj[pick("cost", "cost")] = message.cost;
1514
+ }
1515
+ if (message.costRounded !== "") {
1516
+ obj[pick("costRounded", "cost_rounded")] = message.costRounded;
1517
+ }
1518
+ return obj;
1519
+ },
1520
+ create(base) {
1521
+ return CostBreakdown.fromPartial(base ?? {});
1522
+ },
1523
+ fromPartial(object) {
1524
+ const message = createBaseCostBreakdown();
1525
+ message.skuCosts = object.skuCosts?.map((e) => SkuCost.fromPartial(e)) || [];
1526
+ message.cost = (object.cost !== undefined && object.cost !== null)
1527
+ ? object.cost
1528
+ : "";
1529
+ message.costRounded = (object.costRounded !== undefined && object.costRounded !== null)
1530
+ ? object.costRounded
1531
+ : "";
1532
+ return message;
1533
+ },
1534
+ };
1535
+ protoRegistry.registerMessage(CostBreakdown);
1536
+ function CostBreakdownCustomInspect() {
1537
+ const parts = [];
1538
+ if ((this.skuCosts?.length ?? 0) !== 0)
1539
+ parts.push("skuCosts" + "=" + inspect(this.skuCosts));
1540
+ if (this.cost !== "")
1541
+ parts.push("cost" + "=" + inspect(this.cost));
1542
+ if (this.costRounded !== "")
1543
+ parts.push("costRounded" + "=" + inspect(this.costRounded));
1544
+ return `${this.$type}(${parts.join(", ")})`;
1545
+ }
1546
+ function CostBreakdownCustomJson() {
1547
+ const obj = {
1548
+ type: this.$type,
1549
+ };
1550
+ if ((this.skuCosts?.length ?? 0) !== 0)
1551
+ obj.skuCosts = inspectJson(this.skuCosts);
1552
+ if (this.cost !== "")
1553
+ obj.cost = inspectJson(this.cost);
1554
+ if (this.costRounded !== "")
1555
+ obj.costRounded = inspectJson(this.costRounded);
1556
+ return obj;
1557
+ }
1558
+ function applyCostBreakdownCustom(message) {
1559
+ message[custom] = CostBreakdownCustomInspect;
1560
+ message[customJson] = CostBreakdownCustomJson;
1561
+ return message;
1562
+ }
1563
+ function createBaseCostBreakdown() {
1564
+ const message = {
1565
+ $type: "nebius.billing.v1.CostBreakdown",
1566
+ skuCosts: [],
1567
+ cost: "",
1568
+ costRounded: "",
1569
+ };
1570
+ return applyCostBreakdownCustom(message);
1571
+ }
1572
+ export const SkuCost = {
1573
+ $type: "nebius.billing.v1.SkuCost",
1574
+ encode(message, writer = new BinaryWriter()) {
1575
+ if (message.skuId !== "") {
1576
+ writer.uint32(10).string(message.skuId);
1577
+ }
1578
+ if (message.quantity !== "") {
1579
+ writer.uint32(162).string(message.quantity);
1580
+ }
1581
+ if (message.quantityRounded !== "") {
1582
+ writer.uint32(170).string(message.quantityRounded);
1583
+ }
1584
+ if (message.cost !== "") {
1585
+ writer.uint32(242).string(message.cost);
1586
+ }
1587
+ if (message.costRounded !== "") {
1588
+ writer.uint32(250).string(message.costRounded);
1589
+ }
1590
+ if (message[unknownFieldsSymbol]) {
1591
+ writer.raw(message[unknownFieldsSymbol]);
1592
+ }
1593
+ return writer;
1594
+ },
1595
+ decode(input, length) {
1596
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1597
+ const end = length === undefined ? reader.len : reader.pos + length;
1598
+ const message = createBaseSkuCost();
1599
+ let writer = undefined;
1600
+ while (reader.pos < end) {
1601
+ const tag = reader.uint32();
1602
+ switch (tag >>> 3) {
1603
+ case 1: {
1604
+ if (tag !== 10)
1605
+ break;
1606
+ message.skuId = reader.string();
1607
+ continue;
1608
+ }
1609
+ case 20: {
1610
+ if (tag !== 162)
1611
+ break;
1612
+ message.quantity = reader.string();
1613
+ continue;
1614
+ }
1615
+ case 21: {
1616
+ if (tag !== 170)
1617
+ break;
1618
+ message.quantityRounded = reader.string();
1619
+ continue;
1620
+ }
1621
+ case 30: {
1622
+ if (tag !== 242)
1623
+ break;
1624
+ message.cost = reader.string();
1625
+ continue;
1626
+ }
1627
+ case 31: {
1628
+ if (tag !== 250)
1629
+ break;
1630
+ message.costRounded = reader.string();
1631
+ continue;
1632
+ }
1633
+ default:
1634
+ break;
1635
+ }
1636
+ if ((tag & 7) === 4 || tag === 0) {
1637
+ break;
1638
+ }
1639
+ {
1640
+ if (!writer)
1641
+ writer = new BinaryWriter();
1642
+ const skipped = reader.skip(tag & 7, tag >>> 3);
1643
+ writer.uint32(tag).raw(skipped);
1644
+ }
1645
+ }
1646
+ if (writer) {
1647
+ message[unknownFieldsSymbol] = writer.finish();
1648
+ }
1649
+ return message;
1650
+ },
1651
+ fromJSON(object) {
1652
+ return applySkuCostCustom({
1653
+ $type: "nebius.billing.v1.SkuCost",
1654
+ skuId: isSet(object.skuId ?? object.sku_id)
1655
+ ? String(object.skuId ?? object.sku_id)
1656
+ : "",
1657
+ quantity: isSet(object.quantity ?? object.quantity)
1658
+ ? String(object.quantity ?? object.quantity)
1659
+ : "",
1660
+ quantityRounded: isSet(object.quantityRounded ?? object.quantity_rounded)
1661
+ ? String(object.quantityRounded ?? object.quantity_rounded)
1662
+ : "",
1663
+ cost: isSet(object.cost ?? object.cost)
1664
+ ? String(object.cost ?? object.cost)
1665
+ : "",
1666
+ costRounded: isSet(object.costRounded ?? object.cost_rounded)
1667
+ ? String(object.costRounded ?? object.cost_rounded)
1668
+ : "",
1669
+ });
1670
+ },
1671
+ toJSON(message, use = "json") {
1672
+ const obj = {};
1673
+ const pick = (json, pb) => (use === "json" ? json : pb);
1674
+ if (message.skuId !== "") {
1675
+ obj[pick("skuId", "sku_id")] = message.skuId;
1676
+ }
1677
+ if (message.quantity !== "") {
1678
+ obj[pick("quantity", "quantity")] = message.quantity;
1679
+ }
1680
+ if (message.quantityRounded !== "") {
1681
+ obj[pick("quantityRounded", "quantity_rounded")] = message.quantityRounded;
1682
+ }
1683
+ if (message.cost !== "") {
1684
+ obj[pick("cost", "cost")] = message.cost;
1685
+ }
1686
+ if (message.costRounded !== "") {
1687
+ obj[pick("costRounded", "cost_rounded")] = message.costRounded;
1688
+ }
1689
+ return obj;
1690
+ },
1691
+ create(base) {
1692
+ return SkuCost.fromPartial(base ?? {});
1693
+ },
1694
+ fromPartial(object) {
1695
+ const message = createBaseSkuCost();
1696
+ message.skuId = (object.skuId !== undefined && object.skuId !== null)
1697
+ ? object.skuId
1698
+ : "";
1699
+ message.quantity = (object.quantity !== undefined && object.quantity !== null)
1700
+ ? object.quantity
1701
+ : "";
1702
+ message.quantityRounded = (object.quantityRounded !== undefined && object.quantityRounded !== null)
1703
+ ? object.quantityRounded
1704
+ : "";
1705
+ message.cost = (object.cost !== undefined && object.cost !== null)
1706
+ ? object.cost
1707
+ : "";
1708
+ message.costRounded = (object.costRounded !== undefined && object.costRounded !== null)
1709
+ ? object.costRounded
1710
+ : "";
1711
+ return message;
1712
+ },
1713
+ };
1714
+ protoRegistry.registerMessage(SkuCost);
1715
+ function SkuCostCustomInspect() {
1716
+ const parts = [];
1717
+ if (this.skuId !== "")
1718
+ parts.push("skuId" + "=" + inspect(this.skuId));
1719
+ if (this.quantity !== "")
1720
+ parts.push("quantity" + "=" + inspect(this.quantity));
1721
+ if (this.quantityRounded !== "")
1722
+ parts.push("quantityRounded" + "=" + inspect(this.quantityRounded));
1723
+ if (this.cost !== "")
1724
+ parts.push("cost" + "=" + inspect(this.cost));
1725
+ if (this.costRounded !== "")
1726
+ parts.push("costRounded" + "=" + inspect(this.costRounded));
1727
+ return `${this.$type}(${parts.join(", ")})`;
1728
+ }
1729
+ function SkuCostCustomJson() {
1730
+ const obj = {
1731
+ type: this.$type,
1732
+ };
1733
+ if (this.skuId !== "")
1734
+ obj.skuId = inspectJson(this.skuId);
1735
+ if (this.quantity !== "")
1736
+ obj.quantity = inspectJson(this.quantity);
1737
+ if (this.quantityRounded !== "")
1738
+ obj.quantityRounded = inspectJson(this.quantityRounded);
1739
+ if (this.cost !== "")
1740
+ obj.cost = inspectJson(this.cost);
1741
+ if (this.costRounded !== "")
1742
+ obj.costRounded = inspectJson(this.costRounded);
1743
+ return obj;
1744
+ }
1745
+ function applySkuCostCustom(message) {
1746
+ message[custom] = SkuCostCustomInspect;
1747
+ message[customJson] = SkuCostCustomJson;
1748
+ return message;
1749
+ }
1750
+ function createBaseSkuCost() {
1751
+ const message = {
1752
+ $type: "nebius.billing.v1.SkuCost",
1753
+ skuId: "",
1754
+ quantity: "",
1755
+ quantityRounded: "",
1756
+ cost: "",
1757
+ costRounded: "",
1758
+ };
1759
+ return applySkuCostCustom(message);
1760
+ }
1761
+ export const TotalCost = {
1762
+ $type: "nebius.billing.v1.TotalCost",
1763
+ encode(message, writer = new BinaryWriter()) {
1764
+ if (message.aggregationUnit !== undefined) {
1765
+ const w = writer.uint32(10).fork();
1766
+ AggregationUnit.encode(message.aggregationUnit, w);
1767
+ w.join();
1768
+ }
1769
+ if (message.costType?.$case === undefined) { /* noop */ }
1770
+ else if (message.costType?.$case === "general") {
1771
+ const w = writer.uint32(162).fork();
1772
+ GeneralResourceCost.encode(message.costType.general, w);
1773
+ w.join();
1774
+ }
1775
+ else if (message.costType?.$case === "range") {
1776
+ const w = writer.uint32(170).fork();
1777
+ RangeTotalCost.encode(message.costType.range, w);
1778
+ w.join();
1779
+ }
1780
+ if (message[unknownFieldsSymbol]) {
1781
+ writer.raw(message[unknownFieldsSymbol]);
1782
+ }
1783
+ return writer;
1784
+ },
1785
+ decode(input, length) {
1786
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1787
+ const end = length === undefined ? reader.len : reader.pos + length;
1788
+ const message = createBaseTotalCost();
1789
+ let writer = undefined;
1790
+ while (reader.pos < end) {
1791
+ const tag = reader.uint32();
1792
+ switch (tag >>> 3) {
1793
+ case 1: {
1794
+ if (tag !== 10)
1795
+ break;
1796
+ message.aggregationUnit = AggregationUnit.decode(reader, reader.uint32());
1797
+ continue;
1798
+ }
1799
+ case 20: {
1800
+ if (tag !== 162)
1801
+ break;
1802
+ message.costType = {
1803
+ $case: "general",
1804
+ general: GeneralResourceCost.decode(reader, reader.uint32())
1805
+ };
1806
+ continue;
1807
+ }
1808
+ case 21: {
1809
+ if (tag !== 170)
1810
+ break;
1811
+ message.costType = {
1812
+ $case: "range",
1813
+ range: RangeTotalCost.decode(reader, reader.uint32())
1814
+ };
1815
+ continue;
1816
+ }
1817
+ default:
1818
+ break;
1819
+ }
1820
+ if ((tag & 7) === 4 || tag === 0) {
1821
+ break;
1822
+ }
1823
+ {
1824
+ if (!writer)
1825
+ writer = new BinaryWriter();
1826
+ const skipped = reader.skip(tag & 7, tag >>> 3);
1827
+ writer.uint32(tag).raw(skipped);
1828
+ }
1829
+ }
1830
+ if (writer) {
1831
+ message[unknownFieldsSymbol] = writer.finish();
1832
+ }
1833
+ return message;
1834
+ },
1835
+ fromJSON(object) {
1836
+ return applyTotalCostCustom({
1837
+ $type: "nebius.billing.v1.TotalCost",
1838
+ aggregationUnit: isSet(object.aggregationUnit ?? object.aggregation_unit)
1839
+ ? AggregationUnit.fromJSON(object.aggregationUnit ?? object.aggregation_unit)
1840
+ : undefined,
1841
+ costType: (() => {
1842
+ if (isSet(object.general) || isSet(object.general)) {
1843
+ return {
1844
+ $case: "general",
1845
+ general: GeneralResourceCost.fromJSON(object.general ?? object.general)
1846
+ };
1847
+ }
1848
+ if (isSet(object.range) || isSet(object.range)) {
1849
+ return {
1850
+ $case: "range",
1851
+ range: RangeTotalCost.fromJSON(object.range ?? object.range)
1852
+ };
1853
+ }
1854
+ return undefined;
1855
+ })(),
1856
+ });
1857
+ },
1858
+ toJSON(message, use = "json") {
1859
+ const obj = {};
1860
+ const pick = (json, pb) => (use === "json" ? json : pb);
1861
+ if (message.aggregationUnit !== undefined) {
1862
+ obj[pick("aggregationUnit", "aggregation_unit")] = message.aggregationUnit
1863
+ ? AggregationUnit.toJSON(message.aggregationUnit, use)
1864
+ : undefined;
1865
+ }
1866
+ switch (message.costType?.$case) {
1867
+ case "general": {
1868
+ obj[pick("general", "general")] = GeneralResourceCost.toJSON(message.costType.general, use);
1869
+ break;
1870
+ }
1871
+ case "range": {
1872
+ obj[pick("range", "range")] = RangeTotalCost.toJSON(message.costType.range, use);
1873
+ break;
1874
+ }
1875
+ default: break;
1876
+ }
1877
+ return obj;
1878
+ },
1879
+ create(base) {
1880
+ return TotalCost.fromPartial(base ?? {});
1881
+ },
1882
+ fromPartial(object) {
1883
+ const message = createBaseTotalCost();
1884
+ message.aggregationUnit = (object.aggregationUnit !== undefined && object.aggregationUnit !== null)
1885
+ ? AggregationUnit.fromPartial(object.aggregationUnit)
1886
+ : undefined;
1887
+ switch (object.costType?.$case) {
1888
+ case "general": {
1889
+ if (object.costType.general !== undefined && object.costType.general !== null) {
1890
+ message.costType = {
1891
+ $case: "general",
1892
+ general: GeneralResourceCost.fromPartial(object.costType.general),
1893
+ };
1894
+ }
1895
+ break;
1896
+ }
1897
+ case "range": {
1898
+ if (object.costType.range !== undefined && object.costType.range !== null) {
1899
+ message.costType = {
1900
+ $case: "range",
1901
+ range: RangeTotalCost.fromPartial(object.costType.range),
1902
+ };
1903
+ }
1904
+ break;
1905
+ }
1906
+ default: break;
1907
+ }
1908
+ return message;
1909
+ },
1910
+ };
1911
+ protoRegistry.registerMessage(TotalCost);
1912
+ function TotalCostCustomInspect() {
1913
+ const parts = [];
1914
+ if (this.aggregationUnit !== undefined)
1915
+ parts.push("aggregationUnit" + "=" + inspect(this.aggregationUnit));
1916
+ return `${this.$type}(${parts.join(", ")})`;
1917
+ }
1918
+ function TotalCostCustomJson() {
1919
+ const obj = {
1920
+ type: this.$type,
1921
+ };
1922
+ if (this.aggregationUnit !== undefined)
1923
+ obj.aggregationUnit = inspectJson(this.aggregationUnit);
1924
+ return obj;
1925
+ }
1926
+ function applyTotalCostCustom(message) {
1927
+ message[custom] = TotalCostCustomInspect;
1928
+ message[customJson] = TotalCostCustomJson;
1929
+ return message;
1930
+ }
1931
+ function createBaseTotalCost() {
1932
+ const message = {
1933
+ $type: "nebius.billing.v1.TotalCost",
1934
+ aggregationUnit: undefined,
1935
+ costType: undefined,
1936
+ };
1937
+ return applyTotalCostCustom(message);
1938
+ }
1939
+ export const FilterAggregationUnit = {
1940
+ $type: "nebius.billing.v1.FilterAggregationUnit",
1941
+ encode(message, writer = new BinaryWriter()) {
1942
+ if (message.filterAggregationUnitValues?.length) {
1943
+ const w = writer.uint32(10).fork();
1944
+ for (const v of message.filterAggregationUnitValues)
1945
+ w.int32(v?.code | 0);
1946
+ w.join();
1947
+ }
1948
+ if (message[unknownFieldsSymbol]) {
1949
+ writer.raw(message[unknownFieldsSymbol]);
1950
+ }
1951
+ return writer;
1952
+ },
1953
+ decode(input, length) {
1954
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1955
+ const end = length === undefined ? reader.len : reader.pos + length;
1956
+ const message = createBaseFilterAggregationUnit();
1957
+ let writer = undefined;
1958
+ while (reader.pos < end) {
1959
+ const tag = reader.uint32();
1960
+ switch (tag >>> 3) {
1961
+ case 1: {
1962
+ // packed or unpacked repeated enum
1963
+ if ((tag & 7) === 2) {
1964
+ const end2 = reader.uint32() + reader.pos;
1965
+ while (reader.pos < end2) {
1966
+ message.filterAggregationUnitValues.push(FilterAggregationUnit_FilterAggregationUnitValue.fromNumber(reader.int32()));
1967
+ }
1968
+ continue;
1969
+ }
1970
+ else if ((tag & 7) === 0) {
1971
+ message.filterAggregationUnitValues.push(FilterAggregationUnit_FilterAggregationUnitValue.fromNumber(reader.int32()));
1972
+ continue;
1973
+ }
1974
+ break; // wrong wire type
1975
+ }
1976
+ default:
1977
+ break;
1978
+ }
1979
+ if ((tag & 7) === 4 || tag === 0) {
1980
+ break;
1981
+ }
1982
+ {
1983
+ if (!writer)
1984
+ writer = new BinaryWriter();
1985
+ const skipped = reader.skip(tag & 7, tag >>> 3);
1986
+ writer.uint32(tag).raw(skipped);
1987
+ }
1988
+ }
1989
+ if (writer) {
1990
+ message[unknownFieldsSymbol] = writer.finish();
1991
+ }
1992
+ return message;
1993
+ },
1994
+ fromJSON(object) {
1995
+ return applyFilterAggregationUnitCustom({
1996
+ $type: "nebius.billing.v1.FilterAggregationUnit",
1997
+ filterAggregationUnitValues: globalThis.Array.isArray(object?.filterAggregationUnitValues ?? object?.filter_aggregation_unit_values)
1998
+ ? (object.filterAggregationUnitValues ?? object.filter_aggregation_unit_values).map((e) => FilterAggregationUnit_FilterAggregationUnitValue.fromJSON(e))
1999
+ : [],
2000
+ });
2001
+ },
2002
+ toJSON(message, use = "json") {
2003
+ const obj = {};
2004
+ const pick = (json, pb) => (use === "json" ? json : pb);
2005
+ if (message.filterAggregationUnitValues?.length) {
2006
+ obj[pick("filterAggregationUnitValues", "filter_aggregation_unit_values")] = message.filterAggregationUnitValues.map((e) => FilterAggregationUnit_FilterAggregationUnitValue.toJSON(e));
2007
+ }
2008
+ return obj;
2009
+ },
2010
+ create(base) {
2011
+ return FilterAggregationUnit.fromPartial(base ?? {});
2012
+ },
2013
+ fromPartial(object) {
2014
+ const message = createBaseFilterAggregationUnit();
2015
+ message.filterAggregationUnitValues = object.filterAggregationUnitValues?.map((e) => FilterAggregationUnit_FilterAggregationUnitValue.fromJSON(e.name)) || [];
2016
+ return message;
2017
+ },
2018
+ };
2019
+ protoRegistry.registerMessage(FilterAggregationUnit);
2020
+ function FilterAggregationUnitCustomInspect() {
2021
+ const parts = [];
2022
+ if ((this.filterAggregationUnitValues?.length ?? 0) !== 0)
2023
+ parts.push("filterAggregationUnitValues" + "=" + inspect(this.filterAggregationUnitValues));
2024
+ return `${this.$type}(${parts.join(", ")})`;
2025
+ }
2026
+ function FilterAggregationUnitCustomJson() {
2027
+ const obj = {
2028
+ type: this.$type,
2029
+ };
2030
+ if ((this.filterAggregationUnitValues?.length ?? 0) !== 0)
2031
+ obj.filterAggregationUnitValues = inspectJson(this.filterAggregationUnitValues);
2032
+ return obj;
2033
+ }
2034
+ function applyFilterAggregationUnitCustom(message) {
2035
+ message[custom] = FilterAggregationUnitCustomInspect;
2036
+ message[customJson] = FilterAggregationUnitCustomJson;
2037
+ return message;
2038
+ }
2039
+ function createBaseFilterAggregationUnit() {
2040
+ const message = {
2041
+ $type: "nebius.billing.v1.FilterAggregationUnit",
2042
+ filterAggregationUnitValues: [],
2043
+ };
2044
+ return applyFilterAggregationUnitCustom(message);
2045
+ }
2046
+ export const AggregationUnit = {
2047
+ $type: "nebius.billing.v1.AggregationUnit",
2048
+ encode(message, writer = new BinaryWriter()) {
2049
+ if (message.unit !== "") {
2050
+ writer.uint32(10).string(message.unit);
2051
+ }
2052
+ if ((message.unitType ?? AggregationUnit_UnitType.UNIT_TYPE_UNSPECIFIED) !== AggregationUnit_UnitType.UNIT_TYPE_UNSPECIFIED) {
2053
+ AggregationUnit_UnitType.encodeField(writer, 2, message.unitType);
2054
+ }
2055
+ if (message[unknownFieldsSymbol]) {
2056
+ writer.raw(message[unknownFieldsSymbol]);
2057
+ }
2058
+ return writer;
2059
+ },
2060
+ decode(input, length) {
2061
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2062
+ const end = length === undefined ? reader.len : reader.pos + length;
2063
+ const message = createBaseAggregationUnit();
2064
+ let writer = undefined;
2065
+ while (reader.pos < end) {
2066
+ const tag = reader.uint32();
2067
+ switch (tag >>> 3) {
2068
+ case 1: {
2069
+ if (tag !== 10)
2070
+ break;
2071
+ message.unit = reader.string();
2072
+ continue;
2073
+ }
2074
+ case 2: {
2075
+ if (tag !== 16)
2076
+ break;
2077
+ message.unitType = AggregationUnit_UnitType.fromNumber(reader.int32());
2078
+ continue;
2079
+ }
2080
+ default:
2081
+ break;
2082
+ }
2083
+ if ((tag & 7) === 4 || tag === 0) {
2084
+ break;
2085
+ }
2086
+ {
2087
+ if (!writer)
2088
+ writer = new BinaryWriter();
2089
+ const skipped = reader.skip(tag & 7, tag >>> 3);
2090
+ writer.uint32(tag).raw(skipped);
2091
+ }
2092
+ }
2093
+ if (writer) {
2094
+ message[unknownFieldsSymbol] = writer.finish();
2095
+ }
2096
+ return message;
2097
+ },
2098
+ fromJSON(object) {
2099
+ return applyAggregationUnitCustom({
2100
+ $type: "nebius.billing.v1.AggregationUnit",
2101
+ unit: isSet(object.unit ?? object.unit)
2102
+ ? String(object.unit ?? object.unit)
2103
+ : "",
2104
+ unitType: isSet(object.unitType ?? object.unit_type)
2105
+ ? AggregationUnit_UnitType.fromJSON(object.unitType ?? object.unit_type)
2106
+ : AggregationUnit_UnitType.UNIT_TYPE_UNSPECIFIED,
2107
+ });
2108
+ },
2109
+ toJSON(message, use = "json") {
2110
+ const obj = {};
2111
+ const pick = (json, pb) => (use === "json" ? json : pb);
2112
+ if (message.unit !== "") {
2113
+ obj[pick("unit", "unit")] = message.unit;
2114
+ }
2115
+ if ((message.unitType ?? AggregationUnit_UnitType.UNIT_TYPE_UNSPECIFIED) !== AggregationUnit_UnitType.UNIT_TYPE_UNSPECIFIED) {
2116
+ obj[pick("unitType", "unit_type")] = AggregationUnit_UnitType.toJSON(message.unitType);
2117
+ }
2118
+ return obj;
2119
+ },
2120
+ create(base) {
2121
+ return AggregationUnit.fromPartial(base ?? {});
2122
+ },
2123
+ fromPartial(object) {
2124
+ const message = createBaseAggregationUnit();
2125
+ message.unit = (object.unit !== undefined && object.unit !== null)
2126
+ ? object.unit
2127
+ : "";
2128
+ message.unitType = (object.unitType !== undefined && object.unitType !== null)
2129
+ ? AggregationUnit_UnitType.fromJSON(object.unitType.name)
2130
+ : AggregationUnit_UnitType.UNIT_TYPE_UNSPECIFIED;
2131
+ return message;
2132
+ },
2133
+ };
2134
+ protoRegistry.registerMessage(AggregationUnit);
2135
+ function AggregationUnitCustomInspect() {
2136
+ const parts = [];
2137
+ if (this.unit !== "")
2138
+ parts.push("unit" + "=" + inspect(this.unit));
2139
+ if (this.unitType !== undefined)
2140
+ parts.push("unitType" + "=" + inspect(this.unitType));
2141
+ return `${this.$type}(${parts.join(", ")})`;
2142
+ }
2143
+ function AggregationUnitCustomJson() {
2144
+ const obj = {
2145
+ type: this.$type,
2146
+ };
2147
+ if (this.unit !== "")
2148
+ obj.unit = inspectJson(this.unit);
2149
+ if (this.unitType !== undefined)
2150
+ obj.unitType = inspectJson(this.unitType);
2151
+ return obj;
2152
+ }
2153
+ function applyAggregationUnitCustom(message) {
2154
+ message[custom] = AggregationUnitCustomInspect;
2155
+ message[customJson] = AggregationUnitCustomJson;
2156
+ return message;
2157
+ }
2158
+ function createBaseAggregationUnit() {
2159
+ const message = {
2160
+ $type: "nebius.billing.v1.AggregationUnit",
2161
+ unit: "",
2162
+ unitType: AggregationUnit_UnitType.UNIT_TYPE_UNSPECIFIED,
2163
+ };
2164
+ return applyAggregationUnitCustom(message);
2165
+ }
2166
+ const OfferType_VALUE_COMMENTS = {
2167
+ OFFER_TYPE_CONTRACT_PRICE: " Contract price is a special price for SKU.\n",
2168
+ };
2169
+ export const OfferType = createEnum("nebius.billing.v1.OfferType", {
2170
+ OFFER_TYPE_UNSPECIFIED: 0,
2171
+ /**
2172
+ * Contract price is a special price for SKU.
2173
+ *
2174
+ */
2175
+ OFFER_TYPE_CONTRACT_PRICE: 1,
2176
+ }, OfferType_VALUE_COMMENTS);
2177
+ protoRegistry.registerEnum(OfferType);
2178
+ //# sourceMappingURL=index.js.map