Alibaba Cloud

v3.15.0 published on Thursday, Jan 13, 2022 by Pulumi

getTags

This data source provides the Direct Mail Tags of the current Alibaba Cloud user.

NOTE: Available in v1.144.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var ids = Output.Create(AliCloud.DirectMail.GetTags.InvokeAsync(new AliCloud.DirectMail.GetTagsArgs
        {
            Ids = 
            {
                "example_id",
            },
        }));
        this.DirectMailTagId1 = ids.Apply(ids => ids.Tags?[0]?.Id);
        var nameRegex = Output.Create(AliCloud.DirectMail.GetTags.InvokeAsync(new AliCloud.DirectMail.GetTagsArgs
        {
            NameRegex = "^my-Tag",
        }));
        this.DirectMailTagId2 = nameRegex.Apply(nameRegex => nameRegex.Tags?[0]?.Id);
    }

    [Output("directMailTagId1")]
    public Output<string> DirectMailTagId1 { get; set; }
    [Output("directMailTagId2")]
    public Output<string> DirectMailTagId2 { get; set; }
}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := directmail.GetTags(ctx, &directmail.GetTagsArgs{
			Ids: []string{
				"example_id",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("directMailTagId1", ids.Tags[0].Id)
		opt0 := "^my-Tag"
		nameRegex, err := directmail.GetTags(ctx, &directmail.GetTagsArgs{
			NameRegex: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("directMailTagId2", nameRegex.Tags[0].Id)
		return nil
	})
}
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.directmail.get_tags(ids=["example_id"])
pulumi.export("directMailTagId1", ids.tags[0].id)
name_regex = alicloud.directmail.get_tags(name_regex="^my-Tag")
pulumi.export("directMailTagId2", name_regex.tags[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.directmail.getTags({
    ids: ["example_id"],
});
export const directMailTagId1 = ids.then(ids => ids.tags?[0]?.id);
const nameRegex = alicloud.directmail.getTags({
    nameRegex: "^my-Tag",
});
export const directMailTagId2 = nameRegex.then(nameRegex => nameRegex.tags?[0]?.id);

Using getTags

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 getTags(args: GetTagsArgs, opts?: InvokeOptions): Promise<GetTagsResult>
function getTagsOutput(args: GetTagsOutputArgs, opts?: InvokeOptions): Output<GetTagsResult>
def get_tags(ids: Optional[Sequence[str]] = None,
             name_regex: Optional[str] = None,
             output_file: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetTagsResult
def get_tags_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
             name_regex: Optional[pulumi.Input[str]] = None,
             output_file: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetTagsResult]
func GetTags(ctx *Context, args *GetTagsArgs, opts ...InvokeOption) (*GetTagsResult, error)
func GetTagsOutput(ctx *Context, args *GetTagsOutputArgs, opts ...InvokeOption) GetTagsResultOutput

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

public static class GetTags 
{
    public static Task<GetTagsResult> InvokeAsync(GetTagsArgs args, InvokeOptions? opts = null)
    public static Output<GetTagsResult> Invoke(GetTagsInvokeArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Ids List<string>
A list of Tag IDs.
NameRegex string
A regex string to filter results by Tag name.
OutputFile string
Ids []string
A list of Tag IDs.
NameRegex string
A regex string to filter results by Tag name.
OutputFile string
ids string[]
A list of Tag IDs.
nameRegex string
A regex string to filter results by Tag name.
outputFile string
ids Sequence[str]
A list of Tag IDs.
name_regex str
A regex string to filter results by Tag name.
output_file str

getTags Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Names List<string>
Tags List<Pulumi.AliCloud.DirectMail.Outputs.GetTagsTag>
NameRegex string
OutputFile string
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Names []string
Tags []GetTagsTag
NameRegex string
OutputFile string
id string
The provider-assigned unique ID for this managed resource.
ids string[]
names string[]
tags GetTagsTag[]
nameRegex string
outputFile string
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
names Sequence[str]
tags Sequence[GetTagsTag]
name_regex str
output_file str

Supporting Types

GetTagsTag

Id string
The ID of the tag.
TagId string
The ID of the tag.
TagName string
The name of the tag.
Id string
The ID of the tag.
TagId string
The ID of the tag.
TagName string
The name of the tag.
id string
The ID of the tag.
tagId string
The ID of the tag.
tagName string
The name of the tag.
id str
The ID of the tag.
tag_id str
The ID of the tag.
tag_name str
The name of the tag.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.