// NewRestrictedEndpointsAdmission creates a new endpoints admission plugin.
336438
func NewRestrictedEndpointsAdmission(restrictedNetworks []*net.IPNet) *restrictedEndpointsAdmission {
	return &restrictedEndpointsAdmission{
		Handler:            admission.NewHandler(admission.Create, admission.Update),
		restrictedNetworks: restrictedNetworks,
	}
}
903441
func newEndpoints(c *CoreV1Client, namespace string) *endpoints {
	return &endpoints{
		client: c.RESTClient(),
		ns:     namespace,
	}
}
709592
func (o *PutEndpointIDParams) WithEndpoint(endpoint *models.EndpointChangeRequest) *PutEndpointIDParams {
	o.SetEndpoint(endpoint)
	return o
}
760731
func NewEndpoint(serviceName string, hostPort string) (*model.Endpoint, error) {
	e := &model.Endpoint{
		ServiceName: serviceName,
	}

	if hostPort == "" || hostPort == ":0" {
		if serviceName == "" {
			// if all properties are empty we should not have an Endpoint object.
			return nil, nil
		}
		return e, nil
	}

	if strings.IndexByte(hostPort, ':') < 0 {
		hostPort += ":0"
	}

	host, port, err := net.SplitHostPort(hostPort)
	if err != nil {
		return nil, err
	}

	p, err := strconv.ParseUint(port, 10, 16)
	if err != nil {
		return nil, err
	}
	e.Port = uint16(p)

	addrs, err := net.LookupIP(host)
	if err != nil {
		return nil, err
	}

	for i := range addrs {
		addr := addrs[i].To4()
		if addr == nil {
			// IPv6 - 16 bytes
			if e.IPv6 == nil {
				e.IPv6 = addrs[i].To16()
			}
		} else {
			// IPv4 - 4 bytes
			if e.IPv4 == nil {
				e.IPv4 = addr
			}
		}
		if e.IPv4 != nil && e.IPv6 != nil {
			// Both IPv4 & IPv6 have been set, done...
			break
		}
	}

	return e, nil
}
611194
func (b ConnectionStringBuilder) WithEndpoint(endpoint string) ConnectionStringBuilder {
	b.endpoint = endpoint
	return b
}
282113
func NewLinkPermissions(CanRevoke bool) *LinkPermissions {
	s := new(LinkPermissions)
	s.CanRevoke = CanRevoke
	return s
}
1059910
func (p *protocol) NewEndpoint(nicid tcpip.NICID, addr tcpip.Address, linkAddrCache stack.LinkAddressCache, dispatcher stack.TransportDispatcher, linkEP stack.LinkEndpoint) (stack.NetworkEndpoint, *tcpip.Error) {
	e := &endpoint{
		nicid:         nicid,
		id:            stack.NetworkEndpointID{LocalAddress: addr},
		linkEP:        linkEP,
		dispatcher:    dispatcher,
		fragmentation: fragmentation.NewFragmentation(fragmentation.HighFragThreshold, fragmentation.LowFragThreshold, fragmentation.DefaultReassembleTimeout),
	}

	return e, nil
}
1255638
func (i *IngressRule) GetSourceEndpointSelectors() EndpointSelectorSlice {
	if i.aggregatedSelectors == nil {
		i.SetAggregatedSelectors()
	}
	return i.aggregatedSelectors
}
344622
func NewGrantPermissionsArgs(origin string, permissions []PermissionType) *GrantPermissionsArgs {
	args := new(GrantPermissionsArgs)
	args.Origin = origin
	args.Permissions = permissions
	return args
}
335897
func NewErroringLimiter(limit Allower) endpoint.Middleware {
	return func(next endpoint.Endpoint) endpoint.Endpoint {
		return func(ctx context.Context, request interface{}) (interface{}, error) {
			if !limit.Allow() {
				return nil, ErrLimited
			}
			return next(ctx, request)
		}
	}
}
1174830
func WriteEndpoint(keys []*lxcmap.EndpointKey, pm *policymap.PolicyMap) error {
	return writeEndpoint(keys, pm.GetFd())
}
695920
func (cp *connProducer) UpdateEndpoints(endpoints []string) {
	if len(endpoints) == 0 {
		// Ignore updates with empty endpoints
		return
	}
	cp.Lock()
	defer cp.Unlock()

	newDisabled := make(map[string]time.Time)
	for i := range endpoints {
		if startTime, ok := cp.disabledEndpoints[endpoints[i]]; ok {
			newDisabled[endpoints[i]] = startTime
		}
	}
	cp.endpoints = endpoints
	cp.disabledEndpoints = newDisabled
}
784451
func NewInjectableEndpoint(routes map[tcpip.Address]stack.InjectableLinkEndpoint) (tcpip.LinkEndpointID, *InjectableEndpoint) {
	e := &InjectableEndpoint{
		routes: routes,
	}
	return stack.RegisterLinkEndpoint(e), e
}
834520
func (s *VpcConfigResponse) SetEndpointPublicAccess(v bool) *VpcConfigResponse {
	s.EndpointPublicAccess = &v
	return s
}
6119
func NewPermission(a Action, r Resource) (*Permission, error) {
	p := &Permission{
		Action:   a,
		Resource: r,
	}

	return p, p.Valid()
}
914013
func (c *Client) EnablePublicEndpointPort(serviceid, endpointName, portAddr string, isEnabled bool) error {
	request := &PublicEndpointRequest{
		Serviceid:    serviceid,
		EndpointName: endpointName,
		Name:         portAddr,
		IsEnabled:    isEnabled,
	}
	return c.call("EnablePublicEndpointPort", request, nil)
}
1177769
func NewWithEndpoint(auth Auth, region, endpoint string) *Kinesis {
	// TODO: remove trailing slash on endpoint if there is one? does it matter?
	// TODO: validate endpoint somehow?
	return &Kinesis{client: NewClient(auth), version: KinesisVersion, region: region, endpoint: endpoint, streamType: "Kinesis"}
}