/
dnatEntries.go
283 lines (257 loc) · 10.6 KB
/
dnatEntries.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
// 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 nat
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 dnat entries
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
// "github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/eip"
// "github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/nat"
// "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
// }
// fooGateway, err := nat.NewGateway(ctx, "fooGateway", &nat.GatewayArgs{
// VpcId: fooVpc.ID(),
// SubnetId: fooSubnet.ID(),
// Spec: pulumi.String("Small"),
// NatGatewayName: pulumi.String("acc-test-ng"),
// Description: pulumi.String("acc-test"),
// BillingType: pulumi.String("PostPaid"),
// ProjectName: pulumi.String("default"),
// Tags: nat.GatewayTagArray{
// &nat.GatewayTagArgs{
// Key: pulumi.String("k1"),
// Value: pulumi.String("v1"),
// },
// },
// })
// if err != nil {
// return err
// }
// fooAddress, err := eip.NewAddress(ctx, "fooAddress", &eip.AddressArgs{
// Description: pulumi.String("acc-test"),
// Bandwidth: pulumi.Int(1),
// BillingType: pulumi.String("PostPaidByBandwidth"),
// Isp: pulumi.String("BGP"),
// })
// if err != nil {
// return err
// }
// fooAssociate, err := eip.NewAssociate(ctx, "fooAssociate", &eip.AssociateArgs{
// AllocationId: fooAddress.ID(),
// InstanceId: fooGateway.ID(),
// InstanceType: pulumi.String("Nat"),
// })
// if err != nil {
// return err
// }
// fooDnatEntry, err := nat.NewDnatEntry(ctx, "fooDnatEntry", &nat.DnatEntryArgs{
// DnatEntryName: pulumi.String("acc-test-dnat-entry"),
// ExternalIp: fooAddress.EipAddress,
// ExternalPort: pulumi.String("80"),
// InternalIp: pulumi.String("172.16.0.10"),
// InternalPort: pulumi.String("80"),
// NatGatewayId: fooGateway.ID(),
// Protocol: pulumi.String("tcp"),
// }, pulumi.DependsOn([]pulumi.Resource{
// fooAssociate,
// }))
// if err != nil {
// return err
// }
// _ = nat.DnatEntriesOutput(ctx, nat.DnatEntriesOutputArgs{
// Ids: pulumi.StringArray{
// fooDnatEntry.ID(),
// },
// }, nil)
// return nil
// })
// }
//
// ```
func DnatEntries(ctx *pulumi.Context, args *DnatEntriesArgs, opts ...pulumi.InvokeOption) (*DnatEntriesResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv DnatEntriesResult
err := ctx.Invoke("volcengine:nat/dnatEntries:DnatEntries", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking DnatEntries.
type DnatEntriesArgs struct {
// The name of the DNAT entry.
DnatEntryName *string `pulumi:"dnatEntryName"`
// Provides the public IP address for public network access.
ExternalIp *string `pulumi:"externalIp"`
// The port or port segment that receives requests from the public network. If InternalPort is passed into the port segment, ExternalPort must also be passed into the port segment.
ExternalPort *string `pulumi:"externalPort"`
// A list of DNAT entry ids.
Ids []string `pulumi:"ids"`
// Provides the internal IP address.
InternalIp *string `pulumi:"internalIp"`
// The port or port segment on which the cloud server instance provides services to the public network.
InternalPort *string `pulumi:"internalPort"`
// The id of the NAT gateway.
NatGatewayId *string `pulumi:"natGatewayId"`
// File name where to save data source results.
OutputFile *string `pulumi:"outputFile"`
// The network protocol.
Protocol *string `pulumi:"protocol"`
}
// A collection of values returned by DnatEntries.
type DnatEntriesResult struct {
// List of DNAT entries.
DnatEntries []DnatEntriesDnatEntry `pulumi:"dnatEntries"`
// The name of the DNAT entry.
DnatEntryName *string `pulumi:"dnatEntryName"`
// Provides the public IP address for public network access.
ExternalIp *string `pulumi:"externalIp"`
// The port or port segment that receives requests from the public network. If InternalPort is passed into the port segment, ExternalPort must also be passed into the port segment.
ExternalPort *string `pulumi:"externalPort"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
Ids []string `pulumi:"ids"`
// Provides the internal IP address.
InternalIp *string `pulumi:"internalIp"`
// The port or port segment on which the cloud server instance provides services to the public network.
InternalPort *string `pulumi:"internalPort"`
// The ID of the NAT gateway.
NatGatewayId *string `pulumi:"natGatewayId"`
OutputFile *string `pulumi:"outputFile"`
// The network protocol.
Protocol *string `pulumi:"protocol"`
// The total count of snat entries query.
TotalCount int `pulumi:"totalCount"`
}
func DnatEntriesOutput(ctx *pulumi.Context, args DnatEntriesOutputArgs, opts ...pulumi.InvokeOption) DnatEntriesResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (DnatEntriesResult, error) {
args := v.(DnatEntriesArgs)
r, err := DnatEntries(ctx, &args, opts...)
var s DnatEntriesResult
if r != nil {
s = *r
}
return s, err
}).(DnatEntriesResultOutput)
}
// A collection of arguments for invoking DnatEntries.
type DnatEntriesOutputArgs struct {
// The name of the DNAT entry.
DnatEntryName pulumi.StringPtrInput `pulumi:"dnatEntryName"`
// Provides the public IP address for public network access.
ExternalIp pulumi.StringPtrInput `pulumi:"externalIp"`
// The port or port segment that receives requests from the public network. If InternalPort is passed into the port segment, ExternalPort must also be passed into the port segment.
ExternalPort pulumi.StringPtrInput `pulumi:"externalPort"`
// A list of DNAT entry ids.
Ids pulumi.StringArrayInput `pulumi:"ids"`
// Provides the internal IP address.
InternalIp pulumi.StringPtrInput `pulumi:"internalIp"`
// The port or port segment on which the cloud server instance provides services to the public network.
InternalPort pulumi.StringPtrInput `pulumi:"internalPort"`
// The id of the NAT gateway.
NatGatewayId pulumi.StringPtrInput `pulumi:"natGatewayId"`
// File name where to save data source results.
OutputFile pulumi.StringPtrInput `pulumi:"outputFile"`
// The network protocol.
Protocol pulumi.StringPtrInput `pulumi:"protocol"`
}
func (DnatEntriesOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*DnatEntriesArgs)(nil)).Elem()
}
// A collection of values returned by DnatEntries.
type DnatEntriesResultOutput struct{ *pulumi.OutputState }
func (DnatEntriesResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*DnatEntriesResult)(nil)).Elem()
}
func (o DnatEntriesResultOutput) ToDnatEntriesResultOutput() DnatEntriesResultOutput {
return o
}
func (o DnatEntriesResultOutput) ToDnatEntriesResultOutputWithContext(ctx context.Context) DnatEntriesResultOutput {
return o
}
// List of DNAT entries.
func (o DnatEntriesResultOutput) DnatEntries() DnatEntriesDnatEntryArrayOutput {
return o.ApplyT(func(v DnatEntriesResult) []DnatEntriesDnatEntry { return v.DnatEntries }).(DnatEntriesDnatEntryArrayOutput)
}
// The name of the DNAT entry.
func (o DnatEntriesResultOutput) DnatEntryName() pulumi.StringPtrOutput {
return o.ApplyT(func(v DnatEntriesResult) *string { return v.DnatEntryName }).(pulumi.StringPtrOutput)
}
// Provides the public IP address for public network access.
func (o DnatEntriesResultOutput) ExternalIp() pulumi.StringPtrOutput {
return o.ApplyT(func(v DnatEntriesResult) *string { return v.ExternalIp }).(pulumi.StringPtrOutput)
}
// The port or port segment that receives requests from the public network. If InternalPort is passed into the port segment, ExternalPort must also be passed into the port segment.
func (o DnatEntriesResultOutput) ExternalPort() pulumi.StringPtrOutput {
return o.ApplyT(func(v DnatEntriesResult) *string { return v.ExternalPort }).(pulumi.StringPtrOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o DnatEntriesResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v DnatEntriesResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o DnatEntriesResultOutput) Ids() pulumi.StringArrayOutput {
return o.ApplyT(func(v DnatEntriesResult) []string { return v.Ids }).(pulumi.StringArrayOutput)
}
// Provides the internal IP address.
func (o DnatEntriesResultOutput) InternalIp() pulumi.StringPtrOutput {
return o.ApplyT(func(v DnatEntriesResult) *string { return v.InternalIp }).(pulumi.StringPtrOutput)
}
// The port or port segment on which the cloud server instance provides services to the public network.
func (o DnatEntriesResultOutput) InternalPort() pulumi.StringPtrOutput {
return o.ApplyT(func(v DnatEntriesResult) *string { return v.InternalPort }).(pulumi.StringPtrOutput)
}
// The ID of the NAT gateway.
func (o DnatEntriesResultOutput) NatGatewayId() pulumi.StringPtrOutput {
return o.ApplyT(func(v DnatEntriesResult) *string { return v.NatGatewayId }).(pulumi.StringPtrOutput)
}
func (o DnatEntriesResultOutput) OutputFile() pulumi.StringPtrOutput {
return o.ApplyT(func(v DnatEntriesResult) *string { return v.OutputFile }).(pulumi.StringPtrOutput)
}
// The network protocol.
func (o DnatEntriesResultOutput) Protocol() pulumi.StringPtrOutput {
return o.ApplyT(func(v DnatEntriesResult) *string { return v.Protocol }).(pulumi.StringPtrOutput)
}
// The total count of snat entries query.
func (o DnatEntriesResultOutput) TotalCount() pulumi.IntOutput {
return o.ApplyT(func(v DnatEntriesResult) int { return v.TotalCount }).(pulumi.IntOutput)
}
func init() {
pulumi.RegisterOutputType(DnatEntriesResultOutput{})
}