Alibaba Cloud

Pulumi Official
Package maintained by Pulumi
v3.27.0 published on Monday, Aug 8, 2022 by Pulumi

getPolicyVersions

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

NOTE: Available in 1.85.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var @default = Output.Create(AliCloud.ResourceManager.GetPolicyVersions.InvokeAsync(new AliCloud.ResourceManager.GetPolicyVersionsArgs
        {
            PolicyName = "tftest",
            PolicyType = "Custom",
        }));
        this.FirstPolicyVersionId = @default.Apply(@default => @default.Versions?[0]?.Id);
    }

    [Output("firstPolicyVersionId")]
    public Output<string> FirstPolicyVersionId { get; set; }
}
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 {
		_default, err := resourcemanager.GetPolicyVersions(ctx, &resourcemanager.GetPolicyVersionsArgs{
			PolicyName: "tftest",
			PolicyType: "Custom",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstPolicyVersionId", _default.Versions[0].Id)
		return nil
	})
}
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.GetPolicyVersionsArgs;
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 default = ResourcemanagerFunctions.getPolicyVersions(GetPolicyVersionsArgs.builder()
            .policyName("tftest")
            .policyType("Custom")
            .build());

        ctx.export("firstPolicyVersionId", default_.versions()[0].id());
    }
}
import pulumi
import pulumi_alicloud as alicloud

default = alicloud.resourcemanager.get_policy_versions(policy_name="tftest",
    policy_type="Custom")
pulumi.export("firstPolicyVersionId", default.versions[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const defaultPolicyVersions = pulumi.output(alicloud.resourcemanager.getPolicyVersions({
    policyName: "tftest",
    policyType: "Custom",
}));

export const firstPolicyVersionId = defaultPolicyVersions.versions[0].id;
variables:
  default:
    Fn::Invoke:
      Function: alicloud:resourcemanager:getPolicyVersions
      Arguments:
        policyName: tftest
        policyType: Custom
outputs:
  firstPolicyVersionId: ${default.versions[0].id}

Using getPolicyVersions

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 getPolicyVersions(args: GetPolicyVersionsArgs, opts?: InvokeOptions): Promise<GetPolicyVersionsResult>
function getPolicyVersionsOutput(args: GetPolicyVersionsOutputArgs, opts?: InvokeOptions): Output<GetPolicyVersionsResult>
def get_policy_versions(enable_details: Optional[bool] = None,
                        ids: Optional[Sequence[str]] = None,
                        output_file: Optional[str] = None,
                        policy_name: Optional[str] = None,
                        policy_type: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetPolicyVersionsResult
def get_policy_versions_output(enable_details: Optional[pulumi.Input[bool]] = None,
                        ids: Optional[pulumi.Input[Sequence[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[GetPolicyVersionsResult]
func GetPolicyVersions(ctx *Context, args *GetPolicyVersionsArgs, opts ...InvokeOption) (*GetPolicyVersionsResult, error)
func GetPolicyVersionsOutput(ctx *Context, args *GetPolicyVersionsOutputArgs, opts ...InvokeOption) GetPolicyVersionsResultOutput

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

public static class GetPolicyVersions 
{
    public static Task<GetPolicyVersionsResult> InvokeAsync(GetPolicyVersionsArgs args, InvokeOptions? opts = null)
    public static Output<GetPolicyVersionsResult> Invoke(GetPolicyVersionsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPolicyVersionsResult> getPolicyVersions(GetPolicyVersionsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: alicloud:resourcemanager/getPolicyVersions:getPolicyVersions
  Arguments:
    # Arguments dictionary

The following arguments are supported:

PolicyName string

The name of the policy.

PolicyType string

The type of the policy. Valid values:Custom and System.

EnableDetails bool

-(Optional, Available in v1.114.0+) Default to false. Set it to true can output more details.

Ids List<string>

A list of policy version IDs.

OutputFile string
PolicyName string

The name of the policy.

PolicyType string

The type of the policy. Valid values:Custom and System.

EnableDetails bool

-(Optional, Available in v1.114.0+) Default to false. Set it to true can output more details.

Ids []string

A list of policy version IDs.

OutputFile string
policyName String

The name of the policy.

policyType String

The type of the policy. Valid values:Custom and System.

enableDetails Boolean

-(Optional, Available in v1.114.0+) Default to false. Set it to true can output more details.

ids List<String>

A list of policy version IDs.

outputFile String
policyName string

The name of the policy.

policyType string

The type of the policy. Valid values:Custom and System.

enableDetails boolean

-(Optional, Available in v1.114.0+) Default to false. Set it to true can output more details.

ids string[]

A list of policy version IDs.

outputFile string
policy_name str

The name of the policy.

policy_type str

The type of the policy. Valid values:Custom and System.

enable_details bool

-(Optional, Available in v1.114.0+) Default to false. Set it to true can output more details.

ids Sequence[str]

A list of policy version IDs.

output_file str
policyName String

The name of the policy.

policyType String

The type of the policy. Valid values:Custom and System.

enableDetails Boolean

-(Optional, Available in v1.114.0+) Default to false. Set it to true can output more details.

ids List<String>

A list of policy version IDs.

outputFile String

getPolicyVersions Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>

A list of policy version IDs.

PolicyName string
PolicyType string
Versions List<Pulumi.AliCloud.ResourceManager.Outputs.GetPolicyVersionsVersion>

A list of policy versions. Each element contains the following attributes:

EnableDetails bool
OutputFile string
Id string

The provider-assigned unique ID for this managed resource.

Ids []string

A list of policy version IDs.

PolicyName string
PolicyType string
Versions []GetPolicyVersionsVersion

A list of policy versions. Each element contains the following attributes:

EnableDetails bool
OutputFile string
id String

The provider-assigned unique ID for this managed resource.

ids List<String>

A list of policy version IDs.

policyName String
policyType String
versions List<GetPolicyVersionsVersion>

A list of policy versions. Each element contains the following attributes:

enableDetails Boolean
outputFile String
id string

The provider-assigned unique ID for this managed resource.

ids string[]

A list of policy version IDs.

policyName string
policyType string
versions GetPolicyVersionsVersion[]

A list of policy versions. Each element contains the following attributes:

enableDetails boolean
outputFile string
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]

A list of policy version IDs.

policy_name str
policy_type str
versions Sequence[GetPolicyVersionsVersion]

A list of policy versions. Each element contains the following attributes:

enable_details bool
output_file str
id String

The provider-assigned unique ID for this managed resource.

ids List<String>

A list of policy version IDs.

policyName String
policyType String
versions List<Property Map>

A list of policy versions. Each element contains the following attributes:

enableDetails Boolean
outputFile String

Supporting Types

GetPolicyVersionsVersion

Id string

The ID of the resource, the value is <policy_name>:<version_id>.

  • version_id- The ID of the policy version.
  • create_date- (Removed form v1.114.0)The time when the policy version was created.
  • is_default_version- Indicates whether the policy version is the default version.
  • policy_document- (Available in v1.114.0+) The policy document of the policy version.
IsDefaultVersion bool
PolicyDocument string
VersionId string
Id string

The ID of the resource, the value is <policy_name>:<version_id>.

  • version_id- The ID of the policy version.
  • create_date- (Removed form v1.114.0)The time when the policy version was created.
  • is_default_version- Indicates whether the policy version is the default version.
  • policy_document- (Available in v1.114.0+) The policy document of the policy version.
IsDefaultVersion bool
PolicyDocument string
VersionId string
id String

The ID of the resource, the value is <policy_name>:<version_id>.

  • version_id- The ID of the policy version.
  • create_date- (Removed form v1.114.0)The time when the policy version was created.
  • is_default_version- Indicates whether the policy version is the default version.
  • policy_document- (Available in v1.114.0+) The policy document of the policy version.
isDefaultVersion Boolean
policyDocument String
versionId String
id string

The ID of the resource, the value is <policy_name>:<version_id>.

  • version_id- The ID of the policy version.
  • create_date- (Removed form v1.114.0)The time when the policy version was created.
  • is_default_version- Indicates whether the policy version is the default version.
  • policy_document- (Available in v1.114.0+) The policy document of the policy version.
isDefaultVersion boolean
policyDocument string
versionId string
id str

The ID of the resource, the value is <policy_name>:<version_id>.

  • version_id- The ID of the policy version.
  • create_date- (Removed form v1.114.0)The time when the policy version was created.
  • is_default_version- Indicates whether the policy version is the default version.
  • policy_document- (Available in v1.114.0+) The policy document of the policy version.
is_default_version bool
policy_document str
version_id str
id String

The ID of the resource, the value is <policy_name>:<version_id>.

  • version_id- The ID of the policy version.
  • create_date- (Removed form v1.114.0)The time when the policy version was created.
  • is_default_version- Indicates whether the policy version is the default version.
  • policy_document- (Available in v1.114.0+) The policy document of the policy version.
isDefaultVersion Boolean
policyDocument String
versionId String

Package Details

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

This Pulumi package is based on the alicloud Terraform Provider.