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

alicloud.pvtz.getRules

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 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);
    
    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)
    
    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, nil, 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
    	})
    }
    
    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),
        };
    });
    
    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()));
        }
    }
    
    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}
    

    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>
    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]
    func GetRules(ctx *Context, args *GetRulesArgs, opts ...InvokeOption) (*GetRulesResult, error)
    func GetRulesOutput(ctx *Context, args *GetRulesOutputArgs, opts ...InvokeOption) GetRulesResultOutput

    > 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)
    }
    public static CompletableFuture<GetRulesResult> getRules(GetRulesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:pvtz/getRules:getRules
      arguments:
        # arguments dictionary

    The following arguments are supported:

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

    GetRulesRuleBindVpc

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

    GetRulesRuleForwardIp

    Ip string
    Port int
    Ip string
    Port int
    ip String
    port Integer
    ip string
    port number
    ip str
    port int
    ip String
    port Number

    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