refactor: use pkg directory structure

This commit is contained in:
2021-09-05 21:37:03 +02:00
parent f59380a35e
commit b7742d5e18
55 changed files with 55 additions and 55 deletions

25
pkg/client/secret.go Normal file
View File

@ -0,0 +1,25 @@
package client
import (
"context"
"github.com/docker/docker/api/types/swarm"
)
func StoreSecret(secretName, secretValue, server string) error {
cl, err := New(server)
if err != nil {
return err
}
ctx := context.Background()
ann := swarm.Annotations{Name: secretName}
spec := swarm.SecretSpec{Annotations: ann, Data: []byte(secretValue)}
// We don't bother with the secret IDs for now
if _, err := cl.SecretCreate(ctx, spec); err != nil {
return err
}
return nil
}