1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. rocketmq
  5. getInstances
Alibaba Cloud v3.59.0 published on Friday, Jul 12, 2024 by Pulumi

alicloud.rocketmq.getInstances

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.59.0 published on Friday, Jul 12, 2024 by Pulumi

    This data source provides a list of ONS Instances in an Alibaba Cloud account according to the specified filters.

    NOTE: Available in 1.52.0+

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "onsInstanceDatasourceName";
    const _default = new alicloud.rocketmq.Instance("default", {
        name: name,
        remark: "default_ons_instance_remark",
    });
    const instancesDs = alicloud.rocketmq.getInstancesOutput({
        ids: [_default.id],
        nameRegex: _default.name,
        outputFile: "instances.txt",
    });
    export const firstInstanceId = instancesDs.apply(instancesDs => instancesDs.instances?.[0]?.instanceId);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "onsInstanceDatasourceName"
    default = alicloud.rocketmq.Instance("default",
        name=name,
        remark="default_ons_instance_remark")
    instances_ds = alicloud.rocketmq.get_instances_output(ids=[default.id],
        name_regex=default.name,
        output_file="instances.txt")
    pulumi.export("firstInstanceId", instances_ds.instances[0].instance_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rocketmq"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "onsInstanceDatasourceName"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := rocketmq.NewInstance(ctx, "default", &rocketmq.InstanceArgs{
    			Name:   pulumi.String(name),
    			Remark: pulumi.String("default_ons_instance_remark"),
    		})
    		if err != nil {
    			return err
    		}
    		instancesDs := rocketmq.GetInstancesOutput(ctx, rocketmq.GetInstancesOutputArgs{
    			Ids: pulumi.StringArray{
    				_default.ID(),
    			},
    			NameRegex:  _default.Name,
    			OutputFile: pulumi.String("instances.txt"),
    		}, nil)
    		ctx.Export("firstInstanceId", instancesDs.ApplyT(func(instancesDs rocketmq.GetInstancesResult) (*string, error) {
    			return &instancesDs.Instances[0].InstanceId, nil
    		}).(pulumi.StringPtrOutput))
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "onsInstanceDatasourceName";
        var @default = new AliCloud.RocketMQ.Instance("default", new()
        {
            Name = name,
            Remark = "default_ons_instance_remark",
        });
    
        var instancesDs = AliCloud.RocketMQ.GetInstances.Invoke(new()
        {
            Ids = new[]
            {
                @default.Id,
            },
            NameRegex = @default.Name,
            OutputFile = "instances.txt",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstInstanceId"] = instancesDs.Apply(getInstancesResult => getInstancesResult.Instances[0]?.InstanceId),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.rocketmq.Instance;
    import com.pulumi.alicloud.rocketmq.InstanceArgs;
    import com.pulumi.alicloud.rocketmq.RocketmqFunctions;
    import com.pulumi.alicloud.rocketmq.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 config = ctx.config();
            final var name = config.get("name").orElse("onsInstanceDatasourceName");
            var default_ = new Instance("default", InstanceArgs.builder()
                .name(name)
                .remark("default_ons_instance_remark")
                .build());
    
            final var instancesDs = RocketmqFunctions.getInstances(GetInstancesArgs.builder()
                .ids(default_.id())
                .nameRegex(default_.name())
                .outputFile("instances.txt")
                .build());
    
            ctx.export("firstInstanceId", instancesDs.applyValue(getInstancesResult -> getInstancesResult).applyValue(instancesDs -> instancesDs.applyValue(getInstancesResult -> getInstancesResult.instances()[0].instanceId())));
        }
    }
    
    configuration:
      name:
        type: string
        default: onsInstanceDatasourceName
    resources:
      default:
        type: alicloud:rocketmq:Instance
        properties:
          name: ${name}
          remark: default_ons_instance_remark
    variables:
      instancesDs:
        fn::invoke:
          Function: alicloud:rocketmq:getInstances
          Arguments:
            ids:
              - ${default.id}
            nameRegex: ${default.name}
            outputFile: instances.txt
    outputs:
      firstInstanceId: ${instancesDs.instances[0].instanceId}
    

    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(enable_details: Optional[bool] = None,
                      ids: Optional[Sequence[str]] = None,
                      name_regex: Optional[str] = None,
                      output_file: Optional[str] = None,
                      status: Optional[int] = None,
                      tags: Optional[Mapping[str, Any]] = None,
                      opts: Optional[InvokeOptions] = None) -> GetInstancesResult
    def get_instances_output(enable_details: Optional[pulumi.Input[bool]] = None,
                      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[int]] = None,
                      tags: Optional[pulumi.Input[Mapping[str, Any]]] = 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:rocketmq/getInstances:getInstances
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EnableDetails bool
    Default to false. Set it to true can output more details.
    Ids List<string>
    A list of instance IDs to filter results.
    NameRegex string
    A regex string to filter results by the instance name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status int
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    Tags Dictionary<string, object>
    A map of tags assigned to the Ons instance.
    EnableDetails bool
    Default to false. Set it to true can output more details.
    Ids []string
    A list of instance IDs to filter results.
    NameRegex string
    A regex string to filter results by the instance name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status int
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    Tags map[string]interface{}
    A map of tags assigned to the Ons instance.
    enableDetails Boolean
    Default to false. Set it to true can output more details.
    ids List<String>
    A list of instance IDs to filter results.
    nameRegex String
    A regex string to filter results by the instance name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status Integer
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    tags Map<String,Object>
    A map of tags assigned to the Ons instance.
    enableDetails boolean
    Default to false. Set it to true can output more details.
    ids string[]
    A list of instance IDs to filter results.
    nameRegex string
    A regex string to filter results by the instance name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    status number
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    tags {[key: string]: any}
    A map of tags assigned to the Ons instance.
    enable_details bool
    Default to false. Set it to true can output more details.
    ids Sequence[str]
    A list of instance IDs to filter results.
    name_regex str
    A regex string to filter results by the instance name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    status int
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    tags Mapping[str, Any]
    A map of tags assigned to the Ons instance.
    enableDetails Boolean
    Default to false. Set it to true can output more details.
    ids List<String>
    A list of instance IDs to filter results.
    nameRegex String
    A regex string to filter results by the instance name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status Number
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    tags Map<Any>
    A map of tags assigned to the Ons instance.

    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 instance IDs.
    Instances List<Pulumi.AliCloud.RocketMQ.Outputs.GetInstancesInstance>
    A list of instances. Each element contains the following attributes:
    Names List<string>
    A list of instance names.
    EnableDetails bool
    NameRegex string
    OutputFile string
    Status int
    The status of the instance. Read Fields in InstanceVO for further details.
    Tags Dictionary<string, object>
    A map of tags assigned to the Ons instance.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of instance IDs.
    Instances []GetInstancesInstance
    A list of instances. Each element contains the following attributes:
    Names []string
    A list of instance names.
    EnableDetails bool
    NameRegex string
    OutputFile string
    Status int
    The status of the instance. Read Fields in InstanceVO for further details.
    Tags map[string]interface{}
    A map of tags assigned to the Ons instance.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of instance IDs.
    instances List<GetInstancesInstance>
    A list of instances. Each element contains the following attributes:
    names List<String>
    A list of instance names.
    enableDetails Boolean
    nameRegex String
    outputFile String
    status Integer
    The status of the instance. Read Fields in InstanceVO for further details.
    tags Map<String,Object>
    A map of tags assigned to the Ons instance.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of instance IDs.
    instances GetInstancesInstance[]
    A list of instances. Each element contains the following attributes:
    names string[]
    A list of instance names.
    enableDetails boolean
    nameRegex string
    outputFile string
    status number
    The status of the instance. Read Fields in InstanceVO for further details.
    tags {[key: string]: any}
    A map of tags assigned to the Ons instance.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of instance IDs.
    instances Sequence[GetInstancesInstance]
    A list of instances. Each element contains the following attributes:
    names Sequence[str]
    A list of instance names.
    enable_details bool
    name_regex str
    output_file str
    status int
    The status of the instance. Read Fields in InstanceVO for further details.
    tags Mapping[str, Any]
    A map of tags assigned to the Ons instance.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of instance IDs.
    instances List<Property Map>
    A list of instances. Each element contains the following attributes:
    names List<String>
    A list of instance names.
    enableDetails Boolean
    nameRegex String
    outputFile String
    status Number
    The status of the instance. Read Fields in InstanceVO for further details.
    tags Map<Any>
    A map of tags assigned to the Ons instance.

    Supporting Types

    GetInstancesInstance

    HttpInternalEndpoint string
    The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    HttpInternetEndpoint string
    The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    HttpInternetSecureEndpoint string
    The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
    Id string
    ID of the instance.
    IndependentNaming bool
    Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
    InstanceId string
    ID of the instance.
    InstanceName string
    Name of the instance.
    InstanceStatus int
    The status of the instance. Read Fields in InstanceVO for further details.
    InstanceType int
    The type of the instance. Read Fields in InstanceVO for further details.
    ReleaseTime string
    The automatic release time of an Enterprise Platinum Edition instance.
    Remark string
    This attribute is a concise description of instance.
    Status int
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    Tags Dictionary<string, object>
    A map of tags assigned to the Ons instance.
    TcpEndpoint string
    The TCP endpoint for the Message Queue for Apache RocketMQ instance.
    HttpInternalEndpoint string
    The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    HttpInternetEndpoint string
    The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    HttpInternetSecureEndpoint string
    The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
    Id string
    ID of the instance.
    IndependentNaming bool
    Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
    InstanceId string
    ID of the instance.
    InstanceName string
    Name of the instance.
    InstanceStatus int
    The status of the instance. Read Fields in InstanceVO for further details.
    InstanceType int
    The type of the instance. Read Fields in InstanceVO for further details.
    ReleaseTime string
    The automatic release time of an Enterprise Platinum Edition instance.
    Remark string
    This attribute is a concise description of instance.
    Status int
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    Tags map[string]interface{}
    A map of tags assigned to the Ons instance.
    TcpEndpoint string
    The TCP endpoint for the Message Queue for Apache RocketMQ instance.
    httpInternalEndpoint String
    The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    httpInternetEndpoint String
    The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    httpInternetSecureEndpoint String
    The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
    id String
    ID of the instance.
    independentNaming Boolean
    Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
    instanceId String
    ID of the instance.
    instanceName String
    Name of the instance.
    instanceStatus Integer
    The status of the instance. Read Fields in InstanceVO for further details.
    instanceType Integer
    The type of the instance. Read Fields in InstanceVO for further details.
    releaseTime String
    The automatic release time of an Enterprise Platinum Edition instance.
    remark String
    This attribute is a concise description of instance.
    status Integer
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    tags Map<String,Object>
    A map of tags assigned to the Ons instance.
    tcpEndpoint String
    The TCP endpoint for the Message Queue for Apache RocketMQ instance.
    httpInternalEndpoint string
    The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    httpInternetEndpoint string
    The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    httpInternetSecureEndpoint string
    The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
    id string
    ID of the instance.
    independentNaming boolean
    Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
    instanceId string
    ID of the instance.
    instanceName string
    Name of the instance.
    instanceStatus number
    The status of the instance. Read Fields in InstanceVO for further details.
    instanceType number
    The type of the instance. Read Fields in InstanceVO for further details.
    releaseTime string
    The automatic release time of an Enterprise Platinum Edition instance.
    remark string
    This attribute is a concise description of instance.
    status number
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    tags {[key: string]: any}
    A map of tags assigned to the Ons instance.
    tcpEndpoint string
    The TCP endpoint for the Message Queue for Apache RocketMQ instance.
    http_internal_endpoint str
    The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    http_internet_endpoint str
    The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    http_internet_secure_endpoint str
    The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
    id str
    ID of the instance.
    independent_naming bool
    Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
    instance_id str
    ID of the instance.
    instance_name str
    Name of the instance.
    instance_status int
    The status of the instance. Read Fields in InstanceVO for further details.
    instance_type int
    The type of the instance. Read Fields in InstanceVO for further details.
    release_time str
    The automatic release time of an Enterprise Platinum Edition instance.
    remark str
    This attribute is a concise description of instance.
    status int
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    tags Mapping[str, Any]
    A map of tags assigned to the Ons instance.
    tcp_endpoint str
    The TCP endpoint for the Message Queue for Apache RocketMQ instance.
    httpInternalEndpoint String
    The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    httpInternetEndpoint String
    The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
    httpInternetSecureEndpoint String
    The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
    id String
    ID of the instance.
    independentNaming Boolean
    Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
    instanceId String
    ID of the instance.
    instanceName String
    Name of the instance.
    instanceStatus Number
    The status of the instance. Read Fields in InstanceVO for further details.
    instanceType Number
    The type of the instance. Read Fields in InstanceVO for further details.
    releaseTime String
    The automatic release time of an Enterprise Platinum Edition instance.
    remark String
    This attribute is a concise description of instance.
    status Number
    The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
    tags Map<Any>
    A map of tags assigned to the Ons instance.
    tcpEndpoint String
    The TCP endpoint for the Message Queue for Apache RocketMQ 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.59.0 published on Friday, Jul 12, 2024 by Pulumi