codosdk 1.0.16__tar.gz → 1.0.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codosdk-1.0.16 → codosdk-1.0.18}/PKG-INFO +1 -1
- {codosdk-1.0.16 → codosdk-1.0.18}/codosdk.egg-info/PKG-INFO +1 -1
- {codosdk-1.0.16 → codosdk-1.0.18}/setup.py +1 -1
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/crud_utils.py +12 -6
- {codosdk-1.0.16 → codosdk-1.0.18}/LICENSE +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/README.md +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/codosdk.egg-info/SOURCES.txt +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/codosdk.egg-info/dependency_links.txt +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/codosdk.egg-info/requires.txt +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/codosdk.egg-info/top_level.txt +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/opssdk/__init__.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/opssdk/utils/__init__.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/pyproject.toml +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/setup.cfg +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/__init__.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/api_set.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/apis/__init__.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/apis/admin_apis.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/apis/agent_apis.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/apis/cmdb_apis.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/apis/kerrigan_apis.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/apis/mgv4_apis.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/apis/task_apis.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/application.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/base_handler.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/cache.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/cache_context.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/client.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/cloud/__init__.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/cloud/qcloud_api.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/cloud/ucloud_api.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/cloud_utils.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/configs.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/consts.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/db_context.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/error.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/fetch_coroutine.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/jwt_token.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/ldap.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/logger.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/model_utils.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/mqhelper.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/program.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/salt_api.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/sqlalchemy_pagination.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/tools.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/utils/__init__.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/utils/cc_crypto.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/utils/date_format.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/utils/pydantic_utils.py +0 -0
- {codosdk-1.0.16 → codosdk-1.0.18}/websdk2/web_logs.py +0 -0
|
@@ -9,7 +9,7 @@ desc : CODO SDK
|
|
|
9
9
|
import sys
|
|
10
10
|
from setuptools import setup, find_packages
|
|
11
11
|
|
|
12
|
-
VERSION = '1.0.
|
|
12
|
+
VERSION = '1.0.18'
|
|
13
13
|
|
|
14
14
|
if sys.version_info < (2, 7) or (3, 0) <= sys.version_info < (3, 6):
|
|
15
15
|
print('This program requires at least Python 2.7 or 3.6 to run.')
|
|
@@ -63,6 +63,7 @@ class ModelCRUDView:
|
|
|
63
63
|
self.prepare()
|
|
64
64
|
|
|
65
65
|
value = params.get('searchValue', params.get('searchVal'))
|
|
66
|
+
id_list = params.get('id_list', [])
|
|
66
67
|
filter_map = params.pop('filter_map', {})
|
|
67
68
|
params.setdefault('page_size', 300) # 统一处理默认值
|
|
68
69
|
|
|
@@ -89,6 +90,8 @@ class ModelCRUDView:
|
|
|
89
90
|
try:
|
|
90
91
|
with DBContext('r') as session:
|
|
91
92
|
query = session.query(self.model).filter(filter_condition).filter_by(**filter_map)
|
|
93
|
+
if id_list and isinstance(id_list, list):
|
|
94
|
+
query = query.filter(self.model.id.in_(id_list))
|
|
92
95
|
page = paginate(query, **params)
|
|
93
96
|
except Exception as e:
|
|
94
97
|
return dict(code=2, msg='查询失败', data=None, reason=str(e), timestamp=get_millisecond_timestamp())
|
|
@@ -112,18 +115,21 @@ class ModelCRUDView:
|
|
|
112
115
|
try:
|
|
113
116
|
self.pydantic_model(**data)
|
|
114
117
|
except ValidationError as e:
|
|
115
|
-
return dict(code=-1, msg='数据格式出错', reason=str(e), timestamp=get_millisecond_timestamp())
|
|
118
|
+
return dict(code=-1, msg='数据格式出错', reason=str(e), data=None, timestamp=get_millisecond_timestamp())
|
|
116
119
|
|
|
117
120
|
try:
|
|
118
121
|
with DBContext('w', None, True) as db:
|
|
119
|
-
|
|
122
|
+
__record = self.model(**data)
|
|
123
|
+
db.add(__record)
|
|
124
|
+
db.flush()
|
|
125
|
+
new_id = __record.id
|
|
126
|
+
return dict(code=0, msg="创建成功", data={"new_id": new_id}, reason="",
|
|
127
|
+
timestamp=get_millisecond_timestamp())
|
|
120
128
|
except IntegrityError as e:
|
|
121
|
-
return dict(code=-2, msg='不要重复添加', reason=str(e), timestamp=get_millisecond_timestamp())
|
|
129
|
+
return dict(code=-2, msg='不要重复添加', data=None, reason=str(e), timestamp=get_millisecond_timestamp())
|
|
122
130
|
|
|
123
131
|
except Exception as e:
|
|
124
|
-
return dict(code=-3, msg='创建失败', reason=str(e), timestamp=get_millisecond_timestamp())
|
|
125
|
-
|
|
126
|
-
return dict(code=0, msg="创建成功", reason="", timestamp=get_millisecond_timestamp())
|
|
132
|
+
return dict(code=-3, msg='创建失败', data=None, reason=str(e), timestamp=get_millisecond_timestamp())
|
|
127
133
|
|
|
128
134
|
def handle_update(self, data: dict) -> dict:
|
|
129
135
|
self.prepare()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|