@scaleway/sdk 0.1.0-beta.9 → 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.
Files changed (179) hide show
  1. package/README.md +1 -1
  2. package/dist/api/account/index.js +2 -2
  3. package/dist/api/account/v2/api.gen.js +34 -18
  4. package/dist/api/account/v2/index.gen.js +3 -0
  5. package/dist/api/account/v2/marshalling.gen.js +0 -2
  6. package/dist/api/account/v2alpha1/api.gen.js +32 -13
  7. package/dist/api/account/v2alpha1/marshalling.gen.js +0 -5
  8. package/dist/api/applesilicon/index.js +2 -2
  9. package/dist/api/applesilicon/v1alpha1/api.gen.js +81 -28
  10. package/dist/api/applesilicon/v1alpha1/index.gen.js +4 -0
  11. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +1 -14
  12. package/dist/api/baremetal/v1/api.gen.js +248 -50
  13. package/dist/api/baremetal/v1/api.utils.js +9 -10
  14. package/dist/api/baremetal/v1/content.gen.js +6 -3
  15. package/dist/api/baremetal/v1/index.js +4 -1
  16. package/dist/api/baremetal/v1/marshalling.gen.js +48 -46
  17. package/dist/api/baremetal/v1/validation-rules.gen.js +109 -0
  18. package/dist/api/cockpit/index.js +2 -0
  19. package/dist/api/cockpit/v1beta1/api.gen.js +307 -0
  20. package/dist/api/cockpit/v1beta1/content.gen.js +7 -0
  21. package/dist/api/cockpit/v1beta1/index.gen.js +4 -0
  22. package/dist/api/cockpit/v1beta1/marshalling.gen.js +174 -0
  23. package/dist/api/container/index.js +2 -2
  24. package/dist/api/container/v1beta1/api.gen.js +194 -53
  25. package/dist/api/container/v1beta1/content.gen.js +4 -4
  26. package/dist/api/container/v1beta1/{index.js → index.gen.js} +3 -1
  27. package/dist/api/container/v1beta1/marshalling.gen.js +12 -26
  28. package/dist/api/domain/index.js +2 -2
  29. package/dist/api/domain/v2beta1/api.gen.js +448 -91
  30. package/dist/api/domain/v2beta1/content.gen.js +22 -1
  31. package/dist/api/domain/v2beta1/index.gen.js +4 -0
  32. package/dist/api/domain/v2beta1/marshalling.gen.js +49 -167
  33. package/dist/api/flexibleip/index.js +2 -2
  34. package/dist/api/flexibleip/v1alpha1/api.gen.js +73 -23
  35. package/dist/api/flexibleip/v1alpha1/content.gen.js +1 -1
  36. package/dist/api/flexibleip/v1alpha1/index.gen.js +6 -0
  37. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +0 -7
  38. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +14 -0
  39. package/dist/api/function/index.js +2 -2
  40. package/dist/api/function/v1beta1/api.gen.js +268 -59
  41. package/dist/api/function/v1beta1/content.gen.js +8 -5
  42. package/dist/api/function/v1beta1/index.gen.js +4 -0
  43. package/dist/api/function/v1beta1/marshalling.gen.js +137 -33
  44. package/dist/api/iam/index.js +2 -2
  45. package/dist/api/iam/v1alpha1/api.gen.js +215 -64
  46. package/dist/api/iam/v1alpha1/index.gen.js +5 -0
  47. package/dist/api/iam/v1alpha1/marshalling.gen.js +7 -29
  48. package/dist/api/iam/v1alpha1/validation-rules.gen.js +184 -0
  49. package/dist/api/instance/v1/api.gen.js +389 -129
  50. package/dist/api/instance/v1/api.utils.js +160 -51
  51. package/dist/api/instance/v1/content.gen.js +7 -7
  52. package/dist/api/instance/v1/marshalling.gen.js +58 -173
  53. package/dist/api/instance/v1/marshalling.utils.js +63 -0
  54. package/dist/api/iot/index.js +2 -2
  55. package/dist/api/iot/v1/api.gen.js +235 -57
  56. package/dist/api/iot/v1/index.gen.js +4 -0
  57. package/dist/api/iot/v1/marshalling.gen.js +2 -51
  58. package/dist/api/k8s/index.js +2 -2
  59. package/dist/api/k8s/v1/api.gen.js +206 -44
  60. package/dist/api/k8s/v1/content.gen.js +2 -2
  61. package/dist/api/k8s/v1/index.gen.js +6 -0
  62. package/dist/api/k8s/v1/marshalling.gen.js +18 -36
  63. package/dist/api/k8s/v1/validation-rules.gen.js +92 -0
  64. package/dist/api/lb/v1/api.gen.js +660 -169
  65. package/dist/api/lb/v1/api.utils.js +32 -9
  66. package/dist/api/lb/v1/content.gen.js +3 -3
  67. package/dist/api/lb/v1/marshalling.gen.js +74 -101
  68. package/dist/api/marketplace/index.js +4 -2
  69. package/dist/api/marketplace/v1/api.gen.js +15 -13
  70. package/dist/api/marketplace/v1/index.gen.js +3 -0
  71. package/dist/api/marketplace/v1/marshalling.gen.js +0 -13
  72. package/dist/api/marketplace/v2/api.gen.js +103 -0
  73. package/dist/api/marketplace/v2/index.gen.js +3 -0
  74. package/dist/api/marketplace/v2/marshalling.gen.js +92 -0
  75. package/dist/api/mnq/index.js +2 -2
  76. package/dist/api/mnq/v1alpha1/api.gen.js +66 -25
  77. package/dist/api/mnq/v1alpha1/index.gen.js +3 -0
  78. package/dist/api/mnq/v1alpha1/marshalling.gen.js +7 -46
  79. package/dist/api/rdb/index.js +2 -2
  80. package/dist/api/rdb/v1/api.gen.js +385 -92
  81. package/dist/api/rdb/v1/content.gen.js +10 -4
  82. package/dist/api/rdb/v1/index.gen.js +4 -0
  83. package/dist/api/rdb/v1/marshalling.gen.js +26 -81
  84. package/dist/api/redis/index.js +2 -2
  85. package/dist/api/redis/v1/api.gen.js +300 -0
  86. package/dist/api/redis/{v1alpha1 → v1}/content.gen.js +1 -1
  87. package/dist/api/redis/v1/index.gen.js +4 -0
  88. package/dist/api/redis/{v1alpha1 → v1}/marshalling.gen.js +42 -59
  89. package/dist/api/registry/index.js +2 -2
  90. package/dist/api/registry/v1/api.gen.js +101 -31
  91. package/dist/api/registry/v1/content.gen.js +2 -2
  92. package/dist/api/registry/v1/{index.js → index.gen.js} +3 -1
  93. package/dist/api/registry/v1/marshalling.gen.js +2 -8
  94. package/dist/api/secret/index.js +2 -0
  95. package/dist/api/secret/v1alpha1/api.gen.js +225 -0
  96. package/dist/api/secret/v1alpha1/index.gen.js +3 -0
  97. package/dist/api/secret/v1alpha1/marshalling.gen.js +82 -0
  98. package/dist/api/tem/index.js +2 -0
  99. package/dist/api/tem/v1alpha1/api.gen.js +185 -0
  100. package/dist/api/tem/v1alpha1/content.gen.js +10 -0
  101. package/dist/api/tem/v1alpha1/index.gen.js +4 -0
  102. package/dist/api/tem/v1alpha1/marshalling.gen.js +132 -0
  103. package/dist/api/test/index.js +2 -2
  104. package/dist/api/test/v1/api.gen.js +67 -21
  105. package/dist/api/test/v1/index.gen.js +4 -0
  106. package/dist/api/test/v1/marshalling.gen.js +2 -5
  107. package/dist/api/vpc/index.js +2 -2
  108. package/dist/api/vpc/v1/api.gen.js +36 -17
  109. package/dist/api/vpc/v1/index.gen.js +3 -0
  110. package/dist/api/vpc/v1/marshalling.gen.js +1 -3
  111. package/dist/api/vpcgw/index.js +2 -2
  112. package/dist/api/vpcgw/v1/api.gen.js +232 -67
  113. package/dist/api/vpcgw/v1/content.gen.js +2 -2
  114. package/dist/api/vpcgw/v1/{index.js → index.gen.js} +3 -1
  115. package/dist/api/vpcgw/v1/marshalling.gen.js +3 -24
  116. package/dist/helpers/json.js +1 -2
  117. package/dist/helpers/marshalling.js +7 -20
  118. package/dist/index.cjs +4423 -3014
  119. package/dist/index.d.ts +7900 -4488
  120. package/dist/index.js +40 -34
  121. package/dist/internal/async/interval-retrier.js +10 -16
  122. package/dist/internal/interceptors/interceptor.js +3 -1
  123. package/dist/internal/interceptors/request.js +1 -3
  124. package/dist/internal/logger/console-logger.js +3 -5
  125. package/dist/internal/logger/index.js +3 -5
  126. package/dist/internal/logger/level-resolver.js +0 -3
  127. package/dist/internal/validations/string-validation.js +8 -10
  128. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js +13 -0
  129. package/dist/scw/api.js +3 -4
  130. package/dist/scw/auth.js +3 -5
  131. package/dist/scw/client-ini-factory.js +32 -15
  132. package/dist/scw/client-ini-profile.js +10 -4
  133. package/dist/scw/client-settings.js +32 -15
  134. package/dist/scw/client.js +5 -6
  135. package/dist/scw/constants.js +1 -1
  136. package/dist/scw/custom-marshalling.js +8 -14
  137. package/dist/scw/errors/error-parser.js +2 -21
  138. package/dist/scw/errors/non-standard/invalid-request-mapper.js +17 -15
  139. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +7 -6
  140. package/dist/scw/errors/scw-error.js +20 -20
  141. package/dist/scw/errors/standard/already-exists-error.js +3 -4
  142. package/dist/scw/errors/standard/denied-authentication-error.js +4 -11
  143. package/dist/scw/errors/standard/invalid-arguments-error.js +1 -10
  144. package/dist/scw/errors/standard/out-of-stock-error.js +0 -3
  145. package/dist/scw/errors/standard/permissions-denied-error.js +1 -4
  146. package/dist/scw/errors/standard/precondition-failed-error.js +4 -8
  147. package/dist/scw/errors/standard/quotas-exceeded-error.js +14 -14
  148. package/dist/scw/errors/standard/resource-expired-error.js +3 -4
  149. package/dist/scw/errors/standard/resource-locked-error.js +3 -4
  150. package/dist/scw/errors/standard/resource-not-found-error.js +3 -4
  151. package/dist/scw/errors/standard/too-many-requests-error.js +3 -16
  152. package/dist/scw/errors/standard/transient-state-error.js +3 -4
  153. package/dist/scw/errors/types.js +0 -3
  154. package/dist/scw/fetch/build-fetcher.js +2 -10
  155. package/dist/scw/fetch/http-dumper.js +4 -7
  156. package/dist/scw/fetch/http-interceptors.js +9 -12
  157. package/dist/scw/fetch/resource-paginator.js +18 -16
  158. package/dist/scw/fetch/response-parser.js +17 -23
  159. package/node_modules/@scaleway/random-name/CHANGELOG.md +42 -63
  160. package/node_modules/@scaleway/random-name/dist/index.js +5 -246
  161. package/node_modules/@scaleway/random-name/package.json +6 -5
  162. package/package.json +4 -5
  163. package/dist/api/account/v2/index.js +0 -1
  164. package/dist/api/applesilicon/v1alpha1/index.js +0 -2
  165. package/dist/api/domain/v2beta1/index.js +0 -2
  166. package/dist/api/flexibleip/v1alpha1/index.js +0 -2
  167. package/dist/api/function/v1beta1/index.js +0 -2
  168. package/dist/api/iam/v1alpha1/index.js +0 -1
  169. package/dist/api/iot/v1/index.js +0 -2
  170. package/dist/api/k8s/v1/index.js +0 -2
  171. package/dist/api/marketplace/v1/index.js +0 -1
  172. package/dist/api/mnq/v1alpha1/index.js +0 -1
  173. package/dist/api/rdb/v1/index.js +0 -2
  174. package/dist/api/redis/v1alpha1/api.gen.js +0 -189
  175. package/dist/api/redis/v1alpha1/index.js +0 -2
  176. package/dist/api/test/v1/index.js +0 -1
  177. package/dist/api/vpc/v1/index.js +0 -1
  178. package/dist/node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js +0 -254
  179. package/node_modules/@scaleway/random-name/dist/index.browser.js +0 -256
package/README.md CHANGED
@@ -9,7 +9,7 @@ This SDK enables you to interact with Scaleway APIs.
9
9
 
10
10
  ## Getting Started
11
11
 
12
- You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/docs/console/my-project/how-to/generate-api-key) on how to retrieve them.
12
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/console/my-project/how-to/generate-api-key/) on how to retrieve them.
13
13
 
14
14
  **A minimal setup** would look like this:
15
15
 
@@ -1,4 +1,4 @@
1
1
  import * as index$1 from './v2alpha1/index.js';
2
2
  export { index$1 as v2alpha1 };
3
- import * as index$2 from './v2/index.js';
4
- export { index$2 as v2 };
3
+ import * as index_gen from './v2/index.gen.js';
4
+ export { index_gen as v2 };
@@ -1,4 +1,4 @@
1
- import { API } from '../../../scw/api.js';
1
+ import { API as API$1 } from '../../../scw/api.js';
2
2
  import { urlParams, validatePathParam } from '../../../helpers/marshalling.js';
3
3
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
4
  import { marshalCreateProjectRequest, unmarshalProject, unmarshalListProjectsResponse, marshalUpdateProjectRequest } from './marshalling.gen.js';
@@ -7,73 +7,90 @@ import { marshalCreateProjectRequest, unmarshalProject, unmarshalListProjectsRes
7
7
  const jsonContentHeaders = {
8
8
  'Content-Type': 'application/json; charset=utf-8'
9
9
  };
10
+
10
11
  /**
11
12
  * Account API.
12
13
  *
13
14
  * This API allows you to manage projects.
14
15
  */
15
-
16
- class AccountV2GenAPI extends API {
16
+ class API extends API$1 {
17
17
  constructor() {
18
18
  var _this;
19
-
20
19
  super(...arguments);
21
20
  _this = this;
22
-
21
+ /**
22
+ * Create project
23
+ *
24
+ * @param request - The request {@link CreateProjectRequest}
25
+ * @returns A Promise of Project
26
+ */
23
27
  this.createProject = request => this.client.fetch({
24
28
  body: JSON.stringify(marshalCreateProjectRequest(request, this.client.settings)),
25
29
  headers: jsonContentHeaders,
26
30
  method: 'POST',
27
31
  path: `/account/v2/projects`
28
32
  }, unmarshalProject);
29
-
30
33
  this.pageOfListProjects = function (request) {
31
34
  if (request === void 0) {
32
35
  request = {};
33
36
  }
34
-
35
37
  return _this.client.fetch({
36
38
  method: 'GET',
37
39
  path: `/account/v2/projects`,
38
- 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])
40
+ 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_ids', request.projectIds])
39
41
  }, unmarshalListProjectsResponse);
40
42
  };
41
-
43
+ /**
44
+ * List projects
45
+ *
46
+ * @param request - The request {@link ListProjectsRequest}
47
+ * @returns A Promise of ListProjectsResponse
48
+ */
42
49
  this.listProjects = function (request) {
43
50
  if (request === void 0) {
44
51
  request = {};
45
52
  }
46
-
47
53
  return enrichForPagination('projects', _this.pageOfListProjects, request);
48
54
  };
49
-
55
+ /**
56
+ * Get project
57
+ *
58
+ * @param request - The request {@link GetProjectRequest}
59
+ * @returns A Promise of Project
60
+ */
50
61
  this.getProject = function (request) {
51
62
  if (request === void 0) {
52
63
  request = {};
53
64
  }
54
-
55
65
  return _this.client.fetch({
56
66
  method: 'GET',
57
67
  path: `/account/v2/projects/${validatePathParam('projectId', request.projectId ?? _this.client.settings.defaultProjectId)}`
58
68
  }, unmarshalProject);
59
69
  };
60
-
70
+ /**
71
+ * Delete project
72
+ *
73
+ * @param request - The request {@link DeleteProjectRequest}
74
+ */
61
75
  this.deleteProject = function (request) {
62
76
  if (request === void 0) {
63
77
  request = {};
64
78
  }
65
-
66
79
  return _this.client.fetch({
67
80
  method: 'DELETE',
68
81
  path: `/account/v2/projects/${validatePathParam('projectId', request.projectId ?? _this.client.settings.defaultProjectId)}`
69
82
  });
70
83
  };
71
-
84
+ /**
85
+ * Update project
86
+ *
87
+ * @param request - The request {@link UpdateProjectRequest}
88
+ * @returns A Promise of Project
89
+ */
72
90
  this.updateProject = function (request) {
73
91
  if (request === void 0) {
74
92
  request = {};
75
93
  }
76
-
77
94
  return _this.client.fetch({
78
95
  body: JSON.stringify(marshalUpdateProjectRequest(request, _this.client.settings)),
79
96
  headers: jsonContentHeaders,
@@ -82,7 +99,6 @@ class AccountV2GenAPI extends API {
82
99
  }, unmarshalProject);
83
100
  };
84
101
  }
85
-
86
102
  }
87
103
 
88
- export { AccountV2GenAPI };
104
+ export { API };
@@ -0,0 +1,3 @@
1
+ export { API } from './api.gen.js';
2
+
3
+ // This file was automatically generated. DO NOT EDIT.
@@ -6,7 +6,6 @@ const unmarshalProject = data => {
6
6
  if (!isJSONObject(data)) {
7
7
  throw new TypeError(`Unmarshalling the type 'Project' failed as data isn't a dictionary.`);
8
8
  }
9
-
10
9
  return {
11
10
  createdAt: unmarshalDate(data.created_at),
12
11
  description: data.description,
@@ -20,7 +19,6 @@ const unmarshalListProjectsResponse = data => {
20
19
  if (!isJSONObject(data)) {
21
20
  throw new TypeError(`Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary.`);
22
21
  }
23
-
24
22
  return {
25
23
  projects: unmarshalArrayOfObject(data.projects, unmarshalProject),
26
24
  totalCount: data.total_count
@@ -1,4 +1,4 @@
1
- import { API } from '../../../scw/api.js';
1
+ import { API as API$1 } from '../../../scw/api.js';
2
2
  import { urlParams, validatePathParam } from '../../../helpers/marshalling.js';
3
3
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
4
  import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHKey, marshalUpdateSSHKeyRequest } from './marshalling.gen.js';
@@ -7,60 +7,79 @@ import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHK
7
7
  const jsonContentHeaders = {
8
8
  'Content-Type': 'application/json; charset=utf-8'
9
9
  };
10
- /** Account API. */
11
10
 
12
- class AccountV2Alpha1GenAPI extends API {
11
+ /** Account API. */
12
+ class AccountV2Alpha1GenAPI extends API$1 {
13
13
  constructor() {
14
14
  var _this;
15
-
16
15
  super(...arguments);
17
16
  _this = this;
18
-
19
17
  this.pageOfListSSHKeys = function (request) {
20
18
  if (request === void 0) {
21
19
  request = {};
22
20
  }
23
-
24
21
  return _this.client.fetch({
25
22
  method: 'GET',
26
23
  path: `/account/v2alpha1/ssh-keys`,
27
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])
28
25
  }, unmarshalListSSHKeysResponse);
29
26
  };
30
-
27
+ /**
28
+ * List all SSH keys of your project
29
+ *
30
+ * @param request - The request {@link ListSSHKeysRequest}
31
+ * @returns A Promise of ListSSHKeysResponse
32
+ */
31
33
  this.listSSHKeys = function (request) {
32
34
  if (request === void 0) {
33
35
  request = {};
34
36
  }
35
-
36
37
  return enrichForPagination('sshKeys', _this.pageOfListSSHKeys, request);
37
38
  };
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
+ */
39
45
  this.createSSHKey = request => this.client.fetch({
40
46
  body: JSON.stringify(marshalCreateSSHKeyRequest(request, this.client.settings)),
41
47
  headers: jsonContentHeaders,
42
48
  method: 'POST',
43
49
  path: `/account/v2alpha1/ssh-keys`
44
50
  }, unmarshalSSHKey);
45
-
51
+ /**
52
+ * Get an SSH key from your project
53
+ *
54
+ * @param request - The request {@link GetSSHKeyRequest}
55
+ * @returns A Promise of SSHKey
56
+ */
46
57
  this.getSSHKey = request => this.client.fetch({
47
58
  method: 'GET',
48
59
  path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
49
60
  }, unmarshalSSHKey);
50
-
61
+ /**
62
+ * Update an SSH key on your project
63
+ *
64
+ * @param request - The request {@link UpdateSSHKeyRequest}
65
+ * @returns A Promise of SSHKey
66
+ */
51
67
  this.updateSSHKey = request => this.client.fetch({
52
68
  body: JSON.stringify(marshalUpdateSSHKeyRequest(request, this.client.settings)),
53
69
  headers: jsonContentHeaders,
54
70
  method: 'PATCH',
55
71
  path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
56
72
  }, unmarshalSSHKey);
57
-
73
+ /**
74
+ * Remove an SSH key from your project
75
+ *
76
+ * @param request - The request {@link DeleteSSHKeyRequest}
77
+ */
58
78
  this.deleteSSHKey = request => this.client.fetch({
59
79
  method: 'DELETE',
60
80
  path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
61
81
  });
62
82
  }
63
-
64
83
  }
65
84
 
66
85
  export { AccountV2Alpha1GenAPI };
@@ -2,24 +2,20 @@ import { isJSONObject } from '../../../helpers/json.js';
2
2
  import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
3
3
 
4
4
  // This file was automatically generated. DO NOT EDIT.
5
-
6
5
  const unmarshalSSHKeyCreationInfo = data => {
7
6
  if (!isJSONObject(data)) {
8
7
  throw new TypeError(`Unmarshalling the type 'SSHKeyCreationInfo' failed as data isn't a dictionary.`);
9
8
  }
10
-
11
9
  return {
12
10
  address: data.address,
13
11
  countryCode: data.country_code,
14
12
  userAgent: data.user_agent
15
13
  };
16
14
  };
17
-
18
15
  const unmarshalSSHKey = data => {
19
16
  if (!isJSONObject(data)) {
20
17
  throw new TypeError(`Unmarshalling the type 'SSHKey' failed as data isn't a dictionary.`);
21
18
  }
22
-
23
19
  return {
24
20
  createdAt: unmarshalDate(data.created_at),
25
21
  creationInfo: data.creation_info ? unmarshalSSHKeyCreationInfo(data.creation_info) : undefined,
@@ -36,7 +32,6 @@ const unmarshalListSSHKeysResponse = data => {
36
32
  if (!isJSONObject(data)) {
37
33
  throw new TypeError(`Unmarshalling the type 'ListSSHKeysResponse' failed as data isn't a dictionary.`);
38
34
  }
39
-
40
35
  return {
41
36
  sshKeys: unmarshalArrayOfObject(data.ssh_keys, unmarshalSSHKey),
42
37
  totalCount: data.total_count
@@ -1,2 +1,2 @@
1
- import * as index$1 from './v1alpha1/index.js';
2
- export { index$1 as v1alpha1 };
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };
@@ -1,5 +1,5 @@
1
1
  import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
- import { API } from '../../../scw/api.js';
2
+ import { API as API$1 } from '../../../scw/api.js';
3
3
  import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
4
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
5
  import { SERVER_TRANSIENT_STATUSES } from './content.gen.js';
@@ -9,6 +9,7 @@ import { unmarshalListServerTypesResponse, unmarshalServerType, marshalCreateSer
9
9
  const jsonContentHeaders = {
10
10
  'Content-Type': 'application/json; charset=utf-8'
11
11
  };
12
+
12
13
  /**
13
14
  * Apple silicon.
14
15
  *
@@ -22,115 +23,167 @@ const jsonContentHeaders = {
22
23
  * Get set to explore, learn and build on a dedicated Mac mini M1 with more
23
24
  * performance and speed than you ever thought possible.
24
25
  *
25
- * _Apple silicon as a Service comes with a minimum allocation period of 24 hours_*.
26
+ * _Apple silicon as a Service comes with a minimum allocation period of 24
27
+ * hours_*.
26
28
  *
27
29
  * Mac mini and macOS are trademarks of Apple Inc., registered in the U.S. and
28
30
  * other countries and regions. IOS is a trademark or registered trademark of
29
31
  * Cisco in the U.S. and other countries and is used by Apple under license.
30
32
  * Scaleway is not affiliated with Apple Inc.
31
33
  */
32
-
33
- class ApplesiliconV1Alpha1GenAPI extends API {
34
+ class API extends API$1 {
34
35
  constructor() {
35
36
  var _this;
36
-
37
37
  super(...arguments);
38
38
  _this = this;
39
-
39
+ /**
40
+ * List all server types technical details.
41
+ *
42
+ * @param request - The request {@link ListServerTypesRequest}
43
+ * @returns A Promise of ListServerTypesResponse
44
+ */
40
45
  this.listServerTypes = function (request) {
41
46
  if (request === void 0) {
42
47
  request = {};
43
48
  }
44
-
45
49
  return _this.client.fetch({
46
50
  method: 'GET',
47
51
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/server-types`
48
52
  }, unmarshalListServerTypesResponse);
49
53
  };
50
-
54
+ /**
55
+ * Get a server technical details.
56
+ *
57
+ * @param request - The request {@link GetServerTypeRequest}
58
+ * @returns A Promise of ServerType
59
+ */
51
60
  this.getServerType = request => this.client.fetch({
52
61
  method: 'GET',
53
62
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/server-type/${validatePathParam('serverType', request.serverType)}`
54
63
  }, unmarshalServerType);
55
-
64
+ /**
65
+ * Create a server.
66
+ *
67
+ * @param request - The request {@link CreateServerRequest}
68
+ * @returns A Promise of Server
69
+ */
56
70
  this.createServer = request => this.client.fetch({
57
71
  body: JSON.stringify(marshalCreateServerRequest(request, this.client.settings)),
58
72
  headers: jsonContentHeaders,
59
73
  method: 'POST',
60
74
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`
61
75
  }, unmarshalServer);
62
-
63
76
  this.pageOfListServers = function (request) {
64
77
  if (request === void 0) {
65
78
  request = {};
66
79
  }
67
-
68
80
  return _this.client.fetch({
69
81
  method: 'GET',
70
82
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/servers`,
71
- urlParams: urlParams(['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])
83
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId])
72
84
  }, unmarshalListServersResponse);
73
85
  };
74
-
86
+ /**
87
+ * List all servers.
88
+ *
89
+ * @param request - The request {@link ListServersRequest}
90
+ * @returns A Promise of ListServersResponse
91
+ */
75
92
  this.listServers = function (request) {
76
93
  if (request === void 0) {
77
94
  request = {};
78
95
  }
79
-
80
96
  return enrichForPagination('servers', _this.pageOfListServers, request);
81
97
  };
82
-
83
98
  this.pageOfListOS = function (request) {
84
99
  if (request === void 0) {
85
100
  request = {};
86
101
  }
87
-
88
102
  return _this.client.fetch({
89
103
  method: 'GET',
90
104
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/os`,
91
105
  urlParams: urlParams(['name', request.name], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['server_type', request.serverType])
92
106
  }, unmarshalListOSResponse);
93
107
  };
94
-
108
+ /**
109
+ * List all Operating System (OS).
110
+ *
111
+ * @param request - The request {@link ListOSRequest}
112
+ * @returns A Promise of ListOSResponse
113
+ */
95
114
  this.listOS = function (request) {
96
115
  if (request === void 0) {
97
116
  request = {};
98
117
  }
99
-
100
118
  return enrichForPagination('os', _this.pageOfListOS, request);
101
119
  };
102
-
120
+ /**
121
+ * Get an Operating System (OS).
122
+ *
123
+ * @param request - The request {@link GetOSRequest}
124
+ * @returns A Promise of OS
125
+ */
103
126
  this.getOS = request => this.client.fetch({
104
127
  method: 'GET',
105
128
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`
106
129
  }, unmarshalOS);
107
-
130
+ /**
131
+ * Get a server.
132
+ *
133
+ * @param request - The request {@link GetServerRequest}
134
+ * @returns A Promise of Server
135
+ */
108
136
  this.getServer = request => this.client.fetch({
109
137
  method: 'GET',
110
138
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
111
139
  }, unmarshalServer);
112
-
140
+ /**
141
+ * Waits for {@link Server} to be in a final state.
142
+ *
143
+ * @param request - The request {@link GetServerRequest}
144
+ * @param options - The waiting options
145
+ * @returns A Promise of Server
146
+ */
113
147
  this.waitForServer = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!SERVER_TRANSIENT_STATUSES.includes(res.status))), this.getServer, request, options);
114
-
148
+ /**
149
+ * Update a server.
150
+ *
151
+ * @param request - The request {@link UpdateServerRequest}
152
+ * @returns A Promise of Server
153
+ */
115
154
  this.updateServer = request => this.client.fetch({
116
155
  body: JSON.stringify(marshalUpdateServerRequest(request, this.client.settings)),
117
156
  headers: jsonContentHeaders,
118
157
  method: 'PATCH',
119
158
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
120
159
  }, unmarshalServer);
121
-
160
+ /**
161
+ * Delete a server.
162
+ *
163
+ * @param request - The request {@link DeleteServerRequest}
164
+ */
122
165
  this.deleteServer = request => this.client.fetch({
123
166
  method: 'DELETE',
124
167
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
125
168
  });
126
-
169
+ /**
170
+ * Reboot a server.
171
+ *
172
+ * @param request - The request {@link RebootServerRequest}
173
+ * @returns A Promise of Server
174
+ */
127
175
  this.rebootServer = request => this.client.fetch({
128
176
  body: '{}',
129
177
  headers: jsonContentHeaders,
130
178
  method: 'POST',
131
179
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`
132
180
  }, unmarshalServer);
133
-
181
+ /**
182
+ * Reinstall a server.
183
+ *
184
+ * @param request - The request {@link ReinstallServerRequest}
185
+ * @returns A Promise of Server
186
+ */
134
187
  this.reinstallServer = request => this.client.fetch({
135
188
  body: '{}',
136
189
  headers: jsonContentHeaders,
@@ -138,8 +191,8 @@ class ApplesiliconV1Alpha1GenAPI extends API {
138
191
  path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reinstall`
139
192
  }, unmarshalServer);
140
193
  }
141
-
142
194
  }
143
- ApplesiliconV1Alpha1GenAPI.LOCALITIES = ['fr-par-3'];
195
+ /** Lists the available zones of the API. */
196
+ API.LOCALITIES = ['fr-par-3'];
144
197
 
145
- export { ApplesiliconV1Alpha1GenAPI };
198
+ export { API };
@@ -0,0 +1,4 @@
1
+ export { API } from './api.gen.js';
2
+ export { SERVER_TRANSIENT_STATUSES } from './content.gen.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
@@ -1,47 +1,39 @@
1
- import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js';
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js';
2
2
  import { isJSONObject } from '../../../helpers/json.js';
3
3
  import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
4
4
 
5
5
  // This file was automatically generated. DO NOT EDIT.
6
-
7
6
  const unmarshalServerTypeCPU = data => {
8
7
  if (!isJSONObject(data)) {
9
8
  throw new TypeError(`Unmarshalling the type 'ServerTypeCPU' failed as data isn't a dictionary.`);
10
9
  }
11
-
12
10
  return {
13
11
  coreCount: data.core_count,
14
12
  name: data.name
15
13
  };
16
14
  };
17
-
18
15
  const unmarshalServerTypeDisk = data => {
19
16
  if (!isJSONObject(data)) {
20
17
  throw new TypeError(`Unmarshalling the type 'ServerTypeDisk' failed as data isn't a dictionary.`);
21
18
  }
22
-
23
19
  return {
24
20
  capacity: data.capacity,
25
21
  type: data.type
26
22
  };
27
23
  };
28
-
29
24
  const unmarshalServerTypeMemory = data => {
30
25
  if (!isJSONObject(data)) {
31
26
  throw new TypeError(`Unmarshalling the type 'ServerTypeMemory' failed as data isn't a dictionary.`);
32
27
  }
33
-
34
28
  return {
35
29
  capacity: data.capacity,
36
30
  type: data.type
37
31
  };
38
32
  };
39
-
40
33
  const unmarshalOS = data => {
41
34
  if (!isJSONObject(data)) {
42
35
  throw new TypeError(`Unmarshalling the type 'OS' failed as data isn't a dictionary.`);
43
36
  }
44
-
45
37
  return {
46
38
  compatibleServerTypes: data.compatible_server_types,
47
39
  id: data.id,
@@ -54,7 +46,6 @@ const unmarshalServer = data => {
54
46
  if (!isJSONObject(data)) {
55
47
  throw new TypeError(`Unmarshalling the type 'Server' failed as data isn't a dictionary.`);
56
48
  }
57
-
58
49
  return {
59
50
  createdAt: unmarshalDate(data.created_at),
60
51
  deletableAt: unmarshalDate(data.deletable_at),
@@ -74,7 +65,6 @@ const unmarshalServerType = data => {
74
65
  if (!isJSONObject(data)) {
75
66
  throw new TypeError(`Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`);
76
67
  }
77
-
78
68
  return {
79
69
  cpu: data.cpu ? unmarshalServerTypeCPU(data.cpu) : undefined,
80
70
  disk: data.disk ? unmarshalServerTypeDisk(data.disk) : undefined,
@@ -88,7 +78,6 @@ const unmarshalListOSResponse = data => {
88
78
  if (!isJSONObject(data)) {
89
79
  throw new TypeError(`Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`);
90
80
  }
91
-
92
81
  return {
93
82
  os: unmarshalArrayOfObject(data.os, unmarshalOS),
94
83
  totalCount: data.total_count
@@ -98,7 +87,6 @@ const unmarshalListServerTypesResponse = data => {
98
87
  if (!isJSONObject(data)) {
99
88
  throw new TypeError(`Unmarshalling the type 'ListServerTypesResponse' failed as data isn't a dictionary.`);
100
89
  }
101
-
102
90
  return {
103
91
  serverTypes: unmarshalArrayOfObject(data.server_types, unmarshalServerType)
104
92
  };
@@ -107,7 +95,6 @@ const unmarshalListServersResponse = data => {
107
95
  if (!isJSONObject(data)) {
108
96
  throw new TypeError(`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`);
109
97
  }
110
-
111
98
  return {
112
99
  servers: unmarshalArrayOfObject(data.servers, unmarshalServer),
113
100
  totalCount: data.total_count