1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. vpc
  5. getBgpPeers
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.vpc.getBgpPeers

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    This data source provides the Vpc Bgp Peers 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.getBgpPeers({
        ids: [
            "example_value-1",
            "example_value-2",
        ],
    });
    export const vpcBgpPeerId1 = ids.then(ids => ids.peers?.[0]?.id);
    const bgpGroupId = alicloud.vpc.getBgpPeers({
        bgpGroupId: "example_value",
    });
    export const vpcBgpPeerId2 = bgpGroupId.then(bgpGroupId => bgpGroupId.peers?.[0]?.id);
    const routerId = alicloud.vpc.getBgpPeers({
        routerId: "example_value",
    });
    export const vpcBgpPeerId3 = routerId.then(routerId => routerId.peers?.[0]?.id);
    const status = alicloud.vpc.getBgpPeers({
        status: "Available",
    });
    export const vpcBgpPeerId4 = status.then(status => status.peers?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.vpc.get_bgp_peers(ids=[
        "example_value-1",
        "example_value-2",
    ])
    pulumi.export("vpcBgpPeerId1", ids.peers[0].id)
    bgp_group_id = alicloud.vpc.get_bgp_peers(bgp_group_id="example_value")
    pulumi.export("vpcBgpPeerId2", bgp_group_id.peers[0].id)
    router_id = alicloud.vpc.get_bgp_peers(router_id="example_value")
    pulumi.export("vpcBgpPeerId3", router_id.peers[0].id)
    status = alicloud.vpc.get_bgp_peers(status="Available")
    pulumi.export("vpcBgpPeerId4", status.peers[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.GetBgpPeers(ctx, &vpc.GetBgpPeersArgs{
    			Ids: []string{
    				"example_value-1",
    				"example_value-2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcBgpPeerId1", ids.Peers[0].Id)
    		bgpGroupId, err := vpc.GetBgpPeers(ctx, &vpc.GetBgpPeersArgs{
    			BgpGroupId: pulumi.StringRef("example_value"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcBgpPeerId2", bgpGroupId.Peers[0].Id)
    		routerId, err := vpc.GetBgpPeers(ctx, &vpc.GetBgpPeersArgs{
    			RouterId: pulumi.StringRef("example_value"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcBgpPeerId3", routerId.Peers[0].Id)
    		status, err := vpc.GetBgpPeers(ctx, &vpc.GetBgpPeersArgs{
    			Status: pulumi.StringRef("Available"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcBgpPeerId4", status.Peers[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.GetBgpPeers.Invoke(new()
        {
            Ids = new[]
            {
                "example_value-1",
                "example_value-2",
            },
        });
    
        var bgpGroupId = AliCloud.Vpc.GetBgpPeers.Invoke(new()
        {
            BgpGroupId = "example_value",
        });
    
        var routerId = AliCloud.Vpc.GetBgpPeers.Invoke(new()
        {
            RouterId = "example_value",
        });
    
        var status = AliCloud.Vpc.GetBgpPeers.Invoke(new()
        {
            Status = "Available",
        });
    
        return new Dictionary<string, object?>
        {
            ["vpcBgpPeerId1"] = ids.Apply(getBgpPeersResult => getBgpPeersResult.Peers[0]?.Id),
            ["vpcBgpPeerId2"] = bgpGroupId.Apply(getBgpPeersResult => getBgpPeersResult.Peers[0]?.Id),
            ["vpcBgpPeerId3"] = routerId.Apply(getBgpPeersResult => getBgpPeersResult.Peers[0]?.Id),
            ["vpcBgpPeerId4"] = status.Apply(getBgpPeersResult => getBgpPeersResult.Peers[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.GetBgpPeersArgs;
    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.getBgpPeers(GetBgpPeersArgs.builder()
                .ids(            
                    "example_value-1",
                    "example_value-2")
                .build());
    
            ctx.export("vpcBgpPeerId1", ids.applyValue(getBgpPeersResult -> getBgpPeersResult.peers()[0].id()));
            final var bgpGroupId = VpcFunctions.getBgpPeers(GetBgpPeersArgs.builder()
                .bgpGroupId("example_value")
                .build());
    
            ctx.export("vpcBgpPeerId2", bgpGroupId.applyValue(getBgpPeersResult -> getBgpPeersResult.peers()[0].id()));
            final var routerId = VpcFunctions.getBgpPeers(GetBgpPeersArgs.builder()
                .routerId("example_value")
                .build());
    
            ctx.export("vpcBgpPeerId3", routerId.applyValue(getBgpPeersResult -> getBgpPeersResult.peers()[0].id()));
            final var status = VpcFunctions.getBgpPeers(GetBgpPeersArgs.builder()
                .status("Available")
                .build());
    
            ctx.export("vpcBgpPeerId4", status.applyValue(getBgpPeersResult -> getBgpPeersResult.peers()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:vpc:getBgpPeers
          Arguments:
            ids:
              - example_value-1
              - example_value-2
      bgpGroupId:
        fn::invoke:
          Function: alicloud:vpc:getBgpPeers
          Arguments:
            bgpGroupId: example_value
      routerId:
        fn::invoke:
          Function: alicloud:vpc:getBgpPeers
          Arguments:
            routerId: example_value
      status:
        fn::invoke:
          Function: alicloud:vpc:getBgpPeers
          Arguments:
            status: Available
    outputs:
      vpcBgpPeerId1: ${ids.peers[0].id}
      vpcBgpPeerId2: ${bgpGroupId.peers[0].id}
      vpcBgpPeerId3: ${routerId.peers[0].id}
      vpcBgpPeerId4: ${status.peers[0].id}
    

    Using getBgpPeers

    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 getBgpPeers(args: GetBgpPeersArgs, opts?: InvokeOptions): Promise<GetBgpPeersResult>
    function getBgpPeersOutput(args: GetBgpPeersOutputArgs, opts?: InvokeOptions): Output<GetBgpPeersResult>
    def get_bgp_peers(bgp_group_id: Optional[str] = None,
                      ids: Optional[Sequence[str]] = None,
                      output_file: Optional[str] = None,
                      router_id: Optional[str] = None,
                      status: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetBgpPeersResult
    def get_bgp_peers_output(bgp_group_id: Optional[pulumi.Input[str]] = None,
                      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[GetBgpPeersResult]
    func GetBgpPeers(ctx *Context, args *GetBgpPeersArgs, opts ...InvokeOption) (*GetBgpPeersResult, error)
    func GetBgpPeersOutput(ctx *Context, args *GetBgpPeersOutputArgs, opts ...InvokeOption) GetBgpPeersResultOutput

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

    public static class GetBgpPeers 
    {
        public static Task<GetBgpPeersResult> InvokeAsync(GetBgpPeersArgs args, InvokeOptions? opts = null)
        public static Output<GetBgpPeersResult> Invoke(GetBgpPeersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetBgpPeersResult> getBgpPeers(GetBgpPeersArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:vpc/getBgpPeers:getBgpPeers
      arguments:
        # arguments dictionary

    The following arguments are supported:

    BgpGroupId string
    The ID of the BGP group.
    Ids List<string>
    A list of Bgp Peer IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RouterId string
    The ID of the router.
    Status string
    The status of the BGP peer.
    BgpGroupId string
    The ID of the BGP group.
    Ids []string
    A list of Bgp Peer IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RouterId string
    The ID of the router.
    Status string
    The status of the BGP peer.
    bgpGroupId String
    The ID of the BGP group.
    ids List<String>
    A list of Bgp Peer IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    routerId String
    The ID of the router.
    status String
    The status of the BGP peer.
    bgpGroupId string
    The ID of the BGP group.
    ids string[]
    A list of Bgp Peer IDs.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    routerId string
    The ID of the router.
    status string
    The status of the BGP peer.
    bgp_group_id str
    The ID of the BGP group.
    ids Sequence[str]
    A list of Bgp Peer IDs.
    output_file str
    File name where to save data source results (after running pulumi preview).
    router_id str
    The ID of the router.
    status str
    The status of the BGP peer.
    bgpGroupId String
    The ID of the BGP group.
    ids List<String>
    A list of Bgp Peer IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    routerId String
    The ID of the router.
    status String
    The status of the BGP peer.

    getBgpPeers Result

    The following output properties are available:

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

    Supporting Types

    GetBgpPeersPeer

    AuthKey string
    The authentication key of the BGP group.
    BfdMultiHop int
    The BFD hop count.
    BgpGroupId string
    The ID of the BGP group.
    BgpPeerId string
    The ID of the BGP neighbor.
    BgpPeerName string
    The name of the BGP neighbor.
    BgpStatus string
    The status of the BGP connection.
    Description string
    The description of the BGP group.
    EnableBfd bool
    Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
    Hold string
    The hold time.
    Id string
    The ID of the Bgp Peer.
    IpVersion string
    The IP version.
    IsFake bool
    Indicates whether a fake AS number is used.
    Keepalive string
    The keepalive time.
    LocalAsn string
    The AS number of the device on the Alibaba Cloud side.
    PeerAsn string
    The autonomous system (AS) number of the BGP peer.
    PeerIpAddress string
    The IP address of the BGP neighbor.
    RouteLimit string
    The limit on routes.
    RouterId string
    The ID of the router.
    Status string
    The status of the BGP peer.
    AuthKey string
    The authentication key of the BGP group.
    BfdMultiHop int
    The BFD hop count.
    BgpGroupId string
    The ID of the BGP group.
    BgpPeerId string
    The ID of the BGP neighbor.
    BgpPeerName string
    The name of the BGP neighbor.
    BgpStatus string
    The status of the BGP connection.
    Description string
    The description of the BGP group.
    EnableBfd bool
    Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
    Hold string
    The hold time.
    Id string
    The ID of the Bgp Peer.
    IpVersion string
    The IP version.
    IsFake bool
    Indicates whether a fake AS number is used.
    Keepalive string
    The keepalive time.
    LocalAsn string
    The AS number of the device on the Alibaba Cloud side.
    PeerAsn string
    The autonomous system (AS) number of the BGP peer.
    PeerIpAddress string
    The IP address of the BGP neighbor.
    RouteLimit string
    The limit on routes.
    RouterId string
    The ID of the router.
    Status string
    The status of the BGP peer.
    authKey String
    The authentication key of the BGP group.
    bfdMultiHop Integer
    The BFD hop count.
    bgpGroupId String
    The ID of the BGP group.
    bgpPeerId String
    The ID of the BGP neighbor.
    bgpPeerName String
    The name of the BGP neighbor.
    bgpStatus String
    The status of the BGP connection.
    description String
    The description of the BGP group.
    enableBfd Boolean
    Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
    hold String
    The hold time.
    id String
    The ID of the Bgp Peer.
    ipVersion String
    The IP version.
    isFake Boolean
    Indicates whether a fake AS number is used.
    keepalive String
    The keepalive time.
    localAsn String
    The AS number of the device on the Alibaba Cloud side.
    peerAsn String
    The autonomous system (AS) number of the BGP peer.
    peerIpAddress String
    The IP address of the BGP neighbor.
    routeLimit String
    The limit on routes.
    routerId String
    The ID of the router.
    status String
    The status of the BGP peer.
    authKey string
    The authentication key of the BGP group.
    bfdMultiHop number
    The BFD hop count.
    bgpGroupId string
    The ID of the BGP group.
    bgpPeerId string
    The ID of the BGP neighbor.
    bgpPeerName string
    The name of the BGP neighbor.
    bgpStatus string
    The status of the BGP connection.
    description string
    The description of the BGP group.
    enableBfd boolean
    Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
    hold string
    The hold time.
    id string
    The ID of the Bgp Peer.
    ipVersion string
    The IP version.
    isFake boolean
    Indicates whether a fake AS number is used.
    keepalive string
    The keepalive time.
    localAsn string
    The AS number of the device on the Alibaba Cloud side.
    peerAsn string
    The autonomous system (AS) number of the BGP peer.
    peerIpAddress string
    The IP address of the BGP neighbor.
    routeLimit string
    The limit on routes.
    routerId string
    The ID of the router.
    status string
    The status of the BGP peer.
    auth_key str
    The authentication key of the BGP group.
    bfd_multi_hop int
    The BFD hop count.
    bgp_group_id str
    The ID of the BGP group.
    bgp_peer_id str
    The ID of the BGP neighbor.
    bgp_peer_name str
    The name of the BGP neighbor.
    bgp_status str
    The status of the BGP connection.
    description str
    The description of the BGP group.
    enable_bfd bool
    Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
    hold str
    The hold time.
    id str
    The ID of the Bgp Peer.
    ip_version str
    The IP version.
    is_fake bool
    Indicates whether a fake AS number is used.
    keepalive str
    The keepalive time.
    local_asn str
    The AS number of the device on the Alibaba Cloud side.
    peer_asn str
    The autonomous system (AS) number of the BGP peer.
    peer_ip_address str
    The IP address of the BGP neighbor.
    route_limit str
    The limit on routes.
    router_id str
    The ID of the router.
    status str
    The status of the BGP peer.
    authKey String
    The authentication key of the BGP group.
    bfdMultiHop Number
    The BFD hop count.
    bgpGroupId String
    The ID of the BGP group.
    bgpPeerId String
    The ID of the BGP neighbor.
    bgpPeerName String
    The name of the BGP neighbor.
    bgpStatus String
    The status of the BGP connection.
    description String
    The description of the BGP group.
    enableBfd Boolean
    Indicates whether the Bidirectional Forwarding Detection (BFD) protocol is enabled.
    hold String
    The hold time.
    id String
    The ID of the Bgp Peer.
    ipVersion String
    The IP version.
    isFake Boolean
    Indicates whether a fake AS number is used.
    keepalive String
    The keepalive time.
    localAsn String
    The AS number of the device on the Alibaba Cloud side.
    peerAsn String
    The autonomous system (AS) number of the BGP peer.
    peerIpAddress String
    The IP address of the BGP neighbor.
    routeLimit String
    The limit on routes.
    routerId String
    The ID of the router.
    status String
    The status of the BGP peer.

    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.53.0 published on Wednesday, Apr 17, 2024 by Pulumi