/
rules.go
213 lines (194 loc) · 6.57 KB
/
rules.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package clb
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/internal"
)
// Use this data source to query detailed information of clb rules
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/clb"
// "github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
// "github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// fooZones, err := ecs.Zones(ctx, nil, nil)
// if err != nil {
// return err
// }
// fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
// VpcName: pulumi.String("acc-test-vpc"),
// CidrBlock: pulumi.String("172.16.0.0/16"),
// })
// if err != nil {
// return err
// }
// fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
// SubnetName: pulumi.String("acc-test-subnet"),
// CidrBlock: pulumi.String("172.16.0.0/24"),
// ZoneId: *pulumi.String(fooZones.Zones[0].Id),
// VpcId: fooVpc.ID(),
// })
// if err != nil {
// return err
// }
// fooClb, err := clb.NewClb(ctx, "fooClb", &clb.ClbArgs{
// Type: pulumi.String("public"),
// SubnetId: fooSubnet.ID(),
// LoadBalancerSpec: pulumi.String("small_1"),
// Description: pulumi.String("acc0Demo"),
// LoadBalancerName: pulumi.String("acc-test-create"),
// EipBillingConfig: &clb.ClbEipBillingConfigArgs{
// Isp: pulumi.String("BGP"),
// EipBillingType: pulumi.String("PostPaidByBandwidth"),
// Bandwidth: pulumi.Int(1),
// },
// })
// if err != nil {
// return err
// }
// fooServerGroup, err := clb.NewServerGroup(ctx, "fooServerGroup", &clb.ServerGroupArgs{
// LoadBalancerId: fooClb.ID(),
// ServerGroupName: pulumi.String("acc-test-create"),
// Description: pulumi.String("hello demo11"),
// })
// if err != nil {
// return err
// }
// fooListener, err := clb.NewListener(ctx, "fooListener", &clb.ListenerArgs{
// LoadBalancerId: fooClb.ID(),
// ListenerName: pulumi.String("acc-test-listener"),
// Protocol: pulumi.String("HTTP"),
// Port: pulumi.Int(90),
// ServerGroupId: fooServerGroup.ID(),
// HealthCheck: &clb.ListenerHealthCheckArgs{
// Enabled: pulumi.String("on"),
// Interval: pulumi.Int(10),
// Timeout: pulumi.Int(3),
// HealthyThreshold: pulumi.Int(5),
// UnHealthyThreshold: pulumi.Int(2),
// Domain: pulumi.String("volcengine.com"),
// HttpCode: pulumi.String("http_2xx"),
// Method: pulumi.String("GET"),
// Uri: pulumi.String("/"),
// },
// Enabled: pulumi.String("on"),
// })
// if err != nil {
// return err
// }
// fooRule, err := clb.NewRule(ctx, "fooRule", &clb.RuleArgs{
// ListenerId: fooListener.ID(),
// ServerGroupId: fooServerGroup.ID(),
// Domain: pulumi.String("test-volc123.com"),
// Url: pulumi.String("/yyyy"),
// })
// if err != nil {
// return err
// }
// _ = clb.RulesOutput(ctx, clb.RulesOutputArgs{
// Ids: pulumi.StringArray{
// fooRule.ID(),
// },
// ListenerId: fooListener.ID(),
// }, nil)
// return nil
// })
// }
//
// ```
func Rules(ctx *pulumi.Context, args *RulesArgs, opts ...pulumi.InvokeOption) (*RulesResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv RulesResult
err := ctx.Invoke("volcengine:clb/rules:Rules", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking Rules.
type RulesArgs struct {
// A list of Rule IDs.
Ids []string `pulumi:"ids"`
// The Id of listener.
ListenerId string `pulumi:"listenerId"`
// File name where to save data source results.
OutputFile *string `pulumi:"outputFile"`
}
// A collection of values returned by Rules.
type RulesResult struct {
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
Ids []string `pulumi:"ids"`
ListenerId string `pulumi:"listenerId"`
OutputFile *string `pulumi:"outputFile"`
// The collection of Rule query.
Rules []RulesRule `pulumi:"rules"`
}
func RulesOutput(ctx *pulumi.Context, args RulesOutputArgs, opts ...pulumi.InvokeOption) RulesResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (RulesResult, error) {
args := v.(RulesArgs)
r, err := Rules(ctx, &args, opts...)
var s RulesResult
if r != nil {
s = *r
}
return s, err
}).(RulesResultOutput)
}
// A collection of arguments for invoking Rules.
type RulesOutputArgs struct {
// A list of Rule IDs.
Ids pulumi.StringArrayInput `pulumi:"ids"`
// The Id of listener.
ListenerId pulumi.StringInput `pulumi:"listenerId"`
// File name where to save data source results.
OutputFile pulumi.StringPtrInput `pulumi:"outputFile"`
}
func (RulesOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*RulesArgs)(nil)).Elem()
}
// A collection of values returned by Rules.
type RulesResultOutput struct{ *pulumi.OutputState }
func (RulesResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*RulesResult)(nil)).Elem()
}
func (o RulesResultOutput) ToRulesResultOutput() RulesResultOutput {
return o
}
func (o RulesResultOutput) ToRulesResultOutputWithContext(ctx context.Context) RulesResultOutput {
return o
}
// The provider-assigned unique ID for this managed resource.
func (o RulesResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v RulesResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o RulesResultOutput) Ids() pulumi.StringArrayOutput {
return o.ApplyT(func(v RulesResult) []string { return v.Ids }).(pulumi.StringArrayOutput)
}
func (o RulesResultOutput) ListenerId() pulumi.StringOutput {
return o.ApplyT(func(v RulesResult) string { return v.ListenerId }).(pulumi.StringOutput)
}
func (o RulesResultOutput) OutputFile() pulumi.StringPtrOutput {
return o.ApplyT(func(v RulesResult) *string { return v.OutputFile }).(pulumi.StringPtrOutput)
}
// The collection of Rule query.
func (o RulesResultOutput) Rules() RulesRuleArrayOutput {
return o.ApplyT(func(v RulesResult) []RulesRule { return v.Rules }).(RulesRuleArrayOutput)
}
func init() {
pulumi.RegisterOutputType(RulesResultOutput{})
}