MCPcopy Index your code
hub / github.com/docker/cli / Secrets

Function Secrets

cli/compose/convert/compose.go:106–138  ·  view source on GitHub ↗

Secrets converts secrets from the Compose type to the engine API type

(namespace Namespace, secrets map[string]composetypes.SecretConfig)

Source from the content-addressed store, hash-verified

104
105// Secrets converts secrets from the Compose type to the engine API type
106func Secrets(namespace Namespace, secrets map[string]composetypes.SecretConfig) ([]swarm.SecretSpec, error) {
107 result := []swarm.SecretSpec{}
108 for name, secret := range secrets {
109 if secret.External.External {
110 continue
111 }
112
113 var obj swarmFileObject
114 var err error
115 if secret.Driver != "" {
116 obj = driverObjectConfig(namespace, name, composetypes.FileObjectConfig(secret))
117 } else {
118 obj, err = fileObjectConfig(namespace, name, composetypes.FileObjectConfig(secret))
119 }
120 if err != nil {
121 return nil, err
122 }
123 spec := swarm.SecretSpec{Annotations: obj.Annotations, Data: obj.Data}
124 if secret.Driver != "" {
125 spec.Driver = &swarm.Driver{
126 Name: secret.Driver,
127 Options: secret.DriverOpts,
128 }
129 }
130 if secret.TemplateDriver != "" {
131 spec.Templating = &swarm.Driver{
132 Name: secret.TemplateDriver,
133 }
134 }
135 result = append(result, spec)
136 }
137 return result, nil
138}
139
140// Configs converts config objects from the Compose type to the engine API type
141func Configs(namespace Namespace, configs map[string]composetypes.ConfigObjConfig) ([]swarm.ConfigSpec, error) {

Callers 1

TestSecretsFunction · 0.85

Calls 2

driverObjectConfigFunction · 0.85
fileObjectConfigFunction · 0.85

Tested by 1

TestSecretsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…