@scaleway/sdk 0.1.0-alpha.2 → 0.1.0-alpha.20
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 +73 -5
- package/dist/api/account/index.js +2 -0
- package/dist/api/account/v2alpha1/api.gen.js +66 -0
- package/dist/api/account/v2alpha1/index.js +1 -0
- package/dist/api/account/v2alpha1/marshalling.gen.js +22 -0
- package/dist/api/applesilicon/index.js +2 -0
- package/dist/api/applesilicon/v1alpha1/api.gen.js +145 -0
- package/dist/api/applesilicon/v1alpha1/content.gen.js +7 -0
- package/dist/api/applesilicon/v1alpha1/index.js +2 -0
- package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +15 -0
- package/dist/api/baremetal/index.js +2 -0
- package/dist/api/baremetal/v1/api.gen.js +254 -0
- package/dist/api/baremetal/v1/api.utils.js +31 -0
- package/dist/api/baremetal/v1/content.gen.js +10 -0
- package/dist/api/baremetal/v1/index.js +2 -0
- package/dist/api/baremetal/v1/marshalling.gen.js +68 -0
- package/dist/api/container/index.js +2 -0
- package/dist/api/container/v1beta1/api.gen.js +254 -0
- package/dist/api/container/v1beta1/content.gen.js +19 -0
- package/dist/api/container/v1beta1/index.js +2 -0
- package/dist/api/container/v1beta1/marshalling.gen.js +87 -0
- package/dist/api/dedibox/index.js +2 -0
- package/dist/api/dedibox/v1/api.gen.js +854 -0
- package/dist/api/dedibox/v1/content.gen.js +31 -0
- package/dist/api/dedibox/v1/index.js +2 -0
- package/dist/api/dedibox/v1/marshalling.gen.js +146 -0
- package/dist/api/domain/index.js +2 -0
- package/dist/api/domain/v2beta1/api.gen.js +382 -0
- package/dist/api/domain/v2beta1/content.gen.js +7 -0
- package/dist/api/domain/v2beta1/index.js +2 -0
- package/dist/api/domain/v2beta1/marshalling.gen.js +425 -0
- package/dist/api/flexibleip/index.js +2 -0
- package/dist/api/flexibleip/v1alpha1/api.gen.js +111 -0
- package/dist/api/flexibleip/v1alpha1/content.gen.js +10 -0
- package/dist/api/flexibleip/v1alpha1/index.js +2 -0
- package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +35 -0
- package/dist/api/function/index.js +2 -0
- package/dist/api/function/v1beta1/api.gen.js +276 -0
- package/dist/api/function/v1beta1/content.gen.js +19 -0
- package/dist/api/function/v1beta1/index.js +2 -0
- package/dist/api/function/v1beta1/marshalling.gen.js +81 -0
- package/dist/api/iam/index.js +2 -0
- package/dist/api/iam/v1alpha1/api.gen.js +353 -0
- package/dist/api/iam/v1alpha1/index.js +1 -0
- package/dist/api/iam/v1alpha1/marshalling.gen.js +124 -0
- package/dist/api/instance/index.js +2 -0
- package/dist/api/instance/v1/api.gen.js +537 -0
- package/dist/api/instance/v1/api.utils.js +254 -0
- package/dist/api/instance/v1/content.gen.js +28 -0
- package/dist/api/instance/v1/index.js +2 -0
- package/dist/api/instance/v1/marshalling.gen.js +493 -0
- package/dist/api/iot/index.js +2 -0
- package/dist/api/iot/v1/api.gen.js +306 -0
- package/dist/api/iot/v1/content.gen.js +7 -0
- package/dist/api/iot/v1/index.js +2 -0
- package/dist/api/iot/v1/marshalling.gen.js +159 -0
- package/dist/api/k8s/index.js +2 -0
- package/dist/api/k8s/v1/api.gen.js +188 -0
- package/dist/api/k8s/v1/content.gen.js +13 -0
- package/dist/api/k8s/v1/index.js +2 -0
- package/dist/api/k8s/v1/marshalling.gen.js +178 -0
- package/dist/api/lb/index.js +2 -0
- package/dist/api/lb/v1/api.gen.js +862 -0
- package/dist/api/lb/v1/api.utils.js +62 -0
- package/dist/api/lb/v1/content.gen.js +16 -0
- package/dist/api/lb/v1/index.js +2 -0
- package/dist/api/lb/v1/marshalling.gen.js +517 -0
- package/dist/api/marketplace/index.js +2 -0
- package/dist/api/marketplace/v1/api.gen.js +54 -0
- package/dist/api/marketplace/v1/index.js +1 -0
- package/dist/api/marketplace/v1/marshalling.gen.js +7 -0
- package/dist/api/mnq/index.js +2 -0
- package/dist/api/mnq/v1alpha1/api.gen.js +115 -0
- package/dist/api/mnq/v1alpha1/index.js +1 -0
- package/dist/api/mnq/v1alpha1/marshalling.gen.js +36 -0
- package/dist/api/rdb/index.js +2 -0
- package/dist/api/rdb/v1/api.gen.js +411 -0
- package/dist/api/rdb/v1/content.gen.js +16 -0
- package/dist/api/rdb/v1/index.js +2 -0
- package/dist/api/rdb/v1/marshalling.gen.js +166 -0
- package/dist/api/redis/index.js +2 -0
- package/dist/api/redis/v1alpha1/api.gen.js +189 -0
- package/dist/api/redis/v1alpha1/content.gen.js +7 -0
- package/dist/api/redis/v1alpha1/index.js +2 -0
- package/dist/api/redis/v1alpha1/marshalling.gen.js +90 -0
- package/dist/api/registry/index.js +2 -0
- package/dist/api/registry/v1/api.gen.js +135 -0
- package/dist/api/registry/v1/content.gen.js +13 -0
- package/dist/api/registry/v1/index.js +2 -0
- package/dist/api/registry/v1/marshalling.gen.js +28 -0
- package/dist/api/vpc/index.js +2 -0
- package/dist/api/vpc/v1/api.gen.js +73 -0
- package/dist/api/vpc/v1/index.js +1 -0
- package/dist/api/vpc/v1/marshalling.gen.js +18 -0
- package/dist/api/vpcgw/index.js +2 -0
- package/dist/api/vpcgw/v1/api.gen.js +340 -0
- package/dist/api/vpcgw/v1/content.gen.js +10 -0
- package/dist/api/vpcgw/v1/index.js +2 -0
- package/dist/api/vpcgw/v1/marshalling.gen.js +132 -0
- package/dist/helpers/API.js +2 -1
- package/dist/helpers/camelize.js +29 -2
- package/dist/index.cjs +12152 -798
- package/dist/index.d.ts +21925 -597
- package/dist/index.js +42 -8
- package/dist/internal/async/interval-retrier.js +49 -33
- package/dist/internal/interceptors/request.js +5 -1
- package/dist/internal/logger/console-logger.js +9 -1
- package/dist/internal/tools/string-validation.js +0 -7
- 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-marshalling.js +37 -0
- package/dist/scw/errors/error-parser.js +5 -0
- package/dist/scw/errors/scw-error.js +14 -1
- 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/http-interceptors.js +4 -0
- package/dist/scw/fetch/resource-paginator.js +34 -4
- package/dist/scw/fetch/response-parser.js +34 -3
- package/dist/scw/marshalling.js +22 -8
- 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/function/manual/types.js +0 -1
- package/dist/api/registry/manual/RegistryAPI.js +0 -254
- package/dist/api/registry/manual/WaitForRegistryAPI.js +0 -27
- package/dist/api/registry/manual/types.js +0 -1
- package/dist/helpers/forRegions.js +0 -15
package/README.md
CHANGED
|
@@ -1,16 +1,80 @@
|
|
|
1
1
|
# Scaleway SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This SDK enables you to interact with Scaleway 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 node.js runtime, 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)
|
|
8
14
|
|
|
9
|
-
|
|
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 { Registry, 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 Registry.v1.API(client)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**For a simpler setup**, 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
|
|
72
|
+
|
|
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](https://deno.land/) 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,66 @@
|
|
|
1
|
+
import { API } from '../../../helpers/API.js';
|
|
2
|
+
import { urlParams, validatePathParam } from '../../../scw/marshalling.js';
|
|
3
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
4
|
+
import { unmarshal0ECB, marshalCreateSSHKeyRequest, marshalUpdateSSHKeyRequest } from './marshalling.gen.js';
|
|
5
|
+
|
|
6
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
7
|
+
const jsonContentHeaders = {
|
|
8
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
9
|
+
};
|
|
10
|
+
/** Account API. */
|
|
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 => this.client.fetch({
|
|
40
|
+
body: JSON.stringify(marshalCreateSSHKeyRequest(request, this.client.settings)),
|
|
41
|
+
headers: jsonContentHeaders,
|
|
42
|
+
method: 'POST',
|
|
43
|
+
path: `/account/v2alpha1/ssh-keys`
|
|
44
|
+
}, unmarshal0ECB);
|
|
45
|
+
|
|
46
|
+
this.getSSHKey = request => this.client.fetch({
|
|
47
|
+
method: 'GET',
|
|
48
|
+
path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
|
|
49
|
+
}, unmarshal0ECB);
|
|
50
|
+
|
|
51
|
+
this.updateSSHKey = request => this.client.fetch({
|
|
52
|
+
body: JSON.stringify(marshalUpdateSSHKeyRequest(request, this.client.settings)),
|
|
53
|
+
headers: jsonContentHeaders,
|
|
54
|
+
method: 'PATCH',
|
|
55
|
+
path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
|
|
56
|
+
}, unmarshal0ECB);
|
|
57
|
+
|
|
58
|
+
this.deleteSSHKey = request => this.client.fetch({
|
|
59
|
+
method: 'DELETE',
|
|
60
|
+
path: `/account/v2alpha1/ssh-key/${validatePathParam('sshKeyId', request.sshKeyId)}`
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { AccountV2Alpha1GenAPI };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AccountV2Alpha1GenAPI as API } from './api.gen.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { resolveOneOf, unmarshalAnyRes } from '../../../scw/marshalling.js';
|
|
2
|
+
|
|
3
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
4
|
+
const unmarshal0ECB = data => unmarshalAnyRes(data, [], ['created_at', 'updated_at']);
|
|
5
|
+
const marshalCreateSSHKeyRequest = (request, defaults) => ({
|
|
6
|
+
name: request.name,
|
|
7
|
+
public_key: request.publicKey,
|
|
8
|
+
...resolveOneOf([{
|
|
9
|
+
default: defaults.defaultProjectId,
|
|
10
|
+
param: 'project_id',
|
|
11
|
+
value: request.projectId
|
|
12
|
+
}, {
|
|
13
|
+
default: defaults.defaultOrganizationId,
|
|
14
|
+
param: 'organization_id',
|
|
15
|
+
value: request.organizationId
|
|
16
|
+
}])
|
|
17
|
+
});
|
|
18
|
+
const marshalUpdateSSHKeyRequest = (request, defaults) => ({
|
|
19
|
+
name: request.name
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export { marshalCreateSSHKeyRequest, marshalUpdateSSHKeyRequest, unmarshal0ECB };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { API } from '../../../helpers/API.js';
|
|
2
|
+
import { waitForResource } from '../../../internal/async/interval-retrier.js';
|
|
3
|
+
import { validatePathParam, unmarshalAnyRes, urlParams } from '../../../scw/marshalling.js';
|
|
4
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
5
|
+
import { SERVER_TRANSIENT_STATUSES } from './content.gen.js';
|
|
6
|
+
import { marshalCreateServerRequest, unmarshalA4C1, marshalUpdateServerRequest } from './marshalling.gen.js';
|
|
7
|
+
|
|
8
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
9
|
+
const jsonContentHeaders = {
|
|
10
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Apple silicon.
|
|
14
|
+
*
|
|
15
|
+
* Scaleway Apple silicon M1 as-a-Service is built using the latest generation
|
|
16
|
+
* of Apple Mac mini hardware (fifth generation).
|
|
17
|
+
*
|
|
18
|
+
* These dedicated Mac mini M1s are designed for developing, building, testing,
|
|
19
|
+
* and signing applications for Apple devices, including iPhones, iPads, Mac
|
|
20
|
+
* computers and much more.
|
|
21
|
+
*
|
|
22
|
+
* Get set to explore, learn and build on a dedicated Mac mini M1 with more
|
|
23
|
+
* performance and speed than you ever thought possible.
|
|
24
|
+
*
|
|
25
|
+
* _Apple silicon as a Service comes with a minimum allocation period of 24 hours_*.
|
|
26
|
+
*
|
|
27
|
+
* Mac mini and macOS are trademarks of Apple Inc., registered in the U.S. and
|
|
28
|
+
* other countries and regions. IOS is a trademark or registered trademark of
|
|
29
|
+
* Cisco in the U.S. and other countries and is used by Apple under license.
|
|
30
|
+
* Scaleway is not affiliated with Apple Inc.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
class ApplesiliconV1Alpha1GenAPI extends API {
|
|
34
|
+
constructor() {
|
|
35
|
+
var _this;
|
|
36
|
+
|
|
37
|
+
super(...arguments);
|
|
38
|
+
_this = this;
|
|
39
|
+
|
|
40
|
+
this.listServerTypes = function (request) {
|
|
41
|
+
if (request === void 0) {
|
|
42
|
+
request = {};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return _this.client.fetch({
|
|
46
|
+
method: 'GET',
|
|
47
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/server-types`
|
|
48
|
+
}, unmarshalAnyRes);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
this.getServerType = request => this.client.fetch({
|
|
52
|
+
method: 'GET',
|
|
53
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/server-type/${validatePathParam('serverType', request.serverType)}`
|
|
54
|
+
}, unmarshalAnyRes);
|
|
55
|
+
|
|
56
|
+
this.createServer = request => this.client.fetch({
|
|
57
|
+
body: JSON.stringify(marshalCreateServerRequest(request, this.client.settings)),
|
|
58
|
+
headers: jsonContentHeaders,
|
|
59
|
+
method: 'POST',
|
|
60
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`
|
|
61
|
+
}, unmarshalA4C1);
|
|
62
|
+
|
|
63
|
+
this.pageOfListServers = function (request) {
|
|
64
|
+
if (request === void 0) {
|
|
65
|
+
request = {};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return _this.client.fetch({
|
|
69
|
+
method: 'GET',
|
|
70
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/servers`,
|
|
71
|
+
urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
|
|
72
|
+
}, unmarshalA4C1);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
this.listServers = function (request) {
|
|
76
|
+
if (request === void 0) {
|
|
77
|
+
request = {};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return enrichForPagination('servers', _this.pageOfListServers, request);
|
|
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
|
+
}, unmarshalAnyRes);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
this.listOS = function (request) {
|
|
96
|
+
if (request === void 0) {
|
|
97
|
+
request = {};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return enrichForPagination('os', _this.pageOfListOS, request);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
this.getOS = request => this.client.fetch({
|
|
104
|
+
method: 'GET',
|
|
105
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`
|
|
106
|
+
}, unmarshalAnyRes);
|
|
107
|
+
|
|
108
|
+
this.getServer = request => this.client.fetch({
|
|
109
|
+
method: 'GET',
|
|
110
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
111
|
+
}, unmarshalA4C1);
|
|
112
|
+
|
|
113
|
+
this.waitForServer = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!SERVER_TRANSIENT_STATUSES.includes(res.status))), this.getServer, request, options);
|
|
114
|
+
|
|
115
|
+
this.updateServer = request => this.client.fetch({
|
|
116
|
+
body: JSON.stringify(marshalUpdateServerRequest(request, this.client.settings)),
|
|
117
|
+
headers: jsonContentHeaders,
|
|
118
|
+
method: 'PATCH',
|
|
119
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
120
|
+
}, unmarshalA4C1);
|
|
121
|
+
|
|
122
|
+
this.deleteServer = request => this.client.fetch({
|
|
123
|
+
method: 'DELETE',
|
|
124
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
this.rebootServer = request => this.client.fetch({
|
|
128
|
+
body: '{}',
|
|
129
|
+
headers: jsonContentHeaders,
|
|
130
|
+
method: 'POST',
|
|
131
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`
|
|
132
|
+
}, unmarshalA4C1);
|
|
133
|
+
|
|
134
|
+
this.reinstallServer = request => this.client.fetch({
|
|
135
|
+
body: '{}',
|
|
136
|
+
headers: jsonContentHeaders,
|
|
137
|
+
method: 'POST',
|
|
138
|
+
path: `/apple-silicon/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reinstall`
|
|
139
|
+
}, unmarshalA4C1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
ApplesiliconV1Alpha1GenAPI.LOCALITIES = ['fr-par-3'];
|
|
144
|
+
|
|
145
|
+
export { ApplesiliconV1Alpha1GenAPI };
|
|
@@ -0,0 +1,7 @@
|
|
|
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 ServerStatus}. */
|
|
5
|
+
const SERVER_TRANSIENT_STATUSES = ['starting', 'rebooting', 'updating', 'locking', 'unlocking', 'reinstalling'];
|
|
6
|
+
|
|
7
|
+
export { SERVER_TRANSIENT_STATUSES };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js';
|
|
2
|
+
import { unmarshalAnyRes } from '../../../scw/marshalling.js';
|
|
3
|
+
|
|
4
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
5
|
+
const unmarshalA4C1 = data => unmarshalAnyRes(data, [], ['created_at', 'deletable_at', 'updated_at']);
|
|
6
|
+
const marshalCreateServerRequest = (request, defaults) => ({
|
|
7
|
+
name: request.name || randomName('as'),
|
|
8
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
9
|
+
type: request.type
|
|
10
|
+
});
|
|
11
|
+
const marshalUpdateServerRequest = (request, defaults) => ({
|
|
12
|
+
name: request.name
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { marshalCreateServerRequest, marshalUpdateServerRequest, unmarshalA4C1 };
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { API } from '../../../helpers/API.js';
|
|
2
|
+
import { waitForResource } from '../../../internal/async/interval-retrier.js';
|
|
3
|
+
import { validatePathParam, urlParams, unmarshalAnyRes } from '../../../scw/marshalling.js';
|
|
4
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
5
|
+
import { SERVER_TRANSIENT_STATUSES } from './content.gen.js';
|
|
6
|
+
import { unmarshal23C1, marshalCreateServerRequest, marshalUpdateServerRequest, marshalInstallServerRequest, marshalRebootServerRequest, marshalStartServerRequest, unmarshal0ECB, marshalStartBMCAccessRequest, unmarshal41B8, marshalUpdateIPRequest, marshalAddOptionServerRequest, marshalUpdateSettingRequest } from './marshalling.gen.js';
|
|
7
|
+
|
|
8
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
9
|
+
const jsonContentHeaders = {
|
|
10
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Elastic metal API.
|
|
14
|
+
*
|
|
15
|
+
* This API allows to manage your Bare metal server.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
class BaremetalV1GenAPI extends API {
|
|
19
|
+
constructor() {
|
|
20
|
+
var _this;
|
|
21
|
+
|
|
22
|
+
super(...arguments);
|
|
23
|
+
_this = this;
|
|
24
|
+
|
|
25
|
+
this.pageOfListServers = function (request) {
|
|
26
|
+
if (request === void 0) {
|
|
27
|
+
request = {};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return _this.client.fetch({
|
|
31
|
+
method: 'GET',
|
|
32
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/servers`,
|
|
33
|
+
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])
|
|
34
|
+
}, unmarshal23C1);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
this.listServers = function (request) {
|
|
38
|
+
if (request === void 0) {
|
|
39
|
+
request = {};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return enrichForPagination('servers', _this.pageOfListServers, request);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
this.getServer = request => this.client.fetch({
|
|
46
|
+
method: 'GET',
|
|
47
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
48
|
+
}, unmarshal23C1);
|
|
49
|
+
|
|
50
|
+
this.waitForServer = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!SERVER_TRANSIENT_STATUSES.includes(res.status))), this.getServer, request, options);
|
|
51
|
+
|
|
52
|
+
this.createServer = request => this.client.fetch({
|
|
53
|
+
body: JSON.stringify(marshalCreateServerRequest(request, this.client.settings)),
|
|
54
|
+
headers: jsonContentHeaders,
|
|
55
|
+
method: 'POST',
|
|
56
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`
|
|
57
|
+
}, unmarshal23C1);
|
|
58
|
+
|
|
59
|
+
this.updateServer = request => this.client.fetch({
|
|
60
|
+
body: JSON.stringify(marshalUpdateServerRequest(request, this.client.settings)),
|
|
61
|
+
headers: jsonContentHeaders,
|
|
62
|
+
method: 'PATCH',
|
|
63
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
64
|
+
}, unmarshal23C1);
|
|
65
|
+
|
|
66
|
+
this.installServer = request => this.client.fetch({
|
|
67
|
+
body: JSON.stringify(marshalInstallServerRequest(request, this.client.settings)),
|
|
68
|
+
headers: jsonContentHeaders,
|
|
69
|
+
method: 'POST',
|
|
70
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/install`
|
|
71
|
+
}, unmarshal23C1);
|
|
72
|
+
|
|
73
|
+
this.getServerMetrics = request => this.client.fetch({
|
|
74
|
+
method: 'GET',
|
|
75
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/metrics`
|
|
76
|
+
}, unmarshalAnyRes);
|
|
77
|
+
|
|
78
|
+
this.deleteServer = request => this.client.fetch({
|
|
79
|
+
method: 'DELETE',
|
|
80
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}`
|
|
81
|
+
}, unmarshal23C1);
|
|
82
|
+
|
|
83
|
+
this.rebootServer = request => this.client.fetch({
|
|
84
|
+
body: JSON.stringify(marshalRebootServerRequest(request, this.client.settings)),
|
|
85
|
+
headers: jsonContentHeaders,
|
|
86
|
+
method: 'POST',
|
|
87
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/reboot`
|
|
88
|
+
}, unmarshal23C1);
|
|
89
|
+
|
|
90
|
+
this.startServer = request => this.client.fetch({
|
|
91
|
+
body: JSON.stringify(marshalStartServerRequest(request, this.client.settings)),
|
|
92
|
+
headers: jsonContentHeaders,
|
|
93
|
+
method: 'POST',
|
|
94
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/start`
|
|
95
|
+
}, unmarshal23C1);
|
|
96
|
+
|
|
97
|
+
this.stopServer = request => this.client.fetch({
|
|
98
|
+
body: '{}',
|
|
99
|
+
headers: jsonContentHeaders,
|
|
100
|
+
method: 'POST',
|
|
101
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/stop`
|
|
102
|
+
}, unmarshal23C1);
|
|
103
|
+
|
|
104
|
+
this.pageOfListServerEvents = request => this.client.fetch({
|
|
105
|
+
method: 'GET',
|
|
106
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/events`,
|
|
107
|
+
urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
|
|
108
|
+
}, unmarshal0ECB);
|
|
109
|
+
|
|
110
|
+
this.listServerEvents = request => enrichForPagination('events', this.pageOfListServerEvents, request);
|
|
111
|
+
|
|
112
|
+
this.startBMCAccess = request => this.client.fetch({
|
|
113
|
+
body: JSON.stringify(marshalStartBMCAccessRequest(request, this.client.settings)),
|
|
114
|
+
headers: jsonContentHeaders,
|
|
115
|
+
method: 'POST',
|
|
116
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
|
|
117
|
+
}, unmarshal41B8);
|
|
118
|
+
|
|
119
|
+
this.getBMCAccess = request => this.client.fetch({
|
|
120
|
+
method: 'GET',
|
|
121
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
|
|
122
|
+
}, unmarshal41B8);
|
|
123
|
+
|
|
124
|
+
this.stopBMCAccess = request => this.client.fetch({
|
|
125
|
+
method: 'DELETE',
|
|
126
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/bmc-access`
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
this.updateIP = request => this.client.fetch({
|
|
130
|
+
body: JSON.stringify(marshalUpdateIPRequest(request, this.client.settings)),
|
|
131
|
+
headers: jsonContentHeaders,
|
|
132
|
+
method: 'PATCH',
|
|
133
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/ips/${validatePathParam('ipId', request.ipId)}`
|
|
134
|
+
}, unmarshalAnyRes);
|
|
135
|
+
|
|
136
|
+
this.addOptionServer = request => this.client.fetch({
|
|
137
|
+
body: JSON.stringify(marshalAddOptionServerRequest(request, this.client.settings)),
|
|
138
|
+
headers: jsonContentHeaders,
|
|
139
|
+
method: 'POST',
|
|
140
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/options/${validatePathParam('optionId', request.optionId)}`
|
|
141
|
+
}, unmarshal23C1);
|
|
142
|
+
|
|
143
|
+
this.deleteOptionServer = request => this.client.fetch({
|
|
144
|
+
method: 'DELETE',
|
|
145
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers/${validatePathParam('serverId', request.serverId)}/options/${validatePathParam('optionId', request.optionId)}`
|
|
146
|
+
}, unmarshal23C1);
|
|
147
|
+
|
|
148
|
+
this.pageOfListOffers = function (request) {
|
|
149
|
+
if (request === void 0) {
|
|
150
|
+
request = {};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return _this.client.fetch({
|
|
154
|
+
method: 'GET',
|
|
155
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/offers`,
|
|
156
|
+
urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['subscription_period', request.subscriptionPeriod ?? 'unknown_subscription_period'])
|
|
157
|
+
}, unmarshalAnyRes);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
this.listOffers = function (request) {
|
|
161
|
+
if (request === void 0) {
|
|
162
|
+
request = {};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return enrichForPagination('offers', _this.pageOfListOffers, request);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
this.getOffer = request => this.client.fetch({
|
|
169
|
+
method: 'GET',
|
|
170
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/offers/${validatePathParam('offerId', request.offerId)}`
|
|
171
|
+
}, unmarshalAnyRes);
|
|
172
|
+
|
|
173
|
+
this.getOption = request => this.client.fetch({
|
|
174
|
+
method: 'GET',
|
|
175
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/options/${validatePathParam('optionId', request.optionId)}`
|
|
176
|
+
}, unmarshalAnyRes);
|
|
177
|
+
|
|
178
|
+
this.pageOfListOptions = function (request) {
|
|
179
|
+
if (request === void 0) {
|
|
180
|
+
request = {};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return _this.client.fetch({
|
|
184
|
+
method: 'GET',
|
|
185
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/options`,
|
|
186
|
+
urlParams: urlParams(['name', request.name], ['offer_id', request.offerId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
|
|
187
|
+
}, unmarshalAnyRes);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
this.listOptions = function (request) {
|
|
191
|
+
if (request === void 0) {
|
|
192
|
+
request = {};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return enrichForPagination('options', _this.pageOfListOptions, request);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
this.pageOfListSettings = function (request) {
|
|
199
|
+
if (request === void 0) {
|
|
200
|
+
request = {};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return _this.client.fetch({
|
|
204
|
+
method: 'GET',
|
|
205
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/settings`,
|
|
206
|
+
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])
|
|
207
|
+
}, unmarshalAnyRes);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
this.listSettings = function (request) {
|
|
211
|
+
if (request === void 0) {
|
|
212
|
+
request = {};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return enrichForPagination('settings', _this.pageOfListSettings, request);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
this.updateSetting = request => this.client.fetch({
|
|
219
|
+
body: JSON.stringify(marshalUpdateSettingRequest(request, this.client.settings)),
|
|
220
|
+
headers: jsonContentHeaders,
|
|
221
|
+
method: 'PATCH',
|
|
222
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/settings/${validatePathParam('settingId', request.settingId)}`
|
|
223
|
+
}, unmarshalAnyRes);
|
|
224
|
+
|
|
225
|
+
this.pageOfListOS = function (request) {
|
|
226
|
+
if (request === void 0) {
|
|
227
|
+
request = {};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return _this.client.fetch({
|
|
231
|
+
method: 'GET',
|
|
232
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/os`,
|
|
233
|
+
urlParams: urlParams(['offer_id', request.offerId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
|
|
234
|
+
}, unmarshalAnyRes);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
this.listOS = function (request) {
|
|
238
|
+
if (request === void 0) {
|
|
239
|
+
request = {};
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return enrichForPagination('os', _this.pageOfListOS, request);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
this.getOS = request => this.client.fetch({
|
|
246
|
+
method: 'GET',
|
|
247
|
+
path: `/baremetal/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/os/${validatePathParam('osId', request.osId)}`
|
|
248
|
+
}, unmarshalAnyRes);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
}
|
|
252
|
+
BaremetalV1GenAPI.LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1'];
|
|
253
|
+
|
|
254
|
+
export { BaremetalV1GenAPI };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { tryAtIntervals, createExponentialBackoffStrategy } from '../../../internal/async/interval-retrier.js';
|
|
2
|
+
import { BaremetalV1GenAPI } from './api.gen.js';
|
|
3
|
+
import { SERVER_INSTALL_TRANSIENT_STATUSES } from './content.gen.js';
|
|
4
|
+
|
|
5
|
+
class BaremetalV1UtilsAPI extends BaremetalV1GenAPI {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
|
|
9
|
+
this.waitForServerInstall = (request, options) => tryAtIntervals(async () => {
|
|
10
|
+
const value = await this.getServer(request).then(server => {
|
|
11
|
+
if (!server.install) {
|
|
12
|
+
throw new Error(`Server creation has not begun for server ${request.serverId}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return server.install;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
if (!value) {
|
|
19
|
+
throw new Error(`Server creation has not begun for server ${request.serverId}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
done: !SERVER_INSTALL_TRANSIENT_STATUSES.includes(value.status),
|
|
24
|
+
value
|
|
25
|
+
};
|
|
26
|
+
}, createExponentialBackoffStrategy((options == null ? void 0 : options.minDelay) ?? 1, (options == null ? void 0 : options.maxDelay) ?? 30), options == null ? void 0 : options.timeout);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { BaremetalV1UtilsAPI };
|