@scaleway/sdk 0.1.0-alpha.2 → 0.1.0-alpha.5

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 (54) hide show
  1. package/README.md +63 -1
  2. package/dist/api/account/v2alpha1/api.gen.js +91 -0
  3. package/dist/api/{function/manual/types.js → account/v2alpha1/types.gen.js} +0 -0
  4. package/dist/api/applesilicon/v1alpha1/api.gen.js +146 -0
  5. package/dist/api/{registry/manual/types.js → applesilicon/v1alpha1/types.gen.js} +0 -0
  6. package/dist/api/baremetal/v1/api.gen.js +332 -0
  7. package/dist/api/baremetal/v1/types.gen.js +1 -0
  8. package/dist/api/container/v1beta1/api.gen.js +290 -0
  9. package/dist/api/container/v1beta1/types.gen.js +1 -0
  10. package/dist/api/domain/v2beta1/api.gen.js +280 -0
  11. package/dist/api/domain/v2beta1/types.gen.js +1 -0
  12. package/dist/api/flexibleip/v1alpha1/api.gen.js +125 -0
  13. package/dist/api/flexibleip/v1alpha1/types.gen.js +1 -0
  14. package/dist/api/function/v1beta1/api.gen.js +312 -0
  15. package/dist/api/function/v1beta1/types.gen.js +1 -0
  16. package/dist/api/instance/v1/api.gen.js +880 -0
  17. package/dist/api/instance/v1/types.gen.js +1 -0
  18. package/dist/api/iot/v1/api.gen.js +438 -0
  19. package/dist/api/iot/v1/types.gen.js +1 -0
  20. package/dist/api/k8s/v1/api.gen.js +267 -0
  21. package/dist/api/k8s/v1/types.gen.js +1 -0
  22. package/dist/api/lb/v1/api.gen.js +728 -0
  23. package/dist/api/lb/v1/types.gen.js +1 -0
  24. package/dist/api/marketplace/v1/api.gen.js +66 -0
  25. package/dist/api/marketplace/v1/types.gen.js +1 -0
  26. package/dist/api/mnq/v1alpha1/api.gen.js +154 -0
  27. package/dist/api/mnq/v1alpha1/types.gen.js +1 -0
  28. package/dist/api/rdb/v1/api.gen.js +591 -0
  29. package/dist/api/rdb/v1/types.gen.js +1 -0
  30. package/dist/api/redis/v1alpha1/api.gen.js +238 -0
  31. package/dist/api/redis/v1alpha1/types.gen.js +1 -0
  32. package/dist/api/registry/v1/api.gen.js +172 -0
  33. package/dist/api/registry/v1/types.gen.js +1 -0
  34. package/dist/api/vpc/v1/api.gen.js +67 -0
  35. package/dist/api/vpc/v1/types.gen.js +1 -0
  36. package/dist/api/vpcgw/v1/api.gen.js +466 -0
  37. package/dist/api/vpcgw/v1/types.gen.js +1 -0
  38. package/dist/index.cjs +7375 -632
  39. package/dist/index.d.ts +15324 -495
  40. package/dist/index.js +54 -6
  41. package/dist/internals.js +2 -1
  42. package/dist/node_modules/.pnpm/{@scaleway_random-name@3.0.0 → @scaleway_random-name@3.0.2}/node_modules/@scaleway/random-name/dist/index.js +0 -0
  43. package/dist/scw/fetch/response-parser.js +1 -0
  44. package/dist/scw/marshalling.js +20 -7
  45. package/node_modules/@scaleway/random-name/CHANGELOG.md +16 -0
  46. package/node_modules/@scaleway/random-name/README.md +2 -2
  47. package/node_modules/@scaleway/random-name/package.json +2 -2
  48. package/package.json +4 -4
  49. package/dist/api/function/manual/FunctionAPI.js +0 -436
  50. package/dist/api/function/manual/WaitForFunctionAPI.js +0 -27
  51. package/dist/api/registry/manual/RegistryAPI.js +0 -254
  52. package/dist/api/registry/manual/WaitForRegistryAPI.js +0 -27
  53. package/dist/internal/async/interval-retrier.js +0 -89
  54. package/dist/internal/async/sleep.js +0 -13
package/README.md CHANGED
@@ -2,7 +2,65 @@
2
2
 
3
3
  ## ALPHA
4
4
 
5
- The project is in an early alpha phase. Only a few APIs are available, the rest should quickly follow! Feel free to open an issue for any feedback.
5
+ The project is in an **early alpha** phase.
6
+
7
+ * The generated code as well as the distribution is subject to change (i.e. we might have one package per product).
8
+ * The code will be available on GitHub once it enters beta.
9
+
10
+ **List of available APIs:**
11
+
12
+ | **Name** | **Version** | **Class** |
13
+ |:-------------:|:-----------:|:---------------:|
14
+ | Account | v2alpha1 | AccountAPI |
15
+ | Apple Silicon | v1alpha1 | ApplesiliconAPI |
16
+ | Baremetal | v1 | BaremetalAPI |
17
+ | Container | v1beta1 | ContainerAPI |
18
+ | Domain | v2beta1 | DomainAPI |
19
+ | Flexible IP | v1alpha1 | FlexibleipAPI |
20
+ | Function | v1beta1 | FunctionAPI |
21
+ | IOT | v1 | IotAPI |
22
+ | K8S | v1 | K8SAPI |
23
+ | LB | v1 | LbAPI |
24
+ | Marketplace | v1 | MarketplaceAPI |
25
+ | RDB | v1 | RdbAPI |
26
+ | Redis | v1alpha1 | RedisAPI |
27
+ | Registry | v1 | RegistryAPI |
28
+ | VPC | v1 | VpcAPI |
29
+ | VPC Gateway | v1 | VpcgwAPI |
30
+
31
+
32
+ ## Getting Started
33
+
34
+ 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.
35
+
36
+ **A minimal setup** would look like this:
37
+
38
+ ```ts
39
+ import { RegistryAPI, createScwClient } from '@scaleway/sdk'
40
+
41
+ const client = createScwClient({
42
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
43
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
45
+ defaultRegion: 'fr-par',
46
+ defaultZone: 'fr-par-1',
47
+ })
48
+
49
+ const registryAPI = new RegistryAPI(client)
50
+ ```
51
+
52
+ **In case of a NodeJS environment**, you could retrieve the profile from either the configuration file or the environment variables:
53
+
54
+ ```ts
55
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
56
+ // import { loadProfileFromEnvironmentValues } from '@scaleway/configuration-loader'
57
+
58
+ const profile = loadProfileFromConfigurationFile()
59
+ // const profile = loadProfileFromEnvironmentValues()
60
+ const client = createScwClient(profile)
61
+ ```
62
+
63
+ **For more advanced needs**, please check the examples.
6
64
 
7
65
  ## Usage
8
66
 
@@ -26,3 +84,7 @@ or
26
84
  ```bash
27
85
  node -r cross-fetch/polyfill ./script-using-sdk.mjs
28
86
  ```
87
+
88
+ ## Reach us
89
+
90
+ We love feedback. Feel free to reach us on [Scaleway Slack community](https://slack.scaleway.com/), we are waiting for you on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource).
@@ -0,0 +1,91 @@
1
+ import { urlParams, resolveOneOf, validatePathParam, unmarshalAnyRes } from '../../../scw/marshalling.js';
2
+ import { fetchAll, fetchPaginated } from '../../../scw/fetch/resource-paginator.js';
3
+ import { API } from '../../../helpers/API.js';
4
+
5
+ // This file was automatically generated. DO NOT EDIT.
6
+
7
+ const unmarshalListSSHKeysResponse = data => unmarshalAnyRes(data, [], ['created_at', 'updated_at']);
8
+
9
+ const unmarshalSSHKey = data => unmarshalAnyRes(data, [], ['created_at', 'updated_at']);
10
+
11
+ const jsonContentHeaders = {
12
+ 'Content-Type': 'application/json; charset=utf-8'
13
+ };
14
+ class AccountAPI extends API {
15
+ constructor() {
16
+ var _this;
17
+
18
+ super(...arguments);
19
+ _this = this;
20
+
21
+ this.pageOfListSSHKeys = function (request) {
22
+ if (request === void 0) {
23
+ request = {};
24
+ }
25
+
26
+ return _this.client.fetch({
27
+ method: 'GET',
28
+ path: `/account/v2alpha1/ssh-keys`,
29
+ 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])
30
+ }, unmarshalListSSHKeysResponse);
31
+ };
32
+
33
+ this.listSSHKeys = function (request) {
34
+ if (request === void 0) {
35
+ request = {};
36
+ }
37
+
38
+ return Object.assign(_this.pageOfListSSHKeys(request), {
39
+ all: () => fetchAll('sshKeys', _this.pageOfListSSHKeys, request),
40
+ [Symbol.asyncIterator]: () => fetchPaginated('sshKeys', _this.pageOfListSSHKeys, request),
41
+ page: async num => (await _this.pageOfListSSHKeys({ ...request,
42
+ page: num
43
+ })).sshKeys
44
+ });
45
+ };
46
+
47
+ this.createSSHKey = request => {
48
+ const projectIdentifier = resolveOneOf([{
49
+ default: this.client.settings.defaultProjectId,
50
+ param: 'project_id',
51
+ value: request.projectId
52
+ }, {
53
+ default: this.client.settings.defaultOrganizationId,
54
+ param: 'organization_id',
55
+ value: request.organizationId
56
+ }]);
57
+ return this.client.fetch({
58
+ body: JSON.stringify({
59
+ name: request.name,
60
+ public_key: request.publicKey,
61
+ ...projectIdentifier
62
+ }),
63
+ headers: jsonContentHeaders,
64
+ method: 'POST',
65
+ path: `/account/v2alpha1/ssh-keys`
66
+ }, unmarshalSSHKey);
67
+ };
68
+
69
+ this.getSSHKey = request => this.client.fetch({
70
+ method: 'GET',
71
+ path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
72
+ }, unmarshalSSHKey);
73
+
74
+ this.updateSSHKey = request => this.client.fetch({
75
+ body: JSON.stringify({
76
+ name: request.name
77
+ }),
78
+ headers: jsonContentHeaders,
79
+ method: 'PATCH',
80
+ path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
81
+ }, unmarshalSSHKey);
82
+
83
+ this.deleteSSHKey = request => this.client.fetch({
84
+ method: 'DELETE',
85
+ path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
86
+ });
87
+ }
88
+
89
+ }
90
+
91
+ export { AccountAPI };
@@ -0,0 +1,146 @@
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js';
2
+ import { validatePathParam, urlParams, unmarshalAnyRes } from '../../../scw/marshalling.js';
3
+ import { fetchAll, fetchPaginated } from '../../../scw/fetch/resource-paginator.js';
4
+ import { API } from '../../../helpers/API.js';
5
+
6
+ // This file was automatically generated. DO NOT EDIT.
7
+
8
+ const unmarshalListOSResponse = data => unmarshalAnyRes(data);
9
+
10
+ const unmarshalListServerTypesResponse = data => unmarshalAnyRes(data);
11
+
12
+ const unmarshalListServersResponse = data => unmarshalAnyRes(data, [], ['created_at', 'deletable_at', 'updated_at']);
13
+
14
+ const unmarshalOS = data => unmarshalAnyRes(data);
15
+
16
+ const unmarshalServer = data => unmarshalAnyRes(data, [], ['created_at', 'deletable_at', 'updated_at']);
17
+
18
+ const unmarshalServerType = data => unmarshalAnyRes(data);
19
+
20
+ const jsonContentHeaders = {
21
+ 'Content-Type': 'application/json; charset=utf-8'
22
+ };
23
+ class ApplesiliconAPI extends API {
24
+ constructor() {
25
+ var _this;
26
+
27
+ super(...arguments);
28
+ _this = this;
29
+
30
+ this.listServerTypes = function (request) {
31
+ if (request === void 0) {
32
+ request = {};
33
+ }
34
+
35
+ return _this.client.fetch({
36
+ method: 'GET',
37
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/server-types`
38
+ }, unmarshalListServerTypesResponse);
39
+ };
40
+
41
+ this.getServerType = request => this.client.fetch({
42
+ method: 'GET',
43
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/server-type/${validatePathParam('serverType', request.serverType)}`
44
+ }, unmarshalServerType);
45
+
46
+ this.createServer = request => this.client.fetch({
47
+ body: JSON.stringify({
48
+ name: request.name || randomName('as'),
49
+ project_id: request.projectId ?? this.client.settings.defaultProjectId,
50
+ type: request.type
51
+ }),
52
+ headers: jsonContentHeaders,
53
+ method: 'POST',
54
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`
55
+ }, unmarshalServer);
56
+
57
+ this.pageOfListServers = function (request) {
58
+ if (request === void 0) {
59
+ request = {};
60
+ }
61
+
62
+ return _this.client.fetch({
63
+ method: 'GET',
64
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/servers`,
65
+ 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])
66
+ }, unmarshalListServersResponse);
67
+ };
68
+
69
+ this.listServers = function (request) {
70
+ if (request === void 0) {
71
+ request = {};
72
+ }
73
+
74
+ return Object.assign(_this.pageOfListServers(request), {
75
+ all: () => fetchAll('servers', _this.pageOfListServers, request),
76
+ [Symbol.asyncIterator]: () => fetchPaginated('servers', _this.pageOfListServers, request),
77
+ page: async num => (await _this.pageOfListServers({ ...request,
78
+ page: num
79
+ })).servers
80
+ });
81
+ };
82
+
83
+ this.pageOfListOS = function (request) {
84
+ if (request === void 0) {
85
+ request = {};
86
+ }
87
+
88
+ return _this.client.fetch({
89
+ method: 'GET',
90
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/os`,
91
+ urlParams: urlParams(['name', request.name], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['server_type', request.serverType])
92
+ }, unmarshalListOSResponse);
93
+ };
94
+
95
+ this.listOS = function (request) {
96
+ if (request === void 0) {
97
+ request = {};
98
+ }
99
+
100
+ return Object.assign(_this.pageOfListOS(request), {
101
+ all: () => fetchAll('os', _this.pageOfListOS, request),
102
+ [Symbol.asyncIterator]: () => fetchPaginated('os', _this.pageOfListOS, request),
103
+ page: async num => (await _this.pageOfListOS({ ...request,
104
+ page: num
105
+ })).os
106
+ });
107
+ };
108
+
109
+ this.getOS = request => this.client.fetch({
110
+ method: 'GET',
111
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`
112
+ }, unmarshalOS);
113
+
114
+ this.getServer = request => this.client.fetch({
115
+ method: 'GET',
116
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
117
+ }, unmarshalServer);
118
+
119
+ this.updateServer = request => this.client.fetch({
120
+ body: JSON.stringify({
121
+ name: request.name
122
+ }),
123
+ headers: jsonContentHeaders,
124
+ method: 'PATCH',
125
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
126
+ }, unmarshalServer);
127
+
128
+ this.deleteServer = request => this.client.fetch({
129
+ method: 'DELETE',
130
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
131
+ });
132
+
133
+ this.rebootServer = request => this.client.fetch({
134
+ method: 'POST',
135
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`
136
+ }, unmarshalServer);
137
+
138
+ this.reinstallServer = request => this.client.fetch({
139
+ method: 'POST',
140
+ path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reinstall`
141
+ }, unmarshalServer);
142
+ }
143
+
144
+ }
145
+
146
+ export { ApplesiliconAPI };
@@ -0,0 +1,332 @@
1
+ import { validatePathParam, urlParams, resolveOneOf, unmarshalAnyRes } from '../../../scw/marshalling.js';
2
+ import { fetchAll, fetchPaginated } from '../../../scw/fetch/resource-paginator.js';
3
+ import { API } from '../../../helpers/API.js';
4
+
5
+ // This file was automatically generated. DO NOT EDIT.
6
+
7
+ const unmarshalBMCAccess = data => unmarshalAnyRes(data, [], ['expires_at']);
8
+
9
+ const unmarshalGetServerMetricsResponse = data => unmarshalAnyRes(data);
10
+
11
+ const unmarshalIP = data => unmarshalAnyRes(data);
12
+
13
+ const unmarshalListOSResponse = data => unmarshalAnyRes(data);
14
+
15
+ const unmarshalListOffersResponse = data => unmarshalAnyRes(data);
16
+
17
+ const unmarshalListOptionsResponse = data => unmarshalAnyRes(data);
18
+
19
+ const unmarshalListServerEventsResponse = data => unmarshalAnyRes(data, [], ['created_at', 'updated_at']);
20
+
21
+ const unmarshalListServersResponse = data => unmarshalAnyRes(data, [], ['created_at', 'updated_at']);
22
+
23
+ const unmarshalListSettingsResponse = data => unmarshalAnyRes(data);
24
+
25
+ const unmarshalOS = data => unmarshalAnyRes(data);
26
+
27
+ const unmarshalOffer = data => unmarshalAnyRes(data);
28
+
29
+ const unmarshalOption = data => unmarshalAnyRes(data);
30
+
31
+ const unmarshalServer = data => unmarshalAnyRes(data, [], ['created_at', 'updated_at']);
32
+
33
+ const unmarshalSetting = data => unmarshalAnyRes(data);
34
+
35
+ const jsonContentHeaders = {
36
+ 'Content-Type': 'application/json; charset=utf-8'
37
+ };
38
+ class BaremetalAPI extends API {
39
+ constructor() {
40
+ var _this;
41
+
42
+ super(...arguments);
43
+ _this = this;
44
+
45
+ this.pageOfListServers = request => this.client.fetch({
46
+ method: 'GET',
47
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`,
48
+ urlParams: urlParams(['name', request.name], ['option_id', request.optionId], ['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], ['status', request.status], ['tags', request.tags])
49
+ }, unmarshalListServersResponse);
50
+
51
+ this.listServers = request => Object.assign(this.pageOfListServers(request), {
52
+ all: () => fetchAll('servers', this.pageOfListServers, request),
53
+ [Symbol.asyncIterator]: () => fetchPaginated('servers', this.pageOfListServers, request),
54
+ page: async num => (await this.pageOfListServers({ ...request,
55
+ page: num
56
+ })).servers
57
+ });
58
+
59
+ this.getServer = request => this.client.fetch({
60
+ method: 'GET',
61
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
62
+ }, unmarshalServer);
63
+
64
+ this.createServer = request => {
65
+ const projectIdentifier = resolveOneOf([{
66
+ default: this.client.settings.defaultProjectId,
67
+ param: 'project_id',
68
+ value: request.projectId
69
+ }, {
70
+ default: this.client.settings.defaultOrganizationId,
71
+ param: 'organization_id',
72
+ value: request.organizationId
73
+ }]);
74
+ return this.client.fetch({
75
+ body: JSON.stringify({
76
+ description: request.description,
77
+ install: request.install,
78
+ name: request.name,
79
+ offer_id: request.offerId,
80
+ option_ids: request.optionIds,
81
+ tags: request.tags,
82
+ ...projectIdentifier
83
+ }),
84
+ headers: jsonContentHeaders,
85
+ method: 'POST',
86
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`
87
+ }, unmarshalServer);
88
+ };
89
+
90
+ this.updateServer = request => this.client.fetch({
91
+ body: JSON.stringify({
92
+ description: request.description,
93
+ name: request.name,
94
+ tags: request.tags
95
+ }),
96
+ headers: jsonContentHeaders,
97
+ method: 'PATCH',
98
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
99
+ }, unmarshalServer);
100
+
101
+ this.installServer = request => this.client.fetch({
102
+ body: JSON.stringify({
103
+ hostname: request.hostname,
104
+ os_id: request.osId,
105
+ password: request.password,
106
+ service_password: request.servicePassword,
107
+ service_user: request.serviceUser,
108
+ ssh_key_ids: request.sshKeyIds,
109
+ user: request.user
110
+ }),
111
+ headers: jsonContentHeaders,
112
+ method: 'POST',
113
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/install`
114
+ }, unmarshalServer);
115
+
116
+ this.getServerMetrics = request => this.client.fetch({
117
+ method: 'GET',
118
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/metrics`
119
+ }, unmarshalGetServerMetricsResponse);
120
+
121
+ this.deleteServer = request => this.client.fetch({
122
+ method: 'DELETE',
123
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
124
+ }, unmarshalServer);
125
+
126
+ this.rebootServer = request => this.client.fetch({
127
+ body: JSON.stringify({
128
+ boot_type: request.bootType ?? 'unknown_boot_type'
129
+ }),
130
+ headers: jsonContentHeaders,
131
+ method: 'POST',
132
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`
133
+ }, unmarshalServer);
134
+
135
+ this.startServer = request => this.client.fetch({
136
+ body: JSON.stringify({
137
+ boot_type: request.bootType ?? 'unknown_boot_type'
138
+ }),
139
+ headers: jsonContentHeaders,
140
+ method: 'POST',
141
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/start`
142
+ }, unmarshalServer);
143
+
144
+ this.stopServer = request => this.client.fetch({
145
+ method: 'POST',
146
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/stop`
147
+ }, unmarshalServer);
148
+
149
+ this.pageOfListServerEvents = request => this.client.fetch({
150
+ method: 'GET',
151
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/events`,
152
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
153
+ }, unmarshalListServerEventsResponse);
154
+
155
+ this.listServerEvents = request => Object.assign(this.pageOfListServerEvents(request), {
156
+ all: () => fetchAll('events', this.pageOfListServerEvents, request),
157
+ [Symbol.asyncIterator]: () => fetchPaginated('events', this.pageOfListServerEvents, request),
158
+ page: async num => (await this.pageOfListServerEvents({ ...request,
159
+ page: num
160
+ })).events
161
+ });
162
+
163
+ this.startBMCAccess = request => this.client.fetch({
164
+ body: JSON.stringify({
165
+ ip: request.ip
166
+ }),
167
+ headers: jsonContentHeaders,
168
+ method: 'POST',
169
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
170
+ }, unmarshalBMCAccess);
171
+
172
+ this.getBMCAccess = request => this.client.fetch({
173
+ method: 'GET',
174
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
175
+ }, unmarshalBMCAccess);
176
+
177
+ this.stopBMCAccess = request => this.client.fetch({
178
+ method: 'DELETE',
179
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
180
+ });
181
+
182
+ this.updateIP = request => this.client.fetch({
183
+ body: JSON.stringify({
184
+ reverse: request.reverse
185
+ }),
186
+ headers: jsonContentHeaders,
187
+ method: 'PATCH',
188
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/ips/${validatePathParam('ipId', request.ipId)}`
189
+ }, unmarshalIP);
190
+
191
+ this.addOptionServer = request => this.client.fetch({
192
+ method: 'POST',
193
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/options/${validatePathParam('optionId', request.optionId)}`
194
+ }, unmarshalServer);
195
+
196
+ this.deleteOptionServer = request => this.client.fetch({
197
+ method: 'DELETE',
198
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/options/${validatePathParam('optionId', request.optionId)}`
199
+ }, unmarshalServer);
200
+
201
+ this.pageOfListOffers = function (request) {
202
+ if (request === void 0) {
203
+ request = {};
204
+ }
205
+
206
+ return _this.client.fetch({
207
+ method: 'GET',
208
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/offers`,
209
+ urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['subscription_period', request.subscriptionPeriod ?? 'unknown_subscription_period'])
210
+ }, unmarshalListOffersResponse);
211
+ };
212
+
213
+ this.listOffers = function (request) {
214
+ if (request === void 0) {
215
+ request = {};
216
+ }
217
+
218
+ return Object.assign(_this.pageOfListOffers(request), {
219
+ all: () => fetchAll('offers', _this.pageOfListOffers, request),
220
+ [Symbol.asyncIterator]: () => fetchPaginated('offers', _this.pageOfListOffers, request),
221
+ page: async num => (await _this.pageOfListOffers({ ...request,
222
+ page: num
223
+ })).offers
224
+ });
225
+ };
226
+
227
+ this.getOffer = request => this.client.fetch({
228
+ method: 'GET',
229
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/offers/${validatePathParam('offerId', request.offerId)}`
230
+ }, unmarshalOffer);
231
+
232
+ this.getOption = request => this.client.fetch({
233
+ method: 'GET',
234
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/options/${validatePathParam('optionId', request.optionId)}`
235
+ }, unmarshalOption);
236
+
237
+ this.pageOfListOptions = function (request) {
238
+ if (request === void 0) {
239
+ request = {};
240
+ }
241
+
242
+ return _this.client.fetch({
243
+ method: 'GET',
244
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/options`,
245
+ urlParams: urlParams(['name', request.name], ['offer_id', request.offerId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
246
+ }, unmarshalListOptionsResponse);
247
+ };
248
+
249
+ this.listOptions = function (request) {
250
+ if (request === void 0) {
251
+ request = {};
252
+ }
253
+
254
+ return Object.assign(_this.pageOfListOptions(request), {
255
+ all: () => fetchAll('options', _this.pageOfListOptions, request),
256
+ [Symbol.asyncIterator]: () => fetchPaginated('options', _this.pageOfListOptions, request),
257
+ page: async num => (await _this.pageOfListOptions({ ...request,
258
+ page: num
259
+ })).options
260
+ });
261
+ };
262
+
263
+ this.pageOfListSettings = function (request) {
264
+ if (request === void 0) {
265
+ request = {};
266
+ }
267
+
268
+ return _this.client.fetch({
269
+ method: 'GET',
270
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/settings`,
271
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
272
+ }, unmarshalListSettingsResponse);
273
+ };
274
+
275
+ this.listSettings = function (request) {
276
+ if (request === void 0) {
277
+ request = {};
278
+ }
279
+
280
+ return Object.assign(_this.pageOfListSettings(request), {
281
+ all: () => fetchAll('settings', _this.pageOfListSettings, request),
282
+ [Symbol.asyncIterator]: () => fetchPaginated('settings', _this.pageOfListSettings, request),
283
+ page: async num => (await _this.pageOfListSettings({ ...request,
284
+ page: num
285
+ })).settings
286
+ });
287
+ };
288
+
289
+ this.updateSetting = request => this.client.fetch({
290
+ body: JSON.stringify({
291
+ enabled: request.enabled
292
+ }),
293
+ headers: jsonContentHeaders,
294
+ method: 'PATCH',
295
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/settings/${validatePathParam('settingId', request.settingId)}`
296
+ }, unmarshalSetting);
297
+
298
+ this.pageOfListOS = function (request) {
299
+ if (request === void 0) {
300
+ request = {};
301
+ }
302
+
303
+ return _this.client.fetch({
304
+ method: 'GET',
305
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/os`,
306
+ urlParams: urlParams(['offer_id', request.offerId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
307
+ }, unmarshalListOSResponse);
308
+ };
309
+
310
+ this.listOS = function (request) {
311
+ if (request === void 0) {
312
+ request = {};
313
+ }
314
+
315
+ return Object.assign(_this.pageOfListOS(request), {
316
+ all: () => fetchAll('os', _this.pageOfListOS, request),
317
+ [Symbol.asyncIterator]: () => fetchPaginated('os', _this.pageOfListOS, request),
318
+ page: async num => (await _this.pageOfListOS({ ...request,
319
+ page: num
320
+ })).os
321
+ });
322
+ };
323
+
324
+ this.getOS = request => this.client.fetch({
325
+ method: 'GET',
326
+ path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`
327
+ }, unmarshalOS);
328
+ }
329
+
330
+ }
331
+
332
+ export { BaremetalAPI };
@@ -0,0 +1 @@
1
+