1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. slb
  5. getBackendServers
Alibaba Cloud v3.56.0 published on Friday, May 31, 2024 by Pulumi

alicloud.slb.getBackendServers

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.56.0 published on Friday, May 31, 2024 by Pulumi

    This data source provides the server load balancer backend servers related to a server load balancer..

    NOTE: Available in 1.53.0+

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const sampleDs = alicloud.slb.getBackendServers({
        loadBalancerId: sampleSlb.id,
    });
    export const firstSlbBackendServerId = sampleDs.then(sampleDs => sampleDs.backendServers?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    sample_ds = alicloud.slb.get_backend_servers(load_balancer_id=sample_slb["id"])
    pulumi.export("firstSlbBackendServerId", sample_ds.backend_servers[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/slb"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		sampleDs, err := slb.GetBackendServers(ctx, &slb.GetBackendServersArgs{
    			LoadBalancerId: sampleSlb.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstSlbBackendServerId", sampleDs.BackendServers[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var sampleDs = AliCloud.Slb.GetBackendServers.Invoke(new()
        {
            LoadBalancerId = sampleSlb.Id,
        });
    
        return new Dictionary<string, object?>
        {
            ["firstSlbBackendServerId"] = sampleDs.Apply(getBackendServersResult => getBackendServersResult.BackendServers[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.slb.SlbFunctions;
    import com.pulumi.alicloud.slb.inputs.GetBackendServersArgs;
    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 sampleDs = SlbFunctions.getBackendServers(GetBackendServersArgs.builder()
                .loadBalancerId(sampleSlb.id())
                .build());
    
            ctx.export("firstSlbBackendServerId", sampleDs.applyValue(getBackendServersResult -> getBackendServersResult.backendServers()[0].id()));
        }
    }
    
    variables:
      sampleDs:
        fn::invoke:
          Function: alicloud:slb:getBackendServers
          Arguments:
            loadBalancerId: ${sampleSlb.id}
    outputs:
      firstSlbBackendServerId: ${sampleDs.backendServers[0].id}
    

    Using getBackendServers

    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 getBackendServers(args: GetBackendServersArgs, opts?: InvokeOptions): Promise<GetBackendServersResult>
    function getBackendServersOutput(args: GetBackendServersOutputArgs, opts?: InvokeOptions): Output<GetBackendServersResult>
    def get_backend_servers(ids: Optional[Sequence[str]] = None,
                            load_balancer_id: Optional[str] = None,
                            output_file: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetBackendServersResult
    def get_backend_servers_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                            load_balancer_id: Optional[pulumi.Input[str]] = None,
                            output_file: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetBackendServersResult]
    func GetBackendServers(ctx *Context, args *GetBackendServersArgs, opts ...InvokeOption) (*GetBackendServersResult, error)
    func GetBackendServersOutput(ctx *Context, args *GetBackendServersOutputArgs, opts ...InvokeOption) GetBackendServersResultOutput

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

    public static class GetBackendServers 
    {
        public static Task<GetBackendServersResult> InvokeAsync(GetBackendServersArgs args, InvokeOptions? opts = null)
        public static Output<GetBackendServersResult> Invoke(GetBackendServersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetBackendServersResult> getBackendServers(GetBackendServersArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:slb/getBackendServers:getBackendServers
      arguments:
        # arguments dictionary

    The following arguments are supported:

    LoadBalancerId string
    ID of the SLB with attachments.
    Ids List<string>
    List of attached ECS instance IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    LoadBalancerId string
    ID of the SLB with attachments.
    Ids []string
    List of attached ECS instance IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    loadBalancerId String
    ID of the SLB with attachments.
    ids List<String>
    List of attached ECS instance IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    loadBalancerId string
    ID of the SLB with attachments.
    ids string[]
    List of attached ECS instance IDs.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    load_balancer_id str
    ID of the SLB with attachments.
    ids Sequence[str]
    List of attached ECS instance IDs.
    output_file str
    File name where to save data source results (after running pulumi preview).
    loadBalancerId String
    ID of the SLB with attachments.
    ids List<String>
    List of attached ECS instance IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getBackendServers Result

    The following output properties are available:

    BackendServers List<Pulumi.AliCloud.Slb.Outputs.GetBackendServersBackendServer>
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    LoadBalancerId string
    OutputFile string
    BackendServers []GetBackendServersBackendServer
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    LoadBalancerId string
    OutputFile string
    backendServers List<GetBackendServersBackendServer>
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    loadBalancerId String
    outputFile String
    backendServers GetBackendServersBackendServer[]
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    loadBalancerId string
    outputFile string
    backend_servers Sequence[GetBackendServersBackendServer]
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    load_balancer_id str
    output_file str
    backendServers List<Property Map>
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    loadBalancerId String
    outputFile String

    Supporting Types

    GetBackendServersBackendServer

    Id string
    backend server ID.
    ServerType string
    Type of the backend server.
    Weight int
    Weight associated to the ECS instance.
    Id string
    backend server ID.
    ServerType string
    Type of the backend server.
    Weight int
    Weight associated to the ECS instance.
    id String
    backend server ID.
    serverType String
    Type of the backend server.
    weight Integer
    Weight associated to the ECS instance.
    id string
    backend server ID.
    serverType string
    Type of the backend server.
    weight number
    Weight associated to the ECS instance.
    id str
    backend server ID.
    server_type str
    Type of the backend server.
    weight int
    Weight associated to the ECS instance.
    id String
    backend server ID.
    serverType String
    Type of the backend server.
    weight Number
    Weight associated to the ECS instance.

    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.56.0 published on Friday, May 31, 2024 by Pulumi