cmdbox 0.6.3.2__py3-none-any.whl → 0.6.4__py3-none-any.whl

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.

Potentially problematic release.


This version of cmdbox might be problematic. Click here for more details.

Files changed (133) hide show
  1. cmdbox/app/app.py +16 -7
  2. cmdbox/app/common.py +2 -2
  3. cmdbox/app/commons/redis_client.py +1 -1
  4. cmdbox/app/edge.py +1 -1
  5. cmdbox/app/feature.py +1 -1
  6. cmdbox/app/features/cli/cmdbox_audit_createdb.py +224 -224
  7. cmdbox/app/features/cli/cmdbox_audit_delete.py +4 -4
  8. cmdbox/app/features/cli/cmdbox_audit_search.py +4 -4
  9. cmdbox/app/features/cli/cmdbox_audit_write.py +6 -8
  10. cmdbox/app/features/cli/cmdbox_client_file_copy.py +3 -3
  11. cmdbox/app/features/cli/cmdbox_client_file_download.py +3 -3
  12. cmdbox/app/features/cli/cmdbox_client_file_list.py +3 -3
  13. cmdbox/app/features/cli/cmdbox_client_file_mkdir.py +3 -3
  14. cmdbox/app/features/cli/cmdbox_client_file_move.py +3 -3
  15. cmdbox/app/features/cli/cmdbox_client_file_remove.py +3 -3
  16. cmdbox/app/features/cli/cmdbox_client_file_rmdir.py +3 -3
  17. cmdbox/app/features/cli/cmdbox_client_file_upload.py +3 -3
  18. cmdbox/app/features/cli/cmdbox_client_http.py +7 -6
  19. cmdbox/app/features/cli/cmdbox_client_server_info.py +4 -4
  20. cmdbox/app/features/cli/cmdbox_cmd_list.py +3 -3
  21. cmdbox/app/features/cli/cmdbox_cmd_load.py +5 -5
  22. cmdbox/app/features/cli/cmdbox_edge_config.py +1 -1
  23. cmdbox/app/features/cli/cmdbox_edge_start.py +3 -3
  24. cmdbox/app/features/cli/cmdbox_mcp_client.py +174 -174
  25. cmdbox/app/features/cli/cmdbox_mcp_proxy.py +96 -96
  26. cmdbox/app/features/cli/cmdbox_server_list.py +2 -2
  27. cmdbox/app/features/cli/cmdbox_server_start.py +103 -103
  28. cmdbox/app/features/cli/cmdbox_server_stop.py +4 -4
  29. cmdbox/app/features/cli/cmdbox_tts_install.py +307 -0
  30. cmdbox/app/features/cli/cmdbox_tts_say.py +179 -0
  31. cmdbox/app/features/cli/cmdbox_tts_start.py +329 -0
  32. cmdbox/app/features/cli/cmdbox_tts_stop.py +108 -0
  33. cmdbox/app/features/cli/cmdbox_web_apikey_add.py +91 -91
  34. cmdbox/app/features/cli/cmdbox_web_apikey_del.py +91 -91
  35. cmdbox/app/features/cli/cmdbox_web_gencert.py +6 -6
  36. cmdbox/app/features/cli/cmdbox_web_genpass.py +168 -168
  37. cmdbox/app/features/cli/cmdbox_web_group_add.py +94 -94
  38. cmdbox/app/features/cli/cmdbox_web_group_del.py +87 -87
  39. cmdbox/app/features/cli/cmdbox_web_group_edit.py +94 -94
  40. cmdbox/app/features/cli/cmdbox_web_group_list.py +87 -87
  41. cmdbox/app/features/cli/cmdbox_web_start.py +235 -235
  42. cmdbox/app/features/cli/cmdbox_web_stop.py +72 -72
  43. cmdbox/app/features/cli/cmdbox_web_user_add.py +104 -104
  44. cmdbox/app/features/cli/cmdbox_web_user_del.py +87 -87
  45. cmdbox/app/features/cli/cmdbox_web_user_edit.py +104 -104
  46. cmdbox/app/features/cli/cmdbox_web_user_list.py +87 -87
  47. cmdbox/app/filer.py +9 -9
  48. cmdbox/app/mcp.py +15 -7
  49. cmdbox/app/options.py +46 -43
  50. cmdbox/app/server.py +224 -224
  51. cmdbox/extensions/features.yml +3 -0
  52. cmdbox/extensions/sample_project/sample/app/features/cli/sample_client_time.py +2 -2
  53. cmdbox/extensions/sample_project/sample/app/features/cli/sample_server_time.py +3 -3
  54. cmdbox/licenses/LICENSE_Werkzeug_3_1_1_BSD_License.txt +28 -0
  55. cmdbox/licenses/LICENSE_absolufy-imports_0_3_1_MIT_License.txt +21 -0
  56. cmdbox/licenses/LICENSE_cyclopts_3_22_5_Apache_Software_License.txt +201 -0
  57. cmdbox/licenses/LICENSE_isodate_0_7_2_BSD_License.txt +26 -0
  58. cmdbox/licenses/LICENSE_lazy-object-proxy_1_11_0_BSD_License.txt +20 -0
  59. cmdbox/licenses/LICENSE_openapi-core_0_19_5_BSD_License.txt +29 -0
  60. cmdbox/licenses/LICENSE_openapi-schema-validator_0_6_3_BSD_License.txt +29 -0
  61. cmdbox/licenses/LICENSE_openapi-spec-validator_0_7_2_Apache_Software_License.txt +201 -0
  62. cmdbox/licenses/LICENSE_opentelemetry-semantic-conventions_0_57b0_UNKNOWN.txt +201 -0
  63. cmdbox/licenses/LICENSE_parse_1_20_2_MIT_License.txt +19 -0
  64. cmdbox/licenses/LICENSE_pathable_0_4_4_Apache_Software_License.txt +201 -0
  65. cmdbox/licenses/{LICENSE_pillow_11_2_1_UNKNOWN.txt → LICENSE_pillow_11_3_0_UNKNOWN.txt} +393 -3
  66. cmdbox/licenses/LICENSE_pyperclip_1_9_0_BSD_License.txt +27 -0
  67. cmdbox/licenses/LICENSE_rfc3339-validator_0_1_4_MIT_License.txt +22 -0
  68. cmdbox/licenses/LICENSE_rich-rst_1_3_1_MIT_License.txt +7 -0
  69. cmdbox/licenses/{LICENSE_setuptools_65_5_0_MIT_License.txt → LICENSE_setuptools_80_9_0_UNKNOWN.txt} +0 -2
  70. cmdbox/licenses/LICENSE_tokenizers_0_21_4_Apache_Software_License.txt +1 -0
  71. cmdbox/licenses/LICENSE_voicevox_core_0_16_0_MIT.txt +20 -0
  72. cmdbox/licenses/LICENSE_watchdog_6_0_0_Apache_Software_License.txt +16 -0
  73. cmdbox/licenses/{LICENSE_typer_0_16_0_MIT_License.txt → LICENSE_wsproto_1_2_0_MIT_License.txt} +2 -2
  74. cmdbox/licenses/files.txt +56 -42
  75. cmdbox/logconf_cmdbox.yml +104 -0
  76. cmdbox/version.py +2 -2
  77. cmdbox/web/agent.html +8 -2
  78. cmdbox/web/assets/cmdbox/agent.js +182 -1
  79. cmdbox/web/assets/cmdbox/common.js +16 -3
  80. cmdbox/web/assets/cmdbox/svgicon.js +18 -0
  81. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.dist-info}/METADATA +28 -20
  82. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.dist-info}/RECORD +122 -112
  83. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.dist-info}/WHEEL +1 -1
  84. cmdbox/config.yml +0 -3
  85. cmdbox/licenses/LICENSE_httptools_0_6_4_MIT_License.txt +0 -21
  86. cmdbox/licenses/LICENSE_shellingham_1_5_4_ISC_License-ISCL.txt +0 -13
  87. cmdbox/licenses/LICENSE_watchfiles_1_1_0_MIT_License.txt +0 -21
  88. cmdbox/logconf_audit.yml +0 -43
  89. cmdbox/logconf_client.yml +0 -43
  90. cmdbox/logconf_edge.yml +0 -43
  91. cmdbox/logconf_gui.yml +0 -43
  92. cmdbox/logconf_mcp.yml +0 -43
  93. cmdbox/logconf_server.yml +0 -43
  94. cmdbox/logconf_web.yml +0 -43
  95. /cmdbox/licenses/{LICENSE_Authlib_1_6_0_BSD_License.txt → LICENSE_Authlib_1_6_1_BSD_License.txt} +0 -0
  96. /cmdbox/licenses/{LICENSE_SQLAlchemy_2_0_41_MIT.txt → LICENSE_SQLAlchemy_2_0_42_MIT.txt} +0 -0
  97. /cmdbox/licenses/{LICENSE_aiohttp_3_12_13_Apache-2_0.txt → LICENSE_aiohttp_3_12_15_Apache-2_0_AND_MIT.txt} +0 -0
  98. /cmdbox/licenses/{LICENSE_aiosignal_1_3_2_Apache_Software_License.txt → LICENSE_aiosignal_1_4_0_Apache_Software_License.txt} +0 -0
  99. /cmdbox/licenses/{LICENSE_certifi_2025_6_15_Mozilla_Public_License_2_0-MPL_2_0.txt → LICENSE_certifi_2025_7_14_Mozilla_Public_License_2_0-MPL_2_0.txt} +0 -0
  100. /cmdbox/licenses/{LICENSE_cryptography_45_0_4_Apache-2_0_OR_BSD-3-Clause.txt → LICENSE_cryptography_45_0_5_Apache-2_0_OR_BSD-3-Clause.txt} +0 -0
  101. /cmdbox/licenses/{LICENSE_docstring_parser_0_16_MIT_License.txt → LICENSE_docstring_parser_0_17_0_MIT_License.txt} +0 -0
  102. /cmdbox/licenses/{LICENSE_fastapi_0_115_14_MIT_License.txt → LICENSE_fastapi_0_116_1_MIT_License.txt} +0 -0
  103. /cmdbox/licenses/{LICENSE_fastmcp_2_10_1_Apache_Software_License.txt → LICENSE_fastmcp_2_11_0_Apache_Software_License.txt} +0 -0
  104. /cmdbox/licenses/{LICENSE_fsspec_2025_5_1_BSD_License.txt → LICENSE_fsspec_2025_7_0_BSD_License.txt} +0 -0
  105. /cmdbox/licenses/{LICENSE_google-adk_1_5_0_Apache_Software_License.txt → LICENSE_google-adk_1_9_0_Apache_Software_License.txt} +0 -0
  106. /cmdbox/licenses/{LICENSE_google-api-python-client_2_174_0_Apache_Software_License.txt → LICENSE_google-api-python-client_2_177_0_Apache_Software_License.txt} +0 -0
  107. /cmdbox/licenses/{LICENSE_google-cloud-aiplatform_1_100_0_Apache_2_0.txt → LICENSE_google-cloud-aiplatform_1_106_0_Apache_2_0.txt} +0 -0
  108. /cmdbox/licenses/{LICENSE_google-cloud-bigquery_3_34_0_Apache_Software_License.txt → LICENSE_google-cloud-bigquery_3_35_1_Apache_Software_License.txt} +0 -0
  109. /cmdbox/licenses/{LICENSE_google-genai_1_23_0_Apache_Software_License.txt → LICENSE_google-genai_1_28_0_Apache_Software_License.txt} +0 -0
  110. /cmdbox/licenses/{LICENSE_grpcio-status_1_73_1_Apache_Software_License.txt → LICENSE_grpcio-status_1_74_0_Apache_Software_License.txt} +0 -0
  111. /cmdbox/licenses/{LICENSE_grpcio_1_73_1_Apache_Software_License.txt → LICENSE_grpcio_1_74_0_Apache_Software_License.txt} +0 -0
  112. /cmdbox/licenses/{LICENSE_huggingface-hub_0_33_1_Apache_Software_License.txt → LICENSE_huggingface-hub_0_34_3_Apache_Software_License.txt} +0 -0
  113. /cmdbox/licenses/{LICENSE_opentelemetry-api_1_34_1_Apache_Software_License.txt → LICENSE_jsonschema-path_0_3_4_Apache_Software_License.txt} +0 -0
  114. /cmdbox/licenses/{LICENSE_jsonschema_4_24_0_UNKNOWN.txt → LICENSE_jsonschema_4_25_0_UNKNOWN.txt} +0 -0
  115. /cmdbox/licenses/{LICENSE_litellm_1_73_6_MIT_License.txt → LICENSE_litellm_1_74_12_MIT_License.txt} +0 -0
  116. /cmdbox/licenses/{LICENSE_mcp_1_10_1_MIT_License.txt → LICENSE_mcp_1_12_3_MIT_License.txt} +0 -0
  117. /cmdbox/licenses/{LICENSE_multidict_6_6_2_Apache_License_2_0.txt → LICENSE_multidict_6_6_3_Apache_License_2_0.txt} +0 -0
  118. /cmdbox/licenses/{LICENSE_nh3_0_2_21_MIT.txt → LICENSE_nh3_0_3_0_MIT.txt} +0 -0
  119. /cmdbox/licenses/{LICENSE_numpy_2_3_1_BSD_License.txt → LICENSE_numpy_2_3_2_BSD_License.txt} +0 -0
  120. /cmdbox/licenses/{LICENSE_openai_1_93_0_Apache_Software_License.txt → LICENSE_openai_1_98_0_Apache_Software_License.txt} +0 -0
  121. /cmdbox/licenses/{LICENSE_opentelemetry-sdk_1_34_1_Apache_Software_License.txt → LICENSE_opentelemetry-api_1_36_0_UNKNOWN.txt} +0 -0
  122. /cmdbox/licenses/{LICENSE_opentelemetry-semantic-conventions_0_55b1_Apache_Software_License.txt → LICENSE_opentelemetry-sdk_1_36_0_UNKNOWN.txt} +0 -0
  123. /cmdbox/licenses/{LICENSE_tokenizers_0_21_2_Apache_Software_License.txt → LICENSE_pywin32_311_Python_Software_Foundation_License.txt} +0 -0
  124. /cmdbox/licenses/{LICENSE_regex_2024_11_6_Apache_Software_License.txt → LICENSE_regex_2025_7_34_UNKNOWN.txt} +0 -0
  125. /cmdbox/licenses/{LICENSE_rich_14_0_0_MIT_License.txt → LICENSE_rich_14_1_0_MIT_License.txt} +0 -0
  126. /cmdbox/licenses/{LICENSE_rpds-py_0_25_1_MIT.txt → LICENSE_rpds-py_0_26_0_MIT.txt} +0 -0
  127. /cmdbox/licenses/{LICENSE_sse-starlette_2_3_6_BSD_License.txt → LICENSE_sse-starlette_3_0_2_UNKNOWN.txt} +0 -0
  128. /cmdbox/licenses/{LICENSE_starlette_0_46_2_BSD_License.txt → LICENSE_starlette_0_47_2_BSD_License.txt} +0 -0
  129. /cmdbox/licenses/{LICENSE_typing_extensions_4_14_0_UNKNOWN.txt → LICENSE_typing_extensions_4_14_1_UNKNOWN.txt} +0 -0
  130. /cmdbox/licenses/{LICENSE_zope_event_5_1_Zope_Public_License.txt → LICENSE_zope_event_5_1_1_Zope_Public_License.txt} +0 -0
  131. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.dist-info}/entry_points.txt +0 -0
  132. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.dist-info/licenses}/LICENSE +0 -0
  133. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.dist-info}/top_level.txt +0 -0
@@ -1,91 +1,91 @@
1
- from cmdbox.app import common, feature, web
2
- from cmdbox.app.options import Options
3
- from pathlib import Path
4
- from typing import Dict, Any, Tuple, List, Union
5
- import argparse
6
- import logging
7
-
8
-
9
- class WebApikeyAdd(feature.UnsupportEdgeFeature):
10
- def get_mode(self) -> Union[str, List[str]]:
11
- """
12
- この機能のモードを返します
13
-
14
- Returns:
15
- Union[str, List[str]]: モード
16
- """
17
- return 'web'
18
-
19
- def get_cmd(self):
20
- """
21
- この機能のコマンドを返します
22
-
23
- Returns:
24
- str: コマンド
25
- """
26
- return 'apikey_add'
27
-
28
- def get_option(self):
29
- """
30
- この機能のオプションを返します
31
-
32
- Returns:
33
- Dict[str, Any]: オプション
34
- """
35
- return dict(
36
- use_redis=self.USE_REDIS_MEIGHT, nouse_webmode=False,
37
- description_ja="WebモードのユーザーのApiKeyを追加します。",
38
- description_en="Add an ApiKey for a user in Web mode.",
39
- choice=[
40
- dict(opt="user_name", type=Options.T_STR, default=None, required=True, multi=False, hide=False, choice=None,
41
- description_ja="対象のユーザー名を指定します。",
42
- description_en="Specify the target user name."),
43
- dict(opt="apikey_name", type=Options.T_STR, default=None, required=True, multi=False, hide=False, choice=None,
44
- description_ja="このユーザーのApiKey名を指定します。",
45
- description_en="Specify the ApiKey name for this user."),
46
- dict(opt="signin_file", type=Options.T_FILE, default=f".{self.ver.__appid__}/user_list.yml", required=True, multi=False, hide=False, choice=None, fileio="in",
47
- description_ja="サインイン可能なユーザーとパスワードを記載したファイルを指定します。省略した時は認証を要求しません。",
48
- description_en="Specify a file containing users and passwords with which they can signin. If omitted, no authentication is required."),
49
- dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
50
- description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
51
- description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
52
- dict(opt="capture_stdout", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
53
- description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をキャプチャーし、実行結果画面に表示します。",
54
- description_en="Available only in GUI mode. Captures standard output during command execution and displays it on the execution result screen."),
55
- dict(opt="capture_maxsize", type=Options.T_INT, default=self.DEFAULT_CAPTURE_MAXSIZE, required=False, multi=False, hide=True, choice=None,
56
- description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力の最大キャプチャーサイズを指定します。",
57
- description_en="Available only in GUI mode. Specifies the maximum capture size of standard output when executing commands."),
58
- ]
59
- )
60
-
61
- def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
62
- """
63
- この機能の実行を行います
64
-
65
- Args:
66
- logger (logging.Logger): ロガー
67
- args (argparse.Namespace): 引数
68
- tm (float): 実行開始時間
69
- pf (List[Dict[str, float]]): 呼出元のパフォーマンス情報
70
-
71
- Returns:
72
- Tuple[int, Dict[str, Any], Any]: 終了コード, 結果, オブジェクト
73
- """
74
- if args.data is None:
75
- msg = dict(warn=f"Please specify the --data option.")
76
- common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
77
- return 1, msg, None
78
- w = None
79
- try:
80
- w = web.Web(logger, self.default_data, appcls=self.appcls, ver=self.ver,
81
- redis_host=self.default_host, redis_port=self.default_port, redis_password=self.default_pass, svname=self.default_svname,
82
- signin_file=args.signin_file)
83
- user = dict(name=args.user_name, apikey_name=args.apikey_name)
84
- apikey = w.apikey_add(user)
85
- msg = dict(success=dict(apikey=apikey, msg=f"User ApiKey added. user_name={args.user_name} apikey_name={args.apikey_name}"))
86
- common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
87
- return 0, msg, w
88
- except Exception as e:
89
- msg = dict(warn=f"{e}")
90
- common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
91
- return 1, msg, w
1
+ from cmdbox.app import common, feature, web
2
+ from cmdbox.app.options import Options
3
+ from pathlib import Path
4
+ from typing import Dict, Any, Tuple, List, Union
5
+ import argparse
6
+ import logging
7
+
8
+
9
+ class WebApikeyAdd(feature.UnsupportEdgeFeature):
10
+ def get_mode(self) -> Union[str, List[str]]:
11
+ """
12
+ この機能のモードを返します
13
+
14
+ Returns:
15
+ Union[str, List[str]]: モード
16
+ """
17
+ return 'web'
18
+
19
+ def get_cmd(self):
20
+ """
21
+ この機能のコマンドを返します
22
+
23
+ Returns:
24
+ str: コマンド
25
+ """
26
+ return 'apikey_add'
27
+
28
+ def get_option(self):
29
+ """
30
+ この機能のオプションを返します
31
+
32
+ Returns:
33
+ Dict[str, Any]: オプション
34
+ """
35
+ return dict(
36
+ use_redis=self.USE_REDIS_MEIGHT, nouse_webmode=False,
37
+ description_ja="WebモードのユーザーのApiKeyを追加します。",
38
+ description_en="Add an ApiKey for a user in Web mode.",
39
+ choice=[
40
+ dict(opt="user_name", type=Options.T_STR, default=None, required=True, multi=False, hide=False, choice=None,
41
+ description_ja="対象のユーザー名を指定します。",
42
+ description_en="Specify the target user name."),
43
+ dict(opt="apikey_name", type=Options.T_STR, default=None, required=True, multi=False, hide=False, choice=None,
44
+ description_ja="このユーザーのApiKey名を指定します。",
45
+ description_en="Specify the ApiKey name for this user."),
46
+ dict(opt="signin_file", type=Options.T_FILE, default=f".{self.ver.__appid__}/user_list.yml", required=True, multi=False, hide=False, choice=None, fileio="in",
47
+ description_ja="サインイン可能なユーザーとパスワードを記載したファイルを指定します。省略した時は認証を要求しません。",
48
+ description_en="Specify a file containing users and passwords with which they can signin. If omitted, no authentication is required."),
49
+ dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
50
+ description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
51
+ description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
52
+ dict(opt="capture_stdout", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
53
+ description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をキャプチャーし、実行結果画面に表示します。",
54
+ description_en="Available only in GUI mode. Captures standard output during command execution and displays it on the execution result screen."),
55
+ dict(opt="capture_maxsize", type=Options.T_INT, default=self.DEFAULT_CAPTURE_MAXSIZE, required=False, multi=False, hide=True, choice=None,
56
+ description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力の最大キャプチャーサイズを指定します。",
57
+ description_en="Available only in GUI mode. Specifies the maximum capture size of standard output when executing commands."),
58
+ ]
59
+ )
60
+
61
+ def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
62
+ """
63
+ この機能の実行を行います
64
+
65
+ Args:
66
+ logger (logging.Logger): ロガー
67
+ args (argparse.Namespace): 引数
68
+ tm (float): 実行開始時間
69
+ pf (List[Dict[str, float]]): 呼出元のパフォーマンス情報
70
+
71
+ Returns:
72
+ Tuple[int, Dict[str, Any], Any]: 終了コード, 結果, オブジェクト
73
+ """
74
+ if args.data is None:
75
+ msg = dict(warn=f"Please specify the --data option.")
76
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
77
+ return self.RESP_WARN, msg, None
78
+ w = None
79
+ try:
80
+ w = web.Web(logger, self.default_data, appcls=self.appcls, ver=self.ver,
81
+ redis_host=self.default_host, redis_port=self.default_port, redis_password=self.default_pass, svname=self.default_svname,
82
+ signin_file=args.signin_file)
83
+ user = dict(name=args.user_name, apikey_name=args.apikey_name)
84
+ apikey = w.apikey_add(user)
85
+ msg = dict(success=dict(apikey=apikey, msg=f"User ApiKey added. user_name={args.user_name} apikey_name={args.apikey_name}"))
86
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
87
+ return self.RESP_SUCCESS, msg, w
88
+ except Exception as e:
89
+ msg = dict(warn=f"{e}")
90
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
91
+ return self.RESP_WARN, msg, w
@@ -1,91 +1,91 @@
1
- from cmdbox.app import common, feature, web
2
- from cmdbox.app.options import Options
3
- from pathlib import Path
4
- from typing import Dict, Any, Tuple, List, Union
5
- import argparse
6
- import logging
7
-
8
-
9
- class WebApikeyDel(feature.UnsupportEdgeFeature):
10
- def get_mode(self) -> Union[str, List[str]]:
11
- """
12
- この機能のモードを返します
13
-
14
- Returns:
15
- Union[str, List[str]]: モード
16
- """
17
- return 'web'
18
-
19
- def get_cmd(self):
20
- """
21
- この機能のコマンドを返します
22
-
23
- Returns:
24
- str: コマンド
25
- """
26
- return 'apikey_del'
27
-
28
- def get_option(self):
29
- """
30
- この機能のオプションを返します
31
-
32
- Returns:
33
- Dict[str, Any]: オプション
34
- """
35
- return dict(
36
- use_redis=self.USE_REDIS_MEIGHT, nouse_webmode=False,
37
- description_ja="WebモードのユーザーのApiKeyを削除します。",
38
- description_en="Del an ApiKey for a user in Web mode.",
39
- choice=[
40
- dict(opt="user_name", type=Options.T_STR, default=None, required=True, multi=False, hide=False, choice=None,
41
- description_ja="対象のユーザー名を指定します。",
42
- description_en="Specify the target user name."),
43
- dict(opt="apikey_name", type=Options.T_STR, default=None, required=True, multi=False, hide=False, choice=None,
44
- description_ja="このユーザーのApiKey名を指定します。",
45
- description_en="Specify the ApiKey name for this user."),
46
- dict(opt="signin_file", type=Options.T_FILE, default=f".{self.ver.__appid__}/user_list.yml", required=True, multi=False, hide=False, choice=None, fileio="in",
47
- description_ja="サインイン可能なユーザーとパスワードを記載したファイルを指定します。省略した時は認証を要求しません。",
48
- description_en="Specify a file containing users and passwords with which they can signin. If omitted, no authentication is required."),
49
- dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
50
- description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
51
- description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
52
- dict(opt="capture_stdout", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
53
- description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をキャプチャーし、実行結果画面に表示します。",
54
- description_en="Available only in GUI mode. Captures standard output during command execution and displays it on the execution result screen."),
55
- dict(opt="capture_maxsize", type=Options.T_INT, default=self.DEFAULT_CAPTURE_MAXSIZE, required=False, multi=False, hide=True, choice=None,
56
- description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力の最大キャプチャーサイズを指定します。",
57
- description_en="Available only in GUI mode. Specifies the maximum capture size of standard output when executing commands."),
58
- ]
59
- )
60
-
61
- def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
62
- """
63
- この機能の実行を行います
64
-
65
- Args:
66
- logger (logging.Logger): ロガー
67
- args (argparse.Namespace): 引数
68
- tm (float): 実行開始時間
69
- pf (List[Dict[str, float]]): 呼出元のパフォーマンス情報
70
-
71
- Returns:
72
- Tuple[int, Dict[str, Any], Any]: 終了コード, 結果, オブジェクト
73
- """
74
- if args.data is None:
75
- msg = dict(warn=f"Please specify the --data option.")
76
- common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
77
- return 1, msg, None
78
- w = None
79
- try:
80
- w = web.Web(logger, self.default_data, appcls=self.appcls, ver=self.ver,
81
- redis_host=self.default_host, redis_port=self.default_port, redis_password=self.default_pass, svname=self.default_svname,
82
- signin_file=args.signin_file)
83
- user = dict(name=args.user_name, apikey_name=args.apikey_name)
84
- w.apikey_del(user)
85
- msg = dict(success=dict(msg=f"User ApiKey deleted. user_name={args.user_name} apikey_name={args.apikey_name}"))
86
- common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
87
- return 0, msg, w
88
- except Exception as e:
89
- msg = dict(warn=f"{e}")
90
- common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
91
- return 1, msg, w
1
+ from cmdbox.app import common, feature, web
2
+ from cmdbox.app.options import Options
3
+ from pathlib import Path
4
+ from typing import Dict, Any, Tuple, List, Union
5
+ import argparse
6
+ import logging
7
+
8
+
9
+ class WebApikeyDel(feature.UnsupportEdgeFeature):
10
+ def get_mode(self) -> Union[str, List[str]]:
11
+ """
12
+ この機能のモードを返します
13
+
14
+ Returns:
15
+ Union[str, List[str]]: モード
16
+ """
17
+ return 'web'
18
+
19
+ def get_cmd(self):
20
+ """
21
+ この機能のコマンドを返します
22
+
23
+ Returns:
24
+ str: コマンド
25
+ """
26
+ return 'apikey_del'
27
+
28
+ def get_option(self):
29
+ """
30
+ この機能のオプションを返します
31
+
32
+ Returns:
33
+ Dict[str, Any]: オプション
34
+ """
35
+ return dict(
36
+ use_redis=self.USE_REDIS_MEIGHT, nouse_webmode=False,
37
+ description_ja="WebモードのユーザーのApiKeyを削除します。",
38
+ description_en="Del an ApiKey for a user in Web mode.",
39
+ choice=[
40
+ dict(opt="user_name", type=Options.T_STR, default=None, required=True, multi=False, hide=False, choice=None,
41
+ description_ja="対象のユーザー名を指定します。",
42
+ description_en="Specify the target user name."),
43
+ dict(opt="apikey_name", type=Options.T_STR, default=None, required=True, multi=False, hide=False, choice=None,
44
+ description_ja="このユーザーのApiKey名を指定します。",
45
+ description_en="Specify the ApiKey name for this user."),
46
+ dict(opt="signin_file", type=Options.T_FILE, default=f".{self.ver.__appid__}/user_list.yml", required=True, multi=False, hide=False, choice=None, fileio="in",
47
+ description_ja="サインイン可能なユーザーとパスワードを記載したファイルを指定します。省略した時は認証を要求しません。",
48
+ description_en="Specify a file containing users and passwords with which they can signin. If omitted, no authentication is required."),
49
+ dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
50
+ description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
51
+ description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
52
+ dict(opt="capture_stdout", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
53
+ description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をキャプチャーし、実行結果画面に表示します。",
54
+ description_en="Available only in GUI mode. Captures standard output during command execution and displays it on the execution result screen."),
55
+ dict(opt="capture_maxsize", type=Options.T_INT, default=self.DEFAULT_CAPTURE_MAXSIZE, required=False, multi=False, hide=True, choice=None,
56
+ description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力の最大キャプチャーサイズを指定します。",
57
+ description_en="Available only in GUI mode. Specifies the maximum capture size of standard output when executing commands."),
58
+ ]
59
+ )
60
+
61
+ def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
62
+ """
63
+ この機能の実行を行います
64
+
65
+ Args:
66
+ logger (logging.Logger): ロガー
67
+ args (argparse.Namespace): 引数
68
+ tm (float): 実行開始時間
69
+ pf (List[Dict[str, float]]): 呼出元のパフォーマンス情報
70
+
71
+ Returns:
72
+ Tuple[int, Dict[str, Any], Any]: 終了コード, 結果, オブジェクト
73
+ """
74
+ if args.data is None:
75
+ msg = dict(warn=f"Please specify the --data option.")
76
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
77
+ return self.RESP_WARN, msg, None
78
+ w = None
79
+ try:
80
+ w = web.Web(logger, self.default_data, appcls=self.appcls, ver=self.ver,
81
+ redis_host=self.default_host, redis_port=self.default_port, redis_password=self.default_pass, svname=self.default_svname,
82
+ signin_file=args.signin_file)
83
+ user = dict(name=args.user_name, apikey_name=args.apikey_name)
84
+ w.apikey_del(user)
85
+ msg = dict(success=dict(msg=f"User ApiKey deleted. user_name={args.user_name} apikey_name={args.apikey_name}"))
86
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
87
+ return self.RESP_SUCCESS, msg, w
88
+ except Exception as e:
89
+ msg = dict(warn=f"{e}")
90
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
91
+ return self.RESP_WARN, msg, w
@@ -94,7 +94,7 @@ class WebGencert(feature.UnsupportEdgeFeature):
94
94
  if args.webhost is None:
95
95
  msg = dict(warn=f"Please specify the --webhost option.")
96
96
  common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
97
- return 1, msg, None
97
+ return self.RESP_WARN, msg, None
98
98
  if args.output_cert is None:
99
99
  args.output_cert = f"{args.webhost}.crt"
100
100
  if args.output_pkey is None:
@@ -107,15 +107,15 @@ class WebGencert(feature.UnsupportEdgeFeature):
107
107
  if not args.overwrite and output_cert.exists():
108
108
  msg = dict(warn=f"File already exists. {output_cert}")
109
109
  common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
110
- return 1, msg, None
110
+ return self.RESP_WARN, msg, None
111
111
  if not args.overwrite and output_pkey.exists():
112
112
  msg = dict(warn=f"File already exists. {output_pkey}")
113
113
  common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
114
- return 1, msg, None
114
+ return self.RESP_WARN, msg, None
115
115
  if not args.overwrite and output_key.exists():
116
116
  msg = dict(warn=f"File already exists. {output_key}")
117
117
  common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
118
- return 1, msg, None
118
+ return self.RESP_WARN, msg, None
119
119
 
120
120
  try:
121
121
  self.gen_cert(logger, args.webhost,
@@ -126,8 +126,8 @@ class WebGencert(feature.UnsupportEdgeFeature):
126
126
  except Exception as e:
127
127
  msg = dict(error=f"Failed to generate certificate. {e}")
128
128
  common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
129
- return 1, msg, None
130
- return 0, ret, None
129
+ return self.RESP_WARN, msg, None
130
+ return self.RESP_SUCCESS, ret, None
131
131
 
132
132
  def gen_cert(self, logger:logging.Logger, webhost:str,
133
133
  output_cert:Path, output_cert_format:str,