/
getLoadBalancers.go
124 lines (119 loc) · 3.97 KB
/
getLoadBalancers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package slb
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// This data source provides the server load balancers of the current Alibaba Cloud user.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-alicloud/sdk/v2/go/alicloud/slb"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := slb.NewLoadBalancer(ctx, "_default", nil)
// if err != nil {
// return err
// }
// opt0 := "sample_slb"
// slbsDs, err := slb.GetLoadBalancers(ctx, &slb.GetLoadBalancersArgs{
// NameRegex: &opt0,
// }, nil)
// if err != nil {
// return err
// }
// ctx.Export("firstSlbId", slbsDs.Slbs[0].Id)
// return nil
// })
// }
// ```
func GetLoadBalancers(ctx *pulumi.Context, args *GetLoadBalancersArgs, opts ...pulumi.InvokeOption) (*GetLoadBalancersResult, error) {
var rv GetLoadBalancersResult
err := ctx.Invoke("alicloud:slb/getLoadBalancers:getLoadBalancers", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getLoadBalancers.
type GetLoadBalancersArgs struct {
// Service address of the SLBs.
Address *string `pulumi:"address"`
// A list of SLBs IDs.
Ids []string `pulumi:"ids"`
// Master availability zone of the SLBs.
MasterAvailabilityZone *string `pulumi:"masterAvailabilityZone"`
// A regex string to filter results by SLB name.
NameRegex *string `pulumi:"nameRegex"`
// Network type of the SLBs. Valid values: `vpc` and `classic`.
NetworkType *string `pulumi:"networkType"`
OutputFile *string `pulumi:"outputFile"`
// The Id of resource group which SLB belongs.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// Slave availability zone of the SLBs.
SlaveAvailabilityZone *string `pulumi:"slaveAvailabilityZone"`
// A map of tags assigned to the SLB instances. The `tags` can have a maximum of 5 tag. It must be in the format:
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-alicloud/sdk/v2/go/alicloud/slb"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := slb.GetLoadBalancers(ctx, &slb.GetLoadBalancersArgs{
// Tags: map[string]interface{}{
// "tagKey1": "tagValue1",
// "tagKey2": "tagValue2",
// },
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
Tags map[string]interface{} `pulumi:"tags"`
// ID of the VPC linked to the SLBs.
VpcId *string `pulumi:"vpcId"`
// ID of the VSwitch linked to the SLBs.
VswitchId *string `pulumi:"vswitchId"`
}
// A collection of values returned by getLoadBalancers.
type GetLoadBalancersResult struct {
// Service address of the SLB.
Address *string `pulumi:"address"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// A list of slb IDs.
Ids []string `pulumi:"ids"`
// Master availability zone of the SLBs.
MasterAvailabilityZone *string `pulumi:"masterAvailabilityZone"`
NameRegex *string `pulumi:"nameRegex"`
// A list of slb names.
Names []string `pulumi:"names"`
// Network type of the SLB. Possible values: `vpc` and `classic`.
NetworkType *string `pulumi:"networkType"`
OutputFile *string `pulumi:"outputFile"`
ResourceGroupId *string `pulumi:"resourceGroupId"`
// Slave availability zone of the SLBs.
SlaveAvailabilityZone *string `pulumi:"slaveAvailabilityZone"`
// A list of SLBs. Each element contains the following attributes:
Slbs []GetLoadBalancersSlb `pulumi:"slbs"`
// A map of tags assigned to the SLB instance.
Tags map[string]interface{} `pulumi:"tags"`
// ID of the VPC the SLB belongs to.
VpcId *string `pulumi:"vpcId"`
// ID of the VSwitch the SLB belongs to.
VswitchId *string `pulumi:"vswitchId"`
}