@scaleway/sdk 2.9.0 → 2.11.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,2 +1,4 @@
1
1
  import * as index_gen from './v2alpha1/index.gen.js';
2
2
  export { index_gen as v2alpha1 };
3
+ import * as index_gen$1 from './v2beta1/index.gen.js';
4
+ export { index_gen$1 as v2beta1 };
@@ -0,0 +1,103 @@
1
+ import { API as API$1 } from '../../../scw/api.js';
2
+ import { urlParams, resolveOneOf, validatePathParam } from '../../../helpers/marshalling.js';
3
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
+ import { unmarshalListConsumptionsResponse, unmarshalListTaxesResponse, unmarshalListInvoicesResponse, unmarshalInvoice } from './marshalling.gen.js';
5
+
6
+ // This file was automatically generated. DO NOT EDIT.
7
+ // If you have any remark or suggestion do not hesitate to open an issue.
8
+ /**
9
+ * Billing API.
10
+ *
11
+ * This API allows you to query your consumption.
12
+ */
13
+ class API extends API$1 {
14
+ pageOfListConsumptions = (request = {}) => this.client.fetch({
15
+ method: 'GET',
16
+ path: `/billing/v2beta1/consumptions`,
17
+ urlParams: urlParams(['billing_period', request.billingPeriod], ['category_name', request.categoryName], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ...Object.entries(resolveOneOf([{
18
+ default: this.client.settings.defaultOrganizationId,
19
+ param: 'organization_id',
20
+ value: request.organizationId
21
+ }, {
22
+ default: this.client.settings.defaultProjectId,
23
+ param: 'project_id',
24
+ value: request.projectId
25
+ }])))
26
+ }, unmarshalListConsumptionsResponse);
27
+
28
+ /**
29
+ * Get monthly consumption. Consumption allows you to retrieve your past or
30
+ * current consumption cost, by project or category.
31
+ *
32
+ * @param request - The request {@link ListConsumptionsRequest}
33
+ * @returns A Promise of ListConsumptionsResponse
34
+ */
35
+ listConsumptions = (request = {}) => enrichForPagination('consumptions', this.pageOfListConsumptions, request);
36
+ pageOfListTaxes = (request = {}) => this.client.fetch({
37
+ method: 'GET',
38
+ path: `/billing/v2beta1/taxes`,
39
+ urlParams: urlParams(['billing_period', request.billingPeriod], ['order_by', request.orderBy], ['organization_id', request.organizationId ?? this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
40
+ }, unmarshalListTaxesResponse);
41
+
42
+ /**
43
+ * Get monthly consumption taxes. Consumption Tax allows you to retrieve your
44
+ * past or current tax charges, by project or category.
45
+ *
46
+ * @param request - The request {@link ListTaxesRequest}
47
+ * @returns A Promise of ListTaxesResponse
48
+ */
49
+ listTaxes = (request = {}) => enrichForPagination('taxes', this.pageOfListTaxes, request);
50
+ pageOfListInvoices = (request = {}) => this.client.fetch({
51
+ method: 'GET',
52
+ path: `/billing/v2beta1/invoices`,
53
+ urlParams: urlParams(['billing_period_start_after', request.billingPeriodStartAfter], ['billing_period_start_before', request.billingPeriodStartBefore], ['invoice_type', request.invoiceType], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
54
+ }, unmarshalListInvoicesResponse);
55
+
56
+ /**
57
+ * List invoices. List all your invoices, filtering by `start_date` and
58
+ * `invoice_type`. Each invoice has its own ID.
59
+ *
60
+ * @param request - The request {@link ListInvoicesRequest}
61
+ * @returns A Promise of ListInvoicesResponse
62
+ */
63
+ listInvoices = (request = {}) => enrichForPagination('invoices', this.pageOfListInvoices, request);
64
+
65
+ /**
66
+ * Export invoices. Export invoices in a CSV file.
67
+ *
68
+ * @param request - The request {@link ExportInvoicesRequest}
69
+ * @returns A Promise of Blob
70
+ */
71
+ exportInvoices = (request = {}) => this.client.fetch({
72
+ method: 'GET',
73
+ path: `/billing/v2beta1/export-invoices`,
74
+ urlParams: urlParams(['dl', 1], ['billing_period_start_after', request.billingPeriodStartAfter], ['billing_period_start_before', request.billingPeriodStartBefore], ['file_type', request.fileType], ['invoice_type', request.invoiceType], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize]),
75
+ responseType: 'blob'
76
+ });
77
+
78
+ /**
79
+ * Get an invoice. Get a specific invoice, specified by its ID.
80
+ *
81
+ * @param request - The request {@link GetInvoiceRequest}
82
+ * @returns A Promise of Invoice
83
+ */
84
+ getInvoice = request => this.client.fetch({
85
+ method: 'GET',
86
+ path: `/billing/v2beta1/invoices/${validatePathParam('invoiceId', request.invoiceId)}`
87
+ }, unmarshalInvoice);
88
+
89
+ /**
90
+ * Download an invoice. Download a specific invoice, specified by its ID.
91
+ *
92
+ * @param request - The request {@link DownloadInvoiceRequest}
93
+ * @returns A Promise of Blob
94
+ */
95
+ downloadInvoice = request => this.client.fetch({
96
+ method: 'GET',
97
+ path: `/billing/v2beta1/invoices/${validatePathParam('invoiceId', request.invoiceId)}/download`,
98
+ urlParams: urlParams(['dl', 1], ['file_type', request.fileType]),
99
+ responseType: 'blob'
100
+ });
101
+ }
102
+
103
+ export { API };
@@ -0,0 +1,4 @@
1
+ export { API } from './api.gen.js';
2
+
3
+ // This file was automatically generated. DO NOT EDIT.
4
+ // If you have any remark or suggestion do not hesitate to open an issue.
@@ -0,0 +1,87 @@
1
+ import { isJSONObject } from '../../../helpers/json.js';
2
+ import { unmarshalMoney } from '../../../scw/custom-marshalling.js';
3
+ import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
4
+
5
+ // This file was automatically generated. DO NOT EDIT.
6
+ // If you have any remark or suggestion do not hesitate to open an issue.
7
+ const unmarshalInvoice = data => {
8
+ if (!isJSONObject(data)) {
9
+ throw new TypeError(`Unmarshalling the type 'Invoice' failed as data isn't a dictionary.`);
10
+ }
11
+ return {
12
+ billingPeriod: unmarshalDate(data.billing_period),
13
+ customerName: data.customer_name,
14
+ dueDate: unmarshalDate(data.due_date),
15
+ id: data.id,
16
+ issuedDate: unmarshalDate(data.issued_date),
17
+ number: data.number,
18
+ organizationId: data.organization_id,
19
+ organizationName: data.organization_name,
20
+ sellerName: data.seller_name,
21
+ startDate: unmarshalDate(data.start_date),
22
+ state: data.state,
23
+ stopDate: unmarshalDate(data.stop_date),
24
+ totalDiscount: data.total_discount ? unmarshalMoney(data.total_discount) : undefined,
25
+ totalTax: data.total_tax ? unmarshalMoney(data.total_tax) : undefined,
26
+ totalTaxed: data.total_taxed ? unmarshalMoney(data.total_taxed) : undefined,
27
+ totalUndiscount: data.total_undiscount ? unmarshalMoney(data.total_undiscount) : undefined,
28
+ totalUntaxed: data.total_untaxed ? unmarshalMoney(data.total_untaxed) : undefined,
29
+ type: data.type
30
+ };
31
+ };
32
+ const unmarshalListConsumptionsResponseConsumption = data => {
33
+ if (!isJSONObject(data)) {
34
+ throw new TypeError(`Unmarshalling the type 'ListConsumptionsResponseConsumption' failed as data isn't a dictionary.`);
35
+ }
36
+ return {
37
+ categoryName: data.category_name,
38
+ productName: data.product_name,
39
+ projectId: data.project_id,
40
+ resourceName: data.resource_name,
41
+ sku: data.sku,
42
+ value: data.value ? unmarshalMoney(data.value) : undefined
43
+ };
44
+ };
45
+ const unmarshalListConsumptionsResponse = data => {
46
+ if (!isJSONObject(data)) {
47
+ throw new TypeError(`Unmarshalling the type 'ListConsumptionsResponse' failed as data isn't a dictionary.`);
48
+ }
49
+ return {
50
+ consumptions: unmarshalArrayOfObject(data.consumptions, unmarshalListConsumptionsResponseConsumption),
51
+ totalCount: data.total_count,
52
+ totalDiscountUntaxedValue: data.total_discount_untaxed_value,
53
+ updatedAt: unmarshalDate(data.updated_at)
54
+ };
55
+ };
56
+ const unmarshalListInvoicesResponse = data => {
57
+ if (!isJSONObject(data)) {
58
+ throw new TypeError(`Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`);
59
+ }
60
+ return {
61
+ invoices: unmarshalArrayOfObject(data.invoices, unmarshalInvoice),
62
+ totalCount: data.total_count
63
+ };
64
+ };
65
+ const unmarshalListTaxesResponseTax = data => {
66
+ if (!isJSONObject(data)) {
67
+ throw new TypeError(`Unmarshalling the type 'ListTaxesResponseTax' failed as data isn't a dictionary.`);
68
+ }
69
+ return {
70
+ currency: data.currency,
71
+ description: data.description,
72
+ rate: data.rate,
73
+ totalTaxValue: data.total_tax_value
74
+ };
75
+ };
76
+ const unmarshalListTaxesResponse = data => {
77
+ if (!isJSONObject(data)) {
78
+ throw new TypeError(`Unmarshalling the type 'ListTaxesResponse' failed as data isn't a dictionary.`);
79
+ }
80
+ return {
81
+ taxes: unmarshalArrayOfObject(data.taxes, unmarshalListTaxesResponseTax),
82
+ totalCount: data.total_count,
83
+ updatedAt: unmarshalDate(data.updated_at)
84
+ };
85
+ };
86
+
87
+ export { unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
@@ -1,7 +1,7 @@
1
1
  import { API as API$1 } from '../../../scw/api.js';
2
2
  import { urlParams, validatePathParam, resolveOneOf } from '../../../helpers/marshalling.js';
3
3
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
- import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHKey, marshalUpdateSSHKeyRequest, unmarshalListUsersResponse, unmarshalUser, marshalCreateUserRequest, unmarshalListApplicationsResponse, marshalCreateApplicationRequest, unmarshalApplication, marshalUpdateApplicationRequest, unmarshalListGroupsResponse, marshalCreateGroupRequest, unmarshalGroup, marshalUpdateGroupRequest, marshalSetGroupMembersRequest, marshalAddGroupMemberRequest, marshalAddGroupMembersRequest, marshalRemoveGroupMemberRequest, unmarshalListPoliciesResponse, marshalCreatePolicyRequest, unmarshalPolicy, marshalUpdatePolicyRequest, marshalSetRulesRequest, unmarshalSetRulesResponse, unmarshalListRulesResponse, unmarshalListPermissionSetsResponse, unmarshalListAPIKeysResponse, marshalCreateAPIKeyRequest, unmarshalAPIKey, marshalUpdateAPIKeyRequest, unmarshalListQuotaResponse, unmarshalQuotum, unmarshalListJWTsResponse, unmarshalJWT, unmarshalListLogsResponse, unmarshalLog } from './marshalling.gen.js';
4
+ import { unmarshalListSSHKeysResponse, marshalCreateSSHKeyRequest, unmarshalSSHKey, marshalUpdateSSHKeyRequest, unmarshalListUsersResponse, unmarshalUser, marshalUpdateUserRequest, marshalCreateUserRequest, unmarshalListApplicationsResponse, marshalCreateApplicationRequest, unmarshalApplication, marshalUpdateApplicationRequest, unmarshalListGroupsResponse, marshalCreateGroupRequest, unmarshalGroup, marshalUpdateGroupRequest, marshalSetGroupMembersRequest, marshalAddGroupMemberRequest, marshalAddGroupMembersRequest, marshalRemoveGroupMemberRequest, unmarshalListPoliciesResponse, marshalCreatePolicyRequest, unmarshalPolicy, marshalUpdatePolicyRequest, marshalSetRulesRequest, unmarshalSetRulesResponse, unmarshalListRulesResponse, unmarshalListPermissionSetsResponse, unmarshalListAPIKeysResponse, marshalCreateAPIKeyRequest, unmarshalAPIKey, marshalUpdateAPIKeyRequest, unmarshalListQuotaResponse, unmarshalQuotum, unmarshalListJWTsResponse, unmarshalJWT, unmarshalListLogsResponse, unmarshalLog } 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.
@@ -111,6 +111,19 @@ class API extends API$1 {
111
111
  path: `/iam/v1alpha1/users/${validatePathParam('userId', request.userId)}`
112
112
  }, unmarshalUser);
113
113
 
114
+ /**
115
+ * Update a user. Update the parameters of a user, including `tags`.
116
+ *
117
+ * @param request - The request {@link UpdateUserRequest}
118
+ * @returns A Promise of User
119
+ */
120
+ updateUser = request => this.client.fetch({
121
+ body: JSON.stringify(marshalUpdateUserRequest(request, this.client.settings)),
122
+ headers: jsonContentHeaders,
123
+ method: 'PATCH',
124
+ path: `/iam/v1alpha1/users/${validatePathParam('userId', request.userId)}`
125
+ }, unmarshalUser);
126
+
114
127
  /**
115
128
  * Delete a guest user from an Organization. Remove a user from an
116
129
  * Organization in which they are a guest. You must define the `user_id` in
@@ -415,5 +415,8 @@ const marshalUpdateSSHKeyRequest = (request, defaults) => ({
415
415
  disabled: request.disabled,
416
416
  name: request.name
417
417
  });
418
+ const marshalUpdateUserRequest = (request, defaults) => ({
419
+ tags: request.tags
420
+ });
418
421
 
419
- export { marshalAddGroupMemberRequest, marshalAddGroupMembersRequest, marshalCreateAPIKeyRequest, marshalCreateApplicationRequest, marshalCreateGroupRequest, marshalCreatePolicyRequest, marshalCreateSSHKeyRequest, marshalCreateUserRequest, marshalRemoveGroupMemberRequest, marshalSetGroupMembersRequest, marshalSetRulesRequest, marshalUpdateAPIKeyRequest, marshalUpdateApplicationRequest, marshalUpdateGroupRequest, marshalUpdatePolicyRequest, marshalUpdateSSHKeyRequest, unmarshalAPIKey, unmarshalApplication, unmarshalGroup, unmarshalJWT, unmarshalListAPIKeysResponse, unmarshalListApplicationsResponse, unmarshalListGroupsResponse, unmarshalListJWTsResponse, unmarshalListLogsResponse, unmarshalListPermissionSetsResponse, unmarshalListPoliciesResponse, unmarshalListQuotaResponse, unmarshalListRulesResponse, unmarshalListSSHKeysResponse, unmarshalListUsersResponse, unmarshalLog, unmarshalPolicy, unmarshalQuotum, unmarshalSSHKey, unmarshalSetRulesResponse, unmarshalUser };
422
+ export { marshalAddGroupMemberRequest, marshalAddGroupMembersRequest, marshalCreateAPIKeyRequest, marshalCreateApplicationRequest, marshalCreateGroupRequest, marshalCreatePolicyRequest, marshalCreateSSHKeyRequest, marshalCreateUserRequest, marshalRemoveGroupMemberRequest, marshalSetGroupMembersRequest, marshalSetRulesRequest, marshalUpdateAPIKeyRequest, marshalUpdateApplicationRequest, marshalUpdateGroupRequest, marshalUpdatePolicyRequest, marshalUpdateSSHKeyRequest, marshalUpdateUserRequest, unmarshalAPIKey, unmarshalApplication, unmarshalGroup, unmarshalJWT, unmarshalListAPIKeysResponse, unmarshalListApplicationsResponse, unmarshalListGroupsResponse, unmarshalListJWTsResponse, unmarshalListLogsResponse, unmarshalListPermissionSetsResponse, unmarshalListPoliciesResponse, unmarshalListQuotaResponse, unmarshalListRulesResponse, unmarshalListSSHKeysResponse, unmarshalListUsersResponse, unmarshalLog, unmarshalPolicy, unmarshalQuotum, unmarshalSSHKey, unmarshalSetRulesResponse, unmarshalUser };
@@ -119,7 +119,7 @@ class ZonedAPI extends API$1 {
119
119
  pageOfListIPs = (request = {}) => this.client.fetch({
120
120
  method: 'GET',
121
121
  path: `/lb/v1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/ips`,
122
- urlParams: urlParams(['ip_address', request.ipAddress], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId])
122
+ urlParams: urlParams(['ip_address', request.ipAddress], ['ip_type', request.ipType], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId])
123
123
  }, unmarshalListIpsResponse);
124
124
 
125
125
  /**
@@ -908,7 +908,7 @@ class API extends API$1 {
908
908
  pageOfListIPs = (request = {}) => this.client.fetch({
909
909
  method: 'GET',
910
910
  path: `/lb/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/ips`,
911
- urlParams: urlParams(['ip_address', request.ipAddress], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId])
911
+ urlParams: urlParams(['ip_address', request.ipAddress], ['ip_type', request.ipType], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId])
912
912
  }, unmarshalListIpsResponse);
913
913
 
914
914
  /**
@@ -49,6 +49,7 @@ const unmarshalReadReplica = data => {
49
49
  return {
50
50
  endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
51
51
  id: data.id,
52
+ instanceId: data.instance_id,
52
53
  region: data.region,
53
54
  sameZone: data.same_zone,
54
55
  status: data.status
@@ -165,7 +165,12 @@ const marshalCreateEmailRequestAttachment = (request, defaults) => ({
165
165
  name: request.name,
166
166
  type: request.type
167
167
  });
168
+ const marshalCreateEmailRequestHeader = (request, defaults) => ({
169
+ key: request.key,
170
+ value: request.value
171
+ });
168
172
  const marshalCreateEmailRequest = (request, defaults) => ({
173
+ additional_headers: request.additionalHeaders !== undefined ? request.additionalHeaders.map(elt => marshalCreateEmailRequestHeader(elt)) : undefined,
169
174
  attachments: request.attachments !== undefined ? request.attachments.map(elt => marshalCreateEmailRequestAttachment(elt)) : undefined,
170
175
  bcc: request.bcc !== undefined ? request.bcc.map(elt => marshalCreateEmailRequestAddress(elt)) : undefined,
171
176
  cc: request.cc !== undefined ? request.cc.map(elt => marshalCreateEmailRequestAddress(elt)) : undefined,