Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi
alicloud.actiontrail.getTopics
Explore with Pulumi AI
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)
public static Output<GetTopicsResult> getTopics(GetTopicsArgs args, InvokeOptions options)
fn::invoke:
  function: alicloud:actiontrail/getTopics:getTopics
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Instance
Id string - ID of the instance.
 - Ids List<string>
 - A list of ALIKAFKA Topics IDs, It is formatted to 
<instance_id>:<topic>. - Name
Regex string - A regex string to filter results by the topic name.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Page
Number int - Page
Size int - Topic string
 - A topic to filter results by the topic name.
 
- Instance
Id string - ID of the instance.
 - Ids []string
 - A list of ALIKAFKA Topics IDs, It is formatted to 
<instance_id>:<topic>. - Name
Regex string - A regex string to filter results by the topic name.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Page
Number int - Page
Size int - Topic string
 - A topic to filter results by the topic name.
 
- instance
Id String - ID of the instance.
 - ids List<String>
 - A list of ALIKAFKA Topics IDs, It is formatted to 
<instance_id>:<topic>. - name
Regex String - A regex string to filter results by the topic name.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - page
Number Integer - page
Size Integer - topic String
 - A topic to filter results by the topic name.
 
- instance
Id string - ID of the instance.
 - ids string[]
 - A list of ALIKAFKA Topics IDs, It is formatted to 
<instance_id>:<topic>. - name
Regex string - A regex string to filter results by the topic name.
 - output
File string - File name where to save data source results (after running 
pulumi preview). - page
Number number - page
Size 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.
 
- instance
Id String - ID of the instance.
 - ids List<String>
 - A list of ALIKAFKA Topics IDs, It is formatted to 
<instance_id>:<topic>. - name
Regex String - A regex string to filter results by the topic name.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - page
Number Number - page
Size 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>
 - Instance
Id string - The instance_id of the instance.
 - Names List<string>
 - A list of topic names.
 - Topics
List<Pulumi.
Ali Cloud. Action Trail. Outputs. Get Topics Topic>  - A list of topics. Each element contains the following attributes:
 - Total
Count int - Name
Regex string - Output
File string - Page
Number int - Page
Size int - Topic string
 - The name of the topic.
 
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids []string
 - Instance
Id string - The instance_id of the instance.
 - Names []string
 - A list of topic names.
 - Topics
[]Get
Topics Topic  - A list of topics. Each element contains the following attributes:
 - Total
Count int - Name
Regex string - Output
File string - Page
Number int - Page
Size int - Topic string
 - The name of the topic.
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - instance
Id String - The instance_id of the instance.
 - names List<String>
 - A list of topic names.
 - topics
List<Get
Topics Topic>  - A list of topics. Each element contains the following attributes:
 - total
Count Integer - name
Regex String - output
File String - page
Number Integer - page
Size Integer - topic String
 - The name of the topic.
 
- id string
 - The provider-assigned unique ID for this managed resource.
 - ids string[]
 - instance
Id string - The instance_id of the instance.
 - names string[]
 - A list of topic names.
 - topics
Get
Topics Topic[]  - A list of topics. Each element contains the following attributes:
 - total
Count number - name
Regex string - output
File string - page
Number number - page
Size 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[Get
Topics Topic]  - 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>
 - instance
Id 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:
 - total
Count Number - name
Regex String - output
File String - page
Number Number - page
Size Number - topic String
 - The name of the topic.
 
Supporting Types
GetTopicsTopic  
- Compact
Topic bool - whether the current topic is kafka compact topic or not.
 - Create
Time string - Time of creation.
 - Id string
 - The ID of the topic, It is formatted to 
<instance_id>:<topic>. - Instance
Id string - 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 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.
 - Status
Name string - The status_name of the topic.
 - Topic string
 - A topic to filter results by the topic name.
 - Dictionary<string, string>
 - A mapping of tags to assign to the topic.
 
- Compact
Topic bool - whether the current topic is kafka compact topic or not.
 - Create
Time string - Time of creation.
 - Id string
 - The ID of the topic, It is formatted to 
<instance_id>:<topic>. - Instance
Id string - 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 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.
 - Status
Name string - The status_name of the topic.
 - Topic string
 - A topic to filter results by the topic name.
 - map[string]string
 - A mapping of tags to assign to the topic.
 
- compact
Topic Boolean - whether the current topic is kafka compact topic or not.
 - create
Time String - Time of creation.
 - id String
 - The ID of the topic, It is formatted to 
<instance_id>:<topic>. - instance
Id String - ID of the instance.
 - local
Topic Boolean - whether the current topic is kafka local topic or not.
 - partition
Num 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.
 - status
Name String - The status_name of the topic.
 - topic String
 - A topic to filter results by the topic name.
 - Map<String,String>
 - A mapping of tags to assign to the topic.
 
- compact
Topic boolean - whether the current topic is kafka compact topic or not.
 - create
Time string - Time of creation.
 - id string
 - The ID of the topic, It is formatted to 
<instance_id>:<topic>. - instance
Id string - ID of the instance.
 - local
Topic boolean - whether the current topic is kafka local topic or not.
 - partition
Num 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.
 - status
Name string - The status_name of the topic.
 - topic string
 - A topic to filter results by the topic name.
 - {[key: string]: string}
 - 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.
 - Mapping[str, str]
 - A mapping of tags to assign to the topic.
 
- compact
Topic Boolean - whether the current topic is kafka compact topic or not.
 - create
Time String - Time of creation.
 - id String
 - The ID of the topic, It is formatted to 
<instance_id>:<topic>. - instance
Id String - ID of the instance.
 - local
Topic Boolean - whether the current topic is kafka local topic or not.
 - partition
Num 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.
 - status
Name String - The status_name of the topic.
 - topic String
 - A topic to filter results by the topic name.
 - Map<String>
 - 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 
alicloudTerraform Provider.