-
Notifications
You must be signed in to change notification settings - Fork 17
/
awsec2_NatProvider.go
136 lines (118 loc) · 3.25 KB
/
awsec2_NatProvider.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
package awsec2
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
// NAT providers.
//
// Determines what type of NAT provider to create, either NAT gateways or NAT
// instance.
//
// Example:
// // Configure the `natGatewayProvider` when defining a Vpc
// natGatewayProvider := ec2.natProvider.instance(&natInstanceProps{
// instanceType: ec2.NewInstanceType(jsii.String("t3.small")),
// })
//
// vpc := ec2.NewVpc(this, jsii.String("MyVpc"), &vpcProps{
// natGatewayProvider: natGatewayProvider,
//
// // The 'natGateways' parameter now controls the number of NAT instances
// natGateways: jsii.Number(2),
// })
//
type NatProvider interface {
// Return list of gateways spawned by the provider.
ConfiguredGateways() *[]*GatewayConfig
// Called by the VPC to configure NAT.
//
// Don't call this directly, the VPC will call it automatically.
ConfigureNat(options *ConfigureNatOptions)
// Configures subnet with the gateway.
//
// Don't call this directly, the VPC will call it automatically.
ConfigureSubnet(subnet PrivateSubnet)
}
// The jsii proxy struct for NatProvider
type jsiiProxy_NatProvider struct {
_ byte // padding
}
func (j *jsiiProxy_NatProvider) ConfiguredGateways() *[]*GatewayConfig {
var returns *[]*GatewayConfig
_jsii_.Get(
j,
"configuredGateways",
&returns,
)
return returns
}
func NewNatProvider_Override(n NatProvider) {
_init_.Initialize()
_jsii_.Create(
"aws-cdk-lib.aws_ec2.NatProvider",
nil, // no parameters
n,
)
}
// Use NAT Gateways to provide NAT services for your VPC.
//
// NAT gateways are managed by AWS.
// See: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html
//
func NatProvider_Gateway(props *NatGatewayProps) NatProvider {
_init_.Initialize()
if err := validateNatProvider_GatewayParameters(props); err != nil {
panic(err)
}
var returns NatProvider
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_ec2.NatProvider",
"gateway",
[]interface{}{props},
&returns,
)
return returns
}
// Use NAT instances to provide NAT services for your VPC.
//
// NAT instances are managed by you, but in return allow more configuration.
//
// Be aware that instances created using this provider will not be
// automatically replaced if they are stopped for any reason. You should implement
// your own NatProvider based on AutoScaling groups if you need that.
// See: https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html
//
func NatProvider_Instance(props *NatInstanceProps) NatInstanceProvider {
_init_.Initialize()
if err := validateNatProvider_InstanceParameters(props); err != nil {
panic(err)
}
var returns NatInstanceProvider
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_ec2.NatProvider",
"instance",
[]interface{}{props},
&returns,
)
return returns
}
func (n *jsiiProxy_NatProvider) ConfigureNat(options *ConfigureNatOptions) {
if err := n.validateConfigureNatParameters(options); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
n,
"configureNat",
[]interface{}{options},
)
}
func (n *jsiiProxy_NatProvider) ConfigureSubnet(subnet PrivateSubnet) {
if err := n.validateConfigureSubnetParameters(subnet); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
n,
"configureSubnet",
[]interface{}{subnet},
)
}