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

alicloud.oss.getInstanceAttachments

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi
    Deprecated: alicloud.oss.getInstanceAttachments has been deprecated in favor of alicloud.ots.getInstanceAttachments

    This data source provides the ots instance attachments of the current Alibaba Cloud user.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const attachmentsDs = alicloud.ots.getInstanceAttachments({
        instanceName: "sample-instance",
        nameRegex: "testvpc",
        outputFile: "attachments.txt",
    });
    export const firstOtsAttachmentId = attachmentsDs.then(attachmentsDs => attachmentsDs.attachments?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    attachments_ds = alicloud.ots.get_instance_attachments(instance_name="sample-instance",
        name_regex="testvpc",
        output_file="attachments.txt")
    pulumi.export("firstOtsAttachmentId", attachments_ds.attachments[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ots"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		attachmentsDs, err := ots.GetInstanceAttachments(ctx, &ots.GetInstanceAttachmentsArgs{
    			InstanceName: "sample-instance",
    			NameRegex:    pulumi.StringRef("testvpc"),
    			OutputFile:   pulumi.StringRef("attachments.txt"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstOtsAttachmentId", attachmentsDs.Attachments[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var attachmentsDs = AliCloud.Ots.GetInstanceAttachments.Invoke(new()
        {
            InstanceName = "sample-instance",
            NameRegex = "testvpc",
            OutputFile = "attachments.txt",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstOtsAttachmentId"] = attachmentsDs.Apply(getInstanceAttachmentsResult => getInstanceAttachmentsResult.Attachments[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ots.OtsFunctions;
    import com.pulumi.alicloud.ots.inputs.GetInstanceAttachmentsArgs;
    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 attachmentsDs = OtsFunctions.getInstanceAttachments(GetInstanceAttachmentsArgs.builder()
                .instanceName("sample-instance")
                .nameRegex("testvpc")
                .outputFile("attachments.txt")
                .build());
    
            ctx.export("firstOtsAttachmentId", attachmentsDs.applyValue(getInstanceAttachmentsResult -> getInstanceAttachmentsResult.attachments()[0].id()));
        }
    }
    
    variables:
      attachmentsDs:
        fn::invoke:
          Function: alicloud:ots:getInstanceAttachments
          Arguments:
            instanceName: sample-instance
            nameRegex: testvpc
            outputFile: attachments.txt
    outputs:
      firstOtsAttachmentId: ${attachmentsDs.attachments[0].id}
    

    Using getInstanceAttachments

    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 getInstanceAttachments(args: GetInstanceAttachmentsArgs, opts?: InvokeOptions): Promise<GetInstanceAttachmentsResult>
    function getInstanceAttachmentsOutput(args: GetInstanceAttachmentsOutputArgs, opts?: InvokeOptions): Output<GetInstanceAttachmentsResult>
    def get_instance_attachments(instance_name: Optional[str] = None,
                                 name_regex: Optional[str] = None,
                                 output_file: Optional[str] = None,
                                 opts: Optional[InvokeOptions] = None) -> GetInstanceAttachmentsResult
    def get_instance_attachments_output(instance_name: Optional[pulumi.Input[str]] = None,
                                 name_regex: Optional[pulumi.Input[str]] = None,
                                 output_file: Optional[pulumi.Input[str]] = None,
                                 opts: Optional[InvokeOptions] = None) -> Output[GetInstanceAttachmentsResult]
    func GetInstanceAttachments(ctx *Context, args *GetInstanceAttachmentsArgs, opts ...InvokeOption) (*GetInstanceAttachmentsResult, error)
    func GetInstanceAttachmentsOutput(ctx *Context, args *GetInstanceAttachmentsOutputArgs, opts ...InvokeOption) GetInstanceAttachmentsResultOutput

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

    public static class GetInstanceAttachments 
    {
        public static Task<GetInstanceAttachmentsResult> InvokeAsync(GetInstanceAttachmentsArgs args, InvokeOptions? opts = null)
        public static Output<GetInstanceAttachmentsResult> Invoke(GetInstanceAttachmentsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetInstanceAttachmentsResult> getInstanceAttachments(GetInstanceAttachmentsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:oss/getInstanceAttachments:getInstanceAttachments
      arguments:
        # arguments dictionary

    The following arguments are supported:

    InstanceName string
    The name of OTS instance.
    NameRegex string
    A regex string to filter results by vpc name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    InstanceName string
    The name of OTS instance.
    NameRegex string
    A regex string to filter results by vpc name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    instanceName String
    The name of OTS instance.
    nameRegex String
    A regex string to filter results by vpc name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    instanceName string
    The name of OTS instance.
    nameRegex string
    A regex string to filter results by vpc name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    instance_name str
    The name of OTS instance.
    name_regex str
    A regex string to filter results by vpc name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    instanceName String
    The name of OTS instance.
    nameRegex String
    A regex string to filter results by vpc name.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getInstanceAttachments Result

    The following output properties are available:

    Attachments List<Pulumi.AliCloud.Oss.Outputs.GetInstanceAttachmentsAttachment>
    A list of instance attachments. Each element contains the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceName string
    The instance name.
    Names List<string>
    A list of vpc names.
    VpcIds List<string>
    A list of vpc ids.
    NameRegex string
    OutputFile string
    Attachments []GetInstanceAttachmentsAttachment
    A list of instance attachments. Each element contains the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceName string
    The instance name.
    Names []string
    A list of vpc names.
    VpcIds []string
    A list of vpc ids.
    NameRegex string
    OutputFile string
    attachments List<GetInstanceAttachmentsAttachment>
    A list of instance attachments. Each element contains the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    instanceName String
    The instance name.
    names List<String>
    A list of vpc names.
    vpcIds List<String>
    A list of vpc ids.
    nameRegex String
    outputFile String
    attachments GetInstanceAttachmentsAttachment[]
    A list of instance attachments. Each element contains the following attributes:
    id string
    The provider-assigned unique ID for this managed resource.
    instanceName string
    The instance name.
    names string[]
    A list of vpc names.
    vpcIds string[]
    A list of vpc ids.
    nameRegex string
    outputFile string
    attachments Sequence[GetInstanceAttachmentsAttachment]
    A list of instance attachments. Each element contains the following attributes:
    id str
    The provider-assigned unique ID for this managed resource.
    instance_name str
    The instance name.
    names Sequence[str]
    A list of vpc names.
    vpc_ids Sequence[str]
    A list of vpc ids.
    name_regex str
    output_file str
    attachments List<Property Map>
    A list of instance attachments. Each element contains the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    instanceName String
    The instance name.
    names List<String>
    A list of vpc names.
    vpcIds List<String>
    A list of vpc ids.
    nameRegex String
    outputFile String

    Supporting Types

    GetInstanceAttachmentsAttachment

    Domain string
    The domain of the instance attachment.
    Endpoint string
    The access endpoint of the instance attachment.
    Id string
    The resource ID, the value is same as "instance_name".
    InstanceName string
    The name of OTS instance.
    Region string
    The region of the instance attachment.
    VpcId string
    The ID of attaching VPC to instance.
    VpcName string
    The name of attaching VPC to instance.
    Domain string
    The domain of the instance attachment.
    Endpoint string
    The access endpoint of the instance attachment.
    Id string
    The resource ID, the value is same as "instance_name".
    InstanceName string
    The name of OTS instance.
    Region string
    The region of the instance attachment.
    VpcId string
    The ID of attaching VPC to instance.
    VpcName string
    The name of attaching VPC to instance.
    domain String
    The domain of the instance attachment.
    endpoint String
    The access endpoint of the instance attachment.
    id String
    The resource ID, the value is same as "instance_name".
    instanceName String
    The name of OTS instance.
    region String
    The region of the instance attachment.
    vpcId String
    The ID of attaching VPC to instance.
    vpcName String
    The name of attaching VPC to instance.
    domain string
    The domain of the instance attachment.
    endpoint string
    The access endpoint of the instance attachment.
    id string
    The resource ID, the value is same as "instance_name".
    instanceName string
    The name of OTS instance.
    region string
    The region of the instance attachment.
    vpcId string
    The ID of attaching VPC to instance.
    vpcName string
    The name of attaching VPC to instance.
    domain str
    The domain of the instance attachment.
    endpoint str
    The access endpoint of the instance attachment.
    id str
    The resource ID, the value is same as "instance_name".
    instance_name str
    The name of OTS instance.
    region str
    The region of the instance attachment.
    vpc_id str
    The ID of attaching VPC to instance.
    vpc_name str
    The name of attaching VPC to instance.
    domain String
    The domain of the instance attachment.
    endpoint String
    The access endpoint of the instance attachment.
    id String
    The resource ID, the value is same as "instance_name".
    instanceName String
    The name of OTS instance.
    region String
    The region of the instance attachment.
    vpcId String
    The ID of attaching VPC to instance.
    vpcName String
    The name of attaching VPC to 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