@scaleway/sdk 2.5.0 → 2.7.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/dist/api/account/v2/api.gen.js +26 -74
- package/dist/api/account/v3/api.gen.js +20 -60
- package/dist/api/applesilicon/v1alpha1/api.gen.js +16 -56
- package/dist/api/baremetal/v1/api.gen.js +36 -132
- package/dist/api/billing/v2alpha1/api.gen.js +17 -57
- package/dist/api/block/v1alpha1/api.gen.js +19 -67
- package/dist/api/block/v1alpha1/marshalling.gen.js +1 -0
- package/dist/api/cockpit/v1beta1/api.gen.js +95 -279
- package/dist/api/container/v1beta1/api.gen.js +51 -123
- package/dist/api/document_db/v1beta1/api.gen.js +18 -66
- package/dist/api/document_db/v1beta1/marshalling.gen.js +20 -1
- package/dist/api/domain/v2beta1/api.gen.js +36 -124
- package/dist/api/flexibleip/v1alpha1/api.gen.js +6 -22
- package/dist/api/function/v1beta1/api.gen.js +55 -135
- package/dist/api/iam/v1alpha1/api.gen.js +66 -226
- package/dist/api/instance/v1/api.gen.js +156 -325
- package/dist/api/instance/v1/api.utils.js +0 -126
- package/dist/api/instance/v1/marshalling.gen.js +99 -51
- package/dist/api/iot/v1/api.gen.js +24 -88
- package/dist/api/ipam/v1/api.gen.js +12 -28
- package/dist/api/ipfs/v1alpha1/api.gen.js +12 -44
- package/dist/api/jobs/v1alpha1/api.gen.js +13 -58
- package/dist/api/jobs/v1alpha1/marshalling.gen.js +2 -0
- package/dist/api/k8s/v1/api.gen.js +16 -56
- package/dist/api/k8s/v1/marshalling.gen.js +1 -0
- package/dist/api/lb/v1/api.gen.js +72 -248
- package/dist/api/marketplace/v1/api.gen.js +7 -31
- package/dist/api/marketplace/v1/marshalling.gen.js +1 -18
- package/dist/api/marketplace/v2/api.gen.js +21 -53
- package/dist/api/mnq/v1beta1/api.gen.js +76 -212
- package/dist/api/rdb/v1/api.gen.js +24 -88
- package/dist/api/rdb/v1/marshalling.gen.js +11 -1
- package/dist/api/redis/v1/api.gen.js +6 -22
- package/dist/api/registry/v1/api.gen.js +12 -44
- package/dist/api/secret/v1alpha1/api.gen.js +18 -66
- package/dist/api/serverless_sqldb/index.js +2 -0
- package/dist/api/serverless_sqldb/v1alpha1/api.gen.js +162 -0
- package/dist/api/serverless_sqldb/v1alpha1/content.gen.js +7 -0
- package/dist/api/serverless_sqldb/v1alpha1/index.gen.js +7 -0
- package/dist/api/serverless_sqldb/v1alpha1/marshalling.gen.js +77 -0
- package/dist/api/serverless_sqldb/v1alpha1/validation-rules.gen.js +60 -0
- package/dist/api/tem/v1alpha1/api.gen.js +17 -57
- package/dist/api/test/v1/api.gen.js +6 -22
- package/dist/api/vpc/v1/api.gen.js +12 -36
- package/dist/api/vpc/v2/api.gen.js +30 -86
- package/dist/api/vpcgw/v1/api.gen.js +46 -158
- package/dist/api/webhosting/v1alpha1/api.gen.js +12 -44
- package/dist/helpers/marshalling.js +8 -23
- package/dist/index.cjs +1066 -821
- package/dist/index.d.ts +2191 -1780
- package/dist/index.js +12 -10
- package/dist/internal/async/interval-retrier.js +8 -16
- package/dist/internal/interceptors/helpers.js +3 -4
- package/dist/internal/logger/console-logger.js +1 -7
- package/dist/internal/logger/index.js +1 -9
- package/dist/scw/auth.js +1 -2
- package/dist/scw/client.js +2 -10
- package/dist/scw/constants.js +1 -1
- package/dist/scw/errors/non-standard/invalid-request-mapper.js +5 -8
- package/dist/scw/errors/scw-error.js +2 -9
- package/dist/scw/errors/standard/permissions-denied-error.js +4 -7
- package/dist/scw/fetch/build-fetcher.js +1 -4
- package/dist/scw/fetch/http-dumper.js +1 -4
- package/dist/scw/fetch/http-interceptors.js +18 -31
- package/dist/scw/fetch/resource-paginator.js +3 -17
- package/package.json +2 -2
- package/dist/api/instance/v1/marshalling.utils.js +0 -63
package/dist/index.js
CHANGED
|
@@ -61,15 +61,17 @@ import * as index$o from './api/registry/index.js';
|
|
|
61
61
|
export { index$o as Registry };
|
|
62
62
|
import * as index$p from './api/secret/index.js';
|
|
63
63
|
export { index$p as Secret };
|
|
64
|
+
import * as index$q from './api/serverless_sqldb/index.js';
|
|
65
|
+
export { index$q as ServerlessSQLDB };
|
|
64
66
|
import * as index_gen from './api/std/index.gen.js';
|
|
65
67
|
export { index_gen as Std };
|
|
66
|
-
import * as index$
|
|
67
|
-
export { index$
|
|
68
|
-
import * as index$
|
|
69
|
-
export { index$
|
|
70
|
-
import * as index$
|
|
71
|
-
export { index$
|
|
72
|
-
import * as index$
|
|
73
|
-
export { index$
|
|
74
|
-
import * as index$
|
|
75
|
-
export { index$
|
|
68
|
+
import * as index$r from './api/test/index.js';
|
|
69
|
+
export { index$r as Test };
|
|
70
|
+
import * as index$s from './api/tem/index.js';
|
|
71
|
+
export { index$s as TransactionalEmail };
|
|
72
|
+
import * as index$t from './api/vpc/index.js';
|
|
73
|
+
export { index$t as VPC };
|
|
74
|
+
import * as index$u from './api/vpcgw/index.js';
|
|
75
|
+
export { index$u as VPCGW };
|
|
76
|
+
import * as index$v from './api/webhosting/index.js';
|
|
77
|
+
export { index$v as Webhosting };
|
|
@@ -42,10 +42,7 @@ function* createExponentialBackoffStrategy(minDelay, maxDelay) {
|
|
|
42
42
|
*
|
|
43
43
|
* @internal
|
|
44
44
|
*/
|
|
45
|
-
const tryAtIntervals = async
|
|
46
|
-
if (timeout === void 0) {
|
|
47
|
-
timeout = DEFAULT_TIMEOUT_SECONDS;
|
|
48
|
-
}
|
|
45
|
+
const tryAtIntervals = async (retry, strategy, timeout = DEFAULT_TIMEOUT_SECONDS) => {
|
|
49
46
|
const timeoutTimestamp = Date.now() + timeout * 1000;
|
|
50
47
|
let retryCount = 0;
|
|
51
48
|
while (Date.now() <= timeoutTimestamp) {
|
|
@@ -89,17 +86,12 @@ const tryAtIntervals = async function (retry, strategy, timeout) {
|
|
|
89
86
|
*
|
|
90
87
|
* @public
|
|
91
88
|
*/
|
|
92
|
-
const waitForResource =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
done: await stop(value),
|
|
100
|
-
value
|
|
101
|
-
};
|
|
102
|
-
}, strategy, options?.timeout);
|
|
103
|
-
};
|
|
89
|
+
const waitForResource = (stop, fetcher, request, options, strategy = createExponentialBackoffStrategy(options?.minDelay ?? DEFAULT_MIN_DELAY_SECONDS, options?.maxDelay ?? DEFAULT_MAX_DELAY_SECONDS)) => tryAtIntervals(async () => {
|
|
90
|
+
const value = await fetcher(request);
|
|
91
|
+
return {
|
|
92
|
+
done: await stop(value),
|
|
93
|
+
value
|
|
94
|
+
};
|
|
95
|
+
}, strategy, options?.timeout);
|
|
104
96
|
|
|
105
97
|
export { createExponentialBackoffStrategy, tryAtIntervals, waitForResource };
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
const addHeaderInterceptor = (key, value) =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = _ref;
|
|
10
|
+
const addHeaderInterceptor = (key, value) => ({
|
|
11
|
+
request
|
|
12
|
+
}) => {
|
|
14
13
|
const clone = request.clone();
|
|
15
14
|
if (value !== undefined) {
|
|
16
15
|
clone.headers.append(key, value);
|
|
@@ -10,13 +10,7 @@ import { LevelResolver, shouldLog } from './level-resolver.js';
|
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
12
|
class ConsoleLogger {
|
|
13
|
-
constructor(logLevel, prefix, output) {
|
|
14
|
-
if (prefix === void 0) {
|
|
15
|
-
prefix = '';
|
|
16
|
-
}
|
|
17
|
-
if (output === void 0) {
|
|
18
|
-
output = console;
|
|
19
|
-
}
|
|
13
|
+
constructor(logLevel, prefix = '', output = console) {
|
|
20
14
|
this.logLevel = logLevel;
|
|
21
15
|
this.prefix = prefix;
|
|
22
16
|
this.output = output;
|
|
@@ -21,15 +21,7 @@ const setLogger = logger => {
|
|
|
21
21
|
*
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
|
-
const enableConsoleLogger =
|
|
25
|
-
if (logLevel === void 0) {
|
|
26
|
-
logLevel = 'warn';
|
|
27
|
-
}
|
|
28
|
-
if (prefix === void 0) {
|
|
29
|
-
prefix = 'scaleway-sdk-js:';
|
|
30
|
-
}
|
|
31
|
-
return setLogger(new ConsoleLogger(logLevel, prefix));
|
|
32
|
-
};
|
|
24
|
+
const enableConsoleLogger = (logLevel = 'warn', prefix = 'scaleway-sdk-js:') => setLogger(new ConsoleLogger(logLevel, prefix));
|
|
33
25
|
|
|
34
26
|
/**
|
|
35
27
|
* Returns the active SDK logger.
|
package/dist/scw/auth.js
CHANGED
|
@@ -58,8 +58,7 @@ const obfuscateUUID = key => `${key.substring(0, 8)}-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
|
58
58
|
*
|
|
59
59
|
* @internal
|
|
60
60
|
*/
|
|
61
|
-
const obfuscateAuthHeadersEntry =
|
|
62
|
-
let [name, value] = _ref;
|
|
61
|
+
const obfuscateAuthHeadersEntry = ([name, value]) => {
|
|
63
62
|
if (name === SESSION_HEADER_KEY) return [name, obfuscateToken(value)];
|
|
64
63
|
if (name === AUTH_HEADER_KEY) return [name, obfuscateUUID(value)];
|
|
65
64
|
return [name, value];
|
package/dist/scw/client.js
CHANGED
|
@@ -40,10 +40,7 @@ const DEFAULT_SETTINGS = {
|
|
|
40
40
|
*
|
|
41
41
|
* @public
|
|
42
42
|
*/
|
|
43
|
-
const createAdvancedClient =
|
|
44
|
-
for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
45
|
-
configs[_key] = arguments[_key];
|
|
46
|
-
}
|
|
43
|
+
const createAdvancedClient = (...configs) => {
|
|
47
44
|
const settings = configs.concat([withLegacyInterceptors()]).reduce((currentSettings, config) => config(currentSettings), DEFAULT_SETTINGS);
|
|
48
45
|
assertValidSettings(settings);
|
|
49
46
|
getLogger().info(`init Scaleway SDK version ${version}`);
|
|
@@ -88,11 +85,6 @@ const createAdvancedClient = function () {
|
|
|
88
85
|
*
|
|
89
86
|
* @public
|
|
90
87
|
*/
|
|
91
|
-
const createClient =
|
|
92
|
-
if (profile === void 0) {
|
|
93
|
-
profile = {};
|
|
94
|
-
}
|
|
95
|
-
return createAdvancedClient(withProfile(profile));
|
|
96
|
-
};
|
|
88
|
+
const createClient = (profile = {}) => createAdvancedClient(withProfile(profile));
|
|
97
89
|
|
|
98
90
|
export { createAdvancedClient, createClient };
|
package/dist/scw/constants.js
CHANGED
|
@@ -20,14 +20,11 @@ class InvalidRequestMapper {
|
|
|
20
20
|
const fields = obj.fields && isRecordOfStringArray(obj.fields) ? obj.fields : {};
|
|
21
21
|
const fieldsMessages = Object.entries(fields);
|
|
22
22
|
if (fieldsMessages.length) {
|
|
23
|
-
return new InvalidArgumentsError(status, obj, fieldsMessages.map(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
reason: 'constraint'
|
|
29
|
-
}));
|
|
30
|
-
}).flat());
|
|
23
|
+
return new InvalidArgumentsError(status, obj, fieldsMessages.map(([argumentName, messages]) => messages.map(helpMessage => ({
|
|
24
|
+
argumentName,
|
|
25
|
+
helpMessage,
|
|
26
|
+
reason: 'constraint'
|
|
27
|
+
}))).flat());
|
|
31
28
|
}
|
|
32
29
|
return new ScalewayError(status, obj);
|
|
33
30
|
}
|
|
@@ -22,10 +22,7 @@ const buildDefaultMessage = (status, body) => {
|
|
|
22
22
|
message.push(body.message);
|
|
23
23
|
}
|
|
24
24
|
if (body.fields && isRecordOfStringArray(body.fields)) {
|
|
25
|
-
message.push(Object.entries(body.fields).map(
|
|
26
|
-
let [name, list] = _ref;
|
|
27
|
-
return `${name} (${list.join(', ')})`;
|
|
28
|
-
}).join(', '));
|
|
25
|
+
message.push(Object.entries(body.fields).map(([name, list]) => `${name} (${list.join(', ')})`).join(', '));
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
28
|
return message.join(': ');
|
|
@@ -42,10 +39,7 @@ class ScalewayError extends Error {
|
|
|
42
39
|
constructor( /** The response status. */
|
|
43
40
|
status, /** The response payload. */
|
|
44
41
|
body, /** The augmented message. */
|
|
45
|
-
message) {
|
|
46
|
-
if (message === void 0) {
|
|
47
|
-
message = buildDefaultMessage(status, body);
|
|
48
|
-
}
|
|
42
|
+
message = buildDefaultMessage(status, body)) {
|
|
49
43
|
super(message); // 'Error' breaks prototype chain here
|
|
50
44
|
this.status = status;
|
|
51
45
|
this.body = body;
|
|
@@ -54,7 +48,6 @@ class ScalewayError extends Error {
|
|
|
54
48
|
this.rawMessage = typeof body === 'object' && typeof body.message === 'string' ? body.message : undefined;
|
|
55
49
|
Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
|
|
56
50
|
}
|
|
57
|
-
|
|
58
51
|
static fromJSON(status, obj) {
|
|
59
52
|
return new ScalewayError(status, obj);
|
|
60
53
|
}
|
|
@@ -15,13 +15,10 @@ import { ScalewayError } from '../scw-error.js';
|
|
|
15
15
|
*
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
|
-
const buildMessage = list => `insufficient permissions: ${list.map(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = _ref;
|
|
23
|
-
return `${action} ${resource}`;
|
|
24
|
-
}).join('; ')}`;
|
|
18
|
+
const buildMessage = list => `insufficient permissions: ${list.map(({
|
|
19
|
+
action,
|
|
20
|
+
resource
|
|
21
|
+
}) => `${action} ${resource}`).join('; ')}`;
|
|
25
22
|
|
|
26
23
|
/**
|
|
27
24
|
* PermissionsDenied error happens when one or many permissions are not accorded to the user making the request.
|
|
@@ -47,10 +47,7 @@ const buildFetcher = (settings, httpClient) => {
|
|
|
47
47
|
const prepareRequest = requestId => composeRequestInterceptors([...settings.interceptors.map(obj => obj.request).filter(obj => obj), logRequest(requestId, obfuscateInterceptor(obfuscateAuthHeadersEntry))]);
|
|
48
48
|
const prepareResponse = requestId => composeResponseInterceptors([...settings.interceptors.map(obj => obj.response).filter(obj => obj), logResponse(requestId)]);
|
|
49
49
|
const prepareResponseErrors = () => composeResponseErrorInterceptors(settings.interceptors.map(obj => obj.responseError).filter(obj => obj));
|
|
50
|
-
return async
|
|
51
|
-
if (unwrapper === void 0) {
|
|
52
|
-
unwrapper = asIs;
|
|
53
|
-
}
|
|
50
|
+
return async (request, unwrapper = asIs) => {
|
|
54
51
|
const requestId = `${requestNumber += 1}`;
|
|
55
52
|
const reqInterceptors = prepareRequest(requestId);
|
|
56
53
|
const finalRequest = await reqInterceptors(buildRequest(request, settings));
|
|
@@ -16,10 +16,7 @@ const toPascalCase = str => str.replace(/\w+/g, word => `${word[0].toUpperCase()
|
|
|
16
16
|
*
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
|
-
const serializeHeadersEntry =
|
|
20
|
-
let [name, value] = _ref;
|
|
21
|
-
return `${toPascalCase(name)}: ${value}`;
|
|
22
|
-
};
|
|
19
|
+
const serializeHeadersEntry = ([name, value]) => `${toPascalCase(name)}: ${value}`;
|
|
23
20
|
|
|
24
21
|
/**
|
|
25
22
|
* Converts Headers to safe to log strings (with obfuscated auth secrets).
|
|
@@ -35,18 +35,12 @@ class ObfuscatedRequest extends Request {
|
|
|
35
35
|
*
|
|
36
36
|
* @internal
|
|
37
37
|
*/
|
|
38
|
-
const obfuscateInterceptor = obfuscate =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
const identity = _ref2 => {
|
|
45
|
-
let {
|
|
46
|
-
request
|
|
47
|
-
} = _ref2;
|
|
48
|
-
return request;
|
|
49
|
-
};
|
|
38
|
+
const obfuscateInterceptor = obfuscate => ({
|
|
39
|
+
request
|
|
40
|
+
}) => new ObfuscatedRequest(request, obfuscate);
|
|
41
|
+
const identity = ({
|
|
42
|
+
request
|
|
43
|
+
}) => request;
|
|
50
44
|
|
|
51
45
|
/**
|
|
52
46
|
* Creates an interceptor to log the requests.
|
|
@@ -57,23 +51,17 @@ const identity = _ref2 => {
|
|
|
57
51
|
*
|
|
58
52
|
* @internal
|
|
59
53
|
*/
|
|
60
|
-
const logRequest =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
let {
|
|
66
|
-
request
|
|
67
|
-
} = _ref3;
|
|
68
|
-
if (shouldLog(LevelResolver[getLogger().logLevel], 'debug')) {
|
|
69
|
-
getLogger().debug(`--------------- Scaleway SDK REQUEST ${identifier} ---------------
|
|
54
|
+
const logRequest = (identifier, obfuscate = identity) => async ({
|
|
55
|
+
request
|
|
56
|
+
}) => {
|
|
57
|
+
if (shouldLog(LevelResolver[getLogger().logLevel], 'debug')) {
|
|
58
|
+
getLogger().debug(`--------------- Scaleway SDK REQUEST ${identifier} ---------------
|
|
70
59
|
${await dumpRequest(await obfuscate({
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
request
|
|
61
|
+
}))}
|
|
73
62
|
---------------------------------------------------------`);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
63
|
+
}
|
|
64
|
+
return request;
|
|
77
65
|
};
|
|
78
66
|
|
|
79
67
|
/**
|
|
@@ -84,10 +72,9 @@ ${await dumpRequest(await obfuscate({
|
|
|
84
72
|
*
|
|
85
73
|
* @internal
|
|
86
74
|
*/
|
|
87
|
-
const logResponse = identifier => async
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} = _ref4;
|
|
75
|
+
const logResponse = identifier => async ({
|
|
76
|
+
response
|
|
77
|
+
}) => {
|
|
91
78
|
if (shouldLog(LevelResolver[getLogger().logLevel], 'debug')) {
|
|
92
79
|
getLogger().debug(`--------------- Scaleway SDK RESPONSE ${identifier} ---------------
|
|
93
80
|
${await dumpResponse(response)}
|
|
@@ -34,17 +34,8 @@ function* pages(key, fetcher, request, firstPage) {
|
|
|
34
34
|
* @param initial - The first page
|
|
35
35
|
* @returns An async generator of resources arrays
|
|
36
36
|
*/
|
|
37
|
-
function fetchPaginated(key, fetcher, request, initial) {
|
|
38
|
-
|
|
39
|
-
if (initial === void 0) {
|
|
40
|
-
initial = fetcher(request);
|
|
41
|
-
}
|
|
42
|
-
return async function* () {
|
|
43
|
-
yield* pages(key, fetcher, request, await initial);
|
|
44
|
-
}();
|
|
45
|
-
} catch (e) {
|
|
46
|
-
return Promise.reject(e);
|
|
47
|
-
}
|
|
37
|
+
async function* fetchPaginated(key, fetcher, request, initial = fetcher(request)) {
|
|
38
|
+
yield* pages(key, fetcher, request, await initial);
|
|
48
39
|
}
|
|
49
40
|
|
|
50
41
|
/**
|
|
@@ -56,12 +47,7 @@ function fetchPaginated(key, fetcher, request, initial) {
|
|
|
56
47
|
* @param initial - The first page
|
|
57
48
|
* @returns A resources array Promise
|
|
58
49
|
*/
|
|
59
|
-
const fetchAll = async
|
|
60
|
-
if (initial === void 0) {
|
|
61
|
-
initial = fetcher(request);
|
|
62
|
-
}
|
|
63
|
-
return (await Promise.all(Array.from(pages(key, fetcher, request, await initial)))).flat();
|
|
64
|
-
};
|
|
50
|
+
const fetchAll = async (key, fetcher, request, initial = fetcher(request)) => (await Promise.all(Array.from(pages(key, fetcher, request, await initial)))).flat();
|
|
65
51
|
|
|
66
52
|
/**
|
|
67
53
|
* Enriches a listing method with helpers.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Scaleway SDK.",
|
|
6
6
|
"keywords": [
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"bundledDependencies": [
|
|
36
36
|
"@scaleway/random-name"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "75dfdca7bebe465fdc713443420722f20a826dc5"
|
|
39
39
|
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const marshalVolumeSummary = (request, defaults) => ({
|
|
2
|
-
id: request.id,
|
|
3
|
-
name: request.name,
|
|
4
|
-
size: request.size,
|
|
5
|
-
volume_type: request.volumeType
|
|
6
|
-
});
|
|
7
|
-
const marshalServerSummary = (request, defaults) => ({
|
|
8
|
-
id: request.id,
|
|
9
|
-
name: request.name
|
|
10
|
-
});
|
|
11
|
-
const marshalBootscript = (request, defaults) => ({
|
|
12
|
-
arch: request.arch,
|
|
13
|
-
bootcmdargs: request.bootcmdargs,
|
|
14
|
-
default: request.default,
|
|
15
|
-
dtb: request.dtb,
|
|
16
|
-
id: request.id,
|
|
17
|
-
initrd: request.initrd,
|
|
18
|
-
kernel: request.kernel,
|
|
19
|
-
organization: request.organization,
|
|
20
|
-
project: request.project,
|
|
21
|
-
public: request.public,
|
|
22
|
-
title: request.title,
|
|
23
|
-
zone: request.zone
|
|
24
|
-
});
|
|
25
|
-
const marshalVolume = (request, defaults) => ({
|
|
26
|
-
creation_date: request.creationDate,
|
|
27
|
-
export_uri: request.exportUri,
|
|
28
|
-
id: request.id,
|
|
29
|
-
modification_date: request.modificationDate,
|
|
30
|
-
name: request.name,
|
|
31
|
-
organization: request.organization,
|
|
32
|
-
project: request.project,
|
|
33
|
-
server: request.server ? marshalServerSummary(request.server) : undefined,
|
|
34
|
-
size: request.size,
|
|
35
|
-
state: request.state,
|
|
36
|
-
tags: request.tags,
|
|
37
|
-
volume_type: request.volumeType,
|
|
38
|
-
zone: request.zone
|
|
39
|
-
});
|
|
40
|
-
const marshalSetImageRequestWithID = (request, defaults) => ({
|
|
41
|
-
arch: request.arch,
|
|
42
|
-
creation_date: request.creationDate,
|
|
43
|
-
default_bootscript: request.defaultBootscript ? marshalBootscript(request.defaultBootscript) : undefined,
|
|
44
|
-
extra_volumes: request.extraVolumes ? Object.entries(request.extraVolumes).reduce((acc, _ref) => {
|
|
45
|
-
let [key, value] = _ref;
|
|
46
|
-
return {
|
|
47
|
-
...acc,
|
|
48
|
-
[key]: marshalVolume(value)
|
|
49
|
-
};
|
|
50
|
-
}, {}) : undefined,
|
|
51
|
-
from_server: request.fromServer,
|
|
52
|
-
modification_date: request.modificationDate,
|
|
53
|
-
id: request.id,
|
|
54
|
-
name: request.name,
|
|
55
|
-
organization: request.organization,
|
|
56
|
-
project: request.project,
|
|
57
|
-
public: request.public,
|
|
58
|
-
root_volume: request.rootVolume ? marshalVolumeSummary(request.rootVolume) : undefined,
|
|
59
|
-
state: request.state,
|
|
60
|
-
tags: request.tags
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export { marshalSetImageRequestWithID };
|