// CreateRoute installs a new route for your domain.
// The route structure you provide serves as a template, and
// only a subset of the fields influence the operation.
// See the Route structure definition for more details.
182768
func (mg *MailgunImpl) CreateRoute(ctx context.Context, prototype Route) (_ignored Route, err error) {
	r := newHTTPRequest(generatePublicApiUrl(mg, routesEndpoint))
	r.setClient(mg.Client())
	r.setBasicAuth(basicAuthUser, mg.APIKey())
	p := newUrlEncodedPayload()
	p.addValue("priority", strconv.Itoa(prototype.Priority))
	p.addValue("description", prototype.Description)
	p.addValue("expression", prototype.Expression)
	for _, action := range prototype.Actions {
		p.addValue("action", action)
	}
	var resp createRouteResp
	if err = postResponseFromJSON(ctx, r, p, &resp); err != nil {
		return _ignored, err
	}
	return resp.Route, err
}
226262
func newRoute(nodes ...Node) *Chain {
	chain := NewChain(nodes...)
	chain.isRoute = true
	return chain
}
535026
func (o *L2Domain) CreateStaticRoute(child *StaticRoute) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
736529
func (b *BigIP) CreateRoute(name, dest, gateway string) error {
	config := &Route{
		Name:    name,
		Network: dest,
		Gateway: gateway,
	}

	return b.post(config, uriNet, uriRoute)
}
609677
func newRouter() *router {
	r := &router{
		RedirectTrailingSlash:  true,
		RedirectFixedPath:      true,
		HandleMethodNotAllowed: true,
		HandleOPTIONS:          true,
		cache: &cache{
			v: map[string]*msc{
				// init default methods
				MethodGET: &msc{
					v: make(map[string]*cacheRecord),
				},
				MethodDELETE: &msc{
					v: make(map[string]*cacheRecord),
				},
				MethodHEAD: &msc{
					v: make(map[string]*cacheRecord),
				},
				MethodOPTIONS: &msc{
					v: make(map[string]*cacheRecord),
				},
				MethodPATCH: &msc{
					v: make(map[string]*cacheRecord),
				},
				MethodPOST: &msc{
					v: make(map[string]*cacheRecord),
				},
				MethodPUT: &msc{
					v: make(map[string]*cacheRecord),
				},
			},
		},
	}
	r.StaticHandlers = map[methodIndex]map[string]staticHandler{
		methodToIdx(GET):     make(map[string]staticHandler),
		methodToIdx(DELETE):  make(map[string]staticHandler),
		methodToIdx(HEAD):    make(map[string]staticHandler),
		methodToIdx(OPTIONS): make(map[string]staticHandler),
		methodToIdx(PATCH):   make(map[string]staticHandler),
		methodToIdx(POST):    make(map[string]staticHandler),
		methodToIdx(PUT):     make(map[string]staticHandler),
	}
	go r.cache.maintain()
	return r
}
612447
func createPaths(mode byte, paths *MvcPath) {
	if (mode & OModel) == OModel {
		os.Mkdir(paths.ModelPath, 0777)
	}
	if (mode & OController) == OController {
		os.Mkdir(paths.ControllerPath, 0777)
	}
	if (mode & ORouter) == ORouter {
		os.Mkdir(paths.RouterPath, 0777)
	}
}
614295
func (r *Router) NewRoute() *Route {
	// initialize a route with a copy of the parent router's configuration
	route := &Route{routeConf: copyRouteConf(r.routeConf), namedRoutes: r.namedRoutes}
	r.routes = append(r.routes, route)
	return route
}
1242645
func (c *Client) DomainCreate(domain string, Type string,
	conf DomainCreateOpts) (domainID int, err error) {

	args, err := c.argMarshal(conf)
	if err != nil {
		return 0, err
	}
	args["Domain"] = domain
	args["Type"] = Type

	data, err := c.apiCall("domain.create", args)
	if err != nil {
		return 0, err
	}

	err = unmarshalSingle(data, "DomainID", &domainID)
	if err != nil {
		return 0, err
	}

	return domainID, nil
}
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
}
124626
func (s *CreateRouteOutput) SetRoute(v *RouteData) *CreateRouteOutput {
	s.Route = v
	return s
}
1176739
func (r *RoutesService) Create(route *Route) (*Route, *http.Response, error) {
	return r.CreateWithContext(context.TODO(), route)
}
1037604
func NewFromRoutes(routes map[string]Rule) (Router, error) {
	router := &RuleRouter{}
	for name, rule := range routes {
		output, err := substituteEnvVars(rule.Output)
		if err != nil {
			return router, err
		}
		output = setDefaults(output)

		rule.Name = name
		rule.Output = output
		router.rules = append(router.rules, rule)
	}

	return router, nil
}
662208
func (api *API) CreateWorkerRoute(zoneID string, route WorkerRoute) (WorkerRouteResponse, error) {
	// Check whether a script name is defined in order to determine whether
	// to use the single-script or multi-script endpoint.
	pathComponent := "filters"
	if route.Script != "" {
		if api.OrganizationID == "" {
			return WorkerRouteResponse{}, errors.New("organization ID required for enterprise only request")
		}
		pathComponent = "routes"
	}

	uri := "/zones/" + zoneID + "/workers/" + pathComponent
	res, err := api.makeRequest("POST", uri, route)
	if err != nil {
		return WorkerRouteResponse{}, errors.Wrap(err, errMakeRequestError)
	}
	var r WorkerRouteResponse
	err = json.Unmarshal(res, &r)
	if err != nil {
		return WorkerRouteResponse{}, errors.Wrap(err, errUnmarshalError)
	}
	return r, nil
}
1061203
func (c *DeleteAppHandler) RegisterRoute(r *mux.Router) {
	r.Handle(fmt.Sprintf("/app/{%s}", appNamePath), c).Methods("DELETE")
}
527546
func NewRouter() *Router {
	r := &Router{
		root:               radix.New(),
		storagePrefix:      radix.New(),
		mountUUIDCache:     radix.New(),
		mountAccessorCache: radix.New(),
	}
	return r
}
273254
func RouteURL(router *mux.Router) func(string, ...interface{}) (template.URL, error) {
	return func(name string, pairs ...interface{}) (template.URL, error) {
		route := router.Get(name)
		if route == nil {
			return "", fmt.Errorf("path: no such route %q", name)
		}
		spairs := make([]string, len(pairs))
		for i := range pairs {
			spairs[i] = fmt.Sprint(pairs[i])
		}
		u, err := route.URL(spairs...)
		return template.URL(u.String()), err
	}
}
1271488
func (r *SimpleRouter) NewRoute() *Route {
	route := &Route{}
	r.routes = append(r.routes, route)
	return route
}