1. Packages
  2. Ucloud Provider
  3. API Docs
  4. getLbRules
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

ucloud.getLbRules

Explore with Pulumi AI

This data source provides a list of Load Balancer Rule resources according to their Load Balancer Rule ID.

Example Usage

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

const example = ucloud.getLbRules({
    loadBalancerId: "ulb-xxx",
    listenerId: "vserver-xxx",
});
export const first = example.then(example => example.lbRules?.[0]?.id);
Copy
import pulumi
import pulumi_ucloud as ucloud

example = ucloud.get_lb_rules(load_balancer_id="ulb-xxx",
    listener_id="vserver-xxx")
pulumi.export("first", example.lb_rules[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := ucloud.GetLbRules(ctx, &ucloud.GetLbRulesArgs{
			LoadBalancerId: "ulb-xxx",
			ListenerId:     "vserver-xxx",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("first", example.LbRules[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ucloud = Pulumi.Ucloud;

return await Deployment.RunAsync(() => 
{
    var example = Ucloud.GetLbRules.Invoke(new()
    {
        LoadBalancerId = "ulb-xxx",
        ListenerId = "vserver-xxx",
    });

    return new Dictionary<string, object?>
    {
        ["first"] = example.Apply(getLbRulesResult => getLbRulesResult.LbRules[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ucloud.UcloudFunctions;
import com.pulumi.ucloud.inputs.GetLbRulesArgs;
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 = UcloudFunctions.getLbRules(GetLbRulesArgs.builder()
            .loadBalancerId("ulb-xxx")
            .listenerId("vserver-xxx")
            .build());

        ctx.export("first", example.applyValue(getLbRulesResult -> getLbRulesResult.lbRules()[0].id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ucloud:getLbRules
      arguments:
        loadBalancerId: ulb-xxx
        listenerId: vserver-xxx
outputs:
  first: ${example.lbRules[0].id}
Copy

Using getLbRules

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 getLbRules(args: GetLbRulesArgs, opts?: InvokeOptions): Promise<GetLbRulesResult>
function getLbRulesOutput(args: GetLbRulesOutputArgs, opts?: InvokeOptions): Output<GetLbRulesResult>
Copy
def get_lb_rules(id: Optional[str] = None,
                 ids: Optional[Sequence[str]] = None,
                 listener_id: Optional[str] = None,
                 load_balancer_id: Optional[str] = None,
                 output_file: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetLbRulesResult
def get_lb_rules_output(id: Optional[pulumi.Input[str]] = None,
                 ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 listener_id: Optional[pulumi.Input[str]] = None,
                 load_balancer_id: Optional[pulumi.Input[str]] = None,
                 output_file: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetLbRulesResult]
Copy
func GetLbRules(ctx *Context, args *GetLbRulesArgs, opts ...InvokeOption) (*GetLbRulesResult, error)
func GetLbRulesOutput(ctx *Context, args *GetLbRulesOutputArgs, opts ...InvokeOption) GetLbRulesResultOutput
Copy

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

public static class GetLbRules 
{
    public static Task<GetLbRulesResult> InvokeAsync(GetLbRulesArgs args, InvokeOptions? opts = null)
    public static Output<GetLbRulesResult> Invoke(GetLbRulesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetLbRulesResult> getLbRules(GetLbRulesArgs args, InvokeOptions options)
public static Output<GetLbRulesResult> getLbRules(GetLbRulesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: ucloud:index/getLbRules:getLbRules
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ListenerId This property is required. string
The ID of a listener server.


LoadBalancerId This property is required. string
The ID of a load balancer.
Id string
The ID of LB Rule.
Ids List<string>
A list of LB Rule IDs, all the LB Rules belong to the Load Balancer listener will be retrieved if the ID is [].
OutputFile string
File name where to save data source results (after running pulumi preview).
ListenerId This property is required. string
The ID of a listener server.


LoadBalancerId This property is required. string
The ID of a load balancer.
Id string
The ID of LB Rule.
Ids []string
A list of LB Rule IDs, all the LB Rules belong to the Load Balancer listener will be retrieved if the ID is [].
OutputFile string
File name where to save data source results (after running pulumi preview).
listenerId This property is required. String
The ID of a listener server.


loadBalancerId This property is required. String
The ID of a load balancer.
id String
The ID of LB Rule.
ids List<String>
A list of LB Rule IDs, all the LB Rules belong to the Load Balancer listener will be retrieved if the ID is [].
outputFile String
File name where to save data source results (after running pulumi preview).
listenerId This property is required. string
The ID of a listener server.


loadBalancerId This property is required. string
The ID of a load balancer.
id string
The ID of LB Rule.
ids string[]
A list of LB Rule IDs, all the LB Rules belong to the Load Balancer listener will be retrieved if the ID is [].
outputFile string
File name where to save data source results (after running pulumi preview).
listener_id This property is required. str
The ID of a listener server.


load_balancer_id This property is required. str
The ID of a load balancer.
id str
The ID of LB Rule.
ids Sequence[str]
A list of LB Rule IDs, all the LB Rules belong to the Load Balancer listener will be retrieved if the ID is [].
output_file str
File name where to save data source results (after running pulumi preview).
listenerId This property is required. String
The ID of a listener server.


loadBalancerId This property is required. String
The ID of a load balancer.
id String
The ID of LB Rule.
ids List<String>
A list of LB Rule IDs, all the LB Rules belong to the Load Balancer listener will be retrieved if the ID is [].
outputFile String
File name where to save data source results (after running pulumi preview).

getLbRules Result

The following output properties are available:

Id string
The ID of LB Rule.
Ids List<string>
LbRules List<GetLbRulesLbRule>
It is a nested type which documented below.
ListenerId string
LoadBalancerId string
TotalCount double
Total number of LB Rules that satisfy the condition.
OutputFile string
Id string
The ID of LB Rule.
Ids []string
LbRules []GetLbRulesLbRule
It is a nested type which documented below.
ListenerId string
LoadBalancerId string
TotalCount float64
Total number of LB Rules that satisfy the condition.
OutputFile string
id String
The ID of LB Rule.
ids List<String>
lbRules List<GetLbRulesLbRule>
It is a nested type which documented below.
listenerId String
loadBalancerId String
totalCount Double
Total number of LB Rules that satisfy the condition.
outputFile String
id string
The ID of LB Rule.
ids string[]
lbRules GetLbRulesLbRule[]
It is a nested type which documented below.
listenerId string
loadBalancerId string
totalCount number
Total number of LB Rules that satisfy the condition.
outputFile string
id str
The ID of LB Rule.
ids Sequence[str]
lb_rules Sequence[GetLbRulesLbRule]
It is a nested type which documented below.
listener_id str
load_balancer_id str
total_count float
Total number of LB Rules that satisfy the condition.
output_file str
id String
The ID of LB Rule.
ids List<String>
lbRules List<Property Map>
It is a nested type which documented below.
listenerId String
loadBalancerId String
totalCount Number
Total number of LB Rules that satisfy the condition.
outputFile String

Supporting Types

GetLbRulesLbRule

Domain This property is required. string
(Optional) The domain of content forward matching fields. path and domain cannot coexist.
Id This property is required. string
The ID of LB Rule.
Path This property is required. string
(Optional) The path of Content forward matching fields. path and domain cannot coexist.
Domain This property is required. string
(Optional) The domain of content forward matching fields. path and domain cannot coexist.
Id This property is required. string
The ID of LB Rule.
Path This property is required. string
(Optional) The path of Content forward matching fields. path and domain cannot coexist.
domain This property is required. String
(Optional) The domain of content forward matching fields. path and domain cannot coexist.
id This property is required. String
The ID of LB Rule.
path This property is required. String
(Optional) The path of Content forward matching fields. path and domain cannot coexist.
domain This property is required. string
(Optional) The domain of content forward matching fields. path and domain cannot coexist.
id This property is required. string
The ID of LB Rule.
path This property is required. string
(Optional) The path of Content forward matching fields. path and domain cannot coexist.
domain This property is required. str
(Optional) The domain of content forward matching fields. path and domain cannot coexist.
id This property is required. str
The ID of LB Rule.
path This property is required. str
(Optional) The path of Content forward matching fields. path and domain cannot coexist.
domain This property is required. String
(Optional) The domain of content forward matching fields. path and domain cannot coexist.
id This property is required. String
The ID of LB Rule.
path This property is required. String
(Optional) The path of Content forward matching fields. path and domain cannot coexist.

Package Details

Repository
ucloud ucloud/terraform-provider-ucloud
License
Notes
This Pulumi package is based on the ucloud Terraform Provider.