Skip to content

Commit ab54543

Browse files
committed
Rename api params and other artifacts from service to application
1 parent 588a7d0 commit ab54543

File tree

369 files changed

+4114
-4137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

369 files changed

+4114
-4137
lines changed

api/action/client.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,20 @@ func (c *Client) Cancel(arg params.Actions) (params.ActionResults, error) {
9191
return results, err
9292
}
9393

94-
// servicesCharmActions is a batched query for the charm.Actions for a slice
94+
// applicationsCharmsActions is a batched query for the charm.Actions for a slice
9595
// of services by Entity.
96-
func (c *Client) servicesCharmActions(arg params.Entities) (params.ServicesCharmActionsResults, error) {
97-
results := params.ServicesCharmActionsResults{}
98-
err := c.facade.FacadeCall("ServicesCharmActions", arg, &results)
96+
func (c *Client) applicationsCharmsActions(arg params.Entities) (params.ApplicationsCharmActionsResults, error) {
97+
results := params.ApplicationsCharmActionsResults{}
98+
err := c.facade.FacadeCall("ApplicationsCharmsActions", arg, &results)
9999
return results, err
100100
}
101101

102-
// ServiceCharmActions is a single query which uses ServicesCharmActions to
102+
// ApplicationCharmActions is a single query which uses ApplicationsCharmsActions to
103103
// get the charm.Actions for a single Service by tag.
104-
func (c *Client) ServiceCharmActions(arg params.Entity) (*charm.Actions, error) {
104+
func (c *Client) ApplicationCharmActions(arg params.Entity) (*charm.Actions, error) {
105105
none := &charm.Actions{}
106106
tags := params.Entities{Entities: []params.Entity{{Tag: arg.Tag}}}
107-
results, err := c.servicesCharmActions(tags)
107+
results, err := c.applicationsCharmsActions(tags)
108108
if err != nil {
109109
return none, err
110110
}
@@ -116,7 +116,7 @@ func (c *Client) ServiceCharmActions(arg params.Entity) (*charm.Actions, error)
116116
return none, result.Error
117117
}
118118
if result.ApplicationTag != arg.Tag {
119-
return none, errors.Errorf("action results received for wrong service %q", result.ApplicationTag)
119+
return none, errors.Errorf("action results received for wrong application %q", result.ApplicationTag)
120120
}
121121
return result.Actions, nil
122122
}

api/action/client_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ func (s *actionSuite) TestClient(c *gc.C) {
2727
c.Check(facade.Name(), gc.Equals, "Action")
2828
}
2929

30-
func (s *actionSuite) TestServiceCharmActions(c *gc.C) {
30+
func (s *actionSuite) TestApplicationCharmActions(c *gc.C) {
3131
tests := []struct {
3232
description string
33-
patchResults []params.ServiceCharmActionsResult
33+
patchResults []params.ApplicationCharmActionsResult
3434
patchErr string
3535
expectedErr string
3636
expectedResult *charm.Actions
3737
}{{
3838
description: "result from wrong service",
39-
patchResults: []params.ServiceCharmActionsResult{
39+
patchResults: []params.ApplicationCharmActionsResult{
4040
{
4141
ApplicationTag: names.NewApplicationTag("bar").String(),
4242
},
4343
},
44-
expectedErr: `action results received for wrong service "application-bar"`,
44+
expectedErr: `action results received for wrong application "application-bar"`,
4545
}, {
4646
description: "some other error",
47-
patchResults: []params.ServiceCharmActionsResult{
47+
patchResults: []params.ApplicationCharmActionsResult{
4848
{
4949
ApplicationTag: names.NewApplicationTag("foo").String(),
5050
Error: &params.Error{
@@ -55,22 +55,22 @@ func (s *actionSuite) TestServiceCharmActions(c *gc.C) {
5555
expectedErr: `something bad`,
5656
}, {
5757
description: "more than one result",
58-
patchResults: []params.ServiceCharmActionsResult{
58+
patchResults: []params.ApplicationCharmActionsResult{
5959
{},
6060
{},
6161
},
6262
expectedErr: "2 results, expected 1",
6363
}, {
6464
description: "no results",
65-
patchResults: []params.ServiceCharmActionsResult{},
65+
patchResults: []params.ApplicationCharmActionsResult{},
6666
expectedErr: "0 results, expected 1",
6767
}, {
6868
description: "error on facade call",
6969
patchErr: "something went wrong",
7070
expectedErr: "something went wrong",
7171
}, {
7272
description: "normal result",
73-
patchResults: []params.ServiceCharmActionsResult{
73+
patchResults: []params.ApplicationCharmActionsResult{
7474
{
7575
ApplicationTag: names.NewApplicationTag("foo").String(),
7676
Actions: &charm.Actions{
@@ -101,9 +101,9 @@ func (s *actionSuite) TestServiceCharmActions(c *gc.C) {
101101
// anonymous func to properly trigger defer
102102
func() {
103103
c.Logf("test %d: %s", i, t.description)
104-
cleanup := patchServiceCharmActions(c, s.client, t.patchResults, t.patchErr)
104+
cleanup := patchApplicationCharmActions(c, s.client, t.patchResults, t.patchErr)
105105
defer cleanup()
106-
result, err := s.client.ServiceCharmActions(params.Entity{Tag: names.NewApplicationTag("foo").String()})
106+
result, err := s.client.ApplicationCharmActions(params.Entity{Tag: names.NewApplicationTag("foo").String()})
107107
if t.expectedErr != "" {
108108
c.Check(err, gc.ErrorMatches, t.expectedErr)
109109
} else {
@@ -114,16 +114,16 @@ func (s *actionSuite) TestServiceCharmActions(c *gc.C) {
114114
}
115115
}
116116

117-
// replace "ServicesCharmActions" facade call with required results and error
117+
// replace sCharmActions" facade call with required results and error
118118
// if desired
119-
func patchServiceCharmActions(c *gc.C, apiCli *action.Client, patchResults []params.ServiceCharmActionsResult, err string) func() {
119+
func patchApplicationCharmActions(c *gc.C, apiCli *action.Client, patchResults []params.ApplicationCharmActionsResult, err string) func() {
120120
return action.PatchClientFacadeCall(apiCli,
121121
func(req string, paramsIn interface{}, resp interface{}) error {
122-
c.Assert(req, gc.Equals, "ServicesCharmActions")
122+
c.Assert(req, gc.Equals, "ApplicationsCharmsActions")
123123
c.Assert(paramsIn, gc.FitsTypeOf, params.Entities{})
124124
p := paramsIn.(params.Entities)
125125
c.Check(p.Entities, gc.HasLen, 1)
126-
result := resp.(*params.ServicesCharmActionsResults)
126+
result := resp.(*params.ApplicationsCharmActionsResults)
127127
result.Results = patchResults
128128
if err != "" {
129129
return errors.New(err)

api/service/client.go renamed to api/application/client.go

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2014 Canonical Ltd.
22
// Licensed under the AGPLv3, see LICENCE file for details.
33

4-
// Package service provides access to the service api facade.
5-
// This facade contains api calls that are specific to services.
6-
// As a rule of thumb, if the argument for an api requries a service name
7-
// and affects only that service then the call belongs here.
8-
package service
4+
// Package application provides access to the application api facade.
5+
// This facade contains api calls that are specific to applications.
6+
// As a rule of thumb, if the argument for an api requires an application name
7+
// and affects only that application then the call belongs here.
8+
package application
99

1010
import (
1111
"github.com/juju/errors"
@@ -21,7 +21,7 @@ import (
2121
"github.com/juju/juju/storage"
2222
)
2323

24-
var logger = loggo.GetLogger("juju.api.service")
24+
var logger = loggo.GetLogger("juju.api.application")
2525

2626
// Client allows access to the service API end point.
2727
type Client struct {
@@ -30,13 +30,13 @@ type Client struct {
3030
facade base.FacadeCaller
3131
}
3232

33-
// NewClient creates a new client for accessing the service api.
33+
// NewClient creates a new client for accessing the application api.
3434
func NewClient(st api.Connection) *Client {
35-
frontend, backend := base.NewClientFacade(st, "Service")
35+
frontend, backend := base.NewClientFacade(st, "Application")
3636
return &Client{ClientFacade: frontend, st: st, facade: backend}
3737
}
3838

39-
// SetMetricCredentials sets the metric credentials for the service specified.
39+
// SetMetricCredentials sets the metric credentials for the application specified.
4040
func (c *Client) SetMetricCredentials(service string, credentials []byte) error {
4141
creds := []params.ApplicationMetricCredential{
4242
{service, credentials},
@@ -64,15 +64,15 @@ func (c *Client) ModelUUID() string {
6464
type DeployArgs struct {
6565
// CharmID identifies the charm to deploy.
6666
CharmID charmstore.CharmID
67-
// ServiceName is the name to give the service.
68-
ServiceName string
67+
// ApplicationName is the name to give the application.
68+
ApplicationName string
6969
// Series to be used for the machine.
7070
Series string
7171
// NumUnits is the number of units to deploy.
7272
NumUnits int
7373
// ConfigYAML is a string that overrides the default config.yml.
7474
ConfigYAML string
75-
// Cons contains constraints on where units of this service may be
75+
// Cons contains constraints on where units of this application may be
7676
// placed.
7777
Cons constraints.Value
7878
// Placement directives on where the machines for the unit must be
@@ -83,7 +83,7 @@ type DeployArgs struct {
8383
Storage map[string]storage.Constraints
8484
// EndpointBindings
8585
EndpointBindings map[string]string
86-
// Collection of resource names for the service, with the value being the
86+
// Collection of resource names for the application, with the value being the
8787
// unique ID of a pre-uploaded resources in storage.
8888
Resources map[string]string
8989
}
@@ -94,7 +94,7 @@ type DeployArgs struct {
9494
func (c *Client) Deploy(args DeployArgs) error {
9595
deployArgs := params.ApplicationsDeploy{
9696
Applications: []params.ApplicationDeploy{{
97-
ApplicationName: args.ServiceName,
97+
ApplicationName: args.ApplicationName,
9898
Series: args.Series,
9999
CharmUrl: args.CharmID.URL.String(),
100100
Channel: string(args.CharmID.Channel),
@@ -134,8 +134,8 @@ func (c *Client) GetCharmURL(serviceName string) (*charm.URL, error) {
134134
// SetCharmConfig holds the configuration for setting a new revision of a charm
135135
// on a service.
136136
type SetCharmConfig struct {
137-
// ServiceName is the name of the service to set the charm on.
138-
ServiceName string
137+
// ApplicationName is the name of the application to set the charm on.
138+
ApplicationName string
139139
// CharmID identifies the charm.
140140
CharmID charmstore.CharmID
141141
// ForceSeries forces the use of the charm even if it doesn't match the
@@ -151,7 +151,7 @@ type SetCharmConfig struct {
151151
// SetCharm sets the charm for a given service.
152152
func (c *Client) SetCharm(cfg SetCharmConfig) error {
153153
args := params.ApplicationSetCharm{
154-
ApplicationName: cfg.ServiceName,
154+
ApplicationName: cfg.ApplicationName,
155155
CharmUrl: cfg.CharmID.URL.String(),
156156
Channel: string(cfg.CharmID.Channel),
157157
ForceSeries: cfg.ForceSeries,
@@ -161,17 +161,17 @@ func (c *Client) SetCharm(cfg SetCharmConfig) error {
161161
return c.facade.FacadeCall("SetCharm", args, nil)
162162
}
163163

164-
// Update updates the service attributes, including charm URL,
164+
// Update updates the application attributes, including charm URL,
165165
// minimum number of units, settings and constraints.
166166
func (c *Client) Update(args params.ApplicationUpdate) error {
167167
return c.facade.FacadeCall("Update", args, nil)
168168
}
169169

170-
// AddUnits adds a given number of units to a service using the specified
170+
// AddUnits adds a given number of units to an application using the specified
171171
// placement directives to assign units to machines.
172-
func (c *Client) AddUnits(service string, numUnits int, placement []*instance.Placement) ([]string, error) {
172+
func (c *Client) AddUnits(application string, numUnits int, placement []*instance.Placement) ([]string, error) {
173173
args := params.AddApplicationUnits{
174-
ApplicationName: service,
174+
ApplicationName: application,
175175
NumUnits: numUnits,
176176
Placement: placement,
177177
}
@@ -180,80 +180,80 @@ func (c *Client) AddUnits(service string, numUnits int, placement []*instance.Pl
180180
return results.Units, err
181181
}
182182

183-
// DestroyUnits decreases the number of units dedicated to a service.
183+
// DestroyUnits decreases the number of units dedicated to an application.
184184
func (c *Client) DestroyUnits(unitNames ...string) error {
185185
params := params.DestroyApplicationUnits{unitNames}
186186
return c.facade.FacadeCall("DestroyUnits", params, nil)
187187
}
188188

189-
// Destroy destroys a given service.
190-
func (c *Client) Destroy(service string) error {
189+
// Destroy destroys a given application.
190+
func (c *Client) Destroy(application string) error {
191191
params := params.ApplicationDestroy{
192-
ApplicationName: service,
192+
ApplicationName: application,
193193
}
194194
return c.facade.FacadeCall("Destroy", params, nil)
195195
}
196196

197-
// GetConstraints returns the constraints for the given service.
197+
// GetConstraints returns the constraints for the given application.
198198
func (c *Client) GetConstraints(service string) (constraints.Value, error) {
199199
results := new(params.GetConstraintsResults)
200200
err := c.facade.FacadeCall("GetConstraints", params.GetApplicationConstraints{service}, results)
201201
return results.Constraints, err
202202
}
203203

204-
// SetConstraints specifies the constraints for the given service.
205-
func (c *Client) SetConstraints(service string, constraints constraints.Value) error {
204+
// SetConstraints specifies the constraints for the given application.
205+
func (c *Client) SetConstraints(application string, constraints constraints.Value) error {
206206
params := params.SetConstraints{
207-
ApplicationName: service,
207+
ApplicationName: application,
208208
Constraints: constraints,
209209
}
210210
return c.facade.FacadeCall("SetConstraints", params, nil)
211211
}
212212

213213
// Expose changes the juju-managed firewall to expose any ports that
214214
// were also explicitly marked by units as open.
215-
func (c *Client) Expose(service string) error {
216-
params := params.ApplicationExpose{ApplicationName: service}
215+
func (c *Client) Expose(application string) error {
216+
params := params.ApplicationExpose{ApplicationName: application}
217217
return c.facade.FacadeCall("Expose", params, nil)
218218
}
219219

220220
// Unexpose changes the juju-managed firewall to unexpose any ports that
221221
// were also explicitly marked by units as open.
222-
func (c *Client) Unexpose(service string) error {
223-
params := params.ApplicationUnexpose{ApplicationName: service}
222+
func (c *Client) Unexpose(application string) error {
223+
params := params.ApplicationUnexpose{ApplicationName: application}
224224
return c.facade.FacadeCall("Unexpose", params, nil)
225225
}
226226

227-
// Get returns the configuration for the named service.
228-
func (c *Client) Get(service string) (*params.ApplicationGetResults, error) {
227+
// Get returns the configuration for the named application.
228+
func (c *Client) Get(application string) (*params.ApplicationGetResults, error) {
229229
var results params.ApplicationGetResults
230-
params := params.ApplicationGet{ApplicationName: service}
230+
params := params.ApplicationGet{ApplicationName: application}
231231
err := c.facade.FacadeCall("Get", params, &results)
232232
return &results, err
233233
}
234234

235-
// Set sets configuration options on a service.
236-
func (c *Client) Set(service string, options map[string]string) error {
235+
// Set sets configuration options on an application.
236+
func (c *Client) Set(application string, options map[string]string) error {
237237
p := params.ApplicationSet{
238-
ApplicationName: service,
238+
ApplicationName: application,
239239
Options: options,
240240
}
241241
return c.facade.FacadeCall("Set", p, nil)
242242
}
243243

244-
// Unset resets configuration options on a service.
245-
func (c *Client) Unset(service string, options []string) error {
244+
// Unset resets configuration options on an application.
245+
func (c *Client) Unset(application string, options []string) error {
246246
p := params.ApplicationUnset{
247-
ApplicationName: service,
247+
ApplicationName: application,
248248
Options: options,
249249
}
250250
return c.facade.FacadeCall("Unset", p, nil)
251251
}
252252

253-
// CharmRelations returns the service's charms relation names.
254-
func (c *Client) CharmRelations(service string) ([]string, error) {
253+
// CharmRelations returns the application's charms relation names.
254+
func (c *Client) CharmRelations(application string) ([]string, error) {
255255
var results params.ApplicationCharmRelationsResults
256-
params := params.ApplicationCharmRelations{ApplicationName: service}
256+
params := params.ApplicationCharmRelations{ApplicationName: application}
257257
err := c.facade.FacadeCall("CharmRelations", params, &results)
258258
return results.CharmRelations, err
259259
}

0 commit comments

Comments
 (0)