// AddServices sets up services for the provided objects.
350073
func AddServices(objects Objects, firstPortOnly bool) Objects {
	svcs := []runtime.Object{}
	for _, o := range objects {
		switch t := o.(type) {
		case *appsv1.DeploymentConfig:
			svc := addService(t.Spec.Template.Spec.Containers, t.ObjectMeta, t.Spec.Selector, firstPortOnly)
			if svc != nil {
				svcs = append(svcs, svc)
			}
		case *kappsv1.DaemonSet:
			svc := addService(t.Spec.Template.Spec.Containers, t.ObjectMeta, t.Spec.Template.Labels, firstPortOnly)
			if svc != nil {
				svcs = append(svcs, svc)
			}
		case *extensionsv1beta1.DaemonSet:
			svc := addService(t.Spec.Template.Spec.Containers, t.ObjectMeta, t.Spec.Template.Labels, firstPortOnly)
			if svc != nil {
				svcs = append(svcs, svc)
			}
		case *kappsv1beta2.DaemonSet:
			svc := addService(t.Spec.Template.Spec.Containers, t.ObjectMeta, t.Spec.Template.Labels, firstPortOnly)
			if svc != nil {
				svcs = append(svcs, svc)
			}
		}
	}
	return append(objects, svcs...)
}
1364320
func (s *CreateDeploymentGroupInput) SetEcsServices(v []*ECSService) *CreateDeploymentGroupInput {
	s.EcsServices = v
	return s
}
528466
func (s *Supervisor) Add(service Service, opts ...ServiceOption) {
	s.addService(service, opts...)
}
1003206
func (s *EventTypeFilter) SetServices(v []*string) *EventTypeFilter {
	s.Services = v
	return s
}
2228
func (s *ErrorRootCause) SetServices(v []*ErrorRootCauseService) *ErrorRootCause {
	s.Services = v
	return s
}
126416
func (d *Device) SetServices(svcs []*ble.Service) error {
	return d.Server.SetServices(svcs)
}
55400
func (w *Watchdog) AddService(name, binary string) (*Service, error) {
	if _, ok := w.services[name]; ok {
		return nil, fmt.Errorf("Service %q already exists", name)
	}

	svc := newService(name, binary)
	w.services[name] = svc

	return svc, nil
}
686179
func (c *AvailableConditionController) addService(obj interface{}) {
	for _, apiService := range c.getAPIServicesFor(obj.(*v1.Service)) {
		c.enqueue(apiService)
	}
}
370451
func (service *BaseService) AddInstanceMethods(obj interface{}, option ...Options) Service {
	service.methodManager.AddInstanceMethods(obj, option...)
	return service
}
392710
func (a *Accessory) AddService(s *service.Service) {
	a.Services = append(a.Services, s)
}
152131
func (i *Infrastructure) AddServiceServer(serviceName string, addr Address) error {
	i.Lock.RLock()
	if _, ok := i.Services[serviceName]; !ok {
		i.Lock.RUnlock()
		return ErrServiceNotExists
	}
	i.Lock.RUnlock()
	i.Lock.Lock()
	if i.Services[serviceName].Addresses == nil {
		i.Services[serviceName].Addresses = make([]Address, 0)
	}
	i.UpdateTimestamp = time.Now().UnixNano()
	i.Services[serviceName].Addresses = append(i.Services[serviceName].Addresses, addr)
	i.Lock.Unlock()
	return nil
}
184989
func AddService(configuration *config.HTTPConfiguration, serviceName string, service *config.Service) bool {
	if _, ok := configuration.Services[serviceName]; !ok {
		configuration.Services[serviceName] = service
		return true
	}

	if !configuration.Services[serviceName].LoadBalancer.Mergeable(service.LoadBalancer) {
		return false
	}

	configuration.Services[serviceName].LoadBalancer.Servers = append(configuration.Services[serviceName].LoadBalancer.Servers, service.LoadBalancer.Servers...)
	return true
}
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
}
1336936
func SetServices(svcs []*Service) error {
	if defaultDevice == nil {
		return ErrDefaultDevice
	}
	return defaultDevice.SetServices(svcs)
}
1269683
func (lb *LoadBalancer) AddService(svc LBSVC) bool {
	scopedLog := log.WithFields(logrus.Fields{
		logfields.ServiceName: svc.FE.String(),
		logfields.SHA:         svc.Sha256,
	})

	oldSvc, ok := lb.SVCMapID[ServiceID(svc.FE.ID)]
	if ok {
		// If service already existed, remove old entry from Cilium's map
		scopedLog.Debug("service is already in lb.SVCMapID; deleting old entry and updating it with new entry")
		delete(lb.SVCMap, oldSvc.Sha256)
		updateMetric.Inc()
	} else {
		addMetric.Inc()
	}
	scopedLog.Debug("adding service to loadbalancer")
	lb.SVCMap[svc.Sha256] = svc
	lb.SVCMapID[ServiceID(svc.FE.ID)] = &svc
	return !ok
}
959625
func (s *storeImpl) addUpdatedServicesFromCache(ctx datastore.Context, svcs []Service, since time.Time) ([]Service, error) {
	// Make a map of service ids so we don't duplicate services from our cache.
	svcMap := make(map[string]struct{})
	for _, svc := range svcs {
		svcMap[svc.ID] = struct{}{}
	}

	// If getting these one at a time turns out to be hard on elastic, we can
	// later try batching the elastic queries for sets of N ids until we go
	// through the whole list with a new elastic search.
	for _, cacheEntry := range s.getUpdatedCacheEntries(since) { // single Mutex RLock
		// Don't add services already in the list.
		if _, ok := svcMap[cacheEntry.ID]; !ok {
			// Query the service from elastic.  We already have the cached
			// data, so we save making a mutex lock here for every service
			// by called s.get() and updating the service without needing
			// additional mutex locks.
			if svc, err := s.get(ctx, cacheEntry.ID); err != nil {
				return svcs, err
			} else {
				// Fill additional info without a mutex lock.
				s.fillConfig(svc)
				s.updateServiceFromVolatileService(svc, cacheEntry)
				svcs = append(svcs, *svc)
			}
		} else {
			plog.WithField("serviceid", cacheEntry.ID).Debug("Skipping service because it is already cached")
		}
	}
	return svcs, nil
}
439878
func (s *CreateTaskSetInput) SetServiceRegistries(v []*ServiceRegistry) *CreateTaskSetInput {
	s.ServiceRegistries = v
	return s
}