-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up #444
Clean up #444
Conversation
…imaryHandler_Test as primaryHandler will no longer be used
listenerStub.go
Outdated
package main | ||
|
||
import "time" | ||
|
||
//This is a stub for the ancla listener. This will be removed once we can add ancla back into caduceus | ||
|
||
type ListenerStub struct { | ||
PartnerIds []string | ||
Webhook Webhook | ||
} | ||
|
||
type Webhook struct { | ||
// Address is the subscription request origin HTTP Address. | ||
Address string `json:"registered_from_address"` | ||
|
||
// Config contains data to inform how events are delivered. | ||
Config DeliveryConfig `json:"config"` | ||
|
||
// FailureURL is the URL used to notify subscribers when they've been cut off due to event overflow. | ||
// Optional, set to "" to disable notifications. | ||
FailureURL string `json:"failure_url"` | ||
|
||
// Events is the list of regular expressions to match an event type against. | ||
Events []string `json:"events"` | ||
|
||
// Matcher type contains values to match against the metadata. | ||
Matcher MetadataMatcherConfig `json:"matcher,omitempty"` | ||
|
||
// Duration describes how long the subscription lasts once added. | ||
Duration time.Duration `json:"duration"` | ||
|
||
// Until describes the time this subscription expires. | ||
Until time.Time `json:"until"` | ||
} | ||
|
||
// DeliveryConfig is a Webhook substructure with data related to event delivery. | ||
type DeliveryConfig struct { | ||
// URL is the HTTP URL to deliver messages to. | ||
URL string `json:"url"` | ||
|
||
// ContentType is content type value to set WRP messages to (unless already specified in the WRP). | ||
ContentType string `json:"content_type"` | ||
|
||
// Secret is the string value for the SHA1 HMAC. | ||
// (Optional, set to "" to disable behavior). | ||
Secret string `json:"secret,omitempty"` | ||
|
||
// AlternativeURLs is a list of explicit URLs that should be round robin through on failure cases to the main URL. | ||
AlternativeURLs []string `json:"alt_urls,omitempty"` | ||
} | ||
|
||
// MetadataMatcherConfig is Webhook substructure with config to match event metadata. | ||
type MetadataMatcherConfig struct { | ||
// DeviceID is the list of regular expressions to match device id type against. | ||
DeviceID []string `json:"device_id"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is outdated, check https://github.com/xmidt-org/webhook-schema/pull/4/files#
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a few suggestion
looks like primaryHandler.go
's auth code (fetching jwks) will be re-introduced later
otherwise, great work! lgtm
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## denopink/feat/rewrite #444 +/- ##
========================================================
- Coverage 16.78% 7.99% -8.80%
========================================================
Files 12 12
Lines 1233 1214 -19
========================================================
- Hits 207 97 -110
- Misses 1014 1117 +103
+ Partials 12 0 -12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
/*TODO: need middleware for: | ||
Counter: obs.deliveryRetryCounter.With("url", obs.id, "event", event) | ||
Logger | ||
Update Request | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this is important to us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
at somepoint we'll need to replace viper as well
yeah it's basically gone at this point - it just exists in primaryHandler.go which isn't being used right now - just keeping it so it's easier for me to reference what's needed for bascule once we have new bascule. |
going to change the listener stub and add the middleware in in the v2 work |
What's Included:
should be reviewed/merged after merging #436