Skip to content

Commit ddacf80

Browse files
authored
Merge branch 'main' into v1.6631.0
2 parents 7761942 + 791f49d commit ddacf80

File tree

10 files changed

+158
-51
lines changed

10 files changed

+158
-51
lines changed

packages_generated/billing/src/v2beta1/api.gen.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ import {
88
validatePathParam,
99
} from '@scaleway/sdk-client'
1010
import {
11+
unmarshalDiscount,
1112
unmarshalInvoice,
1213
unmarshalListConsumptionsResponse,
1314
unmarshalListDiscountsResponse,
1415
unmarshalListInvoicesResponse,
1516
unmarshalListTaxesResponse,
1617
} from './marshalling.gen'
1718
import type {
19+
Discount,
1820
DownloadInvoiceRequest,
1921
ExportInvoicesRequest,
2022
GetInvoiceRequest,
@@ -27,6 +29,7 @@ import type {
2729
ListInvoicesResponse,
2830
ListTaxesRequest,
2931
ListTaxesResponse,
32+
RedeemCouponRequest,
3033
} from './types.gen'
3134

3235
/**
@@ -227,4 +230,27 @@ export class API extends ParentAPI {
227230
*/
228231
listDiscounts = (request: Readonly<ListDiscountsRequest> = {}) =>
229232
enrichForPagination('discounts', this.pageOfListDiscounts, request)
233+
234+
/**
235+
* Redeem coupon. Redeem a coupon given the related code.
236+
*
237+
* @param request - The request {@link RedeemCouponRequest}
238+
* @returns A Promise of Discount
239+
*/
240+
redeemCoupon = (request: Readonly<RedeemCouponRequest>) =>
241+
this.client.fetch<Discount>(
242+
{
243+
method: 'POST',
244+
path: `/billing/v2beta1/redeem-coupon`,
245+
urlParams: urlParams(
246+
['code', request.code],
247+
[
248+
'organization_id',
249+
request.organizationId ??
250+
this.client.settings.defaultOrganizationId,
251+
],
252+
),
253+
},
254+
unmarshalDiscount,
255+
)
230256
}

packages_generated/billing/src/v2beta1/marshalling.gen.ts

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,55 @@ import type {
1919
ListTaxesResponseTax,
2020
} from './types.gen'
2121

22+
const unmarshalDiscountCoupon = (data: unknown): DiscountCoupon => {
23+
if (!isJSONObject(data)) {
24+
throw new TypeError(
25+
`Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary.`,
26+
)
27+
}
28+
29+
return {
30+
description: data.description,
31+
} as DiscountCoupon
32+
}
33+
34+
const unmarshalDiscountFilter = (data: unknown): DiscountFilter => {
35+
if (!isJSONObject(data)) {
36+
throw new TypeError(
37+
`Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary.`,
38+
)
39+
}
40+
41+
return {
42+
exclude: data.exclude,
43+
type: data.type,
44+
value: data.value,
45+
} as DiscountFilter
46+
}
47+
48+
export const unmarshalDiscount = (data: unknown): Discount => {
49+
if (!isJSONObject(data)) {
50+
throw new TypeError(
51+
`Unmarshalling the type 'Discount' failed as data isn't a dictionary.`,
52+
)
53+
}
54+
55+
return {
56+
coupon: data.coupon ? unmarshalDiscountCoupon(data.coupon) : undefined,
57+
creationDate: unmarshalDate(data.creation_date),
58+
description: data.description,
59+
filters: unmarshalArrayOfObject(data.filters, unmarshalDiscountFilter),
60+
id: data.id,
61+
mode: data.mode,
62+
organizationId: data.organization_id,
63+
startDate: unmarshalDate(data.start_date),
64+
stopDate: unmarshalDate(data.stop_date),
65+
value: data.value,
66+
valueRemaining: data.value_remaining,
67+
valueUsed: data.value_used,
68+
} as Discount
69+
}
70+
2271
export const unmarshalInvoice = (data: unknown): Invoice => {
2372
if (!isJSONObject(data)) {
2473
throw new TypeError(
@@ -94,55 +143,6 @@ export const unmarshalListConsumptionsResponse = (
94143
} as ListConsumptionsResponse
95144
}
96145

97-
const unmarshalDiscountCoupon = (data: unknown): DiscountCoupon => {
98-
if (!isJSONObject(data)) {
99-
throw new TypeError(
100-
`Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary.`,
101-
)
102-
}
103-
104-
return {
105-
description: data.description,
106-
} as DiscountCoupon
107-
}
108-
109-
const unmarshalDiscountFilter = (data: unknown): DiscountFilter => {
110-
if (!isJSONObject(data)) {
111-
throw new TypeError(
112-
`Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary.`,
113-
)
114-
}
115-
116-
return {
117-
exclude: data.exclude,
118-
type: data.type,
119-
value: data.value,
120-
} as DiscountFilter
121-
}
122-
123-
const unmarshalDiscount = (data: unknown): Discount => {
124-
if (!isJSONObject(data)) {
125-
throw new TypeError(
126-
`Unmarshalling the type 'Discount' failed as data isn't a dictionary.`,
127-
)
128-
}
129-
130-
return {
131-
coupon: data.coupon ? unmarshalDiscountCoupon(data.coupon) : undefined,
132-
creationDate: unmarshalDate(data.creation_date),
133-
description: data.description,
134-
filters: unmarshalArrayOfObject(data.filters, unmarshalDiscountFilter),
135-
id: data.id,
136-
mode: data.mode,
137-
organizationId: data.organization_id,
138-
startDate: unmarshalDate(data.start_date),
139-
stopDate: unmarshalDate(data.stop_date),
140-
value: data.value,
141-
valueRemaining: data.value_remaining,
142-
valueUsed: data.value_used,
143-
} as Discount
144-
}
145-
146146
export const unmarshalListDiscountsResponse = (
147147
data: unknown,
148148
): ListDiscountsResponse => {

packages_generated/billing/src/v2beta1/types.gen.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,3 +480,14 @@ export interface ListTaxesResponse {
480480
*/
481481
updatedAt?: Date
482482
}
483+
484+
export type RedeemCouponRequest = {
485+
/**
486+
* The Organization ID of the discount.
487+
*/
488+
organizationId?: string
489+
/**
490+
* The code of the coupon to redeem.
491+
*/
492+
code: string
493+
}

packages_generated/function/src/v1beta1/api.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export class API extends ParentAPI {
185185
* @param request - The request {@link CreateNamespaceRequest}
186186
* @returns A Promise of Namespace
187187
*/
188-
createNamespace = (request: Readonly<CreateNamespaceRequest> = {}) =>
188+
createNamespace = (request: Readonly<CreateNamespaceRequest>) =>
189189
this.client.fetch<Namespace>(
190190
{
191191
body: JSON.stringify(

packages_generated/function/src/v1beta1/marshalling.gen.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export const unmarshalFunction = (data: unknown): Function => {
117117
name: data.name,
118118
namespaceId: data.namespace_id,
119119
privacy: data.privacy,
120+
privateNetworkId: data.private_network_id,
120121
readyAt: unmarshalDate(data.ready_at),
121122
region: data.region,
122123
runtime: data.runtime,
@@ -159,6 +160,7 @@ export const unmarshalNamespace = (data: unknown): Namespace => {
159160
status: data.status,
160161
tags: data.tags,
161162
updatedAt: unmarshalDate(data.updated_at),
163+
vpcIntegrationActivated: data.vpc_integration_activated,
162164
} as Namespace
163165
}
164166

@@ -452,6 +454,7 @@ export const marshalCreateFunctionRequest = (
452454
name: request.name || randomName('fn'),
453455
namespace_id: request.namespaceId,
454456
privacy: request.privacy,
457+
private_network_id: request.privateNetworkId,
455458
runtime: request.runtime,
456459
sandbox: request.sandbox,
457460
secret_environment_variables:
@@ -468,6 +471,7 @@ export const marshalCreateNamespaceRequest = (
468471
request: CreateNamespaceRequest,
469472
defaults: DefaultValues,
470473
): Record<string, unknown> => ({
474+
activate_vpc_integration: request.activateVpcIntegration,
471475
description: request.description,
472476
environment_variables: request.environmentVariables,
473477
name: request.name || randomName('ns'),
@@ -585,6 +589,7 @@ export const marshalUpdateFunctionRequest = (
585589
memory_limit: request.memoryLimit,
586590
min_scale: request.minScale,
587591
privacy: request.privacy,
592+
private_network_id: request.privateNetworkId,
588593
redeploy: request.redeploy,
589594
runtime: request.runtime,
590595
sandbox: request.sandbox,

packages_generated/function/src/v1beta1/types.gen.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ export interface Function {
409409
* List of tags applied to the Serverless Function.
410410
*/
411411
tags: string[]
412+
/**
413+
* When connected to a Private Network, the function can access other Scaleway resources in this Private Network.
414+
*/
415+
privateNetworkId?: string
412416
}
413417

414418
export interface Namespace {
@@ -472,6 +476,11 @@ export interface Namespace {
472476
* Last update date of the namespace.
473477
*/
474478
updatedAt?: Date
479+
/**
480+
* @deprecated When activated, functions in the namespace can be connected to a Private Network.
481+
Note that activating the VPC integration can only be done when creating a new namespace.
482+
*/
483+
vpcIntegrationActivated?: boolean
475484
}
476485

477486
export interface Token {
@@ -669,6 +678,12 @@ export type CreateFunctionRequest = {
669678
* Tags of the Serverless Function.
670679
*/
671680
tags?: string[]
681+
/**
682+
* When connected to a Private Network, the function can access other Scaleway resources in this Private Network.
683+
684+
Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag.
685+
*/
686+
privateNetworkId?: string
672687
}
673688

674689
export type CreateNamespaceRequest = {
@@ -697,6 +712,10 @@ export type CreateNamespaceRequest = {
697712
* Tags of the Serverless Function Namespace.
698713
*/
699714
tags?: string[]
715+
/**
716+
* When activated, functions in the namespace can be connected to a Private Network.
717+
*/
718+
activateVpcIntegration: boolean
700719
}
701720

702721
export type CreateTokenRequest = {
@@ -1282,6 +1301,12 @@ export type UpdateFunctionRequest = {
12821301
* Tags of the Serverless Function.
12831302
*/
12841303
tags?: string[]
1304+
/**
1305+
* When connected to a Private Network, the function can access other Scaleway resources in this Private Network.
1306+
1307+
Note: this feature is currently in beta and requires a namespace with VPC integration activated, using the `activate_vpc_integration` flag.
1308+
*/
1309+
privateNetworkId?: string
12851310
}
12861311

12871312
export type UpdateNamespaceRequest = {

packages_generated/iam/src/v1alpha1/validation-rules.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export const ListUsersRequest = {
226226

227227
export const RuleSpecs = {
228228
condition: {
229-
maxLength: 1024,
229+
maxLength: 2048,
230230
},
231231
}
232232

packages_generated/instance/src/v1/content.gen.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
IpState,
66
PrivateNICState,
77
SecurityGroupState,
8+
ServerFilesystemState,
89
ServerIpState,
910
ServerState,
1011
SnapshotState,
@@ -27,6 +28,12 @@ export const SECURITY_GROUP_TRANSIENT_STATUSES: SecurityGroupState[] = [
2728
'syncing',
2829
]
2930

31+
/** Lists transient statutes of the enum {@link ServerFilesystemState}. */
32+
export const SERVER_FILESYSTEM_TRANSIENT_STATUSES: ServerFilesystemState[] = [
33+
'attaching',
34+
'detaching',
35+
]
36+
3037
/** Lists transient statutes of the enum {@link ServerIpState}. */
3138
export const SERVER_IP_TRANSIENT_STATUSES: ServerIpState[] = ['pending']
3239

packages_generated/instance/src/v1/marshalling.gen.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ import type {
8484
ServerActionRequestVolumeBackupTemplate,
8585
ServerActionResponse,
8686
ServerCompatibleTypes,
87+
ServerFilesystem,
8788
ServerIp,
8889
ServerIpv6,
8990
ServerLocation,
@@ -303,6 +304,19 @@ const unmarshalSecurityGroupSummary = (data: unknown): SecurityGroupSummary => {
303304
} as SecurityGroupSummary
304305
}
305306

307+
const unmarshalServerFilesystem = (data: unknown): ServerFilesystem => {
308+
if (!isJSONObject(data)) {
309+
throw new TypeError(
310+
`Unmarshalling the type 'ServerFilesystem' failed as data isn't a dictionary.`,
311+
)
312+
}
313+
314+
return {
315+
filesystemId: data.filesystem_id,
316+
state: data.state,
317+
} as ServerFilesystem
318+
}
319+
306320
const unmarshalServerIp = (data: unknown): ServerIp => {
307321
if (!isJSONObject(data)) {
308322
throw new TypeError(
@@ -409,6 +423,10 @@ const unmarshalServer = (data: unknown): Server => {
409423
dynamicIpRequired: data.dynamic_ip_required,
410424
enableIpv6: data.enable_ipv6,
411425
endOfService: data.end_of_service,
426+
filesystems: unmarshalArrayOfObject(
427+
data.filesystems,
428+
unmarshalServerFilesystem,
429+
),
412430
hostname: data.hostname,
413431
id: data.id,
414432
image: data.image ? unmarshalImage(data.image) : undefined,

packages_generated/instance/src/v1/types.gen.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ export type ServerAction =
6262
| 'reboot'
6363
| 'enable_routed_ip'
6464

65+
export type ServerFilesystemState =
66+
| 'unknown_state'
67+
| 'attaching'
68+
| 'available'
69+
| 'detaching'
70+
6571
export type ServerIpIpFamily = 'inet' | 'inet6'
6672

6773
export type ServerIpProvisioningMode = 'manual' | 'dhcp' | 'slaac'
@@ -334,6 +340,11 @@ export interface SecurityGroupSummary {
334340
name: string
335341
}
336342

343+
export interface ServerFilesystem {
344+
filesystemId: string
345+
state: ServerFilesystemState
346+
}
347+
337348
export interface ServerIp {
338349
/**
339350
* Unique ID of the IP address.
@@ -636,6 +647,10 @@ export interface Server {
636647
* This value is reset when admin_password_encryption_ssh_key_id is set to an empty string.
637648
*/
638649
adminPasswordEncryptedValue?: string
650+
/**
651+
* List of attached filesystems.
652+
*/
653+
filesystems: ServerFilesystem[]
639654
/**
640655
* True if the Instance type has reached end of service.
641656
*/

0 commit comments

Comments
 (0)