// NewLookupService returns a mock of LookupService where its methods will return zero values.
767075
func NewLookupService() *LookupService {
	return &LookupService{
		NameFn: func(ctx context.Context, resource platform.ResourceType, id platform.ID) (string, error) {
			return "", nil
		},
	}
}
91794
func (s *RedisAnnouncementStore) ListService(serviceName string, opts *storage.ListOptions) ([]*Announcement, error) {
	announcementsI, err := s.store.List(serviceName+":*", opts)
	if err != nil {
		return nil, err
	}
	announcements := make([]*Announcement, len(announcementsI))
	for i, announcementI := range announcementsI {
		if announcement, ok := announcementI.(Announcement); ok {
			announcements[i] = &announcement
			announcement.Metadata, err = s.GetMetadata(announcement.ServiceName, announcement.ID)
			if err != nil {
				return nil, err
			}
		}
	}
	return announcements, nil
}
821258
func NewGetMappingService(client *Client) *GetMappingService {
	return &GetMappingService{
		client: client,
		index:  make([]string, 0),
		typ:    make([]string, 0),
	}
}
56849
func Lookup(service string, entries chan<- *ServiceEntry) error {
	params := DefaultParams(service)
	params.Entries = entries
	return Query(params)
}
975610
func NewOSOSubscriptionService(context servicecontext.ServiceContext, config OSOSubscriptionServiceConfiguration) service.OSOSubscriptionService {
	return &osoSubscriptionServiceImpl{
		BaseService: base.NewBaseService(context),
		config:      config,
		httpClient:  http.DefaultClient,
	}
}
420214
func (ens *NetpluginNameServer) NsLookup(nsq []byte, vrfPtr *string) ([]byte, error) {
	tenant := *vrfPtr
	req := new(dns.Msg)
	err := req.Unpack(nsq)
	if err != nil {
		ens.incTenantStats(tenant, "invalidQuery")
		return nil, err
	}

	// no fancy requests
	if req.Response {
		ens.incTenantStats(tenant, "invalidQuery")
		return nil, errors.New("")
	}

	if req.IsTsig() != nil {
		ens.incTenantStats(tenant, "invalidQuery")
		return nil, errors.New("")
	}

	d, err := ens.serveNameRecord(tenant, req)
	if err != nil {
		logrus.Infof("no name record: %s", err)
		ens.incTenantStats(tenant, "noNameRecord")
		return nil, err
	}

	ens.incTenantStats(tenant, "foundNameRecord")
	return d, err

}
1217604
func NewDiscoveryFilterService(discoveryService fab.DiscoveryService, targetFilter fab.TargetFilter) fab.DiscoveryService {
	return &filterService{discoveryService: discoveryService, targetFilter: targetFilter}
}
852143
func NewOnboardingService() *OnboardingService {
	return &OnboardingService{
		IsOnboardingFn: func(context.Context) (bool, error) { return false, nil },
		GenerateFn: func(context.Context, *platform.OnboardingRequest) (*platform.OnboardingResults, error) {
			return nil, nil
		},
	}
}
93465
func NewClusterService(id ServiceID, k8sService *Service, k8sEndpoints *Endpoints) service.ClusterService {
	svc := service.NewClusterService(id.Name, id.Namespace)

	for key, value := range k8sService.Labels {
		svc.Labels[key] = value
	}

	for key, value := range k8sService.Selector {
		svc.Selector[key] = value
	}

	portConfig := service.PortConfiguration{}
	for portName, port := range k8sService.Ports {
		portConfig[string(portName)] = port.L4Addr
	}

	svc.Frontends = map[string]service.PortConfiguration{}
	svc.Frontends[k8sService.FrontendIP.String()] = portConfig

	svc.Backends = map[string]service.PortConfiguration{}
	for ipString, portConfig := range k8sEndpoints.Backends {
		svc.Backends[ipString] = portConfig
	}

	return svc
}
947983
func NewMockLXDProfileMachine(ctrl *gomock.Controller) *MockLXDProfileMachine {
	mock := &MockLXDProfileMachine{ctrl: ctrl}
	mock.recorder = &MockLXDProfileMachineMockRecorder{mock}
	return mock
}
549498
func NewMockServiceAccountInterface(ctrl *gomock.Controller) *MockServiceAccountInterface {
	mock := &MockServiceAccountInterface{ctrl: ctrl}
	mock.recorder = &MockServiceAccountInterfaceMockRecorder{mock}
	return mock
}
152210
func (d *DNSServer) serviceLookup(cfg *dnsConfig, network, datacenter, service, tag string, connect bool, req, resp *dns.Msg, maxRecursionLevel int) {
	out, err := d.lookupServiceNodes(cfg, datacenter, service, tag, connect, maxRecursionLevel)
	if err != nil {
		d.logger.Printf("[ERR] dns: rpc error: %v", err)
		resp.SetRcode(req, dns.RcodeServerFailure)
		return
	}

	// If we have no nodes, return not found!
	if len(out.Nodes) == 0 {
		d.addSOA(cfg, resp)
		resp.SetRcode(req, dns.RcodeNameError)
		return
	}

	// Perform a random shuffle
	out.Nodes.Shuffle()

	// Determine the TTL
	ttl, _ := cfg.GetTTLForService(service)

	// Add various responses depending on the request
	qType := req.Question[0].Qtype
	if qType == dns.TypeSRV {
		d.serviceSRVRecords(cfg, datacenter, out.Nodes, req, resp, ttl, maxRecursionLevel)
	} else {
		d.serviceNodeRecords(cfg, datacenter, out.Nodes, req, resp, ttl, maxRecursionLevel)
	}

	d.trimDNSResponse(cfg, network, req, resp)

	// If the answer is empty and the response isn't truncated, return not found
	if len(resp.Answer) == 0 && !resp.Truncated {
		d.addSOA(cfg, resp)
		return
	}
}
905441
func NewCountService(client *Client) *CountService {
	return &CountService{
		client: client,
		index:  make([]string, 0),
		typ:    make([]string, 0),
	}
}
94009
func NewIndicesAnalyzeService(client *Client) *IndicesAnalyzeService {
	return &IndicesAnalyzeService{
		client:  client,
		request: new(IndicesAnalyzeRequest),
	}
}
1003082
func LoadServices(servicesDict map[string]interface{}, workingDir string, lookupEnv template.Mapping) ([]types.ServiceConfig, error) {
	var services []types.ServiceConfig

	for name, serviceDef := range servicesDict {
		serviceConfig, err := LoadService(name, serviceDef.(map[string]interface{}), workingDir, lookupEnv)
		if err != nil {
			return nil, err
		}
		services = append(services, *serviceConfig)
	}

	return services, nil
}
1357228
func NewLookup(registry registry.Registry, rep metrics.ProxyReporter, logger logger.Logger) negroni.Handler {
	return &lookupHandler{
		registry: registry,
		reporter: rep,
		logger:   logger,
	}
}
165676
func (a *Client) PostLookups(params *PostLookupsParams, authInfo runtime.ClientAuthInfoWriter) (*PostLookupsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPostLookupsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "PostLookups",
		Method:             "POST",
		PathPattern:        "/lookups",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &PostLookupsReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*PostLookupsOK), nil
}