Skip to content

Commit 126b339

Browse files
committed
feat: update generated APIs
1 parent f794692 commit 126b339

File tree

6 files changed

+438
-56
lines changed

6 files changed

+438
-56
lines changed

packages/clients/src/api/interlink/v1beta1/api.gen.ts

Lines changed: 130 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ import {
55
enrichForPagination,
66
urlParams,
77
validatePathParam,
8+
waitForResource,
89
} from '@scaleway/sdk-client'
9-
import type { Region as ScwRegion } from '@scaleway/sdk-client'
10+
import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client'
11+
import {
12+
DEDICATED_CONNECTION_TRANSIENT_STATUSES as DEDICATED_CONNECTION_TRANSIENT_STATUSES_INTERLINK,
13+
LINK_TRANSIENT_STATUSES as LINK_TRANSIENT_STATUSES_INTERLINK,
14+
} from './content.gen'
1015
import {
1116
marshalAttachRoutingPolicyRequest,
1217
marshalAttachVpcRequest,
1318
marshalCreateLinkRequest,
1419
marshalCreateRoutingPolicyRequest,
1520
marshalUpdateLinkRequest,
1621
marshalUpdateRoutingPolicyRequest,
22+
unmarshalDedicatedConnection,
1723
unmarshalLink,
24+
unmarshalListDedicatedConnectionsResponse,
1825
unmarshalListLinksResponse,
1926
unmarshalListPartnersResponse,
2027
unmarshalListPopsResponse,
@@ -28,17 +35,21 @@ import type {
2835
AttachVpcRequest,
2936
CreateLinkRequest,
3037
CreateRoutingPolicyRequest,
38+
DedicatedConnection,
3139
DeleteLinkRequest,
3240
DeleteRoutingPolicyRequest,
3341
DetachRoutingPolicyRequest,
3442
DetachVpcRequest,
3543
DisableRoutePropagationRequest,
3644
EnableRoutePropagationRequest,
45+
GetDedicatedConnectionRequest,
3746
GetLinkRequest,
3847
GetPartnerRequest,
3948
GetPopRequest,
4049
GetRoutingPolicyRequest,
4150
Link,
51+
ListDedicatedConnectionsRequest,
52+
ListDedicatedConnectionsResponse,
4253
ListLinksRequest,
4354
ListLinksResponse,
4455
ListPartnersRequest,
@@ -72,6 +83,91 @@ export class API extends ParentAPI {
7283
'pl-waw',
7384
]
7485

86+
protected pageOfListDedicatedConnections = (
87+
request: Readonly<ListDedicatedConnectionsRequest> = {},
88+
) =>
89+
this.client.fetch<ListDedicatedConnectionsResponse>(
90+
{
91+
method: 'GET',
92+
path: `/interlink/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/dedicated-connections`,
93+
urlParams: urlParams(
94+
['bandwidth_mbps', request.bandwidthMbps],
95+
['name', request.name],
96+
['order_by', request.orderBy],
97+
['organization_id', request.organizationId],
98+
['page', request.page],
99+
[
100+
'page_size',
101+
request.pageSize ?? this.client.settings.defaultPageSize,
102+
],
103+
['pop_id', request.popId],
104+
['project_id', request.projectId],
105+
['status', request.status],
106+
['tags', request.tags],
107+
),
108+
},
109+
unmarshalListDedicatedConnectionsResponse,
110+
)
111+
112+
/**
113+
* List dedicated connections. For self-hosted users, list their dedicated
114+
* physical connections in a given region. By default, the connections
115+
* returned in the list are ordered by name in ascending order, though this
116+
* can be modified via the `order_by` field.
117+
*
118+
* @param request - The request {@link ListDedicatedConnectionsRequest}
119+
* @returns A Promise of ListDedicatedConnectionsResponse
120+
*/
121+
listDedicatedConnections = (
122+
request: Readonly<ListDedicatedConnectionsRequest> = {},
123+
) =>
124+
enrichForPagination(
125+
'connections',
126+
this.pageOfListDedicatedConnections,
127+
request,
128+
)
129+
130+
/**
131+
* Get a dedicated connection. For self-hosted users, get a dedicated physical
132+
* connection corresponding to the given ID. The response object includes
133+
* information such as the connection's name, status and total bandwidth.
134+
*
135+
* @param request - The request {@link GetDedicatedConnectionRequest}
136+
* @returns A Promise of DedicatedConnection
137+
*/
138+
getDedicatedConnection = (request: Readonly<GetDedicatedConnectionRequest>) =>
139+
this.client.fetch<DedicatedConnection>(
140+
{
141+
method: 'GET',
142+
path: `/interlink/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/dedicated-connections/${validatePathParam('connectionId', request.connectionId)}`,
143+
},
144+
unmarshalDedicatedConnection,
145+
)
146+
147+
/**
148+
* Waits for {@link DedicatedConnection} to be in a final state.
149+
*
150+
* @param request - The request {@link GetDedicatedConnectionRequest}
151+
* @param options - The waiting options
152+
* @returns A Promise of DedicatedConnection
153+
*/
154+
waitForDedicatedConnection = (
155+
request: Readonly<GetDedicatedConnectionRequest>,
156+
options?: Readonly<WaitForOptions<DedicatedConnection>>,
157+
) =>
158+
waitForResource(
159+
options?.stop ??
160+
(res =>
161+
Promise.resolve(
162+
!DEDICATED_CONNECTION_TRANSIENT_STATUSES_INTERLINK.includes(
163+
res.status,
164+
),
165+
)),
166+
this.getDedicatedConnection,
167+
request,
168+
options,
169+
)
170+
75171
protected pageOfListPartners = (
76172
request: Readonly<ListPartnersRequest> = {},
77173
) =>
@@ -126,6 +222,7 @@ export class API extends ParentAPI {
126222
method: 'GET',
127223
path: `/interlink/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pops`,
128224
urlParams: urlParams(
225+
['dedicated_available', request.dedicatedAvailable],
129226
['hosting_provider_name', request.hostingProviderName],
130227
['link_bandwidth_mbps', request.linkBandwidthMbps],
131228
['name', request.name],
@@ -176,6 +273,8 @@ export class API extends ParentAPI {
176273
['bandwidth_mbps', request.bandwidthMbps],
177274
['bgp_v4_status', request.bgpV4Status],
178275
['bgp_v6_status', request.bgpV6Status],
276+
['connection_id', request.connectionId],
277+
['kind', request.kind],
179278
['name', request.name],
180279
['order_by', request.orderBy],
181280
['organization_id', request.organizationId],
@@ -208,9 +307,9 @@ export class API extends ParentAPI {
208307
enrichForPagination('links', this.pageOfListLinks, request)
209308

210309
/**
211-
* Get a link. Get a link (InterLink connection) for the given link ID. The
212-
* response object includes information about the link's various configuration
213-
* details.
310+
* Get a link. Get a link (InterLink session / logical InterLink resource) for
311+
* the given link ID. The response object includes information about the
312+
* link's various configuration details.
214313
*
215314
* @param request - The request {@link GetLinkRequest}
216315
* @returns A Promise of Link
@@ -225,10 +324,33 @@ export class API extends ParentAPI {
225324
)
226325

227326
/**
228-
* Create a link. Create a link (InterLink connection) in a given PoP,
229-
* specifying its various configuration details. For the moment only hosted
230-
* links (faciliated by partners) are available, though in the future
231-
* dedicated and shared links will also be possible.
327+
* Waits for {@link Link} to be in a final state.
328+
*
329+
* @param request - The request {@link GetLinkRequest}
330+
* @param options - The waiting options
331+
* @returns A Promise of Link
332+
*/
333+
waitForLink = (
334+
request: Readonly<GetLinkRequest>,
335+
options?: Readonly<WaitForOptions<Link>>,
336+
) =>
337+
waitForResource(
338+
options?.stop ??
339+
(res =>
340+
Promise.resolve(
341+
!LINK_TRANSIENT_STATUSES_INTERLINK.includes(res.status),
342+
)),
343+
this.getLink,
344+
request,
345+
options,
346+
)
347+
348+
/**
349+
* Create a link. Create a link (InterLink session / logical InterLink
350+
* resource) in a given PoP, specifying its various configuration details.
351+
* Links can either be hosted (faciliated by partners' shared physical
352+
* connections) or self-hosted (for users who have purchased a dedicated
353+
* physical connection).
232354
*
233355
* @param request - The request {@link CreateLinkRequest}
234356
* @returns A Promise of Link
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
import type { DedicatedConnectionStatus, LinkStatus } from './types.gen'
4+
5+
/** Lists transient statutes of the enum {@link DedicatedConnectionStatus}. */
6+
export const DEDICATED_CONNECTION_TRANSIENT_STATUSES: DedicatedConnectionStatus[] =
7+
['configuring']
8+
9+
/** Lists transient statutes of the enum {@link LinkStatus}. */
10+
export const LINK_TRANSIENT_STATUSES: LinkStatus[] = ['configuring']

packages/clients/src/api/interlink/v1beta1/index.gen.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
// This file was automatically generated. DO NOT EDIT.
22
// If you have any remark or suggestion do not hesitate to open an issue.
33
export { API } from './api.gen'
4+
export * from './content.gen'
45
export type {
56
AttachRoutingPolicyRequest,
67
AttachVpcRequest,
8+
BgpConfig,
79
BgpStatus,
810
CreateLinkRequest,
911
CreateRoutingPolicyRequest,
12+
DedicatedConnection,
13+
DedicatedConnectionStatus,
1014
DeleteLinkRequest,
1115
DeleteRoutingPolicyRequest,
1216
DetachRoutingPolicyRequest,
1317
DetachVpcRequest,
1418
DisableRoutePropagationRequest,
1519
EnableRoutePropagationRequest,
20+
GetDedicatedConnectionRequest,
1621
GetLinkRequest,
1722
GetPartnerRequest,
1823
GetPopRequest,
1924
GetRoutingPolicyRequest,
2025
Link,
26+
LinkKind,
2127
LinkStatus,
28+
ListDedicatedConnectionsRequest,
29+
ListDedicatedConnectionsRequestOrderBy,
30+
ListDedicatedConnectionsResponse,
2231
ListLinksRequest,
2332
ListLinksRequestOrderBy,
2433
ListLinksResponse,
@@ -32,8 +41,10 @@ export type {
3241
ListRoutingPoliciesRequestOrderBy,
3342
ListRoutingPoliciesResponse,
3443
Partner,
44+
PartnerHost,
3545
Pop,
3646
RoutingPolicy,
47+
SelfHost,
3748
UpdateLinkRequest,
3849
UpdateRoutingPolicyRequest,
3950
} from './types.gen'

0 commit comments

Comments
 (0)