@scaleway/sdk 0.1.0-beta.13 → 0.1.0-beta.15
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/dist/api/baremetal/v1/content.gen.js +1 -1
- package/dist/api/instance/v1/content.gen.js +1 -1
- package/dist/api/mnq/v1alpha1/api.gen.js +1 -1
- package/dist/api/mnq/v1alpha1/marshalling.gen.js +4 -2
- package/dist/api/redis/index.js +2 -0
- package/dist/api/redis/v1/api.gen.js +187 -0
- package/dist/api/redis/v1/content.gen.js +7 -0
- package/dist/api/redis/v1/index.js +2 -0
- package/dist/api/redis/v1/marshalling.gen.js +307 -0
- package/dist/api/transactional_email/index.js +2 -0
- package/dist/api/transactional_email/v1alpha1/api.gen.js +136 -0
- package/dist/api/transactional_email/v1alpha1/index.js +1 -0
- package/dist/api/transactional_email/v1alpha1/marshalling.gen.js +133 -0
- package/dist/index.cjs +1409 -511
- package/dist/index.d.ts +3639 -2529
- package/dist/index.js +6 -4
- package/dist/scw/client.js +1 -1
- package/dist/scw/constants.js +1 -1
- package/package.json +2 -2
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
const SERVER_INSTALL_TRANSIENT_STATUSES = ['to_install', 'installing'];
|
|
6
6
|
/** Lists transient statutes of the enum {@link ServerStatus}. */
|
|
7
7
|
|
|
8
|
-
const SERVER_TRANSIENT_STATUSES = ['delivering', 'stopping', 'starting', 'deleting', 'ordered'];
|
|
8
|
+
const SERVER_TRANSIENT_STATUSES = ['delivering', 'stopping', 'starting', 'deleting', 'ordered', 'resetting'];
|
|
9
9
|
|
|
10
10
|
export { SERVER_INSTALL_TRANSIENT_STATUSES, SERVER_TRANSIENT_STATUSES };
|
|
@@ -14,7 +14,7 @@ const SECURITY_GROUP_TRANSIENT_STATUSES = ['syncing'];
|
|
|
14
14
|
const SERVER_TRANSIENT_STATUSES = ['starting', 'stopping'];
|
|
15
15
|
/** Lists transient statutes of the enum {@link SnapshotState}. */
|
|
16
16
|
|
|
17
|
-
const SNAPSHOT_TRANSIENT_STATUSES = ['snapshotting'];
|
|
17
|
+
const SNAPSHOT_TRANSIENT_STATUSES = ['snapshotting', 'importing', 'exporting'];
|
|
18
18
|
/** Lists transient statutes of the enum {@link TaskStatus}. */
|
|
19
19
|
|
|
20
20
|
const TASK_TRANSIENT_STATUSES = ['pending', 'started', 'retry'];
|
|
@@ -28,7 +28,7 @@ class MnqV1Alpha1GenAPI extends API {
|
|
|
28
28
|
return _this.client.fetch({
|
|
29
29
|
method: 'GET',
|
|
30
30
|
path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/namespaces`,
|
|
31
|
-
urlParams: urlParams(['order_by', request.orderBy ?? '
|
|
31
|
+
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])
|
|
32
32
|
}, unmarshalListNamespacesResponse);
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isJSONObject } from '../../../helpers/json.js';
|
|
2
|
-
import { unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
|
|
2
|
+
import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
|
|
3
3
|
|
|
4
4
|
// This file was automatically generated. DO NOT EDIT.
|
|
5
5
|
|
|
@@ -92,12 +92,14 @@ const unmarshalNamespace = data => {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
return {
|
|
95
|
+
createdAt: unmarshalDate(data.created_at),
|
|
95
96
|
endpoint: data.endpoint,
|
|
96
97
|
id: data.id,
|
|
97
98
|
name: data.name,
|
|
98
99
|
projectId: data.project_id,
|
|
99
100
|
protocol: data.protocol,
|
|
100
|
-
region: data.region
|
|
101
|
+
region: data.region,
|
|
102
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
101
103
|
};
|
|
102
104
|
};
|
|
103
105
|
const unmarshalCredential = data => {
|
package/dist/api/redis/index.js
CHANGED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { waitForResource } from '../../../internal/async/interval-retrier.js';
|
|
2
|
+
import { API } from '../../../scw/api.js';
|
|
3
|
+
import { unmarshalScwFile } from '../../../scw/custom-marshalling.js';
|
|
4
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
5
|
+
import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
|
|
6
|
+
import { CLUSTER_TRANSIENT_STATUSES } from './content.gen.js';
|
|
7
|
+
import { marshalCreateClusterRequest, unmarshalCluster, marshalUpdateClusterRequest, unmarshalListClustersResponse, marshalMigrateClusterRequest, unmarshalClusterMetricsResponse, unmarshalListNodeTypesResponse, unmarshalListClusterVersionsResponse, marshalAddClusterSettingsRequest, unmarshalClusterSettingsResponse, marshalSetClusterSettingsRequest, marshalSetAclRulesRequest, unmarshalSetAclRulesResponse, marshalAddAclRulesRequest, unmarshalAddAclRulesResponse, unmarshalACLRule, marshalSetEndpointsRequest, unmarshalSetEndpointsResponse, marshalAddEndpointsRequest, unmarshalAddEndpointsResponse, unmarshalEndpoint, marshalUpdateEndpointRequest } from './marshalling.gen.js';
|
|
8
|
+
|
|
9
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
10
|
+
const jsonContentHeaders = {
|
|
11
|
+
'Content-Type': 'application/json; charset=utf-8'
|
|
12
|
+
};
|
|
13
|
+
/** Managed Database for Redis™ API. */
|
|
14
|
+
|
|
15
|
+
class RedisV1GenAPI extends API {
|
|
16
|
+
constructor() {
|
|
17
|
+
var _this;
|
|
18
|
+
|
|
19
|
+
super(...arguments);
|
|
20
|
+
_this = this;
|
|
21
|
+
|
|
22
|
+
this.createCluster = request => this.client.fetch({
|
|
23
|
+
body: JSON.stringify(marshalCreateClusterRequest(request, this.client.settings)),
|
|
24
|
+
headers: jsonContentHeaders,
|
|
25
|
+
method: 'POST',
|
|
26
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters`
|
|
27
|
+
}, unmarshalCluster);
|
|
28
|
+
|
|
29
|
+
this.updateCluster = request => this.client.fetch({
|
|
30
|
+
body: JSON.stringify(marshalUpdateClusterRequest(request, this.client.settings)),
|
|
31
|
+
headers: jsonContentHeaders,
|
|
32
|
+
method: 'PATCH',
|
|
33
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}`
|
|
34
|
+
}, unmarshalCluster);
|
|
35
|
+
|
|
36
|
+
this.getCluster = request => this.client.fetch({
|
|
37
|
+
method: 'GET',
|
|
38
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}`
|
|
39
|
+
}, unmarshalCluster);
|
|
40
|
+
|
|
41
|
+
this.waitForCluster = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!CLUSTER_TRANSIENT_STATUSES.includes(res.status))), this.getCluster, request, options);
|
|
42
|
+
|
|
43
|
+
this.pageOfListClusters = function (request) {
|
|
44
|
+
if (request === void 0) {
|
|
45
|
+
request = {};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return _this.client.fetch({
|
|
49
|
+
method: 'GET',
|
|
50
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/clusters`,
|
|
51
|
+
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], ['tags', request.tags])
|
|
52
|
+
}, unmarshalListClustersResponse);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
this.listClusters = function (request) {
|
|
56
|
+
if (request === void 0) {
|
|
57
|
+
request = {};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return enrichForPagination('clusters', _this.pageOfListClusters, request);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
this.migrateCluster = request => this.client.fetch({
|
|
64
|
+
body: JSON.stringify(marshalMigrateClusterRequest(request, this.client.settings)),
|
|
65
|
+
headers: jsonContentHeaders,
|
|
66
|
+
method: 'POST',
|
|
67
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/migrate`
|
|
68
|
+
}, unmarshalCluster);
|
|
69
|
+
|
|
70
|
+
this.deleteCluster = request => this.client.fetch({
|
|
71
|
+
method: 'DELETE',
|
|
72
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}`
|
|
73
|
+
}, unmarshalCluster);
|
|
74
|
+
|
|
75
|
+
this.getClusterMetrics = request => this.client.fetch({
|
|
76
|
+
method: 'GET',
|
|
77
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/metrics`,
|
|
78
|
+
urlParams: urlParams(['end_at', request.endAt], ['metric_name', request.metricName], ['start_at', request.startAt])
|
|
79
|
+
}, unmarshalClusterMetricsResponse);
|
|
80
|
+
|
|
81
|
+
this.pageOfListNodeTypes = request => this.client.fetch({
|
|
82
|
+
method: 'GET',
|
|
83
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/node-types`,
|
|
84
|
+
urlParams: urlParams(['include_disabled_types', request.includeDisabledTypes], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
|
|
85
|
+
}, unmarshalListNodeTypesResponse);
|
|
86
|
+
|
|
87
|
+
this.listNodeTypes = request => enrichForPagination('nodeTypes', this.pageOfListNodeTypes, request);
|
|
88
|
+
|
|
89
|
+
this.pageOfListClusterVersions = request => this.client.fetch({
|
|
90
|
+
method: 'GET',
|
|
91
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/cluster-versions`,
|
|
92
|
+
urlParams: urlParams(['include_beta', request.includeBeta], ['include_deprecated', request.includeDeprecated], ['include_disabled', request.includeDisabled], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['version', request.version])
|
|
93
|
+
}, unmarshalListClusterVersionsResponse);
|
|
94
|
+
|
|
95
|
+
this.listClusterVersions = request => enrichForPagination('versions', this.pageOfListClusterVersions, request);
|
|
96
|
+
|
|
97
|
+
this.getClusterCertificate = request => this.client.fetch({
|
|
98
|
+
method: 'GET',
|
|
99
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/certificate`
|
|
100
|
+
}, unmarshalScwFile);
|
|
101
|
+
|
|
102
|
+
this.renewClusterCertificate = request => this.client.fetch({
|
|
103
|
+
body: '{}',
|
|
104
|
+
headers: jsonContentHeaders,
|
|
105
|
+
method: 'POST',
|
|
106
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/renew-certificate`
|
|
107
|
+
}, unmarshalCluster);
|
|
108
|
+
|
|
109
|
+
this.addClusterSettings = request => this.client.fetch({
|
|
110
|
+
body: JSON.stringify(marshalAddClusterSettingsRequest(request, this.client.settings)),
|
|
111
|
+
headers: jsonContentHeaders,
|
|
112
|
+
method: 'POST',
|
|
113
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/settings`
|
|
114
|
+
}, unmarshalClusterSettingsResponse);
|
|
115
|
+
|
|
116
|
+
this.deleteClusterSetting = request => this.client.fetch({
|
|
117
|
+
method: 'DELETE',
|
|
118
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/settings/${validatePathParam('settingName', request.settingName)}`
|
|
119
|
+
}, unmarshalCluster);
|
|
120
|
+
|
|
121
|
+
this.setClusterSettings = request => this.client.fetch({
|
|
122
|
+
body: JSON.stringify(marshalSetClusterSettingsRequest(request, this.client.settings)),
|
|
123
|
+
headers: jsonContentHeaders,
|
|
124
|
+
method: 'PUT',
|
|
125
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/settings`
|
|
126
|
+
}, unmarshalClusterSettingsResponse);
|
|
127
|
+
|
|
128
|
+
this.setAclRules = request => this.client.fetch({
|
|
129
|
+
body: JSON.stringify(marshalSetAclRulesRequest(request, this.client.settings)),
|
|
130
|
+
headers: jsonContentHeaders,
|
|
131
|
+
method: 'PUT',
|
|
132
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/acls`
|
|
133
|
+
}, unmarshalSetAclRulesResponse);
|
|
134
|
+
|
|
135
|
+
this.addAclRules = request => this.client.fetch({
|
|
136
|
+
body: JSON.stringify(marshalAddAclRulesRequest(request, this.client.settings)),
|
|
137
|
+
headers: jsonContentHeaders,
|
|
138
|
+
method: 'POST',
|
|
139
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/acls`
|
|
140
|
+
}, unmarshalAddAclRulesResponse);
|
|
141
|
+
|
|
142
|
+
this.deleteAclRule = request => this.client.fetch({
|
|
143
|
+
method: 'DELETE',
|
|
144
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/acls/${validatePathParam('aclId', request.aclId)}`
|
|
145
|
+
}, unmarshalCluster);
|
|
146
|
+
|
|
147
|
+
this.getAclRule = request => this.client.fetch({
|
|
148
|
+
method: 'GET',
|
|
149
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/acls/${validatePathParam('aclId', request.aclId)}`
|
|
150
|
+
}, unmarshalACLRule);
|
|
151
|
+
|
|
152
|
+
this.setEndpoints = request => this.client.fetch({
|
|
153
|
+
body: JSON.stringify(marshalSetEndpointsRequest(request, this.client.settings)),
|
|
154
|
+
headers: jsonContentHeaders,
|
|
155
|
+
method: 'PUT',
|
|
156
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/endpoints`
|
|
157
|
+
}, unmarshalSetEndpointsResponse);
|
|
158
|
+
|
|
159
|
+
this.addEndpoints = request => this.client.fetch({
|
|
160
|
+
body: JSON.stringify(marshalAddEndpointsRequest(request, this.client.settings)),
|
|
161
|
+
headers: jsonContentHeaders,
|
|
162
|
+
method: 'POST',
|
|
163
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam('clusterId', request.clusterId)}/endpoints`
|
|
164
|
+
}, unmarshalAddEndpointsResponse);
|
|
165
|
+
|
|
166
|
+
this.deleteEndpoint = request => this.client.fetch({
|
|
167
|
+
method: 'DELETE',
|
|
168
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/endpoints/${validatePathParam('endpointId', request.endpointId)}`
|
|
169
|
+
}, unmarshalCluster);
|
|
170
|
+
|
|
171
|
+
this.getEndpoint = request => this.client.fetch({
|
|
172
|
+
method: 'GET',
|
|
173
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/endpoints/${validatePathParam('endpointId', request.endpointId)}`
|
|
174
|
+
}, unmarshalEndpoint);
|
|
175
|
+
|
|
176
|
+
this.updateEndpoint = request => this.client.fetch({
|
|
177
|
+
body: JSON.stringify(marshalUpdateEndpointRequest(request, this.client.settings)),
|
|
178
|
+
headers: jsonContentHeaders,
|
|
179
|
+
method: 'PATCH',
|
|
180
|
+
path: `/redis/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/endpoints/${validatePathParam('endpointId', request.endpointId)}`
|
|
181
|
+
}, unmarshalEndpoint);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
}
|
|
185
|
+
RedisV1GenAPI.LOCALITIES = ['fr-par-1', 'fr-par-2', 'nl-ams-1', 'pl-waw-1'];
|
|
186
|
+
|
|
187
|
+
export { RedisV1GenAPI };
|
|
@@ -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 ClusterStatus}. */
|
|
5
|
+
const CLUSTER_TRANSIENT_STATUSES = ['provisioning', 'configuring', 'deleting', 'autohealing', 'initializing'];
|
|
6
|
+
|
|
7
|
+
export { CLUSTER_TRANSIENT_STATUSES };
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js';
|
|
2
|
+
import { isJSONObject } from '../../../helpers/json.js';
|
|
3
|
+
import { unmarshalTimeSeries } from '../../../scw/custom-marshalling.js';
|
|
4
|
+
import { unmarshalArrayOfObject, unmarshalDate, resolveOneOf } from '../../../helpers/marshalling.js';
|
|
5
|
+
|
|
6
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
7
|
+
|
|
8
|
+
const unmarshalPrivateNetwork = data => {
|
|
9
|
+
if (!isJSONObject(data)) {
|
|
10
|
+
throw new TypeError(`Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
id: data.id,
|
|
15
|
+
serviceIps: data.service_ips,
|
|
16
|
+
zone: data.zone
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const unmarshalPublicNetwork = data => {
|
|
21
|
+
if (!isJSONObject(data)) {
|
|
22
|
+
throw new TypeError(`Unmarshalling the type 'PublicNetwork' failed as data isn't a dictionary.`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const unmarshalACLRule = data => {
|
|
29
|
+
if (!isJSONObject(data)) {
|
|
30
|
+
throw new TypeError(`Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
description: data.description,
|
|
35
|
+
id: data.id,
|
|
36
|
+
ipCidr: data.ip_cidr
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const unmarshalAvailableClusterSetting = data => {
|
|
41
|
+
if (!isJSONObject(data)) {
|
|
42
|
+
throw new TypeError(`Unmarshalling the type 'AvailableClusterSetting' failed as data isn't a dictionary.`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
defaultValue: data.default_value,
|
|
47
|
+
deprecated: data.deprecated,
|
|
48
|
+
description: data.description,
|
|
49
|
+
maxValue: data.max_value,
|
|
50
|
+
minValue: data.min_value,
|
|
51
|
+
name: data.name,
|
|
52
|
+
regex: data.regex,
|
|
53
|
+
type: data.type
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const unmarshalClusterSetting = data => {
|
|
58
|
+
if (!isJSONObject(data)) {
|
|
59
|
+
throw new TypeError(`Unmarshalling the type 'ClusterSetting' failed as data isn't a dictionary.`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
name: data.name,
|
|
64
|
+
value: data.value
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const unmarshalEndpoint = data => {
|
|
69
|
+
if (!isJSONObject(data)) {
|
|
70
|
+
throw new TypeError(`Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
id: data.id,
|
|
75
|
+
ips: data.ips,
|
|
76
|
+
port: data.port,
|
|
77
|
+
privateNetwork: data.private_network ? unmarshalPrivateNetwork(data.private_network) : undefined,
|
|
78
|
+
publicNetwork: data.public_network ? unmarshalPublicNetwork(data.public_network) : undefined
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const unmarshalCluster = data => {
|
|
82
|
+
if (!isJSONObject(data)) {
|
|
83
|
+
throw new TypeError(`Unmarshalling the type 'Cluster' failed as data isn't a dictionary.`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule),
|
|
88
|
+
clusterSettings: unmarshalArrayOfObject(data.cluster_settings, unmarshalClusterSetting),
|
|
89
|
+
clusterSize: data.cluster_size,
|
|
90
|
+
createdAt: unmarshalDate(data.created_at),
|
|
91
|
+
endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
|
|
92
|
+
id: data.id,
|
|
93
|
+
name: data.name,
|
|
94
|
+
nodeType: data.node_type,
|
|
95
|
+
projectId: data.project_id,
|
|
96
|
+
status: data.status,
|
|
97
|
+
tags: data.tags,
|
|
98
|
+
tlsEnabled: data.tls_enabled,
|
|
99
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
100
|
+
version: data.version,
|
|
101
|
+
zone: data.zone
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const unmarshalClusterVersion = data => {
|
|
106
|
+
if (!isJSONObject(data)) {
|
|
107
|
+
throw new TypeError(`Unmarshalling the type 'ClusterVersion' failed as data isn't a dictionary.`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
availableSettings: unmarshalArrayOfObject(data.available_settings, unmarshalAvailableClusterSetting),
|
|
112
|
+
endOfLifeAt: unmarshalDate(data.end_of_life_at),
|
|
113
|
+
logoUrl: data.logo_url,
|
|
114
|
+
version: data.version,
|
|
115
|
+
zone: data.zone
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const unmarshalNodeType = data => {
|
|
120
|
+
if (!isJSONObject(data)) {
|
|
121
|
+
throw new TypeError(`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
beta: data.beta,
|
|
126
|
+
description: data.description,
|
|
127
|
+
disabled: data.disabled,
|
|
128
|
+
memory: data.memory,
|
|
129
|
+
name: data.name,
|
|
130
|
+
stockStatus: data.stock_status,
|
|
131
|
+
vcpus: data.vcpus,
|
|
132
|
+
zone: data.zone
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const unmarshalAddAclRulesResponse = data => {
|
|
137
|
+
if (!isJSONObject(data)) {
|
|
138
|
+
throw new TypeError(`Unmarshalling the type 'AddAclRulesResponse' failed as data isn't a dictionary.`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule),
|
|
143
|
+
totalCount: data.total_count
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
const unmarshalAddEndpointsResponse = data => {
|
|
147
|
+
if (!isJSONObject(data)) {
|
|
148
|
+
throw new TypeError(`Unmarshalling the type 'AddEndpointsResponse' failed as data isn't a dictionary.`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
|
|
153
|
+
totalCount: data.total_count
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
const unmarshalClusterMetricsResponse = data => {
|
|
157
|
+
if (!isJSONObject(data)) {
|
|
158
|
+
throw new TypeError(`Unmarshalling the type 'ClusterMetricsResponse' failed as data isn't a dictionary.`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
timeseries: unmarshalArrayOfObject(data.timeseries, unmarshalTimeSeries)
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
const unmarshalClusterSettingsResponse = data => {
|
|
166
|
+
if (!isJSONObject(data)) {
|
|
167
|
+
throw new TypeError(`Unmarshalling the type 'ClusterSettingsResponse' failed as data isn't a dictionary.`);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
settings: unmarshalArrayOfObject(data.settings, unmarshalClusterSetting)
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
const unmarshalListClusterVersionsResponse = data => {
|
|
175
|
+
if (!isJSONObject(data)) {
|
|
176
|
+
throw new TypeError(`Unmarshalling the type 'ListClusterVersionsResponse' failed as data isn't a dictionary.`);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
totalCount: data.total_count,
|
|
181
|
+
versions: unmarshalArrayOfObject(data.versions, unmarshalClusterVersion)
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
const unmarshalListClustersResponse = data => {
|
|
185
|
+
if (!isJSONObject(data)) {
|
|
186
|
+
throw new TypeError(`Unmarshalling the type 'ListClustersResponse' failed as data isn't a dictionary.`);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
clusters: unmarshalArrayOfObject(data.clusters, unmarshalCluster),
|
|
191
|
+
totalCount: data.total_count
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
const unmarshalListNodeTypesResponse = data => {
|
|
195
|
+
if (!isJSONObject(data)) {
|
|
196
|
+
throw new TypeError(`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return {
|
|
200
|
+
nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
|
|
201
|
+
totalCount: data.total_count
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
const unmarshalSetAclRulesResponse = data => {
|
|
205
|
+
if (!isJSONObject(data)) {
|
|
206
|
+
throw new TypeError(`Unmarshalling the type 'SetAclRulesResponse' failed as data isn't a dictionary.`);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return {
|
|
210
|
+
aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule)
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
const unmarshalSetEndpointsResponse = data => {
|
|
214
|
+
if (!isJSONObject(data)) {
|
|
215
|
+
throw new TypeError(`Unmarshalling the type 'SetEndpointsResponse' failed as data isn't a dictionary.`);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return {
|
|
219
|
+
endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint)
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const marshalEndpointSpecPrivateNetworkSpec = (request, defaults) => ({
|
|
224
|
+
id: request.id,
|
|
225
|
+
service_ips: request.serviceIps
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
const marshalEndpointSpecPublicNetworkSpec = (request, defaults) => ({});
|
|
229
|
+
|
|
230
|
+
const marshalACLRuleSpec = (request, defaults) => ({
|
|
231
|
+
description: request.description,
|
|
232
|
+
ip_cidr: request.ipCidr
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
const marshalClusterSetting = (request, defaults) => ({
|
|
236
|
+
name: request.name,
|
|
237
|
+
value: request.value
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
const marshalEndpointSpec = (request, defaults) => ({ ...resolveOneOf([{
|
|
241
|
+
param: 'private_network',
|
|
242
|
+
value: request.privateNetwork ? marshalEndpointSpecPrivateNetworkSpec(request.privateNetwork) : undefined
|
|
243
|
+
}, {
|
|
244
|
+
param: 'public_network',
|
|
245
|
+
value: request.publicNetwork ? marshalEndpointSpecPublicNetworkSpec(request.publicNetwork) : undefined
|
|
246
|
+
}])
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
const marshalAddAclRulesRequest = (request, defaults) => ({
|
|
250
|
+
acl_rules: request.aclRules.map(elt => marshalACLRuleSpec(elt))
|
|
251
|
+
});
|
|
252
|
+
const marshalAddClusterSettingsRequest = (request, defaults) => ({
|
|
253
|
+
settings: request.settings.map(elt => marshalClusterSetting(elt))
|
|
254
|
+
});
|
|
255
|
+
const marshalAddEndpointsRequest = (request, defaults) => ({
|
|
256
|
+
endpoints: request.endpoints.map(elt => marshalEndpointSpec(elt))
|
|
257
|
+
});
|
|
258
|
+
const marshalCreateClusterRequest = (request, defaults) => ({
|
|
259
|
+
acl_rules: request.aclRules ? request.aclRules.map(elt => marshalACLRuleSpec(elt)) : undefined,
|
|
260
|
+
cluster_settings: request.clusterSettings ? request.clusterSettings.map(elt => marshalClusterSetting(elt)) : undefined,
|
|
261
|
+
cluster_size: request.clusterSize,
|
|
262
|
+
endpoints: request.endpoints ? request.endpoints.map(elt => marshalEndpointSpec(elt)) : undefined,
|
|
263
|
+
name: request.name || randomName('ins'),
|
|
264
|
+
node_type: request.nodeType,
|
|
265
|
+
password: request.password,
|
|
266
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
267
|
+
tags: request.tags,
|
|
268
|
+
tls_enabled: request.tlsEnabled,
|
|
269
|
+
user_name: request.userName,
|
|
270
|
+
version: request.version
|
|
271
|
+
});
|
|
272
|
+
const marshalMigrateClusterRequest = (request, defaults) => ({ ...resolveOneOf([{
|
|
273
|
+
param: 'version',
|
|
274
|
+
value: request.version
|
|
275
|
+
}, {
|
|
276
|
+
param: 'node_type',
|
|
277
|
+
value: request.nodeType
|
|
278
|
+
}, {
|
|
279
|
+
param: 'cluster_size',
|
|
280
|
+
value: request.clusterSize
|
|
281
|
+
}])
|
|
282
|
+
});
|
|
283
|
+
const marshalSetAclRulesRequest = (request, defaults) => ({
|
|
284
|
+
acl_rules: request.aclRules.map(elt => marshalACLRuleSpec(elt))
|
|
285
|
+
});
|
|
286
|
+
const marshalSetClusterSettingsRequest = (request, defaults) => ({
|
|
287
|
+
settings: request.settings.map(elt => marshalClusterSetting(elt))
|
|
288
|
+
});
|
|
289
|
+
const marshalSetEndpointsRequest = (request, defaults) => ({
|
|
290
|
+
endpoints: request.endpoints.map(elt => marshalEndpointSpec(elt))
|
|
291
|
+
});
|
|
292
|
+
const marshalUpdateClusterRequest = (request, defaults) => ({
|
|
293
|
+
name: request.name,
|
|
294
|
+
password: request.password,
|
|
295
|
+
tags: request.tags,
|
|
296
|
+
user_name: request.userName
|
|
297
|
+
});
|
|
298
|
+
const marshalUpdateEndpointRequest = (request, defaults) => ({ ...resolveOneOf([{
|
|
299
|
+
param: 'private_network',
|
|
300
|
+
value: request.privateNetwork ? marshalEndpointSpecPrivateNetworkSpec(request.privateNetwork) : undefined
|
|
301
|
+
}, {
|
|
302
|
+
param: 'public_network',
|
|
303
|
+
value: request.publicNetwork ? marshalEndpointSpecPublicNetworkSpec(request.publicNetwork) : undefined
|
|
304
|
+
}])
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
export { marshalAddAclRulesRequest, marshalAddClusterSettingsRequest, marshalAddEndpointsRequest, marshalCreateClusterRequest, marshalMigrateClusterRequest, marshalSetAclRulesRequest, marshalSetClusterSettingsRequest, marshalSetEndpointsRequest, marshalUpdateClusterRequest, marshalUpdateEndpointRequest, unmarshalACLRule, unmarshalAddAclRulesResponse, unmarshalAddEndpointsResponse, unmarshalCluster, unmarshalClusterMetricsResponse, unmarshalClusterSettingsResponse, unmarshalEndpoint, unmarshalListClusterVersionsResponse, unmarshalListClustersResponse, unmarshalListNodeTypesResponse, unmarshalSetAclRulesResponse, unmarshalSetEndpointsResponse };
|