@scaleway/sdk 2.24.0 → 2.25.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.
@@ -0,0 +1,253 @@
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
+ // If you have any remark or suggestion do not hesitate to open an issue.
6
+ const unmarshalContactPointEmail = data => {
7
+ if (!isJSONObject(data)) {
8
+ throw new TypeError(`Unmarshalling the type 'ContactPointEmail' failed as data isn't a dictionary.`);
9
+ }
10
+ return {
11
+ to: data.to
12
+ };
13
+ };
14
+ const unmarshalContactPoint = data => {
15
+ if (!isJSONObject(data)) {
16
+ throw new TypeError(`Unmarshalling the type 'ContactPoint' failed as data isn't a dictionary.`);
17
+ }
18
+ return {
19
+ email: data.email ? unmarshalContactPointEmail(data.email) : undefined,
20
+ region: data.region
21
+ };
22
+ };
23
+ const unmarshalDataSource = data => {
24
+ if (!isJSONObject(data)) {
25
+ throw new TypeError(`Unmarshalling the type 'DataSource' failed as data isn't a dictionary.`);
26
+ }
27
+ return {
28
+ createdAt: unmarshalDate(data.created_at),
29
+ id: data.id,
30
+ name: data.name,
31
+ origin: data.origin,
32
+ projectId: data.project_id,
33
+ region: data.region,
34
+ synchronizedWithGrafana: data.synchronized_with_grafana,
35
+ type: data.type,
36
+ updatedAt: unmarshalDate(data.updated_at),
37
+ url: data.url
38
+ };
39
+ };
40
+ const unmarshalGrafanaProductDashboard = data => {
41
+ if (!isJSONObject(data)) {
42
+ throw new TypeError(`Unmarshalling the type 'GrafanaProductDashboard' failed as data isn't a dictionary.`);
43
+ }
44
+ return {
45
+ name: data.name,
46
+ tags: data.tags,
47
+ title: data.title,
48
+ url: data.url,
49
+ variables: data.variables
50
+ };
51
+ };
52
+ const unmarshalGrafanaUser = data => {
53
+ if (!isJSONObject(data)) {
54
+ throw new TypeError(`Unmarshalling the type 'GrafanaUser' failed as data isn't a dictionary.`);
55
+ }
56
+ return {
57
+ id: data.id,
58
+ login: data.login,
59
+ password: data.password,
60
+ role: data.role
61
+ };
62
+ };
63
+ const unmarshalPlan = data => {
64
+ if (!isJSONObject(data)) {
65
+ throw new TypeError(`Unmarshalling the type 'Plan' failed as data isn't a dictionary.`);
66
+ }
67
+ return {
68
+ logsIngestionPrice: data.logs_ingestion_price,
69
+ monthlyPrice: data.monthly_price,
70
+ name: data.name,
71
+ retentionLogsInterval: data.retention_logs_interval,
72
+ retentionMetricsInterval: data.retention_metrics_interval,
73
+ retentionTracesInterval: data.retention_traces_interval,
74
+ sampleIngestionPrice: data.sample_ingestion_price,
75
+ tracesIngestionPrice: data.traces_ingestion_price
76
+ };
77
+ };
78
+ const unmarshalToken = data => {
79
+ if (!isJSONObject(data)) {
80
+ throw new TypeError(`Unmarshalling the type 'Token' failed as data isn't a dictionary.`);
81
+ }
82
+ return {
83
+ createdAt: unmarshalDate(data.created_at),
84
+ id: data.id,
85
+ name: data.name,
86
+ projectId: data.project_id,
87
+ region: data.region,
88
+ scopes: data.scopes,
89
+ secretKey: data.secret_key,
90
+ updatedAt: unmarshalDate(data.updated_at)
91
+ };
92
+ };
93
+ const unmarshalAlertManager = data => {
94
+ if (!isJSONObject(data)) {
95
+ throw new TypeError(`Unmarshalling the type 'AlertManager' failed as data isn't a dictionary.`);
96
+ }
97
+ return {
98
+ alertManagerEnabled: data.alert_manager_enabled,
99
+ alertManagerUrl: data.alert_manager_url,
100
+ managedAlertsEnabled: data.managed_alerts_enabled,
101
+ region: data.region
102
+ };
103
+ };
104
+ const unmarshalGrafana = data => {
105
+ if (!isJSONObject(data)) {
106
+ throw new TypeError(`Unmarshalling the type 'Grafana' failed as data isn't a dictionary.`);
107
+ }
108
+ return {
109
+ grafanaUrl: data.grafana_url
110
+ };
111
+ };
112
+ const unmarshalListContactPointsResponse = data => {
113
+ if (!isJSONObject(data)) {
114
+ throw new TypeError(`Unmarshalling the type 'ListContactPointsResponse' failed as data isn't a dictionary.`);
115
+ }
116
+ return {
117
+ contactPoints: unmarshalArrayOfObject(data.contact_points, unmarshalContactPoint),
118
+ hasAdditionalContactPoints: data.has_additional_contact_points,
119
+ hasAdditionalReceivers: data.has_additional_receivers,
120
+ totalCount: data.total_count
121
+ };
122
+ };
123
+ const unmarshalListDataSourcesResponse = data => {
124
+ if (!isJSONObject(data)) {
125
+ throw new TypeError(`Unmarshalling the type 'ListDataSourcesResponse' failed as data isn't a dictionary.`);
126
+ }
127
+ return {
128
+ dataSources: unmarshalArrayOfObject(data.data_sources, unmarshalDataSource),
129
+ totalCount: data.total_count
130
+ };
131
+ };
132
+ const unmarshalListGrafanaProductDashboardsResponse = data => {
133
+ if (!isJSONObject(data)) {
134
+ throw new TypeError(`Unmarshalling the type 'ListGrafanaProductDashboardsResponse' failed as data isn't a dictionary.`);
135
+ }
136
+ return {
137
+ dashboards: unmarshalArrayOfObject(data.dashboards, unmarshalGrafanaProductDashboard),
138
+ totalCount: data.total_count
139
+ };
140
+ };
141
+ const unmarshalListGrafanaUsersResponse = data => {
142
+ if (!isJSONObject(data)) {
143
+ throw new TypeError(`Unmarshalling the type 'ListGrafanaUsersResponse' failed as data isn't a dictionary.`);
144
+ }
145
+ return {
146
+ grafanaUsers: unmarshalArrayOfObject(data.grafana_users, unmarshalGrafanaUser),
147
+ totalCount: data.total_count
148
+ };
149
+ };
150
+ const unmarshalListPlansResponse = data => {
151
+ if (!isJSONObject(data)) {
152
+ throw new TypeError(`Unmarshalling the type 'ListPlansResponse' failed as data isn't a dictionary.`);
153
+ }
154
+ return {
155
+ plans: unmarshalArrayOfObject(data.plans, unmarshalPlan),
156
+ totalCount: data.total_count
157
+ };
158
+ };
159
+ const unmarshalListTokensResponse = data => {
160
+ if (!isJSONObject(data)) {
161
+ throw new TypeError(`Unmarshalling the type 'ListTokensResponse' failed as data isn't a dictionary.`);
162
+ }
163
+ return {
164
+ tokens: unmarshalArrayOfObject(data.tokens, unmarshalToken),
165
+ totalCount: data.total_count
166
+ };
167
+ };
168
+ const unmarshalUsage = data => {
169
+ if (!isJSONObject(data)) {
170
+ throw new TypeError(`Unmarshalling the type 'Usage' failed as data isn't a dictionary.`);
171
+ }
172
+ return {
173
+ dataSourceId: data.data_source_id,
174
+ dataSourceOrigin: data.data_source_origin,
175
+ dataSourceType: data.data_source_type,
176
+ interval: data.interval,
177
+ projectId: data.project_id,
178
+ quantityOverInterval: data.quantity_over_interval,
179
+ region: data.region,
180
+ unit: data.unit
181
+ };
182
+ };
183
+ const unmarshalUsageOverview = data => {
184
+ if (!isJSONObject(data)) {
185
+ throw new TypeError(`Unmarshalling the type 'UsageOverview' failed as data isn't a dictionary.`);
186
+ }
187
+ return {
188
+ externalLogsUsage: data.external_logs_usage ? unmarshalUsage(data.external_logs_usage) : undefined,
189
+ externalMetricsUsage: data.external_metrics_usage ? unmarshalUsage(data.external_metrics_usage) : undefined,
190
+ externalTracesUsage: data.external_traces_usage ? unmarshalUsage(data.external_traces_usage) : undefined,
191
+ scalewayLogsUsage: data.scaleway_logs_usage ? unmarshalUsage(data.scaleway_logs_usage) : undefined,
192
+ scalewayMetricsUsage: data.scaleway_metrics_usage ? unmarshalUsage(data.scaleway_metrics_usage) : undefined
193
+ };
194
+ };
195
+ const marshalGlobalApiCreateGrafanaUserRequest = (request, defaults) => ({
196
+ login: request.login,
197
+ project_id: request.projectId ?? defaults.defaultProjectId,
198
+ role: request.role
199
+ });
200
+ const marshalGlobalApiResetGrafanaUserPasswordRequest = (request, defaults) => ({
201
+ project_id: request.projectId ?? defaults.defaultProjectId
202
+ });
203
+ const marshalGlobalApiSelectPlanRequest = (request, defaults) => ({
204
+ plan_name: request.planName,
205
+ project_id: request.projectId ?? defaults.defaultProjectId
206
+ });
207
+ const marshalGlobalApiSyncGrafanaDataSourcesRequest = (request, defaults) => ({
208
+ project_id: request.projectId ?? defaults.defaultProjectId
209
+ });
210
+ const marshalContactPointEmail = (request, defaults) => ({
211
+ to: request.to
212
+ });
213
+ const marshalRegionalApiCreateContactPointRequest = (request, defaults) => ({
214
+ project_id: request.projectId ?? defaults.defaultProjectId,
215
+ ...resolveOneOf([{
216
+ param: 'email',
217
+ value: request.email !== undefined ? marshalContactPointEmail(request.email) : undefined
218
+ }])
219
+ });
220
+ const marshalRegionalApiCreateDataSourceRequest = (request, defaults) => ({
221
+ name: request.name,
222
+ project_id: request.projectId ?? defaults.defaultProjectId,
223
+ type: request.type
224
+ });
225
+ const marshalRegionalApiCreateTokenRequest = (request, defaults) => ({
226
+ name: request.name,
227
+ project_id: request.projectId ?? defaults.defaultProjectId,
228
+ token_scopes: request.tokenScopes !== undefined ? request.tokenScopes : undefined
229
+ });
230
+ const marshalRegionalApiDeleteContactPointRequest = (request, defaults) => ({
231
+ project_id: request.projectId ?? defaults.defaultProjectId,
232
+ ...resolveOneOf([{
233
+ param: 'email',
234
+ value: request.email !== undefined ? marshalContactPointEmail(request.email) : undefined
235
+ }])
236
+ });
237
+ const marshalRegionalApiDisableAlertManagerRequest = (request, defaults) => ({
238
+ project_id: request.projectId ?? defaults.defaultProjectId
239
+ });
240
+ const marshalRegionalApiDisableManagedAlertsRequest = (request, defaults) => ({
241
+ project_id: request.projectId ?? defaults.defaultProjectId
242
+ });
243
+ const marshalRegionalApiEnableAlertManagerRequest = (request, defaults) => ({
244
+ project_id: request.projectId ?? defaults.defaultProjectId
245
+ });
246
+ const marshalRegionalApiEnableManagedAlertsRequest = (request, defaults) => ({
247
+ project_id: request.projectId ?? defaults.defaultProjectId
248
+ });
249
+ const marshalRegionalApiTriggerTestAlertRequest = (request, defaults) => ({
250
+ project_id: request.projectId ?? defaults.defaultProjectId
251
+ });
252
+
253
+ export { marshalGlobalApiCreateGrafanaUserRequest, marshalGlobalApiResetGrafanaUserPasswordRequest, marshalGlobalApiSelectPlanRequest, marshalGlobalApiSyncGrafanaDataSourcesRequest, marshalRegionalApiCreateContactPointRequest, marshalRegionalApiCreateDataSourceRequest, marshalRegionalApiCreateTokenRequest, marshalRegionalApiDeleteContactPointRequest, marshalRegionalApiDisableAlertManagerRequest, marshalRegionalApiDisableManagedAlertsRequest, marshalRegionalApiEnableAlertManagerRequest, marshalRegionalApiEnableManagedAlertsRequest, marshalRegionalApiTriggerTestAlertRequest, unmarshalAlertManager, unmarshalContactPoint, unmarshalDataSource, unmarshalGrafana, unmarshalGrafanaProductDashboard, unmarshalGrafanaUser, unmarshalListContactPointsResponse, unmarshalListDataSourcesResponse, unmarshalListGrafanaProductDashboardsResponse, unmarshalListGrafanaUsersResponse, unmarshalListPlansResponse, unmarshalListTokensResponse, unmarshalPlan, unmarshalToken, unmarshalUsageOverview };
@@ -0,0 +1,46 @@
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
+ const RegionalApiCreateDataSourceRequest = {
5
+ name: {
6
+ maxLength: 50,
7
+ minLength: 3,
8
+ pattern: /^[A-Za-z0-9-_. ]+$/
9
+ }
10
+ };
11
+ const RegionalApiCreateTokenRequest = {
12
+ name: {
13
+ maxLength: 50,
14
+ minLength: 3,
15
+ pattern: /^[A-Za-z0-9-_]+$/
16
+ }
17
+ };
18
+ const RegionalApiListContactPointsRequest = {
19
+ page: {
20
+ greaterThanOrEqual: 1
21
+ },
22
+ pageSize: {
23
+ greaterThanOrEqual: 1,
24
+ lessThanOrEqual: 1000
25
+ }
26
+ };
27
+ const RegionalApiListDataSourcesRequest = {
28
+ page: {
29
+ greaterThanOrEqual: 1
30
+ },
31
+ pageSize: {
32
+ greaterThanOrEqual: 1,
33
+ lessThanOrEqual: 1000
34
+ }
35
+ };
36
+ const RegionalApiListTokensRequest = {
37
+ page: {
38
+ greaterThanOrEqual: 1
39
+ },
40
+ pageSize: {
41
+ greaterThanOrEqual: 1,
42
+ lessThanOrEqual: 1000
43
+ }
44
+ };
45
+
46
+ export { RegionalApiCreateDataSourceRequest, RegionalApiCreateTokenRequest, RegionalApiListContactPointsRequest, RegionalApiListDataSourcesRequest, RegionalApiListTokensRequest };
@@ -53,7 +53,7 @@ class API extends API$1 {
53
53
  pageOfListServers = (request = {}) => this.client.fetch({
54
54
  method: 'GET',
55
55
  path: `/instance/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/servers`,
56
- urlParams: urlParams(['commercial_type', request.commercialType], ['name', request.name], ['order', request.order], ['organization', request.organization], ['page', request.page], ['per_page', request.perPage ?? this.client.settings.defaultPageSize], ['private_ip', request.privateIp], ['private_network', request.privateNetwork], ['private_networks', request.privateNetworks && request.privateNetworks.length > 0 ? request.privateNetworks.join(',') : undefined], ['private_nic_mac_address', request.privateNicMacAddress], ['project', request.project], ['servers', request.servers && request.servers.length > 0 ? request.servers.join(',') : undefined], ['state', request.state], ['tags', request.tags && request.tags.length > 0 ? request.tags.join(',') : undefined], ['without_ip', request.withoutIp])
56
+ urlParams: urlParams(['commercial_type', request.commercialType], ['name', request.name], ['order', request.order], ['organization', request.organization], ['page', request.page], ['per_page', request.perPage ?? this.client.settings.defaultPageSize], ['private_ip', request.privateIp], ['private_network', request.privateNetwork], ['private_networks', request.privateNetworks && request.privateNetworks.length > 0 ? request.privateNetworks.join(',') : undefined], ['private_nic_mac_address', request.privateNicMacAddress], ['project', request.project], ['servers', request.servers && request.servers.length > 0 ? request.servers.join(',') : undefined], ['state', request.state], ['tags', request.tags && request.tags.length > 0 ? request.tags.join(',') : undefined], ['with_ip', request.withIp], ['without_ip', request.withoutIp])
57
57
  }, unmarshalListServersResponse);
58
58
 
59
59
  /**
@@ -130,6 +130,7 @@ const unmarshalCluster = data => {
130
130
  privateNetworkId: data.private_network_id,
131
131
  projectId: data.project_id,
132
132
  region: data.region,
133
+ routedIpEnabled: data.routed_ip_enabled,
133
134
  status: data.status,
134
135
  tags: data.tags,
135
136
  type: data.type,
@@ -23,6 +23,7 @@ const unmarshalEndpointPrivateNetworkDetails = data => {
23
23
  }
24
24
  return {
25
25
  privateNetworkId: data.private_network_id,
26
+ provisioningMode: data.provisioning_mode,
26
27
  serviceIp: data.service_ip,
27
28
  zone: data.zone
28
29
  };