~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/resource/resourceadapters/deploy.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
        "github.com/juju/juju/resource/cmd"
17
17
)
18
18
 
 
19
// DeployResourcesFunc is the function type of DeployResources.
 
20
type DeployResourcesFunc func(
 
21
        applicationID string,
 
22
        chID charmstore.CharmID,
 
23
        csMac *macaroon.Macaroon,
 
24
        filesAndRevisions map[string]string,
 
25
        resources map[string]charmresource.Meta,
 
26
        conn base.APICallCloser,
 
27
) (ids map[string]string, err error)
 
28
 
19
29
// DeployResources uploads the bytes for the given files to the server and
20
30
// creates pending resource metadata for the all resource mentioned in the
21
31
// metadata. It returns a map of resource name to pending resource IDs.
22
 
func DeployResources(applicationID string, chID charmstore.CharmID, csMac *macaroon.Macaroon, filesAndRevisions map[string]string, resources map[string]charmresource.Meta, conn base.APICallCloser) (ids map[string]string, err error) {
 
32
func DeployResources(
 
33
        applicationID string,
 
34
        chID charmstore.CharmID,
 
35
        csMac *macaroon.Macaroon,
 
36
        filesAndRevisions map[string]string,
 
37
        resources map[string]charmresource.Meta,
 
38
        conn base.APICallCloser,
 
39
) (ids map[string]string, err error) {
 
40
 
 
41
        if len(filesAndRevisions)+len(resources) == 0 {
 
42
                // Nothing to upload.
 
43
                return nil, nil
 
44
        }
 
45
 
23
46
        client, err := NewAPIClient(conn)
24
47
        if err != nil {
25
48
                return nil, errors.Trace(err)