package client

import (
	"context"

	"github.com/docker/docker/api/types/swarm"
	"github.com/docker/docker/client"
)

func StoreSecret(cl *client.Client, secretName, secretValue, server string) error {
	ann := swarm.Annotations{Name: secretName}
	spec := swarm.SecretSpec{Annotations: ann, Data: []byte(secretValue)}

	if _, err := cl.SecretCreate(context.Background(), spec); err != nil {
		return err
	}

	return nil
}
