mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
fix(region): waf rule create (#22737)
This commit is contained in:
@@ -41,6 +41,8 @@ type WafRuleListInput struct {
|
||||
|
||||
// WAF规则组Id
|
||||
WafRuleGroupId string `json:"waf_rule_group_id"`
|
||||
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type WafRuleCreateInput struct {
|
||||
|
||||
@@ -60,7 +60,7 @@ type SWafRule struct {
|
||||
db.SExternalizedResourceBase
|
||||
|
||||
// 规则优先级
|
||||
Priority int `nullable:"false" list:"domain" create:"required"`
|
||||
Priority int `nullable:"false" default:"0" list:"domain" create:"optional"`
|
||||
// 规则默认行为
|
||||
Action *cloudprovider.DefaultAction `charset:"utf8" nullable:"true" list:"user" update:"domain" create:"required"`
|
||||
// 条件
|
||||
@@ -213,6 +213,10 @@ func (manager *SWafRuleManager) ListItemFilter(
|
||||
return nil, errors.Wrap(err, "SExternalizedResourceBaseManager.ListItemFilter")
|
||||
}
|
||||
|
||||
if len(query.Type) > 0 {
|
||||
q = q.Equals("type", query.Type)
|
||||
}
|
||||
|
||||
if len(query.WafInstanceId) > 0 {
|
||||
_, err := validators.ValidateModel(ctx, userCred, WafInstanceManager, &query.WafInstanceId)
|
||||
if err != nil {
|
||||
|
||||
@@ -394,10 +394,6 @@ func (self *SAwsRegionDriver) ValidateCreateWafInstanceData(ctx context.Context,
|
||||
return input, nil
|
||||
}
|
||||
|
||||
func (self *SAwsRegionDriver) ValidateCreateWafRuleData(ctx context.Context, userCred mcclient.TokenCredential, waf *models.SWafInstance, input api.WafRuleCreateInput) (api.WafRuleCreateInput, error) {
|
||||
return input, nil
|
||||
}
|
||||
|
||||
func (self *SAwsRegionDriver) ValidateCreateSecurityGroupInput(ctx context.Context, userCred mcclient.TokenCredential, input *api.SSecgroupCreateInput) (*api.SSecgroupCreateInput, error) {
|
||||
for i := range input.Rules {
|
||||
if input.Rules[i].Action != string(secrules.SecurityRuleAllow) {
|
||||
|
||||
@@ -76,10 +76,6 @@ func (self *SAzureRegionDriver) ValidateCreateWafInstanceData(ctx context.Contex
|
||||
return input, nil
|
||||
}
|
||||
|
||||
func (self *SAzureRegionDriver) ValidateCreateWafRuleData(ctx context.Context, userCred mcclient.TokenCredential, waf *models.SWafInstance, input api.WafRuleCreateInput) (api.WafRuleCreateInput, error) {
|
||||
return input, nil
|
||||
}
|
||||
|
||||
func (self *SAzureRegionDriver) ValidateCreateSecurityGroupInput(ctx context.Context, userCred mcclient.TokenCredential, input *api.SSecgroupCreateInput) (*api.SSecgroupCreateInput, error) {
|
||||
for i := range input.Rules {
|
||||
rule := input.Rules[i]
|
||||
|
||||
@@ -403,7 +403,7 @@ func (self *SBaseRegionDriver) ValidateCreateWafInstanceData(ctx context.Context
|
||||
}
|
||||
|
||||
func (self *SBaseRegionDriver) ValidateCreateWafRuleData(ctx context.Context, userCred mcclient.TokenCredential, waf *models.SWafInstance, input api.WafRuleCreateInput) (api.WafRuleCreateInput, error) {
|
||||
return input, errors.Wrapf(cloudprovider.ErrNotImplemented, "ValidateCreateWafRuleData")
|
||||
return input, nil
|
||||
}
|
||||
|
||||
func (self *SBaseRegionDriver) RequestCreateNetwork(ctx context.Context, userCred mcclient.TokenCredential, net *models.SNetwork, task taskman.ITask) error {
|
||||
|
||||
Reference in New Issue
Block a user