Skip to content

Commit f7b93a1

Browse files
authored
Merge branch 'main' into v1.7016.0
2 parents 7127002 + 8c2303e commit f7b93a1

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
marshalCreateLinkRequest,
2121
marshalCreateRoutingPolicyRequest,
2222
marshalDetachRoutingPolicyRequest,
23+
marshalSetRoutingPolicyRequest,
2324
marshalUpdateLinkRequest,
2425
marshalUpdateRoutingPolicyRequest,
2526
unmarshalDedicatedConnection,
@@ -64,6 +65,7 @@ import type {
6465
Partner,
6566
Pop,
6667
RoutingPolicy,
68+
SetRoutingPolicyRequest,
6769
UpdateLinkRequest,
6870
UpdateRoutingPolicyRequest,
6971
} from './types.gen'
@@ -461,6 +463,25 @@ export class API extends ParentAPI {
461463
unmarshalLink,
462464
)
463465

466+
/**
467+
* Set a routing policy. Replace a routing policy from an existing link. This is usefull when route propagation is enabled because it changes the routing policy "in place", without blocking all routes like a attach / detach would do.
468+
*
469+
* @param request - The request {@link SetRoutingPolicyRequest}
470+
* @returns A Promise of Link
471+
*/
472+
setRoutingPolicy = (request: Readonly<SetRoutingPolicyRequest>) =>
473+
this.client.fetch<Link>(
474+
{
475+
body: JSON.stringify(
476+
marshalSetRoutingPolicyRequest(request, this.client.settings),
477+
),
478+
headers: jsonContentHeaders,
479+
method: 'POST',
480+
path: `/interlink/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/links/${validatePathParam('linkId', request.linkId)}/set-routing-policy`,
481+
},
482+
unmarshalLink,
483+
)
484+
464485
/**
465486
* Enable route propagation. Enable all allowed prefixes (defined in a routing policy) to be announced in the BGP session. This allows traffic to flow between the attached VPC and the on-premises infrastructure along the announced routes. Note that by default, even when route propagation is enabled, all routes are blocked. It is essential to attach a routing policy to define the ranges of routes to announce.
466487
*

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import type {
2727
Pop,
2828
RoutingPolicy,
2929
SelfHost,
30+
SetRoutingPolicyRequest,
3031
UpdateLinkRequest,
3132
UpdateRoutingPolicyRequest,
3233
} from './types.gen'
@@ -296,6 +297,8 @@ export const marshalCreateLinkRequest = (
296297
peer_asn: request.peerAsn,
297298
pop_id: request.popId,
298299
project_id: request.projectId ?? defaults.defaultProjectId,
300+
routing_policy_v4_id: request.routingPolicyV4Id,
301+
routing_policy_v6_id: request.routingPolicyV6Id,
299302
tags: request.tags,
300303
vlan: request.vlan,
301304
...resolveOneOf([
@@ -323,6 +326,13 @@ export const marshalDetachRoutingPolicyRequest = (
323326
routing_policy_id: request.routingPolicyId,
324327
})
325328

329+
export const marshalSetRoutingPolicyRequest = (
330+
request: SetRoutingPolicyRequest,
331+
defaults: DefaultValues,
332+
): Record<string, unknown> => ({
333+
routing_policy_id: request.routingPolicyId,
334+
})
335+
326336
export const marshalUpdateLinkRequest = (
327337
request: UpdateLinkRequest,
328338
defaults: DefaultValues,

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// If you have any remark or suggestion do not hesitate to open an issue.
33
import type { Region as ScwRegion } from '@scaleway/sdk-client'
44

5-
export type BgpStatus = 'unknown_bgp_status' | 'up' | 'down'
5+
export type BgpStatus = 'unknown_bgp_status' | 'up' | 'down' | 'disabled'
66

77
export type DedicatedConnectionStatus =
88
| 'unknown_status'
@@ -30,6 +30,7 @@ export type LinkStatus =
3030
| 'deprovisioning'
3131
| 'deleted'
3232
| 'locked'
33+
| 'ready'
3334

3435
export type ListDedicatedConnectionsRequestOrderBy =
3536
| 'created_at_asc'
@@ -438,6 +439,14 @@ export type CreateLinkRequest = {
438439
* For self-hosted links only, it is possible to choose the VLAN ID. If the VLAN is not available (ie already taken or out of range), an error is returned.
439440
*/
440441
vlan?: number
442+
/**
443+
* If set, attaches this routing policy containing IPv4 prefixes to the Link. Hence, a BGP IPv4 session will be created.
444+
*/
445+
routingPolicyV4Id?: string
446+
/**
447+
* If set, attaches this routing policy containing IPv6 prefixes to the Link. Hence, a BGP IPv6 session will be created.
448+
*/
449+
routingPolicyV6Id?: string
441450
}
442451

443452
export type CreateRoutingPolicyRequest = {
@@ -872,6 +881,21 @@ export interface ListRoutingPoliciesResponse {
872881
totalCount: number
873882
}
874883

884+
export type SetRoutingPolicyRequest = {
885+
/**
886+
* Region to target. If none is passed will use default region from the config.
887+
*/
888+
region?: ScwRegion
889+
/**
890+
* ID of the link to set a routing policy from.
891+
*/
892+
linkId: string
893+
/**
894+
* ID of the routing policy to be set.
895+
*/
896+
routingPolicyId: string
897+
}
898+
875899
export type UpdateLinkRequest = {
876900
/**
877901
* Region to target. If none is passed will use default region from the config.

0 commit comments

Comments
 (0)