@@ -507,6 +507,9 @@ type VPC struct {
507507
508508 // RoutingEnabled: defines whether the VPC routes traffic between its Private Networks.
509509 RoutingEnabled bool `json:"routing_enabled"`
510+
511+ // CustomRoutesPropagationEnabled: defines whether the VPC advertises custom routes between its Private Networks.
512+ CustomRoutesPropagationEnabled bool `json:"custom_routes_propagation_enabled"`
510513}
511514
512515// AddSubnetsRequest: add subnets request.
@@ -636,6 +639,15 @@ type DeleteVPCRequest struct {
636639 VpcID string `json:"-"`
637640}
638641
642+ // EnableCustomRoutesPropagationRequest: enable custom routes propagation request.
643+ type EnableCustomRoutesPropagationRequest struct {
644+ // Region: region to target. If none is passed will use default region from the config.
645+ Region scw.Region `json:"-"`
646+
647+ // VpcID: vPC ID.
648+ VpcID string `json:"-"`
649+ }
650+
639651// EnableDHCPRequest: enable dhcp request.
640652type EnableDHCPRequest struct {
641653 // Region: region to target. If none is passed will use default region from the config.
@@ -1479,6 +1491,42 @@ func (s *API) EnableRouting(req *EnableRoutingRequest, opts ...scw.RequestOption
14791491 return & resp , nil
14801492}
14811493
1494+ // EnableCustomRoutesPropagation: Enable custom routes propagation on an existing VPC. Note that you will not be able to deactivate it afterwards.
1495+ func (s * API ) EnableCustomRoutesPropagation (req * EnableCustomRoutesPropagationRequest , opts ... scw.RequestOption ) (* VPC , error ) {
1496+ var err error
1497+
1498+ if req .Region == "" {
1499+ defaultRegion , _ := s .client .GetDefaultRegion ()
1500+ req .Region = defaultRegion
1501+ }
1502+
1503+ if fmt .Sprint (req .Region ) == "" {
1504+ return nil , errors .New ("field Region cannot be empty in request" )
1505+ }
1506+
1507+ if fmt .Sprint (req .VpcID ) == "" {
1508+ return nil , errors .New ("field VpcID cannot be empty in request" )
1509+ }
1510+
1511+ scwReq := & scw.ScalewayRequest {
1512+ Method : "POST" ,
1513+ Path : "/vpc/v2/regions/" + fmt .Sprint (req .Region ) + "/vpcs/" + fmt .Sprint (req .VpcID ) + "/enable-custom-routes-propagation" ,
1514+ }
1515+
1516+ err = scwReq .SetBody (req )
1517+ if err != nil {
1518+ return nil , err
1519+ }
1520+
1521+ var resp VPC
1522+
1523+ err = s .client .Do (scwReq , & resp , opts ... )
1524+ if err != nil {
1525+ return nil , err
1526+ }
1527+ return & resp , nil
1528+ }
1529+
14821530// ListSubnets: List any Private Network's subnets. See ListPrivateNetworks to list a specific Private Network's subnets.
14831531func (s * API ) ListSubnets (req * ListSubnetsRequest , opts ... scw.RequestOption ) (* ListSubnetsResponse , error ) {
14841532 var err error
0 commit comments