github.com/kyma-incubator/compass/components/director@v0.0.0-20230623144113-d764f56ff805/pkg/webhook/application_lifecycle.go (about)

     1  package webhook
     2  
     3  import (
     4  	"encoding/json"
     5  	"net/http"
     6  )
     7  
     8  // Resource is used to identify entities which can be part of a webhook's request data
     9  type Resource interface {
    10  	Sentinel()
    11  }
    12  
    13  // ApplicationLifecycleWebhookRequestObject struct contains parts of request that might be needed for later processing of a Webhook request
    14  type ApplicationLifecycleWebhookRequestObject struct {
    15  	Application Resource
    16  	TenantID    string
    17  	Headers     map[string]string
    18  }
    19  
    20  // ParseURLTemplate missing godoc
    21  func (rd *ApplicationLifecycleWebhookRequestObject) ParseURLTemplate(tmpl *string) (*URL, error) {
    22  	var url URL
    23  	return &url, parseTemplate(tmpl, *rd, &url)
    24  }
    25  
    26  // ParseInputTemplate missing godoc
    27  func (rd *ApplicationLifecycleWebhookRequestObject) ParseInputTemplate(tmpl *string) ([]byte, error) {
    28  	res := json.RawMessage{}
    29  	return res, parseTemplate(tmpl, *rd, &res)
    30  }
    31  
    32  // ParseHeadersTemplate missing godoc
    33  func (rd *ApplicationLifecycleWebhookRequestObject) ParseHeadersTemplate(tmpl *string) (http.Header, error) {
    34  	var headers http.Header
    35  	return headers, parseTemplate(tmpl, *rd, &headers)
    36  }