Skip to content

Commit

Permalink
fix: return webhook invoke URL in API
Browse files Browse the repository at this point in the history
Signed-off-by: Donnie Adams <[email protected]>
  • Loading branch information
thedadams committed Nov 20, 2024
1 parent 9fe9d65 commit 9d30f07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
8 changes: 6 additions & 2 deletions pkg/api/handlers/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,12 @@ func (a *WebhookHandler) Create(req api.Context) error {

func convertWebhook(webhook v1.Webhook, urlPrefix string) *types.Webhook {
var links []string
if urlPrefix != "" && webhook.Status.Alias != "" {
links = []string{"invoke", fmt.Sprintf("%s/webhooks/%s", urlPrefix, webhook.Status.Alias)}
if urlPrefix != "" {
path := webhook.Name
if webhook.Status.AliasAssigned {
path = webhook.Spec.Alias
}
links = []string{"invoke", fmt.Sprintf("%s/webhooks/%s", urlPrefix, path)}
}

manifest := webhook.Spec.WebhookManifest
Expand Down
1 change: 0 additions & 1 deletion pkg/storage/apis/otto.otto8.ai/v1/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ type WebhookSpec struct {
}

type WebhookStatus struct {
Alias string `json:"alias,omitempty"`
AliasAssigned bool `json:"aliasAssigned,omitempty"`
LastSuccessfulRunCompleted *metav1.Time `json:"lastSuccessfulRunCompleted,omitempty"`
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/storage/openapi/generated/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9d30f07

Please sign in to comment.