Skip to content
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

feat: WebhookConfig #4

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
bc4c4db
feat: introduce `WebhookConfig`
denopink Jan 11, 2024
41b7f59
chore: update to WebhookConfig
denopink Jan 11, 2024
c40ff21
Update webhook.go
denopink Jan 11, 2024
ec3e73a
Update webhook.go
denopink Jan 12, 2024
604fa5a
Update webhook.go
denopink Jan 16, 2024
375a0a7
Update webhook.go
denopink Jan 16, 2024
4a4875f
Update webhook.go
denopink Jan 17, 2024
879a57e
Update webhook.go
denopink Jan 26, 2024
aea7b5b
chore(deps): bump xmidt-org/shared-go from 4.1.0 to 4.2.0 (#5)
dependabot[bot] Jan 18, 2024
4cf5ed4
chore(deps): bump xmidt-org/shared-go from 4.2.0 to 4.2.2 (#6)
dependabot[bot] Jan 19, 2024
99b9e0a
feat(deps): bump github.com/xmidt-org/urlegit from 0.1.0 to 0.1.1 (#7)
dependabot[bot] Jan 19, 2024
c213980
added structure for retry hints
maurafortino Feb 6, 2024
3285ed0
removed the retryhint struct from registration v2 and updated a comment
maurafortino Feb 6, 2024
43b25b1
Merge pull request #9 from xmidt-org/maurafortino/feat/retryhint
denopink Feb 8, 2024
d0621ca
Update webhook.go
denopink Feb 20, 2024
e6d8933
added register interface and updated validate function
maurafortino May 2, 2024
209f020
moved validation from ancla to webhook and added multi-err functionality
maurafortino May 16, 2024
1085b01
commenting out nowFunc for now
maurafortino May 16, 2024
47ea530
removed GetPartnerIds from register and added alwaysvalid as an optio…
maurafortino May 16, 2024
58b841f
added validation file and moved build validators from ancla to this p…
maurafortino May 28, 2024
1bca26e
added validation for until
maurafortino May 29, 2024
d30c20f
added back in nowFunc to registrationv1 and added validation for it
maurafortino May 29, 2024
8cd8302
updatedthe until option validation
maurafortino May 29, 2024
424691f
Merge pull request #16 from xmidt-org/edits-v2
maurafortino Jun 27, 2024
9b8a7ac
validation remaining the same for RegistrationV1; adding in validatio…
maurafortino Jun 28, 2024
b11e74f
added in more validation for RegistrationV2 and updated run_tests
maurafortino Jun 28, 2024
56c9dd9
added test cases for registrationV2 and default cases
maurafortino Jul 1, 2024
9564e84
Revert "Update webhook.go"
maurafortino Jul 1, 2024
dda637f
Revert "Revert "Update webhook.go""
maurafortino Jul 1, 2024
2e1fc04
Revert "updatedthe until option validation"
maurafortino Jul 1, 2024
491ef4b
Revert "added back in nowFunc to registrationv1 and added validation …
maurafortino Jul 1, 2024
101193c
fixed merge issues
maurafortino Jul 1, 2024
5a7e41c
added tests for AlwaysValid option
maurafortino Jul 1, 2024
90baaab
removing the register interface from webhook-schema and moving it to …
maurafortino Jul 2, 2024
e317ca8
added back in the url validation logic that was originally in ancla
maurafortino Jul 3, 2024
316cfea
this is an option for how we can set up the Validation Options
maurafortino Jul 3, 2024
d343c39
added back in the struct methods to clean up code; removed the generi…
maurafortino Jul 8, 2024
84187f4
added back in BuildValidators as I am going to be editing in a future PR
maurafortino Jul 8, 2024
c1be827
moved specialuseips back to original spot
maurafortino Jul 8, 2024
2eb87c9
fixed spacing
maurafortino Jul 8, 2024
2d66130
fixed merge conflicts
maurafortino Jul 8, 2024
6ecbde7
fixed merge conflicts i missed
maurafortino Jul 8, 2024
638f3d4
fixed spacing
maurafortino Jul 9, 2024
358b295
Merge branch 'validation-v3' into draft-options-config
maurafortino Jul 9, 2024
9947a7d
updated tests
maurafortino Jul 9, 2024
9e6e62d
returning error for v2 deviceidregexmustcompile and updated unit test
maurafortino Jul 9, 2024
556f139
removed validation config as that
maurafortino Jul 10, 2024
8d55e4c
fixed formatting issues
maurafortino Jul 11, 2024
0ee06ff
Merge pull request #36 from xmidt-org/validation-v3
maurafortino Jul 11, 2024
ffe3451
added the CheckUntil function from ancla
maurafortino Jul 17, 2024
b8c1ba1
Merge pull request #47 from xmidt-org/draft-options-config
maurafortino Jul 18, 2024
e5cae31
chore: update based on pr feedback
denopink Oct 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ report.json
# VSCode
*.code-workspace
.vscode/*
.dev/*
39 changes: 39 additions & 0 deletions webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var (
ErrInvalidInput = fmt.Errorf("invalid input")
)

// Deprecated: This substructure should only be used for backwards compatibility
// matching. Use WebhookConfig instead.
// DeliveryConfig is a Webhook substructure with data related to event delivery.
type DeliveryConfig struct {
// URL is the HTTP URL to deliver messages to.
Expand All @@ -28,6 +30,43 @@ type DeliveryConfig struct {
AlternativeURLs []string `json:"alt_urls,omitempty"`
}

// WebhookConfig is a Webhook substructure with data related to event delivery.
denopink marked this conversation as resolved.
Show resolved Hide resolved
type WebhookConfig struct {
// Accept is content type of outgoing events. The following content types are supported, otherwise
// a 406 response code is returned: application/octet-stream, application/jsonl, application/msgpack.
denopink marked this conversation as resolved.
Show resolved Hide resolved
Accept string `json:"accept"`
denopink marked this conversation as resolved.
Show resolved Hide resolved

denopink marked this conversation as resolved.
Show resolved Hide resolved
// Secret is the string value.
// (Optional, set to "" to disable behavior).
Secret string `json:"secret,omitempty"`

// SecretHash is the hash algorithm to be used. Only sha256 HMAC and sha512 HMAC are supported.
// (Optional).
// The Default value is the sha512 HMAC.
denopink marked this conversation as resolved.
Show resolved Hide resolved
SecretHash string `json:"secret_hash"`

// BatchHints is the substructure for configuration related to event batching.
// (Optional, if omited then batches of singal events will be sent)
// Default value will disable batch. All zeros will also disable batch.
BatchHints struct {
// MaxLingerDuration is the maximum delay for batching if MaxMesasges has not been reached.
// Default value will set no maximum value.
MaxLingerDuration time.Duration `json:"max_linger_duration"`
// MaxMesasges is the maximum number of events that will be sent in a single batch.
// Default value will set no maximum value.
MaxMesasges int `json:"max_messages"`
} `json:"batch_hints"`

denopink marked this conversation as resolved.
Show resolved Hide resolved
// DNSSrvRecord is the substructure for configuration related to load balancing.
DNSSrvRecord struct {
// FQDNs is a list of FQDNs pointing to dns srv records
FQDNs []string `json:"fqdns"`
// LoadBalancingScheme is the scheme to use for load balancing. Either the
// srv record attribute `weight` or `priortiy` can be used.
LoadBalancingScheme string `json:"load_balancing_scheme"`
} `json:"dns_srv_record"`
denopink marked this conversation as resolved.
Show resolved Hide resolved
}

// 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.
Expand Down