github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/client/secret_update.go (about)

     1  package client // import "github.com/Prakhar-Agarwal-byte/moby/client"
     2  
     3  import (
     4  	"context"
     5  	"net/url"
     6  
     7  	"github.com/Prakhar-Agarwal-byte/moby/api/types/swarm"
     8  )
     9  
    10  // SecretUpdate attempts to update a secret.
    11  func (cli *Client) SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error {
    12  	if err := cli.NewVersionError(ctx, "1.25", "secret update"); err != nil {
    13  		return err
    14  	}
    15  	query := url.Values{}
    16  	query.Set("version", version.String())
    17  	resp, err := cli.post(ctx, "/secrets/"+id+"/update", query, secret, nil)
    18  	ensureReaderClosed(resp)
    19  	return err
    20  }