GetTopics

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

NOTE: Available in 1.53.0+

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var name = config.Get("name") ?? "onsInstanceName";
        var topic = config.Get("topic") ?? "onsTopicDatasourceName";
        var defaultInstance = new AliCloud.RocketMQ.Instance("defaultInstance", new AliCloud.RocketMQ.InstanceArgs
        {
            Remark = "default_ons_instance_remark",
        });
        var defaultTopic = new AliCloud.RocketMQ.Topic("defaultTopic", new AliCloud.RocketMQ.TopicArgs
        {
            InstanceId = defaultInstance.Id,
            MessageType = 0,
            Remark = "dafault_ons_topic_remark",
            Topic = topic,
        });
        var topicsDs = defaultTopic.InstanceId.Apply(instanceId => AliCloud.RocketMQ.GetTopics.InvokeAsync(new AliCloud.RocketMQ.GetTopicsArgs
        {
            InstanceId = instanceId,
            NameRegex = topic,
            OutputFile = "topics.txt",
        }));
        this.FirstTopicName = topicsDs.Apply(topicsDs => topicsDs.Topics[0].Topic);
    }

    [Output("firstTopicName")]
    public Output<string> FirstTopicName { get; set; }
}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "onsInstanceName"
topic = config.get("topic")
if topic is None:
    topic = "onsTopicDatasourceName"
default_instance = alicloud.rocketmq.Instance("defaultInstance", remark="default_ons_instance_remark")
default_topic = alicloud.rocketmq.Topic("defaultTopic",
    instance_id=default_instance.id,
    message_type=0,
    remark="dafault_ons_topic_remark",
    topic=topic)
topics_ds = default_topic.instance_id.apply(lambda instance_id: alicloud.rocketmq.get_topics(instance_id=instance_id,
    name_regex=topic,
    output_file="topics.txt"))
pulumi.export("firstTopicName", topics_ds.topics[0]["topic"])
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "onsInstanceName";
const topic = config.get("topic") || "onsTopicDatasourceName";

const defaultInstance = new alicloud.rocketmq.Instance("default", {
    remark: "default_ons_instance_remark",
});
const defaultTopic = new alicloud.rocketmq.Topic("default", {
    instanceId: defaultInstance.id,
    messageType: 0,
    remark: "dafault_ons_topic_remark",
    topic: topic,
});
const topicsDs = defaultTopic.instanceId.apply(instanceId => alicloud.rocketmq.getTopics({
    instanceId: instanceId,
    nameRegex: topic,
    outputFile: "topics.txt",
}, { async: true }));

export const firstTopicName = topicsDs.topics[0].topic;

Using GetTopics

function getTopics(args: GetTopicsArgs, opts?: InvokeOptions): Promise<GetTopicsResult>
function  get_topics(instance_id=None, name_regex=None, output_file=None, opts=None)
func GetTopics(ctx *Context, args *GetTopicsArgs, opts ...InvokeOption) (*GetTopicsResult, error)
public static class GetTopics {
    public static Task<GetTopicsResult> InvokeAsync(GetTopicsArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

InstanceId string

ID of the ONS Instance that owns the topics.

NameRegex string

A regex string to filter results by the topic name.

OutputFile string
InstanceId string

ID of the ONS Instance that owns the topics.

NameRegex string

A regex string to filter results by the topic name.

OutputFile string
instanceId string

ID of the ONS Instance that owns the topics.

nameRegex string

A regex string to filter results by the topic name.

outputFile string
instance_id str

ID of the ONS Instance that owns the topics.

name_regex str

A regex string to filter results by the topic name.

output_file str

GetTopics Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

InstanceId string
Names List<string>

A list of topic names.

Topics List<Pulumi.AliCloud.RocketMQ.Outputs.GetTopicsTopic>

A list of topics. Each element contains the following attributes:

NameRegex string
OutputFile string
Id string

The provider-assigned unique ID for this managed resource.

InstanceId string
Names []string

A list of topic names.

Topics []GetTopicsTopic

A list of topics. Each element contains the following attributes:

NameRegex string
OutputFile string
id string

The provider-assigned unique ID for this managed resource.

instanceId string
names string[]

A list of topic names.

topics GetTopicsTopic[]

A list of topics. Each element contains the following attributes:

nameRegex string
outputFile string
id str

The provider-assigned unique ID for this managed resource.

instance_id str
names List[str]

A list of topic names.

topics List[GetTopicsTopic]

A list of topics. Each element contains the following attributes:

name_regex str
output_file str

Supporting Types

GetTopicsTopic

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

CreateTime string

Time of creation.

IndependentNaming bool

Indicates whether namespaces are available. Read Fields in PublishInfoDo for further details.

MessageType int

The type of the message. Read Fields in PublishInfoDo for further details.

Owner string

The ID of the topic owner, which is the Alibaba Cloud UID.

Relation int

The relation ID. Read Fields in PublishInfoDo for further details.

RelationName string

The name of the relation, for example, owner, publishable, subscribable, and publishable and subscribable.

Remark string

Remark of the topic.

Topic string

The name of the topic.

CreateTime string

Time of creation.

IndependentNaming bool

Indicates whether namespaces are available. Read Fields in PublishInfoDo for further details.

MessageType int

The type of the message. Read Fields in PublishInfoDo for further details.

Owner string

The ID of the topic owner, which is the Alibaba Cloud UID.

Relation int

The relation ID. Read Fields in PublishInfoDo for further details.

RelationName string

The name of the relation, for example, owner, publishable, subscribable, and publishable and subscribable.

Remark string

Remark of the topic.

Topic string

The name of the topic.

createTime string

Time of creation.

independentNaming boolean

Indicates whether namespaces are available. Read Fields in PublishInfoDo for further details.

messageType number

The type of the message. Read Fields in PublishInfoDo for further details.

owner string

The ID of the topic owner, which is the Alibaba Cloud UID.

relation number

The relation ID. Read Fields in PublishInfoDo for further details.

relationName string

The name of the relation, for example, owner, publishable, subscribable, and publishable and subscribable.

remark string

Remark of the topic.

topic string

The name of the topic.

create_time str

Time of creation.

independentNaming bool

Indicates whether namespaces are available. Read Fields in PublishInfoDo for further details.

message_type float

The type of the message. Read Fields in PublishInfoDo for further details.

owner str

The ID of the topic owner, which is the Alibaba Cloud UID.

relation float

The relation ID. Read Fields in PublishInfoDo for further details.

relationName str

The name of the relation, for example, owner, publishable, subscribable, and publishable and subscribable.

remark str

Remark of the topic.

topic str

The name of the topic.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.