// revokeAllRouteTableRules revoke all routes on the Default Route Table
// This should only be ran once at creation time of this resource
431982
func revokeAllRouteTableRules(defaultRouteTableId string, meta interface{}) error {
	conn := meta.(*AWSClient).ec2conn
	log.Printf("\n***\nrevokeAllRouteTableRules\n***\n")

	resp, err := conn.DescribeRouteTables(&ec2.DescribeRouteTablesInput{
		RouteTableIds: []*string{aws.String(defaultRouteTableId)},
	})
	if err != nil {
		return err
	}

	if len(resp.RouteTables) < 1 || resp.RouteTables[0] == nil {
		return fmt.Errorf("Default Route table not found")
	}

	rt := resp.RouteTables[0]

	// Remove all Gateway association
	for _, r := range rt.PropagatingVgws {
		log.Printf(
			"[INFO] Deleting VGW propagation from %s: %s",
			defaultRouteTableId, *r.GatewayId)
		_, err := conn.DisableVgwRoutePropagation(&ec2.DisableVgwRoutePropagationInput{
			RouteTableId: aws.String(defaultRouteTableId),
			GatewayId:    r.GatewayId,
		})
		if err != nil {
			return err
		}
	}

	// Delete all routes
	for _, r := range rt.Routes {
		// you cannot delete the local route
		if r.GatewayId != nil && *r.GatewayId == "local" {
			continue
		}
		if r.DestinationPrefixListId != nil {
			// Skipping because VPC endpoint routes are handled separately
			// See aws_vpc_endpoint
			continue
		}

		if r.DestinationCidrBlock != nil {
			log.Printf(
				"[INFO] Deleting route from %s: %s",
				defaultRouteTableId, *r.DestinationCidrBlock)
			_, err := conn.DeleteRoute(&ec2.DeleteRouteInput{
				RouteTableId:         aws.String(defaultRouteTableId),
				DestinationCidrBlock: r.DestinationCidrBlock,
			})
			if err != nil {
				return err
			}
		}

		if r.DestinationIpv6CidrBlock != nil {
			log.Printf(
				"[INFO] Deleting route from %s: %s",
				defaultRouteTableId, *r.DestinationIpv6CidrBlock)
			_, err := conn.DeleteRoute(&ec2.DeleteRouteInput{
				RouteTableId:             aws.String(defaultRouteTableId),
				DestinationIpv6CidrBlock: r.DestinationIpv6CidrBlock,
			})
			if err != nil {
				return err
			}
		}

	}

	return nil
}
850519
func (a *Account) RetractRouterRights(routerID, username string) error {
	return a.RetractComponentRights("router", routerID, username)
}
1334700
func (az *Cloud) deleteRouteWithRetry(routeName string) error {
	return wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) {
		ctx, cancel := getContextWithCancel()
		defer cancel()

		resp, err := az.RoutesClient.Delete(ctx, az.RouteTableResourceGroup, az.RouteTableName, routeName)
		klog.V(10).Infof("RoutesClient.Delete(%s,%s): end", az.RouteTableName, routeName)
		return az.processHTTPRetryResponse(nil, "", resp, err)
	})
}
149538
func CompareRoutingRules(ctx context.Context, fromTS, toTS *topo.Server) error {
	rrFrom, err := fromTS.GetRoutingRules(ctx)
	if err != nil {
		return vterrors.Wrapf(err, "GetKeyspace(from)")
	}
	rrTo, err := toTS.GetRoutingRules(ctx)
	if err != nil {
		return vterrors.Wrapf(err, "GetKeyspace(to)")
	}
	if !proto.Equal(rrFrom, rrTo) {
		return vterrors.Errorf(vtrpc.Code_FAILED_PRECONDITION, "routing rules: %v does not match %v", rrFrom, rrTo)
	}
	return nil
}
1177654
func (e *Execution) Revoke(c context.Context) error {
	e.Token = nil
	if err := e.ModifyState(c, dm.Execution_STOPPING); err != nil {
		return err
	}
	return ds.Put(c, e)
}
895462
func (c *Client) RevokeOffer(user, access string, offerURLs ...string) error {
	return c.modifyOfferUser(params.RevokeOfferAccess, user, access, offerURLs)
}
1029089
func RetryAlways(ctx context.Context, req Request, retryCount int, err error) (bool, error) {
	return true, nil
}
944181
func (tsv *TabletServer) UnRegisterQueryRuleSource(ruleSource string) {
	tsv.qe.queryRuleSources.UnRegisterSource(ruleSource)
}
632630
func (app *App) HandleMethodNotAllowed(newValue bool) (oldValue bool) {
	return app.defaultRouter.HandleMethodNotAllowed(newValue)
}
894713
func (s *WebsiteConfiguration) SetRoutingRules(v []*RoutingRule) *WebsiteConfiguration {
	s.RoutingRules = v
	return s
}
587637
func Revoke(host string) error {
	client, err := newACMEClient(new(Config), true)
	if err != nil {
		return err
	}
	return client.Revoke(host)
}
1111846
func (c *Context) RoutesHandler(builder Builder) http.Handler {
	b := builder
	if b == nil {
		b = PassthroughBuilder
	}
	return NewRouter(c, b(NewOperationExecutor(c)))
}
530830
func (a *Client) RevokeConsentSessions(params *RevokeConsentSessionsParams) (*RevokeConsentSessionsNoContent, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRevokeConsentSessionsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "revokeConsentSessions",
		Method:             "DELETE",
		PathPattern:        "/oauth2/auth/sessions/consent",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &RevokeConsentSessionsReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*RevokeConsentSessionsNoContent), nil

}
411243
func (p *Policy) RevokeRole(role string, principals ...string) {
	members := p.Bindings[role]
	for _, principal := range principals {
		delete(members, principal)
	}
}
708300
func prepareRules(c context.Context, cfg policy.ConfigBundle, revision string) (policy.Queryable, error) {
	parsed, ok := cfg[delegationCfg].(*admin.DelegationPermissions)
	if !ok {
		return nil, fmt.Errorf("wrong type of delegation.cfg - %T", cfg[delegationCfg])
	}

	rules := make([]*delegationRule, 0, len(parsed.Rules)+1)
	for _, msg := range parsed.Rules {
		rule, err := makeDelegationRule(c, msg)
		if err != nil {
			return nil, err
		}
		rules = append(rules, rule)
	}

	// Add an implicit rule that allows trusted LUCI microservices to grab
	// delegation tokens for 'project:*' identities. "auth-luci-services" is a
	// magical group also mentioned in luci-py's components.auth.
	//
	// TODO(vadimsh): Currently relied on by Buildbucket. Buildbucket should
	// switch to using 'project:...' identities directly without going through
	// the token server.
	rule, err := makeDelegationRule(c, &admin.DelegationRule{
		Name:                 "allow-project-identities",
		Requestor:            []string{"group:auth-luci-services"},
		AllowedToImpersonate: []string{Projects},
		AllowedAudience:      []string{Requestor},
		TargetService:        []string{"*"},
		MaxValidityDuration:  86400,
	})
	if err != nil {
		panic(err) // should be impossible, this is a hardcoded rule
	}
	rules = append(rules, rule)

	requestors := make([]*identityset.Set, len(rules))
	for i, r := range rules {
		requestors[i] = r.requestors
	}

	return &Rules{
		revision:   revision,
		rules:      rules,
		requestors: identityset.Union(requestors...),
	}, nil
}
534057
func (fw *firewallRulesState) AllRules() ([]*FirewallRule, error) {
	coll, closer := fw.st.db().GetCollection(firewallRulesC)
	defer closer()

	var docs []firewallRulesDoc
	err := coll.Find(nil).All(&docs)
	if err != nil {
		return nil, errors.Trace(err)
	}
	result := make([]*FirewallRule, len(docs))
	for i, doc := range docs {
		result[i] = doc.toRule()
	}
	return result, nil
}
498867
func (app *App) MethodNotAllowed(c func(ctx *Context)) *App {
	app.defaultRouter.router.MethodNotAllowed = c
	return app
}