// This image shows received payload and send validation webhook.
This image shows received payload and send validation webhook.
// This image shows received payload and send validation webhook .
func display(event cloudevents.Event) {
	data := &dockerhub.BuildPayload{}
	if err := event.DataAs(data); err != nil {
		log.Printf("Got Data Error: %s\n", err.Error())
		return
	}
	log.Printf("Got Data: %+v\n", data)
	time.Sleep(time.Second * 5)
	if data.CallbackURL != "" {
		message := "Event has been sent successfully to the sink."
		callbackData := &resources.CallbackPayload{
			State:       resources.StatusSuccess,
			Description: message,
			Context:     "from sink display",
			TargetURL:   "",
		}
		err := callbackData.EmitValidationCallback(data.CallbackURL)
		if err != nil {
			log.Printf("failed to send validation callback: %v", err)
			os.Exit(1)
		} else {
			log.Printf("callback is sent from callback-display: %v", callbackData)
			os.Exit(0)
		}
	}
}
func display ( event cloudevents . Event ) { data := & dockerhub . BuildPayload { } if err := event . DataAs ( data ) ; err != nil { log . Printf ( " \n " , err . Error ( ) ) return } log . Printf ( " \n " , data ) time . Sleep ( time . Second * 5 ) if data . CallbackURL != " " { message := " " callbackData := & resources . CallbackPayload { State : resources . StatusSuccess , Description : message , Context : " " , TargetURL : " " , } err := callbackData . EmitValidationCallback ( data . CallbackURL ) if err != nil { log . Printf ( " " , err ) os . Exit ( 1 ) } else { log . Printf ( " " , callbackData ) os . Exit ( 0 ) } } }
This image shows received payload and send validation webhook.
This image shows received payload and send validation webhook .
// ensure RA finished processing incoming webhook. // if RA send validation webhook behalf, operation below should fail.