@scaleway/sdk 2.11.0 → 2.12.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.
@@ -1,7 +1,7 @@
1
1
  import { API as API$1 } from '../../../scw/api.js';
2
2
  import { urlParams, resolveOneOf, validatePathParam } from '../../../helpers/marshalling.js';
3
3
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
- import { unmarshalListConsumptionsResponse, unmarshalListTaxesResponse, unmarshalListInvoicesResponse, unmarshalInvoice } from './marshalling.gen.js';
4
+ import { unmarshalListConsumptionsResponse, unmarshalListTaxesResponse, unmarshalListInvoicesResponse, unmarshalInvoice, unmarshalListDiscountsResponse } from './marshalling.gen.js';
5
5
 
6
6
  // This file was automatically generated. DO NOT EDIT.
7
7
  // If you have any remark or suggestion do not hesitate to open an issue.
@@ -98,6 +98,12 @@ class API extends API$1 {
98
98
  urlParams: urlParams(['dl', 1], ['file_type', request.fileType]),
99
99
  responseType: 'blob'
100
100
  });
101
+ pageOfListDiscounts = (request = {}) => this.client.fetch({
102
+ method: 'GET',
103
+ path: `/billing/v2beta1/discounts`,
104
+ urlParams: urlParams(['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
105
+ }, unmarshalListDiscountsResponse);
106
+ listDiscounts = (request = {}) => enrichForPagination('discounts', this.pageOfListDiscounts, request);
101
107
  }
102
108
 
103
109
  export { API };
@@ -10,7 +10,6 @@ const unmarshalInvoice = data => {
10
10
  }
11
11
  return {
12
12
  billingPeriod: unmarshalDate(data.billing_period),
13
- customerName: data.customer_name,
14
13
  dueDate: unmarshalDate(data.due_date),
15
14
  id: data.id,
16
15
  issuedDate: unmarshalDate(data.issued_date),
@@ -34,11 +33,13 @@ const unmarshalListConsumptionsResponseConsumption = data => {
34
33
  throw new TypeError(`Unmarshalling the type 'ListConsumptionsResponseConsumption' failed as data isn't a dictionary.`);
35
34
  }
36
35
  return {
36
+ billedQuantity: data.billed_quantity,
37
37
  categoryName: data.category_name,
38
38
  productName: data.product_name,
39
39
  projectId: data.project_id,
40
40
  resourceName: data.resource_name,
41
41
  sku: data.sku,
42
+ unit: data.unit,
42
43
  value: data.value ? unmarshalMoney(data.value) : undefined
43
44
  };
44
45
  };
@@ -53,6 +54,51 @@ const unmarshalListConsumptionsResponse = data => {
53
54
  updatedAt: unmarshalDate(data.updated_at)
54
55
  };
55
56
  };
57
+ const unmarshalDiscountCoupon = data => {
58
+ if (!isJSONObject(data)) {
59
+ throw new TypeError(`Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary.`);
60
+ }
61
+ return {
62
+ description: data.description
63
+ };
64
+ };
65
+ const unmarshalDiscountFilter = data => {
66
+ if (!isJSONObject(data)) {
67
+ throw new TypeError(`Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary.`);
68
+ }
69
+ return {
70
+ type: data.type,
71
+ value: data.value
72
+ };
73
+ };
74
+ const unmarshalDiscount = data => {
75
+ if (!isJSONObject(data)) {
76
+ throw new TypeError(`Unmarshalling the type 'Discount' failed as data isn't a dictionary.`);
77
+ }
78
+ return {
79
+ coupon: data.coupon ? unmarshalDiscountCoupon(data.coupon) : undefined,
80
+ creationDate: unmarshalDate(data.creation_date),
81
+ description: data.description,
82
+ filters: unmarshalArrayOfObject(data.filters, unmarshalDiscountFilter),
83
+ id: data.id,
84
+ mode: data.mode,
85
+ organizationId: data.organization_id,
86
+ startDate: unmarshalDate(data.start_date),
87
+ stopDate: unmarshalDate(data.stop_date),
88
+ value: data.value,
89
+ valueRemaining: data.value_remaining,
90
+ valueUsed: data.value_used
91
+ };
92
+ };
93
+ const unmarshalListDiscountsResponse = data => {
94
+ if (!isJSONObject(data)) {
95
+ throw new TypeError(`Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`);
96
+ }
97
+ return {
98
+ discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount),
99
+ totalCount: data.total_count
100
+ };
101
+ };
56
102
  const unmarshalListInvoicesResponse = data => {
57
103
  if (!isJSONObject(data)) {
58
104
  throw new TypeError(`Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`);
@@ -84,4 +130,4 @@ const unmarshalListTaxesResponse = data => {
84
130
  };
85
131
  };
86
132
 
87
- export { unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
133
+ export { unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
@@ -14,13 +14,13 @@ const jsonContentHeaders = {
14
14
  /**
15
15
  * Cockpit API.
16
16
  *
17
- * Cockpit's API allows you to activate your Cockpit on your Projects.
18
- * Scaleway's Cockpit stores metrics and logs and provides a dedicated Grafana
19
- * for dashboarding to visualize them.
17
+ * The Cockpit API allows you to activate your Cockpit to store metrics and
18
+ * logs. It also provides you with a dedicated Grafana for dashboarding to
19
+ * visualize your metrics and logs.
20
20
  */
21
21
  class API extends API$1 {
22
22
  /**
23
- * Activate the Cockpit of the specified Project ID.
23
+ * Activate the Cockpit of a given Project specified by the Project ID.
24
24
  *
25
25
  * @param request - The request {@link ActivateCockpitRequest}
26
26
  * @returns A Promise of Cockpit
@@ -33,7 +33,7 @@ class API extends API$1 {
33
33
  }, unmarshalCockpit);
34
34
 
35
35
  /**
36
- * Retrieve the Cockpit of the specified Project ID.
36
+ * Retrieve the Cockpit of a given Project specified by the Project ID.
37
37
  *
38
38
  * @param request - The request {@link GetCockpitRequest}
39
39
  * @returns A Promise of Cockpit
@@ -54,7 +54,8 @@ class API extends API$1 {
54
54
  waitForCockpit = (request = {}, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!COCKPIT_TRANSIENT_STATUSES.includes(res.status))), this.getCockpit, request, options);
55
55
 
56
56
  /**
57
- * Get metrics from your Cockpit with the specified Project ID.
57
+ * Retrieve metrics from your Cockpit specified by the ID of the Project the
58
+ * Cockpit belongs to.
58
59
  *
59
60
  * @param request - The request {@link GetCockpitMetricsRequest}
60
61
  * @returns A Promise of CockpitMetrics
@@ -66,7 +67,7 @@ class API extends API$1 {
66
67
  }, unmarshalCockpitMetrics);
67
68
 
68
69
  /**
69
- * Deactivate the Cockpit of the specified Project ID.
70
+ * Deactivate the Cockpit of a given Project specified by the Project ID.
70
71
  *
71
72
  * @param request - The request {@link DeactivateCockpitRequest}
72
73
  * @returns A Promise of Cockpit
@@ -79,7 +80,8 @@ class API extends API$1 {
79
80
  }, unmarshalCockpit);
80
81
 
81
82
  /**
82
- * Create a datasource for the specified Project ID and the given type.
83
+ * Create a data source for a given Project specified by the Project ID and
84
+ * the data source type.
83
85
  *
84
86
  * @param request - The request {@link CreateDatasourceRequest}
85
87
  * @returns A Promise of Datasource
@@ -92,7 +94,7 @@ class API extends API$1 {
92
94
  }, unmarshalDatasource);
93
95
 
94
96
  /**
95
- * Delete the datasource associated with the specified datasource ID.
97
+ * Delete a given data source specified by the data source ID.
96
98
  *
97
99
  * @param request - The request {@link DeleteDatasourceRequest}
98
100
  */
@@ -107,7 +109,7 @@ class API extends API$1 {
107
109
  }, unmarshalListDatasourcesResponse);
108
110
 
109
111
  /**
110
- * Get a list of datasources for the specified Project ID.
112
+ * Get a list of data sources for the specified Project ID.
111
113
  *
112
114
  * @param request - The request {@link ListDatasourcesRequest}
113
115
  * @returns A Promise of ListDatasourcesResponse
@@ -115,7 +117,7 @@ class API extends API$1 {
115
117
  listDatasources = (request = {}) => enrichForPagination('datasources', this.pageOfListDatasources, request);
116
118
 
117
119
  /**
118
- * Create a token associated with the specified Project ID.
120
+ * Create a token in a given Project specified by the Project ID.
119
121
  *
120
122
  * @param request - The request {@link CreateTokenRequest}
121
123
  * @returns A Promise of Token
@@ -133,7 +135,7 @@ class API extends API$1 {
133
135
  }, unmarshalListTokensResponse);
134
136
 
135
137
  /**
136
- * Get a list of tokens associated with the specified Project ID.
138
+ * Get a list of tokens in a given Project specified by the Project ID.
137
139
  *
138
140
  * @param request - The request {@link ListTokensRequest}
139
141
  * @returns A Promise of ListTokensResponse
@@ -141,7 +143,7 @@ class API extends API$1 {
141
143
  listTokens = (request = {}) => enrichForPagination('tokens', this.pageOfListTokens, request);
142
144
 
143
145
  /**
144
- * Retrieve the token associated with the specified token ID.
146
+ * Retrieve a given token specified by the token ID.
145
147
  *
146
148
  * @param request - The request {@link GetTokenRequest}
147
149
  * @returns A Promise of Token
@@ -152,7 +154,7 @@ class API extends API$1 {
152
154
  }, unmarshalToken);
153
155
 
154
156
  /**
155
- * Delete the token associated with the specified token ID.
157
+ * Delete a given token specified by the token ID.
156
158
  *
157
159
  * @param request - The request {@link DeleteTokenRequest}
158
160
  */
@@ -162,7 +164,8 @@ class API extends API$1 {
162
164
  });
163
165
 
164
166
  /**
165
- * Create a contact point to receive alerts for the default receiver.
167
+ * Create a contact point associated with the default receiver, to receive
168
+ * alerts.
166
169
  *
167
170
  * @param request - The request {@link CreateContactPointRequest}
168
171
  * @returns A Promise of ContactPoint
@@ -180,8 +183,8 @@ class API extends API$1 {
180
183
  }, unmarshalListContactPointsResponse);
181
184
 
182
185
  /**
183
- * Get a list of contact points for the Cockpit associated with the specified
184
- * Project ID.
186
+ * Get a list of contact points created for a given Cockpit, specified by the
187
+ * ID of the Project the Cockpit belongs to.
185
188
  *
186
189
  * @param request - The request {@link ListContactPointsRequest}
187
190
  * @returns A Promise of ListContactPointsResponse
@@ -189,7 +192,7 @@ class API extends API$1 {
189
192
  listContactPoints = (request = {}) => enrichForPagination('contactPoints', this.pageOfListContactPoints, request);
190
193
 
191
194
  /**
192
- * Delete a contact point for the default receiver.
195
+ * Delete a contact point associated with the default receiver.
193
196
  *
194
197
  * @param request - The request {@link DeleteContactPointRequest}
195
198
  */
@@ -201,7 +204,8 @@ class API extends API$1 {
201
204
  });
202
205
 
203
206
  /**
204
- * Enable the sending of managed alerts for the specified Project's Cockpit.
207
+ * Enable the sending of managed alerts for a given Cockpit, specified by the
208
+ * ID of the Project the Cockpit belongs to.
205
209
  *
206
210
  * @param request - The request {@link EnableManagedAlertsRequest}
207
211
  */
@@ -213,7 +217,8 @@ class API extends API$1 {
213
217
  });
214
218
 
215
219
  /**
216
- * Disable the sending of managed alerts for the specified Project's Cockpit.
220
+ * Disable the sending of managed alerts for a given Cockpit, specified by the
221
+ * ID of the Project the Cockpit belongs to.
217
222
  *
218
223
  * @param request - The request {@link DisableManagedAlertsRequest}
219
224
  */
@@ -225,7 +230,8 @@ class API extends API$1 {
225
230
  });
226
231
 
227
232
  /**
228
- * Trigger a test alert to all of the Cockpit's receivers.
233
+ * Send a test alert to make sure your contact points get notified when an
234
+ * actual alert is triggered.
229
235
  *
230
236
  * @param request - The request {@link TriggerTestAlertRequest}
231
237
  */
@@ -237,8 +243,8 @@ class API extends API$1 {
237
243
  });
238
244
 
239
245
  /**
240
- * Create a Grafana user for your Cockpit's Grafana instance. Make sure you
241
- * save the automatically-generated password and the Grafana user ID.
246
+ * Create a Grafana user for your Cockpit's Grafana. Make sure you save the
247
+ * automatically-generated password and the Grafana user ID.
242
248
  *
243
249
  * @param request - The request {@link CreateGrafanaUserRequest}
244
250
  * @returns A Promise of GrafanaUser
@@ -256,8 +262,7 @@ class API extends API$1 {
256
262
  }, unmarshalListGrafanaUsersResponse);
257
263
 
258
264
  /**
259
- * Get a list of Grafana users who are able to connect to the Cockpit's
260
- * Grafana instance.
265
+ * Get a list of all Grafana users created in your Cockpit's Grafana.
261
266
  *
262
267
  * @param request - The request {@link ListGrafanaUsersRequest}
263
268
  * @returns A Promise of ListGrafanaUsersResponse
@@ -265,8 +270,8 @@ class API extends API$1 {
265
270
  listGrafanaUsers = (request = {}) => enrichForPagination('grafanaUsers', this.pageOfListGrafanaUsers, request);
266
271
 
267
272
  /**
268
- * Delete a Grafana user from a Grafana instance, specified by the Cockpit's
269
- * Project ID and the Grafana user ID.
273
+ * Delete a Grafana user from your Cockpit's Grafana, specified by the ID of
274
+ * the Project the Cockpit belongs to, and the ID of the Grafana user.
270
275
  *
271
276
  * @param request - The request {@link DeleteGrafanaUserRequest}
272
277
  */
@@ -278,8 +283,8 @@ class API extends API$1 {
278
283
  });
279
284
 
280
285
  /**
281
- * Reset a Grafana user's password specified by the Cockpit's Project ID and
282
- * the Grafana user ID.
286
+ * Reset the password of a Grafana user, specified by the ID of the Project
287
+ * the Cockpit belongs to, and the ID of the Grafana user.
283
288
  *
284
289
  * @param request - The request {@link ResetGrafanaUserPasswordRequest}
285
290
  * @returns A Promise of GrafanaUser
@@ -364,7 +364,7 @@ class API extends API$1 {
364
364
  pageOfListPolicies = (request = {}) => this.client.fetch({
365
365
  method: 'GET',
366
366
  path: `/iam/v1alpha1/policies`,
367
- urlParams: urlParams(['application_ids', request.applicationIds], ['editable', request.editable], ['group_ids', request.groupIds], ['no_principal', request.noPrincipal], ['order_by', request.orderBy], ['organization_id', request.organizationId ?? this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['policy_name', request.policyName], ['tag', request.tag], ['user_ids', request.userIds])
367
+ urlParams: urlParams(['application_ids', request.applicationIds], ['editable', request.editable], ['group_ids', request.groupIds], ['no_principal', request.noPrincipal], ['order_by', request.orderBy], ['organization_id', request.organizationId ?? this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['policy_ids', request.policyIds], ['policy_name', request.policyName], ['tag', request.tag], ['user_ids', request.userIds])
368
368
  }, unmarshalListPoliciesResponse);
369
369
 
370
370
  /**
@@ -503,7 +503,7 @@ class API extends API$1 {
503
503
  pageOfListAPIKeys = (request = {}) => this.client.fetch({
504
504
  method: 'GET',
505
505
  path: `/iam/v1alpha1/api-keys`,
506
- urlParams: urlParams(['access_key', request.accessKey], ['bearer_id', request.bearerId], ['bearer_type', request.bearerType], ['description', request.description], ['editable', request.editable], ['expired', request.expired], ['order_by', request.orderBy], ['organization_id', request.organizationId ?? this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ...Object.entries(resolveOneOf([{
506
+ urlParams: urlParams(['access_key', request.accessKey], ['access_keys', request.accessKeys], ['bearer_id', request.bearerId], ['bearer_type', request.bearerType], ['description', request.description], ['editable', request.editable], ['expired', request.expired], ['order_by', request.orderBy], ['organization_id', request.organizationId ?? this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ...Object.entries(resolveOneOf([{
507
507
  param: 'application_id',
508
508
  value: request.applicationId
509
509
  }, {
@@ -167,7 +167,8 @@ const unmarshalServerMaintenance = data => {
167
167
  throw new TypeError(`Unmarshalling the type 'ServerMaintenance' failed as data isn't a dictionary.`);
168
168
  }
169
169
  return {
170
- reason: data.reason
170
+ reason: data.reason,
171
+ startDate: unmarshalDate(data.start_date)
171
172
  };
172
173
  };
173
174
  const unmarshalVolumeServer = data => {
@@ -1347,7 +1348,8 @@ const marshalServerLocation = (request, defaults) => ({
1347
1348
  zone_id: request.zoneId
1348
1349
  });
1349
1350
  const marshalServerMaintenance = (request, defaults) => ({
1350
- reason: request.reason
1351
+ reason: request.reason,
1352
+ start_date: request.startDate
1351
1353
  });
1352
1354
  const marshalSetServerRequest = (request, defaults) => ({
1353
1355
  allowed_actions: request.allowedActions !== undefined ? request.allowedActions : undefined,
@@ -1,7 +1,7 @@
1
1
  import { API as API$1 } from '../../../scw/api.js';
2
2
  import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
3
3
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
- import { marshalCreateJobDefinitionRequest, unmarshalJobDefinition, unmarshalListJobDefinitionsResponse, marshalUpdateJobDefinitionRequest, unmarshalJobRun, unmarshalListJobRunsResponse } from './marshalling.gen.js';
4
+ import { marshalCreateJobDefinitionRequest, unmarshalJobDefinition, unmarshalListJobDefinitionsResponse, marshalUpdateJobDefinitionRequest, marshalStartJobDefinitionRequest, unmarshalJobRun, unmarshalListJobRunsResponse } from './marshalling.gen.js';
5
5
 
6
6
  // This file was automatically generated. DO NOT EDIT.
7
7
  // If you have any remark or suggestion do not hesitate to open an issue.
@@ -83,7 +83,7 @@ class API extends API$1 {
83
83
  * @returns A Promise of JobRun
84
84
  */
85
85
  startJobDefinition = request => this.client.fetch({
86
- body: '{}',
86
+ body: JSON.stringify(marshalStartJobDefinitionRequest(request, this.client.settings)),
87
87
  headers: jsonContentHeaders,
88
88
  method: 'POST',
89
89
  path: `/serverless-jobs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam('jobDefinitionId', request.jobDefinitionId)}/start`
@@ -39,8 +39,10 @@ const unmarshalJobRun = data => {
39
39
  throw new TypeError(`Unmarshalling the type 'JobRun' failed as data isn't a dictionary.`);
40
40
  }
41
41
  return {
42
+ command: data.command,
42
43
  cpuLimit: data.cpu_limit,
43
44
  createdAt: unmarshalDate(data.created_at),
45
+ environmentVariables: data.environment_variables,
44
46
  errorMessage: data.error_message,
45
47
  exitCode: data.exit_code,
46
48
  id: data.id,
@@ -87,6 +89,11 @@ const marshalCreateJobDefinitionRequest = (request, defaults) => ({
87
89
  name: request.name || randomName('job'),
88
90
  project_id: request.projectId ?? defaults.defaultProjectId
89
91
  });
92
+ const marshalStartJobDefinitionRequest = (request, defaults) => ({
93
+ command: request.command,
94
+ environment_variables: request.environmentVariables,
95
+ replicas: request.replicas
96
+ });
90
97
  const marshalUpdateJobDefinitionRequestCronScheduleConfig = (request, defaults) => ({
91
98
  schedule: request.schedule,
92
99
  timezone: request.timezone
@@ -103,4 +110,4 @@ const marshalUpdateJobDefinitionRequest = (request, defaults) => ({
103
110
  name: request.name
104
111
  });
105
112
 
106
- export { marshalCreateJobDefinitionRequest, marshalUpdateJobDefinitionRequest, unmarshalJobDefinition, unmarshalJobRun, unmarshalListJobDefinitionsResponse, unmarshalListJobRunsResponse };
113
+ export { marshalCreateJobDefinitionRequest, marshalStartJobDefinitionRequest, marshalUpdateJobDefinitionRequest, unmarshalJobDefinition, unmarshalJobRun, unmarshalListJobDefinitionsResponse, unmarshalListJobRunsResponse };
@@ -150,7 +150,7 @@ class API extends API$1 {
150
150
  _getClusterKubeConfig = request => this.client.fetch({
151
151
  method: 'GET',
152
152
  path: `/k8s/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/clusters/${validatePathParam('clusterId', request.clusterId)}/kubeconfig`,
153
- urlParams: urlParams(['dl', 1]),
153
+ urlParams: urlParams(['dl', 1], ['redacted', request.redacted]),
154
154
  responseType: 'blob'
155
155
  });
156
156
 
@@ -70,7 +70,7 @@ class API extends API$1 {
70
70
  pageOfListDatabases = (request = {}) => this.client.fetch({
71
71
  method: 'GET',
72
72
  path: `/serverless-sqldb/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/databases`,
73
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize], ['project_id', request.projectId ?? this.client.settings.defaultProjectId])
73
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize], ['project_id', request.projectId ?? this.client.settings.defaultProjectId])
74
74
  }, unmarshalListDatabasesResponse);
75
75
 
76
76
  /**
@@ -129,7 +129,7 @@ class API extends API$1 {
129
129
  pageOfListDatabaseBackups = request => this.client.fetch({
130
130
  method: 'GET',
131
131
  path: `/serverless-sqldb/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/backups`,
132
- urlParams: urlParams(['database_id', request.databaseId], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize])
132
+ urlParams: urlParams(['database_id', request.databaseId], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize], ['project_id', request.projectId])
133
133
  }, unmarshalListDatabaseBackupsResponse);
134
134
 
135
135
  /**