1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. resourcemanager
  5. getControlPolicies
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.resourcemanager.getControlPolicies

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 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);
Copy
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)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: alicloud:resourcemanager:getControlPolicies
      arguments:
        ids:
          - example_value
        nameRegex: the_resource_name
outputs:
  firstResourceManagerControlPolicyId: ${example.policies[0].id}
Copy

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>
Copy
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]
Copy
func GetControlPolicies(ctx *Context, args *GetControlPoliciesArgs, opts ...InvokeOption) (*GetControlPoliciesResult, error)
func GetControlPoliciesOutput(ctx *Context, args *GetControlPoliciesOutputArgs, opts ...InvokeOption) GetControlPoliciesResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetControlPoliciesResult> getControlPolicies(GetControlPoliciesArgs args, InvokeOptions options)
public static Output<GetControlPoliciesResult> getControlPolicies(GetControlPoliciesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:resourcemanager/getControlPolicies:getControlPolicies
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

EnableDetails bool
Default to false. Set it to true can output more details about resource attributes.
Ids Changes to this property will trigger replacement. List<string>
A list of Control Policy IDs.
Language Changes to this property will trigger replacement. string
The language. Valid value zh-CN, en, and ja. Default value zh-CN.
NameRegex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. []string
A list of Control Policy IDs.
Language Changes to this property will trigger replacement. string
The language. Valid value zh-CN, en, and ja. Default value zh-CN.
NameRegex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. List<String>
A list of Control Policy IDs.
language Changes to this property will trigger replacement. String
The language. Valid value zh-CN, en, and ja. Default value zh-CN.
nameRegex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. string[]
A list of Control Policy IDs.
language Changes to this property will trigger replacement. string
The language. Valid value zh-CN, en, and ja. Default value zh-CN.
nameRegex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. Sequence[str]
A list of Control Policy IDs.
language Changes to this property will trigger replacement. str
The language. Valid value zh-CN, en, and ja. Default value zh-CN.
name_regex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. List<String>
A list of Control Policy IDs.
language Changes to this property will trigger replacement. String
The language. Valid value zh-CN, en, and ja. Default value zh-CN.
nameRegex Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. 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 This property is required. int
The count of policy attachment.
ControlPolicyName This property is required. string
The name of policy.
Description This property is required. string
The description of policy.
EffectScope This property is required. string
The effect scope.
Id This property is required. string
The ID of the Control Policy.
PolicyDocument This property is required. string
The policy document.
PolicyId This property is required. string
The ID of policy.
PolicyType This property is required. string
The type of policy.
AttachmentCount This property is required. int
The count of policy attachment.
ControlPolicyName This property is required. string
The name of policy.
Description This property is required. string
The description of policy.
EffectScope This property is required. string
The effect scope.
Id This property is required. string
The ID of the Control Policy.
PolicyDocument This property is required. string
The policy document.
PolicyId This property is required. string
The ID of policy.
PolicyType This property is required. string
The type of policy.
attachmentCount This property is required. Integer
The count of policy attachment.
controlPolicyName This property is required. String
The name of policy.
description This property is required. String
The description of policy.
effectScope This property is required. String
The effect scope.
id This property is required. String
The ID of the Control Policy.
policyDocument This property is required. String
The policy document.
policyId This property is required. String
The ID of policy.
policyType This property is required. String
The type of policy.
attachmentCount This property is required. number
The count of policy attachment.
controlPolicyName This property is required. string
The name of policy.
description This property is required. string
The description of policy.
effectScope This property is required. string
The effect scope.
id This property is required. string
The ID of the Control Policy.
policyDocument This property is required. string
The policy document.
policyId This property is required. string
The ID of policy.
policyType This property is required. string
The type of policy.
attachment_count This property is required. int
The count of policy attachment.
control_policy_name This property is required. str
The name of policy.
description This property is required. str
The description of policy.
effect_scope This property is required. str
The effect scope.
id This property is required. str
The ID of the Control Policy.
policy_document This property is required. str
The policy document.
policy_id This property is required. str
The ID of policy.
policy_type This property is required. str
The type of policy.
attachmentCount This property is required. Number
The count of policy attachment.
controlPolicyName This property is required. String
The name of policy.
description This property is required. String
The description of policy.
effectScope This property is required. String
The effect scope.
id This property is required. String
The ID of the Control Policy.
policyDocument This property is required. String
The policy document.
policyId This property is required. String
The ID of policy.
policyType This property is required. 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.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi