@scaleway/sdk-inference 1.0.1

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 (37) hide show
  1. package/LICENSE +191 -0
  2. package/dist/index.gen.cjs +6 -0
  3. package/dist/index.gen.d.ts +6 -0
  4. package/dist/index.gen.js +6 -0
  5. package/dist/v1/api.gen.cjs +271 -0
  6. package/dist/v1/api.gen.d.ts +137 -0
  7. package/dist/v1/api.gen.js +271 -0
  8. package/dist/v1/content.gen.cjs +13 -0
  9. package/dist/v1/content.gen.d.ts +5 -0
  10. package/dist/v1/content.gen.js +13 -0
  11. package/dist/v1/index.gen.cjs +22 -0
  12. package/dist/v1/index.gen.d.ts +5 -0
  13. package/dist/v1/index.gen.js +22 -0
  14. package/dist/v1/marshalling.gen.cjs +258 -0
  15. package/dist/v1/marshalling.gen.d.ts +14 -0
  16. package/dist/v1/marshalling.gen.js +258 -0
  17. package/dist/v1/types.gen.d.ts +577 -0
  18. package/dist/v1/validation-rules.gen.cjs +65 -0
  19. package/dist/v1/validation-rules.gen.d.ts +57 -0
  20. package/dist/v1/validation-rules.gen.js +65 -0
  21. package/dist/v1beta1/api.gen.cjs +301 -0
  22. package/dist/v1beta1/api.gen.d.ts +148 -0
  23. package/dist/v1beta1/api.gen.js +301 -0
  24. package/dist/v1beta1/content.gen.cjs +8 -0
  25. package/dist/v1beta1/content.gen.d.ts +3 -0
  26. package/dist/v1beta1/content.gen.js +8 -0
  27. package/dist/v1beta1/index.gen.cjs +25 -0
  28. package/dist/v1beta1/index.gen.d.ts +5 -0
  29. package/dist/v1beta1/index.gen.js +25 -0
  30. package/dist/v1beta1/marshalling.gen.cjs +271 -0
  31. package/dist/v1beta1/marshalling.gen.d.ts +18 -0
  32. package/dist/v1beta1/marshalling.gen.js +271 -0
  33. package/dist/v1beta1/types.gen.d.ts +622 -0
  34. package/dist/v1beta1/validation-rules.gen.cjs +56 -0
  35. package/dist/v1beta1/validation-rules.gen.d.ts +50 -0
  36. package/dist/v1beta1/validation-rules.gen.js +56 -0
  37. package/package.json +51 -0
@@ -0,0 +1,301 @@
1
+ import { API as API$1, urlParams, validatePathParam, enrichForPagination, waitForResource } from "@scaleway/sdk-client";
2
+ import { DEPLOYMENT_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import { unmarshalListDeploymentsResponse, unmarshalDeployment, marshalCreateDeploymentRequest, marshalUpdateDeploymentRequest, marshalCreateEndpointRequest, unmarshalEndpoint, marshalUpdateEndpointRequest, unmarshalListDeploymentACLRulesResponse, marshalAddDeploymentACLRulesRequest, unmarshalAddDeploymentACLRulesResponse, marshalSetDeploymentACLRulesRequest, unmarshalSetDeploymentACLRulesResponse, unmarshalListModelsResponse, unmarshalModel, unmarshalEula, unmarshalListNodeTypesResponse } from "./marshalling.gen.js";
4
+ const jsonContentHeaders = {
5
+ "Content-Type": "application/json; charset=utf-8"
6
+ };
7
+ class API extends API$1 {
8
+ /** Lists the available regions of the API. */
9
+ static LOCALITIES = ["fr-par"];
10
+ pageOfListDeployments = (request = {}) => this.client.fetch(
11
+ {
12
+ method: "GET",
13
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments`,
14
+ urlParams: urlParams(
15
+ ["name", request.name],
16
+ ["order_by", request.orderBy],
17
+ ["organization_id", request.organizationId],
18
+ ["page", request.page],
19
+ [
20
+ "page_size",
21
+ request.pageSize ?? this.client.settings.defaultPageSize
22
+ ],
23
+ ["project_id", request.projectId],
24
+ ["tags", request.tags]
25
+ )
26
+ },
27
+ unmarshalListDeploymentsResponse
28
+ );
29
+ /**
30
+ * List inference deployments. List all your inference deployments.
31
+ *
32
+ * @param request - The request {@link ListDeploymentsRequest}
33
+ * @returns A Promise of ListDeploymentsResponse
34
+ */
35
+ listDeployments = (request = {}) => enrichForPagination("deployments", this.pageOfListDeployments, request);
36
+ /**
37
+ * Get a deployment. Get the deployment for the given ID.
38
+ *
39
+ * @param request - The request {@link GetDeploymentRequest}
40
+ * @returns A Promise of Deployment
41
+ */
42
+ getDeployment = (request) => this.client.fetch(
43
+ {
44
+ method: "GET",
45
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}`
46
+ },
47
+ unmarshalDeployment
48
+ );
49
+ /**
50
+ * Waits for {@link Deployment} to be in a final state.
51
+ *
52
+ * @param request - The request {@link GetDeploymentRequest}
53
+ * @param options - The waiting options
54
+ * @returns A Promise of Deployment
55
+ */
56
+ waitForDeployment = (request, options) => waitForResource(
57
+ options?.stop ?? ((res) => Promise.resolve(
58
+ !DEPLOYMENT_TRANSIENT_STATUSES.includes(res.status)
59
+ )),
60
+ this.getDeployment,
61
+ request,
62
+ options
63
+ );
64
+ /**
65
+ * Create a deployment. Create a new inference deployment related to a specific model.
66
+ *
67
+ * @param request - The request {@link CreateDeploymentRequest}
68
+ * @returns A Promise of Deployment
69
+ */
70
+ createDeployment = (request) => this.client.fetch(
71
+ {
72
+ body: JSON.stringify(
73
+ marshalCreateDeploymentRequest(request, this.client.settings)
74
+ ),
75
+ headers: jsonContentHeaders,
76
+ method: "POST",
77
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments`
78
+ },
79
+ unmarshalDeployment
80
+ );
81
+ /**
82
+ * Update a deployment. Update an existing inference deployment.
83
+ *
84
+ * @param request - The request {@link UpdateDeploymentRequest}
85
+ * @returns A Promise of Deployment
86
+ */
87
+ updateDeployment = (request) => this.client.fetch(
88
+ {
89
+ body: JSON.stringify(
90
+ marshalUpdateDeploymentRequest(request, this.client.settings)
91
+ ),
92
+ headers: jsonContentHeaders,
93
+ method: "PATCH",
94
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}`
95
+ },
96
+ unmarshalDeployment
97
+ );
98
+ /**
99
+ * Delete a deployment. Delete an existing inference deployment.
100
+ *
101
+ * @param request - The request {@link DeleteDeploymentRequest}
102
+ * @returns A Promise of Deployment
103
+ */
104
+ deleteDeployment = (request) => this.client.fetch(
105
+ {
106
+ method: "DELETE",
107
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}`
108
+ },
109
+ unmarshalDeployment
110
+ );
111
+ /**
112
+ * Get the CA certificate. Get the CA certificate used for the deployment of private endpoints.
113
+ The CA certificate will be returned as a PEM file.
114
+ *
115
+ * @param request - The request {@link GetDeploymentCertificateRequest}
116
+ * @returns A Promise of Blob
117
+ */
118
+ getDeploymentCertificate = (request) => this.client.fetch({
119
+ method: "GET",
120
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/certificate`,
121
+ urlParams: urlParams(["dl", 1]),
122
+ responseType: "blob"
123
+ });
124
+ /**
125
+ * Create an endpoint. Create a new Endpoint related to a specific deployment.
126
+ *
127
+ * @param request - The request {@link CreateEndpointRequest}
128
+ * @returns A Promise of Endpoint
129
+ */
130
+ createEndpoint = (request) => this.client.fetch(
131
+ {
132
+ body: JSON.stringify(
133
+ marshalCreateEndpointRequest(request, this.client.settings)
134
+ ),
135
+ headers: jsonContentHeaders,
136
+ method: "POST",
137
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints`
138
+ },
139
+ unmarshalEndpoint
140
+ );
141
+ /**
142
+ * Update an endpoint. Update an existing Endpoint.
143
+ *
144
+ * @param request - The request {@link UpdateEndpointRequest}
145
+ * @returns A Promise of Endpoint
146
+ */
147
+ updateEndpoint = (request) => this.client.fetch(
148
+ {
149
+ body: JSON.stringify(
150
+ marshalUpdateEndpointRequest(request, this.client.settings)
151
+ ),
152
+ headers: jsonContentHeaders,
153
+ method: "PATCH",
154
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
155
+ },
156
+ unmarshalEndpoint
157
+ );
158
+ /**
159
+ * Delete an endpoint. Delete an existing Endpoint.
160
+ *
161
+ * @param request - The request {@link DeleteEndpointRequest}
162
+ */
163
+ deleteEndpoint = (request) => this.client.fetch({
164
+ method: "DELETE",
165
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
166
+ });
167
+ pageOfListDeploymentACLRules = (request) => this.client.fetch(
168
+ {
169
+ method: "GET",
170
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/acls`,
171
+ urlParams: urlParams(
172
+ ["page", request.page],
173
+ [
174
+ "page_size",
175
+ request.pageSize ?? this.client.settings.defaultPageSize
176
+ ]
177
+ )
178
+ },
179
+ unmarshalListDeploymentACLRulesResponse
180
+ );
181
+ /**
182
+ * List your ACLs. List ACLs for a specific deployment.
183
+ *
184
+ * @param request - The request {@link ListDeploymentACLRulesRequest}
185
+ * @returns A Promise of ListDeploymentACLRulesResponse
186
+ */
187
+ listDeploymentACLRules = (request) => enrichForPagination("rules", this.pageOfListDeploymentACLRules, request);
188
+ /**
189
+ * Add new ACLs. Add new ACL rules for a specific deployment.
190
+ *
191
+ * @param request - The request {@link AddDeploymentACLRulesRequest}
192
+ * @returns A Promise of AddDeploymentACLRulesResponse
193
+ */
194
+ addDeploymentACLRules = (request) => this.client.fetch(
195
+ {
196
+ body: JSON.stringify(
197
+ marshalAddDeploymentACLRulesRequest(request, this.client.settings)
198
+ ),
199
+ headers: jsonContentHeaders,
200
+ method: "POST",
201
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/acls`
202
+ },
203
+ unmarshalAddDeploymentACLRulesResponse
204
+ );
205
+ /**
206
+ * Set new ACL. Set new ACL rules for a specific deployment.
207
+ *
208
+ * @param request - The request {@link SetDeploymentACLRulesRequest}
209
+ * @returns A Promise of SetDeploymentACLRulesResponse
210
+ */
211
+ setDeploymentACLRules = (request) => this.client.fetch(
212
+ {
213
+ body: JSON.stringify(
214
+ marshalSetDeploymentACLRulesRequest(request, this.client.settings)
215
+ ),
216
+ headers: jsonContentHeaders,
217
+ method: "PUT",
218
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/acls`
219
+ },
220
+ unmarshalSetDeploymentACLRulesResponse
221
+ );
222
+ /**
223
+ * Delete an existing ACL.
224
+ *
225
+ * @param request - The request {@link DeleteDeploymentACLRuleRequest}
226
+ */
227
+ deleteDeploymentACLRule = (request) => this.client.fetch({
228
+ method: "DELETE",
229
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/acls/${validatePathParam("aclId", request.aclId)}`
230
+ });
231
+ pageOfListModels = (request = {}) => this.client.fetch(
232
+ {
233
+ method: "GET",
234
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/models`,
235
+ urlParams: urlParams(
236
+ ["name", request.name],
237
+ ["order_by", request.orderBy],
238
+ ["page", request.page],
239
+ [
240
+ "page_size",
241
+ request.pageSize ?? this.client.settings.defaultPageSize
242
+ ],
243
+ ["project_id", request.projectId],
244
+ ["tags", request.tags]
245
+ )
246
+ },
247
+ unmarshalListModelsResponse
248
+ );
249
+ /**
250
+ * List models. List all available models.
251
+ *
252
+ * @param request - The request {@link ListModelsRequest}
253
+ * @returns A Promise of ListModelsResponse
254
+ */
255
+ listModels = (request = {}) => enrichForPagination("models", this.pageOfListModels, request);
256
+ /**
257
+ * Get a model. Get the model for the given ID.
258
+ *
259
+ * @param request - The request {@link GetModelRequest}
260
+ * @returns A Promise of Model
261
+ */
262
+ getModel = (request) => this.client.fetch(
263
+ {
264
+ method: "GET",
265
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/models/${validatePathParam("modelId", request.modelId)}`
266
+ },
267
+ unmarshalModel
268
+ );
269
+ getModelEula = (request) => this.client.fetch(
270
+ {
271
+ method: "GET",
272
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/models/${validatePathParam("modelId", request.modelId)}/eula`
273
+ },
274
+ unmarshalEula
275
+ );
276
+ pageOfListNodeTypes = (request) => this.client.fetch(
277
+ {
278
+ method: "GET",
279
+ path: `/inference/v1beta1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/node-types`,
280
+ urlParams: urlParams(
281
+ ["include_disabled_types", request.includeDisabledTypes],
282
+ ["page", request.page],
283
+ [
284
+ "page_size",
285
+ request.pageSize ?? this.client.settings.defaultPageSize
286
+ ]
287
+ )
288
+ },
289
+ unmarshalListNodeTypesResponse
290
+ );
291
+ /**
292
+ * List available node types. List all available node types. By default, the node types returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
293
+ *
294
+ * @param request - The request {@link ListNodeTypesRequest}
295
+ * @returns A Promise of ListNodeTypesResponse
296
+ */
297
+ listNodeTypes = (request) => enrichForPagination("nodeTypes", this.pageOfListNodeTypes, request);
298
+ }
299
+ export {
300
+ API
301
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const DEPLOYMENT_TRANSIENT_STATUSES = [
4
+ "creating",
5
+ "deploying",
6
+ "deleting"
7
+ ];
8
+ exports.DEPLOYMENT_TRANSIENT_STATUSES = DEPLOYMENT_TRANSIENT_STATUSES;
@@ -0,0 +1,3 @@
1
+ import type { DeploymentStatus } from './types.gen';
2
+ /** Lists transient statutes of the enum {@link DeploymentStatus}. */
3
+ export declare const DEPLOYMENT_TRANSIENT_STATUSES: DeploymentStatus[];
@@ -0,0 +1,8 @@
1
+ const DEPLOYMENT_TRANSIENT_STATUSES = [
2
+ "creating",
3
+ "deploying",
4
+ "deleting"
5
+ ];
6
+ export {
7
+ DEPLOYMENT_TRANSIENT_STATUSES
8
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const api_gen = require("./api.gen.cjs");
4
+ const content_gen = require("./content.gen.cjs");
5
+ const marshalling_gen = require("./marshalling.gen.cjs");
6
+ const validationRules_gen = require("./validation-rules.gen.cjs");
7
+ exports.API = api_gen.API;
8
+ exports.DEPLOYMENT_TRANSIENT_STATUSES = content_gen.DEPLOYMENT_TRANSIENT_STATUSES;
9
+ exports.marshalAddDeploymentACLRulesRequest = marshalling_gen.marshalAddDeploymentACLRulesRequest;
10
+ exports.marshalCreateDeploymentRequest = marshalling_gen.marshalCreateDeploymentRequest;
11
+ exports.marshalCreateEndpointRequest = marshalling_gen.marshalCreateEndpointRequest;
12
+ exports.marshalSetDeploymentACLRulesRequest = marshalling_gen.marshalSetDeploymentACLRulesRequest;
13
+ exports.marshalUpdateDeploymentRequest = marshalling_gen.marshalUpdateDeploymentRequest;
14
+ exports.marshalUpdateEndpointRequest = marshalling_gen.marshalUpdateEndpointRequest;
15
+ exports.unmarshalAddDeploymentACLRulesResponse = marshalling_gen.unmarshalAddDeploymentACLRulesResponse;
16
+ exports.unmarshalDeployment = marshalling_gen.unmarshalDeployment;
17
+ exports.unmarshalEndpoint = marshalling_gen.unmarshalEndpoint;
18
+ exports.unmarshalEula = marshalling_gen.unmarshalEula;
19
+ exports.unmarshalListDeploymentACLRulesResponse = marshalling_gen.unmarshalListDeploymentACLRulesResponse;
20
+ exports.unmarshalListDeploymentsResponse = marshalling_gen.unmarshalListDeploymentsResponse;
21
+ exports.unmarshalListModelsResponse = marshalling_gen.unmarshalListModelsResponse;
22
+ exports.unmarshalListNodeTypesResponse = marshalling_gen.unmarshalListNodeTypesResponse;
23
+ exports.unmarshalModel = marshalling_gen.unmarshalModel;
24
+ exports.unmarshalSetDeploymentACLRulesResponse = marshalling_gen.unmarshalSetDeploymentACLRulesResponse;
25
+ exports.ValidationRules = validationRules_gen;
@@ -0,0 +1,5 @@
1
+ export { API } from './api.gen';
2
+ export * from './content.gen';
3
+ export * from './marshalling.gen';
4
+ export type { ACLRule, ACLRuleRequest, AddDeploymentACLRulesRequest, AddDeploymentACLRulesResponse, CreateDeploymentRequest, CreateEndpointRequest, DeleteDeploymentACLRuleRequest, DeleteDeploymentRequest, DeleteEndpointRequest, Deployment, DeploymentStatus, Endpoint, EndpointPrivateNetworkDetails, EndpointPublicAccessDetails, EndpointSpec, EndpointSpecPrivateNetwork, EndpointSpecPublic, Eula, GetDeploymentCertificateRequest, GetDeploymentRequest, GetModelEulaRequest, GetModelRequest, ListDeploymentACLRulesRequest, ListDeploymentACLRulesResponse, ListDeploymentsRequest, ListDeploymentsRequestOrderBy, ListDeploymentsResponse, ListModelsRequest, ListModelsRequestOrderBy, ListModelsResponse, ListNodeTypesRequest, ListNodeTypesResponse, Model, ModelS3Model, NodeType, NodeTypeStock, SetDeploymentACLRulesRequest, SetDeploymentACLRulesResponse, UpdateDeploymentRequest, UpdateEndpointRequest, } from './types.gen';
5
+ export * as ValidationRules from './validation-rules.gen';
@@ -0,0 +1,25 @@
1
+ import { API } from "./api.gen.js";
2
+ import { DEPLOYMENT_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import { marshalAddDeploymentACLRulesRequest, marshalCreateDeploymentRequest, marshalCreateEndpointRequest, marshalSetDeploymentACLRulesRequest, marshalUpdateDeploymentRequest, marshalUpdateEndpointRequest, unmarshalAddDeploymentACLRulesResponse, unmarshalDeployment, unmarshalEndpoint, unmarshalEula, unmarshalListDeploymentACLRulesResponse, unmarshalListDeploymentsResponse, unmarshalListModelsResponse, unmarshalListNodeTypesResponse, unmarshalModel, unmarshalSetDeploymentACLRulesResponse } from "./marshalling.gen.js";
4
+ import * as validationRules_gen from "./validation-rules.gen.js";
5
+ export {
6
+ API,
7
+ DEPLOYMENT_TRANSIENT_STATUSES,
8
+ validationRules_gen as ValidationRules,
9
+ marshalAddDeploymentACLRulesRequest,
10
+ marshalCreateDeploymentRequest,
11
+ marshalCreateEndpointRequest,
12
+ marshalSetDeploymentACLRulesRequest,
13
+ marshalUpdateDeploymentRequest,
14
+ marshalUpdateEndpointRequest,
15
+ unmarshalAddDeploymentACLRulesResponse,
16
+ unmarshalDeployment,
17
+ unmarshalEndpoint,
18
+ unmarshalEula,
19
+ unmarshalListDeploymentACLRulesResponse,
20
+ unmarshalListDeploymentsResponse,
21
+ unmarshalListModelsResponse,
22
+ unmarshalListNodeTypesResponse,
23
+ unmarshalModel,
24
+ unmarshalSetDeploymentACLRulesResponse
25
+ };
@@ -0,0 +1,271 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const randomName = require("@scaleway/random-name");
4
+ const sdkClient = require("@scaleway/sdk-client");
5
+ const unmarshalEndpointPrivateNetworkDetails = (data) => {
6
+ if (!sdkClient.isJSONObject(data)) {
7
+ throw new TypeError(
8
+ `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
9
+ );
10
+ }
11
+ return {
12
+ privateNetworkId: data.private_network_id
13
+ };
14
+ };
15
+ const unmarshalEndpointPublicAccessDetails = (data) => {
16
+ if (!sdkClient.isJSONObject(data)) {
17
+ throw new TypeError(
18
+ `Unmarshalling the type 'EndpointPublicAccessDetails' failed as data isn't a dictionary.`
19
+ );
20
+ }
21
+ return {};
22
+ };
23
+ const unmarshalEndpoint = (data) => {
24
+ if (!sdkClient.isJSONObject(data)) {
25
+ throw new TypeError(
26
+ `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
27
+ );
28
+ }
29
+ return {
30
+ disableAuth: data.disable_auth,
31
+ id: data.id,
32
+ privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
33
+ publicAccess: data.public_access ? unmarshalEndpointPublicAccessDetails(data.public_access) : void 0,
34
+ url: data.url
35
+ };
36
+ };
37
+ const unmarshalDeployment = (data) => {
38
+ if (!sdkClient.isJSONObject(data)) {
39
+ throw new TypeError(
40
+ `Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`
41
+ );
42
+ }
43
+ return {
44
+ createdAt: sdkClient.unmarshalDate(data.created_at),
45
+ endpoints: sdkClient.unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
46
+ errorMessage: data.error_message,
47
+ id: data.id,
48
+ maxSize: data.max_size,
49
+ minSize: data.min_size,
50
+ modelId: data.model_id,
51
+ modelName: data.model_name,
52
+ name: data.name,
53
+ nodeType: data.node_type,
54
+ projectId: data.project_id,
55
+ region: data.region,
56
+ size: data.size,
57
+ status: data.status,
58
+ tags: data.tags,
59
+ updatedAt: sdkClient.unmarshalDate(data.updated_at)
60
+ };
61
+ };
62
+ const unmarshalModelS3Model = (data) => {
63
+ if (!sdkClient.isJSONObject(data)) {
64
+ throw new TypeError(
65
+ `Unmarshalling the type 'ModelS3Model' failed as data isn't a dictionary.`
66
+ );
67
+ }
68
+ return {
69
+ nodeType: data.node_type,
70
+ pythonDependencies: data.python_dependencies,
71
+ s3Url: data.s3_url,
72
+ tritonServerVersion: data.triton_server_version
73
+ };
74
+ };
75
+ const unmarshalModel = (data) => {
76
+ if (!sdkClient.isJSONObject(data)) {
77
+ throw new TypeError(
78
+ `Unmarshalling the type 'Model' failed as data isn't a dictionary.`
79
+ );
80
+ }
81
+ return {
82
+ compatibleNodeTypes: data.compatible_node_types,
83
+ createdAt: sdkClient.unmarshalDate(data.created_at),
84
+ description: data.description,
85
+ hasEula: data.has_eula,
86
+ id: data.id,
87
+ isPublic: data.is_public,
88
+ name: data.name,
89
+ projectId: data.project_id,
90
+ provider: data.provider,
91
+ quantizationLevel: data.quantization_level,
92
+ region: data.region,
93
+ s3Model: data.s3_model ? unmarshalModelS3Model(data.s3_model) : void 0,
94
+ tags: data.tags,
95
+ updatedAt: sdkClient.unmarshalDate(data.updated_at)
96
+ };
97
+ };
98
+ const unmarshalACLRule = (data) => {
99
+ if (!sdkClient.isJSONObject(data)) {
100
+ throw new TypeError(
101
+ `Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`
102
+ );
103
+ }
104
+ return {
105
+ description: data.description,
106
+ id: data.id,
107
+ ip: data.ip
108
+ };
109
+ };
110
+ const unmarshalAddDeploymentACLRulesResponse = (data) => {
111
+ if (!sdkClient.isJSONObject(data)) {
112
+ throw new TypeError(
113
+ `Unmarshalling the type 'AddDeploymentACLRulesResponse' failed as data isn't a dictionary.`
114
+ );
115
+ }
116
+ return {
117
+ rules: sdkClient.unmarshalArrayOfObject(data.rules, unmarshalACLRule)
118
+ };
119
+ };
120
+ const unmarshalEula = (data) => {
121
+ if (!sdkClient.isJSONObject(data)) {
122
+ throw new TypeError(
123
+ `Unmarshalling the type 'Eula' failed as data isn't a dictionary.`
124
+ );
125
+ }
126
+ return {
127
+ content: data.content
128
+ };
129
+ };
130
+ const unmarshalListDeploymentACLRulesResponse = (data) => {
131
+ if (!sdkClient.isJSONObject(data)) {
132
+ throw new TypeError(
133
+ `Unmarshalling the type 'ListDeploymentACLRulesResponse' failed as data isn't a dictionary.`
134
+ );
135
+ }
136
+ return {
137
+ rules: sdkClient.unmarshalArrayOfObject(data.rules, unmarshalACLRule),
138
+ totalCount: data.total_count
139
+ };
140
+ };
141
+ const unmarshalListDeploymentsResponse = (data) => {
142
+ if (!sdkClient.isJSONObject(data)) {
143
+ throw new TypeError(
144
+ `Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`
145
+ );
146
+ }
147
+ return {
148
+ deployments: sdkClient.unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
149
+ totalCount: data.total_count
150
+ };
151
+ };
152
+ const unmarshalListModelsResponse = (data) => {
153
+ if (!sdkClient.isJSONObject(data)) {
154
+ throw new TypeError(
155
+ `Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`
156
+ );
157
+ }
158
+ return {
159
+ models: sdkClient.unmarshalArrayOfObject(data.models, unmarshalModel),
160
+ totalCount: data.total_count
161
+ };
162
+ };
163
+ const unmarshalNodeType = (data) => {
164
+ if (!sdkClient.isJSONObject(data)) {
165
+ throw new TypeError(
166
+ `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
167
+ );
168
+ }
169
+ return {
170
+ beta: data.beta,
171
+ createdAt: sdkClient.unmarshalDate(data.created_at),
172
+ description: data.description,
173
+ disabled: data.disabled,
174
+ gpus: data.gpus,
175
+ memory: data.memory,
176
+ name: data.name,
177
+ region: data.region,
178
+ stockStatus: data.stock_status,
179
+ updatedAt: sdkClient.unmarshalDate(data.updated_at),
180
+ vcpus: data.vcpus,
181
+ vram: data.vram
182
+ };
183
+ };
184
+ const unmarshalListNodeTypesResponse = (data) => {
185
+ if (!sdkClient.isJSONObject(data)) {
186
+ throw new TypeError(
187
+ `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
188
+ );
189
+ }
190
+ return {
191
+ nodeTypes: sdkClient.unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
192
+ totalCount: data.total_count
193
+ };
194
+ };
195
+ const unmarshalSetDeploymentACLRulesResponse = (data) => {
196
+ if (!sdkClient.isJSONObject(data)) {
197
+ throw new TypeError(
198
+ `Unmarshalling the type 'SetDeploymentACLRulesResponse' failed as data isn't a dictionary.`
199
+ );
200
+ }
201
+ return {
202
+ rules: sdkClient.unmarshalArrayOfObject(data.rules, unmarshalACLRule)
203
+ };
204
+ };
205
+ const marshalACLRuleRequest = (request, defaults) => ({
206
+ description: request.description,
207
+ ip: request.ip
208
+ });
209
+ const marshalAddDeploymentACLRulesRequest = (request, defaults) => ({
210
+ acls: request.acls !== void 0 ? request.acls.map((elt) => marshalACLRuleRequest(elt)) : void 0
211
+ });
212
+ const marshalEndpointSpecPrivateNetwork = (request, defaults) => ({
213
+ private_network_id: request.privateNetworkId
214
+ });
215
+ const marshalEndpointSpecPublic = (request, defaults) => ({});
216
+ const marshalEndpointSpec = (request, defaults) => ({
217
+ disable_auth: request.disableAuth,
218
+ ...sdkClient.resolveOneOf([
219
+ {
220
+ param: "public",
221
+ value: request.public !== void 0 ? marshalEndpointSpecPublic(request.public) : void 0
222
+ },
223
+ {
224
+ param: "private_network",
225
+ value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetwork(request.privateNetwork) : void 0
226
+ }
227
+ ])
228
+ });
229
+ const marshalCreateDeploymentRequest = (request, defaults) => ({
230
+ accept_eula: request.acceptEula,
231
+ endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt)),
232
+ max_size: request.maxSize,
233
+ min_size: request.minSize,
234
+ model_name: request.modelName,
235
+ name: request.name || randomName("inference"),
236
+ node_type: request.nodeType,
237
+ project_id: request.projectId ?? defaults.defaultProjectId,
238
+ tags: request.tags
239
+ });
240
+ const marshalCreateEndpointRequest = (request, defaults) => ({
241
+ deployment_id: request.deploymentId,
242
+ endpoint: marshalEndpointSpec(request.endpoint)
243
+ });
244
+ const marshalSetDeploymentACLRulesRequest = (request, defaults) => ({
245
+ acls: request.acls !== void 0 ? request.acls.map((elt) => marshalACLRuleRequest(elt)) : void 0
246
+ });
247
+ const marshalUpdateDeploymentRequest = (request, defaults) => ({
248
+ max_size: request.maxSize,
249
+ min_size: request.minSize,
250
+ name: request.name,
251
+ tags: request.tags
252
+ });
253
+ const marshalUpdateEndpointRequest = (request, defaults) => ({
254
+ disable_auth: request.disableAuth
255
+ });
256
+ exports.marshalAddDeploymentACLRulesRequest = marshalAddDeploymentACLRulesRequest;
257
+ exports.marshalCreateDeploymentRequest = marshalCreateDeploymentRequest;
258
+ exports.marshalCreateEndpointRequest = marshalCreateEndpointRequest;
259
+ exports.marshalSetDeploymentACLRulesRequest = marshalSetDeploymentACLRulesRequest;
260
+ exports.marshalUpdateDeploymentRequest = marshalUpdateDeploymentRequest;
261
+ exports.marshalUpdateEndpointRequest = marshalUpdateEndpointRequest;
262
+ exports.unmarshalAddDeploymentACLRulesResponse = unmarshalAddDeploymentACLRulesResponse;
263
+ exports.unmarshalDeployment = unmarshalDeployment;
264
+ exports.unmarshalEndpoint = unmarshalEndpoint;
265
+ exports.unmarshalEula = unmarshalEula;
266
+ exports.unmarshalListDeploymentACLRulesResponse = unmarshalListDeploymentACLRulesResponse;
267
+ exports.unmarshalListDeploymentsResponse = unmarshalListDeploymentsResponse;
268
+ exports.unmarshalListModelsResponse = unmarshalListModelsResponse;
269
+ exports.unmarshalListNodeTypesResponse = unmarshalListNodeTypesResponse;
270
+ exports.unmarshalModel = unmarshalModel;
271
+ exports.unmarshalSetDeploymentACLRulesResponse = unmarshalSetDeploymentACLRulesResponse;
@@ -0,0 +1,18 @@
1
+ import type { DefaultValues } from '@scaleway/sdk-client';
2
+ import type { AddDeploymentACLRulesRequest, AddDeploymentACLRulesResponse, CreateDeploymentRequest, CreateEndpointRequest, Deployment, Endpoint, Eula, ListDeploymentACLRulesResponse, ListDeploymentsResponse, ListModelsResponse, ListNodeTypesResponse, Model, SetDeploymentACLRulesRequest, SetDeploymentACLRulesResponse, UpdateDeploymentRequest, UpdateEndpointRequest } from './types.gen';
3
+ export declare const unmarshalEndpoint: (data: unknown) => Endpoint;
4
+ export declare const unmarshalDeployment: (data: unknown) => Deployment;
5
+ export declare const unmarshalModel: (data: unknown) => Model;
6
+ export declare const unmarshalAddDeploymentACLRulesResponse: (data: unknown) => AddDeploymentACLRulesResponse;
7
+ export declare const unmarshalEula: (data: unknown) => Eula;
8
+ export declare const unmarshalListDeploymentACLRulesResponse: (data: unknown) => ListDeploymentACLRulesResponse;
9
+ export declare const unmarshalListDeploymentsResponse: (data: unknown) => ListDeploymentsResponse;
10
+ export declare const unmarshalListModelsResponse: (data: unknown) => ListModelsResponse;
11
+ export declare const unmarshalListNodeTypesResponse: (data: unknown) => ListNodeTypesResponse;
12
+ export declare const unmarshalSetDeploymentACLRulesResponse: (data: unknown) => SetDeploymentACLRulesResponse;
13
+ export declare const marshalAddDeploymentACLRulesRequest: (request: AddDeploymentACLRulesRequest, defaults: DefaultValues) => Record<string, unknown>;
14
+ export declare const marshalCreateDeploymentRequest: (request: CreateDeploymentRequest, defaults: DefaultValues) => Record<string, unknown>;
15
+ export declare const marshalCreateEndpointRequest: (request: CreateEndpointRequest, defaults: DefaultValues) => Record<string, unknown>;
16
+ export declare const marshalSetDeploymentACLRulesRequest: (request: SetDeploymentACLRulesRequest, defaults: DefaultValues) => Record<string, unknown>;
17
+ export declare const marshalUpdateDeploymentRequest: (request: UpdateDeploymentRequest, defaults: DefaultValues) => Record<string, unknown>;
18
+ export declare const marshalUpdateEndpointRequest: (request: UpdateEndpointRequest, defaults: DefaultValues) => Record<string, unknown>;