Alibaba Cloud

v3.28.0 published on Tuesday, Aug 16, 2022 by Pulumi

getGroups

This data source provides the Security Center Groups of the current Alibaba Cloud user.

NOTE: Available in v1.133.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var nameRegex = Output.Create(AliCloud.SecurityCenter.GetGroups.InvokeAsync(new AliCloud.SecurityCenter.GetGroupsArgs
        {
            NameRegex = "^my-Group",
        }));
        this.SecurityCenterGroups = nameRegex.Apply(nameRegex => nameRegex.Groups?[0]?.Id);
    }

    [Output("securityCenterGroups")]
    public Output<string> SecurityCenterGroups { get; set; }
}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		nameRegex, err := securitycenter.GetGroups(ctx, &securitycenter.GetGroupsArgs{
			NameRegex: pulumi.StringRef("^my-Group"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("securityCenterGroups", nameRegex.Groups[0].Id)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.securitycenter.SecuritycenterFunctions;
import com.pulumi.alicloud.apigateway.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 nameRegex = SecuritycenterFunctions.getGroups(GetGroupsArgs.builder()
            .nameRegex("^my-Group")
            .build());

        ctx.export("securityCenterGroups", nameRegex.applyValue(getGroupsResult -> getGroupsResult.groups()[0].id()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

name_regex = alicloud.securitycenter.get_groups(name_regex="^my-Group")
pulumi.export("securityCenterGroups", name_regex.groups[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const nameRegex = alicloud.securitycenter.getGroups({
    nameRegex: "^my-Group",
});
export const securityCenterGroups = nameRegex.then(nameRegex => nameRegex.groups?[0]?.id);
variables:
  nameRegex:
    Fn::Invoke:
      Function: alicloud:securitycenter:getGroups
      Arguments:
        nameRegex: ^my-Group
outputs:
  securityCenterGroups: ${nameRegex.groups[0].id}

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(ids: Optional[Sequence[str]] = None,
               name_regex: Optional[str] = None,
               output_file: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetGroupsResult
def get_groups_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[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:securitycenter/getGroups:getGroups
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Ids List<string>

A list of Group IDs.

NameRegex string

A regex string to filter results by Group name.

OutputFile string
Ids []string

A list of Group IDs.

NameRegex string

A regex string to filter results by Group name.

OutputFile string
ids List<String>

A list of Group IDs.

nameRegex String

A regex string to filter results by Group name.

outputFile String
ids string[]

A list of Group IDs.

nameRegex string

A regex string to filter results by Group name.

outputFile string
ids Sequence[str]

A list of Group IDs.

name_regex str

A regex string to filter results by Group name.

output_file str
ids List<String>

A list of Group IDs.

nameRegex String

A regex string to filter results by Group name.

outputFile String

getGroups Result

The following output properties are available:

Groups List<Pulumi.AliCloud.SecurityCenter.Outputs.GetGroupsGroup>
Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
Names List<string>
NameRegex string
OutputFile string
Groups []GetGroupsGroup
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
Names []string
NameRegex string
OutputFile string
groups List<GetGroupsGroup>
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
names List<String>
nameRegex String
outputFile String
groups GetGroupsGroup[]
id string

The provider-assigned unique ID for this managed resource.

ids string[]
names string[]
nameRegex string
outputFile string
groups Sequence[GetGroupsGroup]
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
names Sequence[str]
name_regex str
output_file str
groups List<Property Map>
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
names List<String>
nameRegex String
outputFile String

Supporting Types

GetGroupsGroup

GroupFlag int

GroupFlag, '0' mean default group(created by system), '1' means customer defined group.

GroupId string

The ID of Group.

GroupName string

The name of Group.

Id string

The ID of the Group(same as the group_id).

GroupFlag int

GroupFlag, '0' mean default group(created by system), '1' means customer defined group.

GroupId string

The ID of Group.

GroupName string

The name of Group.

Id string

The ID of the Group(same as the group_id).

groupFlag Integer

GroupFlag, '0' mean default group(created by system), '1' means customer defined group.

groupId String

The ID of Group.

groupName String

The name of Group.

id String

The ID of the Group(same as the group_id).

groupFlag number

GroupFlag, '0' mean default group(created by system), '1' means customer defined group.

groupId string

The ID of Group.

groupName string

The name of Group.

id string

The ID of the Group(same as the group_id).

group_flag int

GroupFlag, '0' mean default group(created by system), '1' means customer defined group.

group_id str

The ID of Group.

group_name str

The name of Group.

id str

The ID of the Group(same as the group_id).

groupFlag Number

GroupFlag, '0' mean default group(created by system), '1' means customer defined group.

groupId String

The ID of Group.

groupName String

The name of Group.

id String

The ID of the Group(same as the group_id).

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.