@scaleway/sdk-searchdb 1.1.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.
- package/LICENSE +191 -0
- package/README.md +95 -0
- package/dist/index.gen.d.ts +5 -0
- package/dist/index.gen.js +4 -0
- package/dist/v1alpha1/api.gen.d.ts +135 -0
- package/dist/v1alpha1/api.gen.js +274 -0
- package/dist/v1alpha1/content.gen.d.ts +3 -0
- package/dist/v1alpha1/content.gen.js +11 -0
- package/dist/v1alpha1/index.gen.d.ts +5 -0
- package/dist/v1alpha1/index.gen.js +22 -0
- package/dist/v1alpha1/marshalling.gen.d.ts +15 -0
- package/dist/v1alpha1/marshalling.gen.js +251 -0
- package/dist/v1alpha1/types.gen.d.ts +553 -0
- package/dist/v1alpha1/validation-rules.gen.d.ts +117 -0
- package/dist/v1alpha1/validation-rules.gen.js +129 -0
- package/package.json +45 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { API as API$1, toApiLocality, validatePathParam, waitForResource, urlParams, enrichForPagination } from "@scaleway/sdk-client";
|
|
2
|
+
import { DEPLOYMENT_TRANSIENT_STATUSES } from "./content.gen.js";
|
|
3
|
+
import { marshalCreateDeploymentRequest, unmarshalDeployment, marshalUpdateDeploymentRequest, marshalUpgradeDeploymentRequest, unmarshalListDeploymentsResponse, unmarshalListVersionsResponse, unmarshalListNodeTypesResponse, marshalCreateEndpointRequest, unmarshalEndpoint, unmarshalListUsersResponse, marshalCreateUserRequest, unmarshalUser, marshalUpdateUserRequest } from "./marshalling.gen.js";
|
|
4
|
+
const jsonContentHeaders = {
|
|
5
|
+
"Content-Type": "application/json; charset=utf-8"
|
|
6
|
+
};
|
|
7
|
+
class API extends API$1 {
|
|
8
|
+
/**
|
|
9
|
+
* Locality of this API.
|
|
10
|
+
* type ∈ {'zone','region','global','unspecified'}
|
|
11
|
+
*/
|
|
12
|
+
static LOCALITY = toApiLocality({
|
|
13
|
+
regions: ["fr-par"]
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Create a new Cloud Essentials for OpenSearch deployment.
|
|
17
|
+
*
|
|
18
|
+
* @param request - The request {@link CreateDeploymentRequest}
|
|
19
|
+
* @returns A Promise of Deployment
|
|
20
|
+
*/
|
|
21
|
+
createDeployment = (request) => this.client.fetch(
|
|
22
|
+
{
|
|
23
|
+
body: JSON.stringify(
|
|
24
|
+
marshalCreateDeploymentRequest(request, this.client.settings)
|
|
25
|
+
),
|
|
26
|
+
headers: jsonContentHeaders,
|
|
27
|
+
method: "POST",
|
|
28
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments`
|
|
29
|
+
},
|
|
30
|
+
unmarshalDeployment
|
|
31
|
+
);
|
|
32
|
+
/**
|
|
33
|
+
* Update a Cloud Essentials for OpenSearch deployment.
|
|
34
|
+
*
|
|
35
|
+
* @param request - The request {@link UpdateDeploymentRequest}
|
|
36
|
+
* @returns A Promise of Deployment
|
|
37
|
+
*/
|
|
38
|
+
updateDeployment = (request) => this.client.fetch(
|
|
39
|
+
{
|
|
40
|
+
body: JSON.stringify(
|
|
41
|
+
marshalUpdateDeploymentRequest(request, this.client.settings)
|
|
42
|
+
),
|
|
43
|
+
headers: jsonContentHeaders,
|
|
44
|
+
method: "PATCH",
|
|
45
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}`
|
|
46
|
+
},
|
|
47
|
+
unmarshalDeployment
|
|
48
|
+
);
|
|
49
|
+
/**
|
|
50
|
+
* Upgrade a Cloud Essentials for OpenSearch deployment.
|
|
51
|
+
*
|
|
52
|
+
* @param request - The request {@link UpgradeDeploymentRequest}
|
|
53
|
+
* @returns A Promise of Deployment
|
|
54
|
+
*/
|
|
55
|
+
upgradeDeployment = (request) => this.client.fetch(
|
|
56
|
+
{
|
|
57
|
+
body: JSON.stringify(
|
|
58
|
+
marshalUpgradeDeploymentRequest(request, this.client.settings)
|
|
59
|
+
),
|
|
60
|
+
headers: jsonContentHeaders,
|
|
61
|
+
method: "POST",
|
|
62
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/upgrade`
|
|
63
|
+
},
|
|
64
|
+
unmarshalDeployment
|
|
65
|
+
);
|
|
66
|
+
/**
|
|
67
|
+
* Retrieve a specific Cloud Essentials for OpenSearch deployment.
|
|
68
|
+
*
|
|
69
|
+
* @param request - The request {@link GetDeploymentRequest}
|
|
70
|
+
* @returns A Promise of Deployment
|
|
71
|
+
*/
|
|
72
|
+
getDeployment = (request) => this.client.fetch(
|
|
73
|
+
{
|
|
74
|
+
method: "GET",
|
|
75
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}`
|
|
76
|
+
},
|
|
77
|
+
unmarshalDeployment
|
|
78
|
+
);
|
|
79
|
+
/**
|
|
80
|
+
* Waits for {@link Deployment} to be in a final state.
|
|
81
|
+
*
|
|
82
|
+
* @param request - The request {@link GetDeploymentRequest}
|
|
83
|
+
* @param options - The waiting options
|
|
84
|
+
* @returns A Promise of Deployment
|
|
85
|
+
*/
|
|
86
|
+
waitForDeployment = (request, options) => waitForResource(
|
|
87
|
+
options?.stop ?? ((res) => Promise.resolve(
|
|
88
|
+
!DEPLOYMENT_TRANSIENT_STATUSES.includes(res.status)
|
|
89
|
+
)),
|
|
90
|
+
this.getDeployment,
|
|
91
|
+
request,
|
|
92
|
+
options
|
|
93
|
+
);
|
|
94
|
+
/**
|
|
95
|
+
* Delete a Cloud Essentials for OpenSearch deployment.
|
|
96
|
+
*
|
|
97
|
+
* @param request - The request {@link DeleteDeploymentRequest}
|
|
98
|
+
* @returns A Promise of Deployment
|
|
99
|
+
*/
|
|
100
|
+
deleteDeployment = (request) => this.client.fetch(
|
|
101
|
+
{
|
|
102
|
+
method: "DELETE",
|
|
103
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}`
|
|
104
|
+
},
|
|
105
|
+
unmarshalDeployment
|
|
106
|
+
);
|
|
107
|
+
pageOfListDeployments = (request = {}) => this.client.fetch(
|
|
108
|
+
{
|
|
109
|
+
method: "GET",
|
|
110
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments`,
|
|
111
|
+
urlParams: urlParams(
|
|
112
|
+
["name", request.name],
|
|
113
|
+
["order_by", request.orderBy],
|
|
114
|
+
["organization_id", request.organizationId],
|
|
115
|
+
["page", request.page],
|
|
116
|
+
[
|
|
117
|
+
"page_size",
|
|
118
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
119
|
+
],
|
|
120
|
+
["project_id", request.projectId],
|
|
121
|
+
["tags", request.tags],
|
|
122
|
+
["version", request.version]
|
|
123
|
+
)
|
|
124
|
+
},
|
|
125
|
+
unmarshalListDeploymentsResponse
|
|
126
|
+
);
|
|
127
|
+
/**
|
|
128
|
+
* Retrieve a list of Cloud Essentials for OpenSearch deployments.
|
|
129
|
+
*
|
|
130
|
+
* @param request - The request {@link ListDeploymentsRequest}
|
|
131
|
+
* @returns A Promise of ListDeploymentsResponse
|
|
132
|
+
*/
|
|
133
|
+
listDeployments = (request = {}) => enrichForPagination("deployments", this.pageOfListDeployments, request);
|
|
134
|
+
pageOfListVersions = (request = {}) => this.client.fetch(
|
|
135
|
+
{
|
|
136
|
+
method: "GET",
|
|
137
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/versions`,
|
|
138
|
+
urlParams: urlParams(
|
|
139
|
+
["order_by", request.orderBy],
|
|
140
|
+
["page", request.page],
|
|
141
|
+
[
|
|
142
|
+
"page_size",
|
|
143
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
144
|
+
],
|
|
145
|
+
["version", request.version]
|
|
146
|
+
)
|
|
147
|
+
},
|
|
148
|
+
unmarshalListVersionsResponse
|
|
149
|
+
);
|
|
150
|
+
/**
|
|
151
|
+
* List available Cloud Essentials for OpenSearch versions.
|
|
152
|
+
*
|
|
153
|
+
* @param request - The request {@link ListVersionsRequest}
|
|
154
|
+
* @returns A Promise of ListVersionsResponse
|
|
155
|
+
*/
|
|
156
|
+
listVersions = (request = {}) => enrichForPagination("versions", this.pageOfListVersions, request);
|
|
157
|
+
pageOfListNodeTypes = (request = {}) => this.client.fetch(
|
|
158
|
+
{
|
|
159
|
+
method: "GET",
|
|
160
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/node-types`,
|
|
161
|
+
urlParams: urlParams(
|
|
162
|
+
["order_by", request.orderBy],
|
|
163
|
+
["page", request.page],
|
|
164
|
+
[
|
|
165
|
+
"page_size",
|
|
166
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
167
|
+
]
|
|
168
|
+
)
|
|
169
|
+
},
|
|
170
|
+
unmarshalListNodeTypesResponse
|
|
171
|
+
);
|
|
172
|
+
/**
|
|
173
|
+
* Retrieve a list of available node types.
|
|
174
|
+
*
|
|
175
|
+
* @param request - The request {@link ListNodeTypesRequest}
|
|
176
|
+
* @returns A Promise of ListNodeTypesResponse
|
|
177
|
+
*/
|
|
178
|
+
listNodeTypes = (request = {}) => enrichForPagination("nodeTypes", this.pageOfListNodeTypes, request);
|
|
179
|
+
/**
|
|
180
|
+
* Create a new endpoint on a deployment.
|
|
181
|
+
*
|
|
182
|
+
* @param request - The request {@link CreateEndpointRequest}
|
|
183
|
+
* @returns A Promise of Endpoint
|
|
184
|
+
*/
|
|
185
|
+
createEndpoint = (request) => this.client.fetch(
|
|
186
|
+
{
|
|
187
|
+
body: JSON.stringify(
|
|
188
|
+
marshalCreateEndpointRequest(request, this.client.settings)
|
|
189
|
+
),
|
|
190
|
+
headers: jsonContentHeaders,
|
|
191
|
+
method: "POST",
|
|
192
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints`
|
|
193
|
+
},
|
|
194
|
+
unmarshalEndpoint
|
|
195
|
+
);
|
|
196
|
+
/**
|
|
197
|
+
* Delete an existing endpoint.
|
|
198
|
+
*
|
|
199
|
+
* @param request - The request {@link DeleteEndpointRequest}
|
|
200
|
+
*/
|
|
201
|
+
deleteEndpoint = (request) => this.client.fetch({
|
|
202
|
+
method: "DELETE",
|
|
203
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
|
|
204
|
+
});
|
|
205
|
+
pageOfListUsers = (request) => this.client.fetch(
|
|
206
|
+
{
|
|
207
|
+
method: "GET",
|
|
208
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/users`,
|
|
209
|
+
urlParams: urlParams(
|
|
210
|
+
["name", request.name],
|
|
211
|
+
["order_by", request.orderBy],
|
|
212
|
+
["page", request.page],
|
|
213
|
+
[
|
|
214
|
+
"page_size",
|
|
215
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
216
|
+
]
|
|
217
|
+
)
|
|
218
|
+
},
|
|
219
|
+
unmarshalListUsersResponse
|
|
220
|
+
);
|
|
221
|
+
/**
|
|
222
|
+
* Retrieve a list of deployment users.
|
|
223
|
+
*
|
|
224
|
+
* @param request - The request {@link ListUsersRequest}
|
|
225
|
+
* @returns A Promise of ListUsersResponse
|
|
226
|
+
*/
|
|
227
|
+
listUsers = (request) => enrichForPagination("users", this.pageOfListUsers, request);
|
|
228
|
+
/**
|
|
229
|
+
* Create a new user.
|
|
230
|
+
*
|
|
231
|
+
* @param request - The request {@link CreateUserRequest}
|
|
232
|
+
* @returns A Promise of User
|
|
233
|
+
*/
|
|
234
|
+
createUser = (request) => this.client.fetch(
|
|
235
|
+
{
|
|
236
|
+
body: JSON.stringify(
|
|
237
|
+
marshalCreateUserRequest(request, this.client.settings)
|
|
238
|
+
),
|
|
239
|
+
headers: jsonContentHeaders,
|
|
240
|
+
method: "POST",
|
|
241
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/users`
|
|
242
|
+
},
|
|
243
|
+
unmarshalUser
|
|
244
|
+
);
|
|
245
|
+
/**
|
|
246
|
+
* Update an existing user.
|
|
247
|
+
*
|
|
248
|
+
* @param request - The request {@link UpdateUserRequest}
|
|
249
|
+
* @returns A Promise of User
|
|
250
|
+
*/
|
|
251
|
+
updateUser = (request) => this.client.fetch(
|
|
252
|
+
{
|
|
253
|
+
body: JSON.stringify(
|
|
254
|
+
marshalUpdateUserRequest(request, this.client.settings)
|
|
255
|
+
),
|
|
256
|
+
headers: jsonContentHeaders,
|
|
257
|
+
method: "PATCH",
|
|
258
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/users/${validatePathParam("username", request.username)}`
|
|
259
|
+
},
|
|
260
|
+
unmarshalUser
|
|
261
|
+
);
|
|
262
|
+
/**
|
|
263
|
+
* Delete an existing user.
|
|
264
|
+
*
|
|
265
|
+
* @param request - The request {@link DeleteUserRequest}
|
|
266
|
+
*/
|
|
267
|
+
deleteUser = (request) => this.client.fetch({
|
|
268
|
+
method: "DELETE",
|
|
269
|
+
path: `/searchdb/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/users/${validatePathParam("username", request.username)}`
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
export {
|
|
273
|
+
API
|
|
274
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { API } from './api.gen.js';
|
|
2
|
+
export * from './content.gen.js';
|
|
3
|
+
export * from './marshalling.gen.js';
|
|
4
|
+
export type { CreateDeploymentRequest, CreateEndpointRequest, CreateUserRequest, DeleteDeploymentRequest, DeleteEndpointRequest, DeleteUserRequest, Deployment, DeploymentStatus, Endpoint, EndpointPrivateNetworkDetails, EndpointPublicDetails, EndpointService, EndpointSpec, EndpointSpecPrivateNetworkDetails, EndpointSpecPublicDetails, GetDeploymentRequest, ListDeploymentsRequest, ListDeploymentsRequestOrderBy, ListDeploymentsResponse, ListNodeTypesRequest, ListNodeTypesRequestOrderBy, ListNodeTypesResponse, ListUsersRequest, ListUsersRequestOrderBy, ListUsersResponse, ListVersionsRequest, ListVersionsRequestOrderBy, ListVersionsResponse, NodeType, NodeTypeStockStatus, NodeTypeVolumeType, UpdateDeploymentRequest, UpdateUserRequest, UpgradeDeploymentRequest, User, Version, Volume, VolumeType, } from './types.gen.js';
|
|
5
|
+
export * as ValidationRules from './validation-rules.gen.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { API } from "./api.gen.js";
|
|
2
|
+
import { DEPLOYMENT_TRANSIENT_STATUSES } from "./content.gen.js";
|
|
3
|
+
import { marshalCreateDeploymentRequest, marshalCreateEndpointRequest, marshalCreateUserRequest, marshalUpdateDeploymentRequest, marshalUpdateUserRequest, marshalUpgradeDeploymentRequest, unmarshalDeployment, unmarshalEndpoint, unmarshalListDeploymentsResponse, unmarshalListNodeTypesResponse, unmarshalListUsersResponse, unmarshalListVersionsResponse, unmarshalUser } 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
|
+
marshalCreateDeploymentRequest,
|
|
10
|
+
marshalCreateEndpointRequest,
|
|
11
|
+
marshalCreateUserRequest,
|
|
12
|
+
marshalUpdateDeploymentRequest,
|
|
13
|
+
marshalUpdateUserRequest,
|
|
14
|
+
marshalUpgradeDeploymentRequest,
|
|
15
|
+
unmarshalDeployment,
|
|
16
|
+
unmarshalEndpoint,
|
|
17
|
+
unmarshalListDeploymentsResponse,
|
|
18
|
+
unmarshalListNodeTypesResponse,
|
|
19
|
+
unmarshalListUsersResponse,
|
|
20
|
+
unmarshalListVersionsResponse,
|
|
21
|
+
unmarshalUser
|
|
22
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DefaultValues } from '@scaleway/sdk-client';
|
|
2
|
+
import type { CreateDeploymentRequest, CreateEndpointRequest, CreateUserRequest, Deployment, Endpoint, ListDeploymentsResponse, ListNodeTypesResponse, ListUsersResponse, ListVersionsResponse, UpdateDeploymentRequest, UpdateUserRequest, UpgradeDeploymentRequest, User } from './types.gen.js';
|
|
3
|
+
export declare const unmarshalEndpoint: (data: unknown) => Endpoint;
|
|
4
|
+
export declare const unmarshalDeployment: (data: unknown) => Deployment;
|
|
5
|
+
export declare const unmarshalUser: (data: unknown) => User;
|
|
6
|
+
export declare const unmarshalListDeploymentsResponse: (data: unknown) => ListDeploymentsResponse;
|
|
7
|
+
export declare const unmarshalListNodeTypesResponse: (data: unknown) => ListNodeTypesResponse;
|
|
8
|
+
export declare const unmarshalListUsersResponse: (data: unknown) => ListUsersResponse;
|
|
9
|
+
export declare const unmarshalListVersionsResponse: (data: unknown) => ListVersionsResponse;
|
|
10
|
+
export declare const marshalCreateDeploymentRequest: (request: CreateDeploymentRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
11
|
+
export declare const marshalCreateEndpointRequest: (request: CreateEndpointRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
12
|
+
export declare const marshalCreateUserRequest: (request: CreateUserRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
13
|
+
export declare const marshalUpdateDeploymentRequest: (request: UpdateDeploymentRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
14
|
+
export declare const marshalUpdateUserRequest: (request: UpdateUserRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
15
|
+
export declare const marshalUpgradeDeploymentRequest: (request: UpgradeDeploymentRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { resolveOneOf, isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
|
|
2
|
+
const unmarshalEndpointPrivateNetworkDetails = (data) => {
|
|
3
|
+
if (!isJSONObject(data)) {
|
|
4
|
+
throw new TypeError(
|
|
5
|
+
`Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
|
|
6
|
+
);
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
privateNetworkId: data.private_network_id
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const unmarshalEndpointPublicDetails = (data) => {
|
|
13
|
+
if (!isJSONObject(data)) {
|
|
14
|
+
throw new TypeError(
|
|
15
|
+
`Unmarshalling the type 'EndpointPublicDetails' failed as data isn't a dictionary.`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
return {};
|
|
19
|
+
};
|
|
20
|
+
const unmarshalEndpointService = (data) => {
|
|
21
|
+
if (!isJSONObject(data)) {
|
|
22
|
+
throw new TypeError(
|
|
23
|
+
`Unmarshalling the type 'EndpointService' failed as data isn't a dictionary.`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
name: data.name,
|
|
28
|
+
port: data.port,
|
|
29
|
+
url: data.url
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const unmarshalEndpoint = (data) => {
|
|
33
|
+
if (!isJSONObject(data)) {
|
|
34
|
+
throw new TypeError(
|
|
35
|
+
`Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
dnsRecord: data.dns_record,
|
|
40
|
+
id: data.id,
|
|
41
|
+
privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
|
|
42
|
+
public: data.public ? unmarshalEndpointPublicDetails(data.public) : void 0,
|
|
43
|
+
services: unmarshalArrayOfObject(data.services, unmarshalEndpointService)
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const unmarshalVolume = (data) => {
|
|
47
|
+
if (!isJSONObject(data)) {
|
|
48
|
+
throw new TypeError(
|
|
49
|
+
`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
sizeBytes: data.size_bytes,
|
|
54
|
+
type: data.type
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const unmarshalDeployment = (data) => {
|
|
58
|
+
if (!isJSONObject(data)) {
|
|
59
|
+
throw new TypeError(
|
|
60
|
+
`Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
createdAt: unmarshalDate(data.created_at),
|
|
65
|
+
endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
|
|
66
|
+
id: data.id,
|
|
67
|
+
name: data.name,
|
|
68
|
+
nodeAmount: data.node_amount,
|
|
69
|
+
nodeType: data.node_type,
|
|
70
|
+
organizationId: data.organization_id,
|
|
71
|
+
projectId: data.project_id,
|
|
72
|
+
region: data.region,
|
|
73
|
+
status: data.status,
|
|
74
|
+
tags: data.tags,
|
|
75
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
76
|
+
version: data.version,
|
|
77
|
+
volume: data.volume ? unmarshalVolume(data.volume) : void 0
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
const unmarshalUser = (data) => {
|
|
81
|
+
if (!isJSONObject(data)) {
|
|
82
|
+
throw new TypeError(
|
|
83
|
+
`Unmarshalling the type 'User' failed as data isn't a dictionary.`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
username: data.username
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
const unmarshalListDeploymentsResponse = (data) => {
|
|
91
|
+
if (!isJSONObject(data)) {
|
|
92
|
+
throw new TypeError(
|
|
93
|
+
`Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
deployments: unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
|
|
98
|
+
totalCount: data.total_count
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
const unmarshalNodeTypeVolumeType = (data) => {
|
|
102
|
+
if (!isJSONObject(data)) {
|
|
103
|
+
throw new TypeError(
|
|
104
|
+
`Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary.`
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
chunkSizeBytes: data.chunk_size_bytes,
|
|
109
|
+
description: data.description,
|
|
110
|
+
maxSizeBytes: data.max_size_bytes,
|
|
111
|
+
minSizeBytes: data.min_size_bytes,
|
|
112
|
+
type: data.type
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
const unmarshalNodeType = (data) => {
|
|
116
|
+
if (!isJSONObject(data)) {
|
|
117
|
+
throw new TypeError(
|
|
118
|
+
`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
availableVolumeTypes: unmarshalArrayOfObject(
|
|
123
|
+
data.available_volume_types,
|
|
124
|
+
unmarshalNodeTypeVolumeType
|
|
125
|
+
),
|
|
126
|
+
beta: data.beta,
|
|
127
|
+
description: data.description,
|
|
128
|
+
disabled: data.disabled,
|
|
129
|
+
instanceRange: data.instance_range,
|
|
130
|
+
memoryBytes: data.memory_bytes,
|
|
131
|
+
name: data.name,
|
|
132
|
+
stockStatus: data.stock_status,
|
|
133
|
+
vcpus: data.vcpus
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
const unmarshalListNodeTypesResponse = (data) => {
|
|
137
|
+
if (!isJSONObject(data)) {
|
|
138
|
+
throw new TypeError(
|
|
139
|
+
`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
|
|
144
|
+
totalCount: data.total_count
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
const unmarshalListUsersResponse = (data) => {
|
|
148
|
+
if (!isJSONObject(data)) {
|
|
149
|
+
throw new TypeError(
|
|
150
|
+
`Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary.`
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
totalCount: data.total_count,
|
|
155
|
+
users: unmarshalArrayOfObject(data.users, unmarshalUser)
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
const unmarshalVersion = (data) => {
|
|
159
|
+
if (!isJSONObject(data)) {
|
|
160
|
+
throw new TypeError(
|
|
161
|
+
`Unmarshalling the type 'Version' failed as data isn't a dictionary.`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
beta: data.beta,
|
|
166
|
+
disabled: data.disabled,
|
|
167
|
+
endOfLife: unmarshalDate(data.end_of_life),
|
|
168
|
+
version: data.version
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
const unmarshalListVersionsResponse = (data) => {
|
|
172
|
+
if (!isJSONObject(data)) {
|
|
173
|
+
throw new TypeError(
|
|
174
|
+
`Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
totalCount: data.total_count,
|
|
179
|
+
versions: unmarshalArrayOfObject(data.versions, unmarshalVersion)
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
const marshalEndpointSpecPrivateNetworkDetails = (request, defaults) => ({
|
|
183
|
+
private_network_id: request.privateNetworkId
|
|
184
|
+
});
|
|
185
|
+
const marshalEndpointSpecPublicDetails = (request, defaults) => ({});
|
|
186
|
+
const marshalEndpointSpec = (request, defaults) => ({
|
|
187
|
+
...resolveOneOf([
|
|
188
|
+
{
|
|
189
|
+
param: "public",
|
|
190
|
+
value: request.public !== void 0 ? marshalEndpointSpecPublicDetails(request.public) : void 0
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
param: "private_network",
|
|
194
|
+
value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetworkDetails(
|
|
195
|
+
request.privateNetwork
|
|
196
|
+
) : void 0
|
|
197
|
+
}
|
|
198
|
+
])
|
|
199
|
+
});
|
|
200
|
+
const marshalVolume = (request, defaults) => ({
|
|
201
|
+
size_bytes: request.sizeBytes,
|
|
202
|
+
type: request.type
|
|
203
|
+
});
|
|
204
|
+
const marshalCreateDeploymentRequest = (request, defaults) => ({
|
|
205
|
+
endpoints: request.endpoints !== void 0 ? request.endpoints.map((elt) => marshalEndpointSpec(elt)) : void 0,
|
|
206
|
+
name: request.name,
|
|
207
|
+
node_amount: request.nodeAmount,
|
|
208
|
+
node_type: request.nodeType,
|
|
209
|
+
password: request.password,
|
|
210
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
211
|
+
tags: request.tags,
|
|
212
|
+
user_name: request.userName,
|
|
213
|
+
version: request.version,
|
|
214
|
+
volume: request.volume !== void 0 ? marshalVolume(request.volume) : void 0
|
|
215
|
+
});
|
|
216
|
+
const marshalCreateEndpointRequest = (request, defaults) => ({
|
|
217
|
+
deployment_id: request.deploymentId,
|
|
218
|
+
endpoint_spec: request.endpointSpec !== void 0 ? marshalEndpointSpec(request.endpointSpec) : void 0
|
|
219
|
+
});
|
|
220
|
+
const marshalCreateUserRequest = (request, defaults) => ({
|
|
221
|
+
password: request.password,
|
|
222
|
+
username: request.username
|
|
223
|
+
});
|
|
224
|
+
const marshalUpdateDeploymentRequest = (request, defaults) => ({
|
|
225
|
+
name: request.name,
|
|
226
|
+
tags: request.tags
|
|
227
|
+
});
|
|
228
|
+
const marshalUpdateUserRequest = (request, defaults) => ({
|
|
229
|
+
password: request.password
|
|
230
|
+
});
|
|
231
|
+
const marshalUpgradeDeploymentRequest = (request, defaults) => ({
|
|
232
|
+
...resolveOneOf([
|
|
233
|
+
{ param: "node_amount", value: request.nodeAmount },
|
|
234
|
+
{ param: "volume_size_bytes", value: request.volumeSizeBytes }
|
|
235
|
+
])
|
|
236
|
+
});
|
|
237
|
+
export {
|
|
238
|
+
marshalCreateDeploymentRequest,
|
|
239
|
+
marshalCreateEndpointRequest,
|
|
240
|
+
marshalCreateUserRequest,
|
|
241
|
+
marshalUpdateDeploymentRequest,
|
|
242
|
+
marshalUpdateUserRequest,
|
|
243
|
+
marshalUpgradeDeploymentRequest,
|
|
244
|
+
unmarshalDeployment,
|
|
245
|
+
unmarshalEndpoint,
|
|
246
|
+
unmarshalListDeploymentsResponse,
|
|
247
|
+
unmarshalListNodeTypesResponse,
|
|
248
|
+
unmarshalListUsersResponse,
|
|
249
|
+
unmarshalListVersionsResponse,
|
|
250
|
+
unmarshalUser
|
|
251
|
+
};
|