1. Packages
  2. Alicloud Provider
  3. API Docs
  4. resourcemanager
  5. getPolicyVersions
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.resourcemanager.getPolicyVersions

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

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

    NOTE: Available in 1.85.0+.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const default = alicloud.resourcemanager.getPolicyVersions({
        policyName: "tftest",
        policyType: "Custom",
    });
    export const firstPolicyVersionId = _default.then(_default => _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)
    
    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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = AliCloud.ResourceManager.GetPolicyVersions.Invoke(new()
        {
            PolicyName = "tftest",
            PolicyType = "Custom",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstPolicyVersionId"] = @default.Apply(@default => @default.Apply(getPolicyVersionsResult => getPolicyVersionsResult.Versions[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.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());
        }
    }
    
    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
    Default to false. Set it to true can output more details.
    Ids List<string>
    A list of policy version IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    PolicyName string
    The name of the policy.
    PolicyType string
    The type of the policy. Valid values:Custom and System.
    EnableDetails bool
    Default to false. Set it to true can output more details.
    Ids []string
    A list of policy version IDs.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    policyName String
    The name of the policy.
    policyType String
    The type of the policy. Valid values:Custom and System.
    enableDetails Boolean
    Default to false. Set it to true can output more details.
    ids List<String>
    A list of policy version IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    policyName string
    The name of the policy.
    policyType string
    The type of the policy. Valid values:Custom and System.
    enableDetails boolean
    Default to false. Set it to true can output more details.
    ids string[]
    A list of policy version IDs.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    policy_name str
    The name of the policy.
    policy_type str
    The type of the policy. Valid values:Custom and System.
    enable_details bool
    Default to false. Set it to true can output more details.
    ids Sequence[str]
    A list of policy version IDs.
    output_file str
    File name where to save data source results (after running pulumi preview).
    policyName String
    The name of the policy.
    policyType String
    The type of the policy. Valid values:Custom and System.
    enableDetails Boolean
    Default to false. Set it to true can output more details.
    ids List<String>
    A list of policy version IDs.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    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>.
    IsDefaultVersion bool
    Indicates whether the policy version is the default version.
    PolicyDocument string
    (Available in v1.114.0+) The policy document of the policy version.
    VersionId string
    The ID of the policy version.
    Id string
    The ID of the resource, the value is <policy_name>:<version_id>.
    IsDefaultVersion bool
    Indicates whether the policy version is the default version.
    PolicyDocument string
    (Available in v1.114.0+) The policy document of the policy version.
    VersionId string
    The ID of the policy version.
    id String
    The ID of the resource, the value is <policy_name>:<version_id>.
    isDefaultVersion Boolean
    Indicates whether the policy version is the default version.
    policyDocument String
    (Available in v1.114.0+) The policy document of the policy version.
    versionId String
    The ID of the policy version.
    id string
    The ID of the resource, the value is <policy_name>:<version_id>.
    isDefaultVersion boolean
    Indicates whether the policy version is the default version.
    policyDocument string
    (Available in v1.114.0+) The policy document of the policy version.
    versionId string
    The ID of the policy version.
    id str
    The ID of the resource, the value is <policy_name>:<version_id>.
    is_default_version bool
    Indicates whether the policy version is the default version.
    policy_document str
    (Available in v1.114.0+) The policy document of the policy version.
    version_id str
    The ID of the policy version.
    id String
    The ID of the resource, the value is <policy_name>:<version_id>.
    isDefaultVersion Boolean
    Indicates whether the policy version is the default version.
    policyDocument String
    (Available in v1.114.0+) The policy document of the policy version.
    versionId String
    The ID of the policy version.

    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.62.1 published on Monday, Sep 16, 2024 by Pulumi