mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #11098 from ioito/automated-cherry-pick-of-#11097-upstream-release-3.7
Automated cherry pick of #11097: fix(region): allow update sku status
This commit is contained in:
@@ -140,6 +140,13 @@ type ServerSkuDetails struct {
|
||||
type ServerSkuUpdateInput struct {
|
||||
apis.EnabledStatusStandaloneResourceBaseUpdateInput
|
||||
|
||||
// 预付费状态
|
||||
// default: available
|
||||
PrepaidStatus string `json:"prepaid_status"`
|
||||
// 后付费状态
|
||||
// default: available
|
||||
PostpaidStatus string `json:"postpaid_status"`
|
||||
|
||||
InstanceTypeFamily string `json:"instance_type_family"`
|
||||
|
||||
InstanceTypeCategory string `json:"instance_type_category"`
|
||||
|
||||
@@ -85,8 +85,8 @@ type SServerSku struct {
|
||||
InstanceTypeCategory string `width:"32" charset:"utf8" nullable:"true" list:"user" create:"admin_optional" update:"admin"` // 通用型
|
||||
LocalCategory string `width:"32" charset:"utf8" nullable:"true" list:"user" create:"admin_optional" update:"admin" default:""` // 记录本地分类
|
||||
|
||||
PrepaidStatus string `width:"32" charset:"utf8" nullable:"true" list:"user" create:"admin_optional" default:"available"` // 预付费资源状态 available|soldout
|
||||
PostpaidStatus string `width:"32" charset:"utf8" nullable:"true" list:"user" create:"admin_optional" default:"available"` // 按需付费资源状态 available|soldout
|
||||
PrepaidStatus string `width:"32" charset:"utf8" nullable:"true" list:"user" update:"admin" create:"admin_optional" default:"available"` // 预付费资源状态 available|soldout
|
||||
PostpaidStatus string `width:"32" charset:"utf8" nullable:"true" list:"user" update:"admin" create:"admin_optional" default:"available"` // 按需付费资源状态 available|soldout
|
||||
|
||||
CpuArch string `width:"16" charset:"ascii" nullable:"true" list:"user" create:"admin_optional" update:"admin"` // CPU 架构 x86|xarm
|
||||
CpuCoreCount int `nullable:"false" list:"user" create:"admin_required"`
|
||||
@@ -629,11 +629,6 @@ func (self *SServerSku) AllowUpdateItem(ctx context.Context, userCred mcclient.T
|
||||
}
|
||||
|
||||
func (self *SServerSku) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.ServerSkuUpdateInput) (api.ServerSkuUpdateInput, error) {
|
||||
// 目前不允许改sku信息
|
||||
if !inWhiteList(self.Provider) {
|
||||
return input, httperrors.NewForbiddenError("can not update instance_type for public cloud %s", self.Provider)
|
||||
}
|
||||
|
||||
if len(input.Name) > 0 {
|
||||
return input, httperrors.NewUnsupportOperationError("Cannot change server sku name")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user