1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. vpc
  5. getBgpNetworks
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.vpc.getBgpNetworks

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

This data source provides the Vpc Bgp Networks of the current Alibaba Cloud user.

NOTE: Available in v1.153.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.vpc.getBgpNetworks({
    ids: ["example_value"],
});
export const vpcBgpNetworkId1 = ids.then(ids => ids.networks?.[0]?.id);
const routerId = alicloud.vpc.getBgpNetworks({
    routerId: "example_value",
});
export const vpcBgpNetworkId2 = routerId.then(routerId => routerId.networks?.[0]?.id);
const status = alicloud.vpc.getBgpNetworks({
    status: "Available",
});
export const vpcBgpNetworkId3 = status.then(status => status.networks?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.vpc.get_bgp_networks(ids=["example_value"])
pulumi.export("vpcBgpNetworkId1", ids.networks[0].id)
router_id = alicloud.vpc.get_bgp_networks(router_id="example_value")
pulumi.export("vpcBgpNetworkId2", router_id.networks[0].id)
status = alicloud.vpc.get_bgp_networks(status="Available")
pulumi.export("vpcBgpNetworkId3", status.networks[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := vpc.GetBgpNetworks(ctx, &vpc.GetBgpNetworksArgs{
			Ids: []string{
				"example_value",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcBgpNetworkId1", ids.Networks[0].Id)
		routerId, err := vpc.GetBgpNetworks(ctx, &vpc.GetBgpNetworksArgs{
			RouterId: pulumi.StringRef("example_value"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcBgpNetworkId2", routerId.Networks[0].Id)
		status, err := vpc.GetBgpNetworks(ctx, &vpc.GetBgpNetworksArgs{
			Status: pulumi.StringRef("Available"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcBgpNetworkId3", status.Networks[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.Vpc.GetBgpNetworks.Invoke(new()
    {
        Ids = new[]
        {
            "example_value",
        },
    });

    var routerId = AliCloud.Vpc.GetBgpNetworks.Invoke(new()
    {
        RouterId = "example_value",
    });

    var status = AliCloud.Vpc.GetBgpNetworks.Invoke(new()
    {
        Status = "Available",
    });

    return new Dictionary<string, object?>
    {
        ["vpcBgpNetworkId1"] = ids.Apply(getBgpNetworksResult => getBgpNetworksResult.Networks[0]?.Id),
        ["vpcBgpNetworkId2"] = routerId.Apply(getBgpNetworksResult => getBgpNetworksResult.Networks[0]?.Id),
        ["vpcBgpNetworkId3"] = status.Apply(getBgpNetworksResult => getBgpNetworksResult.Networks[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetBgpNetworksArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var ids = VpcFunctions.getBgpNetworks(GetBgpNetworksArgs.builder()
            .ids("example_value")
            .build());

        ctx.export("vpcBgpNetworkId1", ids.applyValue(getBgpNetworksResult -> getBgpNetworksResult.networks()[0].id()));
        final var routerId = VpcFunctions.getBgpNetworks(GetBgpNetworksArgs.builder()
            .routerId("example_value")
            .build());

        ctx.export("vpcBgpNetworkId2", routerId.applyValue(getBgpNetworksResult -> getBgpNetworksResult.networks()[0].id()));
        final var status = VpcFunctions.getBgpNetworks(GetBgpNetworksArgs.builder()
            .status("Available")
            .build());

        ctx.export("vpcBgpNetworkId3", status.applyValue(getBgpNetworksResult -> getBgpNetworksResult.networks()[0].id()));
    }
}
Copy
variables:
  ids:
    fn::invoke:
      function: alicloud:vpc:getBgpNetworks
      arguments:
        ids:
          - example_value
  routerId:
    fn::invoke:
      function: alicloud:vpc:getBgpNetworks
      arguments:
        routerId: example_value
  status:
    fn::invoke:
      function: alicloud:vpc:getBgpNetworks
      arguments:
        status: Available
outputs:
  vpcBgpNetworkId1: ${ids.networks[0].id}
  vpcBgpNetworkId2: ${routerId.networks[0].id}
  vpcBgpNetworkId3: ${status.networks[0].id}
Copy

Using getBgpNetworks

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getBgpNetworks(args: GetBgpNetworksArgs, opts?: InvokeOptions): Promise<GetBgpNetworksResult>
function getBgpNetworksOutput(args: GetBgpNetworksOutputArgs, opts?: InvokeOptions): Output<GetBgpNetworksResult>
Copy
def get_bgp_networks(ids: Optional[Sequence[str]] = None,
                     output_file: Optional[str] = None,
                     router_id: Optional[str] = None,
                     status: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetBgpNetworksResult
def get_bgp_networks_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                     output_file: Optional[pulumi.Input[str]] = None,
                     router_id: Optional[pulumi.Input[str]] = None,
                     status: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetBgpNetworksResult]
Copy
func GetBgpNetworks(ctx *Context, args *GetBgpNetworksArgs, opts ...InvokeOption) (*GetBgpNetworksResult, error)
func GetBgpNetworksOutput(ctx *Context, args *GetBgpNetworksOutputArgs, opts ...InvokeOption) GetBgpNetworksResultOutput
Copy

> Note: This function is named GetBgpNetworks in the Go SDK.

public static class GetBgpNetworks 
{
    public static Task<GetBgpNetworksResult> InvokeAsync(GetBgpNetworksArgs args, InvokeOptions? opts = null)
    public static Output<GetBgpNetworksResult> Invoke(GetBgpNetworksInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetBgpNetworksResult> getBgpNetworks(GetBgpNetworksArgs args, InvokeOptions options)
public static Output<GetBgpNetworksResult> getBgpNetworks(GetBgpNetworksArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:vpc/getBgpNetworks:getBgpNetworks
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Ids Changes to this property will trigger replacement. List<string>
A list of Bgp Network IDs.
OutputFile string
File name where to save data source results (after running pulumi preview).
RouterId Changes to this property will trigger replacement. string
The ID of the router to which the route table belongs.
Status Changes to this property will trigger replacement. string
The state of the advertised BGP network. Valid values: Available, Pending, Deleting.
Ids Changes to this property will trigger replacement. []string
A list of Bgp Network IDs.
OutputFile string
File name where to save data source results (after running pulumi preview).
RouterId Changes to this property will trigger replacement. string
The ID of the router to which the route table belongs.
Status Changes to this property will trigger replacement. string
The state of the advertised BGP network. Valid values: Available, Pending, Deleting.
ids Changes to this property will trigger replacement. List<String>
A list of Bgp Network IDs.
outputFile String
File name where to save data source results (after running pulumi preview).
routerId Changes to this property will trigger replacement. String
The ID of the router to which the route table belongs.
status Changes to this property will trigger replacement. String
The state of the advertised BGP network. Valid values: Available, Pending, Deleting.
ids Changes to this property will trigger replacement. string[]
A list of Bgp Network IDs.
outputFile string
File name where to save data source results (after running pulumi preview).
routerId Changes to this property will trigger replacement. string
The ID of the router to which the route table belongs.
status Changes to this property will trigger replacement. string
The state of the advertised BGP network. Valid values: Available, Pending, Deleting.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Bgp Network IDs.
output_file str
File name where to save data source results (after running pulumi preview).
router_id Changes to this property will trigger replacement. str
The ID of the router to which the route table belongs.
status Changes to this property will trigger replacement. str
The state of the advertised BGP network. Valid values: Available, Pending, Deleting.
ids Changes to this property will trigger replacement. List<String>
A list of Bgp Network IDs.
outputFile String
File name where to save data source results (after running pulumi preview).
routerId Changes to this property will trigger replacement. String
The ID of the router to which the route table belongs.
status Changes to this property will trigger replacement. String
The state of the advertised BGP network. Valid values: Available, Pending, Deleting.

getBgpNetworks Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Networks List<Pulumi.AliCloud.Vpc.Outputs.GetBgpNetworksNetwork>
OutputFile string
RouterId string
Status string
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Networks []GetBgpNetworksNetwork
OutputFile string
RouterId string
Status string
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
networks List<GetBgpNetworksNetwork>
outputFile String
routerId String
status String
id string
The provider-assigned unique ID for this managed resource.
ids string[]
networks GetBgpNetworksNetwork[]
outputFile string
routerId string
status string
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
networks Sequence[GetBgpNetworksNetwork]
output_file str
router_id str
status str
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
networks List<Property Map>
outputFile String
routerId String
status String

Supporting Types

GetBgpNetworksNetwork

DstCidrBlock This property is required. string
Advertised BGP networks.
Id This property is required. string
The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
RouterId This property is required. string
The ID of the vRouter.
Status This property is required. string
The state of the advertised BGP network.
DstCidrBlock This property is required. string
Advertised BGP networks.
Id This property is required. string
The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
RouterId This property is required. string
The ID of the vRouter.
Status This property is required. string
The state of the advertised BGP network.
dstCidrBlock This property is required. String
Advertised BGP networks.
id This property is required. String
The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
routerId This property is required. String
The ID of the vRouter.
status This property is required. String
The state of the advertised BGP network.
dstCidrBlock This property is required. string
Advertised BGP networks.
id This property is required. string
The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
routerId This property is required. string
The ID of the vRouter.
status This property is required. string
The state of the advertised BGP network.
dst_cidr_block This property is required. str
Advertised BGP networks.
id This property is required. str
The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
router_id This property is required. str
The ID of the vRouter.
status This property is required. str
The state of the advertised BGP network.
dstCidrBlock This property is required. String
Advertised BGP networks.
id This property is required. String
The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
routerId This property is required. String
The ID of the vRouter.
status This property is required. String
The state of the advertised BGP network.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi