Alibaba Cloud

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

getUsers

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

NOTE: Available in v1.140.0+.

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

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var ids = Output.Create(AliCloud.CloudSso.GetUsers.InvokeAsync(new AliCloud.CloudSso.GetUsersArgs
        {
            DirectoryId = "example_value",
            Ids = 
            {
                "example_value-1",
                "example_value-2",
            },
        }));
        this.CloudSsoUserId1 = ids.Apply(ids => ids.Users?[0]?.Id);
        var nameRegex = Output.Create(AliCloud.CloudSso.GetUsers.InvokeAsync(new AliCloud.CloudSso.GetUsersArgs
        {
            DirectoryId = "example_value",
            NameRegex = "^my-User",
        }));
        this.CloudSsoUserId2 = nameRegex.Apply(nameRegex => nameRegex.Users?[0]?.Id);
        var provisionType = Output.Create(AliCloud.CloudSso.GetUsers.InvokeAsync(new AliCloud.CloudSso.GetUsersArgs
        {
            DirectoryId = "example_value",
            Ids = 
            {
                "example_value-1",
            },
            ProvisionType = "Manual",
        }));
        this.CloudSsoUserId3 = provisionType.Apply(provisionType => provisionType.Users?[0]?.Id);
        var status = Output.Create(AliCloud.CloudSso.GetUsers.InvokeAsync(new AliCloud.CloudSso.GetUsersArgs
        {
            DirectoryId = "example_value",
            Ids = 
            {
                "example_value-1",
            },
            Status = "Enabled",
        }));
        this.CloudSsoUserId4 = status.Apply(status => status.Users?[0]?.Id);
    }

    [Output("cloudSsoUserId1")]
    public Output<string> CloudSsoUserId1 { get; set; }
    [Output("cloudSsoUserId2")]
    public Output<string> CloudSsoUserId2 { get; set; }
    [Output("cloudSsoUserId3")]
    public Output<string> CloudSsoUserId3 { get; set; }
    [Output("cloudSsoUserId4")]
    public Output<string> CloudSsoUserId4 { get; set; }
}
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.GetUsers(ctx, &cloudsso.GetUsersArgs{
			DirectoryId: "example_value",
			Ids: []string{
				"example_value-1",
				"example_value-2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("cloudSsoUserId1", ids.Users[0].Id)
		nameRegex, err := cloudsso.GetUsers(ctx, &cloudsso.GetUsersArgs{
			DirectoryId: "example_value",
			NameRegex:   pulumi.StringRef("^my-User"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("cloudSsoUserId2", nameRegex.Users[0].Id)
		provisionType, err := cloudsso.GetUsers(ctx, &cloudsso.GetUsersArgs{
			DirectoryId: "example_value",
			Ids: []string{
				"example_value-1",
			},
			ProvisionType: pulumi.StringRef("Manual"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("cloudSsoUserId3", provisionType.Users[0].Id)
		status, err := cloudsso.GetUsers(ctx, &cloudsso.GetUsersArgs{
			DirectoryId: "example_value",
			Ids: []string{
				"example_value-1",
			},
			Status: pulumi.StringRef("Enabled"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("cloudSsoUserId4", status.Users[0].Id)
		return nil
	})
}
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.bastionhost.inputs.GetUsersArgs;
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.getUsers(GetUsersArgs.builder()
            .directoryId("example_value")
            .ids(            
                "example_value-1",
                "example_value-2")
            .build());

        ctx.export("cloudSsoUserId1", ids.applyValue(getUsersResult -> getUsersResult.users()[0].id()));
        final var nameRegex = CloudssoFunctions.getUsers(GetUsersArgs.builder()
            .directoryId("example_value")
            .nameRegex("^my-User")
            .build());

        ctx.export("cloudSsoUserId2", nameRegex.applyValue(getUsersResult -> getUsersResult.users()[0].id()));
        final var provisionType = CloudssoFunctions.getUsers(GetUsersArgs.builder()
            .directoryId("example_value")
            .ids("example_value-1")
            .provisionType("Manual")
            .build());

        ctx.export("cloudSsoUserId3", provisionType.applyValue(getUsersResult -> getUsersResult.users()[0].id()));
        final var status = CloudssoFunctions.getUsers(GetUsersArgs.builder()
            .directoryId("example_value")
            .ids("example_value-1")
            .status("Enabled")
            .build());

        ctx.export("cloudSsoUserId4", status.applyValue(getUsersResult -> getUsersResult.users()[0].id()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.cloudsso.get_users(directory_id="example_value",
    ids=[
        "example_value-1",
        "example_value-2",
    ])
pulumi.export("cloudSsoUserId1", ids.users[0].id)
name_regex = alicloud.cloudsso.get_users(directory_id="example_value",
    name_regex="^my-User")
pulumi.export("cloudSsoUserId2", name_regex.users[0].id)
provision_type = alicloud.cloudsso.get_users(directory_id="example_value",
    ids=["example_value-1"],
    provision_type="Manual")
pulumi.export("cloudSsoUserId3", provision_type.users[0].id)
status = alicloud.cloudsso.get_users(directory_id="example_value",
    ids=["example_value-1"],
    status="Enabled")
pulumi.export("cloudSsoUserId4", status.users[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.cloudsso.getUsers({
    directoryId: "example_value",
    ids: [
        "example_value-1",
        "example_value-2",
    ],
});
export const cloudSsoUserId1 = ids.then(ids => ids.users?[0]?.id);
const nameRegex = alicloud.cloudsso.getUsers({
    directoryId: "example_value",
    nameRegex: "^my-User",
});
export const cloudSsoUserId2 = nameRegex.then(nameRegex => nameRegex.users?[0]?.id);
const provisionType = alicloud.cloudsso.getUsers({
    directoryId: "example_value",
    ids: ["example_value-1"],
    provisionType: "Manual",
});
export const cloudSsoUserId3 = provisionType.then(provisionType => provisionType.users?[0]?.id);
const status = alicloud.cloudsso.getUsers({
    directoryId: "example_value",
    ids: ["example_value-1"],
    status: "Enabled",
});
export const cloudSsoUserId4 = status.then(status => status.users?[0]?.id);
variables:
  ids:
    Fn::Invoke:
      Function: alicloud:cloudsso:getUsers
      Arguments:
        directoryId: example_value
        ids:
          - example_value-1
          - example_value-2
  nameRegex:
    Fn::Invoke:
      Function: alicloud:cloudsso:getUsers
      Arguments:
        directoryId: example_value
        nameRegex: ^my-User
  provisionType:
    Fn::Invoke:
      Function: alicloud:cloudsso:getUsers
      Arguments:
        directoryId: example_value
        ids:
          - example_value-1
        provisionType: Manual
  status:
    Fn::Invoke:
      Function: alicloud:cloudsso:getUsers
      Arguments:
        directoryId: example_value
        ids:
          - example_value-1
        status: Enabled
outputs:
  cloudSsoUserId1: ${ids.users[0].id}
  cloudSsoUserId2: ${nameRegex.users[0].id}
  cloudSsoUserId3: ${provisionType.users[0].id}
  cloudSsoUserId4: ${status.users[0].id}

Using getUsers

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 getUsers(args: GetUsersArgs, opts?: InvokeOptions): Promise<GetUsersResult>
function getUsersOutput(args: GetUsersOutputArgs, opts?: InvokeOptions): Output<GetUsersResult>
def get_users(directory_id: Optional[str] = None,
              enable_details: Optional[bool] = None,
              ids: Optional[Sequence[str]] = None,
              name_regex: Optional[str] = None,
              output_file: Optional[str] = None,
              provision_type: Optional[str] = None,
              status: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> GetUsersResult
def get_users_output(directory_id: Optional[pulumi.Input[str]] = None,
              enable_details: Optional[pulumi.Input[bool]] = 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,
              status: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetUsersResult]
func GetUsers(ctx *Context, args *GetUsersArgs, opts ...InvokeOption) (*GetUsersResult, error)
func GetUsersOutput(ctx *Context, args *GetUsersOutputArgs, opts ...InvokeOption) GetUsersResultOutput

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

public static class GetUsers 
{
    public static Task<GetUsersResult> InvokeAsync(GetUsersArgs args, InvokeOptions? opts = null)
    public static Output<GetUsersResult> Invoke(GetUsersInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: alicloud:cloudsso/getUsers:getUsers
  Arguments:
    # Arguments dictionary

The following arguments are supported:

DirectoryId string

The ID of the Directory.

EnableDetails bool

Default to false. Set it to true can output more details about resource attributes.

Ids List<string>

A list of User IDs.

NameRegex string

A regex string to filter results by User name.

OutputFile string
ProvisionType string

ProvisionType.

Status string

User status. Valid values: Enabled and Disabled.

DirectoryId string

The ID of the Directory.

EnableDetails bool

Default to false. Set it to true can output more details about resource attributes.

Ids []string

A list of User IDs.

NameRegex string

A regex string to filter results by User name.

OutputFile string
ProvisionType string

ProvisionType.

Status string

User status. Valid values: Enabled and Disabled.

directoryId String

The ID of the Directory.

enableDetails Boolean

Default to false. Set it to true can output more details about resource attributes.

ids List<String>

A list of User IDs.

nameRegex String

A regex string to filter results by User name.

outputFile String
provisionType String

ProvisionType.

status String

User status. Valid values: Enabled and Disabled.

directoryId string

The ID of the Directory.

enableDetails boolean

Default to false. Set it to true can output more details about resource attributes.

ids string[]

A list of User IDs.

nameRegex string

A regex string to filter results by User name.

outputFile string
provisionType string

ProvisionType.

status string

User status. Valid values: Enabled and Disabled.

directory_id str

The ID of the Directory.

enable_details bool

Default to false. Set it to true can output more details about resource attributes.

ids Sequence[str]

A list of User IDs.

name_regex str

A regex string to filter results by User name.

output_file str
provision_type str

ProvisionType.

status str

User status. Valid values: Enabled and Disabled.

directoryId String

The ID of the Directory.

enableDetails Boolean

Default to false. Set it to true can output more details about resource attributes.

ids List<String>

A list of User IDs.

nameRegex String

A regex string to filter results by User name.

outputFile String
provisionType String

ProvisionType.

status String

User status. Valid values: Enabled and Disabled.

getUsers Result

The following output properties are available:

DirectoryId string
Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
Names List<string>
Users List<Pulumi.AliCloud.CloudSso.Outputs.GetUsersUser>
EnableDetails bool
NameRegex string
OutputFile string
ProvisionType string
Status string
DirectoryId string
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
Names []string
Users []GetUsersUser
EnableDetails bool
NameRegex string
OutputFile string
ProvisionType string
Status string
directoryId String
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
names List<String>
users List<GetUsersUser>
enableDetails Boolean
nameRegex String
outputFile String
provisionType String
status String
directoryId string
id string

The provider-assigned unique ID for this managed resource.

ids string[]
names string[]
users GetUsersUser[]
enableDetails boolean
nameRegex string
outputFile string
provisionType string
status string
directory_id str
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
names Sequence[str]
users Sequence[GetUsersUser]
enable_details bool
name_regex str
output_file str
provision_type str
status str
directoryId String
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
names List<String>
users List<Property Map>
enableDetails Boolean
nameRegex String
outputFile String
provisionType String
status String

Supporting Types

GetUsersUser

CreateTime string

The create time of the user.

Description string

The description of user.

DirectoryId string

The ID of the Directory.

DisplayName string

The display name of user.

Email string

The User's Contact Email Address.

FirstName string

The first name of user.

Id string

The ID of the User.

LastName string

The last name of user.

MfaDevices List<Pulumi.AliCloud.CloudSso.Inputs.GetUsersUserMfaDevice>

The List of MFA Device for User.

ProvisionType string

ProvisionType.

Status string

User status. Valid values: Enabled and Disabled.

UserId string

The User ID of the group.

UserName string

The name of user.

CreateTime string

The create time of the user.

Description string

The description of user.

DirectoryId string

The ID of the Directory.

DisplayName string

The display name of user.

Email string

The User's Contact Email Address.

FirstName string

The first name of user.

Id string

The ID of the User.

LastName string

The last name of user.

MfaDevices []GetUsersUserMfaDevice

The List of MFA Device for User.

ProvisionType string

ProvisionType.

Status string

User status. Valid values: Enabled and Disabled.

UserId string

The User ID of the group.

UserName string

The name of user.

createTime String

The create time of the user.

description String

The description of user.

directoryId String

The ID of the Directory.

displayName String

The display name of user.

email String

The User's Contact Email Address.

firstName String

The first name of user.

id String

The ID of the User.

lastName String

The last name of user.

mfaDevices List<GetUsersUserMfaDevice>

The List of MFA Device for User.

provisionType String

ProvisionType.

status String

User status. Valid values: Enabled and Disabled.

userId String

The User ID of the group.

userName String

The name of user.

createTime string

The create time of the user.

description string

The description of user.

directoryId string

The ID of the Directory.

displayName string

The display name of user.

email string

The User's Contact Email Address.

firstName string

The first name of user.

id string

The ID of the User.

lastName string

The last name of user.

mfaDevices GetUsersUserMfaDevice[]

The List of MFA Device for User.

provisionType string

ProvisionType.

status string

User status. Valid values: Enabled and Disabled.

userId string

The User ID of the group.

userName string

The name of user.

create_time str

The create time of the user.

description str

The description of user.

directory_id str

The ID of the Directory.

display_name str

The display name of user.

email str

The User's Contact Email Address.

first_name str

The first name of user.

id str

The ID of the User.

last_name str

The last name of user.

mfa_devices Sequence[GetUsersUserMfaDevice]

The List of MFA Device for User.

provision_type str

ProvisionType.

status str

User status. Valid values: Enabled and Disabled.

user_id str

The User ID of the group.

user_name str

The name of user.

createTime String

The create time of the user.

description String

The description of user.

directoryId String

The ID of the Directory.

displayName String

The display name of user.

email String

The User's Contact Email Address.

firstName String

The first name of user.

id String

The ID of the User.

lastName String

The last name of user.

mfaDevices List<Property Map>

The List of MFA Device for User.

provisionType String

ProvisionType.

status String

User status. Valid values: Enabled and Disabled.

userId String

The User ID of the group.

userName String

The name of user.

GetUsersUserMfaDevice

DeviceId string

The MFA Device ID.

DeviceName string

The MFA Device Name.

DeviceType string

The MFA Device Type.

EffectiveTime string

The Effective Time of MFA Device.

DeviceId string

The MFA Device ID.

DeviceName string

The MFA Device Name.

DeviceType string

The MFA Device Type.

EffectiveTime string

The Effective Time of MFA Device.

deviceId String

The MFA Device ID.

deviceName String

The MFA Device Name.

deviceType String

The MFA Device Type.

effectiveTime String

The Effective Time of MFA Device.

deviceId string

The MFA Device ID.

deviceName string

The MFA Device Name.

deviceType string

The MFA Device Type.

effectiveTime string

The Effective Time of MFA Device.

device_id str

The MFA Device ID.

device_name str

The MFA Device Name.

device_type str

The MFA Device Type.

effective_time str

The Effective Time of MFA Device.

deviceId String

The MFA Device ID.

deviceName String

The MFA Device Name.

deviceType String

The MFA Device Type.

effectiveTime String

The Effective Time of MFA Device.

Package Details

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

This Pulumi package is based on the alicloud Terraform Provider.