@scaleway/sdk 1.8.0 → 1.10.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 +11 -6
- package/dist/api/account/v2/marshalling.gen.js +2 -1
- package/dist/api/baremetal/v1/marshalling.gen.js +1 -0
- package/dist/api/function/v1beta1/api.gen.js +1 -5
- package/dist/api/iam/v1alpha1/marshalling.gen.js +1 -0
- package/dist/api/webhosting/v1alpha1/api.gen.js +25 -10
- package/dist/index.cjs +192 -50
- package/dist/index.d.ts +272 -80
- package/dist/index.js +2 -1
- package/dist/internal/interceptors/composer.js +46 -0
- package/dist/internal/interceptors/{request.js → helpers.js} +4 -3
- package/dist/scw/auth.js +3 -1
- package/dist/scw/client-ini-factory.js +71 -2
- package/dist/scw/client.js +3 -4
- package/dist/scw/constants.js +1 -1
- package/dist/scw/fetch/build-fetcher.js +18 -4
- package/dist/scw/fetch/http-interceptors.js +23 -5
- package/package.json +2 -2
- package/dist/internal/interceptors/interceptor.js +0 -13
|
@@ -25,12 +25,17 @@ class API extends API$1 {
|
|
|
25
25
|
* @param request - The request {@link CreateProjectRequest}
|
|
26
26
|
* @returns A Promise of Project
|
|
27
27
|
*/
|
|
28
|
-
this.createProject = request
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
this.createProject = function (request) {
|
|
29
|
+
if (request === void 0) {
|
|
30
|
+
request = {};
|
|
31
|
+
}
|
|
32
|
+
return _this.client.fetch({
|
|
33
|
+
body: JSON.stringify(marshalCreateProjectRequest(request, _this.client.settings)),
|
|
34
|
+
headers: jsonContentHeaders,
|
|
35
|
+
method: 'POST',
|
|
36
|
+
path: `/account/v2/projects`
|
|
37
|
+
}, unmarshalProject);
|
|
38
|
+
};
|
|
34
39
|
this.pageOfListProjects = function (request) {
|
|
35
40
|
if (request === void 0) {
|
|
36
41
|
request = {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js';
|
|
1
2
|
import { isJSONObject } from '../../../helpers/json.js';
|
|
2
3
|
import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
|
|
3
4
|
|
|
@@ -26,7 +27,7 @@ const unmarshalListProjectsResponse = data => {
|
|
|
26
27
|
};
|
|
27
28
|
const marshalCreateProjectRequest = (request, defaults) => ({
|
|
28
29
|
description: request.description,
|
|
29
|
-
name: request.name,
|
|
30
|
+
name: request.name || randomName('proj'),
|
|
30
31
|
organization_id: request.organizationId ?? defaults.defaultOrganizationId
|
|
31
32
|
});
|
|
32
33
|
const marshalUpdateProjectRequest = (request, defaults) => ({
|
|
@@ -131,6 +131,7 @@ const unmarshalOS = data => {
|
|
|
131
131
|
throw new TypeError(`Unmarshalling the type 'OS' failed as data isn't a dictionary.`);
|
|
132
132
|
}
|
|
133
133
|
return {
|
|
134
|
+
allowed: data.allowed,
|
|
134
135
|
enabled: data.enabled,
|
|
135
136
|
id: data.id,
|
|
136
137
|
licenseRequired: data.license_required,
|
|
@@ -10,11 +10,7 @@ const jsonContentHeaders = {
|
|
|
10
10
|
'Content-Type': 'application/json; charset=utf-8'
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* Functions API.
|
|
15
|
-
*
|
|
16
|
-
* Serverless functions API. Functions API.
|
|
17
|
-
*/
|
|
13
|
+
/** Serverless Functions API. */
|
|
18
14
|
class API extends API$1 {
|
|
19
15
|
constructor() {
|
|
20
16
|
var _this;
|
|
@@ -143,6 +143,7 @@ const unmarshalUser = data => {
|
|
|
143
143
|
throw new TypeError(`Unmarshalling the type 'User' failed as data isn't a dictionary.`);
|
|
144
144
|
}
|
|
145
145
|
return {
|
|
146
|
+
accountRootUserId: data.account_root_user_id,
|
|
146
147
|
createdAt: unmarshalDate(data.created_at),
|
|
147
148
|
deletable: data.deletable,
|
|
148
149
|
email: data.email,
|
|
@@ -10,14 +10,15 @@ const jsonContentHeaders = {
|
|
|
10
10
|
'Content-Type': 'application/json; charset=utf-8'
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
/**
|
|
13
|
+
/** Web Hosting API. */
|
|
14
14
|
class API extends API$1 {
|
|
15
15
|
constructor() {
|
|
16
16
|
var _this;
|
|
17
17
|
super(...arguments);
|
|
18
18
|
_this = this;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Order a Web Hosting plan. Order a Web Hosting plan, specifying the offer
|
|
21
|
+
* type required via the `offer_id` parameter.
|
|
21
22
|
*
|
|
22
23
|
* @param request - The request {@link CreateHostingRequest}
|
|
23
24
|
* @returns A Promise of Hosting
|
|
@@ -39,7 +40,9 @@ class API extends API$1 {
|
|
|
39
40
|
}, unmarshalListHostingsResponse);
|
|
40
41
|
};
|
|
41
42
|
/**
|
|
42
|
-
* List all
|
|
43
|
+
* List all Web Hosting plans. List all of your existing Web Hosting plans.
|
|
44
|
+
* Various filters are available to limit the results, including filtering by
|
|
45
|
+
* domain, status, tag and Project ID.
|
|
43
46
|
*
|
|
44
47
|
* @param request - The request {@link ListHostingsRequest}
|
|
45
48
|
* @returns A Promise of ListHostingsResponse
|
|
@@ -51,7 +54,8 @@ class API extends API$1 {
|
|
|
51
54
|
return enrichForPagination('hostings', _this.pageOfListHostings, request);
|
|
52
55
|
};
|
|
53
56
|
/**
|
|
54
|
-
* Get a
|
|
57
|
+
* Get a Web Hosting plan. Get the details of one of your existing Web Hosting
|
|
58
|
+
* plans, specified by its `hosting_id`.
|
|
55
59
|
*
|
|
56
60
|
* @param request - The request {@link GetHostingRequest}
|
|
57
61
|
* @returns A Promise of Hosting
|
|
@@ -69,7 +73,9 @@ class API extends API$1 {
|
|
|
69
73
|
*/
|
|
70
74
|
this.waitForHosting = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!HOSTING_TRANSIENT_STATUSES.includes(res.status))), this.getHosting, request, options);
|
|
71
75
|
/**
|
|
72
|
-
* Update a
|
|
76
|
+
* Update a Web Hosting plan. Update the details of one of your existing Web
|
|
77
|
+
* Hosting plans, specified by its `hosting_id`. You can update parameters
|
|
78
|
+
* including the contact email address, tags, options and offer.
|
|
73
79
|
*
|
|
74
80
|
* @param request - The request {@link UpdateHostingRequest}
|
|
75
81
|
* @returns A Promise of Hosting
|
|
@@ -81,7 +87,10 @@ class API extends API$1 {
|
|
|
81
87
|
path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}`
|
|
82
88
|
}, unmarshalHosting);
|
|
83
89
|
/**
|
|
84
|
-
* Delete a
|
|
90
|
+
* Delete a Web Hosting plan. Delete a Web Hosting plan, specified by its
|
|
91
|
+
* `hosting_id`. Note that deletion is not immediate: it will take place at
|
|
92
|
+
* the end of the calendar month, after which time your Web Hosting plan and
|
|
93
|
+
* all its data (files and emails) will be irreversibly lost.
|
|
85
94
|
*
|
|
86
95
|
* @param request - The request {@link DeleteHostingRequest}
|
|
87
96
|
* @returns A Promise of Hosting
|
|
@@ -91,7 +100,12 @@ class API extends API$1 {
|
|
|
91
100
|
path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}`
|
|
92
101
|
}, unmarshalHosting);
|
|
93
102
|
/**
|
|
94
|
-
* Restore a
|
|
103
|
+
* Restore a Web Hosting plan. When you [delete a Web Hosting
|
|
104
|
+
* plan](#path-hostings-delete-a-hosting), definitive deletion does not take
|
|
105
|
+
* place until the end of the calendar month. In the time between initiating
|
|
106
|
+
* the deletion, and definitive deletion at the end of the month, you can
|
|
107
|
+
* choose to **restore** the Web Hosting plan, using this endpoint and
|
|
108
|
+
* specifying its `hosting_id`.
|
|
95
109
|
*
|
|
96
110
|
* @param request - The request {@link RestoreHostingRequest}
|
|
97
111
|
* @returns A Promise of Hosting
|
|
@@ -103,8 +117,8 @@ class API extends API$1 {
|
|
|
103
117
|
path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}/restore`
|
|
104
118
|
}, unmarshalHosting);
|
|
105
119
|
/**
|
|
106
|
-
* Get
|
|
107
|
-
*
|
|
120
|
+
* Get DNS records. Get the set of DNS records of a specified domain
|
|
121
|
+
* associated with a Web Hosting plan.
|
|
108
122
|
*
|
|
109
123
|
* @param request - The request {@link GetDomainDnsRecordsRequest}
|
|
110
124
|
* @returns A Promise of DnsRecords
|
|
@@ -114,7 +128,8 @@ class API extends API$1 {
|
|
|
114
128
|
path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domain', request.domain)}/dns-records`
|
|
115
129
|
}, unmarshalDnsRecords);
|
|
116
130
|
/**
|
|
117
|
-
* List all offers.
|
|
131
|
+
* List all offers. List the different Web Hosting offers, and their options,
|
|
132
|
+
* available to order from Scaleway.
|
|
118
133
|
*
|
|
119
134
|
* @param request - The request {@link ListOffersRequest}
|
|
120
135
|
* @returns A Promise of ListOffersResponse
|
package/dist/index.cjs
CHANGED
|
@@ -71,8 +71,6 @@ const enableConsoleLogger = (logLevel = 'warn', prefix = 'scaleway-sdk-js:') =>
|
|
|
71
71
|
*/
|
|
72
72
|
const getLogger = () => sdkLogger;
|
|
73
73
|
|
|
74
|
-
/** Request Interceptor. */
|
|
75
|
-
|
|
76
74
|
/**
|
|
77
75
|
* Adds an header to a request through an interceptor.
|
|
78
76
|
*
|
|
@@ -82,7 +80,9 @@ const getLogger = () => sdkLogger;
|
|
|
82
80
|
*
|
|
83
81
|
* @internal
|
|
84
82
|
*/
|
|
85
|
-
const addHeaderInterceptor = (key, value) =>
|
|
83
|
+
const addHeaderInterceptor = (key, value) => ({
|
|
84
|
+
request
|
|
85
|
+
}) => {
|
|
86
86
|
const clone = request.clone();
|
|
87
87
|
if (value !== undefined) {
|
|
88
88
|
clone.headers.append(key, value);
|
|
@@ -197,6 +197,8 @@ const AUTH_HEADER_KEY = 'x-auth-token';
|
|
|
197
197
|
* @param getToken - The token accessor
|
|
198
198
|
* @returns The request interceptor
|
|
199
199
|
*
|
|
200
|
+
* @deprecated Please use addAsyncHeaderInterceptor instead.
|
|
201
|
+
*
|
|
200
202
|
* @internal
|
|
201
203
|
*/
|
|
202
204
|
const authenticateWithSessionToken = getToken => addAsyncHeaderInterceptor(SESSION_HEADER_KEY, getToken);
|
|
@@ -286,7 +288,9 @@ const withProfile = profile => settings => {
|
|
|
286
288
|
newSettings.defaultZone = profile.defaultZone;
|
|
287
289
|
}
|
|
288
290
|
if (hasAuthenticationSecrets(profile)) {
|
|
289
|
-
newSettings.
|
|
291
|
+
newSettings.interceptors = [{
|
|
292
|
+
request: authenticateWithSecrets(profile)
|
|
293
|
+
}, ...newSettings.interceptors];
|
|
290
294
|
}
|
|
291
295
|
return newSettings;
|
|
292
296
|
};
|
|
@@ -351,6 +355,73 @@ const withUserAgentSuffix = userAgent => settings => ({
|
|
|
351
355
|
userAgent: settings.userAgent ? `${settings.userAgent} ${userAgent}` : userAgent
|
|
352
356
|
});
|
|
353
357
|
|
|
358
|
+
/**
|
|
359
|
+
* Instantiates the SDK with additional interceptors.
|
|
360
|
+
*
|
|
361
|
+
* @param interceptors - The additional {@link NetworkInterceptors} interceptors
|
|
362
|
+
* @returns A factory {@link ClientConfig}
|
|
363
|
+
*
|
|
364
|
+
* @remarks
|
|
365
|
+
* It doesn't override the existing interceptors, but instead push more to the list.
|
|
366
|
+
* This method should be used in conjunction with the initializer `createAdvancedClient`.
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```
|
|
370
|
+
* withAdditionalInterceptors([
|
|
371
|
+
* {
|
|
372
|
+
* request: ({ request }) => {
|
|
373
|
+
* console.log(`Do something with ${JSON.stringify(request)}`)
|
|
374
|
+
* return request
|
|
375
|
+
* },
|
|
376
|
+
* response: ({ response }) => {
|
|
377
|
+
* console.log(`Do something with ${JSON.stringify(response)}`)
|
|
378
|
+
* return response
|
|
379
|
+
* },
|
|
380
|
+
* responseError: async ({
|
|
381
|
+
* request,
|
|
382
|
+
* error,
|
|
383
|
+
* }: {
|
|
384
|
+
* request: Request
|
|
385
|
+
* error: unknown
|
|
386
|
+
* }) => {
|
|
387
|
+
* console.log(
|
|
388
|
+
* `Do something with ${JSON.stringify(request)} and ${JSON.stringify(
|
|
389
|
+
* error,
|
|
390
|
+
* )}`,
|
|
391
|
+
* )
|
|
392
|
+
* throw error // or return Promise.resolve(someData)
|
|
393
|
+
* },
|
|
394
|
+
* },
|
|
395
|
+
* ])
|
|
396
|
+
* ```
|
|
397
|
+
*
|
|
398
|
+
* @public
|
|
399
|
+
*/
|
|
400
|
+
const withAdditionalInterceptors = interceptors => settings => ({
|
|
401
|
+
...settings,
|
|
402
|
+
interceptors: settings.interceptors.concat(interceptors)
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Instantiates the SDK with legacy interceptors.
|
|
407
|
+
*/
|
|
408
|
+
/* eslint-disable deprecation/deprecation */
|
|
409
|
+
const withLegacyInterceptors = () => settings => {
|
|
410
|
+
if (!settings.requestInterceptors && !settings.responseInterceptors) {
|
|
411
|
+
return settings;
|
|
412
|
+
}
|
|
413
|
+
const allInterceptors = settings.interceptors.concat((settings.requestInterceptors ?? []).map(obj => ({
|
|
414
|
+
request: obj
|
|
415
|
+
})), (settings.responseInterceptors ?? []).map(obj => ({
|
|
416
|
+
response: obj
|
|
417
|
+
})));
|
|
418
|
+
return {
|
|
419
|
+
...settings,
|
|
420
|
+
interceptors: allInterceptors
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
/* eslint-enable deprecation/deprecation */
|
|
424
|
+
|
|
354
425
|
/**
|
|
355
426
|
* Holds default values of settings.
|
|
356
427
|
*
|
|
@@ -426,22 +497,55 @@ const assertValidSettings = obj => {
|
|
|
426
497
|
}
|
|
427
498
|
};
|
|
428
499
|
|
|
429
|
-
const version = 'v1.
|
|
500
|
+
const version = 'v1.9.0';
|
|
430
501
|
const userAgent = `scaleway-sdk-js/${version}`;
|
|
431
502
|
|
|
432
503
|
const isBrowser = () => typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
433
504
|
|
|
434
505
|
/**
|
|
435
|
-
* Composes interceptors.
|
|
506
|
+
* Composes request interceptors.
|
|
507
|
+
*
|
|
508
|
+
* @param interceptors - A list of request interceptors
|
|
509
|
+
* @returns An async composed interceptor
|
|
510
|
+
*
|
|
511
|
+
* @internal
|
|
512
|
+
*/
|
|
513
|
+
const composeRequestInterceptors = interceptors => async request => interceptors.reduce(async (asyncResult, interceptor) => interceptor({
|
|
514
|
+
request: await asyncResult
|
|
515
|
+
}), Promise.resolve(request));
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Composes response interceptors.
|
|
436
519
|
*
|
|
437
|
-
* @param interceptors - A list of interceptors
|
|
520
|
+
* @param interceptors - A list of response interceptors
|
|
438
521
|
* @returns An async composed interceptor
|
|
439
522
|
*
|
|
440
523
|
* @internal
|
|
441
524
|
*/
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
}));
|
|
525
|
+
const composeResponseInterceptors = interceptors => async response => interceptors.reduce(async (asyncResult, interceptor) => interceptor({
|
|
526
|
+
response: await asyncResult
|
|
527
|
+
}), Promise.resolve(response));
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Compose response error interceptors.
|
|
531
|
+
*
|
|
532
|
+
* @internal
|
|
533
|
+
*/
|
|
534
|
+
const composeResponseErrorInterceptors = interceptors => async (request, error) => {
|
|
535
|
+
let prevError = error;
|
|
536
|
+
for (const interceptor of interceptors) {
|
|
537
|
+
try {
|
|
538
|
+
const res = await interceptor({
|
|
539
|
+
request,
|
|
540
|
+
error: prevError
|
|
541
|
+
});
|
|
542
|
+
return res;
|
|
543
|
+
} catch (err) {
|
|
544
|
+
prevError = err;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
throw prevError;
|
|
548
|
+
};
|
|
445
549
|
|
|
446
550
|
/**
|
|
447
551
|
* Converts a string to PascalCase.
|
|
@@ -526,8 +630,12 @@ class ObfuscatedRequest extends Request {
|
|
|
526
630
|
*
|
|
527
631
|
* @internal
|
|
528
632
|
*/
|
|
529
|
-
const obfuscateInterceptor = obfuscate =>
|
|
530
|
-
|
|
633
|
+
const obfuscateInterceptor = obfuscate => ({
|
|
634
|
+
request
|
|
635
|
+
}) => new ObfuscatedRequest(request, obfuscate);
|
|
636
|
+
const identity = ({
|
|
637
|
+
request
|
|
638
|
+
}) => request;
|
|
531
639
|
|
|
532
640
|
/**
|
|
533
641
|
* Creates an interceptor to log the requests.
|
|
@@ -538,10 +646,14 @@ const identity = instance => instance;
|
|
|
538
646
|
*
|
|
539
647
|
* @internal
|
|
540
648
|
*/
|
|
541
|
-
const logRequest = (identifier, obfuscate = identity) => async
|
|
649
|
+
const logRequest = (identifier, obfuscate = identity) => async ({
|
|
650
|
+
request
|
|
651
|
+
}) => {
|
|
542
652
|
if (shouldLog(LevelResolver[getLogger().logLevel], 'debug')) {
|
|
543
653
|
getLogger().debug(`--------------- Scaleway SDK REQUEST ${identifier} ---------------
|
|
544
|
-
${await dumpRequest(await obfuscate(
|
|
654
|
+
${await dumpRequest(await obfuscate({
|
|
655
|
+
request
|
|
656
|
+
}))}
|
|
545
657
|
---------------------------------------------------------`);
|
|
546
658
|
}
|
|
547
659
|
return request;
|
|
@@ -555,7 +667,9 @@ ${await dumpRequest(await obfuscate(request))}
|
|
|
555
667
|
*
|
|
556
668
|
* @internal
|
|
557
669
|
*/
|
|
558
|
-
const logResponse = identifier => async
|
|
670
|
+
const logResponse = identifier => async ({
|
|
671
|
+
response
|
|
672
|
+
}) => {
|
|
559
673
|
if (shouldLog(LevelResolver[getLogger().logLevel], 'debug')) {
|
|
560
674
|
getLogger().debug(`--------------- Scaleway SDK RESPONSE ${identifier} ---------------
|
|
561
675
|
${await dumpResponse(response)}
|
|
@@ -1358,11 +1472,25 @@ const asIs = response => response;
|
|
|
1358
1472
|
*/
|
|
1359
1473
|
const buildFetcher = (settings, httpClient) => {
|
|
1360
1474
|
let requestNumber = 0;
|
|
1361
|
-
const prepareRequest = requestId =>
|
|
1362
|
-
const prepareResponse = requestId =>
|
|
1475
|
+
const prepareRequest = requestId => composeRequestInterceptors([...settings.interceptors.map(obj => obj.request).filter(obj => obj), logRequest(requestId, obfuscateInterceptor(obfuscateAuthHeadersEntry))]);
|
|
1476
|
+
const prepareResponse = requestId => composeResponseInterceptors([...settings.interceptors.map(obj => obj.response).filter(obj => obj), logResponse(requestId)]);
|
|
1477
|
+
const prepareResponseErrors = () => composeResponseErrorInterceptors(settings.interceptors.map(obj => obj.responseError).filter(obj => obj));
|
|
1363
1478
|
return async (request, unwrapper = asIs) => {
|
|
1364
1479
|
const requestId = `${requestNumber += 1}`;
|
|
1365
|
-
|
|
1480
|
+
const reqInterceptors = prepareRequest(requestId);
|
|
1481
|
+
const finalRequest = await reqInterceptors(buildRequest(request, settings));
|
|
1482
|
+
try {
|
|
1483
|
+
const response = await httpClient(finalRequest);
|
|
1484
|
+
const resInterceptors = prepareResponse(requestId);
|
|
1485
|
+
const finalResponse = await resInterceptors(response);
|
|
1486
|
+
const resUnmarshaller = responseParser(unwrapper, request.responseType ?? 'json');
|
|
1487
|
+
const unmarshaledResponse = await resUnmarshaller(finalResponse);
|
|
1488
|
+
return unmarshaledResponse;
|
|
1489
|
+
} catch (err) {
|
|
1490
|
+
const resErrorInterceptors = prepareResponseErrors();
|
|
1491
|
+
const handledError = await resErrorInterceptors(finalRequest, err);
|
|
1492
|
+
return handledError;
|
|
1493
|
+
}
|
|
1366
1494
|
};
|
|
1367
1495
|
};
|
|
1368
1496
|
|
|
@@ -1370,8 +1498,7 @@ const buildFetcher = (settings, httpClient) => {
|
|
|
1370
1498
|
const DEFAULT_SETTINGS = {
|
|
1371
1499
|
apiURL: 'https://api.scaleway.com',
|
|
1372
1500
|
httpClient: fetch,
|
|
1373
|
-
|
|
1374
|
-
responseInterceptors: [],
|
|
1501
|
+
interceptors: [],
|
|
1375
1502
|
userAgent
|
|
1376
1503
|
};
|
|
1377
1504
|
|
|
@@ -1404,7 +1531,7 @@ const DEFAULT_SETTINGS = {
|
|
|
1404
1531
|
* @public
|
|
1405
1532
|
*/
|
|
1406
1533
|
const createAdvancedClient = (...configs) => {
|
|
1407
|
-
const settings = configs.reduce((currentSettings, config) => config(currentSettings), DEFAULT_SETTINGS);
|
|
1534
|
+
const settings = configs.concat([withLegacyInterceptors()]).reduce((currentSettings, config) => config(currentSettings), DEFAULT_SETTINGS);
|
|
1408
1535
|
assertValidSettings(settings);
|
|
1409
1536
|
getLogger().info(`init Scaleway SDK version ${version}`);
|
|
1410
1537
|
return {
|
|
@@ -1886,6 +2013,18 @@ const enrichForPagination = (key, fetcher, request) => {
|
|
|
1886
2013
|
});
|
|
1887
2014
|
};
|
|
1888
2015
|
|
|
2016
|
+
const ADJECTIVES = ['admiring', 'adoring', 'affectionate', 'agitated', 'amazing', 'angry', 'awesome', 'beautiful', 'blissful', 'bold', 'boring', 'brave', 'busy', 'charming', 'clever', 'cool', 'compassionate', 'competent', 'condescending', 'confident', 'cranky', 'crazy', 'dazzling', 'determined', 'distracted', 'dreamy', 'eager', 'ecstatic', 'elastic', 'elated', 'elegant', 'eloquent', 'epic', 'exciting', 'fervent', 'festive', 'flamboyant', 'focused', 'friendly', 'frosty', 'funny', 'gallant', 'gifted', 'goofy', 'gracious', 'great', 'happy', 'hardcore', 'heuristic', 'hopeful', 'hungry', 'infallible', 'inspiring', 'interesting', 'intelligent', 'jolly', 'jovial', 'keen', 'kind', 'laughing', 'loving', 'lucid', 'magical', 'mystifying', 'modest', 'musing', 'naughty', 'nervous', 'nice', 'nifty', 'nostalgic', 'objective', 'optimistic', 'peaceful', 'pedantic', 'pensive', 'practical', 'priceless', 'quirky', 'quizzical', 'recursing', 'relaxed', 'reverent', 'romantic', 'sad', 'serene', 'sharp', 'silly', 'sleepy', 'stoic', 'strange', 'stupefied', 'suspicious', 'sweet', 'tender', 'thirsty', 'trusting', 'unruffled', 'upbeat', 'vibrant', 'vigilant', 'vigorous', 'wizardly', 'wonderful', 'xenodochial', 'youthful', 'zealous', 'zen'];
|
|
2017
|
+
const NAMES = ['albattani', 'allen', 'almeida', 'antonelli', 'agnesi', 'archimedes', 'ardinghelli', 'aryabhata', 'austin', 'babbage', 'banach', 'banzai', 'bardeen', 'bartik', 'bassi', 'beaver', 'bell', 'benz', 'bhabha', 'bhaskara', 'black', 'blackburn', 'blackwell', 'bohr', 'booth', 'borg', 'bose', 'bouman', 'boyd', 'brahmagupta', 'brattain', 'brown', 'buck', 'burnell', 'cannon', 'carson', 'cartwright', 'carver', 'cerf', 'chandrasekhar', 'chaplygin', 'chatelet', 'chatterjee', 'chebyshev', 'cohen', 'chaum', 'clarke', 'colden', 'cori', 'cray', 'curran', 'curie', 'darwin', 'davinci', 'dewdney', 'dhawan', 'diffie', 'dijkstra', 'dirac', 'driscoll', 'dubinsky', 'easley', 'edison', 'einstein', 'elbakyan', 'elgamal', 'elion', 'ellis', 'engelbart', 'euclid', 'euler', 'faraday', 'feistel', 'fermat', 'fermi', 'feynman', 'franklin', 'gagarin', 'galileo', 'galois', 'ganguly', 'gates', 'gauss', 'germain', 'goldberg', 'goldstine', 'goldwasser', 'golick', 'goodall', 'gould', 'greider', 'grothendieck', 'haibt', 'hamilton', 'haslett', 'hawking', 'hellman', 'heisenberg', 'hermann', 'herschel', 'hertz', 'heyrovsky', 'hodgkin', 'hofstadter', 'hoover', 'hopper', 'hugle', 'hypatia', 'ishizaka', 'jackson', 'jang', 'jemison', 'jennings', 'jepsen', 'johnson', 'joliot', 'jones', 'kalam', 'kapitsa', 'kare', 'keldysh', 'keller', 'kepler', 'khayyam', 'khorana', 'kilby', 'kirch', 'knuth', 'kowalevski', 'lalande', 'lamarr', 'lamport', 'leakey', 'leavitt', 'lederberg', 'lehmann', 'lewin', 'lichterman', 'liskov', 'lovelace', 'lumiere', 'mahavira', 'margulis', 'matsumoto', 'maxwell', 'mayer', 'mccarthy', 'mcclintock', 'mclaren', 'mclean', 'mcnulty', 'mendel', 'mendeleev', 'meitner', 'meninsky', 'merkle', 'mestorf', 'mirzakhani', 'montalcini', 'moore', 'morse', 'murdock', 'moser', 'napier', 'nash', 'neumann', 'newton', 'nightingale', 'nobel', 'noether', 'northcutt', 'noyce', 'panini', 'pare', 'pascal', 'pasteur', 'payne', 'perlman', 'pike', 'poincare', 'poitras', 'proskuriakova', 'ptolemy', 'raman', 'ramanujan', 'ride', 'ritchie', 'rhodes', 'robinson', 'roentgen', 'rosalind', 'rubin', 'saha', 'sammet', 'sanderson', 'satoshi', 'shamir', 'shannon', 'shaw', 'shirley', 'shockley', 'shtern', 'sinoussi', 'snyder', 'solomon', 'spence', 'stonebraker', 'sutherland', 'swanson', 'swartz', 'swirles', 'taussig', 'tereshkova', 'tesla', 'tharp', 'thompson', 'torvalds', 'tu', 'turing', 'varahamihira', 'vaughan', 'visvesvaraya', 'volhard', 'villani', 'wescoff', 'wilbur', 'wiles', 'williams', 'williamson', 'wilson', 'wing', 'wozniak', 'wright', 'wu', 'yalow', 'yonath', 'zhukovsky'];
|
|
2018
|
+
const randomName = function () {
|
|
2019
|
+
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
2020
|
+
let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '-';
|
|
2021
|
+
const name = `${ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)] ?? ''}${separator}${NAMES[Math.floor(Math.random() * NAMES.length)] ?? ''}`;
|
|
2022
|
+
if (name === `boring${separator}wozniak`) {
|
|
2023
|
+
return randomName(prefix, separator);
|
|
2024
|
+
}
|
|
2025
|
+
return prefix.length > 0 ? `${prefix}${separator}${name}` : name;
|
|
2026
|
+
};
|
|
2027
|
+
|
|
1889
2028
|
// This file was automatically generated. DO NOT EDIT.
|
|
1890
2029
|
const unmarshalProject = data => {
|
|
1891
2030
|
if (!isJSONObject(data)) {
|
|
@@ -1911,7 +2050,7 @@ const unmarshalListProjectsResponse = data => {
|
|
|
1911
2050
|
};
|
|
1912
2051
|
const marshalCreateProjectRequest = (request, defaults) => ({
|
|
1913
2052
|
description: request.description,
|
|
1914
|
-
name: request.name,
|
|
2053
|
+
name: request.name || randomName('proj'),
|
|
1915
2054
|
organization_id: request.organizationId ?? defaults.defaultOrganizationId
|
|
1916
2055
|
});
|
|
1917
2056
|
const marshalUpdateProjectRequest = (request, defaults) => ({
|
|
@@ -1937,7 +2076,7 @@ let API$p = class API extends API$q {
|
|
|
1937
2076
|
* @param request - The request {@link CreateProjectRequest}
|
|
1938
2077
|
* @returns A Promise of Project
|
|
1939
2078
|
*/
|
|
1940
|
-
createProject = request => this.client.fetch({
|
|
2079
|
+
createProject = (request = {}) => this.client.fetch({
|
|
1941
2080
|
body: JSON.stringify(marshalCreateProjectRequest(request, this.client.settings)),
|
|
1942
2081
|
headers: jsonContentHeaders$m,
|
|
1943
2082
|
method: 'POST',
|
|
@@ -2019,18 +2158,6 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
2019
2158
|
/** Lists transient statutes of the enum {@link ServerStatus}. */
|
|
2020
2159
|
const SERVER_TRANSIENT_STATUSES$2 = ['starting', 'rebooting', 'updating', 'locking', 'unlocking', 'reinstalling'];
|
|
2021
2160
|
|
|
2022
|
-
const ADJECTIVES = ['admiring', 'adoring', 'affectionate', 'agitated', 'amazing', 'angry', 'awesome', 'beautiful', 'blissful', 'bold', 'boring', 'brave', 'busy', 'charming', 'clever', 'cool', 'compassionate', 'competent', 'condescending', 'confident', 'cranky', 'crazy', 'dazzling', 'determined', 'distracted', 'dreamy', 'eager', 'ecstatic', 'elastic', 'elated', 'elegant', 'eloquent', 'epic', 'exciting', 'fervent', 'festive', 'flamboyant', 'focused', 'friendly', 'frosty', 'funny', 'gallant', 'gifted', 'goofy', 'gracious', 'great', 'happy', 'hardcore', 'heuristic', 'hopeful', 'hungry', 'infallible', 'inspiring', 'interesting', 'intelligent', 'jolly', 'jovial', 'keen', 'kind', 'laughing', 'loving', 'lucid', 'magical', 'mystifying', 'modest', 'musing', 'naughty', 'nervous', 'nice', 'nifty', 'nostalgic', 'objective', 'optimistic', 'peaceful', 'pedantic', 'pensive', 'practical', 'priceless', 'quirky', 'quizzical', 'recursing', 'relaxed', 'reverent', 'romantic', 'sad', 'serene', 'sharp', 'silly', 'sleepy', 'stoic', 'strange', 'stupefied', 'suspicious', 'sweet', 'tender', 'thirsty', 'trusting', 'unruffled', 'upbeat', 'vibrant', 'vigilant', 'vigorous', 'wizardly', 'wonderful', 'xenodochial', 'youthful', 'zealous', 'zen'];
|
|
2023
|
-
const NAMES = ['albattani', 'allen', 'almeida', 'antonelli', 'agnesi', 'archimedes', 'ardinghelli', 'aryabhata', 'austin', 'babbage', 'banach', 'banzai', 'bardeen', 'bartik', 'bassi', 'beaver', 'bell', 'benz', 'bhabha', 'bhaskara', 'black', 'blackburn', 'blackwell', 'bohr', 'booth', 'borg', 'bose', 'bouman', 'boyd', 'brahmagupta', 'brattain', 'brown', 'buck', 'burnell', 'cannon', 'carson', 'cartwright', 'carver', 'cerf', 'chandrasekhar', 'chaplygin', 'chatelet', 'chatterjee', 'chebyshev', 'cohen', 'chaum', 'clarke', 'colden', 'cori', 'cray', 'curran', 'curie', 'darwin', 'davinci', 'dewdney', 'dhawan', 'diffie', 'dijkstra', 'dirac', 'driscoll', 'dubinsky', 'easley', 'edison', 'einstein', 'elbakyan', 'elgamal', 'elion', 'ellis', 'engelbart', 'euclid', 'euler', 'faraday', 'feistel', 'fermat', 'fermi', 'feynman', 'franklin', 'gagarin', 'galileo', 'galois', 'ganguly', 'gates', 'gauss', 'germain', 'goldberg', 'goldstine', 'goldwasser', 'golick', 'goodall', 'gould', 'greider', 'grothendieck', 'haibt', 'hamilton', 'haslett', 'hawking', 'hellman', 'heisenberg', 'hermann', 'herschel', 'hertz', 'heyrovsky', 'hodgkin', 'hofstadter', 'hoover', 'hopper', 'hugle', 'hypatia', 'ishizaka', 'jackson', 'jang', 'jemison', 'jennings', 'jepsen', 'johnson', 'joliot', 'jones', 'kalam', 'kapitsa', 'kare', 'keldysh', 'keller', 'kepler', 'khayyam', 'khorana', 'kilby', 'kirch', 'knuth', 'kowalevski', 'lalande', 'lamarr', 'lamport', 'leakey', 'leavitt', 'lederberg', 'lehmann', 'lewin', 'lichterman', 'liskov', 'lovelace', 'lumiere', 'mahavira', 'margulis', 'matsumoto', 'maxwell', 'mayer', 'mccarthy', 'mcclintock', 'mclaren', 'mclean', 'mcnulty', 'mendel', 'mendeleev', 'meitner', 'meninsky', 'merkle', 'mestorf', 'mirzakhani', 'montalcini', 'moore', 'morse', 'murdock', 'moser', 'napier', 'nash', 'neumann', 'newton', 'nightingale', 'nobel', 'noether', 'northcutt', 'noyce', 'panini', 'pare', 'pascal', 'pasteur', 'payne', 'perlman', 'pike', 'poincare', 'poitras', 'proskuriakova', 'ptolemy', 'raman', 'ramanujan', 'ride', 'ritchie', 'rhodes', 'robinson', 'roentgen', 'rosalind', 'rubin', 'saha', 'sammet', 'sanderson', 'satoshi', 'shamir', 'shannon', 'shaw', 'shirley', 'shockley', 'shtern', 'sinoussi', 'snyder', 'solomon', 'spence', 'stonebraker', 'sutherland', 'swanson', 'swartz', 'swirles', 'taussig', 'tereshkova', 'tesla', 'tharp', 'thompson', 'torvalds', 'tu', 'turing', 'varahamihira', 'vaughan', 'visvesvaraya', 'volhard', 'villani', 'wescoff', 'wilbur', 'wiles', 'williams', 'williamson', 'wilson', 'wing', 'wozniak', 'wright', 'wu', 'yalow', 'yonath', 'zhukovsky'];
|
|
2024
|
-
const randomName = function () {
|
|
2025
|
-
let prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
2026
|
-
let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '-';
|
|
2027
|
-
const name = `${ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)] ?? ''}${separator}${NAMES[Math.floor(Math.random() * NAMES.length)] ?? ''}`;
|
|
2028
|
-
if (name === `boring${separator}wozniak`) {
|
|
2029
|
-
return randomName(prefix, separator);
|
|
2030
|
-
}
|
|
2031
|
-
return prefix.length > 0 ? `${prefix}${separator}${name}` : name;
|
|
2032
|
-
};
|
|
2033
|
-
|
|
2034
2161
|
// This file was automatically generated. DO NOT EDIT.
|
|
2035
2162
|
const unmarshalServerTypeCPU = data => {
|
|
2036
2163
|
if (!isJSONObject(data)) {
|
|
@@ -2483,6 +2610,7 @@ const unmarshalOS = data => {
|
|
|
2483
2610
|
throw new TypeError(`Unmarshalling the type 'OS' failed as data isn't a dictionary.`);
|
|
2484
2611
|
}
|
|
2485
2612
|
return {
|
|
2613
|
+
allowed: data.allowed,
|
|
2486
2614
|
enabled: data.enabled,
|
|
2487
2615
|
id: data.id,
|
|
2488
2616
|
licenseRequired: data.license_required,
|
|
@@ -7297,11 +7425,7 @@ const jsonContentHeaders$f = {
|
|
|
7297
7425
|
'Content-Type': 'application/json; charset=utf-8'
|
|
7298
7426
|
};
|
|
7299
7427
|
|
|
7300
|
-
/**
|
|
7301
|
-
* Functions API.
|
|
7302
|
-
*
|
|
7303
|
-
* Serverless functions API. Functions API.
|
|
7304
|
-
*/
|
|
7428
|
+
/** Serverless Functions API. */
|
|
7305
7429
|
let API$h = class API extends API$q {
|
|
7306
7430
|
/** Lists the available regions of the API. */
|
|
7307
7431
|
static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
|
|
@@ -7926,6 +8050,7 @@ const unmarshalUser$1 = data => {
|
|
|
7926
8050
|
throw new TypeError(`Unmarshalling the type 'User' failed as data isn't a dictionary.`);
|
|
7927
8051
|
}
|
|
7928
8052
|
return {
|
|
8053
|
+
accountRootUserId: data.account_root_user_id,
|
|
7929
8054
|
createdAt: unmarshalDate(data.created_at),
|
|
7930
8055
|
deletable: data.deletable,
|
|
7931
8056
|
email: data.email,
|
|
@@ -21327,13 +21452,14 @@ const jsonContentHeaders = {
|
|
|
21327
21452
|
'Content-Type': 'application/json; charset=utf-8'
|
|
21328
21453
|
};
|
|
21329
21454
|
|
|
21330
|
-
/**
|
|
21455
|
+
/** Web Hosting API. */
|
|
21331
21456
|
class API extends API$q {
|
|
21332
21457
|
/** Lists the available regions of the API. */
|
|
21333
21458
|
static LOCALITIES = ['fr-par'];
|
|
21334
21459
|
|
|
21335
21460
|
/**
|
|
21336
|
-
*
|
|
21461
|
+
* Order a Web Hosting plan. Order a Web Hosting plan, specifying the offer
|
|
21462
|
+
* type required via the `offer_id` parameter.
|
|
21337
21463
|
*
|
|
21338
21464
|
* @param request - The request {@link CreateHostingRequest}
|
|
21339
21465
|
* @returns A Promise of Hosting
|
|
@@ -21351,7 +21477,9 @@ class API extends API$q {
|
|
|
21351
21477
|
}, unmarshalListHostingsResponse);
|
|
21352
21478
|
|
|
21353
21479
|
/**
|
|
21354
|
-
* List all
|
|
21480
|
+
* List all Web Hosting plans. List all of your existing Web Hosting plans.
|
|
21481
|
+
* Various filters are available to limit the results, including filtering by
|
|
21482
|
+
* domain, status, tag and Project ID.
|
|
21355
21483
|
*
|
|
21356
21484
|
* @param request - The request {@link ListHostingsRequest}
|
|
21357
21485
|
* @returns A Promise of ListHostingsResponse
|
|
@@ -21359,7 +21487,8 @@ class API extends API$q {
|
|
|
21359
21487
|
listHostings = (request = {}) => enrichForPagination('hostings', this.pageOfListHostings, request);
|
|
21360
21488
|
|
|
21361
21489
|
/**
|
|
21362
|
-
* Get a
|
|
21490
|
+
* Get a Web Hosting plan. Get the details of one of your existing Web Hosting
|
|
21491
|
+
* plans, specified by its `hosting_id`.
|
|
21363
21492
|
*
|
|
21364
21493
|
* @param request - The request {@link GetHostingRequest}
|
|
21365
21494
|
* @returns A Promise of Hosting
|
|
@@ -21379,7 +21508,9 @@ class API extends API$q {
|
|
|
21379
21508
|
waitForHosting = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!HOSTING_TRANSIENT_STATUSES.includes(res.status))), this.getHosting, request, options);
|
|
21380
21509
|
|
|
21381
21510
|
/**
|
|
21382
|
-
* Update a
|
|
21511
|
+
* Update a Web Hosting plan. Update the details of one of your existing Web
|
|
21512
|
+
* Hosting plans, specified by its `hosting_id`. You can update parameters
|
|
21513
|
+
* including the contact email address, tags, options and offer.
|
|
21383
21514
|
*
|
|
21384
21515
|
* @param request - The request {@link UpdateHostingRequest}
|
|
21385
21516
|
* @returns A Promise of Hosting
|
|
@@ -21392,7 +21523,10 @@ class API extends API$q {
|
|
|
21392
21523
|
}, unmarshalHosting);
|
|
21393
21524
|
|
|
21394
21525
|
/**
|
|
21395
|
-
* Delete a
|
|
21526
|
+
* Delete a Web Hosting plan. Delete a Web Hosting plan, specified by its
|
|
21527
|
+
* `hosting_id`. Note that deletion is not immediate: it will take place at
|
|
21528
|
+
* the end of the calendar month, after which time your Web Hosting plan and
|
|
21529
|
+
* all its data (files and emails) will be irreversibly lost.
|
|
21396
21530
|
*
|
|
21397
21531
|
* @param request - The request {@link DeleteHostingRequest}
|
|
21398
21532
|
* @returns A Promise of Hosting
|
|
@@ -21403,7 +21537,12 @@ class API extends API$q {
|
|
|
21403
21537
|
}, unmarshalHosting);
|
|
21404
21538
|
|
|
21405
21539
|
/**
|
|
21406
|
-
* Restore a
|
|
21540
|
+
* Restore a Web Hosting plan. When you [delete a Web Hosting
|
|
21541
|
+
* plan](#path-hostings-delete-a-hosting), definitive deletion does not take
|
|
21542
|
+
* place until the end of the calendar month. In the time between initiating
|
|
21543
|
+
* the deletion, and definitive deletion at the end of the month, you can
|
|
21544
|
+
* choose to **restore** the Web Hosting plan, using this endpoint and
|
|
21545
|
+
* specifying its `hosting_id`.
|
|
21407
21546
|
*
|
|
21408
21547
|
* @param request - The request {@link RestoreHostingRequest}
|
|
21409
21548
|
* @returns A Promise of Hosting
|
|
@@ -21416,8 +21555,8 @@ class API extends API$q {
|
|
|
21416
21555
|
}, unmarshalHosting);
|
|
21417
21556
|
|
|
21418
21557
|
/**
|
|
21419
|
-
* Get
|
|
21420
|
-
*
|
|
21558
|
+
* Get DNS records. Get the set of DNS records of a specified domain
|
|
21559
|
+
* associated with a Web Hosting plan.
|
|
21421
21560
|
*
|
|
21422
21561
|
* @param request - The request {@link GetDomainDnsRecordsRequest}
|
|
21423
21562
|
* @returns A Promise of DnsRecords
|
|
@@ -21428,7 +21567,8 @@ class API extends API$q {
|
|
|
21428
21567
|
}, unmarshalDnsRecords);
|
|
21429
21568
|
|
|
21430
21569
|
/**
|
|
21431
|
-
* List all offers.
|
|
21570
|
+
* List all offers. List the different Web Hosting offers, and their options,
|
|
21571
|
+
* available to order from Scaleway.
|
|
21432
21572
|
*
|
|
21433
21573
|
* @param request - The request {@link ListOffersRequest}
|
|
21434
21574
|
* @returns A Promise of ListOffersResponse
|
|
@@ -21499,6 +21639,7 @@ exports.TransactionalEmail = index$3;
|
|
|
21499
21639
|
exports.VPC = index$2;
|
|
21500
21640
|
exports.VPCGW = index$1;
|
|
21501
21641
|
exports.Webhosting = index;
|
|
21642
|
+
exports.addAsyncHeaderInterceptor = addAsyncHeaderInterceptor;
|
|
21502
21643
|
exports.authenticateWithSessionToken = authenticateWithSessionToken;
|
|
21503
21644
|
exports.createAdvancedClient = createAdvancedClient;
|
|
21504
21645
|
exports.createClient = createClient;
|
|
@@ -21521,6 +21662,7 @@ exports.unmarshalTimeSeriesPoint = unmarshalTimeSeriesPoint;
|
|
|
21521
21662
|
exports.urlParams = urlParams;
|
|
21522
21663
|
exports.validatePathParam = validatePathParam;
|
|
21523
21664
|
exports.waitForResource = waitForResource;
|
|
21665
|
+
exports.withAdditionalInterceptors = withAdditionalInterceptors;
|
|
21524
21666
|
exports.withDefaultPageSize = withDefaultPageSize;
|
|
21525
21667
|
exports.withHTTPClient = withHTTPClient;
|
|
21526
21668
|
exports.withProfile = withProfile;
|