Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.27.0 published on Monday, Aug 8, 2022 by Pulumi

getBackendServers

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

NOTE: Available in 1.53.0+

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var sampleDs = Output.Create(AliCloud.Slb.GetBackendServers.InvokeAsync(new AliCloud.Slb.GetBackendServersArgs
        {
            LoadBalancerId = alicloud_slb_load_balancer.Sample_slb.Id,
        }));
        this.FirstSlbBackendServerId = sampleDs.Apply(sampleDs => sampleDs.BackendServers?[0]?.Id);
    }

    [Output("firstSlbBackendServerId")]
    public Output<string> FirstSlbBackendServerId { get; set; }
}
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: alicloud_slb_load_balancer.Sample_slb.Id,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstSlbBackendServerId", sampleDs.BackendServers[0].Id)
		return nil
	})
}
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(alicloud_slb_load_balancer.sample_slb().id())
            .build());

        ctx.export("firstSlbBackendServerId", sampleDs.applyValue(getBackendServersResult -> getBackendServersResult.backendServers()[0].id()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

sample_ds = alicloud.slb.get_backend_servers(load_balancer_id=alicloud_slb_load_balancer["sample_slb"]["id"])
pulumi.export("firstSlbBackendServerId", sample_ds.backend_servers[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const sampleDs = alicloud_slb_load_balancer_sample_slb.id.apply(id => alicloud.slb.getBackendServers({
    loadBalancerId: id,
}));

export const firstSlbBackendServerId = sampleDs.backendServers[0].id;
variables:
  sampleDs:
    Fn::Invoke:
      Function: alicloud:slb:getBackendServers
      Arguments:
        loadBalancerId: ${alicloud_slb_load_balancer.sample_slb.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
LoadBalancerId string

ID of the SLB with attachments.

Ids []string

List of attached ECS instance IDs.

OutputFile string
loadBalancerId String

ID of the SLB with attachments.

ids List<String>

List of attached ECS instance IDs.

outputFile String
loadBalancerId string

ID of the SLB with attachments.

ids string[]

List of attached ECS instance IDs.

outputFile string
load_balancer_id str

ID of the SLB with attachments.

ids Sequence[str]

List of attached ECS instance IDs.

output_file str
loadBalancerId String

ID of the SLB with attachments.

ids List<String>

List of attached ECS instance IDs.

outputFile String

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
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.