Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi
alicloud.mns.getTopics
Explore with Pulumi AI
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);
import pulumi
import pulumi_alicloud as alicloud
topics = alicloud.mns.get_topics(name_prefix="tf-")
pulumi.export("firstTopicId", topics.topics[0].id)
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
	})
}
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),
    };
});
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()));
    }
}
variables:
  topics:
    fn::invoke:
      Function: alicloud:mns:getTopics
      Arguments:
        namePrefix: tf-
outputs:
  firstTopicId: ${topics.topics[0].id}
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>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]func GetTopics(ctx *Context, args *GetTopicsArgs, opts ...InvokeOption) (*GetTopicsResult, error)
func GetTopicsOutput(ctx *Context, args *GetTopicsOutputArgs, opts ...InvokeOption) GetTopicsResultOutput> 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)
}public static CompletableFuture<GetTopicsResult> getTopics(GetTopicsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:mns/getTopics:getTopics
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Name
Prefix string - A string to filter resulting topics by their name prefixs.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). 
- Name
Prefix string - A string to filter resulting topics by their name prefixs.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). 
- name
Prefix String - A string to filter resulting topics by their name prefixs.
 - output
File String - File name where to save data source results (after running 
pulumi preview). 
- name
Prefix string - A string to filter resulting topics by their name prefixs.
 - output
File 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). 
- name
Prefix String - A string to filter resulting topics by their name prefixs.
 - output
File 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.
Ali Cloud. Mns. Outputs. Get Topics Topic>  - A list of topics. Each element contains the following attributes:
 - Name
Prefix string - Output
File string 
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Names []string
 - A list of topic names.
 - Topics
[]Get
Topics Topic  - A list of topics. Each element contains the following attributes:
 - Name
Prefix string - Output
File string 
- id String
 - The provider-assigned unique ID for this managed resource.
 - names List<String>
 - A list of topic names.
 - topics
List<Get
Topics Topic>  - A list of topics. Each element contains the following attributes:
 - name
Prefix String - output
File String 
- id string
 - The provider-assigned unique ID for this managed resource.
 - names string[]
 - A list of topic names.
 - topics
Get
Topics Topic[]  - A list of topics. Each element contains the following attributes:
 - name
Prefix string - output
File string 
- id str
 - The provider-assigned unique ID for this managed resource.
 - names Sequence[str]
 - A list of topic names.
 - topics
Sequence[Get
Topics Topic]  - 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:
 - name
Prefix String - output
File String 
Supporting Types
GetTopicsTopic  
- Id string
 - The id of the topic. The value is set to 
name. - Logging
Enabled bool - Whether to enable logging.
 - Maximum
Message intSize  - This indicates the maximum length, in bytes, of any message body sent to the topic.
 - Name string
 - The name of the topic.
 
- Id string
 - The id of the topic. The value is set to 
name. - Logging
Enabled bool - Whether to enable logging.
 - Maximum
Message intSize  - This indicates the maximum length, in bytes, of any message body sent to the topic.
 - Name string
 - The name of the topic.
 
- id String
 - The id of the topic. The value is set to 
name. - logging
Enabled Boolean - Whether to enable logging.
 - maximum
Message IntegerSize  - This indicates the maximum length, in bytes, of any message body sent to the topic.
 - name String
 - The name of the topic.
 
- id string
 - The id of the topic. The value is set to 
name. - logging
Enabled boolean - Whether to enable logging.
 - maximum
Message numberSize  - This indicates the maximum length, in bytes, of any message body sent to the topic.
 - name string
 - The name of the topic.
 
- id str
 - The id of the topic. The value is set to 
name. - logging_
enabled bool - Whether to enable logging.
 - maximum_
message_ intsize  - This indicates the maximum length, in bytes, of any message body sent to the topic.
 - name str
 - The name of the topic.
 
- id String
 - The id of the topic. The value is set to 
name. - logging
Enabled Boolean - Whether to enable logging.
 - maximum
Message NumberSize  - This indicates the maximum length, in bytes, of any message body sent to the topic.
 - name 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 
alicloudTerraform Provider.