/
natgateway_types.go
124 lines (102 loc) · 4.56 KB
/
natgateway_types.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
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
)
// Defines the states of NatGateway
const (
NatGatewayStatusPending = "pending"
NatGatewayStatusFailed = "failed"
NatGatewayStatusAvailable = "available"
NatGatewayStatusDeleting = "deleting"
NatGatewayStatusDeleted = "deleted"
)
// NATGatewayParameters defined the desired state of an AWS VPC NAT Gateway
type NATGatewayParameters struct {
// TODO(muvaf): Region is a required field but in order to keep backward compatibility
// with old Provider type and not bear the cost of bumping to v1beta2, we're
// keeping it optional for now. Reconsider before v1beta2 or v1.
// Region is the region you'd like your NATGateway to be created in.
// +immutable
Region string `json:"region"`
// AllocationID is the Elastic IP allocation ID
// +immutable
// +optional
AllocationID *string `json:"allocationId,omitempty"`
// AllocationIDRef references an EIP and retrieves it's allocation id
// +immutable
// +optional
AllocationIDRef *xpv1.Reference `json:"allocationIdRef,omitempty"`
// AllocationIDSelector references an EIP by selector and retrieves it's allocation id
// +immutable
// +optional
AllocationIDSelector *xpv1.Selector `json:"allocationIdSelector,omitempty"`
// SubnetID is the subnet the NAT gateways needs to be associated to
// +immutable
// +optional
SubnetID *string `json:"subnetId,omitempty"`
// SubnetIDRef references a subnet and retrives it's subnet id
// +immutable
// +optional
SubnetIDRef *xpv1.Reference `json:"subnetIdRef,omitempty"`
// SubnetIDSelector references a subnet by selector and retrives it's subnet id
// +immutable
// +optional
SubnetIDSelector *xpv1.Selector `json:"subnetIdSelector,omitempty"`
// Tags represents to current ec2 tags.
// +optional
Tags []Tag `json:"tags,omitempty"`
}
// NATGatewaySpec defines the desired state of a NAT Gateway
type NATGatewaySpec struct {
xpv1.ResourceSpec `json:",inline"`
ForProvider NATGatewayParameters `json:"forProvider"`
}
// NATGatewayObservation keeps the state for the CR
type NATGatewayObservation struct {
CreateTime *metav1.Time `json:"createTime,omitempty"`
DeleteTime *metav1.Time `json:"deleteTime,omitempty"`
FailureCode string `json:"failureCode,omitempty"`
FailureMessage string `json:"failureMessage,omitempty"`
NatGatewayAddresses []NATGatewayAddress `json:"natGatewayAddresses,omitempty"`
NatGatewayID string `json:"natGatewayId,omitempty"`
State string `json:"state,omitempty"`
VpcID string `json:"vpcId,omitempty"`
}
// NATGatewayAddress describes the details of network
type NATGatewayAddress struct {
AllocationID string `json:"allocationId,omitempty"`
NetworkInterfaceID string `json:"networkInterfaceId,omitempty"`
PrivateIP string `json:"privateIp,omitempty"`
PublicIP string `json:"publicIp,omitempty"`
}
// NATGatewayStatus describes the observed state
type NATGatewayStatus struct {
xpv1.ResourceStatus `json:",inline"`
AtProvider NATGatewayObservation `json:"atProvider"`
}
// +kubebuilder:object:root=true
// A NATGateway is a managed resource that represents an AWS VPC NAT
// Gateway.
// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
// +kubebuilder:printcolumn:name="ID",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name"
// +kubebuilder:printcolumn:name="VPC",type="string",JSONPath=".status.atProvider.vpcId"
// +kubebuilder:printcolumn:name="SUBNET",type="string",JSONPath=".spec.forProvider.subnetId"
// +kubebuilder:printcolumn:name="ALLOCATION ID",type="string",JSONPath=".spec.forProvider.allocationId"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws}
type NATGateway struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec NATGatewaySpec `json:"spec"`
Status NATGatewayStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// NATGatewayList contains a list of NatGateways
type NATGatewayList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []NATGateway `json:"items"`
}