Services from compose-file types to engine API types
( ctx context.Context, namespace Namespace, config *composetypes.Config, apiClient client.APIClient, )
| 32 | |
| 33 | // Services from compose-file types to engine API types |
| 34 | func Services( |
| 35 | ctx context.Context, |
| 36 | namespace Namespace, |
| 37 | config *composetypes.Config, |
| 38 | apiClient client.APIClient, |
| 39 | ) (map[string]swarm.ServiceSpec, error) { |
| 40 | result := make(map[string]swarm.ServiceSpec) |
| 41 | for _, service := range config.Services { |
| 42 | secrets, err := convertServiceSecrets(ctx, apiClient, namespace, service.Secrets, config.Secrets) |
| 43 | if err != nil { |
| 44 | return nil, fmt.Errorf("service %s: %w", service.Name, err) |
| 45 | } |
| 46 | configs, err := convertServiceConfigObjs(ctx, apiClient, namespace, service, config.Configs) |
| 47 | if err != nil { |
| 48 | return nil, fmt.Errorf("service %s: %w", service.Name, err) |
| 49 | } |
| 50 | |
| 51 | serviceSpec, err := Service(namespace, service, config.Networks, config.Volumes, secrets, configs) |
| 52 | if err != nil { |
| 53 | return nil, fmt.Errorf("service %s: %w", service.Name, err) |
| 54 | } |
| 55 | result[service.Name] = serviceSpec |
| 56 | } |
| 57 | |
| 58 | return result, nil |
| 59 | } |
| 60 | |
| 61 | // Service converts a ServiceConfig into a swarm ServiceSpec |
| 62 | func Service( |
nothing calls this directly
no test coverage detected
searching dependent graphs…