1. Packages
  2. Alicloud Provider
  3. API Docs
  4. cen
  5. getInstances
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.cen.getInstances

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    This data source provides CEN instances available to the user.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const cenInstancesDs = alicloud.cen.getInstances({
        ids: ["cen-id1"],
        nameRegex: "^foo",
    });
    export const firstCenInstanceId = cenInstancesDs.then(cenInstancesDs => cenInstancesDs.instances?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    cen_instances_ds = alicloud.cen.get_instances(ids=["cen-id1"],
        name_regex="^foo")
    pulumi.export("firstCenInstanceId", cen_instances_ds.instances[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cen"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cenInstancesDs, err := cen.GetInstances(ctx, &cen.GetInstancesArgs{
    			Ids: []string{
    				"cen-id1",
    			},
    			NameRegex: pulumi.StringRef("^foo"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstCenInstanceId", cenInstancesDs.Instances[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var cenInstancesDs = AliCloud.Cen.GetInstances.Invoke(new()
        {
            Ids = new[]
            {
                "cen-id1",
            },
            NameRegex = "^foo",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstCenInstanceId"] = cenInstancesDs.Apply(getInstancesResult => getInstancesResult.Instances[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.cen.CenFunctions;
    import com.pulumi.alicloud.cen.inputs.GetInstancesArgs;
    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 cenInstancesDs = CenFunctions.getInstances(GetInstancesArgs.builder()
                .ids("cen-id1")
                .nameRegex("^foo")
                .build());
    
            ctx.export("firstCenInstanceId", cenInstancesDs.applyValue(getInstancesResult -> getInstancesResult.instances()[0].id()));
        }
    }
    
    variables:
      cenInstancesDs:
        fn::invoke:
          Function: alicloud:cen:getInstances
          Arguments:
            ids:
              - cen-id1
            nameRegex: ^foo
    outputs:
      firstCenInstanceId: ${cenInstancesDs.instances[0].id}
    

    Using getInstances

    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 getInstances(args: GetInstancesArgs, opts?: InvokeOptions): Promise<GetInstancesResult>
    function getInstancesOutput(args: GetInstancesOutputArgs, opts?: InvokeOptions): Output<GetInstancesResult>
    def get_instances(ids: Optional[Sequence[str]] = None,
                      name_regex: Optional[str] = None,
                      output_file: Optional[str] = None,
                      status: Optional[str] = None,
                      tags: Optional[Mapping[str, str]] = None,
                      opts: Optional[InvokeOptions] = None) -> GetInstancesResult
    def get_instances_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                      name_regex: Optional[pulumi.Input[str]] = None,
                      output_file: Optional[pulumi.Input[str]] = None,
                      status: Optional[pulumi.Input[str]] = None,
                      tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetInstancesResult]
    func GetInstances(ctx *Context, args *GetInstancesArgs, opts ...InvokeOption) (*GetInstancesResult, error)
    func GetInstancesOutput(ctx *Context, args *GetInstancesOutputArgs, opts ...InvokeOption) GetInstancesResultOutput

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

    public static class GetInstances 
    {
        public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs args, InvokeOptions? opts = null)
        public static Output<GetInstancesResult> Invoke(GetInstancesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:cen/getInstances:getInstances
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of CEN instances IDs.
    NameRegex string
    A regex string to filter CEN instances by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    Ids []string
    A list of CEN instances IDs.
    NameRegex string
    A regex string to filter CEN instances by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    ids List<String>
    A list of CEN instances IDs.
    nameRegex String
    A regex string to filter CEN instances by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    ids string[]
    A list of CEN instances IDs.
    nameRegex string
    A regex string to filter CEN instances by name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    status string
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    ids Sequence[str]
    A list of CEN instances IDs.
    name_regex str
    A regex string to filter CEN instances by name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    status str
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    ids List<String>
    A list of CEN instances IDs.
    nameRegex String
    A regex string to filter CEN instances by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    tags Map<String>
    A mapping of tags to assign to the resource.

    getInstances Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of CEN instances IDs.
    Instances List<Pulumi.AliCloud.Cen.Outputs.GetInstancesInstance>
    A list of CEN instances. Each element contains the following attributes:
    Names List<string>
    A list of CEN instances names.
    NameRegex string
    OutputFile string
    Status string
    Status of the CEN instance, including "Creating", "Active" and "Deleting".
    Tags Dictionary<string, string>
    A map of tags assigned to the Cen Instance.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of CEN instances IDs.
    Instances []GetInstancesInstance
    A list of CEN instances. Each element contains the following attributes:
    Names []string
    A list of CEN instances names.
    NameRegex string
    OutputFile string
    Status string
    Status of the CEN instance, including "Creating", "Active" and "Deleting".
    Tags map[string]string
    A map of tags assigned to the Cen Instance.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of CEN instances IDs.
    instances List<GetInstancesInstance>
    A list of CEN instances. Each element contains the following attributes:
    names List<String>
    A list of CEN instances names.
    nameRegex String
    outputFile String
    status String
    Status of the CEN instance, including "Creating", "Active" and "Deleting".
    tags Map<String,String>
    A map of tags assigned to the Cen Instance.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of CEN instances IDs.
    instances GetInstancesInstance[]
    A list of CEN instances. Each element contains the following attributes:
    names string[]
    A list of CEN instances names.
    nameRegex string
    outputFile string
    status string
    Status of the CEN instance, including "Creating", "Active" and "Deleting".
    tags {[key: string]: string}
    A map of tags assigned to the Cen Instance.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of CEN instances IDs.
    instances Sequence[GetInstancesInstance]
    A list of CEN instances. Each element contains the following attributes:
    names Sequence[str]
    A list of CEN instances names.
    name_regex str
    output_file str
    status str
    Status of the CEN instance, including "Creating", "Active" and "Deleting".
    tags Mapping[str, str]
    A map of tags assigned to the Cen Instance.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of CEN instances IDs.
    instances List<Property Map>
    A list of CEN instances. Each element contains the following attributes:
    names List<String>
    A list of CEN instances names.
    nameRegex String
    outputFile String
    status String
    Status of the CEN instance, including "Creating", "Active" and "Deleting".
    tags Map<String>
    A map of tags assigned to the Cen Instance.

    Supporting Types

    GetInstancesInstance

    CenBandwidthPackageIds List<string>
    List of CEN Bandwidth Package IDs in the specified CEN instance.
    CenId string
    ID of the CEN instance.
    CenInstanceName string
    Name of the CEN instance.
    CreateTime string
    The creation time of the CEN Instance.
    Description string
    Description of the CEN instance.
    Id string
    ID of the CEN instance.
    Name string
    Name of the CEN instance.
    ProtectionLevel string
    Indicates the allowed level of CIDR block overlapping.
    Status string
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    CenBandwidthPackageIds []string
    List of CEN Bandwidth Package IDs in the specified CEN instance.
    CenId string
    ID of the CEN instance.
    CenInstanceName string
    Name of the CEN instance.
    CreateTime string
    The creation time of the CEN Instance.
    Description string
    Description of the CEN instance.
    Id string
    ID of the CEN instance.
    Name string
    Name of the CEN instance.
    ProtectionLevel string
    Indicates the allowed level of CIDR block overlapping.
    Status string
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    cenBandwidthPackageIds List<String>
    List of CEN Bandwidth Package IDs in the specified CEN instance.
    cenId String
    ID of the CEN instance.
    cenInstanceName String
    Name of the CEN instance.
    createTime String
    The creation time of the CEN Instance.
    description String
    Description of the CEN instance.
    id String
    ID of the CEN instance.
    name String
    Name of the CEN instance.
    protectionLevel String
    Indicates the allowed level of CIDR block overlapping.
    status String
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    cenBandwidthPackageIds string[]
    List of CEN Bandwidth Package IDs in the specified CEN instance.
    cenId string
    ID of the CEN instance.
    cenInstanceName string
    Name of the CEN instance.
    createTime string
    The creation time of the CEN Instance.
    description string
    Description of the CEN instance.
    id string
    ID of the CEN instance.
    name string
    Name of the CEN instance.
    protectionLevel string
    Indicates the allowed level of CIDR block overlapping.
    status string
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    cen_bandwidth_package_ids Sequence[str]
    List of CEN Bandwidth Package IDs in the specified CEN instance.
    cen_id str
    ID of the CEN instance.
    cen_instance_name str
    Name of the CEN instance.
    create_time str
    The creation time of the CEN Instance.
    description str
    Description of the CEN instance.
    id str
    ID of the CEN instance.
    name str
    Name of the CEN instance.
    protection_level str
    Indicates the allowed level of CIDR block overlapping.
    status str
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    cenBandwidthPackageIds List<String>
    List of CEN Bandwidth Package IDs in the specified CEN instance.
    cenId String
    ID of the CEN instance.
    cenInstanceName String
    Name of the CEN instance.
    createTime String
    The creation time of the CEN Instance.
    description String
    Description of the CEN instance.
    id String
    ID of the CEN instance.
    name String
    Name of the CEN instance.
    protectionLevel String
    Indicates the allowed level of CIDR block overlapping.
    status String
    The status of CEN instance. Valid value: Active, Creating and Deleting.
    tags Map<String>
    A mapping of tags to assign to the resource.

    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.62.1 published on Monday, Sep 16, 2024 by Pulumi