~juju-qa/ubuntu/yakkety/juju/2.0-rc3-again

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/state/statecmd/getconstraints.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-04-24 22:34:47 UTC
  • Revision ID: package-import@ubuntu.com-20130424223447-f0qdji7ubnyo0s71
Tags: upstream-1.10.0.1
ImportĀ upstreamĀ versionĀ 1.10.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Code shared by the CLI and API for the GetConstraints function.
 
2
 
 
3
package statecmd
 
4
 
 
5
import (
 
6
        "launchpad.net/juju-core/constraints"
 
7
        "launchpad.net/juju-core/state"
 
8
        "launchpad.net/juju-core/state/api/params"
 
9
)
 
10
 
 
11
// GetServiceConstraints returns the constraints for a given service
 
12
func GetServiceConstraints(st *state.State, args params.GetServiceConstraints) (params.GetServiceConstraintsResults, error) {
 
13
        svc, err := st.Service(args.ServiceName)
 
14
        if err != nil {
 
15
                return params.GetServiceConstraintsResults{constraints.Value{}}, err
 
16
        }
 
17
        constraints, err := svc.Constraints()
 
18
        return params.GetServiceConstraintsResults{constraints}, err
 
19
}