// NewInjectable creates a new fd-based InjectableEndpoint.
779629
func NewInjectable(fd int, mtu uint32, capabilities stack.LinkEndpointCapabilities) (tcpip.LinkEndpointID, *InjectableEndpoint) {
	syscall.SetNonblock(fd, true)

	e := &InjectableEndpoint{endpoint: endpoint{
		fd:   fd,
		mtu:  mtu,
		caps: capabilities,
	}}

	return stack.RegisterLinkEndpoint(e), e
}
674049
func (f *identityProviderFactoryImpl) NewIdentityProvider(ctx context.Context, config provider.IdentityProviderConfiguration) provider.IdentityProvider {
	return provider.NewIdentityProvider(config)
}
326217
func (c *environClient) newInstance(
	args environs.StartInstanceParams,
	img *imagemetadata.ImageMetadata,
	userData []byte,
	authorizedKeys string,
) (srv gosigma.Server, drv gosigma.Drive, ar string, err error) {

	defer func() {
		if err == nil {
			return
		}
		if srv != nil {
			srv.Remove(gosigma.RecurseAllDrives)
		} else if drv != nil {
			drv.Remove()
		}
		srv = nil
		drv = nil
	}()

	if args.InstanceConfig == nil {
		err = errors.New("invalid configuration for new instance: InstanceConfig is nil")
		return nil, nil, "", err
	}

	logger.Debugf("Tools: %v", args.Tools.URLs())
	logger.Debugf("Juju Constraints:" + args.Constraints.String())
	logger.Debugf("InstanceConfig: %#v", args.InstanceConfig)

	constraints := newConstraints(args.InstanceConfig.Bootstrap != nil, args.Constraints, img)
	logger.Debugf("CloudSigma Constraints: %v", constraints)

	originalDrive, err := c.conn.Drive(constraints.driveTemplate, gosigma.LibraryMedia)
	if err != nil {
		err = errors.Annotatef(err, "Failed to query drive template")
		return nil, nil, "", err
	}

	baseName := "juju-" + c.uuid + "-" + args.InstanceConfig.MachineId

	cloneParams := gosigma.CloneParams{Name: baseName}
	if drv, err = originalDrive.CloneWait(cloneParams, nil); err != nil {
		err = errors.Errorf("error cloning drive: %v", err)
		return nil, nil, "", err
	}

	if drv.Size() < constraints.driveSize {
		if err = drv.ResizeWait(constraints.driveSize); err != nil {
			err = errors.Errorf("error resizing drive: %v", err)
			return nil, nil, "", err
		}
	}

	cc, err := c.generateSigmaComponents(
		baseName, constraints, args, drv, userData, authorizedKeys,
	)
	if err != nil {
		return nil, nil, "", errors.Trace(err)
	}

	if srv, err = c.conn.CreateServer(cc); err != nil {
		err = errors.Annotatef(err, "error creating new instance")
		return nil, nil, "", err
	}

	if err = srv.Start(); err != nil {
		err = errors.Annotatef(err, "error booting new instance")
		return nil, nil, "", err
	}

	// populate root drive hardware characteristics
	switch originalDrive.Arch() {
	case "64":
		ar = arch.AMD64
	case "32":
		ar = arch.I386
	default:
		err = errors.Errorf("unknown arch: %v", ar)
		return nil, nil, "", err
	}

	return srv, drv, ar, nil
}
882232
func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
	epOptions map[string]interface{}) error {
	defer osl.InitOSContext()()

	if err := validateID(nid, eid); err != nil {
		return err
	}
	n, err := d.getNetwork(nid)
	if err != nil {
		return fmt.Errorf("network id %q not found", nid)
	}
	if ifInfo.MacAddress() != nil {
		return fmt.Errorf("%s interfaces do not support custom mac address assignment", ipvlanType)
	}
	ep := &endpoint{
		id:     eid,
		nid:    nid,
		addr:   ifInfo.Address(),
		addrv6: ifInfo.AddressIPv6(),
	}
	if ep.addr == nil {
		return fmt.Errorf("create endpoint was not passed an IP address")
	}
	// disallow port mapping -p
	if opt, ok := epOptions[netlabel.PortMap]; ok {
		if _, ok := opt.([]types.PortBinding); ok {
			if len(opt.([]types.PortBinding)) > 0 {
				logrus.Warnf("%s driver does not support port mappings", ipvlanType)
			}
		}
	}
	// disallow port exposure --expose
	if opt, ok := epOptions[netlabel.ExposedPorts]; ok {
		if _, ok := opt.([]types.TransportPort); ok {
			if len(opt.([]types.TransportPort)) > 0 {
				logrus.Warnf("%s driver does not support port exposures", ipvlanType)
			}
		}
	}

	if err := d.storeUpdate(ep); err != nil {
		return fmt.Errorf("failed to save ipvlan endpoint %.7s to store: %v", ep.id, err)
	}

	n.addEndpoint(ep)

	return nil
}
701672
func (s *QuotaService) NewQuotaIsEnabledParams() *QuotaIsEnabledParams {
	p := &QuotaIsEnabledParams{}
	p.p = make(map[string]interface{})
	return p
}
792342
func NewBuilder(mapper meta.RESTMapper, typer runtime.ObjectTyper, clientMapper ClientMapper, decoder runtime.Decoder) *Builder {
	return &Builder{
		mapper:        &Mapper{typer, mapper, clientMapper, decoder},
		requireObject: true,
	}
}
1191689
func NewGetEndpoint(ctx *middleware.Context, handler GetEndpointHandler) *GetEndpoint {
	return &GetEndpoint{Context: ctx, Handler: handler}
}
1169415
func (m *InjectableEndpoint) Attach(dispatcher stack.NetworkDispatcher) {
	for _, endpoint := range m.routes {
		endpoint.Attach(dispatcher)
	}
	m.dispatcher = dispatcher
}
111608
func (d *Provider) AddInjectors(injectors []dependency.Injector) error {
	if d.blocked {
		return fmt.Errorf("goatcore/dependency/provider.AddInjectors: can not add new injector after got dependency")
	}
	d.injectors = append(d.injectors, injectors...)
	return nil
}
375375
func NewOIDCProvider(issuerURL string, client *http.Client) Provider {
	return &providerImpl{
		issuerURL: issuerURL,
		client:    client,
	}
}
444041
func New(lower tcpip.LinkEndpointID) (tcpip.LinkEndpointID, *Endpoint) {
	e := &Endpoint{
		lower: stack.FindLinkEndpoint(lower),
	}
	return stack.RegisterLinkEndpoint(e), e
}
1180057
func (m *InjectableEndpoint) Capabilities() stack.LinkEndpointCapabilities {
	minCapabilities := stack.LinkEndpointCapabilities(^uint(0))
	for _, endpoint := range m.routes {
		minCapabilities &= endpoint.Capabilities()
	}
	return minCapabilities
}
236743
func NewInjector(name string) *Injector {
	var failPercent, _ = strconv.Atoi(os.Getenv("FAULT_" + strings.ToUpper(name) + "_FAIL_PERCENT"))
	return &Injector{
		failPercent: failPercent,
	}
}
546695
func newImmutable(root *treapNode, count int, totalSize uint64) *Immutable {
	return &Immutable{root: root, count: count, totalSize: totalSize}
}
452742
func NewInvoker(handler Handler, opts ...InvokerOpt) *RetryableInvoker {
	invoker := &RetryableInvoker{
		handler: handler,
	}
	for _, opt := range opts {
		opt(invoker)
	}
	return invoker
}
481084
func (ec2i *FakeEC2Impl) CreateRouteTable(request *ec2.RouteTable) (*ec2.CreateRouteTableOutput, error) {
	ec2i.RouteTables = append(ec2i.RouteTables, request)
	response := &ec2.CreateRouteTableOutput{
		RouteTable: request,
	}
	return response, nil
}
760225
func (*protocol) NewEndpoint(stack *stack.Stack, netProto tcpip.NetworkProtocolNumber, waiterQueue *waiter.Queue) (tcpip.Endpoint, *tcpip.Error) {
	return newEndpoint(stack, netProto, waiterQueue), nil
}