@scaleway/sdk 2.0.0-alpha.11 → 2.0.0-alpha.13

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 (204) hide show
  1. package/package.json +2 -2
  2. package/dist/api/account/index.js +0 -4
  3. package/dist/api/account/v2/api.gen.js +0 -147
  4. package/dist/api/account/v2/index.gen.js +0 -4
  5. package/dist/api/account/v2/marshalling.gen.js +0 -39
  6. package/dist/api/account/v3/api.gen.js +0 -129
  7. package/dist/api/account/v3/index.gen.js +0 -6
  8. package/dist/api/account/v3/marshalling.gen.js +0 -39
  9. package/dist/api/account/v3/validation-rules.gen.js +0 -39
  10. package/dist/api/applesilicon/index.js +0 -2
  11. package/dist/api/applesilicon/v1alpha1/api.gen.js +0 -220
  12. package/dist/api/applesilicon/v1alpha1/content.gen.js +0 -7
  13. package/dist/api/applesilicon/v1alpha1/index.gen.js +0 -5
  14. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +0 -113
  15. package/dist/api/baremetal/index.js +0 -2
  16. package/dist/api/baremetal/v1/api.gen.js +0 -523
  17. package/dist/api/baremetal/v1/api.utils.js +0 -27
  18. package/dist/api/baremetal/v1/content.gen.js +0 -13
  19. package/dist/api/baremetal/v1/index.js +0 -5
  20. package/dist/api/baremetal/v1/marshalling.gen.js +0 -395
  21. package/dist/api/baremetal/v1/validation-rules.gen.js +0 -109
  22. package/dist/api/billing/index.js +0 -2
  23. package/dist/api/billing/v2alpha1/api.gen.js +0 -80
  24. package/dist/api/billing/v2alpha1/index.gen.js +0 -4
  25. package/dist/api/billing/v2alpha1/marshalling.gen.js +0 -53
  26. package/dist/api/block/index.js +0 -2
  27. package/dist/api/block/v1alpha1/api.gen.js +0 -245
  28. package/dist/api/block/v1alpha1/content.gen.js +0 -13
  29. package/dist/api/block/v1alpha1/index.gen.js +0 -7
  30. package/dist/api/block/v1alpha1/marshalling.gen.js +0 -175
  31. package/dist/api/block/v1alpha1/validation-rules.gen.js +0 -42
  32. package/dist/api/cockpit/index.js +0 -2
  33. package/dist/api/cockpit/v1beta1/api.gen.js +0 -448
  34. package/dist/api/cockpit/v1beta1/content.gen.js +0 -7
  35. package/dist/api/cockpit/v1beta1/index.gen.js +0 -5
  36. package/dist/api/cockpit/v1beta1/marshalling.gen.js +0 -220
  37. package/dist/api/container/index.js +0 -2
  38. package/dist/api/container/v1beta1/api.gen.js +0 -549
  39. package/dist/api/container/v1beta1/content.gen.js +0 -22
  40. package/dist/api/container/v1beta1/index.gen.js +0 -5
  41. package/dist/api/container/v1beta1/marshalling.gen.js +0 -330
  42. package/dist/api/document_db/index.js +0 -2
  43. package/dist/api/document_db/v1beta1/api.gen.js +0 -830
  44. package/dist/api/document_db/v1beta1/content.gen.js +0 -19
  45. package/dist/api/document_db/v1beta1/index.gen.js +0 -7
  46. package/dist/api/document_db/v1beta1/marshalling.gen.js +0 -580
  47. package/dist/api/document_db/v1beta1/validation-rules.gen.js +0 -10
  48. package/dist/api/domain/index.js +0 -2
  49. package/dist/api/domain/v2beta1/api.gen.js +0 -875
  50. package/dist/api/domain/v2beta1/content.gen.js +0 -28
  51. package/dist/api/domain/v2beta1/index.gen.js +0 -7
  52. package/dist/api/domain/v2beta1/marshalling.gen.js +0 -958
  53. package/dist/api/flexibleip/index.js +0 -2
  54. package/dist/api/flexibleip/v1alpha1/api.gen.js +0 -203
  55. package/dist/api/flexibleip/v1alpha1/content.gen.js +0 -10
  56. package/dist/api/flexibleip/v1alpha1/index.gen.js +0 -7
  57. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +0 -97
  58. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +0 -14
  59. package/dist/api/function/index.js +0 -2
  60. package/dist/api/function/v1beta1/api.gen.js +0 -560
  61. package/dist/api/function/v1beta1/content.gen.js +0 -22
  62. package/dist/api/function/v1beta1/index.gen.js +0 -5
  63. package/dist/api/function/v1beta1/marshalling.gen.js +0 -368
  64. package/dist/api/iam/index.js +0 -2
  65. package/dist/api/iam/v1alpha1/api.gen.js +0 -799
  66. package/dist/api/iam/v1alpha1/index.gen.js +0 -6
  67. package/dist/api/iam/v1alpha1/marshalling.gen.js +0 -373
  68. package/dist/api/iam/v1alpha1/validation-rules.gen.js +0 -207
  69. package/dist/api/instance/index.js +0 -2
  70. package/dist/api/instance/v1/api.gen.js +0 -1003
  71. package/dist/api/instance/v1/api.utils.js +0 -369
  72. package/dist/api/instance/v1/content.gen.js +0 -31
  73. package/dist/api/instance/v1/index.js +0 -2
  74. package/dist/api/instance/v1/marshalling.gen.js +0 -1206
  75. package/dist/api/instance/v1/marshalling.utils.js +0 -63
  76. package/dist/api/iot/index.js +0 -2
  77. package/dist/api/iot/v1/api.gen.js +0 -581
  78. package/dist/api/iot/v1/content.gen.js +0 -7
  79. package/dist/api/iot/v1/index.gen.js +0 -5
  80. package/dist/api/iot/v1/marshalling.gen.js +0 -388
  81. package/dist/api/ipfs/index.js +0 -2
  82. package/dist/api/ipfs/v1alpha1/api.gen.js +0 -197
  83. package/dist/api/ipfs/v1alpha1/content.gen.js +0 -7
  84. package/dist/api/ipfs/v1alpha1/index.gen.js +0 -5
  85. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +0 -121
  86. package/dist/api/k8s/index.js +0 -2
  87. package/dist/api/k8s/v1/api.gen.js +0 -454
  88. package/dist/api/k8s/v1/api.utils.js +0 -13
  89. package/dist/api/k8s/v1/content.gen.js +0 -13
  90. package/dist/api/k8s/v1/index.js +0 -4
  91. package/dist/api/k8s/v1/marshalling.gen.js +0 -333
  92. package/dist/api/k8s/v1/validation-rules.gen.js +0 -101
  93. package/dist/api/lb/index.js +0 -2
  94. package/dist/api/lb/v1/api.gen.js +0 -1669
  95. package/dist/api/lb/v1/api.utils.js +0 -81
  96. package/dist/api/lb/v1/content.gen.js +0 -16
  97. package/dist/api/lb/v1/index.js +0 -2
  98. package/dist/api/lb/v1/marshalling.gen.js +0 -923
  99. package/dist/api/marketplace/index.js +0 -4
  100. package/dist/api/marketplace/v1/api.gen.js +0 -60
  101. package/dist/api/marketplace/v1/index.gen.js +0 -4
  102. package/dist/api/marketplace/v1/marshalling.gen.js +0 -92
  103. package/dist/api/marketplace/v2/api.gen.js +0 -162
  104. package/dist/api/marketplace/v2/index.gen.js +0 -4
  105. package/dist/api/marketplace/v2/marshalling.gen.js +0 -94
  106. package/dist/api/mnq/index.js +0 -2
  107. package/dist/api/mnq/v1alpha1/api.gen.js +0 -205
  108. package/dist/api/mnq/v1alpha1/index.gen.js +0 -4
  109. package/dist/api/mnq/v1alpha1/marshalling.gen.js +0 -121
  110. package/dist/api/rdb/index.js +0 -2
  111. package/dist/api/rdb/v1/api.gen.js +0 -972
  112. package/dist/api/rdb/v1/content.gen.js +0 -22
  113. package/dist/api/rdb/v1/index.gen.js +0 -7
  114. package/dist/api/rdb/v1/marshalling.gen.js +0 -636
  115. package/dist/api/rdb/v1/validation-rules.gen.js +0 -10
  116. package/dist/api/redis/index.js +0 -2
  117. package/dist/api/redis/v1/api.gen.js +0 -389
  118. package/dist/api/redis/v1/content.gen.js +0 -7
  119. package/dist/api/redis/v1/index.gen.js +0 -5
  120. package/dist/api/redis/v1/marshalling.gen.js +0 -259
  121. package/dist/api/registry/index.js +0 -2
  122. package/dist/api/registry/v1/api.gen.js +0 -252
  123. package/dist/api/registry/v1/content.gen.js +0 -13
  124. package/dist/api/registry/v1/index.gen.js +0 -5
  125. package/dist/api/registry/v1/marshalling.gen.js +0 -106
  126. package/dist/api/secret/index.js +0 -2
  127. package/dist/api/secret/v1alpha1/api.gen.js +0 -415
  128. package/dist/api/secret/v1alpha1/index.gen.js +0 -4
  129. package/dist/api/secret/v1alpha1/marshalling.gen.js +0 -143
  130. package/dist/api/tem/index.js +0 -2
  131. package/dist/api/tem/v1alpha1/api.gen.js +0 -229
  132. package/dist/api/tem/v1alpha1/content.gen.js +0 -10
  133. package/dist/api/tem/v1alpha1/index.gen.js +0 -5
  134. package/dist/api/tem/v1alpha1/marshalling.gen.js +0 -159
  135. package/dist/api/test/index.js +0 -2
  136. package/dist/api/test/v1/api.gen.js +0 -152
  137. package/dist/api/test/v1/content.gen.js +0 -7
  138. package/dist/api/test/v1/index.gen.js +0 -5
  139. package/dist/api/test/v1/marshalling.gen.js +0 -79
  140. package/dist/api/vpc/index.js +0 -4
  141. package/dist/api/vpc/v1/api.gen.js +0 -110
  142. package/dist/api/vpc/v1/index.gen.js +0 -4
  143. package/dist/api/vpc/v1/marshalling.gen.js +0 -44
  144. package/dist/api/vpc/v2/api.gen.js +0 -276
  145. package/dist/api/vpc/v2/index.gen.js +0 -4
  146. package/dist/api/vpc/v2/marshalling.gen.js +0 -135
  147. package/dist/api/vpcgw/index.js +0 -2
  148. package/dist/api/vpcgw/v1/api.gen.js +0 -669
  149. package/dist/api/vpcgw/v1/content.gen.js +0 -10
  150. package/dist/api/vpcgw/v1/index.gen.js +0 -5
  151. package/dist/api/vpcgw/v1/marshalling.gen.js +0 -336
  152. package/dist/api/webhosting/index.js +0 -2
  153. package/dist/api/webhosting/v1alpha1/api.gen.js +0 -210
  154. package/dist/api/webhosting/v1alpha1/content.gen.js +0 -7
  155. package/dist/api/webhosting/v1alpha1/index.gen.js +0 -7
  156. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +0 -173
  157. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +0 -23
  158. package/dist/helpers/is-browser.js +0 -5
  159. package/dist/helpers/is-response.js +0 -10
  160. package/dist/helpers/json.js +0 -11
  161. package/dist/helpers/marshalling.js +0 -130
  162. package/dist/index.cjs +0 -24364
  163. package/dist/index.d.ts +0 -27584
  164. package/dist/index.js +0 -69
  165. package/dist/internal/async/interval-retrier.js +0 -105
  166. package/dist/internal/async/sleep.js +0 -13
  167. package/dist/internal/interceptors/composer.js +0 -46
  168. package/dist/internal/interceptors/helpers.js +0 -32
  169. package/dist/internal/logger/console-logger.js +0 -38
  170. package/dist/internal/logger/index.js +0 -41
  171. package/dist/internal/logger/level-resolver.js +0 -13
  172. package/dist/internal/validations/string-validation.js +0 -38
  173. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js +0 -13
  174. package/dist/scw/api.js +0 -12
  175. package/dist/scw/auth.js +0 -68
  176. package/dist/scw/client-ini-factory.js +0 -174
  177. package/dist/scw/client-ini-profile.js +0 -54
  178. package/dist/scw/client-settings.js +0 -78
  179. package/dist/scw/client.js +0 -98
  180. package/dist/scw/constants.js +0 -4
  181. package/dist/scw/custom-marshalling.js +0 -131
  182. package/dist/scw/errors/error-parser.js +0 -107
  183. package/dist/scw/errors/non-standard/invalid-request-mapper.js +0 -36
  184. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +0 -27
  185. package/dist/scw/errors/scw-error.js +0 -66
  186. package/dist/scw/errors/standard/already-exists-error.js +0 -26
  187. package/dist/scw/errors/standard/denied-authentication-error.js +0 -52
  188. package/dist/scw/errors/standard/index.js +0 -13
  189. package/dist/scw/errors/standard/invalid-arguments-error.js +0 -67
  190. package/dist/scw/errors/standard/out-of-stock-error.js +0 -22
  191. package/dist/scw/errors/standard/permissions-denied-error.js +0 -48
  192. package/dist/scw/errors/standard/precondition-failed-error.js +0 -42
  193. package/dist/scw/errors/standard/quotas-exceeded-error.js +0 -68
  194. package/dist/scw/errors/standard/resource-expired-error.js +0 -26
  195. package/dist/scw/errors/standard/resource-locked-error.js +0 -25
  196. package/dist/scw/errors/standard/resource-not-found-error.js +0 -25
  197. package/dist/scw/errors/standard/too-many-requests-error.js +0 -70
  198. package/dist/scw/errors/standard/transient-state-error.js +0 -26
  199. package/dist/scw/errors/types.js +0 -23
  200. package/dist/scw/fetch/build-fetcher.js +0 -72
  201. package/dist/scw/fetch/http-dumper.js +0 -54
  202. package/dist/scw/fetch/http-interceptors.js +0 -99
  203. package/dist/scw/fetch/resource-paginator.js +0 -84
  204. package/dist/scw/fetch/response-parser.js +0 -72
@@ -1,113 +0,0 @@
1
- import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js';
2
- import { isJSONObject } from '../../../helpers/json.js';
3
- import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
4
-
5
- // This file was automatically generated. DO NOT EDIT.
6
- // If you have any remark or suggestion do not hesitate to open an issue.
7
- const unmarshalOS = data => {
8
- if (!isJSONObject(data)) {
9
- throw new TypeError(`Unmarshalling the type 'OS' failed as data isn't a dictionary.`);
10
- }
11
- return {
12
- compatibleServerTypes: data.compatible_server_types,
13
- id: data.id,
14
- imageUrl: data.image_url,
15
- label: data.label,
16
- name: data.name
17
- };
18
- };
19
- const unmarshalServerTypeMemory = data => {
20
- if (!isJSONObject(data)) {
21
- throw new TypeError(`Unmarshalling the type 'ServerTypeMemory' failed as data isn't a dictionary.`);
22
- }
23
- return {
24
- capacity: data.capacity,
25
- type: data.type
26
- };
27
- };
28
- const unmarshalServerTypeDisk = data => {
29
- if (!isJSONObject(data)) {
30
- throw new TypeError(`Unmarshalling the type 'ServerTypeDisk' failed as data isn't a dictionary.`);
31
- }
32
- return {
33
- capacity: data.capacity,
34
- type: data.type
35
- };
36
- };
37
- const unmarshalServerTypeCPU = data => {
38
- if (!isJSONObject(data)) {
39
- throw new TypeError(`Unmarshalling the type 'ServerTypeCPU' failed as data isn't a dictionary.`);
40
- }
41
- return {
42
- coreCount: data.core_count,
43
- name: data.name
44
- };
45
- };
46
- const unmarshalServerType = data => {
47
- if (!isJSONObject(data)) {
48
- throw new TypeError(`Unmarshalling the type 'ServerType' failed as data isn't a dictionary.`);
49
- }
50
- return {
51
- cpu: unmarshalServerTypeCPU(data.cpu),
52
- disk: unmarshalServerTypeDisk(data.disk),
53
- memory: unmarshalServerTypeMemory(data.memory),
54
- minimumLeaseDuration: data.minimum_lease_duration ? data.minimum_lease_duration : undefined,
55
- name: data.name,
56
- stock: data.stock
57
- };
58
- };
59
- const unmarshalServer = data => {
60
- if (!isJSONObject(data)) {
61
- throw new TypeError(`Unmarshalling the type 'Server' failed as data isn't a dictionary.`);
62
- }
63
- return {
64
- createdAt: unmarshalDate(data.created_at),
65
- deletableAt: unmarshalDate(data.deletable_at),
66
- id: data.id,
67
- ip: data.ip,
68
- name: data.name,
69
- organizationId: data.organization_id,
70
- projectId: data.project_id,
71
- status: data.status,
72
- type: data.type,
73
- updatedAt: unmarshalDate(data.updated_at),
74
- vncUrl: data.vnc_url,
75
- zone: data.zone
76
- };
77
- };
78
- const unmarshalListOSResponse = data => {
79
- if (!isJSONObject(data)) {
80
- throw new TypeError(`Unmarshalling the type 'ListOSResponse' failed as data isn't a dictionary.`);
81
- }
82
- return {
83
- os: unmarshalArrayOfObject(data.os, unmarshalOS),
84
- totalCount: data.total_count
85
- };
86
- };
87
- const unmarshalListServerTypesResponse = data => {
88
- if (!isJSONObject(data)) {
89
- throw new TypeError(`Unmarshalling the type 'ListServerTypesResponse' failed as data isn't a dictionary.`);
90
- }
91
- return {
92
- serverTypes: unmarshalArrayOfObject(data.server_types, unmarshalServerType)
93
- };
94
- };
95
- const unmarshalListServersResponse = data => {
96
- if (!isJSONObject(data)) {
97
- throw new TypeError(`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`);
98
- }
99
- return {
100
- servers: unmarshalArrayOfObject(data.servers, unmarshalServer),
101
- totalCount: data.total_count
102
- };
103
- };
104
- const marshalCreateServerRequest = (request, defaults) => ({
105
- name: request.name || randomName('as'),
106
- project_id: request.projectId ?? defaults.defaultProjectId,
107
- type: request.type
108
- });
109
- const marshalUpdateServerRequest = (request, defaults) => ({
110
- name: request.name
111
- });
112
-
113
- export { marshalCreateServerRequest, marshalUpdateServerRequest, unmarshalListOSResponse, unmarshalListServerTypesResponse, unmarshalListServersResponse, unmarshalOS, unmarshalServer, unmarshalServerType };
@@ -1,2 +0,0 @@
1
- import * as index from './v1/index.js';
2
- export { index as v1 };
@@ -1,523 +0,0 @@
1
- import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
- import { API as API$1 } from '../../../scw/api.js';
3
- import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
- import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
- import { SERVER_TRANSIENT_STATUSES } from './content.gen.js';
6
- import { marshalPrivateNetworkApiAddServerPrivateNetworkRequest, unmarshalServerPrivateNetwork, marshalPrivateNetworkApiSetServerPrivateNetworksRequest, unmarshalSetServerPrivateNetworksResponse, unmarshalListServerPrivateNetworksResponse, unmarshalListServersResponse, unmarshalServer, marshalCreateServerRequest, marshalUpdateServerRequest, marshalInstallServerRequest, unmarshalGetServerMetricsResponse, marshalRebootServerRequest, marshalStartServerRequest, unmarshalListServerEventsResponse, marshalStartBMCAccessRequest, unmarshalBMCAccess, marshalUpdateIPRequest, unmarshalIP, marshalAddOptionServerRequest, unmarshalListOffersResponse, unmarshalOffer, unmarshalOption, unmarshalListOptionsResponse, unmarshalListSettingsResponse, marshalUpdateSettingRequest, unmarshalSetting, unmarshalListOSResponse, unmarshalOS } from './marshalling.gen.js';
7
-
8
- // This file was automatically generated. DO NOT EDIT.
9
- // If you have any remark or suggestion do not hesitate to open an issue.
10
- const jsonContentHeaders = {
11
- 'Content-Type': 'application/json; charset=utf-8'
12
- };
13
-
14
- /**
15
- * Elastic Metal API.
16
- *
17
- * This API allows to manage your Elastic Metal server.
18
- */
19
- class API extends API$1 {
20
- /** Lists the available zones of the API. */
21
- static LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1', 'nl-ams-2'];
22
- pageOfListServers = (() => {
23
- var _this = this;
24
- return function (request) {
25
- if (request === void 0) {
26
- request = {};
27
- }
28
- return _this.client.fetch({
29
- method: 'GET',
30
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/servers`,
31
- urlParams: urlParams(['name', request.name], ['option_id', request.optionId], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId], ['status', request.status], ['tags', request.tags])
32
- }, unmarshalListServersResponse);
33
- };
34
- })();
35
-
36
- /**
37
- * List Elastic Metal servers for an Organization. List Elastic Metal servers
38
- * for a specific Organization.
39
- *
40
- * @param request - The request {@link ListServersRequest}
41
- * @returns A Promise of ListServersResponse
42
- */
43
- listServers = (() => {
44
- var _this2 = this;
45
- return function (request) {
46
- if (request === void 0) {
47
- request = {};
48
- }
49
- return enrichForPagination('servers', _this2.pageOfListServers, request);
50
- };
51
- })();
52
-
53
- /**
54
- * Get a specific Elastic Metal server. Get full details of an existing
55
- * Elastic Metal server associated with the ID.
56
- *
57
- * @param request - The request {@link GetServerRequest}
58
- * @returns A Promise of Server
59
- */
60
- getServer = request => this.client.fetch({
61
- method: 'GET',
62
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
63
- }, unmarshalServer);
64
-
65
- /**
66
- * Waits for {@link Server} to be in a final state.
67
- *
68
- * @param request - The request {@link GetServerRequest}
69
- * @param options - The waiting options
70
- * @returns A Promise of Server
71
- */
72
- waitForServer = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!SERVER_TRANSIENT_STATUSES.includes(res.status))), this.getServer, request, options);
73
-
74
- /**
75
- * Create an Elastic Metal server. Create a new Elastic Metal server. Once the
76
- * server is created, proceed with the [installation of an OS](#post-3e949e).
77
- *
78
- * @param request - The request {@link CreateServerRequest}
79
- * @returns A Promise of Server
80
- */
81
- createServer = request => this.client.fetch({
82
- body: JSON.stringify(marshalCreateServerRequest(request, this.client.settings)),
83
- headers: jsonContentHeaders,
84
- method: 'POST',
85
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`
86
- }, unmarshalServer);
87
-
88
- /**
89
- * Update an Elastic Metal server. Update the server associated with the ID.
90
- * You can update parameters such as the server's name, tags and description.
91
- * Any parameters left null in the request body are not updated.
92
- *
93
- * @param request - The request {@link UpdateServerRequest}
94
- * @returns A Promise of Server
95
- */
96
- updateServer = request => this.client.fetch({
97
- body: JSON.stringify(marshalUpdateServerRequest(request, this.client.settings)),
98
- headers: jsonContentHeaders,
99
- method: 'PATCH',
100
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
101
- }, unmarshalServer);
102
-
103
- /**
104
- * Install an Elastic Metal server. Install an Operating System (OS) on the
105
- * Elastic Metal server with a specific ID.
106
- *
107
- * @param request - The request {@link InstallServerRequest}
108
- * @returns A Promise of Server
109
- */
110
- installServer = request => this.client.fetch({
111
- body: JSON.stringify(marshalInstallServerRequest(request, this.client.settings)),
112
- headers: jsonContentHeaders,
113
- method: 'POST',
114
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/install`
115
- }, unmarshalServer);
116
-
117
- /**
118
- * Return server metrics. Get the ping status of the server associated with
119
- * the ID.
120
- *
121
- * @param request - The request {@link GetServerMetricsRequest}
122
- * @returns A Promise of GetServerMetricsResponse
123
- */
124
- getServerMetrics = request => this.client.fetch({
125
- method: 'GET',
126
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/metrics`
127
- }, unmarshalGetServerMetricsResponse);
128
-
129
- /**
130
- * Delete an Elastic Metal server. Delete the server associated with the ID.
131
- *
132
- * @param request - The request {@link DeleteServerRequest}
133
- * @returns A Promise of Server
134
- */
135
- deleteServer = request => this.client.fetch({
136
- method: 'DELETE',
137
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
138
- }, unmarshalServer);
139
-
140
- /**
141
- * Reboot an Elastic Metal server. Reboot the Elastic Metal server associated
142
- * with the ID, use the `boot_type` `rescue` to reboot the server in rescue
143
- * mode.
144
- *
145
- * @param request - The request {@link RebootServerRequest}
146
- * @returns A Promise of Server
147
- */
148
- rebootServer = request => this.client.fetch({
149
- body: JSON.stringify(marshalRebootServerRequest(request, this.client.settings)),
150
- headers: jsonContentHeaders,
151
- method: 'POST',
152
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`
153
- }, unmarshalServer);
154
-
155
- /**
156
- * Start an Elastic Metal server. Start the server associated with the ID.
157
- *
158
- * @param request - The request {@link StartServerRequest}
159
- * @returns A Promise of Server
160
- */
161
- startServer = request => this.client.fetch({
162
- body: JSON.stringify(marshalStartServerRequest(request, this.client.settings)),
163
- headers: jsonContentHeaders,
164
- method: 'POST',
165
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/start`
166
- }, unmarshalServer);
167
-
168
- /**
169
- * Stop an Elastic Metal server. Stop the server associated with the ID. The
170
- * server remains allocated to your account and all data remains on the local
171
- * storage of the server.
172
- *
173
- * @param request - The request {@link StopServerRequest}
174
- * @returns A Promise of Server
175
- */
176
- stopServer = request => this.client.fetch({
177
- body: '{}',
178
- headers: jsonContentHeaders,
179
- method: 'POST',
180
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/stop`
181
- }, unmarshalServer);
182
- pageOfListServerEvents = request => this.client.fetch({
183
- method: 'GET',
184
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/events`,
185
- urlParams: urlParams(['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
186
- }, unmarshalListServerEventsResponse);
187
-
188
- /**
189
- * List server events. List event (i.e. start/stop/reboot) associated to the
190
- * server ID.
191
- *
192
- * @param request - The request {@link ListServerEventsRequest}
193
- * @returns A Promise of ListServerEventsResponse
194
- */
195
- listServerEvents = request => enrichForPagination('events', this.pageOfListServerEvents, request);
196
-
197
- /**
198
- * Start BMC access. Start BMC (Baseboard Management Controller) access
199
- * associated with the ID. The BMC (Baseboard Management Controller) access is
200
- * available one hour after the installation of the server. You need first to
201
- * create an option Remote Access. You will find the ID and the price with a
202
- * call to listOffers
203
- * (https://developers.scaleway.com/en/products/baremetal/api/#get-78db92).
204
- * Then add the option
205
- * https://developers.scaleway.com/en/products/baremetal/api/#post-b14abd.
206
- * After adding the BMC option, you need to Get Remote Access to get the
207
- * login/password
208
- * https://developers.scaleway.com/en/products/baremetal/api/#get-cefc0f. Do
209
- * not forget to delete the Option after use.
210
- *
211
- * @param request - The request {@link StartBMCAccessRequest}
212
- * @returns A Promise of BMCAccess
213
- */
214
- startBMCAccess = request => this.client.fetch({
215
- body: JSON.stringify(marshalStartBMCAccessRequest(request, this.client.settings)),
216
- headers: jsonContentHeaders,
217
- method: 'POST',
218
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
219
- }, unmarshalBMCAccess);
220
-
221
- /**
222
- * Get BMC access. Get the BMC (Baseboard Management Controller) access
223
- * associated with the ID, including the URL and login information needed to
224
- * connect.
225
- *
226
- * @param request - The request {@link GetBMCAccessRequest}
227
- * @returns A Promise of BMCAccess
228
- */
229
- getBMCAccess = request => this.client.fetch({
230
- method: 'GET',
231
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
232
- }, unmarshalBMCAccess);
233
-
234
- /**
235
- * Stop BMC access. Stop BMC (Baseboard Management Controller) access
236
- * associated with the ID.
237
- *
238
- * @param request - The request {@link StopBMCAccessRequest}
239
- */
240
- stopBMCAccess = request => this.client.fetch({
241
- method: 'DELETE',
242
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
243
- });
244
-
245
- /**
246
- * Update IP. Configure the IP address associated with the server ID and IP
247
- * ID. You can use this method to set a reverse DNS for an IP address.
248
- *
249
- * @param request - The request {@link UpdateIPRequest}
250
- * @returns A Promise of IP
251
- */
252
- updateIP = request => this.client.fetch({
253
- body: JSON.stringify(marshalUpdateIPRequest(request, this.client.settings)),
254
- headers: jsonContentHeaders,
255
- method: 'PATCH',
256
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/ips/${validatePathParam('ipId', request.ipId)}`
257
- }, unmarshalIP);
258
-
259
- /**
260
- * Add server option. Add an option, such as Private Networks, to a specific
261
- * server.
262
- *
263
- * @param request - The request {@link AddOptionServerRequest}
264
- * @returns A Promise of Server
265
- */
266
- addOptionServer = request => this.client.fetch({
267
- body: JSON.stringify(marshalAddOptionServerRequest(request, this.client.settings)),
268
- headers: jsonContentHeaders,
269
- method: 'POST',
270
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/options/${validatePathParam('optionId', request.optionId)}`
271
- }, unmarshalServer);
272
-
273
- /**
274
- * Delete server option. Delete an option from a specific server.
275
- *
276
- * @param request - The request {@link DeleteOptionServerRequest}
277
- * @returns A Promise of Server
278
- */
279
- deleteOptionServer = request => this.client.fetch({
280
- method: 'DELETE',
281
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/options/${validatePathParam('optionId', request.optionId)}`
282
- }, unmarshalServer);
283
- pageOfListOffers = (() => {
284
- var _this3 = this;
285
- return function (request) {
286
- if (request === void 0) {
287
- request = {};
288
- }
289
- return _this3.client.fetch({
290
- method: 'GET',
291
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this3.client.settings.defaultZone)}/offers`,
292
- urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['subscription_period', request.subscriptionPeriod])
293
- }, unmarshalListOffersResponse);
294
- };
295
- })();
296
-
297
- /**
298
- * List offers. List all available Elastic Metal server configurations.
299
- *
300
- * @param request - The request {@link ListOffersRequest}
301
- * @returns A Promise of ListOffersResponse
302
- */
303
- listOffers = (() => {
304
- var _this4 = this;
305
- return function (request) {
306
- if (request === void 0) {
307
- request = {};
308
- }
309
- return enrichForPagination('offers', _this4.pageOfListOffers, request);
310
- };
311
- })();
312
-
313
- /**
314
- * Get offer. Get details of an offer identified by its offer ID.
315
- *
316
- * @param request - The request {@link GetOfferRequest}
317
- * @returns A Promise of Offer
318
- */
319
- getOffer = request => this.client.fetch({
320
- method: 'GET',
321
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/offers/${validatePathParam('offerId', request.offerId)}`
322
- }, unmarshalOffer);
323
-
324
- /**
325
- * Get option. Return specific option for the ID.
326
- *
327
- * @param request - The request {@link GetOptionRequest}
328
- * @returns A Promise of Option
329
- */
330
- getOption = request => this.client.fetch({
331
- method: 'GET',
332
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/options/${validatePathParam('optionId', request.optionId)}`
333
- }, unmarshalOption);
334
- pageOfListOptions = (() => {
335
- var _this5 = this;
336
- return function (request) {
337
- if (request === void 0) {
338
- request = {};
339
- }
340
- return _this5.client.fetch({
341
- method: 'GET',
342
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this5.client.settings.defaultZone)}/options`,
343
- urlParams: urlParams(['name', request.name], ['offer_id', request.offerId], ['page', request.page], ['page_size', request.pageSize ?? _this5.client.settings.defaultPageSize])
344
- }, unmarshalListOptionsResponse);
345
- };
346
- })();
347
-
348
- /**
349
- * List options. List all options matching with filters.
350
- *
351
- * @param request - The request {@link ListOptionsRequest}
352
- * @returns A Promise of ListOptionsResponse
353
- */
354
- listOptions = (() => {
355
- var _this6 = this;
356
- return function (request) {
357
- if (request === void 0) {
358
- request = {};
359
- }
360
- return enrichForPagination('options', _this6.pageOfListOptions, request);
361
- };
362
- })();
363
- pageOfListSettings = (() => {
364
- var _this7 = this;
365
- return function (request) {
366
- if (request === void 0) {
367
- request = {};
368
- }
369
- return _this7.client.fetch({
370
- method: 'GET',
371
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this7.client.settings.defaultZone)}/settings`,
372
- urlParams: urlParams(['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this7.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this7.client.settings.defaultProjectId])
373
- }, unmarshalListSettingsResponse);
374
- };
375
- })();
376
-
377
- /**
378
- * List all settings. Return all settings for a Project ID.
379
- *
380
- * @param request - The request {@link ListSettingsRequest}
381
- * @returns A Promise of ListSettingsResponse
382
- */
383
- listSettings = (() => {
384
- var _this8 = this;
385
- return function (request) {
386
- if (request === void 0) {
387
- request = {};
388
- }
389
- return enrichForPagination('settings', _this8.pageOfListSettings, request);
390
- };
391
- })();
392
-
393
- /**
394
- * Update setting. Update a setting for a Project ID (enable or disable).
395
- *
396
- * @param request - The request {@link UpdateSettingRequest}
397
- * @returns A Promise of Setting
398
- */
399
- updateSetting = request => this.client.fetch({
400
- body: JSON.stringify(marshalUpdateSettingRequest(request, this.client.settings)),
401
- headers: jsonContentHeaders,
402
- method: 'PATCH',
403
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/settings/${validatePathParam('settingId', request.settingId)}`
404
- }, unmarshalSetting);
405
- pageOfListOS = (() => {
406
- var _this9 = this;
407
- return function (request) {
408
- if (request === void 0) {
409
- request = {};
410
- }
411
- return _this9.client.fetch({
412
- method: 'GET',
413
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this9.client.settings.defaultZone)}/os`,
414
- urlParams: urlParams(['offer_id', request.offerId], ['page', request.page], ['page_size', request.pageSize ?? _this9.client.settings.defaultPageSize])
415
- }, unmarshalListOSResponse);
416
- };
417
- })();
418
-
419
- /**
420
- * List available OSes. List all OSes that are available for installation on
421
- * Elastic Metal servers.
422
- *
423
- * @param request - The request {@link ListOSRequest}
424
- * @returns A Promise of ListOSResponse
425
- */
426
- listOS = (() => {
427
- var _this10 = this;
428
- return function (request) {
429
- if (request === void 0) {
430
- request = {};
431
- }
432
- return enrichForPagination('os', _this10.pageOfListOS, request);
433
- };
434
- })();
435
-
436
- /**
437
- * Get OS with an ID. Return the specific OS for the ID.
438
- *
439
- * @param request - The request {@link GetOSRequest}
440
- * @returns A Promise of OS
441
- */
442
- getOS = request => this.client.fetch({
443
- method: 'GET',
444
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`
445
- }, unmarshalOS);
446
- }
447
-
448
- /** Elastic Metal Private Network API. */
449
- class PrivateNetworkAPI extends API$1 {
450
- /** Lists the available zones of the API. */
451
- static LOCALITIES = ['fr-par-2'];
452
-
453
- /**
454
- * Add a server to a Private Network.
455
- *
456
- * @param request - The request
457
- * {@link PrivateNetworkApiAddServerPrivateNetworkRequest}
458
- * @returns A Promise of ServerPrivateNetwork
459
- */
460
- addServerPrivateNetwork = request => this.client.fetch({
461
- body: JSON.stringify(marshalPrivateNetworkApiAddServerPrivateNetworkRequest(request, this.client.settings)),
462
- headers: jsonContentHeaders,
463
- method: 'POST',
464
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/private-networks`
465
- }, unmarshalServerPrivateNetwork);
466
-
467
- /**
468
- * Set multiple Private Networks on a server.
469
- *
470
- * @param request - The request
471
- * {@link PrivateNetworkApiSetServerPrivateNetworksRequest}
472
- * @returns A Promise of SetServerPrivateNetworksResponse
473
- */
474
- setServerPrivateNetworks = request => this.client.fetch({
475
- body: JSON.stringify(marshalPrivateNetworkApiSetServerPrivateNetworksRequest(request, this.client.settings)),
476
- headers: jsonContentHeaders,
477
- method: 'PUT',
478
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/private-networks`
479
- }, unmarshalSetServerPrivateNetworksResponse);
480
- pageOfListServerPrivateNetworks = (() => {
481
- var _this11 = this;
482
- return function (request) {
483
- if (request === void 0) {
484
- request = {};
485
- }
486
- return _this11.client.fetch({
487
- method: 'GET',
488
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this11.client.settings.defaultZone)}/server-private-networks`,
489
- urlParams: urlParams(['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this11.client.settings.defaultPageSize], ['private_network_id', request.privateNetworkId], ['project_id', request.projectId], ['server_id', request.serverId])
490
- }, unmarshalListServerPrivateNetworksResponse);
491
- };
492
- })();
493
-
494
- /**
495
- * List the Private Networks of a server.
496
- *
497
- * @param request - The request
498
- * {@link PrivateNetworkApiListServerPrivateNetworksRequest}
499
- * @returns A Promise of ListServerPrivateNetworksResponse
500
- */
501
- listServerPrivateNetworks = (() => {
502
- var _this12 = this;
503
- return function (request) {
504
- if (request === void 0) {
505
- request = {};
506
- }
507
- return enrichForPagination('serverPrivateNetworks', _this12.pageOfListServerPrivateNetworks, request);
508
- };
509
- })();
510
-
511
- /**
512
- * Delete a Private Network.
513
- *
514
- * @param request - The request
515
- * {@link PrivateNetworkApiDeleteServerPrivateNetworkRequest}
516
- */
517
- deleteServerPrivateNetwork = request => this.client.fetch({
518
- method: 'DELETE',
519
- path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/private-networks/${validatePathParam('privateNetworkId', request.privateNetworkId)}`
520
- });
521
- }
522
-
523
- export { API, PrivateNetworkAPI };
@@ -1,27 +0,0 @@
1
- import { tryAtIntervals, createExponentialBackoffStrategy } from '../../../internal/async/interval-retrier.js';
2
- import { API } from './api.gen.js';
3
- import { SERVER_INSTALL_TRANSIENT_STATUSES } from './content.gen.js';
4
-
5
- class BaremetalV1UtilsAPI extends API {
6
- /**
7
- * Waits for {@link ServerInstall} to be in a final state.
8
- *
9
- * @param request - The request {@link GetServerRequest}
10
- * @param options - The waiting options
11
- * @returns A Promise of ServerInstall
12
- */
13
- waitForServerInstall = (request, options) => tryAtIntervals(async () => {
14
- const value = await this.getServer(request).then(server => {
15
- if (!server.install) {
16
- throw new Error(`Server creation has not begun for server ${request.serverId}`);
17
- }
18
- return server.install;
19
- });
20
- return {
21
- done: !SERVER_INSTALL_TRANSIENT_STATUSES.includes(value.status),
22
- value
23
- };
24
- }, createExponentialBackoffStrategy(options?.minDelay ?? 1, options?.maxDelay ?? 30), options?.timeout);
25
- }
26
-
27
- export { BaremetalV1UtilsAPI };
@@ -1,13 +0,0 @@
1
- // This file was automatically generated. DO NOT EDIT.
2
- // If you have any remark or suggestion do not hesitate to open an issue.
3
-
4
- /** Lists transient statutes of the enum {@link ServerInstallStatus}. */
5
- const SERVER_INSTALL_TRANSIENT_STATUSES = ['to_install', 'installing'];
6
-
7
- /** Lists transient statutes of the enum {@link ServerPrivateNetworkStatus}. */
8
- const SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES = ['attaching', 'detaching'];
9
-
10
- /** Lists transient statutes of the enum {@link ServerStatus}. */
11
- const SERVER_TRANSIENT_STATUSES = ['delivering', 'stopping', 'starting', 'deleting', 'ordered', 'resetting'];
12
-
13
- export { SERVER_INSTALL_TRANSIENT_STATUSES, SERVER_PRIVATE_NETWORK_TRANSIENT_STATUSES, SERVER_TRANSIENT_STATUSES };