MCPcopy Create free account
hub / github.com/docker/cli / convertEndpointSpec

Function convertEndpointSpec

cli/compose/convert/service.go:595–612  ·  view source on GitHub ↗
(endpointMode string, source []composetypes.ServicePortConfig)

Source from the content-addressed store, hash-verified

593}
594
595func convertEndpointSpec(endpointMode string, source []composetypes.ServicePortConfig) *swarm.EndpointSpec {
596 portConfigs := make([]swarm.PortConfig, 0, len(source))
597 for _, port := range source {
598 portConfigs = append(portConfigs, swarm.PortConfig{
599 Protocol: network.IPProtocol(port.Protocol),
600 TargetPort: port.Target,
601 PublishedPort: port.Published,
602 PublishMode: swarm.PortConfigPublishMode(port.Mode),
603 })
604 }
605
606 slices.SortFunc(portConfigs, swarm.PortConfig.Compare)
607
608 return &swarm.EndpointSpec{
609 Mode: swarm.ResolutionMode(strings.ToLower(endpointMode)),
610 Ports: portConfigs,
611 }
612}
613
614// convertEnvironment converts key/value mappings to a slice, and sorts
615// the results.

Callers 2

TestConvertEndpointSpecFunction · 0.85
ServiceFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestConvertEndpointSpecFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…