1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. rocketmq
  5. getGroups
Alibaba Cloud v3.43.1 published on Monday, Sep 11, 2023 by Pulumi

alicloud.rocketmq.getGroups

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.43.1 published on Monday, Sep 11, 2023 by Pulumi

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

    NOTE: Available in 1.53.0+

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "onsInstanceName";
        var groupName = config.Get("groupName") ?? "GID-onsGroupDatasourceName";
        var defaultInstance = new AliCloud.RocketMQ.Instance("defaultInstance", new()
        {
            InstanceName = name,
            Remark = "default_ons_instance_remark",
        });
    
        var defaultGroup = new AliCloud.RocketMQ.Group("defaultGroup", new()
        {
            GroupName = groupName,
            InstanceId = defaultInstance.Id,
            Remark = "dafault_ons_group_remark",
        });
    
        var groupsDs = AliCloud.RocketMQ.GetGroups.Invoke(new()
        {
            InstanceId = defaultGroup.InstanceId,
            NameRegex = @var.Group_id,
            OutputFile = "groups.txt",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstGroupName"] = groupsDs.Apply(getGroupsResult => getGroupsResult.Groups[0]?.GroupName),
        };
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rocketmq"
    	"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 := "onsInstanceName"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		groupName := "GID-onsGroupDatasourceName"
    		if param := cfg.Get("groupName"); param != "" {
    			groupName = param
    		}
    		defaultInstance, err := rocketmq.NewInstance(ctx, "defaultInstance", &rocketmq.InstanceArgs{
    			InstanceName: pulumi.String(name),
    			Remark:       pulumi.String("default_ons_instance_remark"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultGroup, err := rocketmq.NewGroup(ctx, "defaultGroup", &rocketmq.GroupArgs{
    			GroupName:  pulumi.String(groupName),
    			InstanceId: defaultInstance.ID(),
    			Remark:     pulumi.String("dafault_ons_group_remark"),
    		})
    		if err != nil {
    			return err
    		}
    		groupsDs := defaultGroup.InstanceId.ApplyT(func(instanceId string) (rocketmq.GetGroupsResult, error) {
    			return rocketmq.GetGroupsOutput(ctx, rocketmq.GetGroupsOutputArgs{
    				InstanceId: instanceId,
    				NameRegex:  _var.Group_id,
    				OutputFile: "groups.txt",
    			}, nil), nil
    		}).(rocketmq.GetGroupsResultOutput)
    		ctx.Export("firstGroupName", groupsDs.ApplyT(func(groupsDs rocketmq.GetGroupsResult) (*string, error) {
    			return &groupsDs.Groups[0].GroupName, 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.rocketmq.Instance;
    import com.pulumi.alicloud.rocketmq.InstanceArgs;
    import com.pulumi.alicloud.rocketmq.Group;
    import com.pulumi.alicloud.rocketmq.GroupArgs;
    import com.pulumi.alicloud.rocketmq.RocketmqFunctions;
    import com.pulumi.alicloud.rocketmq.inputs.GetGroupsArgs;
    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("onsInstanceName");
            final var groupName = config.get("groupName").orElse("GID-onsGroupDatasourceName");
            var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()        
                .instanceName(name)
                .remark("default_ons_instance_remark")
                .build());
    
            var defaultGroup = new Group("defaultGroup", GroupArgs.builder()        
                .groupName(groupName)
                .instanceId(defaultInstance.id())
                .remark("dafault_ons_group_remark")
                .build());
    
            final var groupsDs = RocketmqFunctions.getGroups(GetGroupsArgs.builder()
                .instanceId(defaultGroup.instanceId())
                .nameRegex(var_.group_id())
                .outputFile("groups.txt")
                .build());
    
            ctx.export("firstGroupName", groupsDs.applyValue(getGroupsResult -> getGroupsResult).applyValue(groupsDs -> groupsDs.applyValue(getGroupsResult -> getGroupsResult.groups()[0].groupName())));
        }
    }
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "onsInstanceName"
    group_name = config.get("groupName")
    if group_name is None:
        group_name = "GID-onsGroupDatasourceName"
    default_instance = alicloud.rocketmq.Instance("defaultInstance",
        instance_name=name,
        remark="default_ons_instance_remark")
    default_group = alicloud.rocketmq.Group("defaultGroup",
        group_name=group_name,
        instance_id=default_instance.id,
        remark="dafault_ons_group_remark")
    groups_ds = default_group.instance_id.apply(lambda instance_id: alicloud.rocketmq.get_groups_output(instance_id=instance_id,
        name_regex=var["group_id"],
        output_file="groups.txt"))
    pulumi.export("firstGroupName", groups_ds.groups[0].group_name)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "onsInstanceName";
    const groupName = config.get("groupName") || "GID-onsGroupDatasourceName";
    const defaultInstance = new alicloud.rocketmq.Instance("defaultInstance", {
        instanceName: name,
        remark: "default_ons_instance_remark",
    });
    const defaultGroup = new alicloud.rocketmq.Group("defaultGroup", {
        groupName: groupName,
        instanceId: defaultInstance.id,
        remark: "dafault_ons_group_remark",
    });
    const groupsDs = defaultGroup.instanceId.apply(instanceId => alicloud.rocketmq.getGroupsOutput({
        instanceId: instanceId,
        nameRegex: _var.group_id,
        outputFile: "groups.txt",
    }));
    export const firstGroupName = groupsDs.apply(groupsDs => groupsDs.groups?.[0]?.groupName);
    
    configuration:
      name:
        type: string
        default: onsInstanceName
      groupName:
        type: string
        default: GID-onsGroupDatasourceName
    resources:
      defaultInstance:
        type: alicloud:rocketmq:Instance
        properties:
          instanceName: ${name}
          remark: default_ons_instance_remark
      defaultGroup:
        type: alicloud:rocketmq:Group
        properties:
          groupName: ${groupName}
          instanceId: ${defaultInstance.id}
          remark: dafault_ons_group_remark
    variables:
      groupsDs:
        fn::invoke:
          Function: alicloud:rocketmq:getGroups
          Arguments:
            instanceId: ${defaultGroup.instanceId}
            nameRegex: ${var.group_id}
            outputFile: groups.txt
    outputs:
      firstGroupName: ${groupsDs.groups[0].groupName}
    

    Using getGroups

    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 getGroups(args: GetGroupsArgs, opts?: InvokeOptions): Promise<GetGroupsResult>
    function getGroupsOutput(args: GetGroupsOutputArgs, opts?: InvokeOptions): Output<GetGroupsResult>
    def get_groups(group_id_regex: Optional[str] = None,
                   group_type: Optional[str] = None,
                   ids: Optional[Sequence[str]] = None,
                   instance_id: Optional[str] = None,
                   name_regex: Optional[str] = None,
                   output_file: Optional[str] = None,
                   tags: Optional[Mapping[str, Any]] = None,
                   opts: Optional[InvokeOptions] = None) -> GetGroupsResult
    def get_groups_output(group_id_regex: Optional[pulumi.Input[str]] = None,
                   group_type: Optional[pulumi.Input[str]] = None,
                   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,
                   tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetGroupsResult]
    func GetGroups(ctx *Context, args *GetGroupsArgs, opts ...InvokeOption) (*GetGroupsResult, error)
    func GetGroupsOutput(ctx *Context, args *GetGroupsOutputArgs, opts ...InvokeOption) GetGroupsResultOutput

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

    public static class GetGroups 
    {
        public static Task<GetGroupsResult> InvokeAsync(GetGroupsArgs args, InvokeOptions? opts = null)
        public static Output<GetGroupsResult> Invoke(GetGroupsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetGroupsResult> getGroups(GetGroupsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:rocketmq/getGroups:getGroups
      arguments:
        # arguments dictionary

    The following arguments are supported:

    InstanceId string

    ID of the ONS Instance that owns the groups.

    GroupIdRegex string

    A regex string to filter results by the group name.

    GroupType string

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    Ids List<string>

    A list of group names.

    NameRegex string
    OutputFile string

    File name where to save data source results (after running pulumi preview).

    Tags Dictionary<string, object>

    A map of tags assigned to the Ons instance.

    InstanceId string

    ID of the ONS Instance that owns the groups.

    GroupIdRegex string

    A regex string to filter results by the group name.

    GroupType string

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    Ids []string

    A list of group names.

    NameRegex string
    OutputFile string

    File name where to save data source results (after running pulumi preview).

    Tags map[string]interface{}

    A map of tags assigned to the Ons instance.

    instanceId String

    ID of the ONS Instance that owns the groups.

    groupIdRegex String

    A regex string to filter results by the group name.

    groupType String

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    ids List<String>

    A list of group names.

    nameRegex String
    outputFile String

    File name where to save data source results (after running pulumi preview).

    tags Map<String,Object>

    A map of tags assigned to the Ons instance.

    instanceId string

    ID of the ONS Instance that owns the groups.

    groupIdRegex string

    A regex string to filter results by the group name.

    groupType string

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    ids string[]

    A list of group names.

    nameRegex string
    outputFile string

    File name where to save data source results (after running pulumi preview).

    tags {[key: string]: any}

    A map of tags assigned to the Ons instance.

    instance_id str

    ID of the ONS Instance that owns the groups.

    group_id_regex str

    A regex string to filter results by the group name.

    group_type str

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    ids Sequence[str]

    A list of group names.

    name_regex str
    output_file str

    File name where to save data source results (after running pulumi preview).

    tags Mapping[str, Any]

    A map of tags assigned to the Ons instance.

    instanceId String

    ID of the ONS Instance that owns the groups.

    groupIdRegex String

    A regex string to filter results by the group name.

    groupType String

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    ids List<String>

    A list of group names.

    nameRegex String
    outputFile String

    File name where to save data source results (after running pulumi preview).

    tags Map<Any>

    A map of tags assigned to the Ons instance.

    getGroups Result

    The following output properties are available:

    Groups List<Pulumi.AliCloud.RocketMQ.Outputs.GetGroupsGroup>

    A list of groups. Each element contains the following attributes:

    Id string

    The provider-assigned unique ID for this managed resource.

    Ids List<string>

    A list of group names.

    InstanceId string
    Names List<string>
    GroupIdRegex string
    GroupType string

    Specify the protocol applicable to the created Group ID.

    NameRegex string
    OutputFile string
    Tags Dictionary<string, object>

    A map of tags assigned to the Ons group.

    Groups []GetGroupsGroup

    A list of groups. Each element contains the following attributes:

    Id string

    The provider-assigned unique ID for this managed resource.

    Ids []string

    A list of group names.

    InstanceId string
    Names []string
    GroupIdRegex string
    GroupType string

    Specify the protocol applicable to the created Group ID.

    NameRegex string
    OutputFile string
    Tags map[string]interface{}

    A map of tags assigned to the Ons group.

    groups List<GetGroupsGroup>

    A list of groups. Each element contains the following attributes:

    id String

    The provider-assigned unique ID for this managed resource.

    ids List<String>

    A list of group names.

    instanceId String
    names List<String>
    groupIdRegex String
    groupType String

    Specify the protocol applicable to the created Group ID.

    nameRegex String
    outputFile String
    tags Map<String,Object>

    A map of tags assigned to the Ons group.

    groups GetGroupsGroup[]

    A list of groups. Each element contains the following attributes:

    id string

    The provider-assigned unique ID for this managed resource.

    ids string[]

    A list of group names.

    instanceId string
    names string[]
    groupIdRegex string
    groupType string

    Specify the protocol applicable to the created Group ID.

    nameRegex string
    outputFile string
    tags {[key: string]: any}

    A map of tags assigned to the Ons group.

    groups Sequence[GetGroupsGroup]

    A list of groups. Each element contains the following attributes:

    id str

    The provider-assigned unique ID for this managed resource.

    ids Sequence[str]

    A list of group names.

    instance_id str
    names Sequence[str]
    group_id_regex str
    group_type str

    Specify the protocol applicable to the created Group ID.

    name_regex str
    output_file str
    tags Mapping[str, Any]

    A map of tags assigned to the Ons group.

    groups List<Property Map>

    A list of groups. Each element contains the following attributes:

    id String

    The provider-assigned unique ID for this managed resource.

    ids List<String>

    A list of group names.

    instanceId String
    names List<String>
    groupIdRegex String
    groupType String

    Specify the protocol applicable to the created Group ID.

    nameRegex String
    outputFile String
    tags Map<Any>

    A map of tags assigned to the Ons group.

    Supporting Types

    GetGroupsGroup

    GroupName string

    The name of the group.

    GroupType string

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    Id string

    The name of the group.

    IndependentNaming bool

    Indicates whether namespaces are available. Read Fields in SubscribeInfoDo for further details.

    InstanceId string

    ID of the ONS Instance that owns the groups.

    Owner string

    The ID of the group owner, which is the Alibaba Cloud UID.

    Remark string

    Remark of the group.

    Tags Dictionary<string, object>

    A map of tags assigned to the Ons instance.

    GroupName string

    The name of the group.

    GroupType string

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    Id string

    The name of the group.

    IndependentNaming bool

    Indicates whether namespaces are available. Read Fields in SubscribeInfoDo for further details.

    InstanceId string

    ID of the ONS Instance that owns the groups.

    Owner string

    The ID of the group owner, which is the Alibaba Cloud UID.

    Remark string

    Remark of the group.

    Tags map[string]interface{}

    A map of tags assigned to the Ons instance.

    groupName String

    The name of the group.

    groupType String

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    id String

    The name of the group.

    independentNaming Boolean

    Indicates whether namespaces are available. Read Fields in SubscribeInfoDo for further details.

    instanceId String

    ID of the ONS Instance that owns the groups.

    owner String

    The ID of the group owner, which is the Alibaba Cloud UID.

    remark String

    Remark of the group.

    tags Map<String,Object>

    A map of tags assigned to the Ons instance.

    groupName string

    The name of the group.

    groupType string

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    id string

    The name of the group.

    independentNaming boolean

    Indicates whether namespaces are available. Read Fields in SubscribeInfoDo for further details.

    instanceId string

    ID of the ONS Instance that owns the groups.

    owner string

    The ID of the group owner, which is the Alibaba Cloud UID.

    remark string

    Remark of the group.

    tags {[key: string]: any}

    A map of tags assigned to the Ons instance.

    group_name str

    The name of the group.

    group_type str

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    id str

    The name of the group.

    independent_naming bool

    Indicates whether namespaces are available. Read Fields in SubscribeInfoDo for further details.

    instance_id str

    ID of the ONS Instance that owns the groups.

    owner str

    The ID of the group owner, which is the Alibaba Cloud UID.

    remark str

    Remark of the group.

    tags Mapping[str, Any]

    A map of tags assigned to the Ons instance.

    groupName String

    The name of the group.

    groupType String

    Specify the protocol applicable to the created Group ID. Valid values: tcp, http. Default to tcp.

    id String

    The name of the group.

    independentNaming Boolean

    Indicates whether namespaces are available. Read Fields in SubscribeInfoDo for further details.

    instanceId String

    ID of the ONS Instance that owns the groups.

    owner String

    The ID of the group owner, which is the Alibaba Cloud UID.

    remark String

    Remark of the group.

    tags Map<Any>

    A map of tags assigned to the Ons instance.

    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.43.1 published on Monday, Sep 11, 2023 by Pulumi