refactor(climc): remove dependence for yunion.io/x/pkg/cloudcommon/db

This commit is contained in:
rainzm
2021-01-14 19:00:55 +08:00
parent 197c90acbe
commit a68888979f
4 changed files with 43 additions and 6 deletions
+15
View File
@@ -0,0 +1,15 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package db // import "yunion.io/x/onecloud/pkg/apis/cloudcommon/db"
+21
View File
@@ -0,0 +1,21 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package db
const (
CLOUD_TAG_PREFIX = "ext:"
USER_TAG_PREFIX = "user:"
SYS_CLOUD_TAG_PREFIX = "sys:"
)
+4 -3
View File
@@ -29,6 +29,7 @@ import (
"yunion.io/x/sqlchemy"
"yunion.io/x/onecloud/pkg/apis"
dbapi "yunion.io/x/onecloud/pkg/apis/cloudcommon/db"
"yunion.io/x/onecloud/pkg/cloudcommon/consts"
"yunion.io/x/onecloud/pkg/cloudcommon/db/lockman"
"yunion.io/x/onecloud/pkg/cloudcommon/policy"
@@ -41,9 +42,9 @@ import (
const (
SYSTEM_ADMIN_PREFIX = "__sys_"
SYS_TAG_PREFIX = "__"
CLOUD_TAG_PREFIX = "ext:"
USER_TAG_PREFIX = "user:"
SYS_CLOUD_TAG_PREFIX = "sys:"
CLOUD_TAG_PREFIX = dbapi.CLOUD_TAG_PREFIX
USER_TAG_PREFIX = dbapi.USER_TAG_PREFIX
SYS_CLOUD_TAG_PREFIX = dbapi.SYS_CLOUD_TAG_PREFIX
// TAG_DELETE_RANGE_USER = "user"
// TAG_DELETE_RANGE_CLOUD = CLOUD_TAG_PREFIX // "cloud"
+3 -3
View File
@@ -24,7 +24,7 @@ import (
"yunion.io/x/pkg/gotypes"
"yunion.io/x/pkg/util/reflectutils"
"yunion.io/x/onecloud/pkg/cloudcommon/db"
dbapi "yunion.io/x/onecloud/pkg/apis/cloudcommon/db"
)
// Int returns a pointer to int type with the same value as the argument. This
@@ -288,14 +288,14 @@ func (opts *BaseListOptions) Params() (*jsonutils.JSONDict, error) {
tagIdx++
}
for _, tag := range opts.UserTags {
err = opts.addTag(db.USER_TAG_PREFIX, tag, tagIdx, params)
err = opts.addTag(dbapi.USER_TAG_PREFIX, tag, tagIdx, params)
if err != nil {
return nil, err
}
tagIdx++
}
for _, tag := range opts.CloudTags {
err = opts.addTag(db.CLOUD_TAG_PREFIX, tag, tagIdx, params)
err = opts.addTag(dbapi.CLOUD_TAG_PREFIX, tag, tagIdx, params)
if err != nil {
return nil, err
}