Skip to content

Commit 05ab82a

Browse files
committed
updated ancla dependency
1 parent 50b64af commit 05ab82a

File tree

7 files changed

+23
-22
lines changed

7 files changed

+23
-22
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/xmidt-org/wrp-go/v3 v3.2.3
2626
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.46.1
2727
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1
28-
go.uber.org/fx v1.22.0
28+
go.uber.org/fx v1.22.1
2929
go.uber.org/zap v1.27.0
3030
gopkg.in/dealancer/validate.v2 v2.1.0
3131
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,8 +1851,8 @@ go.uber.org/fx v1.19.0/go.mod h1:bGK+AEy7XUwTBkqCsK/vDyFF0JJOA6X5KWpNC0e6qTA=
18511851
go.uber.org/fx v1.19.1/go.mod h1:bGK+AEy7XUwTBkqCsK/vDyFF0JJOA6X5KWpNC0e6qTA=
18521852
go.uber.org/fx v1.19.2/go.mod h1:43G1VcqSzbIv77y00p1DRAsyZS8WdzuYdhZXmEUkMyQ=
18531853
go.uber.org/fx v1.20.0/go.mod h1:qCUj0btiR3/JnanEr1TYEePfSw6o/4qYJscgvzQ5Ub0=
1854-
go.uber.org/fx v1.22.0 h1:pApUK7yL0OUHMd8vkunWSlLxZVFFk70jR2nKde8X2NM=
1855-
go.uber.org/fx v1.22.0/go.mod h1:HT2M7d7RHo+ebKGh9NRcrsrHHfpZ60nW3QRubMRfv48=
1854+
go.uber.org/fx v1.22.1 h1:nvvln7mwyT5s1q201YE29V/BFrGor6vMiDNpU/78Mys=
1855+
go.uber.org/fx v1.22.1/go.mod h1:HT2M7d7RHo+ebKGh9NRcrsrHHfpZ60nW3QRubMRfv48=
18561856
go.uber.org/goleak v0.10.0/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI=
18571857
go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
18581858
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=

internal/client/httpClient.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type HttpClientTimeout struct {
3535
// NetDialerTimeout is the net dialer timeout
3636
NetDialerTimeout time.Duration
3737
}
38+
3839
type metricWrapper struct {
3940
now func() time.Time
4041
queryLatency prometheus.ObserverVec

internal/sink/matcher.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ func NewMatcher(l ancla.Register, logger *zap.Logger) (Matcher, error) {
6868
func (m1 *MatcherV1) update(l ancla.RegistryV1) error {
6969

7070
//TODO: don't believe the logger for webhook is being set anywhere just yet
71-
m1.logger = m1.logger.With(zap.String("webhook.address", l.Webhook.Address))
71+
m1.logger = m1.logger.With(zap.String("webhook.address", l.Registration.Address))
7272

73-
if l.Webhook.FailureURL != "" {
74-
_, err := url.ParseRequestURI(l.Webhook.FailureURL)
73+
if l.Registration.FailureURL != "" {
74+
_, err := url.ParseRequestURI(l.Registration.FailureURL)
7575
return err
7676
}
7777

7878
var events []*regexp.Regexp
79-
for _, event := range l.Webhook.Events {
79+
for _, event := range l.Registration.Events {
8080
var re *regexp.Regexp
8181
re, err := regexp.Compile(event)
8282
if err != nil {
@@ -90,7 +90,7 @@ func (m1 *MatcherV1) update(l ancla.RegistryV1) error {
9090
}
9191

9292
var matcher []*regexp.Regexp
93-
for _, item := range l.Webhook.Matcher.DeviceID {
93+
for _, item := range l.Registration.Matcher.DeviceID {
9494
if item == ".*" {
9595
// Match everything - skip the filtering
9696
matcher = []*regexp.Regexp{}
@@ -106,11 +106,11 @@ func (m1 *MatcherV1) update(l ancla.RegistryV1) error {
106106
}
107107

108108
// Validate the various urls
109-
urlCount := len(l.Webhook.Config.AlternativeURLs)
109+
urlCount := len(l.Registration.Config.AlternativeURLs)
110110
for i := 0; i < urlCount; i++ {
111-
_, err := url.Parse(l.Webhook.Config.AlternativeURLs[i])
111+
_, err := url.Parse(l.Registration.Config.AlternativeURLs[i])
112112
if err != nil {
113-
m1.logger.Error("failed to update url", zap.Any(metrics.UrlLabel, l.Webhook.Config.AlternativeURLs[i]), zap.Error(err))
113+
m1.logger.Error("failed to update url", zap.Any(metrics.UrlLabel, l.Registration.Config.AlternativeURLs[i]), zap.Error(err))
114114
return err
115115
}
116116
}
@@ -129,11 +129,11 @@ func (m1 *MatcherV1) update(l ancla.RegistryV1) error {
129129

130130
if urlCount == 0 {
131131
m1.urls = ring.New(1)
132-
m1.urls.Value = l.Webhook.Config.ReceiverURL
132+
m1.urls.Value = l.Registration.Config.ReceiverURL
133133
} else {
134134
ring := ring.New(urlCount)
135135
for i := 0; i < urlCount; i++ {
136-
ring.Value = l.Webhook.Config.AlternativeURLs[i]
136+
ring.Value = l.Registration.Config.AlternativeURLs[i]
137137
ring = ring.Next()
138138
}
139139
m1.urls = ring

internal/sink/matcher_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func TestUpdate_MatcherV1(t *testing.T) {
108108
description: "success - with device id",
109109
matcher: matcher,
110110
registry: ancla.RegistryV1{
111-
Webhook: webhook.RegistrationV1{
111+
Registration: webhook.RegistrationV1{
112112
Events: []string{"iot"},
113113
Matcher: webhook.MetadataMatcherConfig{
114114
DeviceID: []string{"mac:112233445566"},
@@ -124,7 +124,7 @@ func TestUpdate_MatcherV1(t *testing.T) {
124124
description: "success - with .* device id",
125125
matcher: matcher,
126126
registry: ancla.RegistryV1{
127-
Webhook: webhook.RegistrationV1{
127+
Registration: webhook.RegistrationV1{
128128
Events: []string{"iot"},
129129
Matcher: webhook.MetadataMatcherConfig{
130130
DeviceID: []string{"mac:112233445566", ".*"},
@@ -140,7 +140,7 @@ func TestUpdate_MatcherV1(t *testing.T) {
140140
description: "failing failureURL",
141141
matcher: matcher,
142142
registry: ancla.RegistryV1{
143-
Webhook: webhook.RegistrationV1{
143+
Registration: webhook.RegistrationV1{
144144
FailureURL: "localhost.io",
145145
},
146146
},
@@ -150,7 +150,7 @@ func TestUpdate_MatcherV1(t *testing.T) {
150150
description: "missing events",
151151
matcher: matcher,
152152
registry: ancla.RegistryV1{
153-
Webhook: webhook.RegistrationV1{
153+
Registration: webhook.RegistrationV1{
154154
Events: []string{},
155155
},
156156
},
@@ -180,7 +180,7 @@ func TestNewMatcher(t *testing.T) {
180180
description: "RegistryV1 - success",
181181
registry: &ancla.RegistryV1{
182182
PartnerIDs: []string{"comcast"},
183-
Webhook: webhook.RegistrationV1{
183+
Registration: webhook.RegistrationV1{
184184
Address: "www.example.com",
185185
Events: []string{"event1", "event2"},
186186
},
@@ -190,7 +190,7 @@ func TestNewMatcher(t *testing.T) {
190190
description: "RegistryV1 - fail",
191191
registry: &ancla.RegistryV1{
192192
PartnerIDs: []string{"comcast"},
193-
Webhook: webhook.RegistrationV1{
193+
Registration: webhook.RegistrationV1{
194194
Address: "www.example.com",
195195
},
196196
},

internal/sink/sinkSender.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ func getPartnerIds(l ancla.Register) ([]string, error) {
482482
func hideSecret(l ancla.Register) {
483483
switch v := l.(type) {
484484
case *ancla.RegistryV1:
485-
v.Webhook.Config.Secret = "XxxxxX"
485+
v.Registration.Config.Secret = "XxxxxX"
486486
case *ancla.RegistryV2:
487487
for i := range v.Registration.Webhooks {
488488
v.Registration.Webhooks[i].Secret = "XxxxxX"

internal/sink/sink_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestNewSink(t *testing.T) {
2121
{
2222
description: "RegistryV1 - success",
2323
listener: &ancla.RegistryV1{
24-
Webhook: webhook.RegistrationV1{
24+
Registration: webhook.RegistrationV1{
2525
Config: webhook.DeliveryConfig{
2626
ReceiverURL: "www.example.com",
2727
},
@@ -55,7 +55,7 @@ func TestNewSink(t *testing.T) {
5555

5656
func TestUpdateSink(t *testing.T) {
5757
listener := &ancla.RegistryV1{
58-
Webhook: webhook.RegistrationV1{
58+
Registration: webhook.RegistrationV1{
5959
Config: webhook.DeliveryConfig{
6060
ReceiverURL: "www.example.com",
6161
},

0 commit comments

Comments
 (0)