@scaleway/sdk 2.21.1 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ import { API as API$1 } from '../../../scw/api.js';
3
3
  import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
4
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
5
  import { INSTANCE_TRANSIENT_STATUSES, READ_REPLICA_TRANSIENT_STATUSES, INSTANCE_LOG_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES } from './content.gen.js';
6
- import { unmarshalListDatabaseEnginesResponse, unmarshalListNodeTypesResponse, marshalUpgradeInstanceRequest, unmarshalInstance, unmarshalListInstancesResponse, marshalCreateInstanceRequest, marshalUpdateInstanceRequest, marshalCloneInstanceRequest, unmarshalInstanceMetrics, marshalCreateReadReplicaRequest, unmarshalReadReplica, marshalCreateReadReplicaEndpointRequest, unmarshalListInstanceLogsResponse, unmarshalInstanceLog, marshalPurgeInstanceLogsRequest, unmarshalListInstanceLogsDetailsResponse, marshalAddInstanceSettingsRequest, unmarshalAddInstanceSettingsResponse, marshalDeleteInstanceSettingsRequest, unmarshalDeleteInstanceSettingsResponse, marshalSetInstanceSettingsRequest, unmarshalSetInstanceSettingsResponse, unmarshalListInstanceACLRulesResponse, marshalAddInstanceACLRulesRequest, unmarshalAddInstanceACLRulesResponse, marshalSetInstanceACLRulesRequest, unmarshalSetInstanceACLRulesResponse, marshalDeleteInstanceACLRulesRequest, unmarshalDeleteInstanceACLRulesResponse, unmarshalListUsersResponse, marshalCreateUserRequest, unmarshalUser, marshalUpdateUserRequest, unmarshalListDatabasesResponse, marshalCreateDatabaseRequest, unmarshalDatabase, unmarshalListPrivilegesResponse, marshalSetPrivilegeRequest, unmarshalPrivilege, unmarshalListSnapshotsResponse, unmarshalSnapshot, marshalCreateSnapshotRequest, marshalUpdateSnapshotRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateEndpointRequest, unmarshalEndpoint, marshalMigrateEndpointRequest } from './marshalling.gen.js';
6
+ import { unmarshalListDatabaseEnginesResponse, unmarshalListNodeTypesResponse, marshalUpgradeInstanceRequest, unmarshalInstance, unmarshalListInstancesResponse, marshalCreateInstanceRequest, marshalUpdateInstanceRequest, marshalCloneInstanceRequest, unmarshalInstanceMetrics, marshalCreateReadReplicaRequest, unmarshalReadReplica, marshalCreateReadReplicaEndpointRequest, unmarshalListInstanceLogsResponse, unmarshalInstanceLog, marshalPurgeInstanceLogsRequest, unmarshalListInstanceLogsDetailsResponse, marshalAddInstanceSettingsRequest, unmarshalAddInstanceSettingsResponse, marshalDeleteInstanceSettingsRequest, unmarshalDeleteInstanceSettingsResponse, marshalSetInstanceSettingsRequest, unmarshalSetInstanceSettingsResponse, unmarshalListInstanceACLRulesResponse, marshalAddInstanceACLRulesRequest, unmarshalAddInstanceACLRulesResponse, marshalSetInstanceACLRulesRequest, unmarshalSetInstanceACLRulesResponse, marshalDeleteInstanceACLRulesRequest, unmarshalDeleteInstanceACLRulesResponse, unmarshalListUsersResponse, marshalCreateUserRequest, unmarshalUser, marshalUpdateUserRequest, unmarshalListDatabasesResponse, marshalCreateDatabaseRequest, unmarshalDatabase, unmarshalListPrivilegesResponse, marshalSetPrivilegeRequest, unmarshalPrivilege, unmarshalListSnapshotsResponse, unmarshalSnapshot, marshalCreateSnapshotRequest, marshalUpdateSnapshotRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateEndpointRequest, unmarshalEndpoint, marshalMigrateEndpointRequest, unmarshalMaintenance } from './marshalling.gen.js';
7
7
 
8
8
  // This file was automatically generated. DO NOT EDIT.
9
9
  // If you have any remark or suggestion do not hesitate to open an issue.
@@ -777,6 +777,20 @@ class API extends API$1 {
777
777
  method: 'POST',
778
778
  path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam('endpointId', request.endpointId)}/migrate`
779
779
  }, unmarshalEndpoint);
780
+
781
+ /**
782
+ * Apply an instance maintenance. Apply a pending instance maintenance on your
783
+ * instance. This action can generate some service interruption.
784
+ *
785
+ * @param request - The request {@link ApplyInstanceMaintenanceRequest}
786
+ * @returns A Promise of Maintenance
787
+ */
788
+ applyInstanceMaintenance = request => this.client.fetch({
789
+ body: '{}',
790
+ headers: jsonContentHeaders,
791
+ method: 'POST',
792
+ path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/apply-maintenance`
793
+ }, unmarshalMaintenance);
780
794
  }
781
795
 
782
796
  export { API };
@@ -8,7 +8,7 @@ const INSTANCE_LOG_TRANSIENT_STATUSES = ['creating'];
8
8
  const INSTANCE_TRANSIENT_STATUSES = ['provisioning', 'configuring', 'deleting', 'autohealing', 'initializing', 'backuping', 'snapshotting', 'restarting'];
9
9
 
10
10
  /** Lists transient statutes of the enum {@link MaintenanceStatus}. */
11
- const MAINTENANCE_TRANSIENT_STATUSES = ['pending'];
11
+ const MAINTENANCE_TRANSIENT_STATUSES = ['ongoing'];
12
12
 
13
13
  /** Lists transient statutes of the enum {@link ReadReplicaStatus}. */
14
14
  const READ_REPLICA_TRANSIENT_STATUSES = ['provisioning', 'initializing', 'deleting', 'configuring', 'promoting'];
@@ -1,7 +1,7 @@
1
1
  import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.3/node_modules/@scaleway/random-name/dist/index.js';
2
2
  import { isJSONObject } from '../../../helpers/json.js';
3
3
  import { unmarshalTimeSeries } from '../../../scw/custom-marshalling.js';
4
- import { unmarshalArrayOfObject, unmarshalDate, resolveOneOf } from '../../../helpers/marshalling.js';
4
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
5
5
 
6
6
  // This file was automatically generated. DO NOT EDIT.
7
7
  // If you have any remark or suggestion do not hesitate to open an issue.
@@ -42,6 +42,19 @@ const unmarshalEndpoint = data => {
42
42
  privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : undefined
43
43
  };
44
44
  };
45
+ const unmarshalMaintenance = data => {
46
+ if (!isJSONObject(data)) {
47
+ throw new TypeError(`Unmarshalling the type 'Maintenance' failed as data isn't a dictionary.`);
48
+ }
49
+ return {
50
+ closedAt: unmarshalDate(data.closed_at),
51
+ forcedAt: unmarshalDate(data.forced_at),
52
+ reason: data.reason,
53
+ startsAt: unmarshalDate(data.starts_at),
54
+ status: data.status,
55
+ stopsAt: unmarshalDate(data.stops_at)
56
+ };
57
+ };
45
58
  const unmarshalReadReplica = data => {
46
59
  if (!isJSONObject(data)) {
47
60
  throw new TypeError(`Unmarshalling the type 'ReadReplica' failed as data isn't a dictionary.`);
@@ -108,18 +121,6 @@ const unmarshalLogsPolicy = data => {
108
121
  totalDiskRetention: data.total_disk_retention
109
122
  };
110
123
  };
111
- const unmarshalMaintenance = data => {
112
- if (!isJSONObject(data)) {
113
- throw new TypeError(`Unmarshalling the type 'Maintenance' failed as data isn't a dictionary.`);
114
- }
115
- return {
116
- closedAt: unmarshalDate(data.closed_at),
117
- reason: data.reason,
118
- startsAt: unmarshalDate(data.starts_at),
119
- status: data.status,
120
- stopsAt: unmarshalDate(data.stops_at)
121
- };
122
- };
123
124
  const unmarshalUpgradableVersion = data => {
124
125
  if (!isJSONObject(data)) {
125
126
  throw new TypeError(`Unmarshalling the type 'UpgradableVersion' failed as data isn't a dictionary.`);
@@ -652,4 +653,4 @@ const marshalUpgradeInstanceRequest = (request, defaults) => ({
652
653
  }])
653
654
  });
654
655
 
655
- export { marshalAddInstanceACLRulesRequest, marshalAddInstanceSettingsRequest, marshalCloneInstanceRequest, marshalCreateDatabaseRequest, marshalCreateEndpointRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateInstanceRequest, marshalCreateReadReplicaEndpointRequest, marshalCreateReadReplicaRequest, marshalCreateSnapshotRequest, marshalCreateUserRequest, marshalDeleteInstanceACLRulesRequest, marshalDeleteInstanceSettingsRequest, marshalMigrateEndpointRequest, marshalPurgeInstanceLogsRequest, marshalSetInstanceACLRulesRequest, marshalSetInstanceSettingsRequest, marshalSetPrivilegeRequest, marshalUpdateInstanceRequest, marshalUpdateSnapshotRequest, marshalUpdateUserRequest, marshalUpgradeInstanceRequest, unmarshalAddInstanceACLRulesResponse, unmarshalAddInstanceSettingsResponse, unmarshalDatabase, unmarshalDeleteInstanceACLRulesResponse, unmarshalDeleteInstanceSettingsResponse, unmarshalEndpoint, unmarshalInstance, unmarshalInstanceLog, unmarshalInstanceMetrics, unmarshalListDatabaseEnginesResponse, unmarshalListDatabasesResponse, unmarshalListInstanceACLRulesResponse, unmarshalListInstanceLogsDetailsResponse, unmarshalListInstanceLogsResponse, unmarshalListInstancesResponse, unmarshalListNodeTypesResponse, unmarshalListPrivilegesResponse, unmarshalListSnapshotsResponse, unmarshalListUsersResponse, unmarshalPrivilege, unmarshalReadReplica, unmarshalSetInstanceACLRulesResponse, unmarshalSetInstanceSettingsResponse, unmarshalSnapshot, unmarshalUser };
656
+ export { marshalAddInstanceACLRulesRequest, marshalAddInstanceSettingsRequest, marshalCloneInstanceRequest, marshalCreateDatabaseRequest, marshalCreateEndpointRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateInstanceRequest, marshalCreateReadReplicaEndpointRequest, marshalCreateReadReplicaRequest, marshalCreateSnapshotRequest, marshalCreateUserRequest, marshalDeleteInstanceACLRulesRequest, marshalDeleteInstanceSettingsRequest, marshalMigrateEndpointRequest, marshalPurgeInstanceLogsRequest, marshalSetInstanceACLRulesRequest, marshalSetInstanceSettingsRequest, marshalSetPrivilegeRequest, marshalUpdateInstanceRequest, marshalUpdateSnapshotRequest, marshalUpdateUserRequest, marshalUpgradeInstanceRequest, unmarshalAddInstanceACLRulesResponse, unmarshalAddInstanceSettingsResponse, unmarshalDatabase, unmarshalDeleteInstanceACLRulesResponse, unmarshalDeleteInstanceSettingsResponse, unmarshalEndpoint, unmarshalInstance, unmarshalInstanceLog, unmarshalInstanceMetrics, unmarshalListDatabaseEnginesResponse, unmarshalListDatabasesResponse, unmarshalListInstanceACLRulesResponse, unmarshalListInstanceLogsDetailsResponse, unmarshalListInstanceLogsResponse, unmarshalListInstancesResponse, unmarshalListNodeTypesResponse, unmarshalListPrivilegesResponse, unmarshalListSnapshotsResponse, unmarshalListUsersResponse, unmarshalMaintenance, unmarshalPrivilege, unmarshalReadReplica, unmarshalSetInstanceACLRulesResponse, unmarshalSetInstanceSettingsResponse, unmarshalSnapshot, unmarshalUser };
@@ -52,6 +52,7 @@ const unmarshalJobRun = data => {
52
52
  memoryLimit: data.memory_limit,
53
53
  region: data.region,
54
54
  runDuration: data.run_duration,
55
+ startedAt: unmarshalDate(data.started_at),
55
56
  state: data.state,
56
57
  terminatedAt: unmarshalDate(data.terminated_at),
57
58
  updatedAt: unmarshalDate(data.updated_at)
@@ -22,7 +22,7 @@ class ZonedAPI extends API$1 {
22
22
  pageOfListLbs = (request = {}) => this.client.fetch({
23
23
  method: 'GET',
24
24
  path: `/lb/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/lbs`,
25
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId])
25
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId], ['tags', request.tags])
26
26
  }, unmarshalListLbsResponse);
27
27
 
28
28
  /**
@@ -825,7 +825,7 @@ class API extends API$1 {
825
825
  pageOfListLbs = (request = {}) => this.client.fetch({
826
826
  method: 'GET',
827
827
  path: `/lb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/lbs`,
828
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId])
828
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId], ['tags', request.tags])
829
829
  }, unmarshalListLbsResponse);
830
830
 
831
831
  /**
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1beta1/index.gen.js';
2
+ export { index_gen as v1beta1 };
@@ -0,0 +1,233 @@
1
+ import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
+ import { API as API$1 } from '../../../scw/api.js';
3
+ import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
+ import { DEPLOYMENT_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { unmarshalListDeploymentsResponse, unmarshalDeployment, marshalCreateDeploymentRequest, marshalUpdateDeploymentRequest, marshalCreateEndpointRequest, unmarshalEndpoint, marshalUpdateEndpointRequest, unmarshalListDeploymentACLRulesResponse, marshalAddDeploymentACLRulesRequest, unmarshalAddDeploymentACLRulesResponse, marshalSetDeploymentACLRulesRequest, unmarshalSetDeploymentACLRulesResponse, unmarshalListModelsResponse, unmarshalModel, unmarshalEula, unmarshalListNodeTypesResponse } from './marshalling.gen.js';
7
+
8
+ // This file was automatically generated. DO NOT EDIT.
9
+ // If you have any remark or suggestion do not hesitate to open an issue.
10
+ const jsonContentHeaders = {
11
+ 'Content-Type': 'application/json; charset=utf-8'
12
+ };
13
+
14
+ /** LLM Inference API. */
15
+ class API extends API$1 {
16
+ /** Lists the available regions of the API. */
17
+ static LOCALITIES = ['fr-par'];
18
+ pageOfListDeployments = (request = {}) => this.client.fetch({
19
+ method: 'GET',
20
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/deployments`,
21
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId], ['tags', request.tags])
22
+ }, unmarshalListDeploymentsResponse);
23
+
24
+ /**
25
+ * List inference deployments. List all your inference deployments.
26
+ *
27
+ * @param request - The request {@link ListDeploymentsRequest}
28
+ * @returns A Promise of ListDeploymentsResponse
29
+ */
30
+ listDeployments = (request = {}) => enrichForPagination('deployments', this.pageOfListDeployments, request);
31
+
32
+ /**
33
+ * Get a deployment. Get the deployment for the given ID.
34
+ *
35
+ * @param request - The request {@link GetDeploymentRequest}
36
+ * @returns A Promise of Deployment
37
+ */
38
+ getDeployment = request => this.client.fetch({
39
+ method: 'GET',
40
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam('deploymentId', request.deploymentId)}`
41
+ }, unmarshalDeployment);
42
+
43
+ /**
44
+ * Waits for {@link Deployment} to be in a final state.
45
+ *
46
+ * @param request - The request {@link GetDeploymentRequest}
47
+ * @param options - The waiting options
48
+ * @returns A Promise of Deployment
49
+ */
50
+ waitForDeployment = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!DEPLOYMENT_TRANSIENT_STATUSES.includes(res.status))), this.getDeployment, request, options);
51
+
52
+ /**
53
+ * Create a deployment. Create a new inference deployment related to a
54
+ * specific model.
55
+ *
56
+ * @param request - The request {@link CreateDeploymentRequest}
57
+ * @returns A Promise of Deployment
58
+ */
59
+ createDeployment = request => this.client.fetch({
60
+ body: JSON.stringify(marshalCreateDeploymentRequest(request, this.client.settings)),
61
+ headers: jsonContentHeaders,
62
+ method: 'POST',
63
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/deployments`
64
+ }, unmarshalDeployment);
65
+
66
+ /**
67
+ * Update a deployment. Update an existing inference deployment.
68
+ *
69
+ * @param request - The request {@link UpdateDeploymentRequest}
70
+ * @returns A Promise of Deployment
71
+ */
72
+ updateDeployment = request => this.client.fetch({
73
+ body: JSON.stringify(marshalUpdateDeploymentRequest(request, this.client.settings)),
74
+ headers: jsonContentHeaders,
75
+ method: 'PATCH',
76
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam('deploymentId', request.deploymentId)}`
77
+ }, unmarshalDeployment);
78
+
79
+ /**
80
+ * Delete a deployment. Delete an existing inference deployment.
81
+ *
82
+ * @param request - The request {@link DeleteDeploymentRequest}
83
+ * @returns A Promise of Deployment
84
+ */
85
+ deleteDeployment = request => this.client.fetch({
86
+ method: 'DELETE',
87
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam('deploymentId', request.deploymentId)}`
88
+ }, unmarshalDeployment);
89
+
90
+ /**
91
+ * Get the CA certificate. Get the CA certificate used for the deployment of
92
+ * private endpoints. The CA certificate will be returned as a PEM file.
93
+ *
94
+ * @param request - The request {@link GetDeploymentCertificateRequest}
95
+ * @returns A Promise of Blob
96
+ */
97
+ getDeploymentCertificate = request => this.client.fetch({
98
+ method: 'GET',
99
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam('deploymentId', request.deploymentId)}/certificate`,
100
+ urlParams: urlParams(['dl', 1]),
101
+ responseType: 'blob'
102
+ });
103
+
104
+ /**
105
+ * Create an endpoint. Create a new Endpoint related to a specific deployment.
106
+ *
107
+ * @param request - The request {@link CreateEndpointRequest}
108
+ * @returns A Promise of Endpoint
109
+ */
110
+ createEndpoint = request => this.client.fetch({
111
+ body: JSON.stringify(marshalCreateEndpointRequest(request, this.client.settings)),
112
+ headers: jsonContentHeaders,
113
+ method: 'POST',
114
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints`
115
+ }, unmarshalEndpoint);
116
+
117
+ /**
118
+ * Update an endpoint. Update an existing Endpoint.
119
+ *
120
+ * @param request - The request {@link UpdateEndpointRequest}
121
+ * @returns A Promise of Endpoint
122
+ */
123
+ updateEndpoint = request => this.client.fetch({
124
+ body: JSON.stringify(marshalUpdateEndpointRequest(request, this.client.settings)),
125
+ headers: jsonContentHeaders,
126
+ method: 'PATCH',
127
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam('endpointId', request.endpointId)}`
128
+ }, unmarshalEndpoint);
129
+
130
+ /**
131
+ * Delete an endpoint. Delete an existing Endpoint.
132
+ *
133
+ * @param request - The request {@link DeleteEndpointRequest}
134
+ */
135
+ deleteEndpoint = request => this.client.fetch({
136
+ method: 'DELETE',
137
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam('endpointId', request.endpointId)}`
138
+ });
139
+ pageOfListDeploymentACLRules = request => this.client.fetch({
140
+ method: 'GET',
141
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam('deploymentId', request.deploymentId)}/acls`,
142
+ urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
143
+ }, unmarshalListDeploymentACLRulesResponse);
144
+
145
+ /**
146
+ * List your ACLs. List ACLs for a specific deployment.
147
+ *
148
+ * @param request - The request {@link ListDeploymentACLRulesRequest}
149
+ * @returns A Promise of ListDeploymentACLRulesResponse
150
+ */
151
+ listDeploymentACLRules = request => enrichForPagination('rules', this.pageOfListDeploymentACLRules, request);
152
+
153
+ /**
154
+ * Add new ACLs. Add new ACL rules for a specific deployment.
155
+ *
156
+ * @param request - The request {@link AddDeploymentACLRulesRequest}
157
+ * @returns A Promise of AddDeploymentACLRulesResponse
158
+ */
159
+ addDeploymentACLRules = request => this.client.fetch({
160
+ body: JSON.stringify(marshalAddDeploymentACLRulesRequest(request, this.client.settings)),
161
+ headers: jsonContentHeaders,
162
+ method: 'POST',
163
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam('deploymentId', request.deploymentId)}/acls`
164
+ }, unmarshalAddDeploymentACLRulesResponse);
165
+
166
+ /**
167
+ * Set new ACL. Set new ACL rules for a specific deployment.
168
+ *
169
+ * @param request - The request {@link SetDeploymentACLRulesRequest}
170
+ * @returns A Promise of SetDeploymentACLRulesResponse
171
+ */
172
+ setDeploymentACLRules = request => this.client.fetch({
173
+ body: JSON.stringify(marshalSetDeploymentACLRulesRequest(request, this.client.settings)),
174
+ headers: jsonContentHeaders,
175
+ method: 'PUT',
176
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam('deploymentId', request.deploymentId)}/acls`
177
+ }, unmarshalSetDeploymentACLRulesResponse);
178
+
179
+ /**
180
+ * Delete an exising ACL.
181
+ *
182
+ * @param request - The request {@link DeleteDeploymentACLRuleRequest}
183
+ */
184
+ deleteDeploymentACLRule = request => this.client.fetch({
185
+ method: 'DELETE',
186
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/acls/${validatePathParam('aclId', request.aclId)}`
187
+ });
188
+ pageOfListModels = (request = {}) => this.client.fetch({
189
+ method: 'GET',
190
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/models`,
191
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId], ['tags', request.tags])
192
+ }, unmarshalListModelsResponse);
193
+
194
+ /**
195
+ * List models. List all available LLM models.
196
+ *
197
+ * @param request - The request {@link ListModelsRequest}
198
+ * @returns A Promise of ListModelsResponse
199
+ */
200
+ listModels = (request = {}) => enrichForPagination('models', this.pageOfListModels, request);
201
+
202
+ /**
203
+ * Get a model. Get the model for the given ID.
204
+ *
205
+ * @param request - The request {@link GetModelRequest}
206
+ * @returns A Promise of Model
207
+ */
208
+ getModel = request => this.client.fetch({
209
+ method: 'GET',
210
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/models/${validatePathParam('modelId', request.modelId)}`
211
+ }, unmarshalModel);
212
+ getModelEula = request => this.client.fetch({
213
+ method: 'GET',
214
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/models/${validatePathParam('modelId', request.modelId)}/eula`
215
+ }, unmarshalEula);
216
+ pageOfListNodeTypes = request => this.client.fetch({
217
+ method: 'GET',
218
+ path: `/llm-inference/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/node-types`,
219
+ urlParams: urlParams(['include_disabled_types', request.includeDisabledTypes], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
220
+ }, unmarshalListNodeTypesResponse);
221
+
222
+ /**
223
+ * List available node types. List all available node types. By default, the
224
+ * node types returned in the list are ordered by creation date in ascending
225
+ * order, though this can be modified via the `order_by` field.
226
+ *
227
+ * @param request - The request {@link ListNodeTypesRequest}
228
+ * @returns A Promise of ListNodeTypesResponse
229
+ */
230
+ listNodeTypes = request => enrichForPagination('nodeTypes', this.pageOfListNodeTypes, request);
231
+ }
232
+
233
+ export { API };
@@ -0,0 +1,7 @@
1
+ // This file was automatically generated. DO NOT EDIT.
2
+ // If you have any remark or suggestion do not hesitate to open an issue.
3
+
4
+ /** Lists transient statutes of the enum {@link DeploymentStatus}. */
5
+ const DEPLOYMENT_TRANSIENT_STATUSES = ['creating', 'deploying', 'deleting'];
6
+
7
+ export { DEPLOYMENT_TRANSIENT_STATUSES };
@@ -0,0 +1,7 @@
1
+ export { API } from './api.gen.js';
2
+ export { DEPLOYMENT_TRANSIENT_STATUSES } from './content.gen.js';
3
+ import * as validationRules_gen from './validation-rules.gen.js';
4
+ export { validationRules_gen as ValidationRules };
5
+
6
+ // This file was automatically generated. DO NOT EDIT.
7
+ // If you have any remark or suggestion do not hesitate to open an issue.
@@ -0,0 +1,225 @@
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.3/node_modules/@scaleway/random-name/dist/index.js';
2
+ import { isJSONObject } from '../../../helpers/json.js';
3
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
4
+
5
+ // This file was automatically generated. DO NOT EDIT.
6
+ // If you have any remark or suggestion do not hesitate to open an issue.
7
+ const unmarshalEndpointPrivateNetworkDetails = data => {
8
+ if (!isJSONObject(data)) {
9
+ throw new TypeError(`Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`);
10
+ }
11
+ return {
12
+ privateNetworkId: data.private_network_id
13
+ };
14
+ };
15
+ const unmarshalEndpointPublicAccessDetails = data => {
16
+ if (!isJSONObject(data)) {
17
+ throw new TypeError(`Unmarshalling the type 'EndpointPublicAccessDetails' failed as data isn't a dictionary.`);
18
+ }
19
+ return {};
20
+ };
21
+ const unmarshalEndpoint = data => {
22
+ if (!isJSONObject(data)) {
23
+ throw new TypeError(`Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`);
24
+ }
25
+ return {
26
+ disableAuth: data.disable_auth,
27
+ id: data.id,
28
+ privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : undefined,
29
+ publicAccess: data.public_access ? unmarshalEndpointPublicAccessDetails(data.public_access) : undefined,
30
+ url: data.url
31
+ };
32
+ };
33
+ const unmarshalDeployment = data => {
34
+ if (!isJSONObject(data)) {
35
+ throw new TypeError(`Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`);
36
+ }
37
+ return {
38
+ createdAt: unmarshalDate(data.created_at),
39
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
40
+ errorMessage: data.error_message,
41
+ id: data.id,
42
+ maxSize: data.max_size,
43
+ minSize: data.min_size,
44
+ modelName: data.model_name,
45
+ name: data.name,
46
+ nodeType: data.node_type,
47
+ projectId: data.project_id,
48
+ region: data.region,
49
+ size: data.size,
50
+ status: data.status,
51
+ tags: data.tags,
52
+ updatedAt: unmarshalDate(data.updated_at)
53
+ };
54
+ };
55
+ const unmarshalModelS3Model = data => {
56
+ if (!isJSONObject(data)) {
57
+ throw new TypeError(`Unmarshalling the type 'ModelS3Model' failed as data isn't a dictionary.`);
58
+ }
59
+ return {
60
+ nodeType: data.node_type,
61
+ pythonDependencies: data.python_dependencies,
62
+ s3Url: data.s3_url,
63
+ tritonServerVersion: data.triton_server_version
64
+ };
65
+ };
66
+ const unmarshalModel = data => {
67
+ if (!isJSONObject(data)) {
68
+ throw new TypeError(`Unmarshalling the type 'Model' failed as data isn't a dictionary.`);
69
+ }
70
+ return {
71
+ compatibleNodeTypes: data.compatible_node_types,
72
+ createdAt: unmarshalDate(data.created_at),
73
+ description: data.description,
74
+ hasEula: data.has_eula,
75
+ id: data.id,
76
+ isPublic: data.is_public,
77
+ name: data.name,
78
+ projectId: data.project_id,
79
+ provider: data.provider,
80
+ quantizationLevel: data.quantization_level,
81
+ region: data.region,
82
+ s3Model: data.s3_model ? unmarshalModelS3Model(data.s3_model) : undefined,
83
+ tags: data.tags,
84
+ updatedAt: unmarshalDate(data.updated_at)
85
+ };
86
+ };
87
+ const unmarshalACLRule = data => {
88
+ if (!isJSONObject(data)) {
89
+ throw new TypeError(`Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`);
90
+ }
91
+ return {
92
+ description: data.description,
93
+ id: data.id,
94
+ ip: data.ip
95
+ };
96
+ };
97
+ const unmarshalAddDeploymentACLRulesResponse = data => {
98
+ if (!isJSONObject(data)) {
99
+ throw new TypeError(`Unmarshalling the type 'AddDeploymentACLRulesResponse' failed as data isn't a dictionary.`);
100
+ }
101
+ return {
102
+ rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule)
103
+ };
104
+ };
105
+ const unmarshalEula = data => {
106
+ if (!isJSONObject(data)) {
107
+ throw new TypeError(`Unmarshalling the type 'Eula' failed as data isn't a dictionary.`);
108
+ }
109
+ return {
110
+ content: data.content
111
+ };
112
+ };
113
+ const unmarshalListDeploymentACLRulesResponse = data => {
114
+ if (!isJSONObject(data)) {
115
+ throw new TypeError(`Unmarshalling the type 'ListDeploymentACLRulesResponse' failed as data isn't a dictionary.`);
116
+ }
117
+ return {
118
+ rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule),
119
+ totalCount: data.total_count
120
+ };
121
+ };
122
+ const unmarshalListDeploymentsResponse = data => {
123
+ if (!isJSONObject(data)) {
124
+ throw new TypeError(`Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`);
125
+ }
126
+ return {
127
+ deployments: unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
128
+ totalCount: data.total_count
129
+ };
130
+ };
131
+ const unmarshalListModelsResponse = data => {
132
+ if (!isJSONObject(data)) {
133
+ throw new TypeError(`Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`);
134
+ }
135
+ return {
136
+ models: unmarshalArrayOfObject(data.models, unmarshalModel),
137
+ totalCount: data.total_count
138
+ };
139
+ };
140
+ const unmarshalNodeType = data => {
141
+ if (!isJSONObject(data)) {
142
+ throw new TypeError(`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`);
143
+ }
144
+ return {
145
+ beta: data.beta,
146
+ createdAt: unmarshalDate(data.created_at),
147
+ description: data.description,
148
+ disabled: data.disabled,
149
+ gpus: data.gpus,
150
+ memory: data.memory,
151
+ name: data.name,
152
+ region: data.region,
153
+ stockStatus: data.stock_status,
154
+ updatedAt: unmarshalDate(data.updated_at),
155
+ vcpus: data.vcpus,
156
+ vram: data.vram
157
+ };
158
+ };
159
+ const unmarshalListNodeTypesResponse = data => {
160
+ if (!isJSONObject(data)) {
161
+ throw new TypeError(`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`);
162
+ }
163
+ return {
164
+ nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
165
+ totalCount: data.total_count
166
+ };
167
+ };
168
+ const unmarshalSetDeploymentACLRulesResponse = data => {
169
+ if (!isJSONObject(data)) {
170
+ throw new TypeError(`Unmarshalling the type 'SetDeploymentACLRulesResponse' failed as data isn't a dictionary.`);
171
+ }
172
+ return {
173
+ rules: unmarshalArrayOfObject(data.rules, unmarshalACLRule)
174
+ };
175
+ };
176
+ const marshalACLRuleRequest = (request, defaults) => ({
177
+ description: request.description,
178
+ ip: request.ip
179
+ });
180
+ const marshalAddDeploymentACLRulesRequest = (request, defaults) => ({
181
+ acls: request.acls !== undefined ? request.acls.map(elt => marshalACLRuleRequest(elt)) : undefined
182
+ });
183
+ const marshalEndpointSpecPrivateNetwork = (request, defaults) => ({
184
+ private_network_id: request.privateNetworkId
185
+ });
186
+ const marshalEndpointSpecPublic = (request, defaults) => ({});
187
+ const marshalEndpointSpec = (request, defaults) => ({
188
+ disable_auth: request.disableAuth,
189
+ ...resolveOneOf([{
190
+ param: 'public',
191
+ value: request.public !== undefined ? marshalEndpointSpecPublic(request.public) : undefined
192
+ }, {
193
+ param: 'private_network',
194
+ value: request.privateNetwork !== undefined ? marshalEndpointSpecPrivateNetwork(request.privateNetwork) : undefined
195
+ }])
196
+ });
197
+ const marshalCreateDeploymentRequest = (request, defaults) => ({
198
+ accept_eula: request.acceptEula,
199
+ endpoints: request.endpoints.map(elt => marshalEndpointSpec(elt)),
200
+ max_size: request.maxSize,
201
+ min_size: request.minSize,
202
+ model_name: request.modelName,
203
+ name: request.name || randomName('llm'),
204
+ node_type: request.nodeType,
205
+ project_id: request.projectId ?? defaults.defaultProjectId,
206
+ tags: request.tags
207
+ });
208
+ const marshalCreateEndpointRequest = (request, defaults) => ({
209
+ deployment_id: request.deploymentId,
210
+ endpoint: marshalEndpointSpec(request.endpoint)
211
+ });
212
+ const marshalSetDeploymentACLRulesRequest = (request, defaults) => ({
213
+ acls: request.acls !== undefined ? request.acls.map(elt => marshalACLRuleRequest(elt)) : undefined
214
+ });
215
+ const marshalUpdateDeploymentRequest = (request, defaults) => ({
216
+ max_size: request.maxSize,
217
+ min_size: request.minSize,
218
+ name: request.name,
219
+ tags: request.tags
220
+ });
221
+ const marshalUpdateEndpointRequest = (request, defaults) => ({
222
+ disable_auth: request.disableAuth
223
+ });
224
+
225
+ export { marshalAddDeploymentACLRulesRequest, marshalCreateDeploymentRequest, marshalCreateEndpointRequest, marshalSetDeploymentACLRulesRequest, marshalUpdateDeploymentRequest, marshalUpdateEndpointRequest, unmarshalAddDeploymentACLRulesResponse, unmarshalDeployment, unmarshalEndpoint, unmarshalEula, unmarshalListDeploymentACLRulesResponse, unmarshalListDeploymentsResponse, unmarshalListModelsResponse, unmarshalListNodeTypesResponse, unmarshalModel, unmarshalSetDeploymentACLRulesResponse };
@@ -0,0 +1,55 @@
1
+ // This file was automatically generated. DO NOT EDIT.
2
+ // If you have any remark or suggestion do not hesitate to open an issue.
3
+
4
+ const CreateDeploymentRequest = {
5
+ maxSize: {
6
+ greaterThanOrEqual: 1,
7
+ lessThanOrEqual: 50
8
+ },
9
+ minSize: {
10
+ greaterThanOrEqual: 1,
11
+ lessThanOrEqual: 50
12
+ },
13
+ modelName: {
14
+ maxLength: 255,
15
+ minLength: 0,
16
+ pattern: /^[\w-_]+\/[\w-_.]+(:[\w]+)?$/
17
+ },
18
+ name: {
19
+ maxLength: 255,
20
+ minLength: 1,
21
+ pattern: /^[A-Za-z0-9-_]+$/
22
+ },
23
+ nodeType: {
24
+ maxLength: 64,
25
+ minLength: 1
26
+ }
27
+ };
28
+ const ListDeploymentsRequest = {
29
+ name: {
30
+ maxLength: 255,
31
+ minLength: 1
32
+ }
33
+ };
34
+ const ListModelsRequest = {
35
+ name: {
36
+ maxLength: 255,
37
+ minLength: 1
38
+ }
39
+ };
40
+ const UpdateDeploymentRequest = {
41
+ maxSize: {
42
+ greaterThanOrEqual: 1,
43
+ lessThanOrEqual: 50
44
+ },
45
+ minSize: {
46
+ greaterThanOrEqual: 1,
47
+ lessThanOrEqual: 50
48
+ },
49
+ name: {
50
+ maxLength: 255,
51
+ minLength: 1
52
+ }
53
+ };
54
+
55
+ export { CreateDeploymentRequest, ListDeploymentsRequest, ListModelsRequest, UpdateDeploymentRequest };