kaqing 1.98.15__py3-none-any.whl → 2.0.145__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 kaqing might be problematic. Click here for more details.

Files changed (180) hide show
  1. adam/app_session.py +1 -1
  2. adam/apps.py +2 -2
  3. adam/batch.py +30 -31
  4. adam/checks/check_utils.py +4 -4
  5. adam/checks/compactionstats.py +1 -1
  6. adam/checks/cpu.py +2 -2
  7. adam/checks/disk.py +1 -1
  8. adam/checks/gossip.py +1 -1
  9. adam/checks/memory.py +3 -3
  10. adam/checks/status.py +1 -1
  11. adam/commands/alter_tables.py +81 -0
  12. adam/commands/app.py +3 -3
  13. adam/commands/app_ping.py +2 -2
  14. adam/commands/audit/audit.py +86 -0
  15. adam/commands/audit/audit_repair_tables.py +77 -0
  16. adam/commands/audit/audit_run.py +58 -0
  17. adam/commands/audit/show_last10.py +51 -0
  18. adam/commands/audit/show_slow10.py +50 -0
  19. adam/commands/audit/show_top10.py +48 -0
  20. adam/commands/audit/utils_show_top10.py +59 -0
  21. adam/commands/bash/bash.py +133 -0
  22. adam/commands/bash/bash_completer.py +93 -0
  23. adam/commands/cat.py +56 -0
  24. adam/commands/cd.py +12 -82
  25. adam/commands/check.py +6 -0
  26. adam/commands/cli_commands.py +3 -3
  27. adam/commands/code.py +60 -0
  28. adam/commands/command.py +48 -12
  29. adam/commands/commands_utils.py +4 -5
  30. adam/commands/cql/cql_completions.py +28 -0
  31. adam/commands/cql/cql_utils.py +209 -0
  32. adam/commands/{cqlsh.py → cql/cqlsh.py} +15 -10
  33. adam/commands/deploy/__init__.py +0 -0
  34. adam/commands/{frontend → deploy}/code_start.py +1 -1
  35. adam/commands/{frontend → deploy}/code_stop.py +1 -1
  36. adam/commands/{frontend → deploy}/code_utils.py +2 -2
  37. adam/commands/deploy/deploy.py +48 -0
  38. adam/commands/deploy/deploy_frontend.py +52 -0
  39. adam/commands/deploy/deploy_pg_agent.py +38 -0
  40. adam/commands/deploy/deploy_pod.py +110 -0
  41. adam/commands/deploy/deploy_utils.py +29 -0
  42. adam/commands/deploy/undeploy.py +48 -0
  43. adam/commands/deploy/undeploy_frontend.py +41 -0
  44. adam/commands/deploy/undeploy_pg_agent.py +42 -0
  45. adam/commands/deploy/undeploy_pod.py +51 -0
  46. adam/commands/devices/__init__.py +0 -0
  47. adam/commands/devices/device.py +27 -0
  48. adam/commands/devices/device_app.py +146 -0
  49. adam/commands/devices/device_auit_log.py +43 -0
  50. adam/commands/devices/device_cass.py +145 -0
  51. adam/commands/devices/device_export.py +86 -0
  52. adam/commands/devices/device_postgres.py +109 -0
  53. adam/commands/devices/devices.py +25 -0
  54. adam/commands/export/__init__.py +0 -0
  55. adam/commands/export/clean_up_export_session.py +53 -0
  56. adam/commands/{frontend/teardown_frontend.py → export/clean_up_export_sessions.py} +9 -11
  57. adam/commands/export/drop_export_database.py +58 -0
  58. adam/commands/export/drop_export_databases.py +46 -0
  59. adam/commands/export/export.py +83 -0
  60. adam/commands/export/export_databases.py +170 -0
  61. adam/commands/export/export_select.py +85 -0
  62. adam/commands/export/export_select_x.py +54 -0
  63. adam/commands/export/export_use.py +55 -0
  64. adam/commands/export/exporter.py +364 -0
  65. adam/commands/export/import_session.py +68 -0
  66. adam/commands/export/importer.py +67 -0
  67. adam/commands/export/importer_athena.py +80 -0
  68. adam/commands/export/importer_sqlite.py +47 -0
  69. adam/commands/export/show_column_counts.py +63 -0
  70. adam/commands/export/show_export_databases.py +39 -0
  71. adam/commands/export/show_export_session.py +51 -0
  72. adam/commands/export/show_export_sessions.py +47 -0
  73. adam/commands/export/utils_export.py +291 -0
  74. adam/commands/help.py +12 -7
  75. adam/commands/issues.py +6 -0
  76. adam/commands/kubectl.py +41 -0
  77. adam/commands/login.py +9 -5
  78. adam/commands/logs.py +2 -1
  79. adam/commands/ls.py +4 -107
  80. adam/commands/medusa/medusa.py +2 -26
  81. adam/commands/medusa/medusa_backup.py +2 -2
  82. adam/commands/medusa/medusa_restore.py +3 -4
  83. adam/commands/medusa/medusa_show_backupjobs.py +4 -3
  84. adam/commands/medusa/medusa_show_restorejobs.py +3 -3
  85. adam/commands/nodetool.py +9 -4
  86. adam/commands/param_set.py +1 -1
  87. adam/commands/postgres/postgres.py +42 -43
  88. adam/commands/postgres/postgres_context.py +248 -0
  89. adam/commands/postgres/postgres_preview.py +0 -1
  90. adam/commands/postgres/postgres_utils.py +31 -0
  91. adam/commands/postgres/psql_completions.py +10 -0
  92. adam/commands/preview_table.py +18 -40
  93. adam/commands/pwd.py +2 -28
  94. adam/commands/reaper/reaper.py +4 -24
  95. adam/commands/reaper/reaper_restart.py +1 -1
  96. adam/commands/reaper/reaper_session.py +2 -2
  97. adam/commands/repair/repair.py +3 -27
  98. adam/commands/repair/repair_log.py +1 -1
  99. adam/commands/repair/repair_run.py +2 -2
  100. adam/commands/repair/repair_scan.py +2 -7
  101. adam/commands/repair/repair_stop.py +1 -1
  102. adam/commands/report.py +6 -0
  103. adam/commands/restart.py +2 -2
  104. adam/commands/rollout.py +1 -1
  105. adam/commands/shell.py +33 -0
  106. adam/commands/show/show.py +11 -26
  107. adam/commands/show/show_app_actions.py +3 -0
  108. adam/commands/show/show_app_id.py +1 -1
  109. adam/commands/show/show_app_queues.py +3 -2
  110. adam/commands/show/show_cassandra_status.py +3 -3
  111. adam/commands/show/show_cassandra_version.py +3 -3
  112. adam/commands/show/show_commands.py +4 -1
  113. adam/commands/show/show_host.py +33 -0
  114. adam/commands/show/show_login.py +3 -0
  115. adam/commands/show/show_processes.py +1 -1
  116. adam/commands/show/show_repairs.py +2 -2
  117. adam/commands/show/show_storage.py +1 -1
  118. adam/commands/watch.py +1 -1
  119. adam/config.py +16 -3
  120. adam/embedded_params.py +1 -1
  121. adam/pod_exec_result.py +10 -2
  122. adam/repl.py +132 -117
  123. adam/repl_commands.py +62 -18
  124. adam/repl_state.py +276 -55
  125. adam/sql/__init__.py +0 -0
  126. adam/sql/sql_completer.py +120 -0
  127. adam/sql/sql_state_machine.py +617 -0
  128. adam/sql/term_completer.py +76 -0
  129. adam/sso/authenticator.py +1 -1
  130. adam/sso/authn_ad.py +36 -56
  131. adam/sso/authn_okta.py +6 -32
  132. adam/sso/cred_cache.py +1 -1
  133. adam/sso/idp.py +74 -9
  134. adam/sso/idp_login.py +2 -2
  135. adam/sso/idp_session.py +10 -7
  136. adam/utils.py +85 -4
  137. adam/utils_athena.py +145 -0
  138. adam/utils_audits.py +102 -0
  139. adam/utils_k8s/__init__.py +0 -0
  140. adam/utils_k8s/app_clusters.py +33 -0
  141. adam/utils_k8s/app_pods.py +31 -0
  142. adam/{k8s_utils → utils_k8s}/cassandra_clusters.py +6 -21
  143. adam/{k8s_utils → utils_k8s}/cassandra_nodes.py +12 -5
  144. adam/utils_k8s/config_maps.py +34 -0
  145. adam/utils_k8s/deployment.py +56 -0
  146. adam/{k8s_utils → utils_k8s}/jobs.py +1 -1
  147. adam/{k8s_utils → utils_k8s}/kube_context.py +1 -1
  148. adam/utils_k8s/pods.py +342 -0
  149. adam/{k8s_utils → utils_k8s}/secrets.py +4 -0
  150. adam/utils_k8s/service_accounts.py +169 -0
  151. adam/{k8s_utils → utils_k8s}/statefulsets.py +5 -4
  152. adam/{k8s_utils → utils_k8s}/volumes.py +9 -0
  153. adam/utils_net.py +24 -0
  154. adam/utils_repl/__init__.py +0 -0
  155. adam/utils_repl/automata_completer.py +48 -0
  156. adam/utils_repl/repl_completer.py +46 -0
  157. adam/utils_repl/state_machine.py +173 -0
  158. adam/utils_sqlite.py +101 -0
  159. adam/version.py +1 -1
  160. {kaqing-1.98.15.dist-info → kaqing-2.0.145.dist-info}/METADATA +1 -1
  161. kaqing-2.0.145.dist-info/RECORD +227 -0
  162. adam/commands/bash.py +0 -87
  163. adam/commands/cql_utils.py +0 -53
  164. adam/commands/devices.py +0 -89
  165. adam/commands/frontend/setup.py +0 -60
  166. adam/commands/frontend/setup_frontend.py +0 -58
  167. adam/commands/frontend/teardown.py +0 -61
  168. adam/commands/postgres/postgres_session.py +0 -225
  169. adam/commands/user_entry.py +0 -77
  170. adam/k8s_utils/pods.py +0 -211
  171. kaqing-1.98.15.dist-info/RECORD +0 -160
  172. /adam/commands/{frontend → audit}/__init__.py +0 -0
  173. /adam/{k8s_utils → commands/bash}/__init__.py +0 -0
  174. /adam/{medusa_show_restorejobs.py → commands/cql/__init__.py} +0 -0
  175. /adam/{k8s_utils → utils_k8s}/custom_resources.py +0 -0
  176. /adam/{k8s_utils → utils_k8s}/ingresses.py +0 -0
  177. /adam/{k8s_utils → utils_k8s}/services.py +0 -0
  178. {kaqing-1.98.15.dist-info → kaqing-2.0.145.dist-info}/WHEEL +0 -0
  179. {kaqing-1.98.15.dist-info → kaqing-2.0.145.dist-info}/entry_points.txt +0 -0
  180. {kaqing-1.98.15.dist-info → kaqing-2.0.145.dist-info}/top_level.txt +0 -0
adam/repl.py CHANGED
@@ -1,81 +1,48 @@
1
- import re
1
+ import os
2
2
  import time
3
3
  import traceback
4
+ from typing import cast
4
5
  import click
5
- from prompt_toolkit.completion import NestedCompleter
6
+ import concurrent
6
7
  from prompt_toolkit.key_binding import KeyBindings
7
8
 
8
9
  from adam.cli_group import cli
9
10
  from adam.commands.command import Command
10
11
  from adam.commands.command_helpers import ClusterCommandHelper
12
+ from adam.commands.devices.devices import Devices
11
13
  from adam.commands.help import Help
12
- from adam.commands.postgres.postgres_session import PostgresSession
13
14
  from adam.config import Config
14
- from adam.k8s_utils.kube_context import KubeContext
15
- from adam.k8s_utils.statefulsets import StatefulSets
15
+ from adam.utils_audits import Audits
16
+ from adam.utils_k8s.app_pods import AppPods
17
+ from adam.utils_k8s.kube_context import KubeContext
18
+ from adam.utils_k8s.statefulsets import StatefulSets
16
19
  from adam.log import Log
17
20
  from adam.repl_commands import ReplCommands
18
21
  from adam.repl_session import ReplSession
19
22
  from adam.repl_state import ReplState
20
- from adam.utils import deep_merge_dicts, lines_to_tabular, log2
23
+ from adam.utils import deep_merge_dicts, deep_sort_dict, lines_to_tabular, log2
21
24
  from adam.apps import Apps
25
+ from adam.utils_repl.repl_completer import ReplCompleter
22
26
  from . import __version__
23
27
 
24
28
  def enter_repl(state: ReplState):
29
+ if os.getenv('QING_DROPPED', 'false') == 'true':
30
+ log2('You have dropped to bash from another qing instance. Please enter "exit" to go back to qing.')
31
+ return
32
+
25
33
  cmd_list: list[Command] = ReplCommands.repl_cmd_list() + [Help()]
26
34
  # head with the Chain of Responsibility pattern
27
35
  cmds: Command = Command.chain(cmd_list)
28
36
  session = ReplSession().prompt_session
29
37
 
30
38
  def prompt_msg():
31
- msg = ''
32
- if state.device == ReplState.P:
33
- msg = f'{ReplState.P}:'
34
- pg = PostgresSession(state.namespace, state.pg_path) if state.pg_path else None
35
- if pg and pg.db:
36
- msg += pg.db
37
- elif pg and pg.host:
38
- msg += pg.host
39
- elif state.device == ReplState.A:
40
- msg = f'{ReplState.A}:'
41
- if state.app_env:
42
- msg += state.app_env
43
- if state.app_app:
44
- msg += f'/{state.app_app}'
45
- else:
46
- msg = f'{ReplState.C}:'
47
- if state.pod:
48
- # cs-d0767a536f-cs-d0767a536f-default-sts-0
49
- group = re.match(r".*?-.*?-(.*)", state.pod)
50
- msg += group[1]
51
- elif state.sts:
52
- # cs-d0767a536f-cs-d0767a536f-default-sts
53
- group = re.match(r".*?-.*?-(.*)", state.sts)
54
- msg += group[1]
39
+ msg = state.__str__()
55
40
 
56
41
  return f"{msg}$ " if state.bash_session else f"{msg}> "
57
42
 
58
43
  Log.log2(f'kaqing {__version__}')
59
- ss = StatefulSets.list_sts_name_and_ns()
60
-
61
- if state.device == ReplState.C:
62
- if not ss:
63
- raise Exception("no Cassandra clusters found")
64
- elif len(ss) == 1 and Config().get('repl.auto-enter-only-cluster', True):
65
- cluster = ss[0]
66
- state.sts = cluster[0]
67
- state.namespace = cluster[1]
68
- state.wait_log(f'Moving to the only Cassandra cluster: {state.sts}@{state.namespace}...')
69
- elif state.device == ReplState.A:
70
- if app := Config().get('repl.auto-enter-app', 'c3/c3'):
71
- if app != 'no':
72
- ea = app.split('/')
73
- state.app_env = ea[0]
74
- if len(ea) > 1:
75
- state.app_app = ea[1]
76
- state.wait_log(f'Moving to {state.app_env}/{state.app_app}...')
77
- else:
78
- state.wait_log(f'Moving to {state.app_env}...')
44
+
45
+ Devices.device(state).enter(state)
79
46
 
80
47
  kb = KeyBindings()
81
48
 
@@ -83,72 +50,120 @@ def enter_repl(state: ReplState):
83
50
  def _(event):
84
51
  event.app.current_buffer.text = ''
85
52
 
86
- # use sorted command list only for auto-completion
87
- sorted_cmds = sorted(cmd_list, key=lambda cmd: cmd.command())
88
- while True:
89
- try:
90
- completer = NestedCompleter.from_nested_dict({})
91
- if not state.bash_session:
92
- completions = {}
93
- # app commands are available only on a: drive
94
- if state.device == ReplState.A and state.app_app:
95
- completions = Apps(path='apps.yaml').commands()
96
-
97
- for cmd in sorted_cmds:
98
- s1 = time.time()
99
- try:
100
- completions = deep_merge_dicts(completions, cmd.completion(state))
101
- finally:
102
- if Config().get('debug.timings', False):
103
- Config().debug('Timing completion calc', cmd.command(), f'{time.time() - s1:.2f}')
104
-
105
- completer = NestedCompleter.from_nested_dict(completions)
106
-
107
- cmd = session.prompt(prompt_msg(), completer=completer, key_bindings=kb)
108
- s0 = time.time()
109
-
110
- if state.bash_session:
111
- if cmd.strip(' ') == 'exit':
112
- state.exit_bash()
113
- continue
114
-
115
- cmd = f'bash {cmd}'
116
-
117
- if cmd and cmd.strip(' ') and not cmds.run(cmd, state):
118
- c_sql_tried = False
119
- if state.device == ReplState.P:
120
- pg = PostgresSession(state.namespace, state.pg_path)
121
- if pg.db:
122
- c_sql_tried = True
123
- cmd = f'pg {cmd}'
124
- cmds.run(cmd, state)
125
- elif state.device == ReplState.A:
126
- if state.app_app:
127
- c_sql_tried = True
128
- cmd = f'app {cmd}'
129
- cmds.run(cmd, state)
130
- elif state.sts:
131
- c_sql_tried = True
132
- cmd = f'cql {cmd}'
133
- cmds.run(cmd, state)
134
-
135
- if not c_sql_tried:
136
- log2(f'* Invalid command: {cmd}')
137
- log2()
138
- lines = [c.help(state) for c in cmd_list if c.help(state)]
139
- log2(lines_to_tabular(lines, separator='\t'))
140
- except EOFError: # Handle Ctrl+D (EOF) for graceful exit
141
- break
142
- except Exception as e:
143
- if Config().get('debug.exit-on-error', False):
144
- raise e
145
- else:
146
- log2(e)
147
- Config().debug(traceback.format_exc())
148
- finally:
149
- state.clear_wait_log_flag()
150
- if Config().get('debug.timings', False) and 'cmd' in locals() and 's0' in locals():
151
- print('Timing command', cmd, f'{time.time() - s0:.2f}')
53
+ with concurrent.futures.ThreadPoolExecutor(max_workers=Config().get('audit.workers', 3)) as executor:
54
+ # warm up AWS lambda - this log line may timeout and get lost, which is fine
55
+ executor.submit(Audits.log, 'entering kaqing repl', state.namespace, 'z', 0.0)
56
+
57
+ s0 = time.time()
58
+
59
+ # use sorted command list only for auto-completion
60
+ sorted_cmds = sorted(cmd_list, key=lambda cmd: cmd.command())
61
+ while True:
62
+ result = None
63
+ try:
64
+ completer = ReplCompleter.from_nested_dict({})
65
+ if not state.bash_session:
66
+ completions = {}
67
+ # app commands are available only on a: drive
68
+ if state.device == ReplState.A and state.app_app:
69
+ completions = Apps(path='apps.yaml').commands()
70
+
71
+ for cmd in sorted_cmds:
72
+ s1 = time.time()
73
+ try:
74
+ completions = deep_sort_dict(deep_merge_dicts(completions, cmd.completion(state)))
75
+ finally:
76
+ if Config().get('debugs.timings', False):
77
+ log2(f'Timing auto-completion-calc {cmd.command()}: {time.time() - s1:.2f}')
78
+
79
+ # print(json.dumps(completions, indent=4))
80
+ completer = ReplCompleter.from_nested_dict(completions)
81
+
82
+ cmd = session.prompt(prompt_msg(), completer=completer, key_bindings=kb)
83
+ s0 = time.time()
84
+
85
+ if state.bash_session:
86
+ if cmd.strip(' ') == 'exit':
87
+ state.exit_bash()
88
+ continue
89
+
90
+ cmd = f'bash {cmd}'
91
+
92
+ def targetted(state: ReplState, cmd: str):
93
+ if not (cmd.startswith('@') and len(arry := cmd.split(' ')) > 1):
94
+ return state, cmd
95
+
96
+ if state.device == ReplState.A and state.app_app or state.device == ReplState.P:
97
+ state.push()
98
+
99
+ state.app_pod = arry[0].strip('@')
100
+ cmd = ' '.join(arry[1:])
101
+ elif state.device == ReplState.P:
102
+ state.push()
103
+
104
+ state.app_pod = arry[0].strip('@')
105
+ cmd = ' '.join(arry[1:])
106
+ elif state.sts:
107
+ state.push()
108
+
109
+ state.pod = arry[0].strip('@')
110
+ cmd = ' '.join(arry[1:])
111
+
112
+ return (state, cmd)
113
+
114
+ target, cmd = targetted(state, cmd)
115
+ if cmd and cmd.strip(' ') and not (result := cmds.run(cmd, target)):
116
+ result = try_device_default_action(target, cmds, cmd_list, cmd)
117
+
118
+ if result and type(result) is ReplState and (s := cast(ReplState, result).export_session) != state.export_session:
119
+ state.export_session = s
120
+
121
+ except EOFError: # Handle Ctrl+D (EOF) for graceful exit
122
+ break
123
+ except Exception as e:
124
+ if Config().get('debugs.exit-on-error', False):
125
+ raise e
126
+ else:
127
+ log2(e)
128
+ Config().debug(traceback.format_exc())
129
+ finally:
130
+ if not state.bash_session:
131
+ state.pop()
132
+
133
+ Config().clear_wait_log_flag()
134
+ if Config().get('debugs.timings', False) and 'cmd' in locals() and 's0' in locals():
135
+ log2(f'Timing command {cmd}: {time.time() - s0:.2f}')
136
+
137
+ # offload audit logging
138
+ if cmd and (state.device != ReplState.L or Config().get('audit.log-audit-queries', False)):
139
+ executor.submit(Audits.log, cmd, state.namespace, state.device, time.time() - s0, get_audit_extra(result))
140
+
141
+ def try_device_default_action(state: ReplState, cmds: Command, cmd_list: list[Command], cmd: str):
142
+ default_action_tried, result = Devices.device(state).try_fallback_action(cmds, state, cmd)
143
+
144
+ if not default_action_tried:
145
+ log2(f'* Invalid command: {cmd}')
146
+ log2()
147
+ lines = [c.help(state) for c in cmd_list if c.help(state)]
148
+ log2(lines_to_tabular(lines, separator='\t'))
149
+
150
+ return result
151
+
152
+ def get_audit_extra(result: any):
153
+ if not result:
154
+ return None
155
+
156
+ if type(result) is list:
157
+ extras = set()
158
+
159
+ for r in result:
160
+ if hasattr(r, '__audit_extra__') and (x := r.__audit_extra__()):
161
+ extras.add(x)
162
+
163
+ return ','.join(list(extras))
164
+
165
+ if hasattr(result, '__audit_extra__') and (x := result.__audit_extra__()):
166
+ return x
152
167
 
153
168
  @cli.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True), cls=ClusterCommandHelper, help="Enter interactive shell.")
154
169
  @click.option('--kubeconfig', '-k', required=False, metavar='path', help='path to kubeconfig file')
@@ -163,5 +178,5 @@ def repl(kubeconfig: str, config: str, param: list[str], cluster:str, namespace:
163
178
  return
164
179
 
165
180
  state = ReplState(device=Config().get('repl.start-drive', 'a'), ns_sts=cluster, namespace=namespace, in_repl=True)
166
- state, _ = state.apply_args(extra_args)
181
+ state, _ = state.apply_device_arg(extra_args)
167
182
  enter_repl(state)
adam/repl_commands.py CHANGED
@@ -1,22 +1,53 @@
1
+ from adam.commands.alter_tables import AlterTables
1
2
  from adam.commands.app import App
2
3
  from adam.commands.app_ping import AppPing
3
- from adam.commands.frontend.code_start import CodeStart
4
- from adam.commands.frontend.code_stop import CodeStop
4
+ from adam.commands.audit.audit import Audit
5
+ from adam.commands.cat import Cat
6
+ from adam.commands.code import Code
7
+ from adam.commands.deploy.code_start import CodeStart
8
+ from adam.commands.deploy.code_stop import CodeStop
9
+ from adam.commands.deploy.deploy import Deploy
10
+ from adam.commands.deploy.deploy_frontend import DeployFrontend
11
+ from adam.commands.deploy.deploy_pg_agent import DeployPgAgent
12
+ from adam.commands.deploy.deploy_pod import DeployPod
13
+ from adam.commands.deploy.undeploy import Undeploy
14
+ from adam.commands.deploy.undeploy_frontend import UndeployFrontend
15
+ from adam.commands.deploy.undeploy_pg_agent import UndeployPgAgent
16
+ from adam.commands.deploy.undeploy_pod import UndeployPod
17
+ from adam.commands.devices.device_app import DeviceApp
18
+ from adam.commands.devices.device_auit_log import DeviceAuditLog
19
+ from adam.commands.devices.device_cass import DeviceCass
20
+ from adam.commands.devices.device_export import DeviceExport
21
+ from adam.commands.devices.device_postgres import DevicePostgres
22
+ from adam.commands.export.drop_export_database import DropExportDatabase
23
+ from adam.commands.export.export import ExportTables
24
+ from adam.commands.export.import_session import ImportSession
25
+ from adam.commands.export.clean_up_export_session import CleanUpExportSession
26
+ from adam.commands.export.clean_up_export_sessions import CleanUpExportSessions
27
+ from adam.commands.export.drop_export_databases import DropExportDatabases
28
+ from adam.commands.export.export_select import ExportSelect
29
+ from adam.commands.export.export_use import ExportUse
30
+ from adam.commands.export.export_select_x import ExportSelectX
31
+ from adam.commands.export.show_column_counts import ShowColumnCounts
32
+ from adam.commands.export.show_export_databases import ShowExportDatabases
33
+ from adam.commands.export.show_export_session import ShowExportSession
34
+ from adam.commands.export.show_export_sessions import ShowExportSessions
35
+ from adam.commands.kubectl import Kubectl
36
+ from adam.commands.shell import Shell
5
37
  from adam.commands.show.show_app_queues import ShowAppQueues
6
38
  from adam.commands.cp import ClipboardCopy
7
- from adam.commands.bash import Bash
39
+ from adam.commands.bash.bash import Bash
8
40
  from adam.commands.cd import Cd
9
41
  from adam.commands.check import Check
10
42
  from adam.commands.command import Command
11
- from adam.commands.cqlsh import Cqlsh
12
- from adam.commands.devices import DeviceApp, DeviceCass, DevicePostgres
43
+ from adam.commands.cql.cqlsh import Cqlsh
13
44
  from adam.commands.exit import Exit
14
45
  from adam.commands.medusa.medusa import Medusa
15
46
  from adam.commands.param_get import GetParam
16
47
  from adam.commands.issues import Issues
17
48
  from adam.commands.ls import Ls
18
49
  from adam.commands.nodetool import NodeTool
19
- from adam.commands.postgres.postgres import Postgres
50
+ from adam.commands.postgres.postgres import Postgres, PostgresPg
20
51
  from adam.commands.preview_table import PreviewTable
21
52
  from adam.commands.pwd import Pwd
22
53
  from adam.commands.reaper.reaper import Reaper
@@ -31,6 +62,7 @@ from adam.commands.show.show_app_id import ShowAppId
31
62
  from adam.commands.show.show_cassandra_status import ShowCassandraStatus
32
63
  from adam.commands.show.show_cassandra_version import ShowCassandraVersion
33
64
  from adam.commands.show.show_commands import ShowKubectlCommands
65
+ from adam.commands.show.show_host import ShowHost
34
66
  from adam.commands.show.show_login import ShowLogin
35
67
  from adam.commands.show.show_params import ShowParams
36
68
  from adam.commands.show.show_processes import ShowProcesses
@@ -41,10 +73,10 @@ from adam.commands.watch import Watch
41
73
 
42
74
  class ReplCommands:
43
75
  def repl_cmd_list() -> list[Command]:
44
- cmds: list[Command] = ReplCommands.navigation() + ReplCommands.cassandra_check() + ReplCommands.cassandra_ops() + \
45
- ReplCommands.tools() + ReplCommands.app() + ReplCommands.exit()
76
+ cmds: list[Command] = ReplCommands.navigation() + ReplCommands.cassandra_ops() + ReplCommands.postgres_ops() + \
77
+ ReplCommands.app_ops() + ReplCommands.audit_ops() + ReplCommands.export_ops() + ReplCommands.tools() + ReplCommands.exit()
46
78
 
47
- intermediate_cmds: list[Command] = [Show(), App(), Reaper(), Repair()]
79
+ intermediate_cmds: list[Command] = [App(), Audit(), Reaper(), Repair(), Deploy(), Show(), Undeploy()]
48
80
  ic = [c.command() for c in intermediate_cmds]
49
81
  # 1. dedup commands
50
82
  deduped = []
@@ -61,20 +93,32 @@ class ReplCommands:
61
93
  return deduped
62
94
 
63
95
  def navigation() -> list[Command]:
64
- return [Ls(), PreviewTable(), DeviceApp(), DevicePostgres(), DeviceCass(), Cd(), Pwd(), ClipboardCopy(),
65
- GetParam(), SetParam(), ShowParams(), ShowKubectlCommands(), ShowLogin(), ShowAdam()]
66
-
67
- def cassandra_check() -> list[Command]:
68
- return [ShowCassandraStatus(), ShowCassandraVersion(), ShowRepairs(), ShowStorage(), ShowProcesses(), Check(), Issues(), NodeTool(), Report()]
96
+ return [Ls(), PreviewTable(), DeviceApp(), DevicePostgres(), DeviceCass(), DeviceAuditLog(), DeviceExport(), Cd(), Cat(), Pwd(), ClipboardCopy(),
97
+ GetParam(), SetParam(), ShowParams(), ShowKubectlCommands(), ShowLogin(), ShowAdam(), ShowHost()]
69
98
 
70
99
  def cassandra_ops() -> list[Command]:
71
- return Medusa.cmd_list() + [Restart(), RollOut(), Watch()] + Reaper.cmd_list() + Repair.cmd_list()
100
+ return [Cqlsh(), ShowCassandraStatus(), ShowCassandraVersion(), ShowRepairs(), ShowStorage(), ShowProcesses(),
101
+ Check(), Issues(), NodeTool(), Report(), AlterTables(), Bash(),
102
+ ExportTables(), ExportSelect(), ExportUse(), ShowExportDatabases(), ShowColumnCounts(),
103
+ DropExportDatabase(), DropExportDatabases(),
104
+ ShowExportSessions(), ShowExportSession(),
105
+ CleanUpExportSession(), CleanUpExportSessions(), ImportSession()] + \
106
+ Medusa.cmd_list() + [Restart(), RollOut(), Watch()] + Reaper.cmd_list() + Repair.cmd_list()
72
107
 
73
- def tools() -> list[Command]:
74
- return [Cqlsh(), Postgres(), Bash(), CodeStart(), CodeStop()]
108
+ def postgres_ops() -> list[Command]:
109
+ return [Postgres(), DeployPgAgent(), UndeployPgAgent(), PostgresPg()]
75
110
 
76
- def app() -> list[Command]:
111
+ def app_ops() -> list[Command]:
77
112
  return [ShowAppActions(), ShowAppId(), ShowAppQueues(), AppPing(), App()]
78
113
 
114
+ def audit_ops() -> list[Command]:
115
+ return [Audit()] + Audit.cmd_list()
116
+
117
+ def export_ops() -> list[Command]:
118
+ return [ExportSelectX(), DropExportDatabase(), DropExportDatabases(), ShowColumnCounts()]
119
+
120
+ def tools() -> list[Command]:
121
+ return [Shell(), CodeStart(), CodeStop(), DeployFrontend(), UndeployFrontend(), DeployPod(), UndeployPod(), Kubectl(), Code()]
122
+
79
123
  def exit() -> list[Command]:
80
124
  return [Exit()]