@leaflow/sdk 0.0.0-dev.415.gb9e4b83 → 0.0.0-dev.418.ge62522e
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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/routes.d.ts +80 -0
- package/dist/routes.js +90 -0
- package/dist/swas/v1/generated/functions.d.ts +418 -0
- package/dist/swas/v1/generated/functions.js +250 -0
- package/dist/swas/v1/generated/models.d.ts +384 -0
- package/dist/swas/v1/generated/models.js +87 -0
- package/dist/swas/v1/generated/schemas.zod.d.ts +117 -0
- package/dist/swas/v1/generated/schemas.zod.js +120 -0
- package/dist/swas/v1/generated/validators/catalog.zod.d.ts +32 -0
- package/dist/swas/v1/generated/validators/catalog.zod.js +16 -0
- package/dist/swas/v1/generated/validators/createPurchaseHeaders.zod.d.ts +14 -0
- package/dist/swas/v1/generated/validators/createPurchaseHeaders.zod.js +12 -0
- package/dist/swas/v1/generated/validators/cursorPagination.zod.d.ts +14 -0
- package/dist/swas/v1/generated/validators/cursorPagination.zod.js +14 -0
- package/dist/swas/v1/generated/validators/customerRefundProgress.zod.d.ts +16 -0
- package/dist/swas/v1/generated/validators/customerRefundProgress.zod.js +14 -0
- package/dist/swas/v1/generated/validators/decimalAmount.zod.d.ts +12 -0
- package/dist/swas/v1/generated/validators/decimalAmount.zod.js +11 -0
- package/dist/swas/v1/generated/validators/error.zod.d.ts +16 -0
- package/dist/swas/v1/generated/validators/error.zod.js +17 -0
- package/dist/swas/v1/generated/validators/expectedQuote.zod.d.ts +14 -0
- package/dist/swas/v1/generated/validators/expectedQuote.zod.js +13 -0
- package/dist/swas/v1/generated/validators/instance.zod.d.ts +58 -0
- package/dist/swas/v1/generated/validators/instance.zod.js +47 -0
- package/dist/swas/v1/generated/validators/instanceCapabilities.zod.d.ts +16 -0
- package/dist/swas/v1/generated/validators/instanceCapabilities.zod.js +14 -0
- package/dist/swas/v1/generated/validators/instanceList.zod.d.ts +62 -0
- package/dist/swas/v1/generated/validators/instanceList.zod.js +15 -0
- package/dist/swas/v1/generated/validators/instancePagination.zod.d.ts +15 -0
- package/dist/swas/v1/generated/validators/instancePagination.zod.js +10 -0
- package/dist/swas/v1/generated/validators/instancePrice.zod.d.ts +15 -0
- package/dist/swas/v1/generated/validators/instancePrice.zod.js +21 -0
- package/dist/swas/v1/generated/validators/listInstancesParams.zod.d.ts +20 -0
- package/dist/swas/v1/generated/validators/listInstancesParams.zod.js +22 -0
- package/dist/swas/v1/generated/validators/listPlansParams.zod.d.ts +14 -0
- package/dist/swas/v1/generated/validators/listPlansParams.zod.js +12 -0
- package/dist/swas/v1/generated/validators/managementOperation.zod.d.ts +36 -0
- package/dist/swas/v1/generated/validators/managementOperation.zod.js +21 -0
- package/dist/swas/v1/generated/validators/money.zod.d.ts +11 -0
- package/dist/swas/v1/generated/validators/money.zod.js +11 -0
- package/dist/swas/v1/generated/validators/offsetPagination.zod.d.ts +16 -0
- package/dist/swas/v1/generated/validators/offsetPagination.zod.js +16 -0
- package/dist/swas/v1/generated/validators/plan.zod.d.ts +29 -0
- package/dist/swas/v1/generated/validators/plan.zod.js +22 -0
- package/dist/swas/v1/generated/validators/price.zod.d.ts +19 -0
- package/dist/swas/v1/generated/validators/price.zod.js +28 -0
- package/dist/swas/v1/generated/validators/purchase.zod.d.ts +34 -0
- package/dist/swas/v1/generated/validators/purchase.zod.js +34 -0
- package/dist/swas/v1/generated/validators/purchaseCreate.zod.d.ts +27 -0
- package/dist/swas/v1/generated/validators/purchaseCreate.zod.js +23 -0
- package/dist/swas/v1/generated/validators/rebootCycle.zod.d.ts +14 -0
- package/dist/swas/v1/generated/validators/rebootCycle.zod.js +17 -0
- package/dist/swas/v1/generated/validators/rebootInstance.zod.d.ts +11 -0
- package/dist/swas/v1/generated/validators/rebootInstance.zod.js +9 -0
- package/dist/swas/v1/generated/validators/rebootInstanceHeaders.zod.d.ts +14 -0
- package/dist/swas/v1/generated/validators/rebootInstanceHeaders.zod.js +12 -0
- package/dist/swas/v1/generated/validators/refundProgress.zod.d.ts +33 -0
- package/dist/swas/v1/generated/validators/refundProgress.zod.js +27 -0
- package/dist/swas/v1/generated/validators/startInstance.zod.d.ts +11 -0
- package/dist/swas/v1/generated/validators/startInstance.zod.js +9 -0
- package/dist/swas/v1/generated/validators/startInstanceHeaders.zod.d.ts +14 -0
- package/dist/swas/v1/generated/validators/startInstanceHeaders.zod.js +12 -0
- package/dist/swas/v1/generated/validators/stopInstance.zod.d.ts +11 -0
- package/dist/swas/v1/generated/validators/stopInstance.zod.js +9 -0
- package/dist/swas/v1/generated/validators/stopInstanceHeaders.zod.d.ts +14 -0
- package/dist/swas/v1/generated/validators/stopInstanceHeaders.zod.js +12 -0
- package/dist/swas/v1/generated/validators/supplierRefundProgress.zod.d.ts +14 -0
- package/dist/swas/v1/generated/validators/supplierRefundProgress.zod.js +12 -0
- package/dist/swas/v1/index.d.ts +4 -0
- package/dist/swas/v1/index.js +4 -0
- package/dist/swas/v1/response-schemas.d.ts +18 -0
- package/dist/swas/v1/response-schemas.js +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
export const getListPlansUrl = (params) => {
|
|
2
|
+
const normalizedParams = new URLSearchParams();
|
|
3
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
4
|
+
if (value !== undefined) {
|
|
5
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
const stringifiedParams = normalizedParams.toString();
|
|
9
|
+
return stringifiedParams.length > 0
|
|
10
|
+
? `https://swas.leaflow.cloud/api/v1/catalog/plans?${stringifiedParams}`
|
|
11
|
+
: `https://swas.leaflow.cloud/api/v1/catalog/plans`;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Lists available plans and prices for the requested region. A plan without a price is not available to buy.
|
|
15
|
+
* @summary List plans
|
|
16
|
+
*/
|
|
17
|
+
export const listPlans = async (params, options, fetchFn) => {
|
|
18
|
+
const res = await (fetchFn ?? fetch)(getListPlansUrl(params), {
|
|
19
|
+
...options,
|
|
20
|
+
method: "GET",
|
|
21
|
+
});
|
|
22
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
23
|
+
const data = body ? JSON.parse(body) : {};
|
|
24
|
+
return { data, status: res.status, headers: res.headers };
|
|
25
|
+
};
|
|
26
|
+
export const getCreatePurchaseUrl = () => {
|
|
27
|
+
return `https://swas.leaflow.cloud/api/v1/purchases`;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Creates a purchase using the current catalog revision and expected price. Reuse the same Idempotency-Key after a timeout. Acceptance is not confirmation of payment or instance delivery.
|
|
31
|
+
* @summary Create purchase
|
|
32
|
+
*/
|
|
33
|
+
export const createPurchase = async (purchaseCreate, headers, options, fetchFn) => {
|
|
34
|
+
const getHeaders = (h) => {
|
|
35
|
+
if (!h)
|
|
36
|
+
return {};
|
|
37
|
+
if (h instanceof Headers)
|
|
38
|
+
return Object.fromEntries(h.entries());
|
|
39
|
+
if (Symbol.iterator in h) {
|
|
40
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
41
|
+
}
|
|
42
|
+
const headers = {};
|
|
43
|
+
for (const [name, value] of Object.entries(h)) {
|
|
44
|
+
if (value !== undefined)
|
|
45
|
+
headers[name] = value;
|
|
46
|
+
}
|
|
47
|
+
return headers;
|
|
48
|
+
};
|
|
49
|
+
const res = await (fetchFn ?? fetch)(getCreatePurchaseUrl(), {
|
|
50
|
+
...options,
|
|
51
|
+
method: "POST",
|
|
52
|
+
headers: { "Content-Type": "application/json", ...headers, ...getHeaders(options?.headers) },
|
|
53
|
+
body: JSON.stringify(purchaseCreate),
|
|
54
|
+
});
|
|
55
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
56
|
+
const data = body ? JSON.parse(body) : {};
|
|
57
|
+
return { data, status: res.status, headers: res.headers };
|
|
58
|
+
};
|
|
59
|
+
export const getGetPurchaseUrl = (purchaseId) => {
|
|
60
|
+
return `https://swas.leaflow.cloud/api/v1/purchases/${encodeURIComponent(String(purchaseId))}`;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Returns purchase, delivery and Billing progress. Payment and instance delivery may finish at different times.
|
|
64
|
+
* @summary Get purchase
|
|
65
|
+
*/
|
|
66
|
+
export const getPurchase = async (purchaseId, options, fetchFn) => {
|
|
67
|
+
const res = await (fetchFn ?? fetch)(getGetPurchaseUrl(purchaseId), {
|
|
68
|
+
...options,
|
|
69
|
+
method: "GET",
|
|
70
|
+
});
|
|
71
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
72
|
+
const data = body ? JSON.parse(body) : {};
|
|
73
|
+
return { data, status: res.status, headers: res.headers };
|
|
74
|
+
};
|
|
75
|
+
export const getListInstancesUrl = (params) => {
|
|
76
|
+
const normalizedParams = new URLSearchParams();
|
|
77
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
78
|
+
if (value !== undefined) {
|
|
79
|
+
normalizedParams.append(key, value === null ? "null" : String(value));
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const stringifiedParams = normalizedParams.toString();
|
|
83
|
+
return stringifiedParams.length > 0
|
|
84
|
+
? `https://swas.leaflow.cloud/api/v1/instances?${stringifiedParams}`
|
|
85
|
+
: `https://swas.leaflow.cloud/api/v1/instances`;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Lists the current project's instances in the requested region. Pagination uses page and page_size; total_count is returned when known.
|
|
89
|
+
* @summary List instances
|
|
90
|
+
*/
|
|
91
|
+
export const listInstances = async (params, options, fetchFn) => {
|
|
92
|
+
const res = await (fetchFn ?? fetch)(getListInstancesUrl(params), {
|
|
93
|
+
...options,
|
|
94
|
+
method: "GET",
|
|
95
|
+
});
|
|
96
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
97
|
+
const data = body ? JSON.parse(body) : {};
|
|
98
|
+
return { data, status: res.status, headers: res.headers };
|
|
99
|
+
};
|
|
100
|
+
export const getGetInstanceUrl = (instanceId) => {
|
|
101
|
+
return `https://swas.leaflow.cloud/api/v1/instances/${encodeURIComponent(String(instanceId))}`;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Returns an instance and its most recently observed status.
|
|
105
|
+
* @summary Get instance
|
|
106
|
+
*/
|
|
107
|
+
export const getInstance = async (instanceId, options, fetchFn) => {
|
|
108
|
+
const res = await (fetchFn ?? fetch)(getGetInstanceUrl(instanceId), {
|
|
109
|
+
...options,
|
|
110
|
+
method: "GET",
|
|
111
|
+
});
|
|
112
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
113
|
+
const data = body ? JSON.parse(body) : {};
|
|
114
|
+
return { data, status: res.status, headers: res.headers };
|
|
115
|
+
};
|
|
116
|
+
export const getStartInstanceUrl = (instanceId) => {
|
|
117
|
+
return `https://swas.leaflow.cloud/api/v1/instances/${encodeURIComponent(String(instanceId))}:start`;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Starts an existing instance. Returns an operation to poll; acceptance is not completion.
|
|
121
|
+
* @summary Start instance
|
|
122
|
+
*/
|
|
123
|
+
export const startInstance = async (instanceId, startInstanceBody, headers, options, fetchFn) => {
|
|
124
|
+
const getHeaders = (h) => {
|
|
125
|
+
if (!h)
|
|
126
|
+
return {};
|
|
127
|
+
if (h instanceof Headers)
|
|
128
|
+
return Object.fromEntries(h.entries());
|
|
129
|
+
if (Symbol.iterator in h) {
|
|
130
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
131
|
+
}
|
|
132
|
+
const headers = {};
|
|
133
|
+
for (const [name, value] of Object.entries(h)) {
|
|
134
|
+
if (value !== undefined)
|
|
135
|
+
headers[name] = value;
|
|
136
|
+
}
|
|
137
|
+
return headers;
|
|
138
|
+
};
|
|
139
|
+
const res = await (fetchFn ?? fetch)(getStartInstanceUrl(instanceId), {
|
|
140
|
+
...options,
|
|
141
|
+
method: "POST",
|
|
142
|
+
headers: { "Content-Type": "application/json", ...headers, ...getHeaders(options?.headers) },
|
|
143
|
+
body: JSON.stringify(startInstanceBody),
|
|
144
|
+
});
|
|
145
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
146
|
+
const data = body ? JSON.parse(body) : {};
|
|
147
|
+
return { data, status: res.status, headers: res.headers };
|
|
148
|
+
};
|
|
149
|
+
export const getGetInstanceOperationUrl = (instanceId, operationId) => {
|
|
150
|
+
return `https://swas.leaflow.cloud/api/v1/instances/${encodeURIComponent(String(instanceId))}/operations/${encodeURIComponent(String(operationId))}`;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Returns management progress for the specified instance. Unknown progress is not confirmation of success; do not repeat an operation solely because its outcome is unknown.
|
|
154
|
+
* @summary Get instance operation
|
|
155
|
+
*/
|
|
156
|
+
export const getInstanceOperation = async (instanceId, operationId, options, fetchFn) => {
|
|
157
|
+
const res = await (fetchFn ?? fetch)(getGetInstanceOperationUrl(instanceId, operationId), {
|
|
158
|
+
...options,
|
|
159
|
+
method: "GET",
|
|
160
|
+
});
|
|
161
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
162
|
+
const data = body ? JSON.parse(body) : {};
|
|
163
|
+
return { data, status: res.status, headers: res.headers };
|
|
164
|
+
};
|
|
165
|
+
export const getStopInstanceUrl = (instanceId) => {
|
|
166
|
+
return `https://swas.leaflow.cloud/api/v1/instances/${encodeURIComponent(String(instanceId))}:stop`;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Stops an existing instance. Returns an operation to poll; acceptance is not completion.
|
|
170
|
+
* @summary Stop instance
|
|
171
|
+
*/
|
|
172
|
+
export const stopInstance = async (instanceId, stopInstanceBody, headers, options, fetchFn) => {
|
|
173
|
+
const getHeaders = (h) => {
|
|
174
|
+
if (!h)
|
|
175
|
+
return {};
|
|
176
|
+
if (h instanceof Headers)
|
|
177
|
+
return Object.fromEntries(h.entries());
|
|
178
|
+
if (Symbol.iterator in h) {
|
|
179
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
180
|
+
}
|
|
181
|
+
const headers = {};
|
|
182
|
+
for (const [name, value] of Object.entries(h)) {
|
|
183
|
+
if (value !== undefined)
|
|
184
|
+
headers[name] = value;
|
|
185
|
+
}
|
|
186
|
+
return headers;
|
|
187
|
+
};
|
|
188
|
+
const res = await (fetchFn ?? fetch)(getStopInstanceUrl(instanceId), {
|
|
189
|
+
...options,
|
|
190
|
+
method: "POST",
|
|
191
|
+
headers: { "Content-Type": "application/json", ...headers, ...getHeaders(options?.headers) },
|
|
192
|
+
body: JSON.stringify(stopInstanceBody),
|
|
193
|
+
});
|
|
194
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
195
|
+
const data = body ? JSON.parse(body) : {};
|
|
196
|
+
return { data, status: res.status, headers: res.headers };
|
|
197
|
+
};
|
|
198
|
+
export const getGetCancellationRefundProgressUrl = (instanceId, cancellationId) => {
|
|
199
|
+
return `https://swas.leaflow.cloud/api/v1/instances/${encodeURIComponent(String(instanceId))}/cancellations/${encodeURIComponent(String(cancellationId))}/refund-progress`;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Returns cancellation and refund progress for the specified instance. Unknown refund amounts and currencies are null. A completed cancellation does not confirm that money has been returned.
|
|
203
|
+
* @summary Get cancellation refund progress
|
|
204
|
+
*/
|
|
205
|
+
export const getCancellationRefundProgress = async (instanceId, cancellationId, options, fetchFn) => {
|
|
206
|
+
const res = await (fetchFn ?? fetch)(getGetCancellationRefundProgressUrl(instanceId, cancellationId), {
|
|
207
|
+
...options,
|
|
208
|
+
method: "GET",
|
|
209
|
+
});
|
|
210
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
211
|
+
const data = body ? JSON.parse(body) : {};
|
|
212
|
+
return {
|
|
213
|
+
data,
|
|
214
|
+
status: res.status,
|
|
215
|
+
headers: res.headers,
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
export const getRebootInstanceUrl = (instanceId) => {
|
|
219
|
+
return `https://swas.leaflow.cloud/api/v1/instances/${encodeURIComponent(String(instanceId))}:reboot`;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Reboots an existing instance. Returns an operation to poll; an unchanged Running status does not confirm completion.
|
|
223
|
+
* @summary Reboot instance
|
|
224
|
+
*/
|
|
225
|
+
export const rebootInstance = async (instanceId, rebootInstanceBody, headers, options, fetchFn) => {
|
|
226
|
+
const getHeaders = (h) => {
|
|
227
|
+
if (!h)
|
|
228
|
+
return {};
|
|
229
|
+
if (h instanceof Headers)
|
|
230
|
+
return Object.fromEntries(h.entries());
|
|
231
|
+
if (Symbol.iterator in h) {
|
|
232
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
233
|
+
}
|
|
234
|
+
const headers = {};
|
|
235
|
+
for (const [name, value] of Object.entries(h)) {
|
|
236
|
+
if (value !== undefined)
|
|
237
|
+
headers[name] = value;
|
|
238
|
+
}
|
|
239
|
+
return headers;
|
|
240
|
+
};
|
|
241
|
+
const res = await (fetchFn ?? fetch)(getRebootInstanceUrl(instanceId), {
|
|
242
|
+
...options,
|
|
243
|
+
method: "POST",
|
|
244
|
+
headers: { "Content-Type": "application/json", ...headers, ...getHeaders(options?.headers) },
|
|
245
|
+
body: JSON.stringify(rebootInstanceBody),
|
|
246
|
+
});
|
|
247
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
248
|
+
const data = body ? JSON.parse(body) : {};
|
|
249
|
+
return { data, status: res.status, headers: res.headers };
|
|
250
|
+
};
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Leaflow SWAS API
|
|
5
|
+
* Manage SWAS purchases and instances in the current project. Use an IAM scoped token for every request. Amounts are decimal strings in the stated currency; timestamps are UTC RFC 3339. Accepted requests may still be in progress. Read purchase, operation and refund progress separately.
|
|
6
|
+
* OpenAPI spec version: 1.0.0
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A decimal string, in the currency stated alongside it.
|
|
10
|
+
*
|
|
11
|
+
* **The currency is not part of this type.** It is carried by a `currency` field next to the
|
|
12
|
+
* amount, or by the account the amount belongs to. Reading an amount without that field is
|
|
13
|
+
* reading a number with no unit.
|
|
14
|
+
*
|
|
15
|
+
* It is a string rather than a JSON number because a JSON number is a float in most parsers,
|
|
16
|
+
* and a float loses precision on the first arithmetic. Nothing on this platform puts an amount
|
|
17
|
+
* through a float.
|
|
18
|
+
*/
|
|
19
|
+
export type Money = string;
|
|
20
|
+
/**
|
|
21
|
+
* A non-negative decimal amount with at most 15 integer digits and 10 fractional digits.
|
|
22
|
+
*/
|
|
23
|
+
export type DecimalAmount = Money & string;
|
|
24
|
+
export interface ExpectedQuote {
|
|
25
|
+
currency: "USD";
|
|
26
|
+
amount: DecimalAmount;
|
|
27
|
+
}
|
|
28
|
+
export interface PurchaseCreate {
|
|
29
|
+
/**
|
|
30
|
+
* @minimum 1
|
|
31
|
+
* @maximum 9007199254740991
|
|
32
|
+
*/
|
|
33
|
+
catalog_revision: number;
|
|
34
|
+
/**
|
|
35
|
+
* @minLength 1
|
|
36
|
+
* @maxLength 256
|
|
37
|
+
*/
|
|
38
|
+
provider_plan_id: string;
|
|
39
|
+
/** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
|
|
40
|
+
billing_price_id: string;
|
|
41
|
+
/**
|
|
42
|
+
* @minLength 1
|
|
43
|
+
* @maxLength 256
|
|
44
|
+
*/
|
|
45
|
+
image_id: string;
|
|
46
|
+
quantity: 1;
|
|
47
|
+
expected_quote: ExpectedQuote;
|
|
48
|
+
/**
|
|
49
|
+
* @minLength 1
|
|
50
|
+
* @maxLength 128
|
|
51
|
+
*/
|
|
52
|
+
region_id: string;
|
|
53
|
+
}
|
|
54
|
+
export type PurchaseState = (typeof PurchaseState)[keyof typeof PurchaseState];
|
|
55
|
+
export declare const PurchaseState: {
|
|
56
|
+
readonly submitted: "submitted";
|
|
57
|
+
readonly checkout_create_reserved: "checkout_create_reserved";
|
|
58
|
+
readonly checkout_unknown: "checkout_unknown";
|
|
59
|
+
readonly checkout_open: "checkout_open";
|
|
60
|
+
readonly order_ready: "order_ready";
|
|
61
|
+
readonly accept_unknown: "accept_unknown";
|
|
62
|
+
readonly accepted: "accepted";
|
|
63
|
+
readonly create_unknown: "create_unknown";
|
|
64
|
+
readonly awaiting_delivery: "awaiting_delivery";
|
|
65
|
+
readonly delivered: "delivered";
|
|
66
|
+
readonly settle_unknown: "settle_unknown";
|
|
67
|
+
readonly completed: "completed";
|
|
68
|
+
readonly rejected: "rejected";
|
|
69
|
+
readonly provider_rejected: "provider_rejected";
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Durable purchase progress. delivered and billing_settled describe different facts. Acceptance is not cloud delivery or checkout completion.
|
|
73
|
+
*/
|
|
74
|
+
export interface Purchase {
|
|
75
|
+
/** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
|
|
76
|
+
id: string;
|
|
77
|
+
state: PurchaseState;
|
|
78
|
+
/** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
|
|
79
|
+
checkout_session_id: string;
|
|
80
|
+
delivered: boolean;
|
|
81
|
+
billing_settled: boolean;
|
|
82
|
+
}
|
|
83
|
+
export type PricePeriodMonths = (typeof PricePeriodMonths)[keyof typeof PricePeriodMonths] | null;
|
|
84
|
+
export declare const PricePeriodMonths: {
|
|
85
|
+
readonly NUMBER_1: 1;
|
|
86
|
+
readonly NUMBER_3: 3;
|
|
87
|
+
readonly NUMBER_6: 6;
|
|
88
|
+
readonly NUMBER_12: 12;
|
|
89
|
+
readonly NUMBER_24: 24;
|
|
90
|
+
readonly NUMBER_36: 36;
|
|
91
|
+
};
|
|
92
|
+
export interface Price {
|
|
93
|
+
/** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
|
|
94
|
+
billing_plan_id: string;
|
|
95
|
+
/** @pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ */
|
|
96
|
+
billing_price_id: string;
|
|
97
|
+
currency: "USD";
|
|
98
|
+
amount: DecimalAmount;
|
|
99
|
+
period_months: PricePeriodMonths;
|
|
100
|
+
}
|
|
101
|
+
export interface Plan {
|
|
102
|
+
provider_plan_id: string;
|
|
103
|
+
region_id: string;
|
|
104
|
+
name: string;
|
|
105
|
+
/** @minimum 1 */
|
|
106
|
+
catalog_revision: number;
|
|
107
|
+
buyable: boolean;
|
|
108
|
+
price: Price | null;
|
|
109
|
+
/**
|
|
110
|
+
* @minItems 1
|
|
111
|
+
* @maxItems 256
|
|
112
|
+
*/
|
|
113
|
+
image_ids: string[];
|
|
114
|
+
/** @minimum 1 */
|
|
115
|
+
cpu: number;
|
|
116
|
+
/** @minimum 1 */
|
|
117
|
+
memory_mb: number;
|
|
118
|
+
/** @minimum 1 */
|
|
119
|
+
disk_gb: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Bounded catalog snapshot for one requested region. Incomplete or unavailable price information is not a purchasable offer.
|
|
123
|
+
*/
|
|
124
|
+
export interface Catalog {
|
|
125
|
+
items: Plan[];
|
|
126
|
+
/** UTC RFC 3339 timestamp. */
|
|
127
|
+
source_observed_at: string;
|
|
128
|
+
complete: boolean;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* What a given `code` carries alongside the message. The keys depend on the code,
|
|
132
|
+
* and a client that does not recognise one ignores it.
|
|
133
|
+
*/
|
|
134
|
+
export type ErrorMeta = {
|
|
135
|
+
[key: string]: unknown;
|
|
136
|
+
};
|
|
137
|
+
export interface Error {
|
|
138
|
+
code?: string;
|
|
139
|
+
message: string;
|
|
140
|
+
/**
|
|
141
|
+
* What a given `code` carries alongside the message. The keys depend on the code,
|
|
142
|
+
* and a client that does not recognise one ignores it.
|
|
143
|
+
*/
|
|
144
|
+
meta?: ErrorMeta;
|
|
145
|
+
status: number;
|
|
146
|
+
}
|
|
147
|
+
export type InstancePricePeriodMonths = (typeof InstancePricePeriodMonths)[keyof typeof InstancePricePeriodMonths];
|
|
148
|
+
export declare const InstancePricePeriodMonths: {
|
|
149
|
+
readonly NUMBER_1: 1;
|
|
150
|
+
readonly NUMBER_3: 3;
|
|
151
|
+
readonly NUMBER_6: 6;
|
|
152
|
+
readonly NUMBER_12: 12;
|
|
153
|
+
readonly NUMBER_24: 24;
|
|
154
|
+
readonly NUMBER_36: 36;
|
|
155
|
+
};
|
|
156
|
+
export interface InstancePrice {
|
|
157
|
+
currency: "USD";
|
|
158
|
+
amount: DecimalAmount;
|
|
159
|
+
period_months: InstancePricePeriodMonths;
|
|
160
|
+
}
|
|
161
|
+
export declare const InstanceCapabilitiesValue: {
|
|
162
|
+
readonly manage: false;
|
|
163
|
+
readonly customer_refund: false;
|
|
164
|
+
readonly supplier_refund: false;
|
|
165
|
+
readonly release: false;
|
|
166
|
+
};
|
|
167
|
+
export type InstanceCapabilities = typeof InstanceCapabilitiesValue;
|
|
168
|
+
export type InstanceStatus = (typeof InstanceStatus)[keyof typeof InstanceStatus];
|
|
169
|
+
export declare const InstanceStatus: {
|
|
170
|
+
readonly Pending: "Pending";
|
|
171
|
+
readonly Starting: "Starting";
|
|
172
|
+
readonly Running: "Running";
|
|
173
|
+
readonly Stopping: "Stopping";
|
|
174
|
+
readonly Stopped: "Stopped";
|
|
175
|
+
readonly Resetting: "Resetting";
|
|
176
|
+
readonly Upgrading: "Upgrading";
|
|
177
|
+
readonly Disabled: "Disabled";
|
|
178
|
+
readonly Unknown: "Unknown";
|
|
179
|
+
};
|
|
180
|
+
export type InstanceBusinessStatus = (typeof InstanceBusinessStatus)[keyof typeof InstanceBusinessStatus];
|
|
181
|
+
export declare const InstanceBusinessStatus: {
|
|
182
|
+
readonly Normal: "Normal";
|
|
183
|
+
readonly Expired: "Expired";
|
|
184
|
+
readonly Overdue: "Overdue";
|
|
185
|
+
readonly Unknown: "Unknown";
|
|
186
|
+
};
|
|
187
|
+
export type InstanceObservation = (typeof InstanceObservation)[keyof typeof InstanceObservation];
|
|
188
|
+
export declare const InstanceObservation: {
|
|
189
|
+
readonly present: "present";
|
|
190
|
+
readonly missing: "missing";
|
|
191
|
+
};
|
|
192
|
+
export interface Instance {
|
|
193
|
+
id: string;
|
|
194
|
+
purchase_id: string;
|
|
195
|
+
project_id: string;
|
|
196
|
+
/**
|
|
197
|
+
* @minLength 1
|
|
198
|
+
* @maxLength 128
|
|
199
|
+
*/
|
|
200
|
+
region_id: string;
|
|
201
|
+
/** @maxLength 128 */
|
|
202
|
+
provider_plan_id: string;
|
|
203
|
+
/** @maxLength 128 */
|
|
204
|
+
image_id: string;
|
|
205
|
+
status: InstanceStatus;
|
|
206
|
+
business_status: InstanceBusinessStatus;
|
|
207
|
+
observation: InstanceObservation;
|
|
208
|
+
created_at: string | null;
|
|
209
|
+
expires_at: string | null;
|
|
210
|
+
original_price: InstancePrice;
|
|
211
|
+
/** UTC RFC 3339 timestamp. */
|
|
212
|
+
source_observed_at: string;
|
|
213
|
+
/**
|
|
214
|
+
* @minimum 1
|
|
215
|
+
* @maximum 9007199254740991
|
|
216
|
+
*/
|
|
217
|
+
sync_revision: number;
|
|
218
|
+
capabilities: InstanceCapabilities;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Pagination metadata for stable numbered pages. total_count is returned only when the operation can determine it without an unbounded scan.
|
|
222
|
+
*/
|
|
223
|
+
export interface OffsetPagination {
|
|
224
|
+
/** @minimum 1 */
|
|
225
|
+
page: number;
|
|
226
|
+
/** @minimum 1 */
|
|
227
|
+
page_size: number;
|
|
228
|
+
/** @minimum 0 */
|
|
229
|
+
total_count?: number;
|
|
230
|
+
}
|
|
231
|
+
export type InstancePagination = OffsetPagination;
|
|
232
|
+
export interface InstanceList {
|
|
233
|
+
/** @maxItems 200 */
|
|
234
|
+
items: Instance[];
|
|
235
|
+
pagination: OffsetPagination;
|
|
236
|
+
}
|
|
237
|
+
export interface StartInstance {
|
|
238
|
+
[key: string]: unknown;
|
|
239
|
+
}
|
|
240
|
+
export type ManagementOperationAction = (typeof ManagementOperationAction)[keyof typeof ManagementOperationAction];
|
|
241
|
+
export declare const ManagementOperationAction: {
|
|
242
|
+
readonly start: "start";
|
|
243
|
+
readonly stop: "stop";
|
|
244
|
+
readonly reboot: "reboot";
|
|
245
|
+
};
|
|
246
|
+
export type ManagementOperationState = (typeof ManagementOperationState)[keyof typeof ManagementOperationState];
|
|
247
|
+
export declare const ManagementOperationState: {
|
|
248
|
+
readonly queued: "queued";
|
|
249
|
+
readonly dispatch_unknown: "dispatch_unknown";
|
|
250
|
+
readonly provider_ack: "provider_ack";
|
|
251
|
+
readonly completed: "completed";
|
|
252
|
+
};
|
|
253
|
+
export type ManagementOperationLastObservedStatus = (typeof ManagementOperationLastObservedStatus)[keyof typeof ManagementOperationLastObservedStatus];
|
|
254
|
+
export declare const ManagementOperationLastObservedStatus: {
|
|
255
|
+
readonly Stopped: "Stopped";
|
|
256
|
+
readonly Running: "Running";
|
|
257
|
+
readonly Starting: "Starting";
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Observed reboot progress. running_observed_at is null until a later Running observation is available.
|
|
261
|
+
*/
|
|
262
|
+
export interface RebootCycle {
|
|
263
|
+
/** UTC RFC 3339 timestamp. */
|
|
264
|
+
starting_observed_at: string;
|
|
265
|
+
running_observed_at: string | null;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Read state to follow the operation. For a reboot, reboot_cycle records a Starting observation followed by a later Running observation. A missing cycle or null running time does not confirm completion.
|
|
269
|
+
*/
|
|
270
|
+
export interface ManagementOperation {
|
|
271
|
+
id: string;
|
|
272
|
+
purchase_id: string;
|
|
273
|
+
action: ManagementOperationAction;
|
|
274
|
+
state: ManagementOperationState;
|
|
275
|
+
last_observed_status: ManagementOperationLastObservedStatus;
|
|
276
|
+
/** UTC RFC 3339 timestamp. */
|
|
277
|
+
created_at: string;
|
|
278
|
+
/** UTC RFC 3339 timestamp. */
|
|
279
|
+
updated_at: string;
|
|
280
|
+
reboot_cycle?: RebootCycle;
|
|
281
|
+
}
|
|
282
|
+
export interface StopInstance {
|
|
283
|
+
[key: string]: unknown;
|
|
284
|
+
}
|
|
285
|
+
export interface CustomerRefundProgress {
|
|
286
|
+
state: "unknown";
|
|
287
|
+
reason: "billing_refund_reader_unavailable";
|
|
288
|
+
/** @nullable */
|
|
289
|
+
amount: null;
|
|
290
|
+
/** @nullable */
|
|
291
|
+
currency: null;
|
|
292
|
+
}
|
|
293
|
+
export declare const SupplierRefundProgressValue: {
|
|
294
|
+
readonly state: "not_observed";
|
|
295
|
+
readonly reason: "supplier_refund_not_queried";
|
|
296
|
+
};
|
|
297
|
+
export type SupplierRefundProgress = typeof SupplierRefundProgressValue;
|
|
298
|
+
export type RefundProgressCancellationState = (typeof RefundProgressCancellationState)[keyof typeof RefundProgressCancellationState];
|
|
299
|
+
export declare const RefundProgressCancellationState: {
|
|
300
|
+
readonly requested: "requested";
|
|
301
|
+
readonly scheduled: "scheduled";
|
|
302
|
+
readonly releasing: "releasing";
|
|
303
|
+
readonly completed: "completed";
|
|
304
|
+
readonly canceled: "canceled";
|
|
305
|
+
readonly failed: "failed";
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Cancellation and refund progress are independent. Unknown money amounts and currencies are null; cancellation completion does not confirm cash settlement.
|
|
309
|
+
*/
|
|
310
|
+
export interface RefundProgress {
|
|
311
|
+
purchase_id: string;
|
|
312
|
+
cancellation_id: string;
|
|
313
|
+
cancellation_state: RefundProgressCancellationState;
|
|
314
|
+
customer_refund: CustomerRefundProgress;
|
|
315
|
+
supplier_refund: SupplierRefundProgress;
|
|
316
|
+
/** UTC RFC 3339 timestamp. */
|
|
317
|
+
observed_at: string;
|
|
318
|
+
}
|
|
319
|
+
export interface RebootInstance {
|
|
320
|
+
[key: string]: unknown;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Pagination metadata for keyset traversal. Pass next_cursor as cursor to read the following page; null means there is no following page.
|
|
324
|
+
*/
|
|
325
|
+
export interface CursorPagination {
|
|
326
|
+
/** @minimum 1 */
|
|
327
|
+
page_size: number;
|
|
328
|
+
/** @nullable */
|
|
329
|
+
next_cursor?: string | null;
|
|
330
|
+
}
|
|
331
|
+
export type ListPlansParams = {
|
|
332
|
+
/**
|
|
333
|
+
* @minLength 1
|
|
334
|
+
* @maxLength 128
|
|
335
|
+
*/
|
|
336
|
+
region_id: string;
|
|
337
|
+
};
|
|
338
|
+
export type CreatePurchaseHeaders = {
|
|
339
|
+
/**
|
|
340
|
+
* @minLength 1
|
|
341
|
+
* @maxLength 128
|
|
342
|
+
*/
|
|
343
|
+
"Idempotency-Key": string;
|
|
344
|
+
};
|
|
345
|
+
export type ListInstancesParams = {
|
|
346
|
+
/**
|
|
347
|
+
* @minLength 1
|
|
348
|
+
* @maxLength 128
|
|
349
|
+
*/
|
|
350
|
+
region_id: string;
|
|
351
|
+
/**
|
|
352
|
+
* 1-based page number. Defaults to 1.
|
|
353
|
+
* @minimum 1
|
|
354
|
+
* @maximum 2147483647
|
|
355
|
+
*/
|
|
356
|
+
page?: number;
|
|
357
|
+
/**
|
|
358
|
+
* Items per page. Defaults to 50; at most 200.
|
|
359
|
+
* @minimum 1
|
|
360
|
+
* @maximum 200
|
|
361
|
+
*/
|
|
362
|
+
page_size?: number;
|
|
363
|
+
};
|
|
364
|
+
export type StartInstanceHeaders = {
|
|
365
|
+
/**
|
|
366
|
+
* @minLength 1
|
|
367
|
+
* @maxLength 128
|
|
368
|
+
*/
|
|
369
|
+
"Idempotency-Key": string;
|
|
370
|
+
};
|
|
371
|
+
export type StopInstanceHeaders = {
|
|
372
|
+
/**
|
|
373
|
+
* @minLength 1
|
|
374
|
+
* @maxLength 128
|
|
375
|
+
*/
|
|
376
|
+
"Idempotency-Key": string;
|
|
377
|
+
};
|
|
378
|
+
export type RebootInstanceHeaders = {
|
|
379
|
+
/**
|
|
380
|
+
* @minLength 1
|
|
381
|
+
* @maxLength 128
|
|
382
|
+
*/
|
|
383
|
+
"Idempotency-Key": string;
|
|
384
|
+
};
|