github.com/kyma-incubator/compass/components/director@v0.0.0-20230623144113-d764f56ff805/internal/domain/application/config.go (about)

     1  package application
     2  
     3  import (
     4  	"encoding/json"
     5  )
     6  
     7  // ORDWebhookMapping represents a struct for ORD Webhook Mappings
     8  type ORDWebhookMapping struct {
     9  	Type                string   `json:"Type"`
    10  	PpmsProductVersions []string `json:"PpmsProductVersions"`
    11  	OrdURLPath          string   `json:"OrdUrlPath"`
    12  	SubdomainSuffix     string   `json:"SubdomainSuffix"`
    13  }
    14  
    15  // UnmarshalMappings unmarshalls a string into []ORDWebhookMapping. This is done because of limitation of the envconfig library
    16  func UnmarshalMappings(mappingsConfig string) ([]ORDWebhookMapping, error) {
    17  	var mappings []ORDWebhookMapping
    18  	if err := json.Unmarshal([]byte(mappingsConfig), &mappings); err != nil {
    19  		return nil, err
    20  	}
    21  
    22  	return mappings, nil
    23  }