1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. mns
  5. getTopics
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.mns.getTopics

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

This data source provides a list of MNS topics in an Alibaba Cloud account according to the specified parameters.

DEPRECATED: This datasource has been deprecated from version 1.188.0. Please use new datasource message_service_topics.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const topics = alicloud.mns.getTopics({
    namePrefix: "tf-",
});
export const firstTopicId = topics.then(topics => topics.topics?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

topics = alicloud.mns.get_topics(name_prefix="tf-")
pulumi.export("firstTopicId", topics.topics[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/mns"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		topics, err := mns.GetTopics(ctx, &mns.GetTopicsArgs{
			NamePrefix: pulumi.StringRef("tf-"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstTopicId", topics.Topics[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var topics = AliCloud.Mns.GetTopics.Invoke(new()
    {
        NamePrefix = "tf-",
    });

    return new Dictionary<string, object?>
    {
        ["firstTopicId"] = topics.Apply(getTopicsResult => getTopicsResult.Topics[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.mns.MnsFunctions;
import com.pulumi.alicloud.mns.inputs.GetTopicsArgs;
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 topics = MnsFunctions.getTopics(GetTopicsArgs.builder()
            .namePrefix("tf-")
            .build());

        ctx.export("firstTopicId", topics.applyValue(getTopicsResult -> getTopicsResult.topics()[0].id()));
    }
}
Copy
variables:
  topics:
    fn::invoke:
      function: alicloud:mns:getTopics
      arguments:
        namePrefix: tf-
outputs:
  firstTopicId: ${topics.topics[0].id}
Copy

Using getTopics

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 getTopics(args: GetTopicsArgs, opts?: InvokeOptions): Promise<GetTopicsResult>
function getTopicsOutput(args: GetTopicsOutputArgs, opts?: InvokeOptions): Output<GetTopicsResult>
Copy
def get_topics(name_prefix: Optional[str] = None,
               output_file: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetTopicsResult
def get_topics_output(name_prefix: Optional[pulumi.Input[str]] = None,
               output_file: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetTopicsResult]
Copy
func GetTopics(ctx *Context, args *GetTopicsArgs, opts ...InvokeOption) (*GetTopicsResult, error)
func GetTopicsOutput(ctx *Context, args *GetTopicsOutputArgs, opts ...InvokeOption) GetTopicsResultOutput
Copy

> Note: This function is named GetTopics in the Go SDK.

public static class GetTopics 
{
    public static Task<GetTopicsResult> InvokeAsync(GetTopicsArgs args, InvokeOptions? opts = null)
    public static Output<GetTopicsResult> Invoke(GetTopicsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetTopicsResult> getTopics(GetTopicsArgs args, InvokeOptions options)
public static Output<GetTopicsResult> getTopics(GetTopicsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:mns/getTopics:getTopics
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

NamePrefix string
A string to filter resulting topics by their name prefixs.
OutputFile string
File name where to save data source results (after running pulumi preview).
NamePrefix string
A string to filter resulting topics by their name prefixs.
OutputFile string
File name where to save data source results (after running pulumi preview).
namePrefix String
A string to filter resulting topics by their name prefixs.
outputFile String
File name where to save data source results (after running pulumi preview).
namePrefix string
A string to filter resulting topics by their name prefixs.
outputFile string
File name where to save data source results (after running pulumi preview).
name_prefix str
A string to filter resulting topics by their name prefixs.
output_file str
File name where to save data source results (after running pulumi preview).
namePrefix String
A string to filter resulting topics by their name prefixs.
outputFile String
File name where to save data source results (after running pulumi preview).

getTopics Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Names List<string>
A list of topic names.
Topics List<Pulumi.AliCloud.Mns.Outputs.GetTopicsTopic>
A list of topics. Each element contains the following attributes:
NamePrefix string
OutputFile string
Id string
The provider-assigned unique ID for this managed resource.
Names []string
A list of topic names.
Topics []GetTopicsTopic
A list of topics. Each element contains the following attributes:
NamePrefix string
OutputFile string
id String
The provider-assigned unique ID for this managed resource.
names List<String>
A list of topic names.
topics List<GetTopicsTopic>
A list of topics. Each element contains the following attributes:
namePrefix String
outputFile String
id string
The provider-assigned unique ID for this managed resource.
names string[]
A list of topic names.
topics GetTopicsTopic[]
A list of topics. Each element contains the following attributes:
namePrefix string
outputFile string
id str
The provider-assigned unique ID for this managed resource.
names Sequence[str]
A list of topic names.
topics Sequence[GetTopicsTopic]
A list of topics. Each element contains the following attributes:
name_prefix str
output_file str
id String
The provider-assigned unique ID for this managed resource.
names List<String>
A list of topic names.
topics List<Property Map>
A list of topics. Each element contains the following attributes:
namePrefix String
outputFile String

Supporting Types

GetTopicsTopic

Id This property is required. string
The id of the topic. The value is set to name.
LoggingEnabled This property is required. bool
Whether to enable logging.
MaximumMessageSize This property is required. int
This indicates the maximum length, in bytes, of any message body sent to the topic.
Name This property is required. string
The name of the topic.
Id This property is required. string
The id of the topic. The value is set to name.
LoggingEnabled This property is required. bool
Whether to enable logging.
MaximumMessageSize This property is required. int
This indicates the maximum length, in bytes, of any message body sent to the topic.
Name This property is required. string
The name of the topic.
id This property is required. String
The id of the topic. The value is set to name.
loggingEnabled This property is required. Boolean
Whether to enable logging.
maximumMessageSize This property is required. Integer
This indicates the maximum length, in bytes, of any message body sent to the topic.
name This property is required. String
The name of the topic.
id This property is required. string
The id of the topic. The value is set to name.
loggingEnabled This property is required. boolean
Whether to enable logging.
maximumMessageSize This property is required. number
This indicates the maximum length, in bytes, of any message body sent to the topic.
name This property is required. string
The name of the topic.
id This property is required. str
The id of the topic. The value is set to name.
logging_enabled This property is required. bool
Whether to enable logging.
maximum_message_size This property is required. int
This indicates the maximum length, in bytes, of any message body sent to the topic.
name This property is required. str
The name of the topic.
id This property is required. String
The id of the topic. The value is set to name.
loggingEnabled This property is required. Boolean
Whether to enable logging.
maximumMessageSize This property is required. Number
This indicates the maximum length, in bytes, of any message body sent to the topic.
name This property is required. String
The name of the topic.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi