-
Notifications
You must be signed in to change notification settings - Fork 46
/
accesslogsubscription.go
50 lines (40 loc) · 1.25 KB
/
accesslogsubscription.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
package lattice
import (
"fmt"
"k8s.io/apimachinery/pkg/types"
"github.com/aws/aws-application-networking-k8s/pkg/aws"
"github.com/aws/aws-application-networking-k8s/pkg/model/core"
)
const AccessLogPolicyTagKey = aws.TagBase + "AccessLogPolicy"
type SourceType string
const (
ServiceNetworkSourceType SourceType = "ServiceNetwork"
ServiceSourceType SourceType = "Service"
)
type AccessLogSubscription struct {
core.ResourceMeta `json:"-"`
Spec AccessLogSubscriptionSpec `json:"spec"`
Status *AccessLogSubscriptionStatus `json:"status,omitempty"`
}
type AccessLogSubscriptionSpec struct {
SourceType SourceType
SourceName string
DestinationArn string
ALPNamespacedName types.NamespacedName
EventType core.EventType
}
type AccessLogSubscriptionStatus struct {
Arn string `json:"arn"`
}
func NewAccessLogSubscription(
stack core.Stack,
spec AccessLogSubscriptionSpec,
status *AccessLogSubscriptionStatus,
) *AccessLogSubscription {
id := fmt.Sprintf("%s-%s-%s", spec.SourceType, spec.SourceName, spec.DestinationArn)
return &AccessLogSubscription{
ResourceMeta: core.NewResourceMeta(stack, "AWS::VPCServiceNetwork::AccessLogSubscription", id),
Spec: spec,
Status: status,
}
}