// DeleteGlobalForwardingRule deletes the GlobalForwardingRule by name.
161114
func (g *Cloud) DeleteGlobalForwardingRule(name string) error {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newForwardingRuleMetricContext("delete", "")
	return mc.Observe(g.c.GlobalForwardingRules().Delete(ctx, meta.GlobalKey(name)))
}
1204340
func (gp *EpgPolicy) DelRule(rule *contivModel.Rule) error {
	// check if the rule exists
	ruleMap := gp.RuleMaps[rule.Key]
	if ruleMap == nil {
		return core.Errorf("Rule does not exists")
	}

	// Delete each ofnet rule under this policy rule
	for _, ofnetRule := range ruleMap.OfnetRules {
		log.Infof("Deleting rule {%+v} from policyDB", ofnetRule)

		// Delete the rule from policyDB
		err := ofnetMaster.DelRule(ofnetRule)
		if err != nil {
			log.Errorf("Error deleting the ofnet rule {%+v}. Err: %v", ofnetRule, err)
		}

		// Send DelRule to netplugin agents
		err = delPolicyRuleState(ofnetRule)
		if err != nil {
			log.Errorf("Error deleting the ofnet rule {%+v}. Err: %v", ofnetRule, err)
		}
	}

	// delete the cache
	delete(gp.RuleMaps, rule.Key)

	return nil
}
179961
func (c *Client) CreateIpForwardingRule(p *CreateIpForwardingRuleParameter) (*IpForwardingRule, error) {
	obj, err := c.Request("createIpForwardingRule", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*IpForwardingRule), err
}
320264
func (c *Client) ListIpForwardingRules(p *ListIpForwardingRulesParameter) ([]*IpForwardingRule, error) {
	obj, err := c.Request("listIpForwardingRules", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.([]*IpForwardingRule), err
}
1169726
func (s *NATService) NewDeleteIpForwardingRuleParams(id string) *DeleteIpForwardingRuleParams {
	p := &DeleteIpForwardingRuleParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	return p
}
507265
func (g *Cloud) ListAlphaRegionForwardingRules(region string) ([]*computealpha.ForwardingRule, error) {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newForwardingRuleMetricContextWithVersion("list", region, computeAlphaVersion)
	v, err := g.c.AlphaForwardingRules().List(ctx, region, filter.None)
	return v, mc.Observe(err)
}
24136
func (s *UpdatePatchBaselineInput) SetGlobalFilters(v *PatchFilterGroup) *UpdatePatchBaselineInput {
	s.GlobalFilters = v
	return s
}
1027145
func (g *Cloud) DeleteGlobalBackendService(name string) error {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newBackendServiceMetricContext("delete", "")
	return mc.Observe(g.c.BackendServices().Delete(ctx, meta.GlobalKey(name)))
}
425790
func (a *AuthWithRoles) DeleteProxy(name string) error {
	if err := a.action(defaults.Namespace, services.KindProxy, services.VerbDelete); err != nil {
		return trace.Wrap(err)
	}
	return a.authServer.DeleteProxy(name)
}
103348
func (c *Client) CreatePortForwardingRule(p *CreatePortForwardingRuleParameter) (*PortForwardingRule, error) {
	obj, err := c.Request("createPortForwardingRule", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*PortForwardingRule), err
}
73100
func (m *Manager) RemoveTokensByGlobalID(globalid string) error {
	_, err := m.getAccessTokenCollection().RemoveAll(bson.M{"globalid": globalid})
	return err
}
255259
func (c *Client) DeleteEgressFirewallRule(p *DeleteEgressFirewallRuleParameter) (*Result, error) {
	obj, err := c.Request("deleteEgressFirewallRule", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Result), err
}
167864
func (g *Cloud) CreateAlphaRegionForwardingRule(rule *computealpha.ForwardingRule, region string) error {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newForwardingRuleMetricContextWithVersion("create", region, computeAlphaVersion)
	return mc.Observe(g.c.AlphaForwardingRules().Insert(ctx, meta.RegionalKey(rule.Name, region), rule))
}
624754
func (n *NetworkServerAPI) DeleteGatewayProfile(ctx context.Context, req *ns.DeleteGatewayProfileRequest) (*empty.Empty, error) {
	var gpID uuid.UUID
	copy(gpID[:], req.Id)

	if err := storage.DeleteGatewayProfile(storage.DB(), gpID); err != nil {
		return nil, errToRPCError(err)
	}

	return &empty.Empty{}, nil
}
697439
func ValidateGlobal(obj *Global) error {
	collections.globalMutex.Lock()
	defer collections.globalMutex.Unlock()

	// Validate key is correct
	keyStr := obj.Name
	if obj.Key != keyStr {
		log.Errorf("Expecting Global Key: %s. Got: %s", keyStr, obj.Key)
		return errors.New("Invalid Key")
	}

	// Validate each field

	if len(obj.ArpMode) > 64 {
		return errors.New("arpMode string too long")
	}

	arpModeMatch := regexp.MustCompile("^(proxy|flood)?$")
	if arpModeMatch.MatchString(obj.ArpMode) == false {
		return errors.New("arpMode string invalid format")
	}

	if len(obj.FwdMode) > 64 {
		return errors.New("fwdMode string too long")
	}

	fwdModeMatch := regexp.MustCompile("^(bridge|routing)?$")
	if fwdModeMatch.MatchString(obj.FwdMode) == false {
		return errors.New("fwdMode string invalid format")
	}

	if len(obj.Name) > 64 {
		return errors.New("name string too long")
	}

	nameMatch := regexp.MustCompile("^(global)$")
	if nameMatch.MatchString(obj.Name) == false {
		return errors.New("name string invalid format")
	}

	if len(obj.NetworkInfraType) > 64 {
		return errors.New("networkInfraType string too long")
	}

	networkInfraTypeMatch := regexp.MustCompile("^(aci|aci-opflex|default)?$")
	if networkInfraTypeMatch.MatchString(obj.NetworkInfraType) == false {
		return errors.New("networkInfraType string invalid format")
	}

	pvtSubnetMatch := regexp.MustCompile("^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})/16$")
	if pvtSubnetMatch.MatchString(obj.PvtSubnet) == false {
		return errors.New("pvtSubnet string invalid format")
	}

	vlansMatch := regexp.MustCompile("^([0-9]{1,4}?-[0-9]{1,4}?)$")
	if vlansMatch.MatchString(obj.Vlans) == false {
		return errors.New("vlans string invalid format")
	}

	vxlansMatch := regexp.MustCompile("^([0-9]{1,8}?-[0-9]{1,8}?)$")
	if vxlansMatch.MatchString(obj.Vxlans) == false {
		return errors.New("vxlans string invalid format")
	}

	return nil
}
648972
func (g *Cloud) GetAlphaRegionForwardingRule(name, region string) (*computealpha.ForwardingRule, error) {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newForwardingRuleMetricContextWithVersion("get", region, computeAlphaVersion)
	v, err := g.c.AlphaForwardingRules().Get(ctx, meta.RegionalKey(name, region))
	return v, mc.Observe(err)
}
625741
func (s *FirewallService) DeletePortForwardingRule(p *DeletePortForwardingRuleParams) (*DeletePortForwardingRuleResponse, error) {
	resp, err := s.cs.newRequest("deletePortForwardingRule", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r DeletePortForwardingRuleResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = convertFirewallServiceResponse(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}