Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi
alicloud.rocketmq.getInstances
Explore with Pulumi AI
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:
- Enable
Details bool - Default to
false
. Set it to true can output more details. - Ids List<string>
- A list of instance IDs to filter results.
- Name
Regex string - A regex string to filter results by the instance name.
- Output
File 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. - Dictionary<string, object>
- A map of tags assigned to the Ons instance.
- Enable
Details bool - Default to
false
. Set it to true can output more details. - Ids []string
- A list of instance IDs to filter results.
- Name
Regex string - A regex string to filter results by the instance name.
- Output
File 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. - map[string]interface{}
- A map of tags assigned to the Ons instance.
- enable
Details Boolean - Default to
false
. Set it to true can output more details. - ids List<String>
- A list of instance IDs to filter results.
- name
Regex String - A regex string to filter results by the instance name.
- output
File 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. - Map<String,Object>
- A map of tags assigned to the Ons instance.
- enable
Details boolean - Default to
false
. Set it to true can output more details. - ids string[]
- A list of instance IDs to filter results.
- name
Regex string - A regex string to filter results by the instance name.
- output
File 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. - {[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. - Mapping[str, Any]
- A map of tags assigned to the Ons instance.
- enable
Details Boolean - Default to
false
. Set it to true can output more details. - ids List<String>
- A list of instance IDs to filter results.
- name
Regex String - A regex string to filter results by the instance name.
- output
File 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. - 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.
Ali Cloud. Rocket MQ. Outputs. Get Instances Instance> - A list of instances. Each element contains the following attributes:
- Names List<string>
- A list of instance names.
- Enable
Details bool - Name
Regex string - Output
File string - Status int
- The status of the instance. Read Fields in InstanceVO for further details.
- 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
[]Get
Instances Instance - A list of instances. Each element contains the following attributes:
- Names []string
- A list of instance names.
- Enable
Details bool - Name
Regex string - Output
File string - Status int
- The status of the instance. Read Fields in InstanceVO for further details.
- 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<Get
Instances Instance> - A list of instances. Each element contains the following attributes:
- names List<String>
- A list of instance names.
- enable
Details Boolean - name
Regex String - output
File String - status Integer
- The status of the instance. Read Fields in InstanceVO for further details.
- 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
Get
Instances Instance[] - A list of instances. Each element contains the following attributes:
- names string[]
- A list of instance names.
- enable
Details boolean - name
Regex string - output
File string - status number
- The status of the instance. Read Fields in InstanceVO for further details.
- {[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[Get
Instances Instance] - 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.
- 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.
- enable
Details Boolean - name
Regex String - output
File String - status Number
- The status of the instance. Read Fields in InstanceVO for further details.
- Map<Any>
- A map of tags assigned to the Ons instance.
Supporting Types
GetInstancesInstance
- Http
Internal stringEndpoint - The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- Http
Internet stringEndpoint - The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- Http
Internet stringSecure Endpoint - The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
- Id string
- ID of the instance.
- Independent
Naming bool - Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
- Instance
Id string - ID of the instance.
- Instance
Name string - 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 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. - Dictionary<string, object>
- A map of tags assigned to the Ons instance.
- Tcp
Endpoint string - The TCP endpoint for the Message Queue for Apache RocketMQ instance.
- Http
Internal stringEndpoint - The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- Http
Internet stringEndpoint - The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- Http
Internet stringSecure Endpoint - The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
- Id string
- ID of the instance.
- Independent
Naming bool - Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
- Instance
Id string - ID of the instance.
- Instance
Name string - 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 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. - map[string]interface{}
- A map of tags assigned to the Ons instance.
- Tcp
Endpoint string - The TCP endpoint for the Message Queue for Apache RocketMQ instance.
- http
Internal StringEndpoint - The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- http
Internet StringEndpoint - The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- http
Internet StringSecure Endpoint - The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
- id String
- ID of the instance.
- independent
Naming Boolean - Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
- instance
Id String - ID of the instance.
- instance
Name String - Name of the instance.
- instance
Status Integer - The status of the instance. Read Fields in InstanceVO for further details.
- instance
Type Integer - The type of the instance. Read Fields in InstanceVO for further details.
- release
Time 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. - Map<String,Object>
- A map of tags assigned to the Ons instance.
- tcp
Endpoint String - The TCP endpoint for the Message Queue for Apache RocketMQ instance.
- http
Internal stringEndpoint - The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- http
Internet stringEndpoint - The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- http
Internet stringSecure Endpoint - The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
- id string
- ID of the instance.
- independent
Naming boolean - Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
- instance
Id string - ID of the instance.
- instance
Name string - Name of the instance.
- instance
Status number - The status of the instance. Read Fields in InstanceVO for further details.
- instance
Type number - The type of the instance. Read Fields in InstanceVO for further details.
- release
Time 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. - {[key: string]: any}
- A map of tags assigned to the Ons instance.
- tcp
Endpoint string - The TCP endpoint for the Message Queue for Apache RocketMQ instance.
- http_
internal_ strendpoint - The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- http_
internet_ strendpoint - The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- http_
internet_ strsecure_ endpoint - 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. - 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.
- http
Internal StringEndpoint - The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- http
Internet StringEndpoint - The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
- http
Internet StringSecure Endpoint - The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
- id String
- ID of the instance.
- independent
Naming Boolean - Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
- instance
Id String - ID of the instance.
- instance
Name String - Name of the instance.
- instance
Status Number - The status of the instance. Read Fields in InstanceVO for further details.
- instance
Type Number - The type of the instance. Read Fields in InstanceVO for further details.
- release
Time 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. - Map<Any>
- A map of tags assigned to the Ons instance.
- tcp
Endpoint 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.