// GetEndpointStats invokes ofnetAgent api
558362
func (sw *OvsSwitch) GetEndpointStats() (map[string]*ofnet.OfnetEndpointStats, error) {
	if sw.ofnetAgent == nil {
		return nil, errors.New("no ofnet agent")
	}

	stats, err := sw.ofnetAgent.GetEndpointStats()
	if err != nil {
		log.Errorf("Error: %v", err)
		return nil, err
	}

	log.Debugf("stats: %+v", stats)

	return stats, nil
}
475968
func findOtherEndpoint(endpoints []params.EndpointStatus, applicationName string) (params.EndpointStatus, bool) {
	for _, endpoint := range endpoints {
		if endpoint.ApplicationName != applicationName {
			return endpoint, true
		}
	}
	return params.EndpointStatus{}, false
}
598787
func (g *Cloud) AttachNetworkEndpoints(name, zone string, endpoints []*computebeta.NetworkEndpoint) error {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newNetworkEndpointGroupMetricContext("attach", zone)
	req := &computebeta.NetworkEndpointGroupsAttachEndpointsRequest{
		NetworkEndpoints: endpoints,
	}
	return mc.Observe(g.c.BetaNetworkEndpointGroups().AttachNetworkEndpoints(ctx, meta.ZonalKey(name, zone), req))
}
1362713
func (s *endpointsLister) Endpoints(namespace string) EndpointsNamespaceLister {
	return endpointsNamespaceLister{indexer: s.indexer, namespace: namespace}
}
675308
func GetRemotePeers(endpoints EndpointList) []string {
	peerSet := set.NewStringSet()
	for _, endpoint := range endpoints {
		if endpoint.Type() != URLEndpointType {
			continue
		}

		peer := endpoint.Host
		if endpoint.IsLocal {
			if _, port := mustSplitHostPort(peer); port == globalMinioPort {
				continue
			}
		}

		peerSet.Add(peer)
	}

	return peerSet.ToSlice()
}
858878
func (lbc *loadBalancerController) getEndpoints(
	s *api.Service, servicePort *api.ServicePort) (endpoints []string) {
	ep, err := lbc.epLister.GetServiceEndpoints(s)
	if err != nil {
		return
	}

	// The intent here is to create a union of all subsets that match a targetPort.
	// We know the endpoint already matches the service, so all pod ips that have
	// the target port are capable of service traffic for it.
	for _, ss := range ep.Subsets {
		for _, epPort := range ss.Ports {
			var targetPort int
			switch servicePort.TargetPort.Type {
			case intstr.Int:
				if epPort.Port == getTargetPort(servicePort) {
					targetPort = epPort.Port
				}
			case intstr.String:
				if epPort.Name == servicePort.TargetPort.StrVal {
					targetPort = epPort.Port
				}
			}
			if targetPort == 0 {
				continue
			}
			for _, epAddress := range ss.Addresses {
				endpoints = append(endpoints, fmt.Sprintf("%v:%v", epAddress.IP, targetPort))
			}
		}
	}
	return
}
518820
func (s *StoreToEndpointsLister) GetServiceEndpoints(svc *api.Service) (ep api.Endpoints, err error) {
	for _, m := range s.Store.List() {
		ep = *m.(*api.Endpoints)
		if svc.Name == ep.Name && svc.Namespace == ep.Namespace {
			return ep, nil
		}
	}
	err = fmt.Errorf("could not find endpoints for service: %v", svc.Name)
	return
}
1255638
func (i *IngressRule) GetSourceEndpointSelectors() EndpointSelectorSlice {
	if i.aggregatedSelectors == nil {
		i.SetAggregatedSelectors()
	}
	return i.aggregatedSelectors
}
687310
func (client *Client) getEndpointByLocation() string {
	locationClient := NewLocationClient(client.AccessKeyId, client.AccessKeySecret, client.securityToken)
	locationClient.SetDebug(true)
	return locationClient.DescribeOpenAPIEndpoint(client.regionID, client.serviceCode)
}
211299
func (s *XDSServer) getLocalEndpoint(networkPolicyName string) logger.EndpointUpdater {
	s.mutex.RLock()
	defer s.mutex.RUnlock()

	return s.networkPolicyEndpoints[networkPolicyName]
}
705922
func (f *Facade) GetServicePublicEndpoints(ctx datastore.Context, serviceID string, children bool) ([]service.PublicEndpoint, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetServicePublicEndpoints"))

	pubeps := []service.PublicEndpoint{}
	if children {
		allPeps, err := f.GetAllPublicEndpoints(ctx)
		if err != nil {
			return pubeps, err
		}
		for _, pep := range allPeps {
			if pep.ServiceID == serviceID {
				pubeps = append(pubeps, pep)
			} else {
				// Determine if serviceID is a parent
				detail, err := f.GetServiceDetailsAncestry(ctx, pep.ServiceID)
				if err != nil {
					return pubeps, err
				}
				for detail != nil {
					if detail.ID == serviceID {
						pubeps = append(pubeps, pep)
						break
					}
					detail = detail.Parent
				}
			}
		}
	} else {
		svc, err := f.serviceStore.Get(ctx, serviceID)

		if err != nil {
			return nil, err
		}
		pubeps = f.getServicePublicEndpoints(*svc)
	}
	return pubeps, nil

}
578570
func (c *agencyConnection) Endpoints() []string {
	c.mutex.RLock()
	defer c.mutex.RUnlock()

	var result []string
	for _, x := range c.connections {
		result = append(result, x.Endpoints()...)
	}
	return result
}
104164
func (ect *EndpointChangeTracker) endpointsToEndpointsMap(endpoints *v1.Endpoints) EndpointsMap {
	if endpoints == nil {
		return nil
	}

	endpointsMap := make(EndpointsMap)
	// We need to build a map of portname -> all ip:ports for that
	// portname.  Explode Endpoints.Subsets[*] into this structure.
	for i := range endpoints.Subsets {
		ss := &endpoints.Subsets[i]
		for i := range ss.Ports {
			port := &ss.Ports[i]
			if port.Port == 0 {
				klog.Warningf("ignoring invalid endpoint port %s", port.Name)
				continue
			}
			svcPortName := ServicePortName{
				NamespacedName: types.NamespacedName{Namespace: endpoints.Namespace, Name: endpoints.Name},
				Port:           port.Name,
			}
			for i := range ss.Addresses {
				addr := &ss.Addresses[i]
				if addr.IP == "" {
					klog.Warningf("ignoring invalid endpoint port %s with empty host", port.Name)
					continue
				}
				// Filter out the incorrect IP version case.
				// Any endpoint port that contains incorrect IP version will be ignored.
				if ect.isIPv6Mode != nil && utilnet.IsIPv6String(addr.IP) != *ect.isIPv6Mode {
					// Emit event on the corresponding service which had a different
					// IP version than the endpoint.
					utilproxy.LogAndEmitIncorrectIPVersionEvent(ect.recorder, "endpoints", addr.IP, endpoints.Name, endpoints.Namespace, "")
					continue
				}
				isLocal := addr.NodeName != nil && *addr.NodeName == ect.hostname
				baseEndpointInfo := newBaseEndpointInfo(addr.IP, int(port.Port), isLocal)
				if ect.makeEndpointInfo != nil {
					endpointsMap[svcPortName] = append(endpointsMap[svcPortName], ect.makeEndpointInfo(baseEndpointInfo))
				} else {
					endpointsMap[svcPortName] = append(endpointsMap[svcPortName], baseEndpointInfo)
				}
			}
			if klog.V(3) {
				newEPList := []string{}
				for _, ep := range endpointsMap[svcPortName] {
					newEPList = append(newEPList, ep.String())
				}
				klog.Infof("Setting endpoints for %q to %+v", svcPortName, newEPList)
			}
		}
	}
	return endpointsMap
}
1036176
func (o *InfrastructureAccessProfile) Connectionendpoints(info *bambou.FetchingInfo) (ConnectionendpointsList, *bambou.Error) {

	var list ConnectionendpointsList
	err := bambou.CurrentSession().FetchChildren(o, ConnectionendpointIdentity, &list, info)
	return list, err
}
1372218
func (a *Client) GetEndpoint(params *GetEndpointParams) (*GetEndpointOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetEndpointParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "GetEndpoint",
		Method:             "GET",
		PathPattern:        "/endpoint",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetEndpointReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetEndpointOK), nil

}
756859
func getEndpoints(ctx *app.ListEndpointsContext, fileHandler asseter) (*app.Endpoints, error) {
	// Get an unmarshal swagger specification
	swaggerJSON, err := fileHandler.Asset(embeddedSwaggerSpecFile)
	if err != nil {
		// TODO(tinakurian): fix error handling
		return nil, errors.NewNotFoundError("file", embeddedSwaggerSpecFile)
	}

	var result map[string]interface{}
	err = json.Unmarshal(swaggerJSON, &result)
	if err != nil {
		return nil, errs.Wrapf(err, `unable to unmarshal the file with id "%s"`, embeddedSwaggerSpecFile)
	}

	// Get and iterate over paths from swagger specification.
	swaggerPaths, ok := result["paths"]
	if !ok {
		return nil, errors.NewInternalErrorFromString(`failed to find field "paths" in swagger specification`)
	}

	swaggerPathz, ok := swaggerPaths.(map[string]interface{})
	if !ok {
		return nil, errors.NewInternalErrorFromString(`unable to assert concrete type map for field "paths" in swagger specification`)
	}

	basePathObj, ok := result["basePath"]
	if !ok {
		return nil, errors.NewInternalErrorFromString(`failed to find field "basePath" in swagger specification`)
	}

	basePath, ok := basePathObj.(string)
	if !ok {
		return nil, errors.NewInternalErrorFromString(`unable to assert concrete type string for field "basePath" in swagger specification`)
	}

	absoluteBasePath := rest.AbsoluteURL(ctx.Request, basePath)

	// the namedPaths map stores paths as key and URLs as values
	namedPaths := make(map[string]interface{})
	for path, swaggerPath := range swaggerPathz {

		// Currently not supporting endpoints that contain parameters.
		if !strings.Contains(path, "{") {
			key := path

			pathsObj, ok := swaggerPath.(map[string]interface{})
			if !ok {
				return nil, errors.NewInternalErrorFromString("unable to assert concrete type map for field `paths` in swagger specification")
			}

			// Get the x-tag value. If the tag exists, use it as path name.
			xtagObj, ok := pathsObj["x-tag"]
			if ok {
				xtag, ok := xtagObj.(string)
				if !ok {
					return nil, errors.NewInternalErrorFromString("unable to assert concrete type string for field `x-tag` in swagger specification")
				}

				key = xtag
			}

			// cleanup the key to conform to JSONAPI member names
			key = jsonapi.FormatMemberName(key)

			// Set the related field and link objects for each name.
			if key != "" {
				namedPaths[key] = map[string]interface{}{
					"links": map[string]string{
						"related": absoluteBasePath + path,
					},
				}
			}
		}
	}

	return &app.Endpoints{
		Type:          "endpoints",
		ID:            uuid.NewV4(),
		Relationships: namedPaths,
		Links: &app.GenericLinks{
			Self: ptr.String(absoluteBasePath),
		},
	}, nil
}
238403
func (s *ListEndpointsByPlatformApplicationOutput) SetEndpoints(v []*Endpoint) *ListEndpointsByPlatformApplicationOutput {
	s.Endpoints = v
	return s
}