1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. vpc
  5. getBgpNetworks
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.vpc.getBgpNetworks

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 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);
    
    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)
    
    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
    	})
    }
    
    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),
        };
    });
    
    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()));
        }
    }
    
    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}
    

    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>
    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]
    func GetBgpNetworks(ctx *Context, args *GetBgpNetworksArgs, opts ...InvokeOption) (*GetBgpNetworksResult, error)
    func GetBgpNetworksOutput(ctx *Context, args *GetBgpNetworksOutputArgs, opts ...InvokeOption) GetBgpNetworksResultOutput

    > 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)
    }
    public static CompletableFuture<GetBgpNetworksResult> getBgpNetworks(GetBgpNetworksArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:vpc/getBgpNetworks:getBgpNetworks
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of Bgp Network IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RouterId string
    The ID of the router to which the route table belongs.
    Status string
    The state of the advertised BGP network. Valid values: Available, Pending, Deleting.
    Ids []string
    A list of Bgp Network IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RouterId string
    The ID of the router to which the route table belongs.
    Status string
    The state of the advertised BGP network. Valid values: Available, Pending, Deleting.
    ids List<String>
    A list of Bgp Network IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    routerId String
    The ID of the router to which the route table belongs.
    status String
    The state of the advertised BGP network. Valid values: Available, Pending, Deleting.
    ids string[]
    A list of Bgp Network IDs.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    routerId string
    The ID of the router to which the route table belongs.
    status string
    The state of the advertised BGP network. Valid values: Available, Pending, Deleting.
    ids 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 str
    The ID of the router to which the route table belongs.
    status str
    The state of the advertised BGP network. Valid values: Available, Pending, Deleting.
    ids List<String>
    A list of Bgp Network IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    routerId String
    The ID of the router to which the route table belongs.
    status 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 string
    Advertised BGP networks.
    Id string
    The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
    RouterId string
    The ID of the vRouter.
    Status string
    The state of the advertised BGP network.
    DstCidrBlock string
    Advertised BGP networks.
    Id string
    The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
    RouterId string
    The ID of the vRouter.
    Status string
    The state of the advertised BGP network.
    dstCidrBlock String
    Advertised BGP networks.
    id String
    The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
    routerId String
    The ID of the vRouter.
    status String
    The state of the advertised BGP network.
    dstCidrBlock string
    Advertised BGP networks.
    id string
    The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
    routerId string
    The ID of the vRouter.
    status string
    The state of the advertised BGP network.
    dst_cidr_block str
    Advertised BGP networks.
    id str
    The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
    router_id str
    The ID of the vRouter.
    status str
    The state of the advertised BGP network.
    dstCidrBlock String
    Advertised BGP networks.
    id String
    The ID of the Bgp Network. The value formats as <router_id>:<dst_cidr_block>.
    routerId String
    The ID of the vRouter.
    status 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.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi