Alibaba Cloud v3.63.0 published on Monday, Sep 30, 2024 by Pulumi
alicloud.ram.getRoles
Explore with Pulumi AI
This data source provides a list of RAM Roles in an Alibaba Cloud account according to the specified filters.
NOTE: Available since v1.0.0+.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const rolesDs = alicloud.ram.getRoles({
outputFile: "roles.txt",
nameRegex: ".*test.*",
policyName: "AliyunACSDefaultAccess",
policyType: "Custom",
});
export const firstRoleId = rolesDs.then(rolesDs => rolesDs.roles?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
roles_ds = alicloud.ram.get_roles(output_file="roles.txt",
name_regex=".*test.*",
policy_name="AliyunACSDefaultAccess",
policy_type="Custom")
pulumi.export("firstRoleId", roles_ds.roles[0].id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ram"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
rolesDs, err := ram.GetRoles(ctx, &ram.GetRolesArgs{
OutputFile: pulumi.StringRef("roles.txt"),
NameRegex: pulumi.StringRef(".*test.*"),
PolicyName: pulumi.StringRef("AliyunACSDefaultAccess"),
PolicyType: pulumi.StringRef("Custom"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstRoleId", rolesDs.Roles[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var rolesDs = AliCloud.Ram.GetRoles.Invoke(new()
{
OutputFile = "roles.txt",
NameRegex = ".*test.*",
PolicyName = "AliyunACSDefaultAccess",
PolicyType = "Custom",
});
return new Dictionary<string, object?>
{
["firstRoleId"] = rolesDs.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.ram.RamFunctions;
import com.pulumi.alicloud.ram.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 rolesDs = RamFunctions.getRoles(GetRolesArgs.builder()
.outputFile("roles.txt")
.nameRegex(".*test.*")
.policyName("AliyunACSDefaultAccess")
.policyType("Custom")
.build());
ctx.export("firstRoleId", rolesDs.applyValue(getRolesResult -> getRolesResult.roles()[0].id()));
}
}
variables:
rolesDs:
fn::invoke:
Function: alicloud:ram:getRoles
Arguments:
outputFile: roles.txt
nameRegex: .*test.*
policyName: AliyunACSDefaultAccess
policyType: Custom
outputs:
firstRoleId: ${rolesDs.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(ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
policy_name: Optional[str] = None,
policy_type: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetRolesResult
def get_roles_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
policy_name: Optional[pulumi.Input[str]] = None,
policy_type: 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:ram/getRoles:getRoles
arguments:
# arguments dictionary
The following arguments are supported:
- Ids List<string>
- A list of ram role IDs.
- Name
Regex string - A regex string to filter results by the role name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Policy
Name string - Filter results by a specific policy name. If you set this parameter without setting
policy_type
, the later will be automatically set toSystem
. The resulting roles will be attached to the specified policy. - Policy
Type string - Filter results by a specific policy type. Valid values are
Custom
andSystem
. If you set this parameter, you must setpolicy_name
as well.
- Ids []string
- A list of ram role IDs.
- Name
Regex string - A regex string to filter results by the role name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Policy
Name string - Filter results by a specific policy name. If you set this parameter without setting
policy_type
, the later will be automatically set toSystem
. The resulting roles will be attached to the specified policy. - Policy
Type string - Filter results by a specific policy type. Valid values are
Custom
andSystem
. If you set this parameter, you must setpolicy_name
as well.
- ids List<String>
- A list of ram role IDs.
- name
Regex String - A regex string to filter results by the role name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - policy
Name String - Filter results by a specific policy name. If you set this parameter without setting
policy_type
, the later will be automatically set toSystem
. The resulting roles will be attached to the specified policy. - policy
Type String - Filter results by a specific policy type. Valid values are
Custom
andSystem
. If you set this parameter, you must setpolicy_name
as well.
- ids string[]
- A list of ram role IDs.
- name
Regex string - A regex string to filter results by the role name.
- output
File string - File name where to save data source results (after running
pulumi preview
). - policy
Name string - Filter results by a specific policy name. If you set this parameter without setting
policy_type
, the later will be automatically set toSystem
. The resulting roles will be attached to the specified policy. - policy
Type string - Filter results by a specific policy type. Valid values are
Custom
andSystem
. If you set this parameter, you must setpolicy_name
as well.
- ids Sequence[str]
- A list of ram role IDs.
- name_
regex str - A regex string to filter results by the role name.
- output_
file str - File name where to save data source results (after running
pulumi preview
). - policy_
name str - Filter results by a specific policy name. If you set this parameter without setting
policy_type
, the later will be automatically set toSystem
. The resulting roles will be attached to the specified policy. - policy_
type str - Filter results by a specific policy type. Valid values are
Custom
andSystem
. If you set this parameter, you must setpolicy_name
as well.
- ids List<String>
- A list of ram role IDs.
- name
Regex String - A regex string to filter results by the role name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - policy
Name String - Filter results by a specific policy name. If you set this parameter without setting
policy_type
, the later will be automatically set toSystem
. The resulting roles will be attached to the specified policy. - policy
Type String - Filter results by a specific policy type. Valid values are
Custom
andSystem
. If you set this parameter, you must setpolicy_name
as well.
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 ram role IDs.
- Names List<string>
- A list of ram role names.
- Roles
List<Pulumi.
Ali Cloud. Ram. Outputs. Get Roles Role> - A list of roles. Each element contains the following attributes:
- Name
Regex string - Output
File string - Policy
Name string - Policy
Type string
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- A list of ram role IDs.
- Names []string
- A list of ram role names.
- Roles
[]Get
Roles Role - A list of roles. Each element contains the following attributes:
- Name
Regex string - Output
File string - Policy
Name string - Policy
Type string
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of ram role IDs.
- names List<String>
- A list of ram role names.
- roles
List<Get
Roles Role> - A list of roles. Each element contains the following attributes:
- name
Regex String - output
File String - policy
Name String - policy
Type String
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- A list of ram role IDs.
- names string[]
- A list of ram role names.
- roles
Get
Roles Role[] - A list of roles. Each element contains the following attributes:
- name
Regex string - output
File string - policy
Name string - policy
Type string
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- A list of ram role IDs.
- names Sequence[str]
- A list of ram role names.
- roles
Sequence[Get
Roles Role] - A list of roles. Each element contains the following attributes:
- name_
regex str - output_
file str - policy_
name str - policy_
type str
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of ram role IDs.
- names List<String>
- A list of ram role names.
- roles List<Property Map>
- A list of roles. Each element contains the following attributes:
- name
Regex String - output
File String - policy
Name String - policy
Type String
Supporting Types
GetRolesRole
- Arn string
- Resource descriptor of the role.
- Assume
Role stringPolicy Document - Authorization strategy of the role. This parameter is deprecated and replaced by
document
. - Create
Date string - Creation date of the role.
- Description string
- Description of the role.
- Document string
- Authorization strategy of the role.
- Id string
- ID of the role.
- Name string
- Name of the role.
- Update
Date string - Update date of the role.
- Arn string
- Resource descriptor of the role.
- Assume
Role stringPolicy Document - Authorization strategy of the role. This parameter is deprecated and replaced by
document
. - Create
Date string - Creation date of the role.
- Description string
- Description of the role.
- Document string
- Authorization strategy of the role.
- Id string
- ID of the role.
- Name string
- Name of the role.
- Update
Date string - Update date of the role.
- arn String
- Resource descriptor of the role.
- assume
Role StringPolicy Document - Authorization strategy of the role. This parameter is deprecated and replaced by
document
. - create
Date String - Creation date of the role.
- description String
- Description of the role.
- document String
- Authorization strategy of the role.
- id String
- ID of the role.
- name String
- Name of the role.
- update
Date String - Update date of the role.
- arn string
- Resource descriptor of the role.
- assume
Role stringPolicy Document - Authorization strategy of the role. This parameter is deprecated and replaced by
document
. - create
Date string - Creation date of the role.
- description string
- Description of the role.
- document string
- Authorization strategy of the role.
- id string
- ID of the role.
- name string
- Name of the role.
- update
Date string - Update date of the role.
- arn str
- Resource descriptor of the role.
- assume_
role_ strpolicy_ document - Authorization strategy of the role. This parameter is deprecated and replaced by
document
. - create_
date str - Creation date of the role.
- description str
- Description of the role.
- document str
- Authorization strategy of the role.
- id str
- ID of the role.
- name str
- Name of the role.
- update_
date str - Update date of the role.
- arn String
- Resource descriptor of the role.
- assume
Role StringPolicy Document - Authorization strategy of the role. This parameter is deprecated and replaced by
document
. - create
Date String - Creation date of the role.
- description String
- Description of the role.
- document String
- Authorization strategy of the role.
- id String
- ID of the role.
- name String
- Name of the role.
- update
Date String - Update date of the role.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.