@scaleway/sdk 0.1.0-alpha.1 → 0.1.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -4
- package/dist/api/account/v2alpha1/api.gen.js +83 -0
- package/dist/api/{function/manual/types.js → account/v2alpha1/types.gen.js} +0 -0
- package/dist/api/applesilicon/v1alpha1/api.gen.js +129 -0
- package/dist/api/{registry/manual/types.js → applesilicon/v1alpha1/types.gen.js} +0 -0
- package/dist/api/baremetal/v1/api.gen.js +281 -0
- package/dist/api/baremetal/v1/types.gen.js +1 -0
- package/dist/api/container/v1beta1/api.gen.js +249 -0
- package/dist/api/container/v1beta1/types.gen.js +1 -0
- package/dist/api/dedibox/v1/api.gen.js +893 -0
- package/dist/api/dedibox/v1/types.gen.js +1 -0
- package/dist/api/domain/v2beta1/api.gen.js +552 -0
- package/dist/api/domain/v2beta1/types.gen.js +1 -0
- package/dist/api/flexibleip/v1alpha1/api.gen.js +114 -0
- package/dist/api/flexibleip/v1alpha1/types.gen.js +1 -0
- package/dist/api/function/v1beta1/api.gen.js +265 -0
- package/dist/api/function/v1beta1/types.gen.js +1 -0
- package/dist/api/iam/v1alpha1/api.gen.js +378 -0
- package/dist/api/iam/v1alpha1/types.gen.js +1 -0
- package/dist/api/instance/v1/api.gen.js +733 -0
- package/dist/api/instance/v1/types.gen.js +1 -0
- package/dist/api/iot/v1/api.gen.js +399 -0
- package/dist/api/iot/v1/types.gen.js +1 -0
- package/dist/api/k8s/v1/api.gen.js +246 -0
- package/dist/api/k8s/v1/types.gen.js +1 -0
- package/dist/api/lb/v1/api.gen.js +1245 -0
- package/dist/api/lb/v1/types.gen.js +1 -0
- package/dist/api/marketplace/v1/api.gen.js +56 -0
- package/dist/api/marketplace/v1/types.gen.js +1 -0
- package/dist/api/mnq/v1alpha1/api.gen.js +134 -0
- package/dist/api/mnq/v1alpha1/types.gen.js +1 -0
- package/dist/api/rdb/v1/api.gen.js +500 -0
- package/dist/api/rdb/v1/types.gen.js +1 -0
- package/dist/api/redis/v1alpha1/api.gen.js +205 -0
- package/dist/api/redis/v1alpha1/types.gen.js +1 -0
- package/dist/api/registry/v1/api.gen.js +145 -0
- package/dist/api/registry/v1/types.gen.js +1 -0
- package/dist/api/vpc/v1/api.gen.js +62 -0
- package/dist/api/vpc/v1/types.gen.js +1 -0
- package/dist/api/vpcgw/v1/api.gen.js +407 -0
- package/dist/api/vpcgw/v1/types.gen.js +1 -0
- package/dist/helpers/API.js +2 -1
- package/dist/helpers/localities.js +57 -0
- package/dist/index.cjs +9672 -647
- package/dist/index.d.ts +19476 -482
- package/dist/index.js +82 -8
- package/dist/internals.js +5 -3
- 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
- package/dist/scw/client-ini-factory.js +59 -1
- package/dist/scw/client.js +9 -9
- package/dist/scw/constants.js +1 -1
- package/dist/scw/custom-unmarshallers.js +7 -0
- package/dist/scw/errors/error-parser.js +5 -0
- package/dist/scw/errors/standard/index.js +1 -0
- package/dist/scw/errors/standard/invalid-arguments-error.js +1 -1
- package/dist/scw/errors/standard/too-many-requests-error.js +83 -0
- package/dist/scw/fetch/resource-paginator.js +52 -13
- package/dist/scw/fetch/response-parser.js +1 -0
- package/dist/scw/marshalling.js +40 -13
- package/node_modules/@scaleway/random-name/CHANGELOG.md +16 -0
- package/node_modules/@scaleway/random-name/README.md +2 -2
- package/node_modules/@scaleway/random-name/package.json +2 -2
- package/package.json +4 -4
- package/dist/api/function/manual/FunctionAPI.js +0 -436
- package/dist/api/function/manual/WaitForFunctionAPI.js +0 -27
- package/dist/api/registry/manual/RegistryAPI.js +0 -260
- package/dist/api/registry/manual/WaitForRegistryAPI.js +0 -27
- package/dist/helpers/forRegions.js +0 -15
- package/dist/internal/async/interval-retrier.js +0 -89
- package/dist/internal/async/sleep.js +0 -13
package/README.md
CHANGED
|
@@ -1,16 +1,80 @@
|
|
|
1
1
|
# Scaleway SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Scaleway is a single way to create, deploy and scale your infrastructure in the cloud. This SDK enables you to interact with the APIs.
|
|
4
4
|
|
|
5
|
-
The project is in
|
|
5
|
+
**⚠️ The project is in alpha:**
|
|
6
|
+
* Code is subject to breaking changes.
|
|
7
|
+
* Sources will be available on GitHub once the SDK enters beta.
|
|
8
|
+
* SDK only works from a server, browser calls aren't supported yet.
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
**🔗 Important links:**
|
|
11
|
+
* Reference documentation (soon)
|
|
12
|
+
* Example projects (soon)
|
|
13
|
+
* [Developers website](https://developers.scaleway.com) (API documentation)
|
|
14
|
+
|
|
15
|
+
## Getting Started
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
**A minimal setup** would look like this:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { RegistryAPI, createClient } from '@scaleway/sdk'
|
|
23
|
+
|
|
24
|
+
const client = createClient({
|
|
25
|
+
accessKey: 'SCWXXXXXXXXXXXXXXXXX',
|
|
26
|
+
secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
27
|
+
defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
28
|
+
defaultRegion: 'fr-par',
|
|
29
|
+
defaultZone: 'fr-par-1',
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const api = new RegistryAPI(client)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**In case of a NodeJS environment**, you could retrieve the profile from either the configuration file or the environment variables:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import {
|
|
39
|
+
loadProfileFromConfigurationFile,
|
|
40
|
+
// loadProfileFromEnvironmentValues,
|
|
41
|
+
} from '@scaleway/configuration-loader'
|
|
42
|
+
|
|
43
|
+
const profile = loadProfileFromConfigurationFile() // loadProfileFromEnvironmentValues()
|
|
44
|
+
const client = createClient(profile)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**For more advanced needs**, please check the examples.
|
|
48
|
+
|
|
49
|
+
## Pagination
|
|
50
|
+
|
|
51
|
+
We included some pagination helpers for the methods supporting the feature. Let's take `listNamespaces()` (Registry product) as an example:
|
|
52
|
+
|
|
53
|
+
Retrieve the **first page**:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
const namespaces = await api.listNamespaces(/*{ page: 1 }*/)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Retrieve **all the pages**:
|
|
60
|
+
```ts
|
|
61
|
+
const allNamespaces = await api.listNamespaces().all()
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Iterate** over the pages:
|
|
65
|
+
```ts
|
|
66
|
+
for await (const page of api.listNamespaces()) {
|
|
67
|
+
//
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Dependencies
|
|
8
72
|
|
|
9
73
|
This SDK is based on the [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) API and use `Request`, `Response` & `Headers` interfaces. Those interfaces are native in modern browsers, node >=18 & deno environments.
|
|
10
74
|
|
|
11
75
|
For `node` < 18 & `React Native` environments, the commonJS build requires [cross-fetch](https://www.npmjs.com/package/cross-fetch) package, it is listed in `dependencies` but not used in esm build.
|
|
12
76
|
|
|
13
|
-
|
|
77
|
+
**Troubleshooting**
|
|
14
78
|
|
|
15
79
|
In node environment, the commonJS module defined in `dist/index.cjs` entry file is used by default, thanks to the "main" `package.json` field.
|
|
16
80
|
|
|
@@ -26,3 +90,7 @@ or
|
|
|
26
90
|
```bash
|
|
27
91
|
node -r cross-fetch/polyfill ./script-using-sdk.mjs
|
|
28
92
|
```
|
|
93
|
+
|
|
94
|
+
## Reach us
|
|
95
|
+
|
|
96
|
+
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,83 @@
|
|
|
1
|
+
import { API } from '../../../helpers/API.js';
|
|
2
|
+
import { urlParams, resolveOneOf, validatePathParam, unmarshalAnyRes } from '../../../scw/marshalling.js';
|
|
3
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
4
|
+
|
|
5
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
6
|
+
|
|
7
|
+
const unmarshal0ECB = data => unmarshalAnyRes(data, [], ['created_at', 'updated_at']);
|
|
8
|
+
|
|
9
|
+
const jsonContentHeaders = {
|
|
10
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
11
|
+
};
|
|
12
|
+
class AccountV2Alpha1GenAPI extends API {
|
|
13
|
+
constructor() {
|
|
14
|
+
var _this;
|
|
15
|
+
|
|
16
|
+
super(...arguments);
|
|
17
|
+
_this = this;
|
|
18
|
+
|
|
19
|
+
this.pageOfListSSHKeys = function (request) {
|
|
20
|
+
if (request === void 0) {
|
|
21
|
+
request = {};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return _this.client.fetch({
|
|
25
|
+
method: 'GET',
|
|
26
|
+
path: `/account/v2alpha1/ssh-keys`,
|
|
27
|
+
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
|
+
}, unmarshal0ECB);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
this.listSSHKeys = function (request) {
|
|
32
|
+
if (request === void 0) {
|
|
33
|
+
request = {};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return enrichForPagination('sshKeys', _this.pageOfListSSHKeys, request);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
this.createSSHKey = request => {
|
|
40
|
+
const projectIdentifier = resolveOneOf([{
|
|
41
|
+
default: this.client.settings.defaultProjectId,
|
|
42
|
+
param: 'project_id',
|
|
43
|
+
value: request.projectId
|
|
44
|
+
}, {
|
|
45
|
+
default: this.client.settings.defaultOrganizationId,
|
|
46
|
+
param: 'organization_id',
|
|
47
|
+
value: request.organizationId
|
|
48
|
+
}]);
|
|
49
|
+
return this.client.fetch({
|
|
50
|
+
body: JSON.stringify({
|
|
51
|
+
name: request.name,
|
|
52
|
+
public_key: request.publicKey,
|
|
53
|
+
...projectIdentifier
|
|
54
|
+
}),
|
|
55
|
+
headers: jsonContentHeaders,
|
|
56
|
+
method: 'POST',
|
|
57
|
+
path: `/account/v2alpha1/ssh-keys`
|
|
58
|
+
}, unmarshal0ECB);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
this.getSSHKey = request => this.client.fetch({
|
|
62
|
+
method: 'GET',
|
|
63
|
+
path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
|
|
64
|
+
}, unmarshal0ECB);
|
|
65
|
+
|
|
66
|
+
this.updateSSHKey = request => this.client.fetch({
|
|
67
|
+
body: JSON.stringify({
|
|
68
|
+
name: request.name
|
|
69
|
+
}),
|
|
70
|
+
headers: jsonContentHeaders,
|
|
71
|
+
method: 'PATCH',
|
|
72
|
+
path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
|
|
73
|
+
}, unmarshal0ECB);
|
|
74
|
+
|
|
75
|
+
this.deleteSSHKey = request => this.client.fetch({
|
|
76
|
+
method: 'DELETE',
|
|
77
|
+
path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { AccountV2Alpha1GenAPI };
|
|
File without changes
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js';
|
|
2
|
+
import { API } from '../../../helpers/API.js';
|
|
3
|
+
import { validatePathParam, unmarshalAnyRes, urlParams } from '../../../scw/marshalling.js';
|
|
4
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
5
|
+
|
|
6
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
7
|
+
|
|
8
|
+
const unmarshalA4C1 = data => unmarshalAnyRes(data, [], ['created_at', 'deletable_at', 'updated_at']);
|
|
9
|
+
|
|
10
|
+
const jsonContentHeaders = {
|
|
11
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
12
|
+
};
|
|
13
|
+
class ApplesiliconV1Alpha1GenAPI extends API {
|
|
14
|
+
constructor() {
|
|
15
|
+
var _this;
|
|
16
|
+
|
|
17
|
+
super(...arguments);
|
|
18
|
+
_this = this;
|
|
19
|
+
|
|
20
|
+
this.listServerTypes = function (request) {
|
|
21
|
+
if (request === void 0) {
|
|
22
|
+
request = {};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return _this.client.fetch({
|
|
26
|
+
method: 'GET',
|
|
27
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/server-types`
|
|
28
|
+
}, unmarshalAnyRes);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
this.getServerType = request => this.client.fetch({
|
|
32
|
+
method: 'GET',
|
|
33
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/server-type/${validatePathParam('serverType', request.serverType)}`
|
|
34
|
+
}, unmarshalAnyRes);
|
|
35
|
+
|
|
36
|
+
this.createServer = request => this.client.fetch({
|
|
37
|
+
body: JSON.stringify({
|
|
38
|
+
name: request.name || randomName('as'),
|
|
39
|
+
project_id: request.projectId ?? this.client.settings.defaultProjectId,
|
|
40
|
+
type: request.type
|
|
41
|
+
}),
|
|
42
|
+
headers: jsonContentHeaders,
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`
|
|
45
|
+
}, unmarshalA4C1);
|
|
46
|
+
|
|
47
|
+
this.pageOfListServers = function (request) {
|
|
48
|
+
if (request === void 0) {
|
|
49
|
+
request = {};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return _this.client.fetch({
|
|
53
|
+
method: 'GET',
|
|
54
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/servers`,
|
|
55
|
+
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])
|
|
56
|
+
}, unmarshalA4C1);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
this.listServers = function (request) {
|
|
60
|
+
if (request === void 0) {
|
|
61
|
+
request = {};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return enrichForPagination('servers', _this.pageOfListServers, request);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
this.pageOfListOS = function (request) {
|
|
68
|
+
if (request === void 0) {
|
|
69
|
+
request = {};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return _this.client.fetch({
|
|
73
|
+
method: 'GET',
|
|
74
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/os`,
|
|
75
|
+
urlParams: urlParams(['name', request.name], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['server_type', request.serverType])
|
|
76
|
+
}, unmarshalAnyRes);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
this.listOS = function (request) {
|
|
80
|
+
if (request === void 0) {
|
|
81
|
+
request = {};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return enrichForPagination('os', _this.pageOfListOS, request);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
this.getOS = request => this.client.fetch({
|
|
88
|
+
method: 'GET',
|
|
89
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`
|
|
90
|
+
}, unmarshalAnyRes);
|
|
91
|
+
|
|
92
|
+
this.getServer = request => this.client.fetch({
|
|
93
|
+
method: 'GET',
|
|
94
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
95
|
+
}, unmarshalA4C1);
|
|
96
|
+
|
|
97
|
+
this.updateServer = request => this.client.fetch({
|
|
98
|
+
body: JSON.stringify({
|
|
99
|
+
name: request.name
|
|
100
|
+
}),
|
|
101
|
+
headers: jsonContentHeaders,
|
|
102
|
+
method: 'PATCH',
|
|
103
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
104
|
+
}, unmarshalA4C1);
|
|
105
|
+
|
|
106
|
+
this.deleteServer = request => this.client.fetch({
|
|
107
|
+
method: 'DELETE',
|
|
108
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
this.rebootServer = request => this.client.fetch({
|
|
112
|
+
body: '{}',
|
|
113
|
+
headers: jsonContentHeaders,
|
|
114
|
+
method: 'POST',
|
|
115
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`
|
|
116
|
+
}, unmarshalA4C1);
|
|
117
|
+
|
|
118
|
+
this.reinstallServer = request => this.client.fetch({
|
|
119
|
+
body: '{}',
|
|
120
|
+
headers: jsonContentHeaders,
|
|
121
|
+
method: 'POST',
|
|
122
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reinstall`
|
|
123
|
+
}, unmarshalA4C1);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
ApplesiliconV1Alpha1GenAPI.LOCALITIES = ['fr-par-3'];
|
|
128
|
+
|
|
129
|
+
export { ApplesiliconV1Alpha1GenAPI };
|
|
File without changes
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { API } from '../../../helpers/API.js';
|
|
2
|
+
import { validatePathParam, urlParams, resolveOneOf, unmarshalAnyRes } from '../../../scw/marshalling.js';
|
|
3
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
4
|
+
|
|
5
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
6
|
+
|
|
7
|
+
const unmarshal0ECB = data => unmarshalAnyRes(data, [], ['created_at', 'updated_at']);
|
|
8
|
+
|
|
9
|
+
const unmarshal23C1 = data => unmarshalAnyRes(data, [], ['created_at', 'expires_at', 'updated_at']);
|
|
10
|
+
|
|
11
|
+
const unmarshal41B8 = data => unmarshalAnyRes(data, [], ['expires_at']);
|
|
12
|
+
|
|
13
|
+
const jsonContentHeaders = {
|
|
14
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
15
|
+
};
|
|
16
|
+
class BaremetalV1GenAPI extends API {
|
|
17
|
+
constructor() {
|
|
18
|
+
var _this;
|
|
19
|
+
|
|
20
|
+
super(...arguments);
|
|
21
|
+
_this = this;
|
|
22
|
+
|
|
23
|
+
this.pageOfListServers = request => this.client.fetch({
|
|
24
|
+
method: 'GET',
|
|
25
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`,
|
|
26
|
+
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])
|
|
27
|
+
}, unmarshal23C1);
|
|
28
|
+
|
|
29
|
+
this.listServers = request => enrichForPagination('servers', this.pageOfListServers, request);
|
|
30
|
+
|
|
31
|
+
this.getServer = request => this.client.fetch({
|
|
32
|
+
method: 'GET',
|
|
33
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
34
|
+
}, unmarshal23C1);
|
|
35
|
+
|
|
36
|
+
this.createServer = request => {
|
|
37
|
+
const projectIdentifier = resolveOneOf([{
|
|
38
|
+
default: this.client.settings.defaultProjectId,
|
|
39
|
+
param: 'project_id',
|
|
40
|
+
value: request.projectId
|
|
41
|
+
}, {
|
|
42
|
+
default: this.client.settings.defaultOrganizationId,
|
|
43
|
+
param: 'organization_id',
|
|
44
|
+
value: request.organizationId
|
|
45
|
+
}]);
|
|
46
|
+
return this.client.fetch({
|
|
47
|
+
body: JSON.stringify({
|
|
48
|
+
description: request.description,
|
|
49
|
+
install: request.install,
|
|
50
|
+
name: request.name,
|
|
51
|
+
offer_id: request.offerId,
|
|
52
|
+
option_ids: request.optionIds,
|
|
53
|
+
tags: request.tags,
|
|
54
|
+
...projectIdentifier
|
|
55
|
+
}),
|
|
56
|
+
headers: jsonContentHeaders,
|
|
57
|
+
method: 'POST',
|
|
58
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`
|
|
59
|
+
}, unmarshal23C1);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
this.updateServer = request => this.client.fetch({
|
|
63
|
+
body: JSON.stringify({
|
|
64
|
+
description: request.description,
|
|
65
|
+
name: request.name,
|
|
66
|
+
tags: request.tags
|
|
67
|
+
}),
|
|
68
|
+
headers: jsonContentHeaders,
|
|
69
|
+
method: 'PATCH',
|
|
70
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
71
|
+
}, unmarshal23C1);
|
|
72
|
+
|
|
73
|
+
this.installServer = request => this.client.fetch({
|
|
74
|
+
body: JSON.stringify({
|
|
75
|
+
hostname: request.hostname,
|
|
76
|
+
os_id: request.osId,
|
|
77
|
+
password: request.password,
|
|
78
|
+
service_password: request.servicePassword,
|
|
79
|
+
service_user: request.serviceUser,
|
|
80
|
+
ssh_key_ids: request.sshKeyIds,
|
|
81
|
+
user: request.user
|
|
82
|
+
}),
|
|
83
|
+
headers: jsonContentHeaders,
|
|
84
|
+
method: 'POST',
|
|
85
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/install`
|
|
86
|
+
}, unmarshal23C1);
|
|
87
|
+
|
|
88
|
+
this.getServerMetrics = request => this.client.fetch({
|
|
89
|
+
method: 'GET',
|
|
90
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/metrics`
|
|
91
|
+
}, unmarshalAnyRes);
|
|
92
|
+
|
|
93
|
+
this.deleteServer = request => this.client.fetch({
|
|
94
|
+
method: 'DELETE',
|
|
95
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
96
|
+
}, unmarshal23C1);
|
|
97
|
+
|
|
98
|
+
this.rebootServer = request => this.client.fetch({
|
|
99
|
+
body: JSON.stringify({
|
|
100
|
+
boot_type: request.bootType ?? 'unknown_boot_type'
|
|
101
|
+
}),
|
|
102
|
+
headers: jsonContentHeaders,
|
|
103
|
+
method: 'POST',
|
|
104
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`
|
|
105
|
+
}, unmarshal23C1);
|
|
106
|
+
|
|
107
|
+
this.startServer = request => this.client.fetch({
|
|
108
|
+
body: JSON.stringify({
|
|
109
|
+
boot_type: request.bootType ?? 'unknown_boot_type'
|
|
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)}/start`
|
|
114
|
+
}, unmarshal23C1);
|
|
115
|
+
|
|
116
|
+
this.stopServer = request => this.client.fetch({
|
|
117
|
+
body: '{}',
|
|
118
|
+
headers: jsonContentHeaders,
|
|
119
|
+
method: 'POST',
|
|
120
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/stop`
|
|
121
|
+
}, unmarshal23C1);
|
|
122
|
+
|
|
123
|
+
this.pageOfListServerEvents = request => this.client.fetch({
|
|
124
|
+
method: 'GET',
|
|
125
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/events`,
|
|
126
|
+
urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
|
|
127
|
+
}, unmarshal0ECB);
|
|
128
|
+
|
|
129
|
+
this.listServerEvents = request => enrichForPagination('events', this.pageOfListServerEvents, request);
|
|
130
|
+
|
|
131
|
+
this.startBMCAccess = request => this.client.fetch({
|
|
132
|
+
body: JSON.stringify({
|
|
133
|
+
ip: request.ip
|
|
134
|
+
}),
|
|
135
|
+
headers: jsonContentHeaders,
|
|
136
|
+
method: 'POST',
|
|
137
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
|
|
138
|
+
}, unmarshal41B8);
|
|
139
|
+
|
|
140
|
+
this.getBMCAccess = request => this.client.fetch({
|
|
141
|
+
method: 'GET',
|
|
142
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
|
|
143
|
+
}, unmarshal41B8);
|
|
144
|
+
|
|
145
|
+
this.stopBMCAccess = request => this.client.fetch({
|
|
146
|
+
method: 'DELETE',
|
|
147
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
this.updateIP = request => this.client.fetch({
|
|
151
|
+
body: JSON.stringify({
|
|
152
|
+
reverse: request.reverse
|
|
153
|
+
}),
|
|
154
|
+
headers: jsonContentHeaders,
|
|
155
|
+
method: 'PATCH',
|
|
156
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/ips/${validatePathParam('ipId', request.ipId)}`
|
|
157
|
+
}, unmarshalAnyRes);
|
|
158
|
+
|
|
159
|
+
this.addOptionServer = request => this.client.fetch({
|
|
160
|
+
body: JSON.stringify({
|
|
161
|
+
expires_at: request.expiresAt
|
|
162
|
+
}),
|
|
163
|
+
headers: jsonContentHeaders,
|
|
164
|
+
method: 'POST',
|
|
165
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/options/${validatePathParam('optionId', request.optionId)}`
|
|
166
|
+
}, unmarshal23C1);
|
|
167
|
+
|
|
168
|
+
this.deleteOptionServer = request => this.client.fetch({
|
|
169
|
+
method: 'DELETE',
|
|
170
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/options/${validatePathParam('optionId', request.optionId)}`
|
|
171
|
+
}, unmarshal23C1);
|
|
172
|
+
|
|
173
|
+
this.pageOfListOffers = function (request) {
|
|
174
|
+
if (request === void 0) {
|
|
175
|
+
request = {};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return _this.client.fetch({
|
|
179
|
+
method: 'GET',
|
|
180
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/offers`,
|
|
181
|
+
urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['subscription_period', request.subscriptionPeriod ?? 'unknown_subscription_period'])
|
|
182
|
+
}, unmarshalAnyRes);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
this.listOffers = function (request) {
|
|
186
|
+
if (request === void 0) {
|
|
187
|
+
request = {};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return enrichForPagination('offers', _this.pageOfListOffers, request);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
this.getOffer = request => this.client.fetch({
|
|
194
|
+
method: 'GET',
|
|
195
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/offers/${validatePathParam('offerId', request.offerId)}`
|
|
196
|
+
}, unmarshalAnyRes);
|
|
197
|
+
|
|
198
|
+
this.getOption = request => this.client.fetch({
|
|
199
|
+
method: 'GET',
|
|
200
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/options/${validatePathParam('optionId', request.optionId)}`
|
|
201
|
+
}, unmarshalAnyRes);
|
|
202
|
+
|
|
203
|
+
this.pageOfListOptions = function (request) {
|
|
204
|
+
if (request === void 0) {
|
|
205
|
+
request = {};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return _this.client.fetch({
|
|
209
|
+
method: 'GET',
|
|
210
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/options`,
|
|
211
|
+
urlParams: urlParams(['name', request.name], ['offer_id', request.offerId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
|
|
212
|
+
}, unmarshalAnyRes);
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
this.listOptions = function (request) {
|
|
216
|
+
if (request === void 0) {
|
|
217
|
+
request = {};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return enrichForPagination('options', _this.pageOfListOptions, request);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
this.pageOfListSettings = function (request) {
|
|
224
|
+
if (request === void 0) {
|
|
225
|
+
request = {};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return _this.client.fetch({
|
|
229
|
+
method: 'GET',
|
|
230
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/settings`,
|
|
231
|
+
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])
|
|
232
|
+
}, unmarshalAnyRes);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
this.listSettings = function (request) {
|
|
236
|
+
if (request === void 0) {
|
|
237
|
+
request = {};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return enrichForPagination('settings', _this.pageOfListSettings, request);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
this.updateSetting = request => this.client.fetch({
|
|
244
|
+
body: JSON.stringify({
|
|
245
|
+
enabled: request.enabled
|
|
246
|
+
}),
|
|
247
|
+
headers: jsonContentHeaders,
|
|
248
|
+
method: 'PATCH',
|
|
249
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/settings/${validatePathParam('settingId', request.settingId)}`
|
|
250
|
+
}, unmarshalAnyRes);
|
|
251
|
+
|
|
252
|
+
this.pageOfListOS = function (request) {
|
|
253
|
+
if (request === void 0) {
|
|
254
|
+
request = {};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return _this.client.fetch({
|
|
258
|
+
method: 'GET',
|
|
259
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/os`,
|
|
260
|
+
urlParams: urlParams(['offer_id', request.offerId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
|
|
261
|
+
}, unmarshalAnyRes);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
this.listOS = function (request) {
|
|
265
|
+
if (request === void 0) {
|
|
266
|
+
request = {};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return enrichForPagination('os', _this.pageOfListOS, request);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
this.getOS = request => this.client.fetch({
|
|
273
|
+
method: 'GET',
|
|
274
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`
|
|
275
|
+
}, unmarshalAnyRes);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
}
|
|
279
|
+
BaremetalV1GenAPI.LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1'];
|
|
280
|
+
|
|
281
|
+
export { BaremetalV1GenAPI };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|