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

alicloud.directmail.getTags

Explore with Pulumi AI

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

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

    NOTE: Available in v1.144.0+.

    Example Usage

    Basic Usage

    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);
    
    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)
    
    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)
    		nameRegex, err := directmail.GetTags(ctx, &directmail.GetTagsArgs{
    			NameRegex: pulumi.StringRef("^my-Tag"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("directMailTagId2", nameRegex.Tags[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var ids = AliCloud.DirectMail.GetTags.Invoke(new()
        {
            Ids = new[]
            {
                "example_id",
            },
        });
    
        var nameRegex = AliCloud.DirectMail.GetTags.Invoke(new()
        {
            NameRegex = "^my-Tag",
        });
    
        return new Dictionary<string, object?>
        {
            ["directMailTagId1"] = ids.Apply(getTagsResult => getTagsResult.Tags[0]?.Id),
            ["directMailTagId2"] = nameRegex.Apply(getTagsResult => getTagsResult.Tags[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.directmail.DirectmailFunctions;
    import com.pulumi.alicloud.directmail.inputs.GetTagsArgs;
    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 ids = DirectmailFunctions.getTags(GetTagsArgs.builder()
                .ids("example_id")
                .build());
    
            ctx.export("directMailTagId1", ids.applyValue(getTagsResult -> getTagsResult.tags()[0].id()));
            final var nameRegex = DirectmailFunctions.getTags(GetTagsArgs.builder()
                .nameRegex("^my-Tag")
                .build());
    
            ctx.export("directMailTagId2", nameRegex.applyValue(getTagsResult -> getTagsResult.tags()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:directmail:getTags
          Arguments:
            ids:
              - example_id
      nameRegex:
        fn::invoke:
          Function: alicloud:directmail:getTags
          Arguments:
            nameRegex: ^my-Tag
    outputs:
      directMailTagId1: ${ids.tags[0].id}
      directMailTagId2: ${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)
    }
    public static CompletableFuture<GetTagsResult> getTags(GetTagsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:directmail/getTags:getTags
      arguments:
        # arguments dictionary

    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
    File name where to save data source results (after running pulumi preview).
    Ids []string
    A list of Tag IDs.
    NameRegex string
    A regex string to filter results by Tag name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ids List<String>
    A list of Tag IDs.
    nameRegex String
    A regex string to filter results by Tag name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    ids string[]
    A list of Tag IDs.
    nameRegex string
    A regex string to filter results by Tag name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    ids Sequence[str]
    A list of Tag IDs.
    name_regex str
    A regex string to filter results by Tag name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    ids List<String>
    A list of Tag IDs.
    nameRegex String
    A regex string to filter results by Tag name.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    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 List<String>
    names List<String>
    tags List<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
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    tags List<Property Map>
    nameRegex String
    outputFile String

    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 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.
    id String
    The ID of the tag.
    tagId String
    The ID of the tag.
    tagName String
    The name of the tag.

    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