浏览代码

创建LDS任务添加返回错误信息,根据是否包含uuid判断创建是否成功

ChenHaolong 6 月之前
父节点
当前提交
f62faa8ebd
共有 3 个文件被更改,包括 26 次插入20 次删除
  1. 12 12
      src/llnwLDS_pb2.py
  2. 4 2
      src/llnwLDS_pb2.pyi
  3. 10 6
      src/main.py

文件差异内容过多而无法显示
+ 12 - 12
src/llnwLDS_pb2.py


+ 4 - 2
src/llnwLDS_pb2.pyi

@@ -36,10 +36,12 @@ class CreateLDSRequest(_message.Message):
     def __init__(self, base: _Optional[_Union[Base, _Mapping]] = ..., shortName: _Optional[str] = ..., accessKey: _Optional[str] = ..., bucketName: _Optional[str] = ..., location: _Optional[str] = ..., path: _Optional[str] = ..., region: _Optional[str] = ..., secretKey: _Optional[str] = ..., name: _Optional[str] = ...) -> None: ...
 
 class CreateLDSResponse(_message.Message):
-    __slots__ = ["isSuccess"]
+    __slots__ = ["isSuccess", "message"]
     ISSUCCESS_FIELD_NUMBER: _ClassVar[int]
+    MESSAGE_FIELD_NUMBER: _ClassVar[int]
     isSuccess: bool
-    def __init__(self, isSuccess: bool = ...) -> None: ...
+    message: str
+    def __init__(self, isSuccess: bool = ..., message: _Optional[str] = ...) -> None: ...
 
 class DeleteLDSRequest(_message.Message):
     __slots__ = ["base", "shortName", "uuid"]

+ 10 - 6
src/main.py

@@ -212,13 +212,17 @@ def check_cert_withdraw_error(res):
 
 
 def check_lds_create_result(res):
-    if res.get('isEnabled') is None:
-        return CreateLDSResponse(isSuccess=False)
+    if res.get('message') is not None:
+        return CreateLDSResponse(isSuccess=False, message=res.get('message'))
+    elif res.get('errors') is not None:
+        errors = ""
+        for error in res.get('errors'):
+            errors += error + " "
+            return CreateLDSResponse(isSuccess=False, message=errors)
+    elif res.get('uuid') is not None:
+        return CreateLDSResponse(isSuccess=True, message="")
     else:
-        if res.get('isEnabled') is True:
-            return CreateLDSResponse(isSuccess=True)
-        else:
-            return CreateLDSResponse(isSuccess=False)
+        return CreateLDSResponse(isSuccess=False, message=res)
 
 
 def check_lds_delete_result(res_code):