-
Notifications
You must be signed in to change notification settings - Fork 46
/
listener.go
43 lines (35 loc) · 1.04 KB
/
listener.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
package lattice
import (
"github.com/aws/aws-application-networking-k8s/pkg/model/core"
)
type Listener struct {
core.ResourceMeta `json:"-"`
Spec ListenerSpec `json:"spec"`
Status *ListenerStatus `json:"status,omitempty"`
}
type ListenerSpec struct {
StackServiceId string `json:"stackserviceid"`
K8SRouteName string `json:"k8sroutename"`
K8SRouteNamespace string `json:"k8sroutenamespace"`
Port int64 `json:"port"`
Protocol string `json:"protocol"`
}
type ListenerStatus struct {
Name string `json:"name"`
ListenerArn string `json:"listenerarn"`
Id string `json:"listenerid"`
ServiceId string `json:"serviceid"`
}
func NewListener(stack core.Stack, spec ListenerSpec) (*Listener, error) {
id, err := core.IdFromHash(spec)
if err != nil {
return nil, err
}
listener := &Listener{
ResourceMeta: core.NewResourceMeta(stack, "AWS::VPCServiceNetwork::Listener", id),
Spec: spec,
Status: nil,
}
stack.AddResource(listener)
return listener, nil
}