getServiceTopics

This data source provides the Message Notification Service Topics of the current Alibaba Cloud user.

NOTE: Available in v1.188.0+.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.message.getServiceTopics({
ids: ["example_id"],
});
export const topicId1 = ids.then(ids => ids.topics?.[0]?.id);
const name = alicloud.message.getServiceTopics({
topicName: "tf-example",
});
export const topicId2 = name.then(name => name.topics?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.message.get_service_topics(ids=["example_id"])
pulumi.export("topicId1", ids.topics[0].id)
name = alicloud.message.get_service_topics(topic_name="tf-example")
pulumi.export("topicId2", name.topics[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Message.GetServiceTopics.Invoke(new()
{
Ids = new[]
{
"example_id",
},
});
var name = AliCloud.Message.GetServiceTopics.Invoke(new()
{
TopicName = "tf-example",
});
return new Dictionary<string, object?>
{
["topicId1"] = ids&#46;Apply(getServiceTopicsResult => getServiceTopicsResult&#46;Topics[0]?.Id),
["topicId2"] = name&#46;Apply(getServiceTopicsResult => getServiceTopicsResult&#46;Topics[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/message"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := message.GetServiceTopics(ctx, &message.GetServiceTopicsArgs{
Ids: []string{
"example_id",
},
}, nil)
if err != nil {
return err
}
ctx.Export("topicId1", ids.Topics[0].Id)
name, err := message.GetServiceTopics(ctx, &message.GetServiceTopicsArgs{
TopicName: pulumi.StringRef("tf-example"),
}, nil)
if err != nil {
return err
}
ctx.Export("topicId2", name.Topics[0].Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.message.MessageFunctions;
import com.pulumi.alicloud.message.inputs.GetServiceTopicsArgs;
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 ids = MessageFunctions.getServiceTopics(GetServiceTopicsArgs.builder()
.ids("example_id")
.build());
ctx.export("topicId1", ids.applyValue(getServiceTopicsResult -> getServiceTopicsResult.topics()[0].id()));
final var name = MessageFunctions.getServiceTopics(GetServiceTopicsArgs.builder()
.topicName("tf-example")
.build());
ctx.export("topicId2", name.applyValue(getServiceTopicsResult -> getServiceTopicsResult.topics()[0].id()));
}
}
variables:
ids:
fn::invoke:
Function: alicloud:message:getServiceTopics
Arguments:
ids:
- example_id
name:
fn::invoke:
Function: alicloud:message:getServiceTopics
Arguments:
topicName: tf-example
outputs:
topicId1: ${ids.topics[0].id}
topicId2: ${name.topics[0].id}

Return

A collection of values returned by getServiceTopics.

Parameters

argument

A collection of arguments for invoking getServiceTopics.


suspend fun getServiceTopics(ids: List<String>? = null, nameRegex: String? = null, outputFile: String? = null, pageNumber: Int? = null, pageSize: Int? = null, topicName: String? = null): GetServiceTopicsResult

Return

A collection of values returned by getServiceTopics.

See also

Parameters

ids

A list of Topic IDs. Its element value is same as Topic Name.

nameRegex

A regex string to filter results by Topic name.

outputFile

File name where to save data source results (after running pulumi preview).

pageNumber
pageSize
topicName

The name of the topic.


Return

A collection of values returned by getServiceTopics.

See also

Parameters

argument

Builder for com.pulumi.alicloud.message.kotlin.inputs.GetServiceTopicsPlainArgs.