Skip to content

Commit

Permalink
struct metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Ignatev committed Jan 18, 2023
1 parent 3258a68 commit 8975b90
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions cmd/bpdispatcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ type Webhook struct {
Namespace string `json:"namespace"`
UID string `json:"uid"`
} `json:"involvedObject"`
Metadata map[string]string `json:"metadata"`
Severity string `json:"severity"`
Reason string `json:"reason"`
Message string `json:"message"`
ReportingController string `json:"reportingController"`
ReportingInstance string `json:"reportingInstance"`
Timestamp string `json:"timestamp"`
Metadata struct {
Revision string `json:"revision"`
Summary string `json:"summary"`
} `json:"metadata"`
Severity string `json:"severity"`
Reason string `json:"reason"`
Message string `json:"message"`
ReportingController string `json:"reportingController"`
ReportingInstance string `json:"reportingInstance"`
Timestamp string `json:"timestamp"`
}

func handleWebhook(w http.ResponseWriter, r *http.Request) {
Expand All @@ -51,7 +54,8 @@ func handleWebhook(w http.ResponseWriter, r *http.Request) {
fmt.Println("Kind:", data.InvolvedObject.Kind)
fmt.Println("Name:", data.InvolvedObject.Name)
fmt.Println("Namespace:", data.InvolvedObject.Namespace)
fmt.Println("Metadata:", data.Metadata)
fmt.Println("Revision:", data.Metadata.Revision)
fmt.Println("Summary:", data.Metadata.Summary)
fmt.Println("Severity:", data.Severity)
fmt.Println("Reason:", data.Reason)
fmt.Println("Message:", data.Message)
Expand Down

0 comments on commit 8975b90

Please sign in to comment.