github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/api/client/backups/create.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package backups
     5  
     6  import (
     7  	"github.com/juju/errors"
     8  
     9  	"github.com/juju/juju/rpc/params"
    10  )
    11  
    12  // Create sends a request to create a backup of juju's state.  It
    13  // returns the metadata associated with the resulting backup and a
    14  // filename for download.
    15  func (c *Client) Create(notes string, noDownload bool) (*params.BackupsMetadataResult, error) {
    16  	var result params.BackupsMetadataResult
    17  	args := params.BackupsCreateArgs{
    18  		Notes:      notes,
    19  		NoDownload: noDownload,
    20  	}
    21  
    22  	if err := c.facade.FacadeCall("Create", args, &result); err != nil {
    23  		return nil, errors.Trace(err)
    24  	}
    25  
    26  	return &result, nil
    27  }