@scaleway/sdk-billing 2.10.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.
- package/dist/.vite/license.md +3 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/index.gen.d.ts +6 -0
- package/dist/index.gen.js +3 -0
- package/dist/metadata.gen.d.ts +12 -0
- package/dist/metadata.gen.js +13 -0
- package/dist/v2/api.gen.d.ts +87 -0
- package/dist/v2/api.gen.js +74 -0
- package/dist/v2/index.gen.d.ts +4 -0
- package/dist/v2/index.gen.js +21 -0
- package/dist/v2/marshalling.gen.d.ts +12 -0
- package/dist/v2/marshalling.gen.js +88 -0
- package/dist/v2/metadata.gen.d.ts +30 -0
- package/dist/v2/metadata.gen.js +32 -0
- package/dist/v2/types.gen.d.ts +220 -0
- package/dist/v2/types.gen.js +0 -0
- package/dist/v2/validation-rules.gen.d.ts +12 -0
- package/dist/v2/validation-rules.gen.js +16 -0
- package/dist/v2beta1/api.gen.d.ts +96 -0
- package/dist/v2beta1/api.gen.js +81 -0
- package/dist/v2beta1/index.gen.d.ts +4 -0
- package/dist/v2beta1/index.gen.js +19 -0
- package/dist/v2beta1/marshalling.gen.d.ts +8 -0
- package/dist/v2beta1/marshalling.gen.js +135 -0
- package/dist/v2beta1/metadata.gen.d.ts +78 -0
- package/dist/v2beta1/metadata.gen.js +86 -0
- package/dist/v2beta1/types.gen.d.ts +533 -0
- package/dist/v2beta1/types.gen.js +0 -0
- package/dist/v2beta1/validation-rules.gen.d.ts +6 -0
- package/dist/v2beta1/validation-rules.gen.js +9 -0
- package/package.json +5 -5
- package/LICENSE +0 -191
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is automatically generated
|
|
3
|
+
* PLEASE DO NOT EDIT HERE
|
|
4
|
+
*/
|
|
5
|
+
export declare const pkgMetadata: {
|
|
6
|
+
readonly name: "@scaleway/sdk-billing";
|
|
7
|
+
readonly namespace: "billing";
|
|
8
|
+
readonly displayName: "Billing";
|
|
9
|
+
readonly versions: readonly ["v2", "v2beta1"];
|
|
10
|
+
};
|
|
11
|
+
export type Metadata = typeof pkgMetadata;
|
|
12
|
+
export default pkgMetadata;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/metadata.gen.ts
|
|
2
|
+
/**
|
|
3
|
+
* This file is automatically generated
|
|
4
|
+
* PLEASE DO NOT EDIT HERE
|
|
5
|
+
*/
|
|
6
|
+
const pkgMetadata = {
|
|
7
|
+
name: "@scaleway/sdk-billing",
|
|
8
|
+
namespace: "billing",
|
|
9
|
+
displayName: "Billing",
|
|
10
|
+
versions: ["v2", "v2beta1"]
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { pkgMetadata as default, pkgMetadata };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
|
+
import type { Budget, BudgetAlert, BudgetAlertNotification, CreateBudgetAlertNotificationRequest, CreateBudgetAlertRequest, CreateBudgetRequest, DeleteBudgetAlertNotificationRequest, DeleteBudgetAlertRequest, DeleteBudgetRequest, GetBudgetRequest, ListBudgetsRequest, ListBudgetsResponse, UpdateBudgetAlertNotificationRequest, UpdateBudgetAlertRequest, UpdateBudgetRequest } from './types.gen.js';
|
|
3
|
+
/**
|
|
4
|
+
* Billing API.
|
|
5
|
+
|
|
6
|
+
This API allows you to query billing related objects.
|
|
7
|
+
*/
|
|
8
|
+
export declare class API extends ParentAPI {
|
|
9
|
+
protected pageOfListBudgets: (request?: Readonly<ListBudgetsRequest>) => Promise<ListBudgetsResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* List your budgets, filtering by `organization_id`.. List your budgets, filtering by `organization_id`.
|
|
12
|
+
*
|
|
13
|
+
* @param request - The request {@link ListBudgetsRequest}
|
|
14
|
+
* @returns A Promise of ListBudgetsResponse
|
|
15
|
+
*/
|
|
16
|
+
listBudgets: (request?: Readonly<ListBudgetsRequest>) => Promise<ListBudgetsResponse> & {
|
|
17
|
+
all: () => Promise<Budget[]>;
|
|
18
|
+
[Symbol.asyncIterator]: () => AsyncGenerator<Budget[], void, void>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Fetch a budget.. Fetch a budget.
|
|
22
|
+
*
|
|
23
|
+
* @param request - The request {@link GetBudgetRequest}
|
|
24
|
+
* @returns A Promise of Budget
|
|
25
|
+
*/
|
|
26
|
+
getBudget: (request: Readonly<GetBudgetRequest>) => Promise<Budget>;
|
|
27
|
+
/**
|
|
28
|
+
* Create a new budget.. Create a new budget.
|
|
29
|
+
*
|
|
30
|
+
* @param request - The request {@link CreateBudgetRequest}
|
|
31
|
+
* @returns A Promise of Budget
|
|
32
|
+
*/
|
|
33
|
+
createBudget: (request: Readonly<CreateBudgetRequest>) => Promise<Budget>;
|
|
34
|
+
/**
|
|
35
|
+
* Update a budget.. Update a budget.
|
|
36
|
+
*
|
|
37
|
+
* @param request - The request {@link UpdateBudgetRequest}
|
|
38
|
+
* @returns A Promise of Budget
|
|
39
|
+
*/
|
|
40
|
+
updateBudget: (request: Readonly<UpdateBudgetRequest>) => Promise<Budget>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete a budget.. Delete a budget.
|
|
43
|
+
*
|
|
44
|
+
* @param request - The request {@link DeleteBudgetRequest}
|
|
45
|
+
*/
|
|
46
|
+
deleteBudget: (request: Readonly<DeleteBudgetRequest>) => Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Create a new budget alert.. Create a new budget alert.
|
|
49
|
+
*
|
|
50
|
+
* @param request - The request {@link CreateBudgetAlertRequest}
|
|
51
|
+
* @returns A Promise of BudgetAlert
|
|
52
|
+
*/
|
|
53
|
+
createBudgetAlert: (request: Readonly<CreateBudgetAlertRequest>) => Promise<BudgetAlert>;
|
|
54
|
+
/**
|
|
55
|
+
* Update a budget alert.. Update a budget alert.
|
|
56
|
+
*
|
|
57
|
+
* @param request - The request {@link UpdateBudgetAlertRequest}
|
|
58
|
+
* @returns A Promise of BudgetAlert
|
|
59
|
+
*/
|
|
60
|
+
updateBudgetAlert: (request: Readonly<UpdateBudgetAlertRequest>) => Promise<BudgetAlert>;
|
|
61
|
+
/**
|
|
62
|
+
* Delete a budget alert.. Delete a budget alert.
|
|
63
|
+
*
|
|
64
|
+
* @param request - The request {@link DeleteBudgetAlertRequest}
|
|
65
|
+
*/
|
|
66
|
+
deleteBudgetAlert: (request: Readonly<DeleteBudgetAlertRequest>) => Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Create a new budget alert notification.. Create a new budget alert notification.
|
|
69
|
+
*
|
|
70
|
+
* @param request - The request {@link CreateBudgetAlertNotificationRequest}
|
|
71
|
+
* @returns A Promise of BudgetAlertNotification
|
|
72
|
+
*/
|
|
73
|
+
createBudgetAlertNotification: (request: Readonly<CreateBudgetAlertNotificationRequest>) => Promise<BudgetAlertNotification>;
|
|
74
|
+
/**
|
|
75
|
+
* Update a budget alert notification.. Update a budget alert notification.
|
|
76
|
+
*
|
|
77
|
+
* @param request - The request {@link UpdateBudgetAlertNotificationRequest}
|
|
78
|
+
* @returns A Promise of BudgetAlertNotification
|
|
79
|
+
*/
|
|
80
|
+
updateBudgetAlertNotification: (request: Readonly<UpdateBudgetAlertNotificationRequest>) => Promise<BudgetAlertNotification>;
|
|
81
|
+
/**
|
|
82
|
+
* Delete a budget alert notification.. Delete a budget alert notification.
|
|
83
|
+
*
|
|
84
|
+
* @param request - The request {@link DeleteBudgetAlertNotificationRequest}
|
|
85
|
+
*/
|
|
86
|
+
deleteBudgetAlertNotification: (request: Readonly<DeleteBudgetAlertNotificationRequest>) => Promise<void>;
|
|
87
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { marshalCreateBudgetAlertNotificationRequest, marshalCreateBudgetAlertRequest, marshalCreateBudgetRequest, marshalUpdateBudgetAlertNotificationRequest, marshalUpdateBudgetAlertRequest, marshalUpdateBudgetRequest, unmarshalBudget, unmarshalBudgetAlert, unmarshalBudgetAlertNotification, unmarshalListBudgetsResponse } from "./marshalling.gen.js";
|
|
2
|
+
import { API as API$1, enrichForPagination, urlParams, validatePathParam } from "@scaleway/sdk-client";
|
|
3
|
+
//#region src/v2/api.gen.ts
|
|
4
|
+
const jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
|
|
5
|
+
/**
|
|
6
|
+
* Billing API.
|
|
7
|
+
|
|
8
|
+
This API allows you to query billing related objects.
|
|
9
|
+
*/
|
|
10
|
+
var API = class extends API$1 {
|
|
11
|
+
constructor(..._args) {
|
|
12
|
+
super(..._args);
|
|
13
|
+
this.pageOfListBudgets = (request = {}) => this.client.fetch({
|
|
14
|
+
method: "GET",
|
|
15
|
+
path: `/billing/v2/budgets`,
|
|
16
|
+
urlParams: urlParams(["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
|
|
17
|
+
}, unmarshalListBudgetsResponse);
|
|
18
|
+
this.listBudgets = (request = {}) => enrichForPagination("budgets", this.pageOfListBudgets, request);
|
|
19
|
+
this.getBudget = (request) => this.client.fetch({
|
|
20
|
+
method: "GET",
|
|
21
|
+
path: `/billing/v2/budgets/${validatePathParam("budgetId", request.budgetId)}`
|
|
22
|
+
}, unmarshalBudget);
|
|
23
|
+
this.createBudget = (request) => this.client.fetch({
|
|
24
|
+
body: JSON.stringify(marshalCreateBudgetRequest(request, this.client.settings)),
|
|
25
|
+
headers: jsonContentHeaders,
|
|
26
|
+
method: "POST",
|
|
27
|
+
path: `/billing/v2/budgets`
|
|
28
|
+
}, unmarshalBudget);
|
|
29
|
+
this.updateBudget = (request) => this.client.fetch({
|
|
30
|
+
body: JSON.stringify(marshalUpdateBudgetRequest(request, this.client.settings)),
|
|
31
|
+
headers: jsonContentHeaders,
|
|
32
|
+
method: "PATCH",
|
|
33
|
+
path: `/billing/v2/budgets/${validatePathParam("budgetId", request.budgetId)}`
|
|
34
|
+
}, unmarshalBudget);
|
|
35
|
+
this.deleteBudget = (request) => this.client.fetch({
|
|
36
|
+
method: "DELETE",
|
|
37
|
+
path: `/billing/v2/budgets/${validatePathParam("budgetId", request.budgetId)}`
|
|
38
|
+
});
|
|
39
|
+
this.createBudgetAlert = (request) => this.client.fetch({
|
|
40
|
+
body: JSON.stringify(marshalCreateBudgetAlertRequest(request, this.client.settings)),
|
|
41
|
+
headers: jsonContentHeaders,
|
|
42
|
+
method: "POST",
|
|
43
|
+
path: `/billing/v2/budget-alerts`
|
|
44
|
+
}, unmarshalBudgetAlert);
|
|
45
|
+
this.updateBudgetAlert = (request) => this.client.fetch({
|
|
46
|
+
body: JSON.stringify(marshalUpdateBudgetAlertRequest(request, this.client.settings)),
|
|
47
|
+
headers: jsonContentHeaders,
|
|
48
|
+
method: "PATCH",
|
|
49
|
+
path: `/billing/v2/budget-alerts/${validatePathParam("budgetAlertId", request.budgetAlertId)}`
|
|
50
|
+
}, unmarshalBudgetAlert);
|
|
51
|
+
this.deleteBudgetAlert = (request) => this.client.fetch({
|
|
52
|
+
method: "DELETE",
|
|
53
|
+
path: `/billing/v2/budget-alerts/${validatePathParam("budgetAlertId", request.budgetAlertId)}`
|
|
54
|
+
});
|
|
55
|
+
this.createBudgetAlertNotification = (request) => this.client.fetch({
|
|
56
|
+
body: JSON.stringify(marshalCreateBudgetAlertNotificationRequest(request, this.client.settings)),
|
|
57
|
+
headers: jsonContentHeaders,
|
|
58
|
+
method: "POST",
|
|
59
|
+
path: `/billing/v2/budget-alert-notifications`
|
|
60
|
+
}, unmarshalBudgetAlertNotification);
|
|
61
|
+
this.updateBudgetAlertNotification = (request) => this.client.fetch({
|
|
62
|
+
body: JSON.stringify(marshalUpdateBudgetAlertNotificationRequest(request, this.client.settings)),
|
|
63
|
+
headers: jsonContentHeaders,
|
|
64
|
+
method: "PATCH",
|
|
65
|
+
path: `/billing/v2/budget-alert-notifications/${validatePathParam("budgetAlertNotificationId", request.budgetAlertNotificationId)}`
|
|
66
|
+
}, unmarshalBudgetAlertNotification);
|
|
67
|
+
this.deleteBudgetAlertNotification = (request) => this.client.fetch({
|
|
68
|
+
method: "DELETE",
|
|
69
|
+
path: `/billing/v2/budget-alert-notifications/${validatePathParam("budgetAlertNotificationId", request.budgetAlertNotificationId)}`
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { API };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { API, } from './api.gen.js';
|
|
2
|
+
export * from './marshalling.gen.js';
|
|
3
|
+
export type { Budget, BudgetAlert, BudgetAlertNotification, BudgetAlertNotificationType, CreateBudgetAlertNotificationRequest, CreateBudgetAlertRequest, CreateBudgetRequest, DeleteBudgetAlertNotificationRequest, DeleteBudgetAlertRequest, DeleteBudgetRequest, GetBudgetRequest, ListBudgetsRequest, ListBudgetsResponse, UpdateBudgetAlertNotificationRequest, UpdateBudgetAlertRequest, UpdateBudgetRequest, } from './types.gen.js';
|
|
4
|
+
export * as ValidationRules from './validation-rules.gen.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { marshalCreateBudgetAlertNotificationRequest, marshalCreateBudgetAlertRequest, marshalCreateBudgetRequest, marshalUpdateBudgetAlertNotificationRequest, marshalUpdateBudgetAlertRequest, marshalUpdateBudgetRequest, unmarshalBudget, unmarshalBudgetAlert, unmarshalBudgetAlertNotification, unmarshalListBudgetsResponse } from "./marshalling.gen.js";
|
|
3
|
+
import { API } from "./api.gen.js";
|
|
4
|
+
import { validation_rules_gen_exports } from "./validation-rules.gen.js";
|
|
5
|
+
//#region src/v2/index.gen.ts
|
|
6
|
+
var index_gen_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
API: () => API,
|
|
8
|
+
ValidationRules: () => validation_rules_gen_exports,
|
|
9
|
+
marshalCreateBudgetAlertNotificationRequest: () => marshalCreateBudgetAlertNotificationRequest,
|
|
10
|
+
marshalCreateBudgetAlertRequest: () => marshalCreateBudgetAlertRequest,
|
|
11
|
+
marshalCreateBudgetRequest: () => marshalCreateBudgetRequest,
|
|
12
|
+
marshalUpdateBudgetAlertNotificationRequest: () => marshalUpdateBudgetAlertNotificationRequest,
|
|
13
|
+
marshalUpdateBudgetAlertRequest: () => marshalUpdateBudgetAlertRequest,
|
|
14
|
+
marshalUpdateBudgetRequest: () => marshalUpdateBudgetRequest,
|
|
15
|
+
unmarshalBudget: () => unmarshalBudget,
|
|
16
|
+
unmarshalBudgetAlert: () => unmarshalBudgetAlert,
|
|
17
|
+
unmarshalBudgetAlertNotification: () => unmarshalBudgetAlertNotification,
|
|
18
|
+
unmarshalListBudgetsResponse: () => unmarshalListBudgetsResponse
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { API, validation_rules_gen_exports as ValidationRules, index_gen_exports, marshalCreateBudgetAlertNotificationRequest, marshalCreateBudgetAlertRequest, marshalCreateBudgetRequest, marshalUpdateBudgetAlertNotificationRequest, marshalUpdateBudgetAlertRequest, marshalUpdateBudgetRequest, unmarshalBudget, unmarshalBudgetAlert, unmarshalBudgetAlertNotification, unmarshalListBudgetsResponse };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DefaultValues } from '@scaleway/sdk-client';
|
|
2
|
+
import type { BudgetAlertNotification, BudgetAlert, Budget, ListBudgetsResponse, CreateBudgetAlertNotificationRequest, CreateBudgetAlertRequest, CreateBudgetRequest, UpdateBudgetAlertNotificationRequest, UpdateBudgetAlertRequest, UpdateBudgetRequest } from './types.gen.js';
|
|
3
|
+
export declare const unmarshalBudgetAlertNotification: (data: unknown) => BudgetAlertNotification;
|
|
4
|
+
export declare const unmarshalBudgetAlert: (data: unknown) => BudgetAlert;
|
|
5
|
+
export declare const unmarshalBudget: (data: unknown) => Budget;
|
|
6
|
+
export declare const unmarshalListBudgetsResponse: (data: unknown) => ListBudgetsResponse;
|
|
7
|
+
export declare const marshalCreateBudgetAlertNotificationRequest: (request: CreateBudgetAlertNotificationRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
8
|
+
export declare const marshalCreateBudgetAlertRequest: (request: CreateBudgetAlertRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
9
|
+
export declare const marshalCreateBudgetRequest: (request: CreateBudgetRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
10
|
+
export declare const marshalUpdateBudgetAlertNotificationRequest: (request: UpdateBudgetAlertNotificationRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
11
|
+
export declare const marshalUpdateBudgetAlertRequest: (request: UpdateBudgetAlertRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
12
|
+
export declare const marshalUpdateBudgetRequest: (request: UpdateBudgetRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney } from "@scaleway/sdk-client";
|
|
2
|
+
//#region src/v2/marshalling.gen.ts
|
|
3
|
+
const unmarshalBudgetAlertNotification = (data) => {
|
|
4
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'BudgetAlertNotification' failed as data isn't a dictionary.`);
|
|
5
|
+
return {
|
|
6
|
+
createdAt: unmarshalDate(data.created_at),
|
|
7
|
+
id: data.id,
|
|
8
|
+
recipients: data.recipients,
|
|
9
|
+
type: data.type,
|
|
10
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const unmarshalBudgetAlert = (data) => {
|
|
14
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'BudgetAlert' failed as data isn't a dictionary.`);
|
|
15
|
+
return {
|
|
16
|
+
createdAt: unmarshalDate(data.created_at),
|
|
17
|
+
id: data.id,
|
|
18
|
+
notifications: unmarshalArrayOfObject(data.notifications, unmarshalBudgetAlertNotification),
|
|
19
|
+
threshold: data.threshold,
|
|
20
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
const unmarshalBudget = (data) => {
|
|
24
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Budget' failed as data isn't a dictionary.`);
|
|
25
|
+
return {
|
|
26
|
+
alerts: unmarshalArrayOfObject(data.alerts, unmarshalBudgetAlert),
|
|
27
|
+
consumptionLimit: data.consumption_limit ? unmarshalMoney(data.consumption_limit) : void 0,
|
|
28
|
+
createdAt: unmarshalDate(data.created_at),
|
|
29
|
+
enabled: data.enabled,
|
|
30
|
+
id: data.id,
|
|
31
|
+
organizationId: data.organization_id,
|
|
32
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const unmarshalListBudgetsResponse = (data) => {
|
|
36
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListBudgetsResponse' failed as data isn't a dictionary.`);
|
|
37
|
+
return {
|
|
38
|
+
budgets: unmarshalArrayOfObject(data.budgets, unmarshalBudget),
|
|
39
|
+
totalCount: data.total_count
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const marshalCreateBudgetAlertNotificationRequest = (request, defaults) => ({
|
|
43
|
+
budget_alert_id: request.budgetAlertId,
|
|
44
|
+
...resolveOneOf([
|
|
45
|
+
{
|
|
46
|
+
param: "sms_phone_numbers",
|
|
47
|
+
value: request.smsPhoneNumbers
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
param: "email_addresses",
|
|
51
|
+
value: request.emailAddresses
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
param: "webhook_urls",
|
|
55
|
+
value: request.webhookUrls
|
|
56
|
+
}
|
|
57
|
+
])
|
|
58
|
+
});
|
|
59
|
+
const marshalCreateBudgetAlertRequest = (request, defaults) => ({
|
|
60
|
+
budget_id: request.budgetId,
|
|
61
|
+
threshold: request.threshold
|
|
62
|
+
});
|
|
63
|
+
const marshalCreateBudgetRequest = (request, defaults) => ({
|
|
64
|
+
consumption_limit: request.consumptionLimit,
|
|
65
|
+
enabled: request.enabled,
|
|
66
|
+
organization_id: request.organizationId ?? defaults.defaultOrganizationId
|
|
67
|
+
});
|
|
68
|
+
const marshalUpdateBudgetAlertNotificationRequest = (request, defaults) => ({ ...resolveOneOf([
|
|
69
|
+
{
|
|
70
|
+
param: "sms_phone_numbers",
|
|
71
|
+
value: request.smsPhoneNumbers
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
param: "email_addresses",
|
|
75
|
+
value: request.emailAddresses
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
param: "webhook_urls",
|
|
79
|
+
value: request.webhookUrls
|
|
80
|
+
}
|
|
81
|
+
]) });
|
|
82
|
+
const marshalUpdateBudgetAlertRequest = (request, defaults) => ({ threshold: request.threshold });
|
|
83
|
+
const marshalUpdateBudgetRequest = (request, defaults) => ({
|
|
84
|
+
consumption_limit: request.consumptionLimit,
|
|
85
|
+
enabled: request.enabled
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
export { marshalCreateBudgetAlertNotificationRequest, marshalCreateBudgetAlertRequest, marshalCreateBudgetRequest, marshalUpdateBudgetAlertNotificationRequest, marshalUpdateBudgetAlertRequest, marshalUpdateBudgetRequest, unmarshalBudget, unmarshalBudgetAlert, unmarshalBudgetAlertNotification, unmarshalListBudgetsResponse };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const queriesMetadata: {
|
|
2
|
+
readonly namespace: 'billing';
|
|
3
|
+
readonly version: 'v2';
|
|
4
|
+
readonly folderName: 'billingv2';
|
|
5
|
+
readonly services: readonly [{
|
|
6
|
+
readonly apiClass: 'API';
|
|
7
|
+
readonly methods: readonly [{
|
|
8
|
+
readonly methodName: 'listBudgets';
|
|
9
|
+
readonly protoName: 'ListBudgets';
|
|
10
|
+
readonly paramsType: 'ListBudgetsRequest';
|
|
11
|
+
readonly returnType: 'ListBudgetsResponse';
|
|
12
|
+
readonly isList: true;
|
|
13
|
+
readonly paginationType: 'offset';
|
|
14
|
+
readonly pageParamKey: 'page';
|
|
15
|
+
readonly listItemType: 'Budget';
|
|
16
|
+
readonly isPrivate: false;
|
|
17
|
+
readonly description: '"';
|
|
18
|
+
}, {
|
|
19
|
+
readonly methodName: 'getBudget';
|
|
20
|
+
readonly protoName: 'GetBudget';
|
|
21
|
+
readonly paramsType: 'GetBudgetRequest';
|
|
22
|
+
readonly returnType: 'Budget';
|
|
23
|
+
readonly isList: false;
|
|
24
|
+
readonly paginationType: 'none';
|
|
25
|
+
readonly isPrivate: false;
|
|
26
|
+
readonly description: '"';
|
|
27
|
+
}];
|
|
28
|
+
}];
|
|
29
|
+
};
|
|
30
|
+
export type QueriesMetadata = typeof queriesMetadata;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/v2/metadata.gen.ts
|
|
2
|
+
const queriesMetadata = {
|
|
3
|
+
namespace: "billing",
|
|
4
|
+
version: "v2",
|
|
5
|
+
folderName: "billingv2",
|
|
6
|
+
services: [{
|
|
7
|
+
apiClass: "API",
|
|
8
|
+
methods: [{
|
|
9
|
+
methodName: "listBudgets",
|
|
10
|
+
protoName: "ListBudgets",
|
|
11
|
+
paramsType: "ListBudgetsRequest",
|
|
12
|
+
returnType: "ListBudgetsResponse",
|
|
13
|
+
isList: true,
|
|
14
|
+
paginationType: "offset",
|
|
15
|
+
pageParamKey: "page",
|
|
16
|
+
listItemType: "Budget",
|
|
17
|
+
isPrivate: false,
|
|
18
|
+
description: "\""
|
|
19
|
+
}, {
|
|
20
|
+
methodName: "getBudget",
|
|
21
|
+
protoName: "GetBudget",
|
|
22
|
+
paramsType: "GetBudgetRequest",
|
|
23
|
+
returnType: "Budget",
|
|
24
|
+
isList: false,
|
|
25
|
+
paginationType: "none",
|
|
26
|
+
isPrivate: false,
|
|
27
|
+
description: "\""
|
|
28
|
+
}]
|
|
29
|
+
}]
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { queriesMetadata };
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import type { Money } from '@scaleway/sdk-client';
|
|
2
|
+
export type BudgetAlertNotificationType = 'unknown_type' | 'sms' | 'email' | 'webhook';
|
|
3
|
+
export interface BudgetAlertNotification {
|
|
4
|
+
/**
|
|
5
|
+
* Alert notification's ID.
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* The creation date of the alert notification.
|
|
10
|
+
*/
|
|
11
|
+
createdAt?: Date;
|
|
12
|
+
/**
|
|
13
|
+
* The last modification date of the alert notification.
|
|
14
|
+
*/
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
/**
|
|
17
|
+
* Kind of notification.
|
|
18
|
+
*/
|
|
19
|
+
type: BudgetAlertNotificationType;
|
|
20
|
+
/**
|
|
21
|
+
* List of recipients for this alert.
|
|
22
|
+
*/
|
|
23
|
+
recipients: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface BudgetAlert {
|
|
26
|
+
/**
|
|
27
|
+
* Alert's ID.
|
|
28
|
+
*/
|
|
29
|
+
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* The creation date of the alert.
|
|
32
|
+
*/
|
|
33
|
+
createdAt?: Date;
|
|
34
|
+
/**
|
|
35
|
+
* The last modification date of the alert.
|
|
36
|
+
*/
|
|
37
|
+
updatedAt?: Date;
|
|
38
|
+
/**
|
|
39
|
+
* Percentage threshold of the budget's limit for which the alert is triggered.
|
|
40
|
+
*/
|
|
41
|
+
threshold: number;
|
|
42
|
+
/**
|
|
43
|
+
* Notifications to send when the alert is triggered.
|
|
44
|
+
*/
|
|
45
|
+
notifications: BudgetAlertNotification[];
|
|
46
|
+
}
|
|
47
|
+
export interface Budget {
|
|
48
|
+
/**
|
|
49
|
+
* Budget's ID.
|
|
50
|
+
*/
|
|
51
|
+
id: string;
|
|
52
|
+
/**
|
|
53
|
+
* The creation date of the budget.
|
|
54
|
+
*/
|
|
55
|
+
createdAt?: Date;
|
|
56
|
+
/**
|
|
57
|
+
* The last modification date of the budget.
|
|
58
|
+
*/
|
|
59
|
+
updatedAt?: Date;
|
|
60
|
+
/**
|
|
61
|
+
* The organization ID of the budget.
|
|
62
|
+
*/
|
|
63
|
+
organizationId: string;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the budget is enabled or not.
|
|
66
|
+
*/
|
|
67
|
+
enabled: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Cost limit for this budget.
|
|
70
|
+
*/
|
|
71
|
+
consumptionLimit?: Money;
|
|
72
|
+
/**
|
|
73
|
+
* Alerts defined for this budget.
|
|
74
|
+
*/
|
|
75
|
+
alerts: BudgetAlert[];
|
|
76
|
+
}
|
|
77
|
+
export type CreateBudgetAlertNotificationRequest = {
|
|
78
|
+
/**
|
|
79
|
+
* The ID of the budget alert to create notification for.
|
|
80
|
+
*/
|
|
81
|
+
budgetAlertId: string;
|
|
82
|
+
/**
|
|
83
|
+
* List of phone numbers to receive sms notifications.
|
|
84
|
+
*
|
|
85
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
86
|
+
*/
|
|
87
|
+
smsPhoneNumbers?: string[];
|
|
88
|
+
/**
|
|
89
|
+
* List of email addresses to receive email notifications.
|
|
90
|
+
*
|
|
91
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
92
|
+
*/
|
|
93
|
+
emailAddresses?: string[];
|
|
94
|
+
/**
|
|
95
|
+
* List of webhook url to receive webhook notifications.
|
|
96
|
+
*
|
|
97
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
98
|
+
*/
|
|
99
|
+
webhookUrls?: string[];
|
|
100
|
+
};
|
|
101
|
+
export type CreateBudgetAlertRequest = {
|
|
102
|
+
/**
|
|
103
|
+
* The ID of the budget to create alert for.
|
|
104
|
+
*/
|
|
105
|
+
budgetId: string;
|
|
106
|
+
/**
|
|
107
|
+
* Threshold above which the alert is sent.
|
|
108
|
+
*/
|
|
109
|
+
threshold: number;
|
|
110
|
+
};
|
|
111
|
+
export type CreateBudgetRequest = {
|
|
112
|
+
/**
|
|
113
|
+
* The Organization ID of the budget.
|
|
114
|
+
*/
|
|
115
|
+
organizationId?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Cost limit for the budget.
|
|
118
|
+
*/
|
|
119
|
+
consumptionLimit: number;
|
|
120
|
+
/**
|
|
121
|
+
* Whether the budget is enabled or not.
|
|
122
|
+
*/
|
|
123
|
+
enabled: boolean;
|
|
124
|
+
};
|
|
125
|
+
export type DeleteBudgetAlertNotificationRequest = {
|
|
126
|
+
/**
|
|
127
|
+
* The ID of the budget alert notification to delete.
|
|
128
|
+
*/
|
|
129
|
+
budgetAlertNotificationId: string;
|
|
130
|
+
};
|
|
131
|
+
export type DeleteBudgetAlertRequest = {
|
|
132
|
+
/**
|
|
133
|
+
* The ID of the budget alert to delete.
|
|
134
|
+
*/
|
|
135
|
+
budgetAlertId: string;
|
|
136
|
+
};
|
|
137
|
+
export type DeleteBudgetRequest = {
|
|
138
|
+
/**
|
|
139
|
+
* The ID of the budget to delete.
|
|
140
|
+
*/
|
|
141
|
+
budgetId: string;
|
|
142
|
+
};
|
|
143
|
+
export type GetBudgetRequest = {
|
|
144
|
+
/**
|
|
145
|
+
* The ID of the budget.
|
|
146
|
+
*/
|
|
147
|
+
budgetId: string;
|
|
148
|
+
};
|
|
149
|
+
export type ListBudgetsRequest = {
|
|
150
|
+
/**
|
|
151
|
+
* Filter by organization ID.
|
|
152
|
+
*/
|
|
153
|
+
organizationId?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Page number.
|
|
156
|
+
*/
|
|
157
|
+
page?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Positive integer to select the number of items to return.
|
|
160
|
+
*/
|
|
161
|
+
pageSize?: number;
|
|
162
|
+
};
|
|
163
|
+
export interface ListBudgetsResponse {
|
|
164
|
+
/**
|
|
165
|
+
* Detailed budget list.
|
|
166
|
+
*/
|
|
167
|
+
budgets: Budget[];
|
|
168
|
+
/**
|
|
169
|
+
* Total number of items.
|
|
170
|
+
*/
|
|
171
|
+
totalCount: number;
|
|
172
|
+
}
|
|
173
|
+
export type UpdateBudgetAlertNotificationRequest = {
|
|
174
|
+
/**
|
|
175
|
+
* The ID of the budget alert notification to update.
|
|
176
|
+
*/
|
|
177
|
+
budgetAlertNotificationId: string;
|
|
178
|
+
/**
|
|
179
|
+
* List of phone numbers to receive sms notifications.
|
|
180
|
+
*
|
|
181
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
182
|
+
*/
|
|
183
|
+
smsPhoneNumbers?: string[];
|
|
184
|
+
/**
|
|
185
|
+
* List of email addresses to receive email notifications.
|
|
186
|
+
*
|
|
187
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
188
|
+
*/
|
|
189
|
+
emailAddresses?: string[];
|
|
190
|
+
/**
|
|
191
|
+
* List of webhook url to receive webhook notifications.
|
|
192
|
+
*
|
|
193
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
194
|
+
*/
|
|
195
|
+
webhookUrls?: string[];
|
|
196
|
+
};
|
|
197
|
+
export type UpdateBudgetAlertRequest = {
|
|
198
|
+
/**
|
|
199
|
+
* The ID of the budget alert to update.
|
|
200
|
+
*/
|
|
201
|
+
budgetAlertId: string;
|
|
202
|
+
/**
|
|
203
|
+
* Threshold above which the alert is sent.
|
|
204
|
+
*/
|
|
205
|
+
threshold: number;
|
|
206
|
+
};
|
|
207
|
+
export type UpdateBudgetRequest = {
|
|
208
|
+
/**
|
|
209
|
+
* The ID of the budget to update.
|
|
210
|
+
*/
|
|
211
|
+
budgetId: string;
|
|
212
|
+
/**
|
|
213
|
+
* Cost limit for the budget.
|
|
214
|
+
*/
|
|
215
|
+
consumptionLimit?: number;
|
|
216
|
+
/**
|
|
217
|
+
* Whether the budget will be enabled or not.
|
|
218
|
+
*/
|
|
219
|
+
enabled?: boolean;
|
|
220
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const CreateBudgetAlertRequest: {
|
|
2
|
+
threshold: {
|
|
3
|
+
greaterThanOrEqual: number;
|
|
4
|
+
lessThanOrEqual: number;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const UpdateBudgetAlertRequest: {
|
|
8
|
+
threshold: {
|
|
9
|
+
greaterThanOrEqual: number;
|
|
10
|
+
lessThanOrEqual: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region src/v2/validation-rules.gen.ts
|
|
3
|
+
var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
CreateBudgetAlertRequest: () => CreateBudgetAlertRequest,
|
|
5
|
+
UpdateBudgetAlertRequest: () => UpdateBudgetAlertRequest
|
|
6
|
+
});
|
|
7
|
+
const CreateBudgetAlertRequest = { threshold: {
|
|
8
|
+
greaterThanOrEqual: 1,
|
|
9
|
+
lessThanOrEqual: 100
|
|
10
|
+
} };
|
|
11
|
+
const UpdateBudgetAlertRequest = { threshold: {
|
|
12
|
+
greaterThanOrEqual: 1,
|
|
13
|
+
lessThanOrEqual: 100
|
|
14
|
+
} };
|
|
15
|
+
//#endregion
|
|
16
|
+
export { CreateBudgetAlertRequest, UpdateBudgetAlertRequest, validation_rules_gen_exports };
|