@scaleway/sdk 1.0.0 → 1.1.0
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/account/v2/api.gen.js +29 -0
- package/dist/api/account/v2alpha1/api.gen.js +29 -0
- package/dist/api/applesilicon/v1alpha1/api.gen.js +74 -1
- package/dist/api/baremetal/v1/api.gen.js +202 -2
- package/dist/api/baremetal/v1/api.utils.js +7 -0
- package/dist/api/baremetal/v1/marshalling.gen.js +4 -1
- package/dist/api/cockpit/index.js +2 -0
- package/dist/api/cockpit/v1beta1/api.gen.js +307 -0
- package/dist/api/cockpit/v1beta1/content.gen.js +7 -0
- package/dist/api/cockpit/v1beta1/index.gen.js +4 -0
- package/dist/api/cockpit/v1beta1/marshalling.gen.js +174 -0
- package/dist/api/container/v1beta1/api.gen.js +189 -2
- package/dist/api/domain/v2beta1/api.gen.js +395 -8
- package/dist/api/domain/v2beta1/marshalling.gen.js +2 -2
- package/dist/api/flexibleip/v1alpha1/api.gen.js +68 -1
- package/dist/api/function/v1beta1/api.gen.js +214 -2
- package/dist/api/function/v1beta1/marshalling.gen.js +12 -0
- package/dist/api/iam/v1alpha1/api.gen.js +200 -2
- package/dist/api/instance/v1/api.gen.js +351 -11
- package/dist/api/instance/v1/api.utils.js +101 -0
- package/dist/api/instance/v1/marshalling.gen.js +12 -5
- package/dist/api/iot/v1/api.gen.js +230 -1
- package/dist/api/k8s/v1/api.gen.js +189 -1
- package/dist/api/lb/v1/api.gen.js +652 -6
- package/dist/api/lb/v1/api.utils.js +29 -0
- package/dist/api/marketplace/v1/api.gen.js +12 -0
- package/dist/api/marketplace/v2/api.gen.js +18 -0
- package/dist/api/mnq/v1alpha1/api.gen.js +60 -1
- package/dist/api/rdb/v1/api.gen.js +370 -3
- package/dist/api/rdb/v1/marshalling.gen.js +1 -0
- package/dist/api/redis/v1/api.gen.js +144 -1
- package/dist/api/registry/v1/api.gen.js +96 -2
- package/dist/api/secret/v1alpha1/api.gen.js +134 -44
- package/dist/api/tem/v1alpha1/api.gen.js +79 -3
- package/dist/api/test/v1/api.gen.js +61 -1
- package/dist/api/vpc/v1/api.gen.js +31 -1
- package/dist/api/vpcgw/v1/api.gen.js +227 -3
- package/dist/index.cjs +646 -156
- package/dist/index.d.ts +830 -298
- package/dist/index.js +40 -38
- package/dist/scw/constants.js +1 -1
- package/dist/scw/fetch/build-fetcher.js +1 -1
- package/package.json +2 -2
|
@@ -164,10 +164,13 @@ const unmarshalOffer = data => {
|
|
|
164
164
|
persistentMemories: unmarshalArrayOfObject(data.persistent_memories, unmarshalPersistentMemory),
|
|
165
165
|
pricePerHour: data.price_per_hour ? unmarshalMoney(data.price_per_hour) : undefined,
|
|
166
166
|
pricePerMonth: data.price_per_month ? unmarshalMoney(data.price_per_month) : undefined,
|
|
167
|
+
privateBandwidth: data.private_bandwidth,
|
|
167
168
|
quotaName: data.quota_name,
|
|
168
169
|
raidControllers: unmarshalArrayOfObject(data.raid_controllers, unmarshalRaidController),
|
|
170
|
+
sharedBandwidth: data.shared_bandwidth,
|
|
169
171
|
stock: data.stock,
|
|
170
|
-
subscriptionPeriod: data.subscription_period
|
|
172
|
+
subscriptionPeriod: data.subscription_period,
|
|
173
|
+
tags: data.tags
|
|
171
174
|
};
|
|
172
175
|
};
|
|
173
176
|
const unmarshalOption = data => {
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { waitForResource } from '../../../internal/async/interval-retrier.js';
|
|
2
|
+
import { API as API$1 } from '../../../scw/api.js';
|
|
3
|
+
import { urlParams, validatePathParam } from '../../../helpers/marshalling.js';
|
|
4
|
+
import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
|
|
5
|
+
import { COCKPIT_TRANSIENT_STATUSES } from './content.gen.js';
|
|
6
|
+
import { marshalActivateCockpitRequest, unmarshalCockpit, marshalDeactivateCockpitRequest, marshalResetCockpitGrafanaRequest, marshalCreateTokenRequest, unmarshalToken, unmarshalListTokensResponse, marshalCreateContactPointRequest, unmarshalContactPoint, unmarshalListContactPointsResponse, marshalDeleteContactPointRequest, marshalEnableManagedAlertsRequest, marshalDisableManagedAlertsRequest, marshalTriggerTestAlertRequest, marshalCreateGrafanaUserRequest, unmarshalGrafanaUser, unmarshalListGrafanaUsersResponse, marshalDeleteGrafanaUserRequest, marshalResetGrafanaUserPasswordRequest } 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
|
+
/**
|
|
14
|
+
* Cockpit API.
|
|
15
|
+
*
|
|
16
|
+
* This API allows to manage Cockpits.
|
|
17
|
+
*/
|
|
18
|
+
class API extends API$1 {
|
|
19
|
+
constructor() {
|
|
20
|
+
var _this;
|
|
21
|
+
super(...arguments);
|
|
22
|
+
_this = this;
|
|
23
|
+
this.activateCockpit = function (request) {
|
|
24
|
+
if (request === void 0) {
|
|
25
|
+
request = {};
|
|
26
|
+
}
|
|
27
|
+
return _this.client.fetch({
|
|
28
|
+
body: JSON.stringify(marshalActivateCockpitRequest(request, _this.client.settings)),
|
|
29
|
+
headers: jsonContentHeaders,
|
|
30
|
+
method: 'POST',
|
|
31
|
+
path: `/cockpit/v1beta1/activate`
|
|
32
|
+
}, unmarshalCockpit);
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Get the cockpit associated with the given project ID.
|
|
36
|
+
*
|
|
37
|
+
* @param request - The request {@link GetCockpitRequest}
|
|
38
|
+
* @returns A Promise of Cockpit
|
|
39
|
+
*/
|
|
40
|
+
this.getCockpit = function (request) {
|
|
41
|
+
if (request === void 0) {
|
|
42
|
+
request = {};
|
|
43
|
+
}
|
|
44
|
+
return _this.client.fetch({
|
|
45
|
+
method: 'GET',
|
|
46
|
+
path: `/cockpit/v1beta1/cockpit`,
|
|
47
|
+
urlParams: urlParams(['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
|
|
48
|
+
}, unmarshalCockpit);
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Waits for {@link Cockpit} to be in a final state.
|
|
52
|
+
*
|
|
53
|
+
* @param request - The request {@link GetCockpitRequest}
|
|
54
|
+
* @param options - The waiting options
|
|
55
|
+
* @returns A Promise of Cockpit
|
|
56
|
+
*/
|
|
57
|
+
this.waitForCockpit = function (request, options) {
|
|
58
|
+
if (request === void 0) {
|
|
59
|
+
request = {};
|
|
60
|
+
}
|
|
61
|
+
return waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!COCKPIT_TRANSIENT_STATUSES.includes(res.status))), _this.getCockpit, request, options);
|
|
62
|
+
};
|
|
63
|
+
this.deactivateCockpit = function (request) {
|
|
64
|
+
if (request === void 0) {
|
|
65
|
+
request = {};
|
|
66
|
+
}
|
|
67
|
+
return _this.client.fetch({
|
|
68
|
+
body: JSON.stringify(marshalDeactivateCockpitRequest(request, _this.client.settings)),
|
|
69
|
+
headers: jsonContentHeaders,
|
|
70
|
+
method: 'POST',
|
|
71
|
+
path: `/cockpit/v1beta1/deactivate`
|
|
72
|
+
}, unmarshalCockpit);
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Reset the Grafana your cockpit associated with the given project ID.
|
|
76
|
+
*
|
|
77
|
+
* @param request - The request {@link ResetCockpitGrafanaRequest}
|
|
78
|
+
* @returns A Promise of Cockpit
|
|
79
|
+
*/
|
|
80
|
+
this.resetCockpitGrafana = function (request) {
|
|
81
|
+
if (request === void 0) {
|
|
82
|
+
request = {};
|
|
83
|
+
}
|
|
84
|
+
return _this.client.fetch({
|
|
85
|
+
body: JSON.stringify(marshalResetCockpitGrafanaRequest(request, _this.client.settings)),
|
|
86
|
+
headers: jsonContentHeaders,
|
|
87
|
+
method: 'POST',
|
|
88
|
+
path: `/cockpit/v1beta1/reset-grafana`
|
|
89
|
+
}, unmarshalCockpit);
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Create token associated with the given project ID.
|
|
93
|
+
*
|
|
94
|
+
* @param request - The request {@link CreateTokenRequest}
|
|
95
|
+
* @returns A Promise of Token
|
|
96
|
+
*/
|
|
97
|
+
this.createToken = request => this.client.fetch({
|
|
98
|
+
body: JSON.stringify(marshalCreateTokenRequest(request, this.client.settings)),
|
|
99
|
+
headers: jsonContentHeaders,
|
|
100
|
+
method: 'POST',
|
|
101
|
+
path: `/cockpit/v1beta1/tokens`
|
|
102
|
+
}, unmarshalToken);
|
|
103
|
+
this.pageOfListTokens = function (request) {
|
|
104
|
+
if (request === void 0) {
|
|
105
|
+
request = {};
|
|
106
|
+
}
|
|
107
|
+
return _this.client.fetch({
|
|
108
|
+
method: 'GET',
|
|
109
|
+
path: `/cockpit/v1beta1/tokens`,
|
|
110
|
+
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])
|
|
111
|
+
}, unmarshalListTokensResponse);
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* List tokens associated with the given project ID.
|
|
115
|
+
*
|
|
116
|
+
* @param request - The request {@link ListTokensRequest}
|
|
117
|
+
* @returns A Promise of ListTokensResponse
|
|
118
|
+
*/
|
|
119
|
+
this.listTokens = function (request) {
|
|
120
|
+
if (request === void 0) {
|
|
121
|
+
request = {};
|
|
122
|
+
}
|
|
123
|
+
return enrichForPagination('tokens', _this.pageOfListTokens, request);
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Get the token associated with the given ID.
|
|
127
|
+
*
|
|
128
|
+
* @param request - The request {@link GetTokenRequest}
|
|
129
|
+
* @returns A Promise of Token
|
|
130
|
+
*/
|
|
131
|
+
this.getToken = request => this.client.fetch({
|
|
132
|
+
method: 'GET',
|
|
133
|
+
path: `/cockpit/v1beta1/tokens/${validatePathParam('tokenId', request.tokenId)}`
|
|
134
|
+
}, unmarshalToken);
|
|
135
|
+
/**
|
|
136
|
+
* Delete the token associated with the given ID.
|
|
137
|
+
*
|
|
138
|
+
* @param request - The request {@link DeleteTokenRequest}
|
|
139
|
+
*/
|
|
140
|
+
this.deleteToken = request => this.client.fetch({
|
|
141
|
+
method: 'DELETE',
|
|
142
|
+
path: `/cockpit/v1beta1/tokens/${validatePathParam('tokenId', request.tokenId)}`
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* Create an alert contact point for the default receiver.
|
|
146
|
+
*
|
|
147
|
+
* @param request - The request {@link CreateContactPointRequest}
|
|
148
|
+
* @returns A Promise of ContactPoint
|
|
149
|
+
*/
|
|
150
|
+
this.createContactPoint = function (request) {
|
|
151
|
+
if (request === void 0) {
|
|
152
|
+
request = {};
|
|
153
|
+
}
|
|
154
|
+
return _this.client.fetch({
|
|
155
|
+
body: JSON.stringify(marshalCreateContactPointRequest(request, _this.client.settings)),
|
|
156
|
+
headers: jsonContentHeaders,
|
|
157
|
+
method: 'POST',
|
|
158
|
+
path: `/cockpit/v1beta1/contact-points`
|
|
159
|
+
}, unmarshalContactPoint);
|
|
160
|
+
};
|
|
161
|
+
this.pageOfListContactPoints = function (request) {
|
|
162
|
+
if (request === void 0) {
|
|
163
|
+
request = {};
|
|
164
|
+
}
|
|
165
|
+
return _this.client.fetch({
|
|
166
|
+
method: 'GET',
|
|
167
|
+
path: `/cockpit/v1beta1/contact-points`,
|
|
168
|
+
urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
|
|
169
|
+
}, unmarshalListContactPointsResponse);
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* List alert contact points associated with the given cockpit ID.
|
|
173
|
+
*
|
|
174
|
+
* @param request - The request {@link ListContactPointsRequest}
|
|
175
|
+
* @returns A Promise of ListContactPointsResponse
|
|
176
|
+
*/
|
|
177
|
+
this.listContactPoints = function (request) {
|
|
178
|
+
if (request === void 0) {
|
|
179
|
+
request = {};
|
|
180
|
+
}
|
|
181
|
+
return enrichForPagination('contactPoints', _this.pageOfListContactPoints, request);
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Delete an alert contact point for the default receiver.
|
|
185
|
+
*
|
|
186
|
+
* @param request - The request {@link DeleteContactPointRequest}
|
|
187
|
+
*/
|
|
188
|
+
this.deleteContactPoint = function (request) {
|
|
189
|
+
if (request === void 0) {
|
|
190
|
+
request = {};
|
|
191
|
+
}
|
|
192
|
+
return _this.client.fetch({
|
|
193
|
+
body: JSON.stringify(marshalDeleteContactPointRequest(request, _this.client.settings)),
|
|
194
|
+
headers: jsonContentHeaders,
|
|
195
|
+
method: 'POST',
|
|
196
|
+
path: `/cockpit/v1beta1/delete-contact-point`
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Enable managed alerts.
|
|
201
|
+
*
|
|
202
|
+
* @param request - The request {@link EnableManagedAlertsRequest}
|
|
203
|
+
*/
|
|
204
|
+
this.enableManagedAlerts = function (request) {
|
|
205
|
+
if (request === void 0) {
|
|
206
|
+
request = {};
|
|
207
|
+
}
|
|
208
|
+
return _this.client.fetch({
|
|
209
|
+
body: JSON.stringify(marshalEnableManagedAlertsRequest(request, _this.client.settings)),
|
|
210
|
+
headers: jsonContentHeaders,
|
|
211
|
+
method: 'POST',
|
|
212
|
+
path: `/cockpit/v1beta1/enable-managed-alerts`
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Disable managed alerts.
|
|
217
|
+
*
|
|
218
|
+
* @param request - The request {@link DisableManagedAlertsRequest}
|
|
219
|
+
*/
|
|
220
|
+
this.disableManagedAlerts = function (request) {
|
|
221
|
+
if (request === void 0) {
|
|
222
|
+
request = {};
|
|
223
|
+
}
|
|
224
|
+
return _this.client.fetch({
|
|
225
|
+
body: JSON.stringify(marshalDisableManagedAlertsRequest(request, _this.client.settings)),
|
|
226
|
+
headers: jsonContentHeaders,
|
|
227
|
+
method: 'POST',
|
|
228
|
+
path: `/cockpit/v1beta1/disable-managed-alerts`
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Trigger a test alert to all receivers.
|
|
233
|
+
*
|
|
234
|
+
* @param request - The request {@link TriggerTestAlertRequest}
|
|
235
|
+
*/
|
|
236
|
+
this.triggerTestAlert = function (request) {
|
|
237
|
+
if (request === void 0) {
|
|
238
|
+
request = {};
|
|
239
|
+
}
|
|
240
|
+
return _this.client.fetch({
|
|
241
|
+
body: JSON.stringify(marshalTriggerTestAlertRequest(request, _this.client.settings)),
|
|
242
|
+
headers: jsonContentHeaders,
|
|
243
|
+
method: 'POST',
|
|
244
|
+
path: `/cockpit/v1beta1/trigger-test-alert`
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Create a grafana user for your grafana instance.
|
|
249
|
+
*
|
|
250
|
+
* @param request - The request {@link CreateGrafanaUserRequest}
|
|
251
|
+
* @returns A Promise of GrafanaUser
|
|
252
|
+
*/
|
|
253
|
+
this.createGrafanaUser = request => this.client.fetch({
|
|
254
|
+
body: JSON.stringify(marshalCreateGrafanaUserRequest(request, this.client.settings)),
|
|
255
|
+
headers: jsonContentHeaders,
|
|
256
|
+
method: 'POST',
|
|
257
|
+
path: `/cockpit/v1beta1/grafana-users`
|
|
258
|
+
}, unmarshalGrafanaUser);
|
|
259
|
+
this.pageOfListGrafanaUsers = function (request) {
|
|
260
|
+
if (request === void 0) {
|
|
261
|
+
request = {};
|
|
262
|
+
}
|
|
263
|
+
return _this.client.fetch({
|
|
264
|
+
method: 'GET',
|
|
265
|
+
path: `/cockpit/v1beta1/grafana-users`,
|
|
266
|
+
urlParams: urlParams(['order_by', request.orderBy ?? 'login_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
|
|
267
|
+
}, unmarshalListGrafanaUsersResponse);
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* List grafana users who are able to connect to your grafana instance.
|
|
271
|
+
*
|
|
272
|
+
* @param request - The request {@link ListGrafanaUsersRequest}
|
|
273
|
+
* @returns A Promise of ListGrafanaUsersResponse
|
|
274
|
+
*/
|
|
275
|
+
this.listGrafanaUsers = function (request) {
|
|
276
|
+
if (request === void 0) {
|
|
277
|
+
request = {};
|
|
278
|
+
}
|
|
279
|
+
return enrichForPagination('grafanaUsers', _this.pageOfListGrafanaUsers, request);
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Delete a grafana user from your grafana instance.
|
|
283
|
+
*
|
|
284
|
+
* @param request - The request {@link DeleteGrafanaUserRequest}
|
|
285
|
+
*/
|
|
286
|
+
this.deleteGrafanaUser = request => this.client.fetch({
|
|
287
|
+
body: JSON.stringify(marshalDeleteGrafanaUserRequest(request, this.client.settings)),
|
|
288
|
+
headers: jsonContentHeaders,
|
|
289
|
+
method: 'POST',
|
|
290
|
+
path: `/cockpit/v1beta1/grafana-users/${validatePathParam('grafanaUserId', request.grafanaUserId)}/delete`
|
|
291
|
+
});
|
|
292
|
+
/**
|
|
293
|
+
* Reset the Grafana user password from your grafana instance.
|
|
294
|
+
*
|
|
295
|
+
* @param request - The request {@link ResetGrafanaUserPasswordRequest}
|
|
296
|
+
* @returns A Promise of GrafanaUser
|
|
297
|
+
*/
|
|
298
|
+
this.resetGrafanaUserPassword = request => this.client.fetch({
|
|
299
|
+
body: JSON.stringify(marshalResetGrafanaUserPasswordRequest(request, this.client.settings)),
|
|
300
|
+
headers: jsonContentHeaders,
|
|
301
|
+
method: 'POST',
|
|
302
|
+
path: `/cockpit/v1beta1/grafana-users/${validatePathParam('grafanaUserId', request.grafanaUserId)}/reset-password`
|
|
303
|
+
}, unmarshalGrafanaUser);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export { API };
|
|
@@ -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 CockpitStatus}. */
|
|
5
|
+
const COCKPIT_TRANSIENT_STATUSES = ['creating', 'deleting', 'updating'];
|
|
6
|
+
|
|
7
|
+
export { COCKPIT_TRANSIENT_STATUSES };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { isJSONObject } from '../../../helpers/json.js';
|
|
2
|
+
import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
|
|
3
|
+
|
|
4
|
+
// This file was automatically generated. DO NOT EDIT.
|
|
5
|
+
const unmarshalContactPointEmail = data => {
|
|
6
|
+
if (!isJSONObject(data)) {
|
|
7
|
+
throw new TypeError(`Unmarshalling the type 'ContactPointEmail' failed as data isn't a dictionary.`);
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
to: data.to
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const unmarshalTokenScopes = data => {
|
|
14
|
+
if (!isJSONObject(data)) {
|
|
15
|
+
throw new TypeError(`Unmarshalling the type 'TokenScopes' failed as data isn't a dictionary.`);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
queryLogs: data.query_logs,
|
|
19
|
+
queryMetrics: data.query_metrics,
|
|
20
|
+
setupAlerts: data.setup_alerts,
|
|
21
|
+
setupLogsRules: data.setup_logs_rules,
|
|
22
|
+
setupMetricsRules: data.setup_metrics_rules,
|
|
23
|
+
writeLogs: data.write_logs,
|
|
24
|
+
writeMetrics: data.write_metrics
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
const unmarshalCockpitEndpoints = data => {
|
|
28
|
+
if (!isJSONObject(data)) {
|
|
29
|
+
throw new TypeError(`Unmarshalling the type 'CockpitEndpoints' failed as data isn't a dictionary.`);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
alertmanagerUrl: data.alertmanager_url,
|
|
33
|
+
grafanaUrl: data.grafana_url,
|
|
34
|
+
logsUrl: data.logs_url,
|
|
35
|
+
metricsUrl: data.metrics_url
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const unmarshalContactPoint = data => {
|
|
39
|
+
if (!isJSONObject(data)) {
|
|
40
|
+
throw new TypeError(`Unmarshalling the type 'ContactPoint' failed as data isn't a dictionary.`);
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
email: data.email ? unmarshalContactPointEmail(data.email) : undefined
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const unmarshalGrafanaUser = data => {
|
|
47
|
+
if (!isJSONObject(data)) {
|
|
48
|
+
throw new TypeError(`Unmarshalling the type 'GrafanaUser' failed as data isn't a dictionary.`);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
id: data.id,
|
|
52
|
+
login: data.login,
|
|
53
|
+
password: data.password,
|
|
54
|
+
role: data.role
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const unmarshalToken = data => {
|
|
58
|
+
if (!isJSONObject(data)) {
|
|
59
|
+
throw new TypeError(`Unmarshalling the type 'Token' failed as data isn't a dictionary.`);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
createdAt: unmarshalDate(data.created_at),
|
|
63
|
+
id: data.id,
|
|
64
|
+
name: data.name,
|
|
65
|
+
projectId: data.project_id,
|
|
66
|
+
scopes: data.scopes ? unmarshalTokenScopes(data.scopes) : undefined,
|
|
67
|
+
secretKey: data.secret_key,
|
|
68
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const unmarshalCockpit = data => {
|
|
72
|
+
if (!isJSONObject(data)) {
|
|
73
|
+
throw new TypeError(`Unmarshalling the type 'Cockpit' failed as data isn't a dictionary.`);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
createdAt: unmarshalDate(data.created_at),
|
|
77
|
+
endpoints: data.endpoints ? unmarshalCockpitEndpoints(data.endpoints) : undefined,
|
|
78
|
+
managedAlertsEnabled: data.managed_alerts_enabled,
|
|
79
|
+
projectId: data.project_id,
|
|
80
|
+
status: data.status,
|
|
81
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const unmarshalListContactPointsResponse = data => {
|
|
85
|
+
if (!isJSONObject(data)) {
|
|
86
|
+
throw new TypeError(`Unmarshalling the type 'ListContactPointsResponse' failed as data isn't a dictionary.`);
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
contactPoints: unmarshalArrayOfObject(data.contact_points, unmarshalContactPoint),
|
|
90
|
+
hasAdditionalContactPoints: data.has_additional_contact_points,
|
|
91
|
+
hasAdditionalReceivers: data.has_additional_receivers,
|
|
92
|
+
totalCount: data.total_count
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
const unmarshalListGrafanaUsersResponse = data => {
|
|
96
|
+
if (!isJSONObject(data)) {
|
|
97
|
+
throw new TypeError(`Unmarshalling the type 'ListGrafanaUsersResponse' failed as data isn't a dictionary.`);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
grafanaUsers: unmarshalArrayOfObject(data.grafana_users, unmarshalGrafanaUser),
|
|
101
|
+
totalCount: data.total_count
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const unmarshalListTokensResponse = data => {
|
|
105
|
+
if (!isJSONObject(data)) {
|
|
106
|
+
throw new TypeError(`Unmarshalling the type 'ListTokensResponse' failed as data isn't a dictionary.`);
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
tokens: unmarshalArrayOfObject(data.tokens, unmarshalToken),
|
|
110
|
+
totalCount: data.total_count
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const marshalContactPointEmail = (request, defaults) => ({
|
|
114
|
+
to: request.to
|
|
115
|
+
});
|
|
116
|
+
const marshalContactPoint = (request, defaults) => ({
|
|
117
|
+
...resolveOneOf([{
|
|
118
|
+
param: 'email',
|
|
119
|
+
value: request.email ? marshalContactPointEmail(request.email) : undefined
|
|
120
|
+
}])
|
|
121
|
+
});
|
|
122
|
+
const marshalTokenScopes = (request, defaults) => ({
|
|
123
|
+
query_logs: request.queryLogs,
|
|
124
|
+
query_metrics: request.queryMetrics,
|
|
125
|
+
setup_alerts: request.setupAlerts,
|
|
126
|
+
setup_logs_rules: request.setupLogsRules,
|
|
127
|
+
setup_metrics_rules: request.setupMetricsRules,
|
|
128
|
+
write_logs: request.writeLogs,
|
|
129
|
+
write_metrics: request.writeMetrics
|
|
130
|
+
});
|
|
131
|
+
const marshalActivateCockpitRequest = (request, defaults) => ({
|
|
132
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
133
|
+
});
|
|
134
|
+
const marshalCreateContactPointRequest = (request, defaults) => ({
|
|
135
|
+
contact_point: request.contactPoint ? marshalContactPoint(request.contactPoint) : undefined,
|
|
136
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
137
|
+
});
|
|
138
|
+
const marshalCreateGrafanaUserRequest = (request, defaults) => ({
|
|
139
|
+
login: request.login,
|
|
140
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
141
|
+
role: request.role ?? 'unknown_role'
|
|
142
|
+
});
|
|
143
|
+
const marshalCreateTokenRequest = (request, defaults) => ({
|
|
144
|
+
name: request.name,
|
|
145
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
146
|
+
scopes: request.scopes ? marshalTokenScopes(request.scopes) : undefined
|
|
147
|
+
});
|
|
148
|
+
const marshalDeactivateCockpitRequest = (request, defaults) => ({
|
|
149
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
150
|
+
});
|
|
151
|
+
const marshalDeleteContactPointRequest = (request, defaults) => ({
|
|
152
|
+
contact_point: request.contactPoint ? marshalContactPoint(request.contactPoint) : undefined,
|
|
153
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
154
|
+
});
|
|
155
|
+
const marshalDeleteGrafanaUserRequest = (request, defaults) => ({
|
|
156
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
157
|
+
});
|
|
158
|
+
const marshalDisableManagedAlertsRequest = (request, defaults) => ({
|
|
159
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
160
|
+
});
|
|
161
|
+
const marshalEnableManagedAlertsRequest = (request, defaults) => ({
|
|
162
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
163
|
+
});
|
|
164
|
+
const marshalResetCockpitGrafanaRequest = (request, defaults) => ({
|
|
165
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
166
|
+
});
|
|
167
|
+
const marshalResetGrafanaUserPasswordRequest = (request, defaults) => ({
|
|
168
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
169
|
+
});
|
|
170
|
+
const marshalTriggerTestAlertRequest = (request, defaults) => ({
|
|
171
|
+
project_id: request.projectId ?? defaults.defaultProjectId
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
export { marshalActivateCockpitRequest, marshalCreateContactPointRequest, marshalCreateGrafanaUserRequest, marshalCreateTokenRequest, marshalDeactivateCockpitRequest, marshalDeleteContactPointRequest, marshalDeleteGrafanaUserRequest, marshalDisableManagedAlertsRequest, marshalEnableManagedAlertsRequest, marshalResetCockpitGrafanaRequest, marshalResetGrafanaUserPasswordRequest, marshalTriggerTestAlertRequest, unmarshalCockpit, unmarshalContactPoint, unmarshalGrafanaUser, unmarshalListContactPointsResponse, unmarshalListGrafanaUsersResponse, unmarshalListTokensResponse, unmarshalToken };
|