github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/apiserver/facades/client/backups/info.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/apiserver/params" 10 ) 11 12 // Info provides the implementation of the API method. 13 func (a *API) Info(args params.BackupsInfoArgs) (params.BackupsMetadataResult, error) { 14 backups, closer := newBackups(a.backend) 15 defer closer.Close() 16 17 meta, file, err := backups.Get(args.ID) 18 if err != nil { 19 return params.BackupsMetadataResult{}, errors.Trace(err) 20 } 21 if file != nil { 22 // We don't use the archive file but need to close it 23 // nonetheless or else we'll leak sockets. 24 defer file.Close() 25 } 26 27 return CreateResult(meta, ""), nil 28 }