Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

getInstances

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

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var name = config.Get("name") ?? "onsInstanceDatasourceName";
        var @default = new AliCloud.RocketMQ.Instance("default", new AliCloud.RocketMQ.InstanceArgs
        {
            Remark = "default_ons_instance_remark",
        });
        var instancesDs = AliCloud.RocketMQ.GetInstances.Invoke(new AliCloud.RocketMQ.GetInstancesInvokeArgs
        {
            Ids = 
            {
                @default.Id,
            },
            NameRegex = @default.Name,
            OutputFile = "instances.txt",
        });
        this.FirstInstanceId = instancesDs.Apply(instancesDs => instancesDs.Instances?[0]?.InstanceId);
    }

    [Output("firstInstanceId")]
    public Output<string> FirstInstanceId { get; set; }
}
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{
			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.StringOutput))
		return nil
	})
}
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.actiontrail.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()        
            .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())));
    }
}
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", 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)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "onsInstanceDatasourceName";

const defaultInstance = new alicloud.rocketmq.Instance("default", {
    remark: "default_ons_instance_remark",
});
const instancesDs = pulumi.all([defaultInstance.id, defaultInstance.name]).apply(([id, name]) => alicloud.rocketmq.getInstances({
    ids: [id],
    nameRegex: name,
    outputFile: "instances.txt",
}));

export const firstInstanceId = instancesDs.instances[0].instanceId;
configuration:
  name:
    type: string
    default: onsInstanceDatasourceName
resources:
  default:
    type: alicloud:rocketmq:Instance
    properties:
      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
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
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
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
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
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
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
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.