mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix: 1. parameter duplicate error due to missing name filter 2.
infras_quota setKeys error
This commit is contained in:
@@ -36,4 +36,7 @@ type ParameterListInput struct {
|
||||
// Deprecated
|
||||
// swagger:ignore
|
||||
UserId string `json:"user_id" deprecated-by:"user"`
|
||||
|
||||
// filter by name
|
||||
Name []string `json:"name"`
|
||||
}
|
||||
|
||||
@@ -70,18 +70,18 @@ func init() {
|
||||
type SInfrasQuota struct {
|
||||
quotas.SQuotaBase
|
||||
|
||||
quotas.SRegionalCloudResourceKeys
|
||||
quotas.SDomainRegionalCloudResourceKeys
|
||||
|
||||
Host int `default:"-1" allow_zero:"true" json:"host"`
|
||||
Vpc int `default:"-1" allow_zero:"true" json:"vpc"`
|
||||
}
|
||||
|
||||
func (self *SInfrasQuota) GetKeys() quotas.IQuotaKeys {
|
||||
return self.SRegionalCloudResourceKeys
|
||||
return self.SDomainRegionalCloudResourceKeys
|
||||
}
|
||||
|
||||
func (self *SInfrasQuota) SetKeys(keys quotas.IQuotaKeys) {
|
||||
self.SRegionalCloudResourceKeys = keys.(quotas.SRegionalCloudResourceKeys)
|
||||
self.SDomainRegionalCloudResourceKeys = keys.(quotas.SDomainRegionalCloudResourceKeys)
|
||||
}
|
||||
|
||||
func (self *SInfrasQuota) FetchSystemQuota() {
|
||||
@@ -106,7 +106,7 @@ func (self *SInfrasQuota) FetchSystemQuota() {
|
||||
}
|
||||
|
||||
func (self *SInfrasQuota) FetchUsage(ctx context.Context) error {
|
||||
regionKeys := self.SRegionalCloudResourceKeys
|
||||
regionKeys := self.SDomainRegionalCloudResourceKeys
|
||||
|
||||
scope := regionKeys.Scope()
|
||||
ownerId := regionKeys.OwnerId()
|
||||
|
||||
@@ -256,6 +256,9 @@ func (manager *SParameterManager) ListItemFilter(
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "SResourceBaseManager.ListItemFilter")
|
||||
}
|
||||
if len(query.Name) > 0 {
|
||||
q = q.In("name", query.Name)
|
||||
}
|
||||
if db.IsAdminAllowList(userCred, manager) {
|
||||
if id := query.NamespaceId; len(id) > 0 {
|
||||
q = q.Equals("namespace_id", id)
|
||||
@@ -372,3 +375,7 @@ func (model *SParameter) GetOwnerId() mcclient.IIdentityProvider {
|
||||
owner := db.SOwnerId{UserId: model.NamespaceId}
|
||||
return &owner
|
||||
}
|
||||
|
||||
func (manager *SParameterManager) FetchOwnerId(ctx context.Context, data jsonutils.JSONObject) (mcclient.IIdentityProvider, error) {
|
||||
return db.FetchUserInfo(ctx, data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user