Alibaba Cloud

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

getPolicies

This data source provides a list of RAM policies in an Alibaba Cloud account according to the specified filters.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var policiesDs = Output.Create(AliCloud.Ram.GetPolicies.InvokeAsync(new AliCloud.Ram.GetPoliciesArgs
        {
            GroupName = "group1",
            OutputFile = "policies.txt",
            Type = "System",
            UserName = "user1",
        }));
        this.FirstPolicyName = policiesDs.Apply(policiesDs => policiesDs.Policies?[0]?.Name);
    }

    [Output("firstPolicyName")]
    public Output<string> FirstPolicyName { get; set; }
}
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{
			GroupName:  pulumi.StringRef("group1"),
			OutputFile: pulumi.StringRef("policies.txt"),
			Type:       pulumi.StringRef("System"),
			UserName:   pulumi.StringRef("user1"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstPolicyName", policiesDs.Policies[0].Name)
		return nil
	})
}
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()
            .groupName("group1")
            .outputFile("policies.txt")
            .type("System")
            .userName("user1")
            .build());

        ctx.export("firstPolicyName", policiesDs.applyValue(getPoliciesResult -> getPoliciesResult.policies()[0].name()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

policies_ds = alicloud.ram.get_policies(group_name="group1",
    output_file="policies.txt",
    type="System",
    user_name="user1")
pulumi.export("firstPolicyName", policies_ds.policies[0].name)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const policiesDs = pulumi.output(alicloud.ram.getPolicies({
    groupName: "group1",
    outputFile: "policies.txt",
    type: "System",
    userName: "user1",
}));

export const firstPolicyName = policiesDs.policies[0].name;
variables:
  policiesDs:
    Fn::Invoke:
      Function: alicloud:ram:getPolicies
      Arguments:
        groupName: group1
        outputFile: policies.txt
        type: System
        userName: user1
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:

EnableDetails bool

Default to true. Set it to true can output more details.

GroupName string

Filter results by a specific group name. Returned policies are attached to the specified group.

Ids List<string>
NameRegex string

A regex string to filter resulting policies by name.

OutputFile string
RoleName 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 and System.

UserName string

Filter results by a specific user name. Returned policies are attached to the specified user.

EnableDetails bool

Default to true. Set it to true can output more details.

GroupName string

Filter results by a specific group name. Returned policies are attached to the specified group.

Ids []string
NameRegex string

A regex string to filter resulting policies by name.

OutputFile string
RoleName 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 and System.

UserName string

Filter results by a specific user name. Returned policies are attached to the specified user.

enableDetails Boolean

Default to true. Set it to true can output more details.

groupName String

Filter results by a specific group name. Returned policies are attached to the specified group.

ids List<String>
nameRegex String

A regex string to filter resulting policies by name.

outputFile String
roleName 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 and System.

userName String

Filter results by a specific user name. Returned policies are attached to the specified user.

enableDetails boolean

Default to true. Set it to true can output more details.

groupName string

Filter results by a specific group name. Returned policies are attached to the specified group.

ids string[]
nameRegex string

A regex string to filter resulting policies by name.

outputFile string
roleName 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 and System.

userName 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]
name_regex str

A regex string to filter resulting policies by name.

output_file str
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 and System.

user_name str

Filter results by a specific user name. Returned policies are attached to the specified user.

enableDetails Boolean

Default to true. Set it to true can output more details.

groupName String

Filter results by a specific group name. Returned policies are attached to the specified group.

ids List<String>
nameRegex String

A regex string to filter resulting policies by name.

outputFile String
roleName 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 and System.

userName 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.AliCloud.Ram.Outputs.GetPoliciesPolicy>

A list of policies. Each element contains the following attributes:

EnableDetails bool
GroupName string
NameRegex string
OutputFile string
RoleName string
Type string

Type of the policy.

UserName string
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
Names []string

A list of ram group names.

Policies []GetPoliciesPolicy

A list of policies. Each element contains the following attributes:

EnableDetails bool
GroupName string
NameRegex string
OutputFile string
RoleName string
Type string

Type of the policy.

UserName string
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<GetPoliciesPolicy>

A list of policies. Each element contains the following attributes:

enableDetails Boolean
groupName String
nameRegex String
outputFile String
roleName String
type String

Type of the policy.

userName String
id string

The provider-assigned unique ID for this managed resource.

ids string[]
names string[]

A list of ram group names.

policies GetPoliciesPolicy[]

A list of policies. Each element contains the following attributes:

enableDetails boolean
groupName string
nameRegex string
outputFile string
roleName string
type string

Type of the policy.

userName string
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[GetPoliciesPolicy]

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
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:

enableDetails Boolean
groupName String
nameRegex String
outputFile String
roleName String
type String

Type of the policy.

userName String

Supporting Types

GetPoliciesPolicy

AttachmentCount int

Attachment count of the policy.

CreateDate string

Creation date of the policy.

DefaultVersion string

Default version of the policy.

Description string

Description of the policy.

Document string

Policy document of the policy.

Id string
Name string

Name of the policy.

PolicyDocument string

Policy document of the policy.

PolicyName string

Name of the policy.

Type string

Filter results by a specific policy type. Valid values are Custom and System.

UpdateDate string

Update date of the policy.

UserName string

Filter results by a specific user name. Returned policies are attached to the specified user.

VersionId string

The ID of default policy.

AttachmentCount int

Attachment count of the policy.

CreateDate string

Creation date of the policy.

DefaultVersion string

Default version of the policy.

Description string

Description of the policy.

Document string

Policy document of the policy.

Id string
Name string

Name of the policy.

PolicyDocument string

Policy document of the policy.

PolicyName string

Name of the policy.

Type string

Filter results by a specific policy type. Valid values are Custom and System.

UpdateDate string

Update date of the policy.

UserName string

Filter results by a specific user name. Returned policies are attached to the specified user.

VersionId string

The ID of default policy.

attachmentCount Integer

Attachment count of the policy.

createDate String

Creation date of the policy.

defaultVersion String

Default version of the policy.

description String

Description of the policy.

document String

Policy document of the policy.

id String
name String

Name of the policy.

policyDocument String

Policy document of the policy.

policyName String

Name of the policy.

type String

Filter results by a specific policy type. Valid values are Custom and System.

updateDate String

Update date of the policy.

userName String

Filter results by a specific user name. Returned policies are attached to the specified user.

versionId String

The ID of default policy.

attachmentCount number

Attachment count of the policy.

createDate string

Creation date of the policy.

defaultVersion string

Default version of the policy.

description string

Description of the policy.

document string

Policy document of the policy.

id string
name string

Name of the policy.

policyDocument string

Policy document of the policy.

policyName string

Name of the policy.

type string

Filter results by a specific policy type. Valid values are Custom and System.

updateDate string

Update date of the policy.

userName string

Filter results by a specific user name. Returned policies are attached to the specified user.

versionId 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
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 and System.

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.

attachmentCount Number

Attachment count of the policy.

createDate String

Creation date of the policy.

defaultVersion String

Default version of the policy.

description String

Description of the policy.

document String

Policy document of the policy.

id String
name String

Name of the policy.

policyDocument String

Policy document of the policy.

policyName String

Name of the policy.

type String

Filter results by a specific policy type. Valid values are Custom and System.

updateDate String

Update date of the policy.

userName String

Filter results by a specific user name. Returned policies are attached to the specified user.

versionId String

The ID of default policy.

Package Details

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

This Pulumi package is based on the alicloud Terraform Provider.