Пример #1
0
// ServiceUpdate updates the service attributes, including charm URL,
// minimum number of units, settings and constraints.
// TODO(frankban) deprecate redundant API calls that this supercedes.
func (c *Client) ServiceUpdate(args params.ServiceUpdate) error {
	if c.BestAPIVersion() < 2 {
		return base.OldAgentError("ServiceUpdate", "2.0")
	}

	return c.FacadeCall("ServiceUpdate", args, nil)
}
Пример #2
0
// ServiceSetCharm sets the charm for a given service.
func (c *Client) ServiceSetCharm(serviceName string, charmUrl string, forceSeries, forceUnits bool) error {
	if c.BestAPIVersion() < 2 {
		return base.OldAgentError("ServiceSetCharm", "2.0")
	}

	args := params.ServiceSetCharm{
		ServiceName: serviceName,
		CharmUrl:    charmUrl,
		ForceSeries: forceSeries,
		ForceUnits:  forceUnits,
	}
	return c.FacadeCall("ServiceSetCharm", args, nil)
}
Пример #3
0
// ServiceGetCharmURL returns the charm URL the given service is
// running at present.
func (c *Client) ServiceGetCharmURL(serviceName string) (*charm.URL, error) {
	if c.BestAPIVersion() < 2 {
		return nil, base.OldAgentError("ServiceGetCharmURL", "2.0")
	}

	result := new(params.StringResult)
	args := params.ServiceGet{ServiceName: serviceName}
	err := c.FacadeCall("ServiceGetCharmURL", args, result)
	if err != nil {
		return nil, err
	}
	if result.Error != nil {
		return nil, result.Error
	}
	return charm.ParseURL(result.Result)
}