MCPcopy Create free account
hub / github.com/devfile/api / validateEndpoints

Function validateEndpoints

pkg/validation/endpoints.go:26–34  ·  view source on GitHub ↗

validateEndpoints checks if 1. all the endpoint names are unique across components 2. endpoint port are unique across component containers ie; two component containers cannot have the same target port but two endpoints in a single component container can have the same target port

(endpoints []v1alpha2.Endpoint, processedEndPointPort map[int]bool, processedEndPointName map[string]bool)

Source from the content-addressed store, hash-verified

24// ie; two component containers cannot have the same target port but two endpoints
25// in a single component container can have the same target port
26func validateEndpoints(endpoints []v1alpha2.Endpoint, processedEndPointPort map[int]bool, processedEndPointName map[string]bool) (errList []error) {
27 currentComponentEndPointPort := make(map[int]bool)
28
29 errList = validateDuplicatedName(endpoints, processedEndPointName, currentComponentEndPointPort)
30 portErrorList := validateDuplicatedPort(processedEndPointPort, currentComponentEndPointPort)
31 errList = append(errList, portErrorList...)
32
33 return errList
34}
35
36func validateDuplicatedName(endpoints []v1alpha2.Endpoint, processedEndPointName map[string]bool, currentComponentEndPointPort map[int]bool) (errList []error) {
37 for _, endPoint := range endpoints {

Callers 2

ValidateComponentsFunction · 0.85
TestValidateEndpointsFunction · 0.85

Calls 2

validateDuplicatedNameFunction · 0.85
validateDuplicatedPortFunction · 0.85

Tested by 1

TestValidateEndpointsFunction · 0.68