alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.cms.getDynamicTagGroups

This data source provides the Cms Dynamic Tag Groups of the current Alibaba Cloud user.

NOTE: Available in v1.142.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "example_value";
    var defaultAlarmContactGroup = new AliCloud.Cms.AlarmContactGroup("defaultAlarmContactGroup", new()
    {
        AlarmContactGroupName = name,
        Describe = "example_value",
        EnableSubscribed = true,
    });

    var defaultDynamicTagGroup = new AliCloud.Cms.DynamicTagGroup("defaultDynamicTagGroup", new()
    {
        ContactGroupLists = new[]
        {
            defaultAlarmContactGroup.Id,
        },
        TagKey = "your_tag_key",
        MatchExpresses = new[]
        {
            new AliCloud.Cms.Inputs.DynamicTagGroupMatchExpressArgs
            {
                TagValue = "your_tag_value",
                TagValueMatchFunction = "all",
            },
        },
    });

    var ids = AliCloud.Cms.GetDynamicTagGroups.Invoke(new()
    {
        Ids = new[]
        {
            defaultDynamicTagGroup.Id,
        },
    });

    return new Dictionary<string, object?>
    {
        ["cmsDynamicTagGroupId1"] = ids.Apply(getDynamicTagGroupsResult => getDynamicTagGroupsResult.Groups[0]?.Id),
    };
});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		name := "example_value"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		defaultAlarmContactGroup, err := cms.NewAlarmContactGroup(ctx, "defaultAlarmContactGroup", &cms.AlarmContactGroupArgs{
			AlarmContactGroupName: pulumi.String(name),
			Describe:              pulumi.String("example_value"),
			EnableSubscribed:      pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		defaultDynamicTagGroup, err := cms.NewDynamicTagGroup(ctx, "defaultDynamicTagGroup", &cms.DynamicTagGroupArgs{
			ContactGroupLists: pulumi.StringArray{
				defaultAlarmContactGroup.ID(),
			},
			TagKey: pulumi.String("your_tag_key"),
			MatchExpresses: cms.DynamicTagGroupMatchExpressArray{
				&cms.DynamicTagGroupMatchExpressArgs{
					TagValue:              pulumi.String("your_tag_value"),
					TagValueMatchFunction: pulumi.String("all"),
				},
			},
		})
		if err != nil {
			return err
		}
		ids := cms.GetDynamicTagGroupsOutput(ctx, cms.GetDynamicTagGroupsOutputArgs{
			Ids: pulumi.StringArray{
				defaultDynamicTagGroup.ID(),
			},
		}, nil)
		ctx.Export("cmsDynamicTagGroupId1", ids.ApplyT(func(ids cms.GetDynamicTagGroupsResult) (*string, error) {
			return &ids.Groups[0].Id, nil
		}).(pulumi.StringPtrOutput))
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.cms.AlarmContactGroup;
import com.pulumi.alicloud.cms.AlarmContactGroupArgs;
import com.pulumi.alicloud.cms.DynamicTagGroup;
import com.pulumi.alicloud.cms.DynamicTagGroupArgs;
import com.pulumi.alicloud.cms.inputs.DynamicTagGroupMatchExpressArgs;
import com.pulumi.alicloud.cms.CmsFunctions;
import com.pulumi.alicloud.cms.inputs.GetDynamicTagGroupsArgs;
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 config = ctx.config();
        final var name = config.get("name").orElse("example_value");
        var defaultAlarmContactGroup = new AlarmContactGroup("defaultAlarmContactGroup", AlarmContactGroupArgs.builder()        
            .alarmContactGroupName(name)
            .describe("example_value")
            .enableSubscribed(true)
            .build());

        var defaultDynamicTagGroup = new DynamicTagGroup("defaultDynamicTagGroup", DynamicTagGroupArgs.builder()        
            .contactGroupLists(defaultAlarmContactGroup.id())
            .tagKey("your_tag_key")
            .matchExpresses(DynamicTagGroupMatchExpressArgs.builder()
                .tagValue("your_tag_value")
                .tagValueMatchFunction("all")
                .build())
            .build());

        final var ids = CmsFunctions.getDynamicTagGroups(GetDynamicTagGroupsArgs.builder()
            .ids(defaultDynamicTagGroup.id())
            .build());

        ctx.export("cmsDynamicTagGroupId1", ids.applyValue(getDynamicTagGroupsResult -> getDynamicTagGroupsResult).applyValue(ids -> ids.applyValue(getDynamicTagGroupsResult -> getDynamicTagGroupsResult.groups()[0].id())));
    }
}
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "example_value"
default_alarm_contact_group = alicloud.cms.AlarmContactGroup("defaultAlarmContactGroup",
    alarm_contact_group_name=name,
    describe="example_value",
    enable_subscribed=True)
default_dynamic_tag_group = alicloud.cms.DynamicTagGroup("defaultDynamicTagGroup",
    contact_group_lists=[default_alarm_contact_group.id],
    tag_key="your_tag_key",
    match_expresses=[alicloud.cms.DynamicTagGroupMatchExpressArgs(
        tag_value="your_tag_value",
        tag_value_match_function="all",
    )])
ids = alicloud.cms.get_dynamic_tag_groups_output(ids=[default_dynamic_tag_group.id])
pulumi.export("cmsDynamicTagGroupId1", ids.groups[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "example_value";
const defaultAlarmContactGroup = new alicloud.cms.AlarmContactGroup("defaultAlarmContactGroup", {
    alarmContactGroupName: name,
    describe: "example_value",
    enableSubscribed: true,
});
const defaultDynamicTagGroup = new alicloud.cms.DynamicTagGroup("defaultDynamicTagGroup", {
    contactGroupLists: [defaultAlarmContactGroup.id],
    tagKey: "your_tag_key",
    matchExpresses: [{
        tagValue: "your_tag_value",
        tagValueMatchFunction: "all",
    }],
});
const ids = alicloud.cms.getDynamicTagGroupsOutput({
    ids: [defaultDynamicTagGroup.id],
});
export const cmsDynamicTagGroupId1 = ids.apply(ids => ids.groups?.[0]?.id);
configuration:
  name:
    type: string
    default: example_value
resources:
  defaultAlarmContactGroup:
    type: alicloud:cms:AlarmContactGroup
    properties:
      alarmContactGroupName: ${name}
      describe: example_value
      enableSubscribed: true
  defaultDynamicTagGroup:
    type: alicloud:cms:DynamicTagGroup
    properties:
      contactGroupLists:
        - ${defaultAlarmContactGroup.id}
      tagKey: your_tag_key
      matchExpresses:
        - tagValue: your_tag_value
          tagValueMatchFunction: all
variables:
  ids:
    fn::invoke:
      Function: alicloud:cms:getDynamicTagGroups
      Arguments:
        ids:
          - ${defaultDynamicTagGroup.id}
outputs:
  cmsDynamicTagGroupId1: ${ids.groups[0].id}

Using getDynamicTagGroups

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 getDynamicTagGroups(args: GetDynamicTagGroupsArgs, opts?: InvokeOptions): Promise<GetDynamicTagGroupsResult>
function getDynamicTagGroupsOutput(args: GetDynamicTagGroupsOutputArgs, opts?: InvokeOptions): Output<GetDynamicTagGroupsResult>
def get_dynamic_tag_groups(ids: Optional[Sequence[str]] = None,
                           output_file: Optional[str] = None,
                           status: Optional[str] = None,
                           tag_key: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetDynamicTagGroupsResult
def get_dynamic_tag_groups_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                           output_file: Optional[pulumi.Input[str]] = None,
                           status: Optional[pulumi.Input[str]] = None,
                           tag_key: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetDynamicTagGroupsResult]
func GetDynamicTagGroups(ctx *Context, args *GetDynamicTagGroupsArgs, opts ...InvokeOption) (*GetDynamicTagGroupsResult, error)
func GetDynamicTagGroupsOutput(ctx *Context, args *GetDynamicTagGroupsOutputArgs, opts ...InvokeOption) GetDynamicTagGroupsResultOutput

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

public static class GetDynamicTagGroups 
{
    public static Task<GetDynamicTagGroupsResult> InvokeAsync(GetDynamicTagGroupsArgs args, InvokeOptions? opts = null)
    public static Output<GetDynamicTagGroupsResult> Invoke(GetDynamicTagGroupsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDynamicTagGroupsResult> getDynamicTagGroups(GetDynamicTagGroupsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:cms/getDynamicTagGroups:getDynamicTagGroups
  arguments:
    # arguments dictionary

The following arguments are supported:

Ids List<string>

A list of Dynamic Tag Group IDs.

OutputFile string
Status string

The status of the resource. Valid values: RUNNING, FINISH.

TagKey string

The tag key of the tag.

Ids []string

A list of Dynamic Tag Group IDs.

OutputFile string
Status string

The status of the resource. Valid values: RUNNING, FINISH.

TagKey string

The tag key of the tag.

ids List<String>

A list of Dynamic Tag Group IDs.

outputFile String
status String

The status of the resource. Valid values: RUNNING, FINISH.

tagKey String

The tag key of the tag.

ids string[]

A list of Dynamic Tag Group IDs.

outputFile string
status string

The status of the resource. Valid values: RUNNING, FINISH.

tagKey string

The tag key of the tag.

ids Sequence[str]

A list of Dynamic Tag Group IDs.

output_file str
status str

The status of the resource. Valid values: RUNNING, FINISH.

tag_key str

The tag key of the tag.

ids List<String>

A list of Dynamic Tag Group IDs.

outputFile String
status String

The status of the resource. Valid values: RUNNING, FINISH.

tagKey String

The tag key of the tag.

getDynamicTagGroups Result

The following output properties are available:

Groups List<Pulumi.AliCloud.Cms.Outputs.GetDynamicTagGroupsGroup>
Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
OutputFile string
Status string
TagKey string
Groups []GetDynamicTagGroupsGroup
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
OutputFile string
Status string
TagKey string
groups List<GetDynamicTagGroupsGroup>
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
outputFile String
status String
tagKey String
groups GetDynamicTagGroupsGroup[]
id string

The provider-assigned unique ID for this managed resource.

ids string[]
outputFile string
status string
tagKey string
groups Sequence[GetDynamicTagGroupsGroup]
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
output_file str
status str
tag_key str
groups List<Property Map>
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
outputFile String
status String
tagKey String

Supporting Types

GetDynamicTagGroupsGroup

DynamicTagRuleId string

The ID of the tag rule.

Id string

The ID of the Dynamic Tag Group.

MatchExpressFilterRelation string

The relationship between conditional expressions. Valid values: and, or.

MatchExpresses List<Pulumi.AliCloud.Cms.Inputs.GetDynamicTagGroupsGroupMatchExpress>

The label generates a matching expression that applies the grouping. See the following Block match_express.

Status string

The status of the resource. Valid values: RUNNING, FINISH.

TagKey string

The tag key of the tag.

DynamicTagRuleId string

The ID of the tag rule.

Id string

The ID of the Dynamic Tag Group.

MatchExpressFilterRelation string

The relationship between conditional expressions. Valid values: and, or.

MatchExpresses []GetDynamicTagGroupsGroupMatchExpress

The label generates a matching expression that applies the grouping. See the following Block match_express.

Status string

The status of the resource. Valid values: RUNNING, FINISH.

TagKey string

The tag key of the tag.

dynamicTagRuleId String

The ID of the tag rule.

id String

The ID of the Dynamic Tag Group.

matchExpressFilterRelation String

The relationship between conditional expressions. Valid values: and, or.

matchExpresses List<GetDynamicTagGroupsGroupMatchExpress>

The label generates a matching expression that applies the grouping. See the following Block match_express.

status String

The status of the resource. Valid values: RUNNING, FINISH.

tagKey String

The tag key of the tag.

dynamicTagRuleId string

The ID of the tag rule.

id string

The ID of the Dynamic Tag Group.

matchExpressFilterRelation string

The relationship between conditional expressions. Valid values: and, or.

matchExpresses GetDynamicTagGroupsGroupMatchExpress[]

The label generates a matching expression that applies the grouping. See the following Block match_express.

status string

The status of the resource. Valid values: RUNNING, FINISH.

tagKey string

The tag key of the tag.

dynamic_tag_rule_id str

The ID of the tag rule.

id str

The ID of the Dynamic Tag Group.

match_express_filter_relation str

The relationship between conditional expressions. Valid values: and, or.

match_expresses Sequence[GetDynamicTagGroupsGroupMatchExpress]

The label generates a matching expression that applies the grouping. See the following Block match_express.

status str

The status of the resource. Valid values: RUNNING, FINISH.

tag_key str

The tag key of the tag.

dynamicTagRuleId String

The ID of the tag rule.

id String

The ID of the Dynamic Tag Group.

matchExpressFilterRelation String

The relationship between conditional expressions. Valid values: and, or.

matchExpresses List<Property Map>

The label generates a matching expression that applies the grouping. See the following Block match_express.

status String

The status of the resource. Valid values: RUNNING, FINISH.

tagKey String

The tag key of the tag.

GetDynamicTagGroupsGroupMatchExpress

TagValue string

The tag value. The Tag value must be used in conjunction with the tag value matching method TagValueMatchFunction.

TagValueMatchFunction string

Matching method of tag value. Valid values: all, startWith,endWith,contains,notContains,equals.

TagValue string

The tag value. The Tag value must be used in conjunction with the tag value matching method TagValueMatchFunction.

TagValueMatchFunction string

Matching method of tag value. Valid values: all, startWith,endWith,contains,notContains,equals.

tagValue String

The tag value. The Tag value must be used in conjunction with the tag value matching method TagValueMatchFunction.

tagValueMatchFunction String

Matching method of tag value. Valid values: all, startWith,endWith,contains,notContains,equals.

tagValue string

The tag value. The Tag value must be used in conjunction with the tag value matching method TagValueMatchFunction.

tagValueMatchFunction string

Matching method of tag value. Valid values: all, startWith,endWith,contains,notContains,equals.

tag_value str

The tag value. The Tag value must be used in conjunction with the tag value matching method TagValueMatchFunction.

tag_value_match_function str

Matching method of tag value. Valid values: all, startWith,endWith,contains,notContains,equals.

tagValue String

The tag value. The Tag value must be used in conjunction with the tag value matching method TagValueMatchFunction.

tagValueMatchFunction String

Matching method of tag value. Valid values: all, startWith,endWith,contains,notContains,equals.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.