Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi
alicloud.ram.getPolicies
Explore with Pulumi AI
This data source provides a list of RAM policies 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 policiesDs = alicloud.ram.getPolicies({
outputFile: "policies.txt",
userName: "user1",
groupName: "group1",
type: "System",
});
export const firstPolicyName = policiesDs.then(policiesDs => policiesDs.policies?.[0]?.name);
import pulumi
import pulumi_alicloud as alicloud
policies_ds = alicloud.ram.get_policies(output_file="policies.txt",
user_name="user1",
group_name="group1",
type="System")
pulumi.export("firstPolicyName", policies_ds.policies[0].name)
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 {
policiesDs, err := ram.GetPolicies(ctx, &ram.GetPoliciesArgs{
OutputFile: pulumi.StringRef("policies.txt"),
UserName: pulumi.StringRef("user1"),
GroupName: pulumi.StringRef("group1"),
Type: pulumi.StringRef("System"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstPolicyName", policiesDs.Policies[0].Name)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var policiesDs = AliCloud.Ram.GetPolicies.Invoke(new()
{
OutputFile = "policies.txt",
UserName = "user1",
GroupName = "group1",
Type = "System",
});
return new Dictionary<string, object?>
{
["firstPolicyName"] = policiesDs.Apply(getPoliciesResult => getPoliciesResult.Policies[0]?.Name),
};
});
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.GetPoliciesArgs;
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 policiesDs = RamFunctions.getPolicies(GetPoliciesArgs.builder()
.outputFile("policies.txt")
.userName("user1")
.groupName("group1")
.type("System")
.build());
ctx.export("firstPolicyName", policiesDs.applyValue(getPoliciesResult -> getPoliciesResult.policies()[0].name()));
}
}
variables:
policiesDs:
fn::invoke:
Function: alicloud:ram:getPolicies
Arguments:
outputFile: policies.txt
userName: user1
groupName: group1
type: System
outputs:
firstPolicyName: ${policiesDs.policies[0].name}
Using getPolicies
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 getPolicies(args: GetPoliciesArgs, opts?: InvokeOptions): Promise<GetPoliciesResult>
function getPoliciesOutput(args: GetPoliciesOutputArgs, opts?: InvokeOptions): Output<GetPoliciesResult>
def get_policies(enable_details: Optional[bool] = None,
group_name: Optional[str] = None,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
role_name: Optional[str] = None,
type: Optional[str] = None,
user_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPoliciesResult
def get_policies_output(enable_details: Optional[pulumi.Input[bool]] = None,
group_name: 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,
role_name: Optional[pulumi.Input[str]] = None,
type: Optional[pulumi.Input[str]] = None,
user_name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPoliciesResult]
func GetPolicies(ctx *Context, args *GetPoliciesArgs, opts ...InvokeOption) (*GetPoliciesResult, error)
func GetPoliciesOutput(ctx *Context, args *GetPoliciesOutputArgs, opts ...InvokeOption) GetPoliciesResultOutput
> Note: This function is named GetPolicies
in the Go SDK.
public static class GetPolicies
{
public static Task<GetPoliciesResult> InvokeAsync(GetPoliciesArgs args, InvokeOptions? opts = null)
public static Output<GetPoliciesResult> Invoke(GetPoliciesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPoliciesResult> getPolicies(GetPoliciesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: alicloud:ram/getPolicies:getPolicies
arguments:
# arguments dictionary
The following arguments are supported:
- Enable
Details bool - Default to
true
. Set it to true can output more details. - Group
Name string - Filter results by a specific group name. Returned policies are attached to the specified group.
- Ids List<string>
- A list of ram group IDs.
- Name
Regex string - A regex string to filter resulting policies by name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Role
Name string - Filter results by a specific role name. Returned policies are attached to the specified role.
- Type string
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - User
Name string - Filter results by a specific user name. Returned policies are attached to the specified user.
- Enable
Details bool - Default to
true
. Set it to true can output more details. - Group
Name string - Filter results by a specific group name. Returned policies are attached to the specified group.
- Ids []string
- A list of ram group IDs.
- Name
Regex string - A regex string to filter resulting policies by name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Role
Name string - Filter results by a specific role name. Returned policies are attached to the specified role.
- Type string
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - User
Name string - Filter results by a specific user name. Returned policies are attached to the specified user.
- enable
Details Boolean - Default to
true
. Set it to true can output more details. - group
Name String - Filter results by a specific group name. Returned policies are attached to the specified group.
- ids List<String>
- A list of ram group IDs.
- name
Regex String - A regex string to filter resulting policies by name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - role
Name String - Filter results by a specific role name. Returned policies are attached to the specified role.
- type String
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - user
Name String - Filter results by a specific user name. Returned policies are attached to the specified user.
- enable
Details boolean - Default to
true
. Set it to true can output more details. - group
Name string - Filter results by a specific group name. Returned policies are attached to the specified group.
- ids string[]
- A list of ram group IDs.
- name
Regex string - A regex string to filter resulting policies by name.
- output
File string - File name where to save data source results (after running
pulumi preview
). - role
Name string - Filter results by a specific role name. Returned policies are attached to the specified role.
- type string
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - user
Name string - Filter results by a specific user name. Returned policies are attached to the specified user.
- enable_
details bool - Default to
true
. Set it to true can output more details. - group_
name str - Filter results by a specific group name. Returned policies are attached to the specified group.
- ids Sequence[str]
- A list of ram group IDs.
- name_
regex str - A regex string to filter resulting policies by name.
- output_
file str - File name where to save data source results (after running
pulumi preview
). - role_
name str - Filter results by a specific role name. Returned policies are attached to the specified role.
- type str
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - user_
name str - Filter results by a specific user name. Returned policies are attached to the specified user.
- enable
Details Boolean - Default to
true
. Set it to true can output more details. - group
Name String - Filter results by a specific group name. Returned policies are attached to the specified group.
- ids List<String>
- A list of ram group IDs.
- name
Regex String - A regex string to filter resulting policies by name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - role
Name String - Filter results by a specific role name. Returned policies are attached to the specified role.
- type String
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - user
Name String - Filter results by a specific user name. Returned policies are attached to the specified user.
getPolicies Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- Names List<string>
- A list of ram group names.
- Policies
List<Pulumi.
Ali Cloud. Ram. Outputs. Get Policies Policy> - A list of policies. Each element contains the following attributes:
- Enable
Details bool - Group
Name string - Name
Regex string - Output
File string - Role
Name string - Type string
- Type of the policy.
- User
Name string - The user name of policy.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- Names []string
- A list of ram group names.
- Policies
[]Get
Policies Policy - A list of policies. Each element contains the following attributes:
- Enable
Details bool - Group
Name string - Name
Regex string - Output
File string - Role
Name string - Type string
- Type of the policy.
- User
Name string - The user name of policy.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- A list of ram group names.
- policies
List<Get
Policies Policy> - A list of policies. Each element contains the following attributes:
- enable
Details Boolean - group
Name String - name
Regex String - output
File String - role
Name String - type String
- Type of the policy.
- user
Name String - The user name of policy.
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- names string[]
- A list of ram group names.
- policies
Get
Policies Policy[] - A list of policies. Each element contains the following attributes:
- enable
Details boolean - group
Name string - name
Regex string - output
File string - role
Name string - type string
- Type of the policy.
- user
Name string - The user name of policy.
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- names Sequence[str]
- A list of ram group names.
- policies
Sequence[Get
Policies Policy] - A list of policies. Each element contains the following attributes:
- enable_
details bool - group_
name str - name_
regex str - output_
file str - role_
name str - type str
- Type of the policy.
- user_
name str - The user name of policy.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- names List<String>
- A list of ram group names.
- policies List<Property Map>
- A list of policies. Each element contains the following attributes:
- enable
Details Boolean - group
Name String - name
Regex String - output
File String - role
Name String - type String
- Type of the policy.
- user
Name String - The user name of policy.
Supporting Types
GetPoliciesPolicy
- Attachment
Count int - Attachment count of the policy.
- Create
Date string - Creation date of the policy.
- Default
Version string - Default version of the policy.
- Description string
- Description of the policy.
- Document string
- Policy document of the policy.
- Id string
- ID of the policy.
- Name string
- Name of the policy.
- Policy
Document string - Policy document of the policy.
- Policy
Name string - Name of the policy.
- Type string
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - Update
Date string - Update date of the policy.
- User
Name string - Filter results by a specific user name. Returned policies are attached to the specified user.
- Version
Id string - The ID of default policy.
- Attachment
Count int - Attachment count of the policy.
- Create
Date string - Creation date of the policy.
- Default
Version string - Default version of the policy.
- Description string
- Description of the policy.
- Document string
- Policy document of the policy.
- Id string
- ID of the policy.
- Name string
- Name of the policy.
- Policy
Document string - Policy document of the policy.
- Policy
Name string - Name of the policy.
- Type string
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - Update
Date string - Update date of the policy.
- User
Name string - Filter results by a specific user name. Returned policies are attached to the specified user.
- Version
Id string - The ID of default policy.
- attachment
Count Integer - Attachment count of the policy.
- create
Date String - Creation date of the policy.
- default
Version String - Default version of the policy.
- description String
- Description of the policy.
- document String
- Policy document of the policy.
- id String
- ID of the policy.
- name String
- Name of the policy.
- policy
Document String - Policy document of the policy.
- policy
Name String - Name of the policy.
- type String
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - update
Date String - Update date of the policy.
- user
Name String - Filter results by a specific user name. Returned policies are attached to the specified user.
- version
Id String - The ID of default policy.
- attachment
Count number - Attachment count of the policy.
- create
Date string - Creation date of the policy.
- default
Version string - Default version of the policy.
- description string
- Description of the policy.
- document string
- Policy document of the policy.
- id string
- ID of the policy.
- name string
- Name of the policy.
- policy
Document string - Policy document of the policy.
- policy
Name string - Name of the policy.
- type string
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - update
Date string - Update date of the policy.
- user
Name string - Filter results by a specific user name. Returned policies are attached to the specified user.
- version
Id string - The ID of default policy.
- attachment_
count int - Attachment count of the policy.
- create_
date str - Creation date of the policy.
- default_
version str - Default version of the policy.
- description str
- Description of the policy.
- document str
- Policy document of the policy.
- id str
- ID of the policy.
- name str
- Name of the policy.
- policy_
document str - Policy document of the policy.
- policy_
name str - Name of the policy.
- type str
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - update_
date str - Update date of the policy.
- user_
name str - Filter results by a specific user name. Returned policies are attached to the specified user.
- version_
id str - The ID of default policy.
- attachment
Count Number - Attachment count of the policy.
- create
Date String - Creation date of the policy.
- default
Version String - Default version of the policy.
- description String
- Description of the policy.
- document String
- Policy document of the policy.
- id String
- ID of the policy.
- name String
- Name of the policy.
- policy
Document String - Policy document of the policy.
- policy
Name String - Name of the policy.
- type String
- Filter results by a specific policy type. Valid values are
Custom
andSystem
. - update
Date String - Update date of the policy.
- user
Name String - Filter results by a specific user name. Returned policies are attached to the specified user.
- version
Id String - The ID of default policy.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloud
Terraform Provider.