// InstallLegacyRoute this looks like a lot of duplication, but the code in the individual versions is living and may
// change. The code here should never change and needs to allow the other code to move independently.
515735
func InstallInternalLegacyRoute(scheme *runtime.Scheme) {
	InstallExternalLegacyRoute(scheme)

	schemeBuilder := runtime.NewSchemeBuilder(
		addUngroupifiedInternalRouteTypes,
		core.AddToScheme,
		corev1conversions.AddToScheme,

		addLegacyRouteFieldSelectorKeyConversions,
		routev1helpers.RegisterDefaults,
		routev1helpers.RegisterConversions,
	)
	utilruntime.Must(schemeBuilder.AddToScheme(scheme))
}
476854
func InstallInternalLegacyBuild(scheme *runtime.Scheme) {
	InstallExternalLegacyBuild(scheme)

	schemeBuilder := runtime.NewSchemeBuilder(
		addUngroupifiedInternalBuildTypes,
		core.AddToScheme,

		addLegacyBuildFieldSelectorKeyConversions,
		buildv1helpers.AddConversionFuncs,
		buildv1helpers.RegisterDefaults,
		buildv1helpers.RegisterConversions,
	)
	utilruntime.Must(schemeBuilder.AddToScheme(scheme))
}
862942
func RegisterRoutingMechanism(name string, ctor RoutingMechanismConstructor) {
	if ctor == nil {
		log.FatalLog("route/REGISTER_ROUTE_MECHANISM",
			"Failed to register nil route constructor for: ", name)
	}

	if _, dup := routes[name]; dup {
		log.FatalLog("route/REGISTER_ROUTE_MECHANISM",
			"Falied to register duplicate route constructor for: ", name)
	}

	routes[name] = ctor
}
1218440
func Install(scheme *runtime.Scheme) {
	utilruntime.Must(authentication.AddToScheme(scheme))
	utilruntime.Must(v1beta1.AddToScheme(scheme))
	utilruntime.Must(v1.AddToScheme(scheme))
	utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion, v1beta1.SchemeGroupVersion))
}
904808
func (r *Router) AddRoute(rule string, priority int, handler http.Handler) error {
	parse, err := r.parser.Parse(rule)
	if err != nil {
		return fmt.Errorf("error while parsing rule %s: %v", rule, err)
	}

	buildTree, ok := parse.(treeBuilder)
	if !ok {
		return fmt.Errorf("error while parsing rule %s", rule)
	}

	if priority == 0 {
		priority = len(rule)
	}

	route := r.NewRoute().Handler(handler).Priority(priority)
	return addRuleOnRoute(route, buildTree())
}
365578
func (c *Client) CreateRoute(routeRequest RouteRequest) (Route, error) {
	routesResource, err := c.createRoute("/v2/routes", routeRequest)
	if nil != err {
		return Route{}, err
	}
	return c.mergeRouteResource(routesResource), nil
}
421213
func wrapRoute(middlewares *alice.Chain) func(*mux.Route, *mux.Router, []*mux.Route) error {
	return func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error {
		handler, err := middlewares.Then(route.GetHandler())
		if err != nil {
			return err
		}

		route.Handler(handler)
		return nil
	}
}
981512
func Install(scheme *runtime.Scheme) {
	utilruntime.Must(core.AddToScheme(scheme))
	utilruntime.Must(v1.AddToScheme(scheme))
	utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion))
}
776987
func InstallHandlers(r *router.Router, base router.MiddlewareChain) {
	r.GET("/auth/api/v1/server/certificates", base, certsHandler)
	r.GET("/auth/api/v1/server/info", base, infoHandler)
}
14570
func (c *Client) InstallPackage(name string) error {
	_, stderr, err := c.execNpm("install", name)
	if err != nil {
		if strings.Contains(stderr, "no such package available") {
			return errors.New("no such package available")
		}
		return errors.New(stderr)
	}
	return nil
}
1187745
func (m *MobileGatewaySetting) AddStaticRoute(prefix string, nextHop string) (int, *MGWStaticRoute) {
	if m.StaticRoutes == nil {
		m.StaticRoutes = []*MGWStaticRoute{}
	}

	s := &MGWStaticRoute{
		Prefix:  prefix,
		NextHop: nextHop,
	}
	m.StaticRoutes = append(m.StaticRoutes, s)
	return len(m.StaticRoutes) - 1, s
}
1057763
func (m *MobileGatewaySIMRoutes) AddSIMRoute(simID int64, prefix string) (int, *MobileGatewaySIMRoute) {
	var exists bool
	for _, route := range m.SIMRoutes {
		if route.ResourceID == fmt.Sprintf("%d", simID) && route.Prefix == prefix {
			exists = true
			break
		}
	}
	if !exists {
		r := &MobileGatewaySIMRoute{
			ResourceID: fmt.Sprintf("%d", simID),
			Prefix:     prefix,
		}
		m.SIMRoutes = append(m.SIMRoutes, r)
		return len(m.SIMRoutes) - 1, r
	}
	return -1, nil
}
890746
func (ds *MySQLDatastore) InsertRoute(ctx context.Context, route *models.Route) (*models.Route, error) {
	hbyte, err := json.Marshal(route.Headers)
	if err != nil {
		return nil, err
	}

	cbyte, err := json.Marshal(route.Config)
	if err != nil {
		return nil, err
	}

	err = ds.Tx(func(tx *sql.Tx) error {
		r := tx.QueryRow(`SELECT 1 FROM apps WHERE name=?`, route.AppName)
		if err := r.Scan(new(int)); err != nil {
			if err == sql.ErrNoRows {
				return models.ErrAppsNotFound
			}
		}
		same, err := tx.Query(`SELECT 1 FROM routes WHERE app_name=? AND path=?`,
			route.AppName, route.Path)
		if err != nil {
			return err
		}
		defer same.Close()
		if same.Next() {
			return models.ErrRoutesAlreadyExists
		}

		_, err = tx.Exec(`
		INSERT INTO routes (
			app_name,
			path,
			image,
			format,
			maxc,
			memory,
			type,
			timeout,
			idle_timeout,
			headers,
			config
		)
		VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);`,
			route.AppName,
			route.Path,
			route.Image,
			route.Format,
			route.MaxConcurrency,
			route.Memory,
			route.Type,
			route.Timeout,
			route.IdleTimeout,
			string(hbyte),
			string(cbyte),
		)
		return err
	})

	if err != nil {
		return nil, err
	}
	return route, nil
}
507041
func (b *BigIP) AddRoute(config *Route) error {
	return b.post(config, uriNet, uriRoute)
}
154617
func InstallInternalLegacyProject(scheme *runtime.Scheme) {
	InstallExternalLegacyProject(scheme)

	schemeBuilder := runtime.NewSchemeBuilder(
		addUngroupifiedInternalProjectTypes,

		addLegacyProjectFieldSelectorKeyConversions,
		projectv1helpers.RegisterDefaults,
		projectv1helpers.RegisterConversions,
	)
	utilruntime.Must(schemeBuilder.AddToScheme(scheme))
}
1001299
func (c *Client) Install(argv []string) error {
	usage := fmt.Sprintf(`Loads the definitions of components from local unit files.

After install, the components will be available to start.

"deisctl install" looks for unit files in these directories, in this order:
- the $DEISCTL_UNITS environment variable, if set
- $HOME/.deis/units
- /var/lib/deis/units

Usage:
  deisctl install [<target>...] [options]

Options:
  --router-mesh-size=<num>  Number of routers to be loaded when installing the platform [default: %d].
`, cmd.DefaultRouterMeshSize)
	// parse command-line arguments
	args, err := docopt.Parse(usage, argv, true, "", false)
	if err != nil {
		return err
	}

	meshSizeArg, _ := args["--router-mesh-size"].(string)
	parsedValue, err := strconv.ParseUint(meshSizeArg, 0, 8)
	if err != nil || parsedValue < 1 {
		fmt.Print("Error: argument --router-mesh-size: invalid value, make sure the value is an integer between 1 and 255.\n")
		return err
	}
	cmd.RouterMeshSize = uint8(parsedValue)

	return cmd.Install(args["<target>"].([]string), c.Backend, c.configBackend, cmd.CheckRequiredKeys)
}
822235
func InstallHandlers(r *router.Router, base router.MiddlewareChain, templatesPath string) {
	m := base.Extend(func(c *router.Context, next router.Handler) {
		c.Context = context.WithValue(c.Context, startTimeContextKey(0), clock.Now(c.Context))
		next(c)
	}).Extend(
		templates.WithTemplates(prepareTemplates(templatesPath)),
		auth.Authenticate(server.UsersAPIAuthMethod{}),
	)

	r.GET("/", m, renderErr(routeToPage))
	r.GET("/p/*path", m, renderErr(routeToPage))
}