/
getNetworkSwitch.go
162 lines (139 loc) · 5.66 KB
/
getNetworkSwitch.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
// 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 openwrt
import (
"context"
"reflect"
"github.com/deposition-cloud/pulumi-openwrt/sdk/go/openwrt/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// Legacy `swconfig` configuration
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/deposition-cloud/pulumi-openwrt/sdk/go/openwrt"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := openwrt.LookupNetworkSwitch(ctx, &openwrt.LookupNetworkSwitchArgs{
// Id: "testing",
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func LookupNetworkSwitch(ctx *pulumi.Context, args *LookupNetworkSwitchArgs, opts ...pulumi.InvokeOption) (*LookupNetworkSwitchResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupNetworkSwitchResult
err := ctx.Invoke("openwrt:index/getNetworkSwitch:getNetworkSwitch", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getNetworkSwitch.
type LookupNetworkSwitchArgs struct {
// Name of the section. This name is only used when interacting with UCI directly.
Id string `pulumi:"id"`
}
// A collection of values returned by getNetworkSwitch.
type LookupNetworkSwitchResult struct {
// Mirror received packets from the `mirrorSourcePort` to the `mirrorMonitorPort`.
EnableMirrorRx bool `pulumi:"enableMirrorRx"`
// Mirror transmitted packets from the `mirrorSourcePort` to the `mirrorMonitorPort`.
EnableMirrorTx bool `pulumi:"enableMirrorTx"`
// Enables VLAN functionality.
EnableVlan bool `pulumi:"enableVlan"`
// Name of the section. This name is only used when interacting with UCI directly.
Id string `pulumi:"id"`
// Switch port to which packets are mirrored.
MirrorMonitorPort int `pulumi:"mirrorMonitorPort"`
// Switch port from which packets are mirrored.
MirrorSourcePort int `pulumi:"mirrorSourcePort"`
Name string `pulumi:"name"`
// Reset the switch.
Reset bool `pulumi:"reset"`
}
func LookupNetworkSwitchOutput(ctx *pulumi.Context, args LookupNetworkSwitchOutputArgs, opts ...pulumi.InvokeOption) LookupNetworkSwitchResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupNetworkSwitchResult, error) {
args := v.(LookupNetworkSwitchArgs)
r, err := LookupNetworkSwitch(ctx, &args, opts...)
var s LookupNetworkSwitchResult
if r != nil {
s = *r
}
return s, err
}).(LookupNetworkSwitchResultOutput)
}
// A collection of arguments for invoking getNetworkSwitch.
type LookupNetworkSwitchOutputArgs struct {
// Name of the section. This name is only used when interacting with UCI directly.
Id pulumi.StringInput `pulumi:"id"`
}
func (LookupNetworkSwitchOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupNetworkSwitchArgs)(nil)).Elem()
}
// A collection of values returned by getNetworkSwitch.
type LookupNetworkSwitchResultOutput struct{ *pulumi.OutputState }
func (LookupNetworkSwitchResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupNetworkSwitchResult)(nil)).Elem()
}
func (o LookupNetworkSwitchResultOutput) ToLookupNetworkSwitchResultOutput() LookupNetworkSwitchResultOutput {
return o
}
func (o LookupNetworkSwitchResultOutput) ToLookupNetworkSwitchResultOutputWithContext(ctx context.Context) LookupNetworkSwitchResultOutput {
return o
}
func (o LookupNetworkSwitchResultOutput) ToOutput(ctx context.Context) pulumix.Output[LookupNetworkSwitchResult] {
return pulumix.Output[LookupNetworkSwitchResult]{
OutputState: o.OutputState,
}
}
// Mirror received packets from the `mirrorSourcePort` to the `mirrorMonitorPort`.
func (o LookupNetworkSwitchResultOutput) EnableMirrorRx() pulumi.BoolOutput {
return o.ApplyT(func(v LookupNetworkSwitchResult) bool { return v.EnableMirrorRx }).(pulumi.BoolOutput)
}
// Mirror transmitted packets from the `mirrorSourcePort` to the `mirrorMonitorPort`.
func (o LookupNetworkSwitchResultOutput) EnableMirrorTx() pulumi.BoolOutput {
return o.ApplyT(func(v LookupNetworkSwitchResult) bool { return v.EnableMirrorTx }).(pulumi.BoolOutput)
}
// Enables VLAN functionality.
func (o LookupNetworkSwitchResultOutput) EnableVlan() pulumi.BoolOutput {
return o.ApplyT(func(v LookupNetworkSwitchResult) bool { return v.EnableVlan }).(pulumi.BoolOutput)
}
// Name of the section. This name is only used when interacting with UCI directly.
func (o LookupNetworkSwitchResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupNetworkSwitchResult) string { return v.Id }).(pulumi.StringOutput)
}
// Switch port to which packets are mirrored.
func (o LookupNetworkSwitchResultOutput) MirrorMonitorPort() pulumi.IntOutput {
return o.ApplyT(func(v LookupNetworkSwitchResult) int { return v.MirrorMonitorPort }).(pulumi.IntOutput)
}
// Switch port from which packets are mirrored.
func (o LookupNetworkSwitchResultOutput) MirrorSourcePort() pulumi.IntOutput {
return o.ApplyT(func(v LookupNetworkSwitchResult) int { return v.MirrorSourcePort }).(pulumi.IntOutput)
}
func (o LookupNetworkSwitchResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupNetworkSwitchResult) string { return v.Name }).(pulumi.StringOutput)
}
// Reset the switch.
func (o LookupNetworkSwitchResultOutput) Reset() pulumi.BoolOutput {
return o.ApplyT(func(v LookupNetworkSwitchResult) bool { return v.Reset }).(pulumi.BoolOutput)
}
func init() {
pulumi.RegisterOutputType(LookupNetworkSwitchResultOutput{})
}