@scaleway/sdk 1.4.0 → 1.6.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.
Files changed (52) hide show
  1. package/dist/api/account/index.js +0 -2
  2. package/dist/api/applesilicon/v1alpha1/api.gen.js +1 -1
  3. package/dist/api/baremetal/index.js +2 -2
  4. package/dist/api/baremetal/v1/api.gen.js +2 -2
  5. package/dist/api/billing/index.js +2 -0
  6. package/dist/api/billing/v2alpha1/api.gen.js +52 -0
  7. package/dist/api/billing/v2alpha1/index.gen.js +3 -0
  8. package/dist/api/billing/v2alpha1/marshalling.gen.js +52 -0
  9. package/dist/api/cockpit/v1beta1/api.gen.js +62 -7
  10. package/dist/api/cockpit/v1beta1/marshalling.gen.js +46 -2
  11. package/dist/api/container/v1beta1/api.gen.js +1 -1
  12. package/dist/api/flexibleip/v1alpha1/api.gen.js +8 -1
  13. package/dist/api/function/v1beta1/api.gen.js +1 -1
  14. package/dist/api/function/v1beta1/marshalling.gen.js +3 -20
  15. package/dist/api/iam/v1alpha1/api.gen.js +7 -0
  16. package/dist/api/iam/v1alpha1/validation-rules.gen.js +10 -10
  17. package/dist/api/instance/index.js +2 -2
  18. package/dist/api/instance/v1/api.gen.js +86 -67
  19. package/dist/api/iot/v1/api.gen.js +1 -1
  20. package/dist/api/k8s/index.js +2 -2
  21. package/dist/api/k8s/v1/api.gen.js +14 -2
  22. package/dist/api/k8s/v1/marshalling.gen.js +6 -1
  23. package/dist/api/lb/index.js +2 -2
  24. package/dist/api/lb/v1/api.gen.js +2 -2
  25. package/dist/api/lb/v1/marshalling.gen.js +33 -19
  26. package/dist/api/mnq/v1alpha1/api.gen.js +1 -1
  27. package/dist/api/rdb/v1/api.gen.js +11 -11
  28. package/dist/api/redis/v1/api.gen.js +89 -27
  29. package/dist/api/redis/v1/marshalling.gen.js +2 -0
  30. package/dist/api/registry/v1/api.gen.js +1 -1
  31. package/dist/api/secret/v1alpha1/api.gen.js +44 -20
  32. package/dist/api/secret/v1alpha1/marshalling.gen.js +14 -2
  33. package/dist/api/tem/v1alpha1/api.gen.js +26 -14
  34. package/dist/api/vpc/v1/api.gen.js +2 -2
  35. package/dist/api/vpcgw/v1/api.gen.js +1 -1
  36. package/dist/api/webhosting/v1alpha1/api.gen.js +4 -3
  37. package/dist/helpers/is-response.js +10 -0
  38. package/dist/index.cjs +625 -366
  39. package/dist/index.d.ts +1444 -1106
  40. package/dist/index.js +44 -42
  41. package/dist/internal/async/interval-retrier.js +6 -0
  42. package/dist/internal/logger/level-resolver.js +3 -3
  43. package/dist/scw/client-ini-factory.js +6 -0
  44. package/dist/scw/client-ini-profile.js +18 -0
  45. package/dist/scw/client-settings.js +12 -0
  46. package/dist/scw/constants.js +1 -1
  47. package/dist/scw/errors/standard/quotas-exceeded-error.js +6 -0
  48. package/dist/scw/fetch/response-parser.js +2 -1
  49. package/package.json +2 -2
  50. package/dist/api/account/v2alpha1/api.gen.js +0 -85
  51. package/dist/api/account/v2alpha1/index.js +0 -1
  52. package/dist/api/account/v2alpha1/marshalling.gen.js +0 -57
package/dist/index.js CHANGED
@@ -16,45 +16,47 @@ import * as index$2 from './api/applesilicon/index.js';
16
16
  export { index$2 as AppleSilicon };
17
17
  import * as index$3 from './api/baremetal/index.js';
18
18
  export { index$3 as BareMetal };
19
- import * as index$4 from './api/cockpit/index.js';
20
- export { index$4 as Cockpit };
21
- import * as index$5 from './api/container/index.js';
22
- export { index$5 as Container };
23
- import * as index$6 from './api/domain/index.js';
24
- export { index$6 as Domain };
25
- import * as index$7 from './api/flexibleip/index.js';
26
- export { index$7 as FlexibleIP };
27
- import * as index$8 from './api/function/index.js';
28
- export { index$8 as Function };
29
- import * as index$9 from './api/iam/index.js';
30
- export { index$9 as IAM };
31
- import * as index$a from './api/instance/index.js';
32
- export { index$a as Instance };
33
- import * as index$b from './api/iot/index.js';
34
- export { index$b as IOT };
35
- import * as index$c from './api/k8s/index.js';
36
- export { index$c as K8S };
37
- import * as index$d from './api/lb/index.js';
38
- export { index$d as LB };
39
- import * as index$e from './api/marketplace/index.js';
40
- export { index$e as Marketplace };
41
- import * as index$f from './api/mnq/index.js';
42
- export { index$f as MNQ };
43
- import * as index$g from './api/rdb/index.js';
44
- export { index$g as RDB };
45
- import * as index$h from './api/redis/index.js';
46
- export { index$h as Redis };
47
- import * as index$i from './api/registry/index.js';
48
- export { index$i as Registry };
49
- import * as index$j from './api/secret/index.js';
50
- export { index$j as Secret };
51
- import * as index$k from './api/test/index.js';
52
- export { index$k as Test };
53
- import * as index$l from './api/tem/index.js';
54
- export { index$l as TransactionalEmail };
55
- import * as index$m from './api/vpc/index.js';
56
- export { index$m as VPC };
57
- import * as index$n from './api/vpcgw/index.js';
58
- export { index$n as VPCGW };
59
- import * as index$o from './api/webhosting/index.js';
60
- export { index$o as Webhosting };
19
+ import * as index$4 from './api/billing/index.js';
20
+ export { index$4 as Billing };
21
+ import * as index$5 from './api/cockpit/index.js';
22
+ export { index$5 as Cockpit };
23
+ import * as index$6 from './api/container/index.js';
24
+ export { index$6 as Container };
25
+ import * as index$7 from './api/domain/index.js';
26
+ export { index$7 as Domain };
27
+ import * as index$8 from './api/flexibleip/index.js';
28
+ export { index$8 as FlexibleIP };
29
+ import * as index$9 from './api/function/index.js';
30
+ export { index$9 as Function };
31
+ import * as index$a from './api/iam/index.js';
32
+ export { index$a as IAM };
33
+ import * as index$b from './api/instance/index.js';
34
+ export { index$b as Instance };
35
+ import * as index$c from './api/iot/index.js';
36
+ export { index$c as IOT };
37
+ import * as index$d from './api/k8s/index.js';
38
+ export { index$d as K8S };
39
+ import * as index$e from './api/lb/index.js';
40
+ export { index$e as LB };
41
+ import * as index$f from './api/marketplace/index.js';
42
+ export { index$f as Marketplace };
43
+ import * as index$g from './api/mnq/index.js';
44
+ export { index$g as MNQ };
45
+ import * as index$h from './api/rdb/index.js';
46
+ export { index$h as RDB };
47
+ import * as index$i from './api/redis/index.js';
48
+ export { index$i as Redis };
49
+ import * as index$j from './api/registry/index.js';
50
+ export { index$j as Registry };
51
+ import * as index$k from './api/secret/index.js';
52
+ export { index$k as Secret };
53
+ import * as index$l from './api/test/index.js';
54
+ export { index$l as Test };
55
+ import * as index$m from './api/tem/index.js';
56
+ export { index$m as TransactionalEmail };
57
+ import * as index$n from './api/vpc/index.js';
58
+ export { index$n as VPC };
59
+ import * as index$o from './api/vpcgw/index.js';
60
+ export { index$o as VPCGW };
61
+ import * as index$p from './api/webhosting/index.js';
62
+ export { index$p as Webhosting };
@@ -70,6 +70,12 @@ const tryAtIntervals = async function (retry, strategy, timeout) {
70
70
  * @public
71
71
  */
72
72
 
73
+ /**
74
+ * The options to wait until a resource is ready.
75
+ *
76
+ * @public
77
+ */
78
+
73
79
  /**
74
80
  * Fetches resource several times until an expected condition is reached, timeouts, or throws an exception.
75
81
  *
@@ -1,13 +1,13 @@
1
1
  // eslint-disable-next-line eslint-comments/disable-enable-pair
2
2
  /* eslint-disable @typescript-eslint/naming-convention */
3
- let LevelResolver;
4
- (function (LevelResolver) {
3
+ let LevelResolver = /*#__PURE__*/function (LevelResolver) {
5
4
  LevelResolver[LevelResolver["silent"] = 0] = "silent";
6
5
  LevelResolver[LevelResolver["error"] = 1] = "error";
7
6
  LevelResolver[LevelResolver["warn"] = 2] = "warn";
8
7
  LevelResolver[LevelResolver["info"] = 3] = "info";
9
8
  LevelResolver[LevelResolver["debug"] = 4] = "debug";
10
- })(LevelResolver || (LevelResolver = {}));
9
+ return LevelResolver;
10
+ }({});
11
11
  const shouldLog = (currentLevel, level) => LevelResolver[level] <= currentLevel;
12
12
 
13
13
  export { LevelResolver, shouldLog };
@@ -1,6 +1,12 @@
1
1
  import { authenticateWithSecrets } from './auth.js';
2
2
  import { hasAuthenticationSecrets } from './client-ini-profile.js';
3
3
 
4
+ /**
5
+ * A factory to build {@link Settings}.
6
+ *
7
+ * @public
8
+ */
9
+
4
10
  /**
5
11
  * Instantiates the SDK from a configuration {@link Profile}.
6
12
  *
@@ -1,5 +1,23 @@
1
1
  import { isAccessKey, isSecretKey } from '../internal/validations/string-validation.js';
2
2
 
3
+ /**
4
+ * Holds access key and secret key.
5
+ *
6
+ * @public
7
+ */
8
+
9
+ /**
10
+ * Holds default values of a Scaleway profile.
11
+ *
12
+ * @public
13
+ */
14
+
15
+ /**
16
+ * Holds values of a Scaleway profile.
17
+ *
18
+ * @public
19
+ */
20
+
3
21
  /**
4
22
  * Verifies that the payload contains both the accessKey and the secretKey.
5
23
  *
@@ -1,5 +1,17 @@
1
1
  import { isOrganizationId, isProjectId, isRegion, isZone, isURL } from '../internal/validations/string-validation.js';
2
2
 
3
+ /**
4
+ * Holds default values of settings.
5
+ *
6
+ * @public
7
+ */
8
+
9
+ /**
10
+ * Settings hold the values of all client options.
11
+ *
12
+ * @public
13
+ */
14
+
3
15
  /**
4
16
  * Validates the content of a {@link Settings} object.
5
17
  *
@@ -1,4 +1,4 @@
1
- const version = 'v1.3.0';
1
+ const version = 'v1.5.0';
2
2
  const userAgent = `scaleway-sdk-js/${version}`;
3
3
 
4
4
  export { userAgent, version };
@@ -7,6 +7,12 @@ import { ScalewayError } from '../scw-error.js';
7
7
  * @public
8
8
  */
9
9
 
10
+ /**
11
+ * Details of an {@link QuotasExceededError} error.
12
+ *
13
+ * @public
14
+ */
15
+
10
16
  /**
11
17
  * Build the default message for {@link QuotasExceededError}.
12
18
  *
@@ -1,3 +1,4 @@
1
+ import { isResponse } from '../../helpers/is-response.js';
1
2
  import { isJSONObject } from '../../helpers/json.js';
2
3
  import { parseScalewayError } from '../errors/error-parser.js';
3
4
  import { ScalewayError } from '../errors/scw-error.js';
@@ -45,7 +46,7 @@ const fixLegacyTotalCount = (obj, headers) => {
45
46
  * @internal
46
47
  */
47
48
  const responseParser = (unmarshaller, responseType) => async response => {
48
- if (!(response instanceof Response)) {
49
+ if (!isResponse(response)) {
49
50
  throw new TypeError('Invalid response object');
50
51
  }
51
52
  if (response.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk",
3
- "version": "1.4.0",
3
+ "version": "1.6.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": "ba3d9093e2aca9b301c9a3f1f1a0f379fd87e807"
38
+ "gitHead": "5d5bb4ab4cbd585b82597b854749659957664a80"
39
39
  }
@@ -1,85 +0,0 @@
1
- import { API as API$1 } from '../../../scw/api.js';
2
- import { urlParams, validatePathParam } from '../../../helpers/marshalling.js';
3
- import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
- import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHKey, marshalUpdateSSHKeyRequest } from './marshalling.gen.js';
5
-
6
- // This file was automatically generated. DO NOT EDIT.
7
- const jsonContentHeaders = {
8
- 'Content-Type': 'application/json; charset=utf-8'
9
- };
10
-
11
- /** Account API. */
12
- class AccountV2Alpha1GenAPI extends API$1 {
13
- constructor() {
14
- var _this;
15
- super(...arguments);
16
- _this = this;
17
- this.pageOfListSSHKeys = function (request) {
18
- if (request === void 0) {
19
- request = {};
20
- }
21
- return _this.client.fetch({
22
- method: 'GET',
23
- path: `/account/v2alpha1/ssh-keys`,
24
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
25
- }, unmarshalListSSHKeysResponse);
26
- };
27
- /**
28
- * List all SSH keys of your project
29
- *
30
- * @param request - The request {@link ListSSHKeysRequest}
31
- * @returns A Promise of ListSSHKeysResponse
32
- */
33
- this.listSSHKeys = function (request) {
34
- if (request === void 0) {
35
- request = {};
36
- }
37
- return enrichForPagination('sshKeys', _this.pageOfListSSHKeys, request);
38
- };
39
- /**
40
- * Add an SSH key to your project
41
- *
42
- * @param request - The request {@link CreateSSHKeyRequest}
43
- * @returns A Promise of SSHKey
44
- */
45
- this.createSSHKey = request => this.client.fetch({
46
- body: JSON.stringify(marshalCreateSSHKeyRequest(request, this.client.settings)),
47
- headers: jsonContentHeaders,
48
- method: 'POST',
49
- path: `/account/v2alpha1/ssh-keys`
50
- }, unmarshalSSHKey);
51
- /**
52
- * Get an SSH key from your project
53
- *
54
- * @param request - The request {@link GetSSHKeyRequest}
55
- * @returns A Promise of SSHKey
56
- */
57
- this.getSSHKey = request => this.client.fetch({
58
- method: 'GET',
59
- path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
60
- }, unmarshalSSHKey);
61
- /**
62
- * Update an SSH key on your project
63
- *
64
- * @param request - The request {@link UpdateSSHKeyRequest}
65
- * @returns A Promise of SSHKey
66
- */
67
- this.updateSSHKey = request => this.client.fetch({
68
- body: JSON.stringify(marshalUpdateSSHKeyRequest(request, this.client.settings)),
69
- headers: jsonContentHeaders,
70
- method: 'PATCH',
71
- path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
72
- }, unmarshalSSHKey);
73
- /**
74
- * Remove an SSH key from your project
75
- *
76
- * @param request - The request {@link DeleteSSHKeyRequest}
77
- */
78
- this.deleteSSHKey = request => this.client.fetch({
79
- method: 'DELETE',
80
- path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
81
- });
82
- }
83
- }
84
-
85
- export { AccountV2Alpha1GenAPI };
@@ -1 +0,0 @@
1
- export { AccountV2Alpha1GenAPI as API } from './api.gen.js';
@@ -1,57 +0,0 @@
1
- import { isJSONObject } from '../../../helpers/json.js';
2
- import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
3
-
4
- // This file was automatically generated. DO NOT EDIT.
5
- const unmarshalSSHKeyCreationInfo = data => {
6
- if (!isJSONObject(data)) {
7
- throw new TypeError(`Unmarshalling the type 'SSHKeyCreationInfo' failed as data isn't a dictionary.`);
8
- }
9
- return {
10
- address: data.address,
11
- countryCode: data.country_code,
12
- userAgent: data.user_agent
13
- };
14
- };
15
- const unmarshalSSHKey = data => {
16
- if (!isJSONObject(data)) {
17
- throw new TypeError(`Unmarshalling the type 'SSHKey' failed as data isn't a dictionary.`);
18
- }
19
- return {
20
- createdAt: unmarshalDate(data.created_at),
21
- creationInfo: data.creation_info ? unmarshalSSHKeyCreationInfo(data.creation_info) : undefined,
22
- fingerprint: data.fingerprint,
23
- id: data.id,
24
- name: data.name,
25
- organizationId: data.organization_id,
26
- projectId: data.project_id,
27
- publicKey: data.public_key,
28
- updatedAt: unmarshalDate(data.updated_at)
29
- };
30
- };
31
- const unmarshalListSSHKeysResponse = data => {
32
- if (!isJSONObject(data)) {
33
- throw new TypeError(`Unmarshalling the type 'ListSSHKeysResponse' failed as data isn't a dictionary.`);
34
- }
35
- return {
36
- sshKeys: unmarshalArrayOfObject(data.ssh_keys, unmarshalSSHKey),
37
- totalCount: data.total_count
38
- };
39
- };
40
- const marshalCreateSSHKeyRequest = (request, defaults) => ({
41
- name: request.name,
42
- public_key: request.publicKey,
43
- ...resolveOneOf([{
44
- default: defaults.defaultProjectId,
45
- param: 'project_id',
46
- value: request.projectId
47
- }, {
48
- default: defaults.defaultOrganizationId,
49
- param: 'organization_id',
50
- value: request.organizationId
51
- }])
52
- });
53
- const marshalUpdateSSHKeyRequest = (request, defaults) => ({
54
- name: request.name
55
- });
56
-
57
- export { marshalCreateSSHKeyRequest, marshalUpdateSSHKeyRequest, unmarshalListSSHKeysResponse, unmarshalSSHKey };