// GetService returns the service entry that is currently configured in the
// kernel IPVS table, which matches the specified service.
429009
func GetService(svc *Service) (*Service, error) {
	svcs, err := services(svc)
	if err != nil {
		return nil, err
	}
	if len(svcs) == 0 {
		return nil, errors.New("no service found")
	}
	return svcs[0], nil
}
741397
func (_m *FacadeInterface) GetServiceInstances(ctx datastore.Context, since time.Time, serviceid string) ([]service.Instance, error) {
	ret := _m.Called(ctx, since, serviceid)

	var r0 []service.Instance
	if rf, ok := ret.Get(0).(func(datastore.Context, time.Time, string) []service.Instance); ok {
		r0 = rf(ctx, since, serviceid)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]service.Instance)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(datastore.Context, time.Time, string) error); ok {
		r1 = rf(ctx, since, serviceid)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
757582
func (f *Facade) getServices(ctx datastore.Context) ([]service.Service, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.getServices"))
	plog.Debug("Started Facade.getServices")
	defer plog.Debug("Finished Facade.getServices")

	store := f.serviceStore
	results, err := store.GetServices(ctx)
	if err != nil {
		plog.WithError(err).Error("Unable to get a list of all services")
		return results, err
	}
	return results, nil
}
1020682
func (client *Client) GetServiceInstance(serviceInstanceGUID string) (ServiceInstance, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetServiceInstanceRequest,
		URIParams:   Params{"service_instance_guid": serviceInstanceGUID},
	})
	if err != nil {
		return ServiceInstance{}, nil, err
	}

	var serviceInstance ServiceInstance
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &serviceInstance,
	}

	err = client.connection.Make(request, &response)
	return serviceInstance, response.Warnings, err
}
912790
func (v *GenerateServiceRequest) GetServices() (o map[ServiceID]*Service) {
	if v != nil {
		o = v.Services
	}
	return
}
32745
func GetConfigService(c context.Context) configInterface.Interface {
	if iface, ok := c.Value(&configInterfaceKey).(configInterface.Interface); ok {
		return iface
	}
	return nil
}
512296
func (ic *IngressIPController) getCachedService(key string) *v1.Service {
	if len(key) == 0 {
		return nil
	}
	if obj, exists, err := ic.cache.GetByKey(key); err != nil {
		klog.V(5).Infof("Unable to retrieve service %v from store: %v", key, err)
	} else if !exists {
		klog.V(6).Infof("Service %v has been deleted", key)
	} else {
		return obj.(*v1.Service)
	}
	return nil
}
274447
func getServices(e encoder, adapter PanamaxAdapter) (int, string) {
	data, err := adapter.GetServices()
	if err != nil {
		return sanitizeErrorCode(err.Code), err.Message
	}

	return http.StatusOK, e.Encode(data)
}
1244655
func (_m *Balancer) GetService(name string) (*types.Service, error) {
	ret := _m.Called(name)

	var r0 *types.Service
	if rf, ok := ret.Get(0).(func(string) *types.Service); ok {
		r0 = rf(name)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*types.Service)
		}
	}

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

	return r0, r1
}
1300057
func (s *ServicesService) GetService(serviceIdentifier string) (*serviceResponse, error) {
	path := versioned(servicePath(serviceIdentifier))
	serviceResponse := &serviceResponse{}

	resp, err := s.client.get(path, serviceResponse)
	if err != nil {
		return nil, err
	}

	serviceResponse.HttpResponse = resp
	return serviceResponse, nil
}
432855
func (s *serviceAccount) getServiceAccount(namespace string, name string) (*corev1.ServiceAccount, error) {
	serviceAccount, err := s.serviceAccountLister.ServiceAccounts(namespace).Get(name)
	if err == nil {
		return serviceAccount, nil
	}
	if !errors.IsNotFound(err) {
		return nil, err
	}

	// Could not find in cache, attempt to look up directly
	numAttempts := 1
	if name == DefaultServiceAccountName {
		// If this is the default serviceaccount, attempt more times, since it should be auto-created by the controller
		numAttempts = 10
	}
	retryInterval := time.Duration(rand.Int63n(100)+int64(100)) * time.Millisecond
	for i := 0; i < numAttempts; i++ {
		if i != 0 {
			time.Sleep(retryInterval)
		}
		serviceAccount, err := s.client.CoreV1().ServiceAccounts(namespace).Get(name, metav1.GetOptions{})
		if err == nil {
			return serviceAccount, nil
		}
		if !errors.IsNotFound(err) {
			return nil, err
		}
	}

	return nil, errors.NewNotFound(api.Resource("serviceaccount"), name)
}
1031888
func (m *Module) LookupService(name string) (*ServiceSpec, error) {
	if s, ok := m.Services[name]; ok {
		return s, nil
	}

	return nil, lookupError{Name: name}
}
418842
func (g *GitHttp) getService(path string) (string, *Service) {
	for re, service := range g.services() {
		if m := re.FindStringSubmatch(path); m != nil {
			return m[1], &service
		}
	}

	// No match
	return "", nil
}
199828
func (actor Actor) GetService(serviceGUID string) (Service, Warnings, error) {
	service, warnings, err := actor.CloudControllerClient.GetService(serviceGUID)
	return Service(service), Warnings(warnings), err
}
818541
func (f *Facade) GetServiceList(ctx datastore.Context, serviceID string) ([]*service.Service, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServiceList"))
	svcs := make([]*service.Service, 0, 1)

	err := f.walkServices(ctx, serviceID, true, func(childService *service.Service) error {
		// Populate service config + addr info
		if err := f.fillOutService(ctx, childService); err != nil {
			return err
		}

		svcs = append(svcs, childService)
		return nil
	}, "GetServiceList")

	if err != nil {
		return nil, fmt.Errorf("error assembling list of services: %s", err)
	}

	return svcs, nil
}
143207
func (c *Cluster) GetService(input string, insertDefaults bool) (types.Service, error) {
	var service *swarmapi.Service
	if err := c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
		s, err := getService(ctx, state.controlClient, input, insertDefaults)
		if err != nil {
			return err
		}
		service = s
		return nil
	}); err != nil {
		return types.Service{}, err
	}
	svc, err := convert.ServiceFromGRPC(*service)
	if err != nil {
		return types.Service{}, err
	}
	return svc, nil
}
591279
func (s *Server) GetServiceProvider(r *http.Request, serviceProviderID string) (*saml.EntityDescriptor, error) {
	s.idpConfigMu.RLock()
	defer s.idpConfigMu.RUnlock()
	rv, ok := s.serviceProviders[serviceProviderID]
	if !ok {
		return nil, os.ErrNotExist
	}
	return rv, nil
}