-
Notifications
You must be signed in to change notification settings - Fork 17
/
Connections.go
249 lines (223 loc) · 6.43 KB
/
Connections.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
package awsec2
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
// Manage the allowed network connections for constructs with Security Groups.
//
// Security Groups can be thought of as a firewall for network-connected
// devices. This class makes it easy to allow network connections to and
// from security groups, and between security groups individually. When
// establishing connectivity between security groups, it will automatically
// add rules in both security groups
//
// This object can manage one or more security groups.
//
// Example:
// // The code below shows an example of how to instantiate this type.
// // The values are placeholders you should change.
// import "github.com/aws/aws-cdk-go/awscdk"
//
// var peer iPeer
// var port port
// var securityGroup securityGroup
//
// connections := awscdk.Aws_ec2.NewConnections(&ConnectionsProps{
// DefaultPort: port,
// Peer: peer,
// SecurityGroups: []iSecurityGroup{
// securityGroup,
// },
// })
//
type Connections interface {
IConnectable
// The network connections associated with this resource.
Connections() Connections
// The default port configured for this connection peer, if available.
DefaultPort() Port
SecurityGroups() *[]ISecurityGroup
// Add a security group to the list of security groups managed by this object.
AddSecurityGroup(securityGroups ...ISecurityGroup)
// Allow connections from the peer on our default port.
//
// Even if the peer has a default port, we will always use our default port.
AllowDefaultPortFrom(other IConnectable, description *string)
// Allow default connections from all IPv4 ranges.
AllowDefaultPortFromAnyIpv4(description *string)
// Allow hosts inside the security group to connect to each other.
AllowDefaultPortInternally(description *string)
// Allow connections from the peer on our default port.
//
// Even if the peer has a default port, we will always use our default port.
AllowDefaultPortTo(other IConnectable, description *string)
// Allow connections from the peer on the given port.
AllowFrom(other IConnectable, portRange Port, description *string)
// Allow from any IPv4 ranges.
AllowFromAnyIpv4(portRange Port, description *string)
// Allow hosts inside the security group to connect to each other on the given port.
AllowInternally(portRange Port, description *string)
// Allow connections to the peer on the given port.
AllowTo(other IConnectable, portRange Port, description *string)
// Allow to all IPv4 ranges.
AllowToAnyIpv4(portRange Port, description *string)
// Allow connections to the security group on their default port.
AllowToDefaultPort(other IConnectable, description *string)
}
// The jsii proxy struct for Connections
type jsiiProxy_Connections struct {
jsiiProxy_IConnectable
}
func (j *jsiiProxy_Connections) Connections() Connections {
var returns Connections
_jsii_.Get(
j,
"connections",
&returns,
)
return returns
}
func (j *jsiiProxy_Connections) DefaultPort() Port {
var returns Port
_jsii_.Get(
j,
"defaultPort",
&returns,
)
return returns
}
func (j *jsiiProxy_Connections) SecurityGroups() *[]ISecurityGroup {
var returns *[]ISecurityGroup
_jsii_.Get(
j,
"securityGroups",
&returns,
)
return returns
}
func NewConnections(props *ConnectionsProps) Connections {
_init_.Initialize()
if err := validateNewConnectionsParameters(props); err != nil {
panic(err)
}
j := jsiiProxy_Connections{}
_jsii_.Create(
"aws-cdk-lib.aws_ec2.Connections",
[]interface{}{props},
&j,
)
return &j
}
func NewConnections_Override(c Connections, props *ConnectionsProps) {
_init_.Initialize()
_jsii_.Create(
"aws-cdk-lib.aws_ec2.Connections",
[]interface{}{props},
c,
)
}
func (c *jsiiProxy_Connections) AddSecurityGroup(securityGroups ...ISecurityGroup) {
args := []interface{}{}
for _, a := range securityGroups {
args = append(args, a)
}
_jsii_.InvokeVoid(
c,
"addSecurityGroup",
args,
)
}
func (c *jsiiProxy_Connections) AllowDefaultPortFrom(other IConnectable, description *string) {
if err := c.validateAllowDefaultPortFromParameters(other); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
c,
"allowDefaultPortFrom",
[]interface{}{other, description},
)
}
func (c *jsiiProxy_Connections) AllowDefaultPortFromAnyIpv4(description *string) {
_jsii_.InvokeVoid(
c,
"allowDefaultPortFromAnyIpv4",
[]interface{}{description},
)
}
func (c *jsiiProxy_Connections) AllowDefaultPortInternally(description *string) {
_jsii_.InvokeVoid(
c,
"allowDefaultPortInternally",
[]interface{}{description},
)
}
func (c *jsiiProxy_Connections) AllowDefaultPortTo(other IConnectable, description *string) {
if err := c.validateAllowDefaultPortToParameters(other); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
c,
"allowDefaultPortTo",
[]interface{}{other, description},
)
}
func (c *jsiiProxy_Connections) AllowFrom(other IConnectable, portRange Port, description *string) {
if err := c.validateAllowFromParameters(other, portRange); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
c,
"allowFrom",
[]interface{}{other, portRange, description},
)
}
func (c *jsiiProxy_Connections) AllowFromAnyIpv4(portRange Port, description *string) {
if err := c.validateAllowFromAnyIpv4Parameters(portRange); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
c,
"allowFromAnyIpv4",
[]interface{}{portRange, description},
)
}
func (c *jsiiProxy_Connections) AllowInternally(portRange Port, description *string) {
if err := c.validateAllowInternallyParameters(portRange); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
c,
"allowInternally",
[]interface{}{portRange, description},
)
}
func (c *jsiiProxy_Connections) AllowTo(other IConnectable, portRange Port, description *string) {
if err := c.validateAllowToParameters(other, portRange); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
c,
"allowTo",
[]interface{}{other, portRange, description},
)
}
func (c *jsiiProxy_Connections) AllowToAnyIpv4(portRange Port, description *string) {
if err := c.validateAllowToAnyIpv4Parameters(portRange); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
c,
"allowToAnyIpv4",
[]interface{}{portRange, description},
)
}
func (c *jsiiProxy_Connections) AllowToDefaultPort(other IConnectable, description *string) {
if err := c.validateAllowToDefaultPortParameters(other); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
c,
"allowToDefaultPort",
[]interface{}{other, description},
)
}