get Service Topics
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);
Content copied to clipboard
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)
Content copied to clipboard
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.Apply(getServiceTopicsResult => getServiceTopicsResult.Topics[0]?.Id),
["topicId2"] = name.Apply(getServiceTopicsResult => getServiceTopicsResult.Topics[0]?.Id),
};
});
Content copied to clipboard
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
})
}
Content copied to clipboard
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.topics()[0].id());
final var name = MessageFunctions.getServiceTopics(GetServiceTopicsArgs.builder()
.topicName("tf-example")
.build());
ctx.export("topicId2", name.topics()[0].id());
}
}
Content copied to clipboard
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}
Content copied to clipboard
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.
Parameters
ids
A list of Topic IDs. Its element value is same as Topic Name.
name Regex
A regex string to filter results by Topic name.
output File
File name where to save data source results (after running pulumi preview
).
page Number
page Size
topic Name
The name of the topic.
See also
suspend fun getServiceTopics(argument: suspend GetServiceTopicsPlainArgsBuilder.() -> Unit): GetServiceTopicsResult
Return
A collection of values returned by getServiceTopics.
Parameters
argument
Builder for com.pulumi.alicloud.message.kotlin.inputs.GetServiceTopicsPlainArgs.