fix: api文档描述更正

This commit is contained in:
Qu Xuan
2020-04-15 17:35:08 +08:00
parent 78e24ccd25
commit 345b8f3f9d
3 changed files with 14 additions and 6 deletions
+4 -2
View File
@@ -80,7 +80,7 @@ type SBillingResourceBase struct {
// SBucket is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SBucket.
type SBucket struct {
apis.SVirtualResourceBase
apis.SSharableVirtualResourceBase
apis.SExternalizedResourceBase
SCloudregionResourceBase
SManagedResourceBase
@@ -931,7 +931,7 @@ type SHost struct {
SysInfo interface{} `json:"sys_info"`
// 物理机序列号信息
SN string `json:"sn"`
// CPU大小
// CPU核数
CpuCount int `json:"cpu_count"`
// 物理CPU颗数
NodeCount byte `json:"node_count"`
@@ -1720,6 +1720,8 @@ type SScalingGroup struct {
LoadbalancerBackendWeight int `json:"loadbalancer_backend_weight"`
// Time to allow scale
AllowScaleTime time.Time `json:"allow_scale_time"`
// NextCheckTime descripe the next time to check instance's health
NextCheckTime time.Time `json:"next_check_time"`
}
// SScalingGroupGuest is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SScalingGroupGuest.
+3 -3
View File
@@ -107,11 +107,11 @@ type ModelBaseListInput struct {
Filter []string `json:"filter"`
// 指定关联过滤条件,允许指定多个,后端将根据关联过滤条件和其他表关联查询,支持的查询语法和filter相同,
// 和其他表关联的语法如下:
// joint_tbl.related_key(origin_key).filter_col.filter_ops(values)
// 其中,joint_tbl为要关联的表,related_key为关联表column,origin_key为当前表column, filter_col为
// joint_resources.related_key(origin_key).filter_col.filter_ops(values)
// 其中,joint_resources为要关联的资源名称,related_key为关联表column,origin_key为当前表column, filter_col为
// 关联表用于查询匹配的field名称,field_ops为filter支持的操作,values为匹配的值
// 举例:
// guestnetworks_tbl.guest_id(id).ip_addr.equals('10.168.21.222')
// guestnetworks.guest_id(id).ip_addr.equals('10.168.21.222')
JointFilter []string `json:"joint_filter"`
// 如果filter_any为true,则查询所有filter的并集,否则为交集
FilterAny *bool `json:"filter_any"`
+7 -1
View File
@@ -215,6 +215,9 @@ func applyListItemsGeneralJointFilters(manager IModelManager, q *sqlchemy.SQuery
jfc := filterclause.ParseJointFilterClause(f)
if jfc != nil {
jointModelManager := GetModelManager(jfc.GetJointModelName())
if jointModelManager == nil {
return nil, httperrors.NewResourceNotFoundError("invalid joint resources %s", jfc.GetJointModelName())
}
schFields := searchFields(jointModelManager, userCred)
if schFields.Contains(jfc.GetField()) {
sq := jointModelManager.Query(jfc.RelatedKey)
@@ -300,7 +303,10 @@ func listItemQueryFiltersRaw(manager IModelManager,
}
jointFilter := jsonutils.GetQueryStringArray(query, "joint_filter")
if len(jointFilter) > 0 {
q, _ = applyListItemsGeneralJointFilters(manager, q, userCred, jointFilter, filterAny)
q, err = applyListItemsGeneralJointFilters(manager, q, userCred, jointFilter, filterAny)
if err != nil {
return nil, err
}
}
return q, nil
}