Skip to content

Commit

Permalink
fix(region): security group rule update (#18451)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Oct 26, 2023
1 parent a38ef1f commit ce83f8a
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 67 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ require (
k8s.io/client-go v0.19.3
k8s.io/cluster-bootstrap v0.19.3
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231026033713-0e4480cdfc28
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231026074131-02cb65f8eeb3
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1179,8 +1179,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231026033713-0e4480cdfc28 h1:ilXUtLYpjxwkY6bCO8sFwg7owx9ylk358tuhIiGwJzg=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231026033713-0e4480cdfc28/go.mod h1:McRjoG2gaOUisB+Qa41kLCNZhr0lsCu4apEjTiphXVY=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231026074131-02cb65f8eeb3 h1:70v0kgsw1wSOYTrHTPn6YJFxc1pnWdCo/VJVaZai/hQ=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231026074131-02cb65f8eeb3/go.mod h1:McRjoG2gaOUisB+Qa41kLCNZhr0lsCu4apEjTiphXVY=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
Expand Down
10 changes: 1 addition & 9 deletions pkg/compute/regiondrivers/huawei.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,15 +619,7 @@ func (self *SHuaWeiRegionDriver) ValidateCreateSecurityGroupInput(ctx context.Co
}

func (self *SHuaWeiRegionDriver) ValidateUpdateSecurityGroupRuleInput(ctx context.Context, userCred mcclient.TokenCredential, input *api.SSecgroupRuleUpdateInput) (*api.SSecgroupRuleUpdateInput, error) {
if input.Priority != nil && *input.Priority < 1 || *input.Priority > 100 {
return nil, httperrors.NewInputParameterError("invalid priority %d, range 1-100", *input.Priority)
}

if input.Ports != nil && strings.Contains(*input.Ports, ",") {
return nil, httperrors.NewInputParameterError("invalid ports %s", *input.Ports)
}

return self.SManagedVirtualizationRegionDriver.ValidateUpdateSecurityGroupRuleInput(ctx, userCred, input)
return nil, httperrors.NewNotSupportedError("not support update security group rule")
}

func (self *SHuaWeiRegionDriver) GetSecurityGroupFilter(vpc *models.SVpc) (func(q *sqlchemy.SQuery) *sqlchemy.SQuery, error) {
Expand Down
11 changes: 1 addition & 10 deletions pkg/compute/regiondrivers/volcengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package regiondrivers

import (
"context"
"strings"

"yunion.io/x/jsonutils"

Expand Down Expand Up @@ -69,13 +68,5 @@ func (self *SVolcengineRegionDriver) ValidateCreateSecurityGroupInput(ctx contex
}

func (self *SVolcengineRegionDriver) ValidateUpdateSecurityGroupRuleInput(ctx context.Context, userCred mcclient.TokenCredential, input *api.SSecgroupRuleUpdateInput) (*api.SSecgroupRuleUpdateInput, error) {
if input.Priority != nil && *input.Priority < 1 || *input.Priority > 100 {
return nil, httperrors.NewInputParameterError("invalid priority %d, range 1-100", *input.Priority)
}

if input.Ports != nil && strings.Contains(*input.Ports, ",") {
return nil, httperrors.NewInputParameterError("invalid ports %s", *input.Ports)
}

return self.SManagedVirtualizationRegionDriver.ValidateUpdateSecurityGroupRuleInput(ctx, userCred, input)
return nil, httperrors.NewNotSupportedError("not support update security group rule")
}
2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
# sigs.k8s.io/yaml v1.2.0
## explicit; go 1.12
sigs.k8s.io/yaml
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231026033713-0e4480cdfc28
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231026074131-02cb65f8eeb3
## explicit; go 1.18
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 20 additions & 14 deletions vendor/yunion.io/x/cloudmux/pkg/multicloud/aliyun/securitygroup.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion vendor/yunion.io/x/cloudmux/pkg/multicloud/ctyun/secrules.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 14 additions & 27 deletions vendor/yunion.io/x/cloudmux/pkg/multicloud/ctyun/securitygroup.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ce83f8a

Please sign in to comment.