1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. mns
  5. getTopics
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.mns.getTopics

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 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);
    
    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 dictionary

    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 string
    The id of the topic. The value is set to name.
    LoggingEnabled bool
    Whether to enable logging.
    MaximumMessageSize int
    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.
    LoggingEnabled bool
    Whether to enable logging.
    MaximumMessageSize int
    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.
    loggingEnabled Boolean
    Whether to enable logging.
    maximumMessageSize Integer
    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.
    loggingEnabled boolean
    Whether to enable logging.
    maximumMessageSize number
    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_size int
    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.
    loggingEnabled Boolean
    Whether to enable logging.
    maximumMessageSize Number
    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 alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi