1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. pvtz
  5. getRules
Alibaba Cloud v3.75.0 published on Friday, Mar 7, 2025 by Pulumi

alicloud.pvtz.getRules

Explore with Pulumi AI

Alibaba Cloud v3.75.0 published on Friday, Mar 7, 2025 by Pulumi

This data source provides the PrivateZone Rules of the current Alibaba Cloud user.

NOTE: Available in v1.143.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.pvtz.getRules({});
export const pvtzRuleId1 = ids.then(ids => ids.rules?.[0]?.id);
const nameRegex = alicloud.pvtz.getRules({
    nameRegex: "^my-Rule",
});
export const pvtzRuleId2 = nameRegex.then(nameRegex => nameRegex.rules?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.pvtz.get_rules()
pulumi.export("pvtzRuleId1", ids.rules[0].id)
name_regex = alicloud.pvtz.get_rules(name_regex="^my-Rule")
pulumi.export("pvtzRuleId2", name_regex.rules[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/pvtz"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := pvtz.GetRules(ctx, &pvtz.GetRulesArgs{}, nil)
		if err != nil {
			return err
		}
		ctx.Export("pvtzRuleId1", ids.Rules[0].Id)
		nameRegex, err := pvtz.GetRules(ctx, &pvtz.GetRulesArgs{
			NameRegex: pulumi.StringRef("^my-Rule"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("pvtzRuleId2", nameRegex.Rules[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.Pvtz.GetRules.Invoke();

    var nameRegex = AliCloud.Pvtz.GetRules.Invoke(new()
    {
        NameRegex = "^my-Rule",
    });

    return new Dictionary<string, object?>
    {
        ["pvtzRuleId1"] = ids.Apply(getRulesResult => getRulesResult.Rules[0]?.Id),
        ["pvtzRuleId2"] = nameRegex.Apply(getRulesResult => getRulesResult.Rules[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.pvtz.PvtzFunctions;
import com.pulumi.alicloud.pvtz.inputs.GetRulesArgs;
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 ids = PvtzFunctions.getRules();

        ctx.export("pvtzRuleId1", ids.applyValue(getRulesResult -> getRulesResult.rules()[0].id()));
        final var nameRegex = PvtzFunctions.getRules(GetRulesArgs.builder()
            .nameRegex("^my-Rule")
            .build());

        ctx.export("pvtzRuleId2", nameRegex.applyValue(getRulesResult -> getRulesResult.rules()[0].id()));
    }
}
Copy
variables:
  ids:
    fn::invoke:
      function: alicloud:pvtz:getRules
      arguments: {}
  nameRegex:
    fn::invoke:
      function: alicloud:pvtz:getRules
      arguments:
        nameRegex: ^my-Rule
outputs:
  pvtzRuleId1: ${ids.rules[0].id}
  pvtzRuleId2: ${nameRegex.rules[0].id}
Copy

Using getRules

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 getRules(args: GetRulesArgs, opts?: InvokeOptions): Promise<GetRulesResult>
function getRulesOutput(args: GetRulesOutputArgs, opts?: InvokeOptions): Output<GetRulesResult>
Copy
def get_rules(endpoint_id: Optional[str] = None,
              ids: Optional[Sequence[str]] = None,
              name_regex: Optional[str] = None,
              output_file: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> GetRulesResult
def get_rules_output(endpoint_id: 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,
              opts: Optional[InvokeOptions] = None) -> Output[GetRulesResult]
Copy
func GetRules(ctx *Context, args *GetRulesArgs, opts ...InvokeOption) (*GetRulesResult, error)
func GetRulesOutput(ctx *Context, args *GetRulesOutputArgs, opts ...InvokeOption) GetRulesResultOutput
Copy

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

public static class GetRules 
{
    public static Task<GetRulesResult> InvokeAsync(GetRulesArgs args, InvokeOptions? opts = null)
    public static Output<GetRulesResult> Invoke(GetRulesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
public static Output<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:pvtz/getRules:getRules
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

EndpointId Changes to this property will trigger replacement. string
The ID of the Endpoint.
Ids Changes to this property will trigger replacement. List<string>
A list of Rule IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Rule name.
OutputFile string
File name where to save data source results (after running pulumi preview).
EndpointId Changes to this property will trigger replacement. string
The ID of the Endpoint.
Ids Changes to this property will trigger replacement. []string
A list of Rule IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Rule name.
OutputFile string
File name where to save data source results (after running pulumi preview).
endpointId Changes to this property will trigger replacement. String
The ID of the Endpoint.
ids Changes to this property will trigger replacement. List<String>
A list of Rule IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Rule name.
outputFile String
File name where to save data source results (after running pulumi preview).
endpointId Changes to this property will trigger replacement. string
The ID of the Endpoint.
ids Changes to this property will trigger replacement. string[]
A list of Rule IDs.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Rule name.
outputFile string
File name where to save data source results (after running pulumi preview).
endpoint_id Changes to this property will trigger replacement. str
The ID of the Endpoint.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Rule IDs.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Rule name.
output_file str
File name where to save data source results (after running pulumi preview).
endpointId Changes to this property will trigger replacement. String
The ID of the Endpoint.
ids Changes to this property will trigger replacement. List<String>
A list of Rule IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Rule name.
outputFile String
File name where to save data source results (after running pulumi preview).

getRules Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
Names List<string>
Rules List<Pulumi.AliCloud.Pvtz.Outputs.GetRulesRule>
EndpointId string
NameRegex string
OutputFile string
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
Names []string
Rules []GetRulesRule
EndpointId string
NameRegex string
OutputFile string
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
rules List<GetRulesRule>
endpointId String
nameRegex String
outputFile String
id string
The provider-assigned unique ID for this managed resource.
ids string[]
names string[]
rules GetRulesRule[]
endpointId string
nameRegex string
outputFile string
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
names Sequence[str]
rules Sequence[GetRulesRule]
endpoint_id str
name_regex str
output_file str
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
names List<String>
rules List<Property Map>
endpointId String
nameRegex String
outputFile String

Supporting Types

GetRulesRule

BindVpcs This property is required. List<Pulumi.AliCloud.Pvtz.Inputs.GetRulesRuleBindVpc>
The List of the VPC. See the following Block bind_vpcs. NOTE: Available in v1.158.0+.
CreateTime This property is required. string
The creation time of the resource.
EndpointId This property is required. string
The ID of the Endpoint.
EndpointName This property is required. string
The Name of the Endpoint.
ForwardIps This property is required. List<Pulumi.AliCloud.Pvtz.Inputs.GetRulesRuleForwardIp>
Id This property is required. string
The ID of the Rule.
RuleId This property is required. string
The first ID of the resource.
RuleName This property is required. string
The name of the resource.
Type This property is required. string
The type of the rule.
ZoneName This property is required. string
The name of the forwarding zone.
BindVpcs This property is required. []GetRulesRuleBindVpc
The List of the VPC. See the following Block bind_vpcs. NOTE: Available in v1.158.0+.
CreateTime This property is required. string
The creation time of the resource.
EndpointId This property is required. string
The ID of the Endpoint.
EndpointName This property is required. string
The Name of the Endpoint.
ForwardIps This property is required. []GetRulesRuleForwardIp
Id This property is required. string
The ID of the Rule.
RuleId This property is required. string
The first ID of the resource.
RuleName This property is required. string
The name of the resource.
Type This property is required. string
The type of the rule.
ZoneName This property is required. string
The name of the forwarding zone.
bindVpcs This property is required. List<GetRulesRuleBindVpc>
The List of the VPC. See the following Block bind_vpcs. NOTE: Available in v1.158.0+.
createTime This property is required. String
The creation time of the resource.
endpointId This property is required. String
The ID of the Endpoint.
endpointName This property is required. String
The Name of the Endpoint.
forwardIps This property is required. List<GetRulesRuleForwardIp>
id This property is required. String
The ID of the Rule.
ruleId This property is required. String
The first ID of the resource.
ruleName This property is required. String
The name of the resource.
type This property is required. String
The type of the rule.
zoneName This property is required. String
The name of the forwarding zone.
bindVpcs This property is required. GetRulesRuleBindVpc[]
The List of the VPC. See the following Block bind_vpcs. NOTE: Available in v1.158.0+.
createTime This property is required. string
The creation time of the resource.
endpointId This property is required. string
The ID of the Endpoint.
endpointName This property is required. string
The Name of the Endpoint.
forwardIps This property is required. GetRulesRuleForwardIp[]
id This property is required. string
The ID of the Rule.
ruleId This property is required. string
The first ID of the resource.
ruleName This property is required. string
The name of the resource.
type This property is required. string
The type of the rule.
zoneName This property is required. string
The name of the forwarding zone.
bind_vpcs This property is required. Sequence[GetRulesRuleBindVpc]
The List of the VPC. See the following Block bind_vpcs. NOTE: Available in v1.158.0+.
create_time This property is required. str
The creation time of the resource.
endpoint_id This property is required. str
The ID of the Endpoint.
endpoint_name This property is required. str
The Name of the Endpoint.
forward_ips This property is required. Sequence[GetRulesRuleForwardIp]
id This property is required. str
The ID of the Rule.
rule_id This property is required. str
The first ID of the resource.
rule_name This property is required. str
The name of the resource.
type This property is required. str
The type of the rule.
zone_name This property is required. str
The name of the forwarding zone.
bindVpcs This property is required. List<Property Map>
The List of the VPC. See the following Block bind_vpcs. NOTE: Available in v1.158.0+.
createTime This property is required. String
The creation time of the resource.
endpointId This property is required. String
The ID of the Endpoint.
endpointName This property is required. String
The Name of the Endpoint.
forwardIps This property is required. List<Property Map>
id This property is required. String
The ID of the Rule.
ruleId This property is required. String
The first ID of the resource.
ruleName This property is required. String
The name of the resource.
type This property is required. String
The type of the rule.
zoneName This property is required. String
The name of the forwarding zone.

GetRulesRuleBindVpc

RegionId This property is required. string
The region ID of the vpc.
RegionName This property is required. string
The Region Name of the vpc.
VpcId This property is required. string
The ID of the VPC.
VpcName This property is required. string
The Name of the VPC.
RegionId This property is required. string
The region ID of the vpc.
RegionName This property is required. string
The Region Name of the vpc.
VpcId This property is required. string
The ID of the VPC.
VpcName This property is required. string
The Name of the VPC.
regionId This property is required. String
The region ID of the vpc.
regionName This property is required. String
The Region Name of the vpc.
vpcId This property is required. String
The ID of the VPC.
vpcName This property is required. String
The Name of the VPC.
regionId This property is required. string
The region ID of the vpc.
regionName This property is required. string
The Region Name of the vpc.
vpcId This property is required. string
The ID of the VPC.
vpcName This property is required. string
The Name of the VPC.
region_id This property is required. str
The region ID of the vpc.
region_name This property is required. str
The Region Name of the vpc.
vpc_id This property is required. str
The ID of the VPC.
vpc_name This property is required. str
The Name of the VPC.
regionId This property is required. String
The region ID of the vpc.
regionName This property is required. String
The Region Name of the vpc.
vpcId This property is required. String
The ID of the VPC.
vpcName This property is required. String
The Name of the VPC.

GetRulesRuleForwardIp

Ip This property is required. string
Port This property is required. int
Ip This property is required. string
Port This property is required. int
ip This property is required. String
port This property is required. Integer
ip This property is required. string
port This property is required. number
ip This property is required. str
port This property is required. int
ip This property is required. String
port This property is required. Number

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.75.0 published on Friday, Mar 7, 2025 by Pulumi