@scaleway/sdk-serverless-sqldb 1.2.0 → 2.1.1
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 +96 -0
- package/dist/v1alpha1/api.gen.d.ts +1 -1
- package/dist/v1alpha1/api.gen.js +6 -12
- package/dist/v1alpha1/index.gen.d.ts +1 -1
- package/package.json +6 -9
- package/dist/index.gen.cjs +0 -4
- package/dist/v1alpha1/api.gen.cjs +0 -188
- package/dist/v1alpha1/content.gen.cjs +0 -8
- package/dist/v1alpha1/index.gen.cjs +0 -16
- package/dist/v1alpha1/marshalling.gen.cjs +0 -89
- package/dist/v1alpha1/validation-rules.gen.cjs +0 -62
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @scaleway/sdk-serverless-sqldb
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@scaleway/sdk-serverless-sqldb)
|
|
4
|
+
[](https://www.npmjs.com/package/@scaleway/sdk-serverless-sqldb)
|
|
5
|
+
[](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
|
|
6
|
+
|
|
7
|
+
Scaleway SDK for Serverless Sqldb API.
|
|
8
|
+
|
|
9
|
+
> **Note**
|
|
10
|
+
> This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @scaleway/sdk-serverless-sqldb @scaleway/sdk-client
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or with pnpm:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm add @scaleway/sdk-serverless-sqldb @scaleway/sdk-client
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
or with yarn:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
yarn add @scaleway/sdk-serverless-sqldb @scaleway/sdk-client
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Getting Started
|
|
31
|
+
|
|
32
|
+
You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
|
|
33
|
+
|
|
34
|
+
### Basic Usage
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { createClient } from '@scaleway/sdk-client'
|
|
38
|
+
import { ServerlessSqldb } from '@scaleway/sdk-serverless-sqldb'
|
|
39
|
+
|
|
40
|
+
const client = createClient({
|
|
41
|
+
accessKey: 'SCWXXXXXXXXXXXXXXXXX',
|
|
42
|
+
secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
43
|
+
defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
44
|
+
defaultRegion: 'fr-par',
|
|
45
|
+
defaultZone: 'fr-par-1',
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const api = new ServerlessSqldb.v1.API(client)
|
|
49
|
+
|
|
50
|
+
// Use the API
|
|
51
|
+
// Example: await api.listServers()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Using Configuration Loader
|
|
55
|
+
|
|
56
|
+
For a simpler setup, you can load credentials from the configuration file or environment variables:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { createClient } from '@scaleway/sdk-client'
|
|
60
|
+
import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
|
|
61
|
+
import { ServerlessSqldb } from '@scaleway/sdk-serverless-sqldb'
|
|
62
|
+
|
|
63
|
+
const profile = loadProfileFromConfigurationFile()
|
|
64
|
+
const client = createClient(profile)
|
|
65
|
+
const api = new ServerlessSqldb.v1.API(client)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Documentation
|
|
69
|
+
|
|
70
|
+
- 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
|
|
71
|
+
- 🌐 [Scaleway Serverless Sqldb API Documentation](https://www.scaleway.com/en/developers/api/serverless-sqldb/)
|
|
72
|
+
- 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
|
|
73
|
+
- 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
- ✅ Full TypeScript support with complete type definitions
|
|
78
|
+
- ✅ Promise-based API
|
|
79
|
+
- ✅ Automatic pagination helpers
|
|
80
|
+
- ✅ Built-in error handling
|
|
81
|
+
- ✅ Compatible with Node.js ≥ 20
|
|
82
|
+
|
|
83
|
+
## Support
|
|
84
|
+
|
|
85
|
+
We love feedback! Feel free to reach us on:
|
|
86
|
+
- [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
|
|
87
|
+
- [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
|
|
96
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
1
|
import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client';
|
|
2
|
+
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
3
3
|
import type { CreateDatabaseRequest, Database, DatabaseBackup, DeleteDatabaseRequest, ExportDatabaseBackupRequest, GetDatabaseBackupRequest, GetDatabaseRequest, ListDatabaseBackupsRequest, ListDatabaseBackupsResponse, ListDatabasesRequest, ListDatabasesResponse, RestoreDatabaseFromBackupRequest, UpdateDatabaseRequest } from './types.gen.js';
|
|
4
4
|
/**
|
|
5
5
|
* Serverless SQL Databases API.
|
package/dist/v1alpha1/api.gen.js
CHANGED
|
@@ -10,7 +10,9 @@ class API extends API$1 {
|
|
|
10
10
|
* type ∈ {'zone','region','global','unspecified'}
|
|
11
11
|
*/
|
|
12
12
|
static LOCALITY = toApiLocality({
|
|
13
|
-
regions: [
|
|
13
|
+
regions: [
|
|
14
|
+
"fr-par"
|
|
15
|
+
]
|
|
14
16
|
});
|
|
15
17
|
/**
|
|
16
18
|
* Create a new Serverless SQL Database. You must provide the following parameters: `organization_id`, `project_id`, `name`, `cpu_min`, `cpu_max`. You can also provide `from_backup_id` to create a database from a backup.
|
|
@@ -50,9 +52,7 @@ class API extends API$1 {
|
|
|
50
52
|
* @returns A Promise of Database
|
|
51
53
|
*/
|
|
52
54
|
waitForDatabase = (request, options) => waitForResource(
|
|
53
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
54
|
-
!DATABASE_TRANSIENT_STATUSES.includes(res.status)
|
|
55
|
-
)),
|
|
55
|
+
options?.stop ?? ((res) => Promise.resolve(!DATABASE_TRANSIENT_STATUSES.includes(res.status))),
|
|
56
56
|
this.getDatabase,
|
|
57
57
|
request,
|
|
58
58
|
options
|
|
@@ -80,10 +80,7 @@ class API extends API$1 {
|
|
|
80
80
|
["organization_id", request.organizationId],
|
|
81
81
|
["page", request.page],
|
|
82
82
|
["page_size", request.pageSize],
|
|
83
|
-
[
|
|
84
|
-
"project_id",
|
|
85
|
-
request.projectId ?? this.client.settings.defaultProjectId
|
|
86
|
-
]
|
|
83
|
+
["project_id", request.projectId ?? this.client.settings.defaultProjectId]
|
|
87
84
|
)
|
|
88
85
|
},
|
|
89
86
|
unmarshalListDatabasesResponse
|
|
@@ -121,10 +118,7 @@ class API extends API$1 {
|
|
|
121
118
|
restoreDatabaseFromBackup = (request) => this.client.fetch(
|
|
122
119
|
{
|
|
123
120
|
body: JSON.stringify(
|
|
124
|
-
marshalRestoreDatabaseFromBackupRequest(
|
|
125
|
-
request,
|
|
126
|
-
this.client.settings
|
|
127
|
-
)
|
|
121
|
+
marshalRestoreDatabaseFromBackupRequest(request, this.client.settings)
|
|
128
122
|
),
|
|
129
123
|
headers: jsonContentHeaders,
|
|
130
124
|
method: "POST",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { API } from './api.gen.js';
|
|
1
|
+
export { API, } from './api.gen.js';
|
|
2
2
|
export * from './content.gen.js';
|
|
3
3
|
export * from './marshalling.gen.js';
|
|
4
4
|
export type { CreateDatabaseRequest, Database, DatabaseBackup, DatabaseBackupStatus, DatabaseStatus, DeleteDatabaseRequest, ExportDatabaseBackupRequest, GetDatabaseBackupRequest, GetDatabaseRequest, ListDatabaseBackupsRequest, ListDatabaseBackupsRequestOrderBy, ListDatabaseBackupsResponse, ListDatabasesRequest, ListDatabasesRequestOrderBy, ListDatabasesResponse, RestoreDatabaseFromBackupRequest, UpdateDatabaseRequest, } from './types.gen.js';
|
package/package.json
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/sdk-serverless-sqldb",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Scaleway SDK serverless-sqldb",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
7
|
+
"README.md",
|
|
7
8
|
"dist"
|
|
8
9
|
],
|
|
9
10
|
"type": "module",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"types": "./dist/index.gen.d.ts",
|
|
13
|
-
"import": "./dist/index.gen.js",
|
|
14
|
-
"require": "./dist/index.gen.cjs",
|
|
15
14
|
"default": "./dist/index.gen.js"
|
|
16
15
|
},
|
|
17
16
|
"./*": {
|
|
18
17
|
"types": "./dist/*/index.gen.d.ts",
|
|
19
|
-
"import": "./dist/*/index.gen.js",
|
|
20
|
-
"require": "./dist/*/index.gen.cjs",
|
|
21
18
|
"default": "./dist/*/index.gen.js"
|
|
22
19
|
}
|
|
23
20
|
},
|
|
@@ -26,17 +23,17 @@
|
|
|
26
23
|
"directory": "packages_generated/serverless-sqldb"
|
|
27
24
|
},
|
|
28
25
|
"engines": {
|
|
29
|
-
"node": ">=20.19.
|
|
26
|
+
"node": ">=20.19.6"
|
|
30
27
|
},
|
|
31
28
|
"dependencies": {
|
|
32
29
|
"@scaleway/random-name": "5.1.2",
|
|
33
|
-
"@scaleway/sdk-std": "1.
|
|
30
|
+
"@scaleway/sdk-std": "2.1.0"
|
|
34
31
|
},
|
|
35
32
|
"peerDependencies": {
|
|
36
|
-
"@scaleway/sdk-client": "^1.
|
|
33
|
+
"@scaleway/sdk-client": "^2.1.0"
|
|
37
34
|
},
|
|
38
35
|
"devDependencies": {
|
|
39
|
-
"@scaleway/sdk-client": "^1.
|
|
36
|
+
"@scaleway/sdk-client": "^2.1.0"
|
|
40
37
|
},
|
|
41
38
|
"scripts": {
|
|
42
39
|
"package:check": "pnpm publint",
|
package/dist/index.gen.cjs
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const sdkClient = require("@scaleway/sdk-client");
|
|
4
|
-
const content_gen = require("./content.gen.cjs");
|
|
5
|
-
const marshalling_gen = require("./marshalling.gen.cjs");
|
|
6
|
-
const jsonContentHeaders = {
|
|
7
|
-
"Content-Type": "application/json; charset=utf-8"
|
|
8
|
-
};
|
|
9
|
-
class API extends sdkClient.API {
|
|
10
|
-
/**
|
|
11
|
-
* Locality of this API.
|
|
12
|
-
* type ∈ {'zone','region','global','unspecified'}
|
|
13
|
-
*/
|
|
14
|
-
static LOCALITY = sdkClient.toApiLocality({
|
|
15
|
-
regions: ["fr-par"]
|
|
16
|
-
});
|
|
17
|
-
/**
|
|
18
|
-
* Create a new Serverless SQL Database. You must provide the following parameters: `organization_id`, `project_id`, `name`, `cpu_min`, `cpu_max`. You can also provide `from_backup_id` to create a database from a backup.
|
|
19
|
-
*
|
|
20
|
-
* @param request - The request {@link CreateDatabaseRequest}
|
|
21
|
-
* @returns A Promise of Database
|
|
22
|
-
*/
|
|
23
|
-
createDatabase = (request) => this.client.fetch(
|
|
24
|
-
{
|
|
25
|
-
body: JSON.stringify(
|
|
26
|
-
marshalling_gen.marshalCreateDatabaseRequest(request, this.client.settings)
|
|
27
|
-
),
|
|
28
|
-
headers: jsonContentHeaders,
|
|
29
|
-
method: "POST",
|
|
30
|
-
path: `/serverless-sqldb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/databases`
|
|
31
|
-
},
|
|
32
|
-
marshalling_gen.unmarshalDatabase
|
|
33
|
-
);
|
|
34
|
-
/**
|
|
35
|
-
* Get a database information. Retrieve information about your Serverless SQL Database. You must provide the `database_id` parameter.
|
|
36
|
-
*
|
|
37
|
-
* @param request - The request {@link GetDatabaseRequest}
|
|
38
|
-
* @returns A Promise of Database
|
|
39
|
-
*/
|
|
40
|
-
getDatabase = (request) => this.client.fetch(
|
|
41
|
-
{
|
|
42
|
-
method: "GET",
|
|
43
|
-
path: `/serverless-sqldb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/databases/${sdkClient.validatePathParam("databaseId", request.databaseId)}`
|
|
44
|
-
},
|
|
45
|
-
marshalling_gen.unmarshalDatabase
|
|
46
|
-
);
|
|
47
|
-
/**
|
|
48
|
-
* Waits for {@link Database} to be in a final state.
|
|
49
|
-
*
|
|
50
|
-
* @param request - The request {@link GetDatabaseRequest}
|
|
51
|
-
* @param options - The waiting options
|
|
52
|
-
* @returns A Promise of Database
|
|
53
|
-
*/
|
|
54
|
-
waitForDatabase = (request, options) => sdkClient.waitForResource(
|
|
55
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
56
|
-
!content_gen.DATABASE_TRANSIENT_STATUSES.includes(res.status)
|
|
57
|
-
)),
|
|
58
|
-
this.getDatabase,
|
|
59
|
-
request,
|
|
60
|
-
options
|
|
61
|
-
);
|
|
62
|
-
/**
|
|
63
|
-
* Delete a database. Deletes a database. You must provide the `database_id` parameter. All data stored in the database will be permanently deleted.
|
|
64
|
-
*
|
|
65
|
-
* @param request - The request {@link DeleteDatabaseRequest}
|
|
66
|
-
* @returns A Promise of Database
|
|
67
|
-
*/
|
|
68
|
-
deleteDatabase = (request) => this.client.fetch(
|
|
69
|
-
{
|
|
70
|
-
method: "DELETE",
|
|
71
|
-
path: `/serverless-sqldb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/databases/${sdkClient.validatePathParam("databaseId", request.databaseId)}`
|
|
72
|
-
},
|
|
73
|
-
marshalling_gen.unmarshalDatabase
|
|
74
|
-
);
|
|
75
|
-
pageOfListDatabases = (request = {}) => this.client.fetch(
|
|
76
|
-
{
|
|
77
|
-
method: "GET",
|
|
78
|
-
path: `/serverless-sqldb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/databases`,
|
|
79
|
-
urlParams: sdkClient.urlParams(
|
|
80
|
-
["name", request.name],
|
|
81
|
-
["order_by", request.orderBy],
|
|
82
|
-
["organization_id", request.organizationId],
|
|
83
|
-
["page", request.page],
|
|
84
|
-
["page_size", request.pageSize],
|
|
85
|
-
[
|
|
86
|
-
"project_id",
|
|
87
|
-
request.projectId ?? this.client.settings.defaultProjectId
|
|
88
|
-
]
|
|
89
|
-
)
|
|
90
|
-
},
|
|
91
|
-
marshalling_gen.unmarshalListDatabasesResponse
|
|
92
|
-
);
|
|
93
|
-
/**
|
|
94
|
-
* List your Serverless SQL Databases. List all Serverless SQL Databases for a given Scaleway Organization or Scaleway Project. By default, the databases returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. For the `name` parameter, the value you include will be checked against the whole name string to see if it includes the string you put in the parameter.
|
|
95
|
-
*
|
|
96
|
-
* @param request - The request {@link ListDatabasesRequest}
|
|
97
|
-
* @returns A Promise of ListDatabasesResponse
|
|
98
|
-
*/
|
|
99
|
-
listDatabases = (request = {}) => sdkClient.enrichForPagination("databases", this.pageOfListDatabases, request);
|
|
100
|
-
/**
|
|
101
|
-
* Update database information. Update CPU limits of your Serverless SQL Database. You must provide the `database_id` parameter.
|
|
102
|
-
*
|
|
103
|
-
* @param request - The request {@link UpdateDatabaseRequest}
|
|
104
|
-
* @returns A Promise of Database
|
|
105
|
-
*/
|
|
106
|
-
updateDatabase = (request) => this.client.fetch(
|
|
107
|
-
{
|
|
108
|
-
body: JSON.stringify(
|
|
109
|
-
marshalling_gen.marshalUpdateDatabaseRequest(request, this.client.settings)
|
|
110
|
-
),
|
|
111
|
-
headers: jsonContentHeaders,
|
|
112
|
-
method: "PATCH",
|
|
113
|
-
path: `/serverless-sqldb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/databases/${sdkClient.validatePathParam("databaseId", request.databaseId)}`
|
|
114
|
-
},
|
|
115
|
-
marshalling_gen.unmarshalDatabase
|
|
116
|
-
);
|
|
117
|
-
/**
|
|
118
|
-
* Restore a database from a backup. Restore a database from a backup. You must provide the `backup_id` parameter.
|
|
119
|
-
*
|
|
120
|
-
* @param request - The request {@link RestoreDatabaseFromBackupRequest}
|
|
121
|
-
* @returns A Promise of Database
|
|
122
|
-
*/
|
|
123
|
-
restoreDatabaseFromBackup = (request) => this.client.fetch(
|
|
124
|
-
{
|
|
125
|
-
body: JSON.stringify(
|
|
126
|
-
marshalling_gen.marshalRestoreDatabaseFromBackupRequest(
|
|
127
|
-
request,
|
|
128
|
-
this.client.settings
|
|
129
|
-
)
|
|
130
|
-
),
|
|
131
|
-
headers: jsonContentHeaders,
|
|
132
|
-
method: "POST",
|
|
133
|
-
path: `/serverless-sqldb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/databases/${sdkClient.validatePathParam("databaseId", request.databaseId)}/restore`
|
|
134
|
-
},
|
|
135
|
-
marshalling_gen.unmarshalDatabase
|
|
136
|
-
);
|
|
137
|
-
/**
|
|
138
|
-
* Get a database backup information. Retrieve information about your Serverless SQL Database backup. You must provide the `backup_id` parameter.
|
|
139
|
-
*
|
|
140
|
-
* @param request - The request {@link GetDatabaseBackupRequest}
|
|
141
|
-
* @returns A Promise of DatabaseBackup
|
|
142
|
-
*/
|
|
143
|
-
getDatabaseBackup = (request) => this.client.fetch(
|
|
144
|
-
{
|
|
145
|
-
method: "GET",
|
|
146
|
-
path: `/serverless-sqldb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backups/${sdkClient.validatePathParam("backupId", request.backupId)}`
|
|
147
|
-
},
|
|
148
|
-
marshalling_gen.unmarshalDatabaseBackup
|
|
149
|
-
);
|
|
150
|
-
pageOfListDatabaseBackups = (request) => this.client.fetch(
|
|
151
|
-
{
|
|
152
|
-
method: "GET",
|
|
153
|
-
path: `/serverless-sqldb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backups`,
|
|
154
|
-
urlParams: sdkClient.urlParams(
|
|
155
|
-
["database_id", request.databaseId],
|
|
156
|
-
["order_by", request.orderBy],
|
|
157
|
-
["organization_id", request.organizationId],
|
|
158
|
-
["page", request.page],
|
|
159
|
-
["page_size", request.pageSize],
|
|
160
|
-
["project_id", request.projectId]
|
|
161
|
-
)
|
|
162
|
-
},
|
|
163
|
-
marshalling_gen.unmarshalListDatabaseBackupsResponse
|
|
164
|
-
);
|
|
165
|
-
/**
|
|
166
|
-
* List your Serverless SQL Database backups. List all Serverless SQL Database backups for a given Scaleway Project or Database. By default, the backups returned in the list are ordered by creation date in descending order, though this can be modified via the order_by field.
|
|
167
|
-
*
|
|
168
|
-
* @param request - The request {@link ListDatabaseBackupsRequest}
|
|
169
|
-
* @returns A Promise of ListDatabaseBackupsResponse
|
|
170
|
-
*/
|
|
171
|
-
listDatabaseBackups = (request) => sdkClient.enrichForPagination("backups", this.pageOfListDatabaseBackups, request);
|
|
172
|
-
/**
|
|
173
|
-
* Export a database backup. Export a database backup providing a download link once the export process is completed. You must provide the `backup_id` parameter.
|
|
174
|
-
*
|
|
175
|
-
* @param request - The request {@link ExportDatabaseBackupRequest}
|
|
176
|
-
* @returns A Promise of DatabaseBackup
|
|
177
|
-
*/
|
|
178
|
-
exportDatabaseBackup = (request) => this.client.fetch(
|
|
179
|
-
{
|
|
180
|
-
body: "{}",
|
|
181
|
-
headers: jsonContentHeaders,
|
|
182
|
-
method: "POST",
|
|
183
|
-
path: `/serverless-sqldb/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/backups/${sdkClient.validatePathParam("backupId", request.backupId)}/export`
|
|
184
|
-
},
|
|
185
|
-
marshalling_gen.unmarshalDatabaseBackup
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
exports.API = API;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const api_gen = require("./api.gen.cjs");
|
|
4
|
-
const content_gen = require("./content.gen.cjs");
|
|
5
|
-
const marshalling_gen = require("./marshalling.gen.cjs");
|
|
6
|
-
const validationRules_gen = require("./validation-rules.gen.cjs");
|
|
7
|
-
exports.API = api_gen.API;
|
|
8
|
-
exports.DATABASE_TRANSIENT_STATUSES = content_gen.DATABASE_TRANSIENT_STATUSES;
|
|
9
|
-
exports.marshalCreateDatabaseRequest = marshalling_gen.marshalCreateDatabaseRequest;
|
|
10
|
-
exports.marshalRestoreDatabaseFromBackupRequest = marshalling_gen.marshalRestoreDatabaseFromBackupRequest;
|
|
11
|
-
exports.marshalUpdateDatabaseRequest = marshalling_gen.marshalUpdateDatabaseRequest;
|
|
12
|
-
exports.unmarshalDatabase = marshalling_gen.unmarshalDatabase;
|
|
13
|
-
exports.unmarshalDatabaseBackup = marshalling_gen.unmarshalDatabaseBackup;
|
|
14
|
-
exports.unmarshalListDatabaseBackupsResponse = marshalling_gen.unmarshalListDatabaseBackupsResponse;
|
|
15
|
-
exports.unmarshalListDatabasesResponse = marshalling_gen.unmarshalListDatabasesResponse;
|
|
16
|
-
exports.ValidationRules = validationRules_gen;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const sdkClient = require("@scaleway/sdk-client");
|
|
4
|
-
const unmarshalDatabaseBackup = (data) => {
|
|
5
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
6
|
-
throw new TypeError(
|
|
7
|
-
`Unmarshalling the type 'DatabaseBackup' failed as data isn't a dictionary.`
|
|
8
|
-
);
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
12
|
-
databaseId: data.database_id,
|
|
13
|
-
dbSize: data.db_size,
|
|
14
|
-
downloadUrl: data.download_url,
|
|
15
|
-
downloadUrlExpiresAt: sdkClient.unmarshalDate(data.download_url_expires_at),
|
|
16
|
-
expiresAt: sdkClient.unmarshalDate(data.expires_at),
|
|
17
|
-
id: data.id,
|
|
18
|
-
organizationId: data.organization_id,
|
|
19
|
-
projectId: data.project_id,
|
|
20
|
-
region: data.region,
|
|
21
|
-
size: data.size,
|
|
22
|
-
status: data.status
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
const unmarshalDatabase = (data) => {
|
|
26
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
27
|
-
throw new TypeError(
|
|
28
|
-
`Unmarshalling the type 'Database' failed as data isn't a dictionary.`
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
cpuCurrent: data.cpu_current,
|
|
33
|
-
cpuMax: data.cpu_max,
|
|
34
|
-
cpuMin: data.cpu_min,
|
|
35
|
-
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
36
|
-
endpoint: data.endpoint,
|
|
37
|
-
engineMajorVersion: data.engine_major_version,
|
|
38
|
-
id: data.id,
|
|
39
|
-
name: data.name,
|
|
40
|
-
organizationId: data.organization_id,
|
|
41
|
-
projectId: data.project_id,
|
|
42
|
-
region: data.region,
|
|
43
|
-
started: data.started,
|
|
44
|
-
status: data.status
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
const unmarshalListDatabaseBackupsResponse = (data) => {
|
|
48
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
49
|
-
throw new TypeError(
|
|
50
|
-
`Unmarshalling the type 'ListDatabaseBackupsResponse' failed as data isn't a dictionary.`
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
backups: sdkClient.unmarshalArrayOfObject(data.backups, unmarshalDatabaseBackup),
|
|
55
|
-
totalCount: data.total_count
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
const unmarshalListDatabasesResponse = (data) => {
|
|
59
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
60
|
-
throw new TypeError(
|
|
61
|
-
`Unmarshalling the type 'ListDatabasesResponse' failed as data isn't a dictionary.`
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
databases: sdkClient.unmarshalArrayOfObject(data.databases, unmarshalDatabase),
|
|
66
|
-
totalCount: data.total_count
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
const marshalCreateDatabaseRequest = (request, defaults) => ({
|
|
70
|
-
cpu_max: request.cpuMax,
|
|
71
|
-
cpu_min: request.cpuMin,
|
|
72
|
-
from_backup_id: request.fromBackupId,
|
|
73
|
-
name: request.name,
|
|
74
|
-
project_id: request.projectId ?? defaults.defaultProjectId
|
|
75
|
-
});
|
|
76
|
-
const marshalRestoreDatabaseFromBackupRequest = (request, defaults) => ({
|
|
77
|
-
backup_id: request.backupId
|
|
78
|
-
});
|
|
79
|
-
const marshalUpdateDatabaseRequest = (request, defaults) => ({
|
|
80
|
-
cpu_max: request.cpuMax,
|
|
81
|
-
cpu_min: request.cpuMin
|
|
82
|
-
});
|
|
83
|
-
exports.marshalCreateDatabaseRequest = marshalCreateDatabaseRequest;
|
|
84
|
-
exports.marshalRestoreDatabaseFromBackupRequest = marshalRestoreDatabaseFromBackupRequest;
|
|
85
|
-
exports.marshalUpdateDatabaseRequest = marshalUpdateDatabaseRequest;
|
|
86
|
-
exports.unmarshalDatabase = unmarshalDatabase;
|
|
87
|
-
exports.unmarshalDatabaseBackup = unmarshalDatabaseBackup;
|
|
88
|
-
exports.unmarshalListDatabaseBackupsResponse = unmarshalListDatabaseBackupsResponse;
|
|
89
|
-
exports.unmarshalListDatabasesResponse = unmarshalListDatabasesResponse;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const CreateDatabaseRequest = {
|
|
4
|
-
cpuMax: {
|
|
5
|
-
greaterThanOrEqual: 1,
|
|
6
|
-
lessThanOrEqual: 15
|
|
7
|
-
},
|
|
8
|
-
cpuMin: {
|
|
9
|
-
lessThanOrEqual: 15
|
|
10
|
-
},
|
|
11
|
-
fromBackupId: {
|
|
12
|
-
ignoreEmpty: true
|
|
13
|
-
},
|
|
14
|
-
name: {
|
|
15
|
-
maxLength: 63,
|
|
16
|
-
minLength: 1
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const Database = {
|
|
20
|
-
cpuCurrent: {
|
|
21
|
-
lessThanOrEqual: 15
|
|
22
|
-
},
|
|
23
|
-
cpuMax: {
|
|
24
|
-
greaterThanOrEqual: 1,
|
|
25
|
-
lessThanOrEqual: 15
|
|
26
|
-
},
|
|
27
|
-
cpuMin: {
|
|
28
|
-
lessThanOrEqual: 15
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const ListDatabaseBackupsRequest = {
|
|
32
|
-
page: {
|
|
33
|
-
greaterThanOrEqual: 1
|
|
34
|
-
},
|
|
35
|
-
pageSize: {
|
|
36
|
-
greaterThanOrEqual: 1,
|
|
37
|
-
lessThanOrEqual: 1e3
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const ListDatabasesRequest = {
|
|
41
|
-
page: {
|
|
42
|
-
greaterThanOrEqual: 1
|
|
43
|
-
},
|
|
44
|
-
pageSize: {
|
|
45
|
-
greaterThanOrEqual: 1,
|
|
46
|
-
lessThanOrEqual: 1e3
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const UpdateDatabaseRequest = {
|
|
50
|
-
cpuMax: {
|
|
51
|
-
greaterThanOrEqual: 1,
|
|
52
|
-
lessThanOrEqual: 15
|
|
53
|
-
},
|
|
54
|
-
cpuMin: {
|
|
55
|
-
lessThanOrEqual: 15
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
exports.CreateDatabaseRequest = CreateDatabaseRequest;
|
|
59
|
-
exports.Database = Database;
|
|
60
|
-
exports.ListDatabaseBackupsRequest = ListDatabaseBackupsRequest;
|
|
61
|
-
exports.ListDatabasesRequest = ListDatabasesRequest;
|
|
62
|
-
exports.UpdateDatabaseRequest = UpdateDatabaseRequest;
|