Skip to content

Commit

Permalink
More rename of service to application, mainly in state
Browse files Browse the repository at this point in the history
  • Loading branch information
wallyworld committed May 29, 2018
1 parent a05dbe6 commit 2ab114a
Show file tree
Hide file tree
Showing 171 changed files with 1,154 additions and 1,154 deletions.
4 changes: 2 additions & 2 deletions api/action/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ func (c *Client) Cancel(arg params.Entities) (params.ActionResults, error) {
}

// applicationsCharmActions is a batched query for the charm.Actions for a slice
// of services by Entity.
// of applications by Entity.
func (c *Client) applicationsCharmActions(arg params.Entities) (params.ApplicationsCharmActionsResults, error) {
results := params.ApplicationsCharmActionsResults{}
err := c.facade.FacadeCall("ApplicationsCharmsActions", arg, &results)
return results, err
}

// ApplicationCharmActions is a single query which uses ApplicationsCharmsActions to
// get the charm.Actions for a single Service by tag.
// get the charm.Actions for a single Application by tag.
func (c *Client) ApplicationCharmActions(arg params.Entity) (map[string]params.ActionSpec, error) {
tags := params.Entities{Entities: []params.Entity{{Tag: arg.Tag}}}
results, err := c.applicationsCharmActions(tags)
Expand Down
2 changes: 1 addition & 1 deletion api/action/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *actionSuite) TestApplicationCharmActions(c *gc.C) {
expectedErr string
expectedResult map[string]params.ActionSpec
}{{
description: "result from wrong service",
description: "result from wrong application",
patchResults: []params.ApplicationCharmActionsResult{
{
ApplicationTag: names.NewApplicationTag("bar").String(),
Expand Down
2 changes: 1 addition & 1 deletion api/action/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (c *Client) RunOnAllMachines(commands string, timeout time.Duration) ([]par
}

// Run the Commands specified on the machines identified through the ids
// provided in the machines, services and units slices.
// provided in the machines, applications and units slices.
func (c *Client) Run(run params.RunParams) ([]params.ActionResult, error) {
var results params.ActionResults
err := c.facade.FacadeCall("Run", run, &results)
Expand Down
2 changes: 1 addition & 1 deletion api/allwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (o orderedDeltas) kindPriority(kind string) int {
switch kind {
case "machine":
return 1
case "service":
case "application":
return 2
case "relation":
return 3
Expand Down
4 changes: 2 additions & 2 deletions api/annotations/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func (s *annotationsMockSuite) TestSetEntitiesAnnotation(c *gc.C) {
annts := map[string]string{"annotation1": "test"}
annts2 := map[string]string{"annotation2": "test"}
setParams := map[string]map[string]string{
"charmA": annts,
"serviceB": annts2,
"charmA": annts,
"applicationB": annts2,
}
apiCaller := basetesting.APICallerFunc(
func(objType string,
Expand Down
18 changes: 9 additions & 9 deletions api/application/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

var logger = loggo.GetLogger("juju.api.application")

// Client allows access to the service API end point.
// Client allows access to the application API end point.
type Client struct {
base.ClientFacade
st base.APICallCloser
Expand All @@ -39,9 +39,9 @@ func NewClient(st base.APICallCloser) *Client {
}

// SetMetricCredentials sets the metric credentials for the application specified.
func (c *Client) SetMetricCredentials(service string, credentials []byte) error {
func (c *Client) SetMetricCredentials(application string, credentials []byte) error {
creds := []params.ApplicationMetricCredential{
{service, credentials},
{application, credentials},
}
p := params.ApplicationMetricCredentials{creds}
results := new(params.ErrorResults)
Expand All @@ -61,7 +61,7 @@ func (c *Client) ModelUUID() string {
return tag.Id()
}

// DeployArgs holds the arguments to be sent to Client.ServiceDeploy.
// DeployArgs holds the arguments to be sent to Client.ApplicationDeploy.
type DeployArgs struct {

// CharmID identifies the charm to deploy.
Expand Down Expand Up @@ -154,11 +154,11 @@ func (c *Client) Deploy(args DeployArgs) error {
return errors.Trace(results.OneError())
}

// GetCharmURL returns the charm URL the given service is
// GetCharmURL returns the charm URL the given application is
// running at present.
func (c *Client) GetCharmURL(serviceName string) (*charm.URL, error) {
func (c *Client) GetCharmURL(applicationName string) (*charm.URL, error) {
result := new(params.StringResult)
args := params.ApplicationGet{ApplicationName: serviceName}
args := params.ApplicationGet{ApplicationName: applicationName}
err := c.facade.FacadeCall("GetCharmURL", args, result)
if err != nil {
return nil, errors.Trace(err)
Expand Down Expand Up @@ -242,7 +242,7 @@ func describeV5(config map[string]interface{}) (map[string]interface{}, error) {
}

// SetCharmConfig holds the configuration for setting a new revision of a charm
// on a service.
// on a application.
type SetCharmConfig struct {
// ApplicationName is the name of the application to set the charm on.
ApplicationName string
Expand Down Expand Up @@ -278,7 +278,7 @@ type SetCharmConfig struct {
StorageConstraints map[string]storage.Constraints `json:"storage-constraints,omitempty"`
}

// SetCharm sets the charm for a given service.
// SetCharm sets the charm for a given application.
func (c *Client) SetCharm(cfg SetCharmConfig) error {
var storageConstraints map[string]params.StorageConstraints
if len(cfg.StorageConstraints) > 0 {
Expand Down
14 changes: 7 additions & 7 deletions api/application/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func newClientV4(f basetesting.APICallerFunc) *application.Client {
return application.NewClient(basetesting.BestVersionCaller{f, 4})
}

func (s *applicationSuite) TestSetServiceMetricCredentials(c *gc.C) {
func (s *applicationSuite) TestSetApplicationMetricCredentials(c *gc.C) {
var called bool
client := newClient(func(objType string, version int, id, request string, a, response interface{}) error {
called = true
Expand All @@ -47,19 +47,19 @@ func (s *applicationSuite) TestSetServiceMetricCredentials(c *gc.C) {
args, ok := a.(params.ApplicationMetricCredentials)
c.Assert(ok, jc.IsTrue)
c.Assert(args.Creds, gc.HasLen, 1)
c.Assert(args.Creds[0].ApplicationName, gc.Equals, "serviceA")
c.Assert(args.Creds[0].ApplicationName, gc.Equals, "applicationA")
c.Assert(args.Creds[0].MetricCredentials, gc.DeepEquals, []byte("creds 1"))

result := response.(*params.ErrorResults)
result.Results = make([]params.ErrorResult, 1)
return nil
})
err := client.SetMetricCredentials("serviceA", []byte("creds 1"))
err := client.SetMetricCredentials("applicationA", []byte("creds 1"))
c.Assert(err, jc.ErrorIsNil)
c.Assert(called, jc.IsTrue)
}

func (s *applicationSuite) TestSetServiceMetricCredentialsFails(c *gc.C) {
func (s *applicationSuite) TestSetApplicationMetricCredentialsFails(c *gc.C) {
var called bool
client := newClient(func(objType string, version int, id, request string, a, response interface{}) error {
called = true
Expand Down Expand Up @@ -88,7 +88,7 @@ func (s *applicationSuite) TestDeploy(c *gc.C) {
c.Assert(args.Applications, gc.HasLen, 1)
app := args.Applications[0]
c.Assert(app.CharmURL, gc.Equals, "cs:trusty/a-charm-1")
c.Assert(app.ApplicationName, gc.Equals, "serviceA")
c.Assert(app.ApplicationName, gc.Equals, "applicationA")
c.Assert(app.Series, gc.Equals, "series")
c.Assert(app.NumUnits, gc.Equals, 1)
c.Assert(app.ConfigYAML, gc.Equals, "configYAML")
Expand All @@ -112,7 +112,7 @@ func (s *applicationSuite) TestDeploy(c *gc.C) {
CharmID: charmstore.CharmID{
URL: charm.MustParseURL("trusty/a-charm-1"),
},
ApplicationName: "serviceA",
ApplicationName: "applicationA",
Series: "series",
NumUnits: 1,
ConfigYAML: "configYAML",
Expand Down Expand Up @@ -227,7 +227,7 @@ func (s *applicationSuite) TestAddUnitsAttachStorageMultipleUnits(c *gc.C) {
c.Assert(called, jc.IsFalse)
}

func (s *applicationSuite) TestServiceGetCharmURL(c *gc.C) {
func (s *applicationSuite) TestApplicationGetCharmURL(c *gc.C) {
var called bool
client := newClient(func(objType string, version int, id, request string, a, response interface{}) error {
called = true
Expand Down
14 changes: 7 additions & 7 deletions api/applicationscaler/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewAPI(caller base.APICaller, newWatcher NewWatcherFunc) *API {
}
}

// Watch returns a StringsWatcher that delivers the names of services
// Watch returns a StringsWatcher that delivers the names of applications
// that may need to be rescaled.
func (api *API) Watch() (watcher.StringsWatcher, error) {
var result params.StringsWatchResult
Expand All @@ -50,15 +50,15 @@ func (api *API) Watch() (watcher.StringsWatcher, error) {
// Rescale requests that all supplied application names be rescaled to
// their minimum configured sizes. It returns the first error it
// encounters.
func (api *API) Rescale(services []string) error {
func (api *API) Rescale(applications []string) error {
args := params.Entities{
Entities: make([]params.Entity, len(services)),
Entities: make([]params.Entity, len(applications)),
}
for i, service := range services {
if !names.IsValidApplication(service) {
return errors.NotValidf("application name %q", service)
for i, application := range applications {
if !names.IsValidApplication(application) {
return errors.NotValidf("application name %q", application)
}
tag := names.NewApplicationTag(service)
tag := names.NewApplicationTag(application)
args.Entities[i].Tag = tag.String()
}
var results params.ErrorResults
Expand Down
2 changes: 1 addition & 1 deletion api/base/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type ModelStatus struct {
TotalMachineCount int
CoreCount int
HostedMachineCount int
ServiceCount int
ApplicationCount int
Machines []Machine
Volumes []Volume
Filesystems []Filesystem
Expand Down
2 changes: 1 addition & 1 deletion api/common/modelstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func constructModelStatus(model names.ModelTag, owner names.UserTag, r params.Mo
Life: string(r.Life),
Owner: owner.Id(),
HostedMachineCount: r.HostedMachineCount,
ServiceCount: r.ApplicationCount,
ApplicationCount: r.ApplicationCount,
TotalMachineCount: len(r.Machines),
Volumes: volumes,
Filesystems: filesystems,
Expand Down
2 changes: 1 addition & 1 deletion api/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ func (s *Suite) TestModelStatus(c *gc.C) {
UUID: coretesting.ModelTag.Id(),
TotalMachineCount: 1,
HostedMachineCount: 2,
ServiceCount: 3,
ApplicationCount: 3,
Owner: "glenda",
Life: string(params.Alive),
Machines: []base.Machine{{Id: "0", InstanceId: "inst-ance", Status: "pending"}},
Expand Down
6 changes: 3 additions & 3 deletions api/firewaller/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ func (s *unitSuite) TestAssignedMachine(c *gc.C) {
c.Assert(err, jc.Satisfies, params.IsCodeNotAssigned)
}

func (s *unitSuite) TestService(c *gc.C) {
service, err := s.apiUnit.Application()
func (s *unitSuite) TestApplication(c *gc.C) {
application, err := s.apiUnit.Application()
c.Assert(err, jc.ErrorIsNil)
c.Assert(service.Name(), gc.Equals, s.application.Name())
c.Assert(application.Name(), gc.Equals, s.application.Name())
}

func (s *unitSuite) TestName(c *gc.C) {
Expand Down
2 changes: 1 addition & 1 deletion api/modelmanager/modelmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func (s *modelmanagerSuite) TestModelStatus(c *gc.C) {
UUID: coretesting.ModelTag.Id(),
TotalMachineCount: 1,
HostedMachineCount: 2,
ServiceCount: 3,
ApplicationCount: 3,
Owner: "glenda",
Life: string(params.Alive),
Machines: []base.Machine{{Id: "0", InstanceId: "inst-ance", Status: "pending"}},
Expand Down
2 changes: 1 addition & 1 deletion apiserver/facades/agent/provisioner/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ func commonServiceInstances(st *state.State, m *state.Machine) ([]instance.Id, e
if !unit.IsPrincipal() {
continue
}
instanceIds, err := state.ServiceInstances(st, unit.ApplicationName())
instanceIds, err := state.ApplicationInstances(st, unit.ApplicationName())
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions apiserver/facades/agent/resourceshookcontext/stub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type stubUnitDataStore struct {

ReturnOpenResource resource.Opened
ReturnGetResource resource.Resource
ReturnListResources resource.ServiceResources
ReturnListResources resource.ApplicationResources
}

func (s *stubUnitDataStore) OpenResource(name string) (resource.Resource, io.ReadCloser, error) {
Expand All @@ -38,10 +38,10 @@ func (s *stubUnitDataStore) GetResource(name string) (resource.Resource, error)
return s.ReturnGetResource, nil
}

func (s *stubUnitDataStore) ListResources() (resource.ServiceResources, error) {
func (s *stubUnitDataStore) ListResources() (resource.ApplicationResources, error) {
s.AddCall("ListResources")
if err := s.NextErr(); err != nil {
return resource.ServiceResources{}, errors.Trace(err)
return resource.ApplicationResources{}, errors.Trace(err)
}

return s.ReturnListResources, nil
Expand Down
4 changes: 2 additions & 2 deletions apiserver/facades/agent/resourceshookcontext/unitfacade.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ type resourcesUnitDataStore struct {
}

// ListResources implements resource/api/private/server.UnitDataStore.
func (ds *resourcesUnitDataStore) ListResources() (resource.ServiceResources, error) {
func (ds *resourcesUnitDataStore) ListResources() (resource.ApplicationResources, error) {
return ds.resources.ListResources(ds.unit.ApplicationName())
}

// UnitDataStore exposes the data storage functionality needed here.
// All functionality is tied to the unit's application.
type UnitDataStore interface {
// ListResources lists all the resources for the application.
ListResources() (resource.ServiceResources, error)
ListResources() (resource.ApplicationResources, error)
}

// NewUnitFacade returns the resources portion of the uniter's API facade.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (s *UnitFacadeSuite) TestGetResourceInfoOkay(c *gc.C) {
opened2 := resourcetesting.NewResource(c, s.stub, "eggs", "a-application", "other data")
res2 := opened2.Resource
store := &stubUnitDataStore{Stub: s.stub}
store.ReturnListResources = resource.ServiceResources{
store.ReturnListResources = resource.ApplicationResources{
Resources: []resource.Resource{res1, res2},
}
uf := resourceshookcontext.UnitFacade{DataStore: store}
Expand All @@ -69,7 +69,7 @@ func (s *UnitFacadeSuite) TestGetResourceInfoOkay(c *gc.C) {
func (s *UnitFacadeSuite) TestGetResourceInfoEmpty(c *gc.C) {
opened := resourcetesting.NewResource(c, s.stub, "spam", "a-application", "some data")
store := &stubUnitDataStore{Stub: s.stub}
store.ReturnListResources = resource.ServiceResources{
store.ReturnListResources = resource.ApplicationResources{
Resources: []resource.Resource{opened.Resource},
}
uf := resourceshookcontext.UnitFacade{DataStore: store}
Expand All @@ -88,7 +88,7 @@ func (s *UnitFacadeSuite) TestGetResourceInfoEmpty(c *gc.C) {
func (s *UnitFacadeSuite) TestGetResourceInfoNotFound(c *gc.C) {
opened := resourcetesting.NewResource(c, s.stub, "spam", "a-application", "some data")
store := &stubUnitDataStore{Stub: s.stub}
store.ReturnListResources = resource.ServiceResources{
store.ReturnListResources = resource.ApplicationResources{
Resources: []resource.Resource{opened.Resource},
}
uf := resourceshookcontext.UnitFacade{DataStore: store}
Expand Down
2 changes: 1 addition & 1 deletion apiserver/facades/agent/uniter/goal-state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (s *uniterGoalStateSuite) SetUpTest(c *gc.C) {
s.JujuConnSuite.SetUpTest(c)

newFactory := factory.NewFactory(s.State)
// Create two machines, two applications and add a unit to each service.
// Create two machines, two applications and add a unit to each application.
s.machine0 = newFactory.MakeMachine(c, &factory.MachineParams{
Series: "quantal",
Jobs: []state.MachineJob{state.JobHostUnits, state.JobManageModel},
Expand Down
Loading

0 comments on commit 2ab114a

Please sign in to comment.