@gpuai/sdk 0.3.13 → 0.3.14

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 (96) hide show
  1. package/.openapi-generator/FILES +26 -0
  2. package/README.md +32 -9
  3. package/dist/apis/AutolaunchApi.d.ts +109 -0
  4. package/dist/apis/AutolaunchApi.js +286 -0
  5. package/dist/apis/MarketApi.d.ts +56 -0
  6. package/dist/apis/MarketApi.js +112 -0
  7. package/dist/apis/WatchApi.d.ts +109 -0
  8. package/dist/apis/WatchApi.js +286 -0
  9. package/dist/apis/index.d.ts +3 -0
  10. package/dist/apis/index.js +3 -0
  11. package/dist/esm/apis/AutolaunchApi.d.ts +109 -0
  12. package/dist/esm/apis/AutolaunchApi.js +282 -0
  13. package/dist/esm/apis/MarketApi.d.ts +56 -0
  14. package/dist/esm/apis/MarketApi.js +108 -0
  15. package/dist/esm/apis/WatchApi.d.ts +109 -0
  16. package/dist/esm/apis/WatchApi.js +282 -0
  17. package/dist/esm/apis/index.d.ts +3 -0
  18. package/dist/esm/apis/index.js +3 -0
  19. package/dist/esm/models/AutolaunchRule.d.ts +181 -0
  20. package/dist/esm/models/AutolaunchRule.js +142 -0
  21. package/dist/esm/models/AutolaunchRuleCreate.d.ts +105 -0
  22. package/dist/esm/models/AutolaunchRuleCreate.js +84 -0
  23. package/dist/esm/models/AutolaunchRuleDisarm.d.ts +34 -0
  24. package/dist/esm/models/AutolaunchRuleDisarm.js +43 -0
  25. package/dist/esm/models/AutolaunchRulePage.d.ts +39 -0
  26. package/dist/esm/models/AutolaunchRulePage.js +48 -0
  27. package/dist/esm/models/MarketHistoryPoint.d.ts +59 -0
  28. package/dist/esm/models/MarketHistoryPoint.js +55 -0
  29. package/dist/esm/models/MarketHistoryResponse.d.ts +60 -0
  30. package/dist/esm/models/MarketHistoryResponse.js +60 -0
  31. package/dist/esm/models/Problem.d.ts +1 -0
  32. package/dist/esm/models/Problem.js +1 -0
  33. package/dist/esm/models/WatchRule.d.ts +141 -0
  34. package/dist/esm/models/WatchRule.js +117 -0
  35. package/dist/esm/models/WatchRuleCreate.d.ts +87 -0
  36. package/dist/esm/models/WatchRuleCreate.js +72 -0
  37. package/dist/esm/models/WatchRulePage.d.ts +39 -0
  38. package/dist/esm/models/WatchRulePage.js +48 -0
  39. package/dist/esm/models/WatchRuleUpdate.d.ts +86 -0
  40. package/dist/esm/models/WatchRuleUpdate.js +68 -0
  41. package/dist/esm/models/index.d.ts +10 -0
  42. package/dist/esm/models/index.js +10 -0
  43. package/dist/models/AutolaunchRule.d.ts +181 -0
  44. package/dist/models/AutolaunchRule.js +150 -0
  45. package/dist/models/AutolaunchRuleCreate.d.ts +105 -0
  46. package/dist/models/AutolaunchRuleCreate.js +92 -0
  47. package/dist/models/AutolaunchRuleDisarm.d.ts +34 -0
  48. package/dist/models/AutolaunchRuleDisarm.js +50 -0
  49. package/dist/models/AutolaunchRulePage.d.ts +39 -0
  50. package/dist/models/AutolaunchRulePage.js +55 -0
  51. package/dist/models/MarketHistoryPoint.d.ts +59 -0
  52. package/dist/models/MarketHistoryPoint.js +62 -0
  53. package/dist/models/MarketHistoryResponse.d.ts +60 -0
  54. package/dist/models/MarketHistoryResponse.js +67 -0
  55. package/dist/models/Problem.d.ts +1 -0
  56. package/dist/models/Problem.js +1 -0
  57. package/dist/models/WatchRule.d.ts +141 -0
  58. package/dist/models/WatchRule.js +125 -0
  59. package/dist/models/WatchRuleCreate.d.ts +87 -0
  60. package/dist/models/WatchRuleCreate.js +80 -0
  61. package/dist/models/WatchRulePage.d.ts +39 -0
  62. package/dist/models/WatchRulePage.js +55 -0
  63. package/dist/models/WatchRuleUpdate.d.ts +86 -0
  64. package/dist/models/WatchRuleUpdate.js +76 -0
  65. package/dist/models/index.d.ts +10 -0
  66. package/dist/models/index.js +10 -0
  67. package/docs/AutolaunchApi.md +390 -0
  68. package/docs/AutolaunchRule.md +69 -0
  69. package/docs/AutolaunchRuleCreate.md +50 -0
  70. package/docs/AutolaunchRuleDisarm.md +35 -0
  71. package/docs/AutolaunchRulePage.md +36 -0
  72. package/docs/MarketApi.md +98 -0
  73. package/docs/MarketHistoryPoint.md +43 -0
  74. package/docs/MarketHistoryResponse.md +43 -0
  75. package/docs/WatchApi.md +389 -0
  76. package/docs/WatchRule.md +61 -0
  77. package/docs/WatchRuleCreate.md +46 -0
  78. package/docs/WatchRulePage.md +36 -0
  79. package/docs/WatchRuleUpdate.md +47 -0
  80. package/package.json +1 -1
  81. package/src/apis/AutolaunchApi.ts +360 -0
  82. package/src/apis/MarketApi.ts +136 -0
  83. package/src/apis/WatchApi.ts +360 -0
  84. package/src/apis/index.ts +3 -0
  85. package/src/models/AutolaunchRule.ts +270 -0
  86. package/src/models/AutolaunchRuleCreate.ts +162 -0
  87. package/src/models/AutolaunchRuleDisarm.ts +68 -0
  88. package/src/models/AutolaunchRulePage.ts +83 -0
  89. package/src/models/MarketHistoryPoint.ts +103 -0
  90. package/src/models/MarketHistoryResponse.ts +113 -0
  91. package/src/models/Problem.ts +1 -0
  92. package/src/models/WatchRule.ts +219 -0
  93. package/src/models/WatchRuleCreate.ts +138 -0
  94. package/src/models/WatchRulePage.ts +83 -0
  95. package/src/models/WatchRuleUpdate.ts +135 -0
  96. package/src/models/index.ts +10 -0
@@ -0,0 +1,360 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * GPU.ai Public Developer API
5
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@gpu.ai
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import * as runtime from '../runtime';
16
+ import {
17
+ type Problem,
18
+ ProblemFromJSON,
19
+ ProblemToJSON,
20
+ } from '../models/Problem';
21
+ import {
22
+ type WatchRule,
23
+ WatchRuleFromJSON,
24
+ WatchRuleToJSON,
25
+ } from '../models/WatchRule';
26
+ import {
27
+ type WatchRuleCreate,
28
+ WatchRuleCreateFromJSON,
29
+ WatchRuleCreateToJSON,
30
+ } from '../models/WatchRuleCreate';
31
+ import {
32
+ type WatchRulePage,
33
+ WatchRulePageFromJSON,
34
+ WatchRulePageToJSON,
35
+ } from '../models/WatchRulePage';
36
+ import {
37
+ type WatchRuleUpdate,
38
+ WatchRuleUpdateFromJSON,
39
+ WatchRuleUpdateToJSON,
40
+ } from '../models/WatchRuleUpdate';
41
+
42
+ export interface CreateWatchRuleRequest {
43
+ watchRuleCreate: WatchRuleCreate;
44
+ idempotencyKey?: string;
45
+ }
46
+
47
+ export interface DeleteWatchRuleRequest {
48
+ id: string;
49
+ }
50
+
51
+ export interface GetWatchRuleRequest {
52
+ id: string;
53
+ }
54
+
55
+ export interface ListWatchRulesRequest {
56
+ cursor?: string;
57
+ limit?: number;
58
+ }
59
+
60
+ export interface UpdateWatchRuleRequest {
61
+ id: string;
62
+ watchRuleUpdate: WatchRuleUpdate;
63
+ }
64
+
65
+ /**
66
+ *
67
+ */
68
+ export class WatchApi extends runtime.BaseAPI {
69
+
70
+ /**
71
+ * Creates request options for createWatchRule without sending the request
72
+ */
73
+ async createWatchRuleRequestOpts(requestParameters: CreateWatchRuleRequest): Promise<runtime.RequestOpts> {
74
+ if (requestParameters['watchRuleCreate'] == null) {
75
+ throw new runtime.RequiredError(
76
+ 'watchRuleCreate',
77
+ 'Required parameter "watchRuleCreate" was null or undefined when calling createWatchRule().'
78
+ );
79
+ }
80
+
81
+ const queryParameters: any = {};
82
+
83
+ const headerParameters: runtime.HTTPHeaders = {};
84
+
85
+ headerParameters['Content-Type'] = 'application/json';
86
+
87
+ if (requestParameters['idempotencyKey'] != null) {
88
+ headerParameters['Idempotency-Key'] = String(requestParameters['idempotencyKey']);
89
+ }
90
+
91
+ if (this.configuration && this.configuration.accessToken) {
92
+ const token = this.configuration.accessToken;
93
+ const tokenString = await token("bearerAuth", []);
94
+
95
+ if (tokenString) {
96
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
97
+ }
98
+ }
99
+
100
+ let urlPath = `/watch-rules`;
101
+
102
+ return {
103
+ path: urlPath,
104
+ method: 'POST',
105
+ headers: headerParameters,
106
+ query: queryParameters,
107
+ body: WatchRuleCreateToJSON(requestParameters['watchRuleCreate']),
108
+ };
109
+ }
110
+
111
+ /**
112
+ * Creates a rule that notifies you when the market moves on a GPU model. Requires the `watch:write` scope (or `full_access`). A watch rule ONLY notifies. It cannot launch capacity and cannot spend money: there is no field on this resource that provisions anything. Automatic launching is a separate resource with its own spend-consent gate. Targeting is dimensional — a GPU model plus optional canonical region and capacity class. It is deliberately NOT possible to pin a rule to a specific catalog listing: listing identity is unstable, so a pinned rule can silently match nothing and never fire. Delivery is to the organization\'s registered webhook endpoints, plus an email to the rule\'s creator. `webhook_endpoint_override_id` routes one rule to one specific endpoint and is the id of an endpoint already registered via `/webhook-endpoints` — the resource accepts no URL of any kind. Organizations are limited to 50 ENABLED rules; the 422 names the limit.
113
+ * Create a watch rule
114
+ */
115
+ async createWatchRuleRaw(requestParameters: CreateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRule>> {
116
+ const requestOptions = await this.createWatchRuleRequestOpts(requestParameters);
117
+ const response = await this.request(requestOptions, initOverrides);
118
+
119
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRuleFromJSON(jsonValue));
120
+ }
121
+
122
+ /**
123
+ * Creates a rule that notifies you when the market moves on a GPU model. Requires the `watch:write` scope (or `full_access`). A watch rule ONLY notifies. It cannot launch capacity and cannot spend money: there is no field on this resource that provisions anything. Automatic launching is a separate resource with its own spend-consent gate. Targeting is dimensional — a GPU model plus optional canonical region and capacity class. It is deliberately NOT possible to pin a rule to a specific catalog listing: listing identity is unstable, so a pinned rule can silently match nothing and never fire. Delivery is to the organization\'s registered webhook endpoints, plus an email to the rule\'s creator. `webhook_endpoint_override_id` routes one rule to one specific endpoint and is the id of an endpoint already registered via `/webhook-endpoints` — the resource accepts no URL of any kind. Organizations are limited to 50 ENABLED rules; the 422 names the limit.
124
+ * Create a watch rule
125
+ */
126
+ async createWatchRule(requestParameters: CreateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRule> {
127
+ const response = await this.createWatchRuleRaw(requestParameters, initOverrides);
128
+ return await response.value();
129
+ }
130
+
131
+ /**
132
+ * Creates request options for deleteWatchRule without sending the request
133
+ */
134
+ async deleteWatchRuleRequestOpts(requestParameters: DeleteWatchRuleRequest): Promise<runtime.RequestOpts> {
135
+ if (requestParameters['id'] == null) {
136
+ throw new runtime.RequiredError(
137
+ 'id',
138
+ 'Required parameter "id" was null or undefined when calling deleteWatchRule().'
139
+ );
140
+ }
141
+
142
+ const queryParameters: any = {};
143
+
144
+ const headerParameters: runtime.HTTPHeaders = {};
145
+
146
+ if (this.configuration && this.configuration.accessToken) {
147
+ const token = this.configuration.accessToken;
148
+ const tokenString = await token("bearerAuth", []);
149
+
150
+ if (tokenString) {
151
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
152
+ }
153
+ }
154
+
155
+ let urlPath = `/watch-rules/{id}`;
156
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
157
+
158
+ return {
159
+ path: urlPath,
160
+ method: 'DELETE',
161
+ headers: headerParameters,
162
+ query: queryParameters,
163
+ };
164
+ }
165
+
166
+ /**
167
+ * Deletes a watch rule. Requires the `watch:write` scope (or `full_access`). Deleting an already-deleted rule returns 404.
168
+ * Delete a watch rule
169
+ */
170
+ async deleteWatchRuleRaw(requestParameters: DeleteWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
171
+ const requestOptions = await this.deleteWatchRuleRequestOpts(requestParameters);
172
+ const response = await this.request(requestOptions, initOverrides);
173
+
174
+ return new runtime.VoidApiResponse(response);
175
+ }
176
+
177
+ /**
178
+ * Deletes a watch rule. Requires the `watch:write` scope (or `full_access`). Deleting an already-deleted rule returns 404.
179
+ * Delete a watch rule
180
+ */
181
+ async deleteWatchRule(requestParameters: DeleteWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
182
+ await this.deleteWatchRuleRaw(requestParameters, initOverrides);
183
+ }
184
+
185
+ /**
186
+ * Creates request options for getWatchRule without sending the request
187
+ */
188
+ async getWatchRuleRequestOpts(requestParameters: GetWatchRuleRequest): Promise<runtime.RequestOpts> {
189
+ if (requestParameters['id'] == null) {
190
+ throw new runtime.RequiredError(
191
+ 'id',
192
+ 'Required parameter "id" was null or undefined when calling getWatchRule().'
193
+ );
194
+ }
195
+
196
+ const queryParameters: any = {};
197
+
198
+ const headerParameters: runtime.HTTPHeaders = {};
199
+
200
+ if (this.configuration && this.configuration.accessToken) {
201
+ const token = this.configuration.accessToken;
202
+ const tokenString = await token("bearerAuth", []);
203
+
204
+ if (tokenString) {
205
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
206
+ }
207
+ }
208
+
209
+ let urlPath = `/watch-rules/{id}`;
210
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
211
+
212
+ return {
213
+ path: urlPath,
214
+ method: 'GET',
215
+ headers: headerParameters,
216
+ query: queryParameters,
217
+ };
218
+ }
219
+
220
+ /**
221
+ * Fetches one watch rule. Requires the `watch:read` scope (or `full_access`). A rule belonging to another organization returns 404 — the same answer as an id that does not exist.
222
+ * Get a watch rule
223
+ */
224
+ async getWatchRuleRaw(requestParameters: GetWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRule>> {
225
+ const requestOptions = await this.getWatchRuleRequestOpts(requestParameters);
226
+ const response = await this.request(requestOptions, initOverrides);
227
+
228
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRuleFromJSON(jsonValue));
229
+ }
230
+
231
+ /**
232
+ * Fetches one watch rule. Requires the `watch:read` scope (or `full_access`). A rule belonging to another organization returns 404 — the same answer as an id that does not exist.
233
+ * Get a watch rule
234
+ */
235
+ async getWatchRule(requestParameters: GetWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRule> {
236
+ const response = await this.getWatchRuleRaw(requestParameters, initOverrides);
237
+ return await response.value();
238
+ }
239
+
240
+ /**
241
+ * Creates request options for listWatchRules without sending the request
242
+ */
243
+ async listWatchRulesRequestOpts(requestParameters: ListWatchRulesRequest): Promise<runtime.RequestOpts> {
244
+ const queryParameters: any = {};
245
+
246
+ if (requestParameters['cursor'] != null) {
247
+ queryParameters['cursor'] = requestParameters['cursor'];
248
+ }
249
+
250
+ if (requestParameters['limit'] != null) {
251
+ queryParameters['limit'] = requestParameters['limit'];
252
+ }
253
+
254
+ const headerParameters: runtime.HTTPHeaders = {};
255
+
256
+ if (this.configuration && this.configuration.accessToken) {
257
+ const token = this.configuration.accessToken;
258
+ const tokenString = await token("bearerAuth", []);
259
+
260
+ if (tokenString) {
261
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
262
+ }
263
+ }
264
+
265
+ let urlPath = `/watch-rules`;
266
+
267
+ return {
268
+ path: urlPath,
269
+ method: 'GET',
270
+ headers: headerParameters,
271
+ query: queryParameters,
272
+ };
273
+ }
274
+
275
+ /**
276
+ * Lists this organization\'s watch rules. Requires the `watch:read` scope (or `full_access`). Rules belonging to other organizations are never returned.
277
+ * List watch rules
278
+ */
279
+ async listWatchRulesRaw(requestParameters: ListWatchRulesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRulePage>> {
280
+ const requestOptions = await this.listWatchRulesRequestOpts(requestParameters);
281
+ const response = await this.request(requestOptions, initOverrides);
282
+
283
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRulePageFromJSON(jsonValue));
284
+ }
285
+
286
+ /**
287
+ * Lists this organization\'s watch rules. Requires the `watch:read` scope (or `full_access`). Rules belonging to other organizations are never returned.
288
+ * List watch rules
289
+ */
290
+ async listWatchRules(requestParameters: ListWatchRulesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRulePage> {
291
+ const response = await this.listWatchRulesRaw(requestParameters, initOverrides);
292
+ return await response.value();
293
+ }
294
+
295
+ /**
296
+ * Creates request options for updateWatchRule without sending the request
297
+ */
298
+ async updateWatchRuleRequestOpts(requestParameters: UpdateWatchRuleRequest): Promise<runtime.RequestOpts> {
299
+ if (requestParameters['id'] == null) {
300
+ throw new runtime.RequiredError(
301
+ 'id',
302
+ 'Required parameter "id" was null or undefined when calling updateWatchRule().'
303
+ );
304
+ }
305
+
306
+ if (requestParameters['watchRuleUpdate'] == null) {
307
+ throw new runtime.RequiredError(
308
+ 'watchRuleUpdate',
309
+ 'Required parameter "watchRuleUpdate" was null or undefined when calling updateWatchRule().'
310
+ );
311
+ }
312
+
313
+ const queryParameters: any = {};
314
+
315
+ const headerParameters: runtime.HTTPHeaders = {};
316
+
317
+ headerParameters['Content-Type'] = 'application/json';
318
+
319
+ if (this.configuration && this.configuration.accessToken) {
320
+ const token = this.configuration.accessToken;
321
+ const tokenString = await token("bearerAuth", []);
322
+
323
+ if (tokenString) {
324
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
325
+ }
326
+ }
327
+
328
+ let urlPath = `/watch-rules/{id}`;
329
+ urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
330
+
331
+ return {
332
+ path: urlPath,
333
+ method: 'PATCH',
334
+ headers: headerParameters,
335
+ query: queryParameters,
336
+ body: WatchRuleUpdateToJSON(requestParameters['watchRuleUpdate']),
337
+ };
338
+ }
339
+
340
+ /**
341
+ * Partially updates a watch rule. Requires the `watch:write` scope (or `full_access`). An ABSENT key keeps the stored value; an explicit `null` on `region`, `capacity_class` or `webhook_endpoint_override_id` CLEARS it back to \"any\" / \"organization default\". The two are distinguished by which keys the body carries, so send only the keys you mean to change. Editing a rule RE-ARMS it: the fired latch describes the condition that was replaced, so carrying it across an edit would suppress the first alert on the new one.
342
+ * Update a watch rule
343
+ */
344
+ async updateWatchRuleRaw(requestParameters: UpdateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WatchRule>> {
345
+ const requestOptions = await this.updateWatchRuleRequestOpts(requestParameters);
346
+ const response = await this.request(requestOptions, initOverrides);
347
+
348
+ return new runtime.JSONApiResponse(response, (jsonValue) => WatchRuleFromJSON(jsonValue));
349
+ }
350
+
351
+ /**
352
+ * Partially updates a watch rule. Requires the `watch:write` scope (or `full_access`). An ABSENT key keeps the stored value; an explicit `null` on `region`, `capacity_class` or `webhook_endpoint_override_id` CLEARS it back to \"any\" / \"organization default\". The two are distinguished by which keys the body carries, so send only the keys you mean to change. Editing a rule RE-ARMS it: the fired latch describes the condition that was replaced, so carrying it across an edit would suppress the first alert on the new one.
353
+ * Update a watch rule
354
+ */
355
+ async updateWatchRule(requestParameters: UpdateWatchRuleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WatchRule> {
356
+ const response = await this.updateWatchRuleRaw(requestParameters, initOverrides);
357
+ return await response.value();
358
+ }
359
+
360
+ }
package/src/apis/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export * from './AutolaunchApi';
3
4
  export * from './BillingApi';
4
5
  export * from './CommunityApi';
5
6
  export * from './EnvironmentsApi';
@@ -7,6 +8,7 @@ export * from './FineTuningApi';
7
8
  export * from './GpuTypesApi';
8
9
  export * from './InferenceApi';
9
10
  export * from './InstancesApi';
11
+ export * from './MarketApi';
10
12
  export * from './MetaApi';
11
13
  export * from './OperationsApi';
12
14
  export * from './PricingApi';
@@ -14,4 +16,5 @@ export * from './RegistryCredentialsApi';
14
16
  export * from './SshKeysApi';
15
17
  export * from './TemplatesApi';
16
18
  export * from './UsageApi';
19
+ export * from './WatchApi';
17
20
  export * from './WebhooksApi';
@@ -0,0 +1,270 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * GPU.ai Public Developer API
5
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@gpu.ai
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ * A standing, pre-approved purchase order. It carries no upstream supplier identity, no org id, and no identifier of the API key that consented — the consenting principal is recorded in storage for the fire-time re-check, and a credential identifier has no business in a rule listing.
18
+ *
19
+ * @export
20
+ * @interface AutolaunchRule
21
+ */
22
+ export interface AutolaunchRule {
23
+ /**
24
+ *
25
+ * @type {string}
26
+ * @memberof AutolaunchRule
27
+ */
28
+ id: string;
29
+ /**
30
+ * The GPU model the rule watches and launches, e.g. "H100".
31
+ * @type {string}
32
+ * @memberof AutolaunchRule
33
+ */
34
+ gpuModel: string;
35
+ /**
36
+ * Canonical region the rule is narrowed to, or null for every region.
37
+ * @type {string}
38
+ * @memberof AutolaunchRule
39
+ */
40
+ region: string | null;
41
+ /**
42
+ * Capacity class the rule is narrowed to, or null for both.
43
+ * @type {AutolaunchRuleCapacityClassEnum}
44
+ * @memberof AutolaunchRule
45
+ */
46
+ capacityClass: AutolaunchRuleCapacityClassEnum | null;
47
+ /**
48
+ *
49
+ * @type {AutolaunchRuleConditionKindEnum}
50
+ * @memberof AutolaunchRule
51
+ */
52
+ conditionKind: AutolaunchRuleConditionKindEnum;
53
+ /**
54
+ * The TRIGGER. Dollars PER GPU-HOUR for price_under, or a unit count for count_at_least. Null for in_stock. This is NOT the spend cap — see max_price_per_hour, which is in a different unit.
55
+ *
56
+ * @type {number}
57
+ * @memberof AutolaunchRule
58
+ */
59
+ threshold: number | null;
60
+ /**
61
+ * The CEILING, and the consent. Dollars per hour for the WHOLE INSTANCE, not per GPU. The launch is abandoned — never repriced — if the live price exceeds it.
62
+ *
63
+ * @type {number}
64
+ * @memberof AutolaunchRule
65
+ */
66
+ maxPricePerHour: number;
67
+ /**
68
+ * How long an auto-launched instance may run before the platform terminates it, enforced through the instance's own auto_terminate_hours.
69
+ *
70
+ * @type {number}
71
+ * @memberof AutolaunchRule
72
+ */
73
+ maxRuntimeHours: number;
74
+ /**
75
+ * The worst-case total the customer approved: max_price_per_hour × max_runtime_hours, computed by the server and echoed on every read so a client never has to derive the number it is displaying.
76
+ *
77
+ * @type {number}
78
+ * @memberof AutolaunchRule
79
+ */
80
+ maxTotalUsd: number;
81
+ /**
82
+ * The frozen launch spec, as READ. Every value under `env` is returned as the literal `[REDACTED]` — the key names are kept so you can see what the launch will set, but the values are not readable back on any surface, by any scope. Reading a rule needs only `autolaunch:read`, which every full_access, standard and read_only key holds, so a rule listing must not be a credential listing.
83
+ * This changes nothing about what the rule DOES: the stored spec keeps the real values and replays them at fire time. If you need to change a token, delete the rule and create a new one.
84
+ *
85
+ * @type {{ [key: string]: any; }}
86
+ * @memberof AutolaunchRule
87
+ */
88
+ spec: { [key: string]: any; };
89
+ /**
90
+ * armed = waiting for the condition. launching = an attempt is in flight. fired = a successful launch consumed the rule's one shot. expired = the per-edge attempt budget ran out. A lost capacity race costs nothing and does NOT consume the shot.
91
+ *
92
+ * @type {AutolaunchRuleStateEnum}
93
+ * @memberof AutolaunchRule
94
+ */
95
+ state: AutolaunchRuleStateEnum;
96
+ /**
97
+ * Launch attempts made since the current condition edge began.
98
+ * @type {number}
99
+ * @memberof AutolaunchRule
100
+ */
101
+ attemptsThisEdge: number;
102
+ /**
103
+ * Why the last attempt did not buy anything: over_ceiling, capacity_race, stale_reference, key_revoked, authority_revoked or validation_failed, optionally with a colon-separated detail. Match the leading token. It never carries API key material.
104
+ *
105
+ * @type {string}
106
+ * @memberof AutolaunchRule
107
+ */
108
+ lastFailureReason: string | null;
109
+ /**
110
+ * The instance this rule launched, once it has fired.
111
+ * @type {string}
112
+ * @memberof AutolaunchRule
113
+ */
114
+ launchedInstanceId: string | null;
115
+ /**
116
+ * Which entrance consented. A dashboard rule has no API key behind it, which is why its fire-time revocation failure is `authority_revoked` (the approving admin was demoted) rather than `key_revoked`.
117
+ *
118
+ * @type {AutolaunchRuleCreatedBySurfaceEnum}
119
+ * @memberof AutolaunchRule
120
+ */
121
+ createdBySurface: AutolaunchRuleCreatedBySurfaceEnum;
122
+ /**
123
+ * False once disarmed or cancelled. A disarmed rule cannot be re-armed.
124
+ * @type {boolean}
125
+ * @memberof AutolaunchRule
126
+ */
127
+ enabled: boolean;
128
+ /**
129
+ *
130
+ * @type {Date}
131
+ * @memberof AutolaunchRule
132
+ */
133
+ createdAt: Date;
134
+ /**
135
+ *
136
+ * @type {Date}
137
+ * @memberof AutolaunchRule
138
+ */
139
+ updatedAt: Date;
140
+ }
141
+
142
+
143
+ /**
144
+ * @export
145
+ */
146
+ export const AutolaunchRuleCapacityClassEnum = {
147
+ Secure: 'secure',
148
+ Community: 'community'
149
+ } as const;
150
+ export type AutolaunchRuleCapacityClassEnum = typeof AutolaunchRuleCapacityClassEnum[keyof typeof AutolaunchRuleCapacityClassEnum];
151
+
152
+ /**
153
+ * @export
154
+ */
155
+ export const AutolaunchRuleConditionKindEnum = {
156
+ PriceUnder: 'price_under',
157
+ InStock: 'in_stock',
158
+ CountAtLeast: 'count_at_least'
159
+ } as const;
160
+ export type AutolaunchRuleConditionKindEnum = typeof AutolaunchRuleConditionKindEnum[keyof typeof AutolaunchRuleConditionKindEnum];
161
+
162
+ /**
163
+ * @export
164
+ */
165
+ export const AutolaunchRuleStateEnum = {
166
+ Armed: 'armed',
167
+ Launching: 'launching',
168
+ Fired: 'fired',
169
+ Expired: 'expired'
170
+ } as const;
171
+ export type AutolaunchRuleStateEnum = typeof AutolaunchRuleStateEnum[keyof typeof AutolaunchRuleStateEnum];
172
+
173
+ /**
174
+ * @export
175
+ */
176
+ export const AutolaunchRuleCreatedBySurfaceEnum = {
177
+ ApiKey: 'api_key',
178
+ Dashboard: 'dashboard'
179
+ } as const;
180
+ export type AutolaunchRuleCreatedBySurfaceEnum = typeof AutolaunchRuleCreatedBySurfaceEnum[keyof typeof AutolaunchRuleCreatedBySurfaceEnum];
181
+
182
+
183
+ /**
184
+ * Check if a given object implements the AutolaunchRule interface.
185
+ */
186
+ export function instanceOfAutolaunchRule(value: object): value is AutolaunchRule {
187
+ if (!('id' in value) || value['id'] === undefined) return false;
188
+ if ((!('gpuModel' in (value as Record<string, any>)) && !('gpu_model' in (value as Record<string, any>))) || ((value as Record<string, any>)['gpuModel'] === undefined && (value as Record<string, any>)['gpu_model'] === undefined)) return false;
189
+ if (!('region' in value) || value['region'] === undefined) return false;
190
+ if ((!('capacityClass' in (value as Record<string, any>)) && !('capacity_class' in (value as Record<string, any>))) || ((value as Record<string, any>)['capacityClass'] === undefined && (value as Record<string, any>)['capacity_class'] === undefined)) return false;
191
+ if ((!('conditionKind' in (value as Record<string, any>)) && !('condition_kind' in (value as Record<string, any>))) || ((value as Record<string, any>)['conditionKind'] === undefined && (value as Record<string, any>)['condition_kind'] === undefined)) return false;
192
+ if (!('threshold' in value) || value['threshold'] === undefined) return false;
193
+ if ((!('maxPricePerHour' in (value as Record<string, any>)) && !('max_price_per_hour' in (value as Record<string, any>))) || ((value as Record<string, any>)['maxPricePerHour'] === undefined && (value as Record<string, any>)['max_price_per_hour'] === undefined)) return false;
194
+ if ((!('maxRuntimeHours' in (value as Record<string, any>)) && !('max_runtime_hours' in (value as Record<string, any>))) || ((value as Record<string, any>)['maxRuntimeHours'] === undefined && (value as Record<string, any>)['max_runtime_hours'] === undefined)) return false;
195
+ if ((!('maxTotalUsd' in (value as Record<string, any>)) && !('max_total_usd' in (value as Record<string, any>))) || ((value as Record<string, any>)['maxTotalUsd'] === undefined && (value as Record<string, any>)['max_total_usd'] === undefined)) return false;
196
+ if (!('spec' in value) || value['spec'] === undefined) return false;
197
+ if (!('state' in value) || value['state'] === undefined) return false;
198
+ if ((!('attemptsThisEdge' in (value as Record<string, any>)) && !('attempts_this_edge' in (value as Record<string, any>))) || ((value as Record<string, any>)['attemptsThisEdge'] === undefined && (value as Record<string, any>)['attempts_this_edge'] === undefined)) return false;
199
+ if ((!('lastFailureReason' in (value as Record<string, any>)) && !('last_failure_reason' in (value as Record<string, any>))) || ((value as Record<string, any>)['lastFailureReason'] === undefined && (value as Record<string, any>)['last_failure_reason'] === undefined)) return false;
200
+ if ((!('launchedInstanceId' in (value as Record<string, any>)) && !('launched_instance_id' in (value as Record<string, any>))) || ((value as Record<string, any>)['launchedInstanceId'] === undefined && (value as Record<string, any>)['launched_instance_id'] === undefined)) return false;
201
+ if ((!('createdBySurface' in (value as Record<string, any>)) && !('created_by_surface' in (value as Record<string, any>))) || ((value as Record<string, any>)['createdBySurface'] === undefined && (value as Record<string, any>)['created_by_surface'] === undefined)) return false;
202
+ if (!('enabled' in value) || value['enabled'] === undefined) return false;
203
+ if ((!('createdAt' in (value as Record<string, any>)) && !('created_at' in (value as Record<string, any>))) || ((value as Record<string, any>)['createdAt'] === undefined && (value as Record<string, any>)['created_at'] === undefined)) return false;
204
+ if ((!('updatedAt' in (value as Record<string, any>)) && !('updated_at' in (value as Record<string, any>))) || ((value as Record<string, any>)['updatedAt'] === undefined && (value as Record<string, any>)['updated_at'] === undefined)) return false;
205
+ return true;
206
+ }
207
+
208
+ export function AutolaunchRuleFromJSON(json: any): AutolaunchRule {
209
+ return AutolaunchRuleFromJSONTyped(json, false);
210
+ }
211
+
212
+ export function AutolaunchRuleFromJSONTyped(json: any, ignoreDiscriminator: boolean): AutolaunchRule {
213
+ if (json == null) {
214
+ return json;
215
+ }
216
+ return {
217
+
218
+ 'id': json['id'],
219
+ 'gpuModel': json['gpu_model'],
220
+ 'region': json['region'],
221
+ 'capacityClass': json['capacity_class'],
222
+ 'conditionKind': json['condition_kind'],
223
+ 'threshold': json['threshold'],
224
+ 'maxPricePerHour': json['max_price_per_hour'],
225
+ 'maxRuntimeHours': json['max_runtime_hours'],
226
+ 'maxTotalUsd': json['max_total_usd'],
227
+ 'spec': json['spec'],
228
+ 'state': json['state'],
229
+ 'attemptsThisEdge': json['attempts_this_edge'],
230
+ 'lastFailureReason': json['last_failure_reason'],
231
+ 'launchedInstanceId': json['launched_instance_id'],
232
+ 'createdBySurface': json['created_by_surface'],
233
+ 'enabled': json['enabled'],
234
+ 'createdAt': (new Date(json['created_at'])),
235
+ 'updatedAt': (new Date(json['updated_at'])),
236
+ };
237
+ }
238
+
239
+ export function AutolaunchRuleToJSON(json: any): AutolaunchRule {
240
+ return AutolaunchRuleToJSONTyped(json, false);
241
+ }
242
+
243
+ export function AutolaunchRuleToJSONTyped(value?: AutolaunchRule | null, ignoreDiscriminator: boolean = false): any {
244
+ if (value == null) {
245
+ return value;
246
+ }
247
+
248
+ return {
249
+
250
+ 'id': value['id'],
251
+ 'gpu_model': value['gpuModel'],
252
+ 'region': value['region'],
253
+ 'capacity_class': value['capacityClass'],
254
+ 'condition_kind': value['conditionKind'],
255
+ 'threshold': value['threshold'],
256
+ 'max_price_per_hour': value['maxPricePerHour'],
257
+ 'max_runtime_hours': value['maxRuntimeHours'],
258
+ 'max_total_usd': value['maxTotalUsd'],
259
+ 'spec': value['spec'],
260
+ 'state': value['state'],
261
+ 'attempts_this_edge': value['attemptsThisEdge'],
262
+ 'last_failure_reason': value['lastFailureReason'],
263
+ 'launched_instance_id': value['launchedInstanceId'],
264
+ 'created_by_surface': value['createdBySurface'],
265
+ 'enabled': value['enabled'],
266
+ 'created_at': value['createdAt'].toISOString(),
267
+ 'updated_at': value['updatedAt'].toISOString(),
268
+ };
269
+ }
270
+