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

alicloud.slb.getAttachments

Explore with Pulumi AI

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

    This data source provides the server load balancer attachments of the current Alibaba Cloud user.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const sampleDs = alicloud.slb.getAttachments({
        loadBalancerId: alicloud_slb_load_balancer.sample_slb.id,
    });
    export const firstSlbAttachmentInstanceId = sampleDs.then(sampleDs => sampleDs.slbAttachments?.[0]?.instanceId);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    sample_ds = alicloud.slb.get_attachments(load_balancer_id=alicloud_slb_load_balancer["sample_slb"]["id"])
    pulumi.export("firstSlbAttachmentInstanceId", sample_ds.slb_attachments[0].instance_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.GetAttachments(ctx, &slb.GetAttachmentsArgs{
    			LoadBalancerId: alicloud_slb_load_balancer.Sample_slb.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstSlbAttachmentInstanceId", sampleDs.SlbAttachments[0].InstanceId)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var sampleDs = AliCloud.Slb.GetAttachments.Invoke(new()
        {
            LoadBalancerId = alicloud_slb_load_balancer.Sample_slb.Id,
        });
    
        return new Dictionary<string, object?>
        {
            ["firstSlbAttachmentInstanceId"] = sampleDs.Apply(getAttachmentsResult => getAttachmentsResult.SlbAttachments[0]?.InstanceId),
        };
    });
    
    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.GetAttachmentsArgs;
    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.getAttachments(GetAttachmentsArgs.builder()
                .loadBalancerId(alicloud_slb_load_balancer.sample_slb().id())
                .build());
    
            ctx.export("firstSlbAttachmentInstanceId", sampleDs.applyValue(getAttachmentsResult -> getAttachmentsResult.slbAttachments()[0].instanceId()));
        }
    }
    
    variables:
      sampleDs:
        fn::invoke:
          Function: alicloud:slb:getAttachments
          Arguments:
            loadBalancerId: ${alicloud_slb_load_balancer.sample_slb.id}
    outputs:
      firstSlbAttachmentInstanceId: ${sampleDs.slbAttachments[0].instanceId}
    

    Using getAttachments

    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 getAttachments(args: GetAttachmentsArgs, opts?: InvokeOptions): Promise<GetAttachmentsResult>
    function getAttachmentsOutput(args: GetAttachmentsOutputArgs, opts?: InvokeOptions): Output<GetAttachmentsResult>
    def get_attachments(instance_ids: Optional[Sequence[str]] = None,
                        load_balancer_id: Optional[str] = None,
                        output_file: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetAttachmentsResult
    def get_attachments_output(instance_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[GetAttachmentsResult]
    func GetAttachments(ctx *Context, args *GetAttachmentsArgs, opts ...InvokeOption) (*GetAttachmentsResult, error)
    func GetAttachmentsOutput(ctx *Context, args *GetAttachmentsOutputArgs, opts ...InvokeOption) GetAttachmentsResultOutput

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

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

    The following arguments are supported:

    LoadBalancerId string
    ID of the SLB with attachments.
    InstanceIds 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.
    InstanceIds []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.
    instanceIds 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.
    instanceIds 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.
    instance_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.
    instanceIds List<String>
    List of attached ECS instance IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getAttachments Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    LoadBalancerId string
    SlbAttachments List<Pulumi.AliCloud.Slb.Outputs.GetAttachmentsSlbAttachment>
    A list of SLB attachments. Each element contains the following attributes:
    InstanceIds List<string>
    OutputFile string
    Id string
    The provider-assigned unique ID for this managed resource.
    LoadBalancerId string
    SlbAttachments []GetAttachmentsSlbAttachment
    A list of SLB attachments. Each element contains the following attributes:
    InstanceIds []string
    OutputFile string
    id String
    The provider-assigned unique ID for this managed resource.
    loadBalancerId String
    slbAttachments List<GetAttachmentsSlbAttachment>
    A list of SLB attachments. Each element contains the following attributes:
    instanceIds List<String>
    outputFile String
    id string
    The provider-assigned unique ID for this managed resource.
    loadBalancerId string
    slbAttachments GetAttachmentsSlbAttachment[]
    A list of SLB attachments. Each element contains the following attributes:
    instanceIds string[]
    outputFile string
    id str
    The provider-assigned unique ID for this managed resource.
    load_balancer_id str
    slb_attachments Sequence[GetAttachmentsSlbAttachment]
    A list of SLB attachments. Each element contains the following attributes:
    instance_ids Sequence[str]
    output_file str
    id String
    The provider-assigned unique ID for this managed resource.
    loadBalancerId String
    slbAttachments List<Property Map>
    A list of SLB attachments. Each element contains the following attributes:
    instanceIds List<String>
    outputFile String

    Supporting Types

    GetAttachmentsSlbAttachment

    InstanceId string
    ID of the attached ECS instance.
    Weight int
    Weight associated to the ECS instance.
    InstanceId string
    ID of the attached ECS instance.
    Weight int
    Weight associated to the ECS instance.
    instanceId String
    ID of the attached ECS instance.
    weight Integer
    Weight associated to the ECS instance.
    instanceId string
    ID of the attached ECS instance.
    weight number
    Weight associated to the ECS instance.
    instance_id str
    ID of the attached ECS instance.
    weight int
    Weight associated to the ECS instance.
    instanceId String
    ID of the attached ECS instance.
    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.53.0 published on Wednesday, Apr 17, 2024 by Pulumi