1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. resourcemanager
  5. getControlPolicies
Alibaba Cloud v3.57.0 published on Saturday, Jun 15, 2024 by Pulumi

alicloud.resourcemanager.getControlPolicies

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.0 published on Saturday, Jun 15, 2024 by Pulumi

    This data source provides the Resource Manager Control Policies of the current Alibaba Cloud user.

    NOTE: Available in v1.120.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const example = alicloud.resourcemanager.getControlPolicies({
        ids: ["example_value"],
        nameRegex: "the_resource_name",
    });
    export const firstResourceManagerControlPolicyId = example.then(example => example.policies?.[0]?.id);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    example = alicloud.resourcemanager.get_control_policies(ids=["example_value"],
        name_regex="the_resource_name")
    pulumi.export("firstResourceManagerControlPolicyId", example.policies[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 {
    		example, err := resourcemanager.GetControlPolicies(ctx, &resourcemanager.GetControlPoliciesArgs{
    			Ids: []string{
    				"example_value",
    			},
    			NameRegex: pulumi.StringRef("the_resource_name"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstResourceManagerControlPolicyId", example.Policies[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = AliCloud.ResourceManager.GetControlPolicies.Invoke(new()
        {
            Ids = new[]
            {
                "example_value",
            },
            NameRegex = "the_resource_name",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstResourceManagerControlPolicyId"] = example.Apply(getControlPoliciesResult => getControlPoliciesResult.Policies[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.GetControlPoliciesArgs;
    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 example = ResourcemanagerFunctions.getControlPolicies(GetControlPoliciesArgs.builder()
                .ids("example_value")
                .nameRegex("the_resource_name")
                .build());
    
            ctx.export("firstResourceManagerControlPolicyId", example.applyValue(getControlPoliciesResult -> getControlPoliciesResult.policies()[0].id()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: alicloud:resourcemanager:getControlPolicies
          Arguments:
            ids:
              - example_value
            nameRegex: the_resource_name
    outputs:
      firstResourceManagerControlPolicyId: ${example.policies[0].id}
    

    Using getControlPolicies

    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 getControlPolicies(args: GetControlPoliciesArgs, opts?: InvokeOptions): Promise<GetControlPoliciesResult>
    function getControlPoliciesOutput(args: GetControlPoliciesOutputArgs, opts?: InvokeOptions): Output<GetControlPoliciesResult>
    def get_control_policies(enable_details: Optional[bool] = None,
                             ids: Optional[Sequence[str]] = None,
                             language: Optional[str] = None,
                             name_regex: Optional[str] = None,
                             output_file: Optional[str] = None,
                             policy_type: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetControlPoliciesResult
    def get_control_policies_output(enable_details: Optional[pulumi.Input[bool]] = None,
                             ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                             language: Optional[pulumi.Input[str]] = None,
                             name_regex: Optional[pulumi.Input[str]] = None,
                             output_file: Optional[pulumi.Input[str]] = None,
                             policy_type: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetControlPoliciesResult]
    func GetControlPolicies(ctx *Context, args *GetControlPoliciesArgs, opts ...InvokeOption) (*GetControlPoliciesResult, error)
    func GetControlPoliciesOutput(ctx *Context, args *GetControlPoliciesOutputArgs, opts ...InvokeOption) GetControlPoliciesResultOutput

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

    public static class GetControlPolicies 
    {
        public static Task<GetControlPoliciesResult> InvokeAsync(GetControlPoliciesArgs args, InvokeOptions? opts = null)
        public static Output<GetControlPoliciesResult> Invoke(GetControlPoliciesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetControlPoliciesResult> getControlPolicies(GetControlPoliciesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:resourcemanager/getControlPolicies:getControlPolicies
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EnableDetails bool
    Default to false. Set it to true can output more details about resource attributes.
    Ids List<string>
    A list of Control Policy IDs.
    Language string
    The language. Valid value zh-CN, en, and ja. Default value zh-CN.
    NameRegex string
    A regex string to filter results by Control Policy name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    PolicyType string
    The policy type of control policy. Valid values System and Custom.
    EnableDetails bool
    Default to false. Set it to true can output more details about resource attributes.
    Ids []string
    A list of Control Policy IDs.
    Language string
    The language. Valid value zh-CN, en, and ja. Default value zh-CN.
    NameRegex string
    A regex string to filter results by Control Policy name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    PolicyType string
    The policy type of control policy. Valid values System and Custom.
    enableDetails Boolean
    Default to false. Set it to true can output more details about resource attributes.
    ids List<String>
    A list of Control Policy IDs.
    language String
    The language. Valid value zh-CN, en, and ja. Default value zh-CN.
    nameRegex String
    A regex string to filter results by Control Policy name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    policyType String
    The policy type of control policy. Valid values System and Custom.
    enableDetails boolean
    Default to false. Set it to true can output more details about resource attributes.
    ids string[]
    A list of Control Policy IDs.
    language string
    The language. Valid value zh-CN, en, and ja. Default value zh-CN.
    nameRegex string
    A regex string to filter results by Control Policy name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    policyType string
    The policy type of control policy. Valid values System and Custom.
    enable_details bool
    Default to false. Set it to true can output more details about resource attributes.
    ids Sequence[str]
    A list of Control Policy IDs.
    language str
    The language. Valid value zh-CN, en, and ja. Default value zh-CN.
    name_regex str
    A regex string to filter results by Control Policy name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    policy_type str
    The policy type of control policy. Valid values System and Custom.
    enableDetails Boolean
    Default to false. Set it to true can output more details about resource attributes.
    ids List<String>
    A list of Control Policy IDs.
    language String
    The language. Valid value zh-CN, en, and ja. Default value zh-CN.
    nameRegex String
    A regex string to filter results by Control Policy name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    policyType String
    The policy type of control policy. Valid values System and Custom.

    getControlPolicies Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    Names List<string>
    Policies List<Pulumi.AliCloud.ResourceManager.Outputs.GetControlPoliciesPolicy>
    EnableDetails bool
    Language string
    NameRegex string
    OutputFile string
    PolicyType string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    Names []string
    Policies []GetControlPoliciesPolicy
    EnableDetails bool
    Language string
    NameRegex string
    OutputFile string
    PolicyType string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    policies List<GetControlPoliciesPolicy>
    enableDetails Boolean
    language String
    nameRegex String
    outputFile String
    policyType String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    names string[]
    policies GetControlPoliciesPolicy[]
    enableDetails boolean
    language string
    nameRegex string
    outputFile string
    policyType string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    names Sequence[str]
    policies Sequence[GetControlPoliciesPolicy]
    enable_details bool
    language str
    name_regex str
    output_file str
    policy_type str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    names List<String>
    policies List<Property Map>
    enableDetails Boolean
    language String
    nameRegex String
    outputFile String
    policyType String

    Supporting Types

    GetControlPoliciesPolicy

    AttachmentCount int
    The count of policy attachment.
    ControlPolicyName string
    The name of policy.
    Description string
    The description of policy.
    EffectScope string
    The effect scope.
    Id string
    The ID of the Control Policy.
    PolicyDocument string
    The policy document.
    PolicyId string
    The ID of policy.
    PolicyType string
    The type of policy.
    AttachmentCount int
    The count of policy attachment.
    ControlPolicyName string
    The name of policy.
    Description string
    The description of policy.
    EffectScope string
    The effect scope.
    Id string
    The ID of the Control Policy.
    PolicyDocument string
    The policy document.
    PolicyId string
    The ID of policy.
    PolicyType string
    The type of policy.
    attachmentCount Integer
    The count of policy attachment.
    controlPolicyName String
    The name of policy.
    description String
    The description of policy.
    effectScope String
    The effect scope.
    id String
    The ID of the Control Policy.
    policyDocument String
    The policy document.
    policyId String
    The ID of policy.
    policyType String
    The type of policy.
    attachmentCount number
    The count of policy attachment.
    controlPolicyName string
    The name of policy.
    description string
    The description of policy.
    effectScope string
    The effect scope.
    id string
    The ID of the Control Policy.
    policyDocument string
    The policy document.
    policyId string
    The ID of policy.
    policyType string
    The type of policy.
    attachment_count int
    The count of policy attachment.
    control_policy_name str
    The name of policy.
    description str
    The description of policy.
    effect_scope str
    The effect scope.
    id str
    The ID of the Control Policy.
    policy_document str
    The policy document.
    policy_id str
    The ID of policy.
    policy_type str
    The type of policy.
    attachmentCount Number
    The count of policy attachment.
    controlPolicyName String
    The name of policy.
    description String
    The description of policy.
    effectScope String
    The effect scope.
    id String
    The ID of the Control Policy.
    policyDocument String
    The policy document.
    policyId String
    The ID of policy.
    policyType String
    The type of policy.

    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.57.0 published on Saturday, Jun 15, 2024 by Pulumi