48
50
// NewAPI creates a new instance of the Client API.
49
51
func NewAPI(st *state.State, resources *common.Resources, authorizer common.Authorizer, datadir string) *API {
57
statusSetter: common.NewStatusSetter(st, common.AuthAlways(true)),
56
59
r.client = &Client{
280
283
_, err = juju.DeployService(c.api.state,
281
284
juju.DeployServiceParams{
282
ServiceName: args.ServiceName,
284
NumUnits: args.NumUnits,
285
ConfigSettings: settings,
286
Constraints: args.Constraints,
287
ToMachineSpec: args.ToMachineSpec,
285
ServiceName: args.ServiceName,
287
NumUnits: args.NumUnits,
288
ConfigSettings: settings,
289
Constraints: args.Constraints,
290
ToMachineSpec: args.ToMachineSpec,
291
IncludeNetworks: args.IncludeNetworks,
292
ExcludeNetworks: args.ExcludeNetworks,
297
// ServiceDeployWithNetworks works exactly like ServiceDeploy, but
298
// allows specifying networks to include or exclude on the machine
299
// where the charm gets deployed.
300
func (c *Client) ServiceDeployWithNetworks(args params.ServiceDeploy) error {
301
return c.ServiceDeploy(args)
292
304
// ServiceUpdate updates the service attributes, including charm URL,
293
305
// minimum number of units, settings and constraints.
294
306
// All parameters in params.ServiceUpdate except the service name are optional.
803
814
// TODO(waigani) 2014-3-11 #1167616
804
815
// Add a txn retry loop to ensure that the settings on disk have not
805
816
// changed underneath us.
807
817
return c.api.state.UpdateEnvironConfig(args.Config, nil, checkAgentVersion)
820
// EnvironmentUnset implements the server-side part of the
821
// set-environment CLI command.
822
func (c *Client) EnvironmentUnset(args params.EnvironmentUnset) error {
823
// TODO(waigani) 2014-3-11 #1167616
824
// Add a txn retry loop to ensure that the settings on disk have not
825
// changed underneath us.
826
return c.api.state.UpdateEnvironConfig(nil, args.Keys, nil)
811
829
// SetEnvironAgentVersion sets the environment agent version.
948
966
return charm.Quote(fmt.Sprintf("%s-%d-%s", name, revision, uuid)), nil
969
// RetryProvisioning marks a provisioning error as transient on the machines.
970
func (c *Client) RetryProvisioning(p params.Entities) (params.ErrorResults, error) {
971
entityStatus := make([]params.EntityStatus, len(p.Entities))
972
for i, entity := range p.Entities {
973
entityStatus[i] = params.EntityStatus{Tag: entity.Tag, Data: params.StatusData{"transient": true}}
975
return c.api.statusSetter.UpdateStatus(params.SetStatus{
976
Entities: entityStatus,