1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. actiontrail
  5. getTopics
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.actiontrail.getTopics

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    This data source provides a list of ALIKAFKA Topics in an Alibaba Cloud account according to the specified filters.

    NOTE: Available in 1.56.0+

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const topicsDs = alicloud.actiontrail.getTopics({
        instanceId: "xxx",
        nameRegex: "alikafkaTopicName",
        outputFile: "topics.txt",
    });
    export const firstTopicName = topicsDs.then(topicsDs => topicsDs.topics?.[0]?.topic);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    topics_ds = alicloud.actiontrail.get_topics(instance_id="xxx",
        name_regex="alikafkaTopicName",
        output_file="topics.txt")
    pulumi.export("firstTopicName", topics_ds.topics[0].topic)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/actiontrail"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		topicsDs, err := actiontrail.GetTopics(ctx, &actiontrail.GetTopicsArgs{
    			InstanceId: "xxx",
    			NameRegex:  pulumi.StringRef("alikafkaTopicName"),
    			OutputFile: pulumi.StringRef("topics.txt"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstTopicName", topicsDs.Topics[0].Topic)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var topicsDs = AliCloud.ActionTrail.GetTopics.Invoke(new()
        {
            InstanceId = "xxx",
            NameRegex = "alikafkaTopicName",
            OutputFile = "topics.txt",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstTopicName"] = topicsDs.Apply(getTopicsResult => getTopicsResult.Topics[0]?.Topic),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.actiontrail.ActiontrailFunctions;
    import com.pulumi.alicloud.actiontrail.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 topicsDs = ActiontrailFunctions.getTopics(GetTopicsArgs.builder()
                .instanceId("xxx")
                .nameRegex("alikafkaTopicName")
                .outputFile("topics.txt")
                .build());
    
            ctx.export("firstTopicName", topicsDs.applyValue(getTopicsResult -> getTopicsResult.topics()[0].topic()));
        }
    }
    
    variables:
      topicsDs:
        fn::invoke:
          Function: alicloud:actiontrail:getTopics
          Arguments:
            instanceId: xxx
            nameRegex: alikafkaTopicName
            outputFile: topics.txt
    outputs:
      firstTopicName: ${topicsDs.topics[0].topic}
    

    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(ids: Optional[Sequence[str]] = None,
                   instance_id: Optional[str] = None,
                   name_regex: Optional[str] = None,
                   output_file: Optional[str] = None,
                   page_number: Optional[int] = None,
                   page_size: Optional[int] = None,
                   topic: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetTopicsResult
    def get_topics_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   instance_id: Optional[pulumi.Input[str]] = None,
                   name_regex: Optional[pulumi.Input[str]] = None,
                   output_file: Optional[pulumi.Input[str]] = None,
                   page_number: Optional[pulumi.Input[int]] = None,
                   page_size: Optional[pulumi.Input[int]] = None,
                   topic: 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:actiontrail/getTopics:getTopics
      arguments:
        # arguments dictionary

    The following arguments are supported:

    InstanceId string
    ID of the instance.
    Ids List<string>
    A list of ALIKAFKA Topics IDs, It is formatted to <instance_id>:<topic>.
    NameRegex string
    A regex string to filter results by the topic name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    PageNumber int
    PageSize int
    Topic string
    A topic to filter results by the topic name.
    InstanceId string
    ID of the instance.
    Ids []string
    A list of ALIKAFKA Topics IDs, It is formatted to <instance_id>:<topic>.
    NameRegex string
    A regex string to filter results by the topic name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    PageNumber int
    PageSize int
    Topic string
    A topic to filter results by the topic name.
    instanceId String
    ID of the instance.
    ids List<String>
    A list of ALIKAFKA Topics IDs, It is formatted to <instance_id>:<topic>.
    nameRegex String
    A regex string to filter results by the topic name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    pageNumber Integer
    pageSize Integer
    topic String
    A topic to filter results by the topic name.
    instanceId string
    ID of the instance.
    ids string[]
    A list of ALIKAFKA Topics IDs, It is formatted to <instance_id>:<topic>.
    nameRegex string
    A regex string to filter results by the topic name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    pageNumber number
    pageSize number
    topic string
    A topic to filter results by the topic name.
    instance_id str
    ID of the instance.
    ids Sequence[str]
    A list of ALIKAFKA Topics IDs, It is formatted to <instance_id>:<topic>.
    name_regex str
    A regex string to filter results by the topic name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    page_number int
    page_size int
    topic str
    A topic to filter results by the topic name.
    instanceId String
    ID of the instance.
    ids List<String>
    A list of ALIKAFKA Topics IDs, It is formatted to <instance_id>:<topic>.
    nameRegex String
    A regex string to filter results by the topic name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    pageNumber Number
    pageSize Number
    topic String
    A topic to filter results by the topic name.

    getTopics Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    InstanceId string
    The instance_id of the instance.
    Names List<string>
    A list of topic names.
    Topics List<Pulumi.AliCloud.ActionTrail.Outputs.GetTopicsTopic>
    A list of topics. Each element contains the following attributes:
    TotalCount int
    NameRegex string
    OutputFile string
    PageNumber int
    PageSize int
    Topic string
    The name of the topic.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    InstanceId string
    The instance_id of the instance.
    Names []string
    A list of topic names.
    Topics []GetTopicsTopic
    A list of topics. Each element contains the following attributes:
    TotalCount int
    NameRegex string
    OutputFile string
    PageNumber int
    PageSize int
    Topic string
    The name of the topic.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    instanceId String
    The instance_id of the instance.
    names List<String>
    A list of topic names.
    topics List<GetTopicsTopic>
    A list of topics. Each element contains the following attributes:
    totalCount Integer
    nameRegex String
    outputFile String
    pageNumber Integer
    pageSize Integer
    topic String
    The name of the topic.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    instanceId string
    The instance_id of the instance.
    names string[]
    A list of topic names.
    topics GetTopicsTopic[]
    A list of topics. Each element contains the following attributes:
    totalCount number
    nameRegex string
    outputFile string
    pageNumber number
    pageSize number
    topic string
    The name of the topic.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    instance_id str
    The instance_id of the instance.
    names Sequence[str]
    A list of topic names.
    topics Sequence[GetTopicsTopic]
    A list of topics. Each element contains the following attributes:
    total_count int
    name_regex str
    output_file str
    page_number int
    page_size int
    topic str
    The name of the topic.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    instanceId String
    The instance_id of the instance.
    names List<String>
    A list of topic names.
    topics List<Property Map>
    A list of topics. Each element contains the following attributes:
    totalCount Number
    nameRegex String
    outputFile String
    pageNumber Number
    pageSize Number
    topic String
    The name of the topic.

    Supporting Types

    GetTopicsTopic

    CompactTopic bool
    whether the current topic is kafka compact topic or not.
    CreateTime string
    Time of creation.
    Id string
    The ID of the topic, It is formatted to <instance_id>:<topic>.
    InstanceId string
    ID of the instance.
    LocalTopic bool
    whether the current topic is kafka local topic or not.
    PartitionNum int
    Partition number of the topic.
    Remark string
    Remark of the topic.
    Status int
    The current status code of the topic. There are three values to describe the topic status: 0 stands for the topic is in service, 1 stands for freezing and 2 stands for pause.
    StatusName string
    The status_name of the topic.
    Topic string
    A topic to filter results by the topic name.
    Tags Dictionary<string, object>
    A mapping of tags to assign to the topic.
    CompactTopic bool
    whether the current topic is kafka compact topic or not.
    CreateTime string
    Time of creation.
    Id string
    The ID of the topic, It is formatted to <instance_id>:<topic>.
    InstanceId string
    ID of the instance.
    LocalTopic bool
    whether the current topic is kafka local topic or not.
    PartitionNum int
    Partition number of the topic.
    Remark string
    Remark of the topic.
    Status int
    The current status code of the topic. There are three values to describe the topic status: 0 stands for the topic is in service, 1 stands for freezing and 2 stands for pause.
    StatusName string
    The status_name of the topic.
    Topic string
    A topic to filter results by the topic name.
    Tags map[string]interface{}
    A mapping of tags to assign to the topic.
    compactTopic Boolean
    whether the current topic is kafka compact topic or not.
    createTime String
    Time of creation.
    id String
    The ID of the topic, It is formatted to <instance_id>:<topic>.
    instanceId String
    ID of the instance.
    localTopic Boolean
    whether the current topic is kafka local topic or not.
    partitionNum Integer
    Partition number of the topic.
    remark String
    Remark of the topic.
    status Integer
    The current status code of the topic. There are three values to describe the topic status: 0 stands for the topic is in service, 1 stands for freezing and 2 stands for pause.
    statusName String
    The status_name of the topic.
    topic String
    A topic to filter results by the topic name.
    tags Map<String,Object>
    A mapping of tags to assign to the topic.
    compactTopic boolean
    whether the current topic is kafka compact topic or not.
    createTime string
    Time of creation.
    id string
    The ID of the topic, It is formatted to <instance_id>:<topic>.
    instanceId string
    ID of the instance.
    localTopic boolean
    whether the current topic is kafka local topic or not.
    partitionNum number
    Partition number of the topic.
    remark string
    Remark of the topic.
    status number
    The current status code of the topic. There are three values to describe the topic status: 0 stands for the topic is in service, 1 stands for freezing and 2 stands for pause.
    statusName string
    The status_name of the topic.
    topic string
    A topic to filter results by the topic name.
    tags {[key: string]: any}
    A mapping of tags to assign to the topic.
    compact_topic bool
    whether the current topic is kafka compact topic or not.
    create_time str
    Time of creation.
    id str
    The ID of the topic, It is formatted to <instance_id>:<topic>.
    instance_id str
    ID of the instance.
    local_topic bool
    whether the current topic is kafka local topic or not.
    partition_num int
    Partition number of the topic.
    remark str
    Remark of the topic.
    status int
    The current status code of the topic. There are three values to describe the topic status: 0 stands for the topic is in service, 1 stands for freezing and 2 stands for pause.
    status_name str
    The status_name of the topic.
    topic str
    A topic to filter results by the topic name.
    tags Mapping[str, Any]
    A mapping of tags to assign to the topic.
    compactTopic Boolean
    whether the current topic is kafka compact topic or not.
    createTime String
    Time of creation.
    id String
    The ID of the topic, It is formatted to <instance_id>:<topic>.
    instanceId String
    ID of the instance.
    localTopic Boolean
    whether the current topic is kafka local topic or not.
    partitionNum Number
    Partition number of the topic.
    remark String
    Remark of the topic.
    status Number
    The current status code of the topic. There are three values to describe the topic status: 0 stands for the topic is in service, 1 stands for freezing and 2 stands for pause.
    statusName String
    The status_name of the topic.
    topic String
    A topic to filter results by the topic name.
    tags Map<Any>
    A mapping of tags to assign to 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.57.1 published on Wednesday, Jun 26, 2024 by Pulumi