mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): huawe redis spec code update (#19294)
This commit is contained in:
@@ -88,7 +88,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.20240118030351-5e18eccac8b2
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240118084326-6aef724d2945
|
||||
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
|
||||
|
||||
@@ -1201,8 +1201,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.20240118030351-5e18eccac8b2 h1:7the9Pn0W277kXf8N+aSW7OOIluV9c8H+mCLQ6gvRUM=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240118030351-5e18eccac8b2/go.mod h1:aj1gR9PPb6eqqKOwvANe26CoZFY8ydmXy0fuvgKYXH0=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240118084326-6aef724d2945 h1:3Ryr7WHr3WcU4CakDvxfxxz7Zz2EPTujGYkeqYMXIQ0=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240118084326-6aef724d2945/go.mod h1:aj1gR9PPb6eqqKOwvANe26CoZFY8ydmXy0fuvgKYXH0=
|
||||
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=
|
||||
|
||||
@@ -93,6 +93,7 @@ func (self *DBInstanceAccountGrantPrivilegeTask) OnInit(ctx context.Context, obj
|
||||
DBInstanceaccountId: account.Id,
|
||||
DBInstancedatabaseId: database.Id,
|
||||
}
|
||||
privilege.ExternalId = fmt.Sprintf("%s/%s/%s", account.Name, database.Name, privilege.Privilege)
|
||||
|
||||
models.DBInstancePrivilegeManager.TableSpec().Insert(ctx, &privilege)
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ func (self *DBInstanceAccountSetPrivilegesTask) OnInit(ctx context.Context, obj
|
||||
DBInstanceaccountId: account.Id,
|
||||
DBInstancedatabaseId: database.Id,
|
||||
}
|
||||
pri.ExternalId = fmt.Sprintf("%s/%s/%s", account.Name, database.Name, pri.Privilege)
|
||||
models.DBInstancePrivilegeManager.TableSpec().Insert(ctx, &pri)
|
||||
logclient.AddActionLogWithStartable(self, account, logclient.ACT_GRANT_PRIVILEGE, nil, self.UserCred, true)
|
||||
}
|
||||
|
||||
@@ -146,6 +146,7 @@ func (self *DBInstanceDatabaseCreateTask) CreateDBInstanceDatabase(ctx context.C
|
||||
DBInstanceaccountId: account.DBInstanceaccountId,
|
||||
DBInstancedatabaseId: database.Id,
|
||||
}
|
||||
privilege.ExternalId = fmt.Sprintf("%s/%s/%s", account.Account, database.Name, privilege.Privilege)
|
||||
models.DBInstancePrivilegeManager.TableSpec().Insert(ctx, &privilege)
|
||||
logclient.AddActionLogWithStartable(self, database, logclient.ACT_GRANT_PRIVILEGE, account, self.UserCred, true)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1465,7 +1465,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.20240118030351-5e18eccac8b2
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240118084326-6aef724d2945
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
|
||||
+3
@@ -794,6 +794,9 @@ type SBucketPolicyStatementDetails struct {
|
||||
func (b *SBucket) GetPolicy() ([]cloudprovider.SBucketPolicyStatement, error) {
|
||||
policies, err := b.getPolicy()
|
||||
if err != nil {
|
||||
if errors.Cause(err) == errors.ErrNotFound {
|
||||
return []cloudprovider.SBucketPolicyStatement{}, nil
|
||||
}
|
||||
return nil, errors.Wrap(err, "getPolicy")
|
||||
}
|
||||
return b.localPolicyToCloudprovider(policies), nil
|
||||
|
||||
+4
-1
@@ -816,11 +816,14 @@ type SBucketPolicyStatementDetails struct {
|
||||
}
|
||||
|
||||
func (b *SBucket) GetPolicy() ([]cloudprovider.SBucketPolicyStatement, error) {
|
||||
res := []cloudprovider.SBucketPolicyStatement{}
|
||||
policies, err := b.getPolicy()
|
||||
if err != nil {
|
||||
if errors.Cause(err) == errors.ErrNotFound {
|
||||
return res, nil
|
||||
}
|
||||
return nil, errors.Wrap(err, "get policy")
|
||||
}
|
||||
res := []cloudprovider.SBucketPolicyStatement{}
|
||||
for i, policy := range policies {
|
||||
temp := cloudprovider.SBucketPolicyStatement{}
|
||||
temp.Action = policy.Action
|
||||
|
||||
+5
-2
@@ -783,6 +783,9 @@ type SBucketPolicyStatementDetails struct {
|
||||
func (b *SBucket) GetPolicy() ([]cloudprovider.SBucketPolicyStatement, error) {
|
||||
policies, err := b.getPolicy()
|
||||
if err != nil {
|
||||
if errors.Cause(err) == errors.ErrNotFound {
|
||||
return []cloudprovider.SBucketPolicyStatement{}, nil
|
||||
}
|
||||
return nil, errors.Wrap(err, "getPolicy")
|
||||
}
|
||||
res := []cloudprovider.SBucketPolicyStatement{}
|
||||
@@ -1005,8 +1008,8 @@ func (b *SBucket) actionToCannedAction(actions []string) string {
|
||||
}
|
||||
|
||||
/*
|
||||
example: in:domain/93887001882246db9273e5f59d544191:user/0932bb867900f4ca1f17c013ba9e3203
|
||||
out:93887001882246db9273e5f59d544191:0932bb867900f4ca1f17c013ba9e3203
|
||||
example: in:domain/93887001882246db9273e5f59d544191:user/0932bb867900f4ca1f17c013ba9e3203
|
||||
out:93887001882246db9273e5f59d544191:0932bb867900f4ca1f17c013ba9e3203
|
||||
*/
|
||||
func getLocalPrincipalId(principals []string) []string {
|
||||
res := []string{}
|
||||
|
||||
+8
-8
@@ -50,7 +50,7 @@ type SElasticcache struct {
|
||||
MaxMemoryMB int `json:"max_memory"`
|
||||
UsedMemoryMB int `json:"used_memory"`
|
||||
InstanceID string `json:"instance_id"`
|
||||
ResourceSpecCode string `json:"resource_spec_code"`
|
||||
SpecCode string `json:"spec_code"`
|
||||
EngineVersion string `json:"engine_version"`
|
||||
InternalVersion string `json:"internal_version"`
|
||||
ChargingMode int `json:"charging_mode"`
|
||||
@@ -173,7 +173,7 @@ func (self *SElasticcache) GetExpiredAt() time.Time {
|
||||
}
|
||||
|
||||
func (self *SElasticcache) GetInstanceType() string {
|
||||
return self.ResourceSpecCode
|
||||
return self.SpecCode
|
||||
}
|
||||
|
||||
func (self *SElasticcache) GetCapacityMB() int {
|
||||
@@ -181,24 +181,24 @@ func (self *SElasticcache) GetCapacityMB() int {
|
||||
}
|
||||
|
||||
func (self *SElasticcache) GetArchType() string {
|
||||
if strings.Contains(self.ResourceSpecCode, "single") {
|
||||
if strings.Contains(self.SpecCode, "single") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_SINGLE
|
||||
}
|
||||
if strings.Contains(self.ResourceSpecCode, "ha") {
|
||||
if strings.Contains(self.SpecCode, "ha") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_MASTER
|
||||
}
|
||||
if strings.Contains(self.ResourceSpecCode, "cluster") {
|
||||
if strings.Contains(self.SpecCode, "cluster") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_CLUSTER
|
||||
}
|
||||
if strings.Contains(self.ResourceSpecCode, "proxy") {
|
||||
if strings.Contains(self.SpecCode, "proxy") {
|
||||
return api.ELASTIC_CACHE_ARCH_TYPE_CLUSTER
|
||||
}
|
||||
return self.ResourceSpecCode
|
||||
return self.SpecCode
|
||||
}
|
||||
|
||||
func (self *SElasticcache) GetNodeType() string {
|
||||
// single(单副本) | double(双副本)
|
||||
if strings.Contains(self.ResourceSpecCode, "single") {
|
||||
if strings.Contains(self.SpecCode, "single") {
|
||||
return "single"
|
||||
}
|
||||
return "double"
|
||||
|
||||
Reference in New Issue
Block a user