1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. cloudsso
  5. getGroups
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

alicloud.cloudsso.getGroups

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

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

    NOTE: Available in v1.138.0+.

    NOTE: Cloud SSO Only Support cn-shanghai And us-west-1 Region

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const ids = alicloud.cloudsso.getGroups({
        directoryId: "example_value",
        ids: [
            "example_value-1",
            "example_value-2",
        ],
    });
    export const cloudSsoGroupId1 = ids.then(ids => ids.groups?.[0]?.id);
    const nameRegex = alicloud.cloudsso.getGroups({
        directoryId: "example_value",
        nameRegex: "^my-Group",
    });
    export const cloudSsoGroupId2 = nameRegex.then(nameRegex => nameRegex.groups?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    ids = alicloud.cloudsso.get_groups(directory_id="example_value",
        ids=[
            "example_value-1",
            "example_value-2",
        ])
    pulumi.export("cloudSsoGroupId1", ids.groups[0].id)
    name_regex = alicloud.cloudsso.get_groups(directory_id="example_value",
        name_regex="^my-Group")
    pulumi.export("cloudSsoGroupId2", name_regex.groups[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cloudsso"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ids, err := cloudsso.GetGroups(ctx, &cloudsso.GetGroupsArgs{
    			DirectoryId: "example_value",
    			Ids: []string{
    				"example_value-1",
    				"example_value-2",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("cloudSsoGroupId1", ids.Groups[0].Id)
    		nameRegex, err := cloudsso.GetGroups(ctx, &cloudsso.GetGroupsArgs{
    			DirectoryId: "example_value",
    			NameRegex:   pulumi.StringRef("^my-Group"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("cloudSsoGroupId2", nameRegex.Groups[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var ids = AliCloud.CloudSso.GetGroups.Invoke(new()
        {
            DirectoryId = "example_value",
            Ids = new[]
            {
                "example_value-1",
                "example_value-2",
            },
        });
    
        var nameRegex = AliCloud.CloudSso.GetGroups.Invoke(new()
        {
            DirectoryId = "example_value",
            NameRegex = "^my-Group",
        });
    
        return new Dictionary<string, object?>
        {
            ["cloudSsoGroupId1"] = ids.Apply(getGroupsResult => getGroupsResult.Groups[0]?.Id),
            ["cloudSsoGroupId2"] = nameRegex.Apply(getGroupsResult => getGroupsResult.Groups[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.cloudsso.CloudssoFunctions;
    import com.pulumi.alicloud.cloudsso.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 ids = CloudssoFunctions.getGroups(GetGroupsArgs.builder()
                .directoryId("example_value")
                .ids(            
                    "example_value-1",
                    "example_value-2")
                .build());
    
            ctx.export("cloudSsoGroupId1", ids.applyValue(getGroupsResult -> getGroupsResult.groups()[0].id()));
            final var nameRegex = CloudssoFunctions.getGroups(GetGroupsArgs.builder()
                .directoryId("example_value")
                .nameRegex("^my-Group")
                .build());
    
            ctx.export("cloudSsoGroupId2", nameRegex.applyValue(getGroupsResult -> getGroupsResult.groups()[0].id()));
        }
    }
    
    variables:
      ids:
        fn::invoke:
          Function: alicloud:cloudsso:getGroups
          Arguments:
            directoryId: example_value
            ids:
              - example_value-1
              - example_value-2
      nameRegex:
        fn::invoke:
          Function: alicloud:cloudsso:getGroups
          Arguments:
            directoryId: example_value
            nameRegex: ^my-Group
    outputs:
      cloudSsoGroupId1: ${ids.groups[0].id}
      cloudSsoGroupId2: ${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(directory_id: Optional[str] = None,
                   ids: Optional[Sequence[str]] = None,
                   name_regex: Optional[str] = None,
                   output_file: Optional[str] = None,
                   provision_type: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetGroupsResult
    def get_groups_output(directory_id: Optional[pulumi.Input[str]] = None,
                   ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   name_regex: Optional[pulumi.Input[str]] = None,
                   output_file: Optional[pulumi.Input[str]] = None,
                   provision_type: 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:cloudsso/getGroups:getGroups
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DirectoryId string
    The ID of the Directory.
    Ids List<string>
    A list of Group IDs.
    NameRegex string
    A regex string to filter results by Group name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ProvisionType string
    The Provision Type of the Group. Valid values: Manual, Synchronized.
    DirectoryId string
    The ID of the Directory.
    Ids []string
    A list of Group IDs.
    NameRegex string
    A regex string to filter results by Group name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    ProvisionType string
    The Provision Type of the Group. Valid values: Manual, Synchronized.
    directoryId String
    The ID of the Directory.
    ids List<String>
    A list of Group IDs.
    nameRegex String
    A regex string to filter results by Group name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    provisionType String
    The Provision Type of the Group. Valid values: Manual, Synchronized.
    directoryId string
    The ID of the Directory.
    ids string[]
    A list of Group IDs.
    nameRegex string
    A regex string to filter results by Group name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    provisionType string
    The Provision Type of the Group. Valid values: Manual, Synchronized.
    directory_id str
    The ID of the Directory.
    ids Sequence[str]
    A list of Group IDs.
    name_regex str
    A regex string to filter results by Group name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    provision_type str
    The Provision Type of the Group. Valid values: Manual, Synchronized.
    directoryId String
    The ID of the Directory.
    ids List<String>
    A list of Group IDs.
    nameRegex String
    A regex string to filter results by Group name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    provisionType String
    The Provision Type of the Group. Valid values: Manual, Synchronized.

    getGroups Result

    The following output properties are available:

    DirectoryId string
    Groups List<Pulumi.AliCloud.CloudSso.Outputs.GetGroupsGroup>
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    NameRegex string
    OutputFile string
    ProvisionType string
    DirectoryId string
    Groups []GetGroupsGroup
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    NameRegex string
    OutputFile string
    ProvisionType string
    directoryId 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
    provisionType String
    directoryId string
    groups GetGroupsGroup[]
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    nameRegex string
    outputFile string
    provisionType string
    directory_id str
    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
    provision_type str
    directoryId String
    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
    provisionType String

    Supporting Types

    GetGroupsGroup

    CreateTime string
    The Created Time of the Directory.
    Description string
    The Description of the Directory.
    DirectoryId string
    The ID of the Directory.
    GroupId string
    The Group ID of the group.
    GroupName string
    The Name of the group.
    Id string
    The ID of the Group.
    ProvisionType string
    The Provision Type of the Group. Valid values: Manual, Synchronized.
    CreateTime string
    The Created Time of the Directory.
    Description string
    The Description of the Directory.
    DirectoryId string
    The ID of the Directory.
    GroupId string
    The Group ID of the group.
    GroupName string
    The Name of the group.
    Id string
    The ID of the Group.
    ProvisionType string
    The Provision Type of the Group. Valid values: Manual, Synchronized.
    createTime String
    The Created Time of the Directory.
    description String
    The Description of the Directory.
    directoryId String
    The ID of the Directory.
    groupId String
    The Group ID of the group.
    groupName String
    The Name of the group.
    id String
    The ID of the Group.
    provisionType String
    The Provision Type of the Group. Valid values: Manual, Synchronized.
    createTime string
    The Created Time of the Directory.
    description string
    The Description of the Directory.
    directoryId string
    The ID of the Directory.
    groupId string
    The Group ID of the group.
    groupName string
    The Name of the group.
    id string
    The ID of the Group.
    provisionType string
    The Provision Type of the Group. Valid values: Manual, Synchronized.
    create_time str
    The Created Time of the Directory.
    description str
    The Description of the Directory.
    directory_id str
    The ID of the Directory.
    group_id str
    The Group ID of the group.
    group_name str
    The Name of the group.
    id str
    The ID of the Group.
    provision_type str
    The Provision Type of the Group. Valid values: Manual, Synchronized.
    createTime String
    The Created Time of the Directory.
    description String
    The Description of the Directory.
    directoryId String
    The ID of the Directory.
    groupId String
    The Group ID of the group.
    groupName String
    The Name of the group.
    id String
    The ID of the Group.
    provisionType String
    The Provision Type of the Group. Valid values: Manual, Synchronized.

    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.54.0 published on Wednesday, Apr 24, 2024 by Pulumi