// InitializeSWbemServices will return a new SWbemServices object that can be used to query WMI
514620
func InitializeSWbemServices(c *Client, connectServerArgs ...interface{}) (*SWbemServices, error) {
	//fmt.Println("InitializeSWbemServices: Starting")
	//TODO: implement connectServerArgs as optional argument for init with connectServer call
	s := new(SWbemServices)
	s.cWMIClient = c
	s.queries = make(chan *queryRequest)
	initError := make(chan error)
	go s.process(initError)

	err, ok := <-initError
	if ok {
		return nil, err //Send error to caller
	}
	//fmt.Println("InitializeSWbemServices: Finished")
	return s, nil
}
1361215
func (c *Container) RegisteredWebServices() []*WebService {
	c.webServicesLock.RLock()
	defer c.webServicesLock.RUnlock()
	result := make([]*WebService, len(c.webServices))
	for ix := range c.webServices {
		result[ix] = c.webServices[ix]
	}
	return result
}
740249
func (s *Store) CheckServiceNodes(ws memdb.WatchSet, serviceName string) (uint64, structs.CheckServiceNodes, error) {
	return s.checkServiceNodes(ws, serviceName, false)
}
732656
func (d *raftData) ServiceInstances(service string) []*discoverd.Instance {
	a := make([]*discoverd.Instance, 0, len(d.Instances[service]))
	for _, i := range d.Instances[service] {
		a = append(a, i)
	}

	sort.Sort(instanceSlice(a))
	return a
}
513688
func (v *vserver) expandServices() map[serviceKey]*service {
	if v.config.UseFWM {
		return v.expandFWMServices()
	}

	svcs := make(map[serviceKey]*service)
	for _, af := range seesaw.AFs() {
		var ip net.IP
		switch af {
		case seesaw.IPv4:
			ip = v.config.Host.IPv4Addr
		case seesaw.IPv6:
			ip = v.config.Host.IPv6Addr
		}
		if ip == nil {
			continue
		}
		for _, entry := range v.config.Entries {
			svc := &service{
				serviceKey: serviceKey{
					af:    af,
					proto: entry.Proto,
					port:  entry.Port,
				},
				ip:      seesaw.NewIP(ip),
				ventry:  entry,
				vserver: v,
				dests:   make(map[destinationKey]*destination, 0),
				stats:   &seesaw.ServiceStats{},
			}
			svc.ipvsSvc = svc.ipvsService()
			svcs[svc.serviceKey] = svc
		}
	}
	return svcs
}
247422
func (cln *Client) DiscoverServices(ss []ble.UUID) ([]*ble.Service, error) {
	rsp := cln.conn.sendReq(45, xpc.Dict{
		"kCBMsgArgDeviceUUID": cln.id,
		"kCBMsgArgUUIDs":      uuidSlice(ss),
	})
	if rsp.err() != nil {
		return nil, rsp.err()
	}
	svcs := []*ble.Service{}
	for _, xss := range rsp.services() {
		xs := msg(xss.(xpc.Dict))
		svcs = append(svcs, &ble.Service{
			UUID:      ble.MustParse(xs.uuid()),
			Handle:    uint16(xs.serviceStartHandle()),
			EndHandle: uint16(xs.serviceEndHandle()),
		})
	}
	if cln.profile == nil {
		cln.profile = &ble.Profile{Services: svcs}
	}
	return svcs, nil
}
117203
func (s *ScalingInstruction) SetServiceNamespace(v string) *ScalingInstruction {
	s.ServiceNamespace = &v
	return s
}
80970
func (s *InstanceGroup) SetEbsBlockDevices(v []*EbsBlockDevice) *InstanceGroup {
	s.EbsBlockDevices = v
	return s
}
717285
func (s *Server) SetServices(svcs []*ble.Service) error {
	s.Lock()
	defer s.Unlock()
	s.svcs = append(defaultServices(s.name), svcs...)
	s.db = att.NewDB(s.svcs, uint16(1)) // ble attrs start at 1
	return nil
}
1027296
func (_m *DBClient) GetDeviceServiceByName(n string) (models.DeviceService, error) {
	ret := _m.Called(n)

	var r0 models.DeviceService
	if rf, ok := ret.Get(0).(func(string) models.DeviceService); ok {
		r0 = rf(n)
	} else {
		r0 = ret.Get(0).(models.DeviceService)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(n)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1322221
func ReStartService() error {
	// TODO(tsm): refactor to make use of service.RestartableService
	svc, err := discoverService(ServiceName)
	if err != nil {
		return errors.Trace(err)
	}
	return restartService(svc)
}
990839
func (o *BackendServiceConfig) SetBackendServices(v []*BackendService) *BackendServiceConfig {
	if o.BackendServices = v; o.BackendServices == nil {
		o.nullFields = append(o.nullFields, "BackendServices")
	}
	return o
}
706592
func NewTeamService(context servicecontext.ServiceContext) service.TeamService {
	return &teamServiceImpl{base.NewBaseService(context)}
}
213481
func (s *DescribeServicesOutput) SetServices(v []*Service) *DescribeServicesOutput {
	s.Services = v
	return s
}
463749
func (n *Node) startWS(endpoint string, apis []rpc.API, modules []string, wsOrigins []string, exposeAll bool) error {
	// Short circuit if the WS endpoint isn't being exposed
	if endpoint == "" {
		return nil
	}
	listener, handler, err := rpc.StartWSEndpoint(endpoint, apis, modules, wsOrigins, exposeAll)
	if err != nil {
		return err
	}
	n.log.Info("WebSocket endpoint opened", "url", fmt.Sprintf("ws://%s", listener.Addr()))
	// All listeners booted successfully
	n.wsEndpoint = endpoint
	n.wsListener = listener
	n.wsHandler = handler

	return nil
}
1235075
func (s *GetTraceGraphOutput) SetServices(v []*Service) *GetTraceGraphOutput {
	s.Services = v
	return s
}
1237709
func newService(name string, conf common.Conf, initSystem, series string) (Service, error) {
	var svc Service
	var err error

	switch initSystem {
	case InitSystemWindows:
		svc, err = windows.NewService(name, conf)
	case InitSystemUpstart:
		svc, err = upstart.NewService(name, conf), nil
	case InitSystemSystemd:
		svc, err = systemd.NewServiceWithDefaults(name, conf)
	case InitSystemSnap:
		svc, err = snap.NewServiceFromName(name, conf)
	default:
		return nil, errors.NotFoundf("init system %q", initSystem)
	}

	if err != nil {
		return nil, errors.Annotatef(err, "failed to wrap service %q", name)
	}
	return svc, nil
}