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

alicloud.resourcemanager.getRoles

Explore with Pulumi AI

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

    This data source provides the Resource Manager Roles of the current Alibaba Cloud user.

    NOTE: Available in 1.86.0+.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const example = alicloud.resourcemanager.getRoles({
        nameRegex: "tftest",
    });
    export const firstRoleId = example.then(example => example.roles?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    example = alicloud.resourcemanager.get_roles(name_regex="tftest")
    pulumi.export("firstRoleId", example.roles[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := resourcemanager.GetRoles(ctx, &resourcemanager.GetRolesArgs{
    			NameRegex: pulumi.StringRef("tftest"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstRoleId", example.Roles[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = AliCloud.ResourceManager.GetRoles.Invoke(new()
        {
            NameRegex = "tftest",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstRoleId"] = example.Apply(getRolesResult => getRolesResult.Roles[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
    import com.pulumi.alicloud.resourcemanager.inputs.GetRolesArgs;
    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 example = ResourcemanagerFunctions.getRoles(GetRolesArgs.builder()
                .nameRegex("tftest")
                .build());
    
            ctx.export("firstRoleId", example.applyValue(getRolesResult -> getRolesResult.roles()[0].id()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: alicloud:resourcemanager:getRoles
          Arguments:
            nameRegex: tftest
    outputs:
      firstRoleId: ${example.roles[0].id}
    

    Using getRoles

    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 getRoles(args: GetRolesArgs, opts?: InvokeOptions): Promise<GetRolesResult>
    function getRolesOutput(args: GetRolesOutputArgs, opts?: InvokeOptions): Output<GetRolesResult>
    def get_roles(enable_details: Optional[bool] = None,
                  ids: Optional[Sequence[str]] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetRolesResult
    def get_roles_output(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,
                  opts: Optional[InvokeOptions] = None) -> Output[GetRolesResult]
    func GetRoles(ctx *Context, args *GetRolesArgs, opts ...InvokeOption) (*GetRolesResult, error)
    func GetRolesOutput(ctx *Context, args *GetRolesOutputArgs, opts ...InvokeOption) GetRolesResultOutput

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

    public static class GetRoles 
    {
        public static Task<GetRolesResult> InvokeAsync(GetRolesArgs args, InvokeOptions? opts = null)
        public static Output<GetRolesResult> Invoke(GetRolesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRolesResult> getRoles(GetRolesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:resourcemanager/getRoles:getRoles
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EnableDetails bool
    Default to false. Set it to true can output more details.
    Ids List<string>
    A list of Resource Manager Role IDs.
    NameRegex string
    A regex string to filter results by role name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    EnableDetails bool
    Default to false. Set it to true can output more details.
    Ids []string
    A list of Resource Manager Role IDs.
    NameRegex string
    A regex string to filter results by role name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    enableDetails Boolean
    Default to false. Set it to true can output more details.
    ids List<String>
    A list of Resource Manager Role IDs.
    nameRegex String
    A regex string to filter results by role name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    enableDetails boolean
    Default to false. Set it to true can output more details.
    ids string[]
    A list of Resource Manager Role IDs.
    nameRegex string
    A regex string to filter results by role name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    enable_details bool
    Default to false. Set it to true can output more details.
    ids Sequence[str]
    A list of Resource Manager Role IDs.
    name_regex str
    A regex string to filter results by role name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    enableDetails Boolean
    Default to false. Set it to true can output more details.
    ids List<String>
    A list of Resource Manager Role IDs.
    nameRegex String
    A regex string to filter results by role name.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getRoles Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of role IDs.
    Names List<string>
    A list of role names.
    Roles List<Pulumi.AliCloud.ResourceManager.Outputs.GetRolesRole>
    A list of roles. Each element contains the following attributes:
    EnableDetails bool
    NameRegex string
    OutputFile string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of role IDs.
    Names []string
    A list of role names.
    Roles []GetRolesRole
    A list of roles. Each element contains the following attributes:
    EnableDetails bool
    NameRegex string
    OutputFile string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of role IDs.
    names List<String>
    A list of role names.
    roles List<GetRolesRole>
    A list of roles. Each element contains the following attributes:
    enableDetails Boolean
    nameRegex String
    outputFile String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of role IDs.
    names string[]
    A list of role names.
    roles GetRolesRole[]
    A list of roles. Each element contains the following attributes:
    enableDetails boolean
    nameRegex string
    outputFile string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of role IDs.
    names Sequence[str]
    A list of role names.
    roles Sequence[GetRolesRole]
    A list of roles. Each element contains the following attributes:
    enable_details bool
    name_regex str
    output_file str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of role IDs.
    names List<String>
    A list of role names.
    roles List<Property Map>
    A list of roles. Each element contains the following attributes:
    enableDetails Boolean
    nameRegex String
    outputFile String

    Supporting Types

    GetRolesRole

    Arn string
    The Alibaba Cloud Resource Name (ARN) of the RAM role.
    AssumeRolePolicyDocument string
    (Available in v1.114.0+) The assume role policy document.
    Description string
    The description of the RAM role.
    Id string
    The ID of the role.
    MaxSessionDuration int
    The maximum session duration of the RAM role.
    RoleId string
    The ID of the role.
    RoleName string
    The name of the role.
    UpdateDate string
    The time when the RAM role was updated.
    Arn string
    The Alibaba Cloud Resource Name (ARN) of the RAM role.
    AssumeRolePolicyDocument string
    (Available in v1.114.0+) The assume role policy document.
    Description string
    The description of the RAM role.
    Id string
    The ID of the role.
    MaxSessionDuration int
    The maximum session duration of the RAM role.
    RoleId string
    The ID of the role.
    RoleName string
    The name of the role.
    UpdateDate string
    The time when the RAM role was updated.
    arn String
    The Alibaba Cloud Resource Name (ARN) of the RAM role.
    assumeRolePolicyDocument String
    (Available in v1.114.0+) The assume role policy document.
    description String
    The description of the RAM role.
    id String
    The ID of the role.
    maxSessionDuration Integer
    The maximum session duration of the RAM role.
    roleId String
    The ID of the role.
    roleName String
    The name of the role.
    updateDate String
    The time when the RAM role was updated.
    arn string
    The Alibaba Cloud Resource Name (ARN) of the RAM role.
    assumeRolePolicyDocument string
    (Available in v1.114.0+) The assume role policy document.
    description string
    The description of the RAM role.
    id string
    The ID of the role.
    maxSessionDuration number
    The maximum session duration of the RAM role.
    roleId string
    The ID of the role.
    roleName string
    The name of the role.
    updateDate string
    The time when the RAM role was updated.
    arn str
    The Alibaba Cloud Resource Name (ARN) of the RAM role.
    assume_role_policy_document str
    (Available in v1.114.0+) The assume role policy document.
    description str
    The description of the RAM role.
    id str
    The ID of the role.
    max_session_duration int
    The maximum session duration of the RAM role.
    role_id str
    The ID of the role.
    role_name str
    The name of the role.
    update_date str
    The time when the RAM role was updated.
    arn String
    The Alibaba Cloud Resource Name (ARN) of the RAM role.
    assumeRolePolicyDocument String
    (Available in v1.114.0+) The assume role policy document.
    description String
    The description of the RAM role.
    id String
    The ID of the role.
    maxSessionDuration Number
    The maximum session duration of the RAM role.
    roleId String
    The ID of the role.
    roleName String
    The name of the role.
    updateDate String
    The time when the RAM role was updated.

    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