// AddService is used to add a service entry to the local state.
// This entry is persistent and the agent will make a best effort to
// ensure it is registered
502228
func (l *State) AddService(service *structs.NodeService, token string) error {
	l.Lock()
	defer l.Unlock()
	return l.addServiceLocked(service, token)
}
175181
func (ec *ServiceManager) BindService(service RunnableInterface) {
	ec.services = append(ec.services, service)
}
549251
func (s *UpdateTaskSetInput) SetService(v string) *UpdateTaskSetInput {
	s.Service = &v
	return s
}
930234
func (_m *Store) AddService(svc *types.Service) error {
	ret := _m.Called(svc)

	var r0 error
	if rf, ok := ret.Get(0).(func(*types.Service) error); ok {
		r0 = rf(svc)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
582114
func (c *ServiceConfigs) Add(name string, service *ServiceConfig) {
	c.mu.Lock()
	c.m[name] = service
	c.mu.Unlock()
}
739280
func (s *DeleteServiceOutput) SetService(v *Service) *DeleteServiceOutput {
	s.Service = v
	return s
}
400508
func (a *api) AddService(config ServiceConfig) (*service.ServiceDetails, error) {
	client, err := a.connectDAO()
	if err != nil {
		return nil, err
	}

	endpoints := make([]servicedefinition.EndpointDefinition, len(*config.LocalPorts)+len(*config.RemotePorts))
	i := 0
	for _, e := range *config.LocalPorts {
		e.Purpose = "local"
		endpoints[i] = e
		i++
	}
	for _, e := range *config.RemotePorts {
		e.Purpose = "remote"
		endpoints[i] = e
		i++
	}

	sd := &servicedefinition.ServiceDefinition{
		Name:      config.Name,
		Command:   config.Command,
		Instances: domain.MinMax{Min: 1, Max: 1, Default: 1},
		ImageID:   config.ImageID,
		Launch:    commons.AUTO,
		Endpoints: endpoints,
	}

	var serviceID string
	if err := client.DeployService(dao.ServiceDeploymentRequest{ParentID: config.ParentServiceID, Service: *sd}, &serviceID); err != nil {
		return nil, err
	}

	return a.GetServiceDetails(serviceID)
}
21766
func (s *CreateTaskSetInput) SetService(v string) *CreateTaskSetInput {
	s.Service = &v
	return s
}
1075061
func (na *NetAddress) HasService(service ServiceFlag) bool {
	return na.Services&service == service
}
376984
func (s *GetServiceOutput) SetService(v *Service) *GetServiceOutput {
	s.Service = v
	return s
}
151351
func (s *Event) SetService(v string) *Event {
	s.Service = &v
	return s
}
220137
func (g *generateServiceBuilder) AddRootService(spec *compile.ServiceSpec) (api.ServiceID, error) {
	id, err := g.addService(spec)
	if err != nil {
		return id, err
	}

	if _, alreadyAdded := g.rootServices[id]; !alreadyAdded {
		g.RootServices = append(g.RootServices, id)
		g.rootServices[id] = struct{}{}
	}

	return id, err
}
149533
func (a *Agent) RemoveService(serviceID string, persist bool) error {
	a.stateLock.Lock()
	defer a.stateLock.Unlock()
	return a.removeServiceLocked(serviceID, persist)
}
413561
func (p *NetPlugin) AddServiceLB(servicename string, spec *core.ServiceSpec) error {
	p.Lock()
	defer p.Unlock()
	return p.NetworkDriver.AddSvcSpec(servicename, spec)
}
44007
func (msg *MsgVersion) HasService(service ServiceFlag) bool {
	return msg.Services&service == service
}
902176
func (_m *Balancer) AddService(_a0 *types.Service) error {
	ret := _m.Called(_a0)

	var r0 error
	if rf, ok := ret.Get(0).(func(*types.Service) error); ok {
		r0 = rf(_a0)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
663293
func (c *Context) Service() *Service {
	s, _ := serviceByName(c.ServiceName)
	return s
}