kaqing 2.0.110__py3-none-any.whl → 2.0.184__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 (204) hide show
  1. adam/__init__.py +0 -2
  2. adam/app_session.py +9 -12
  3. adam/apps.py +18 -4
  4. adam/batch.py +5 -5
  5. adam/checks/check_utils.py +16 -46
  6. adam/checks/cpu.py +7 -1
  7. adam/checks/cpu_metrics.py +52 -0
  8. adam/checks/disk.py +2 -3
  9. adam/columns/columns.py +3 -1
  10. adam/columns/cpu.py +3 -1
  11. adam/columns/cpu_metrics.py +22 -0
  12. adam/columns/memory.py +3 -4
  13. adam/commands/__init__.py +24 -0
  14. adam/commands/alter_tables.py +33 -48
  15. adam/commands/app/__init__.py +0 -0
  16. adam/commands/app/app.py +38 -0
  17. adam/commands/{app_ping.py → app/app_ping.py} +7 -13
  18. adam/commands/app/show_app_actions.py +49 -0
  19. adam/commands/{show → app}/show_app_id.py +8 -11
  20. adam/commands/{show → app}/show_app_queues.py +7 -14
  21. adam/commands/app/utils_app.py +98 -0
  22. adam/commands/audit/audit.py +27 -31
  23. adam/commands/audit/audit_repair_tables.py +14 -18
  24. adam/commands/audit/audit_run.py +16 -23
  25. adam/commands/audit/show_last10.py +4 -17
  26. adam/commands/audit/show_slow10.py +4 -17
  27. adam/commands/audit/show_top10.py +4 -16
  28. adam/commands/audit/utils_show_top10.py +15 -3
  29. adam/commands/bash/__init__.py +5 -0
  30. adam/commands/bash/bash.py +36 -0
  31. adam/commands/bash/bash_completer.py +93 -0
  32. adam/commands/bash/utils_bash.py +16 -0
  33. adam/commands/cat.py +36 -0
  34. adam/commands/cd.py +11 -95
  35. adam/commands/check.py +15 -24
  36. adam/commands/cli_commands.py +2 -3
  37. adam/commands/clipboard_copy.py +86 -0
  38. adam/commands/code.py +57 -0
  39. adam/commands/command.py +198 -40
  40. adam/commands/commands_utils.py +12 -27
  41. adam/commands/cql/cql_completions.py +27 -10
  42. adam/commands/cql/cqlsh.py +12 -30
  43. adam/commands/cql/utils_cql.py +297 -0
  44. adam/commands/deploy/code_start.py +7 -10
  45. adam/commands/deploy/code_stop.py +4 -21
  46. adam/commands/deploy/code_utils.py +3 -3
  47. adam/commands/deploy/deploy.py +4 -27
  48. adam/commands/deploy/deploy_frontend.py +14 -17
  49. adam/commands/deploy/deploy_pg_agent.py +3 -6
  50. adam/commands/deploy/deploy_pod.py +65 -73
  51. adam/commands/deploy/deploy_utils.py +14 -24
  52. adam/commands/deploy/undeploy.py +4 -27
  53. adam/commands/deploy/undeploy_frontend.py +4 -7
  54. adam/commands/deploy/undeploy_pg_agent.py +6 -8
  55. adam/commands/deploy/undeploy_pod.py +11 -12
  56. adam/commands/devices/__init__.py +0 -0
  57. adam/commands/devices/device.py +123 -0
  58. adam/commands/devices/device_app.py +163 -0
  59. adam/commands/devices/device_auit_log.py +49 -0
  60. adam/commands/devices/device_cass.py +179 -0
  61. adam/commands/devices/device_export.py +84 -0
  62. adam/commands/devices/device_postgres.py +150 -0
  63. adam/commands/devices/devices.py +25 -0
  64. adam/commands/download_file.py +47 -0
  65. adam/commands/exit.py +1 -4
  66. adam/commands/export/__init__.py +0 -0
  67. adam/commands/export/clean_up_all_export_sessions.py +37 -0
  68. adam/commands/export/clean_up_export_sessions.py +39 -0
  69. adam/commands/export/download_export_session.py +39 -0
  70. adam/commands/export/drop_export_database.py +39 -0
  71. adam/commands/export/drop_export_databases.py +37 -0
  72. adam/commands/export/export.py +53 -0
  73. adam/commands/export/export_databases.py +245 -0
  74. adam/commands/export/export_select.py +59 -0
  75. adam/commands/export/export_select_x.py +54 -0
  76. adam/commands/export/export_sessions.py +209 -0
  77. adam/commands/export/export_use.py +49 -0
  78. adam/commands/export/exporter.py +332 -0
  79. adam/commands/export/import_files.py +44 -0
  80. adam/commands/export/import_session.py +44 -0
  81. adam/commands/export/importer.py +81 -0
  82. adam/commands/export/importer_athena.py +177 -0
  83. adam/commands/export/importer_sqlite.py +67 -0
  84. adam/commands/export/show_column_counts.py +45 -0
  85. adam/commands/export/show_export_databases.py +38 -0
  86. adam/commands/export/show_export_session.py +39 -0
  87. adam/commands/export/show_export_sessions.py +37 -0
  88. adam/commands/export/utils_export.py +343 -0
  89. adam/commands/find_files.py +51 -0
  90. adam/commands/find_processes.py +76 -0
  91. adam/commands/head.py +36 -0
  92. adam/commands/help.py +5 -3
  93. adam/commands/intermediate_command.py +49 -0
  94. adam/commands/issues.py +11 -43
  95. adam/commands/kubectl.py +38 -0
  96. adam/commands/login.py +22 -24
  97. adam/commands/logs.py +3 -6
  98. adam/commands/ls.py +11 -116
  99. adam/commands/medusa/medusa.py +4 -22
  100. adam/commands/medusa/medusa_backup.py +20 -27
  101. adam/commands/medusa/medusa_restore.py +38 -37
  102. adam/commands/medusa/medusa_show_backupjobs.py +16 -18
  103. adam/commands/medusa/medusa_show_restorejobs.py +13 -18
  104. adam/commands/nodetool.py +11 -17
  105. adam/commands/param_get.py +11 -14
  106. adam/commands/param_set.py +8 -12
  107. adam/commands/postgres/postgres.py +45 -46
  108. adam/commands/postgres/postgres_databases.py +269 -0
  109. adam/commands/postgres/postgres_ls.py +4 -8
  110. adam/commands/postgres/postgres_preview.py +5 -9
  111. adam/commands/postgres/psql_completions.py +4 -3
  112. adam/commands/postgres/utils_postgres.py +70 -0
  113. adam/commands/preview_table.py +8 -44
  114. adam/commands/pwd.py +14 -46
  115. adam/commands/reaper/reaper.py +4 -27
  116. adam/commands/reaper/reaper_forward.py +49 -56
  117. adam/commands/reaper/reaper_forward_session.py +6 -0
  118. adam/commands/reaper/reaper_forward_stop.py +10 -16
  119. adam/commands/reaper/reaper_restart.py +7 -14
  120. adam/commands/reaper/reaper_run_abort.py +8 -33
  121. adam/commands/reaper/reaper_runs.py +43 -58
  122. adam/commands/reaper/reaper_runs_abort.py +29 -49
  123. adam/commands/reaper/reaper_schedule_activate.py +9 -32
  124. adam/commands/reaper/reaper_schedule_start.py +9 -32
  125. adam/commands/reaper/reaper_schedule_stop.py +9 -32
  126. adam/commands/reaper/reaper_schedules.py +4 -14
  127. adam/commands/reaper/reaper_status.py +8 -16
  128. adam/commands/reaper/utils_reaper.py +194 -0
  129. adam/commands/repair/repair.py +4 -22
  130. adam/commands/repair/repair_log.py +5 -11
  131. adam/commands/repair/repair_run.py +27 -34
  132. adam/commands/repair/repair_scan.py +32 -38
  133. adam/commands/repair/repair_stop.py +5 -11
  134. adam/commands/report.py +27 -29
  135. adam/commands/restart.py +25 -26
  136. adam/commands/rollout.py +19 -24
  137. adam/commands/shell.py +12 -4
  138. adam/commands/show/show.py +10 -25
  139. adam/commands/show/show_adam.py +3 -3
  140. adam/commands/show/show_cassandra_repairs.py +35 -0
  141. adam/commands/show/show_cassandra_status.py +33 -51
  142. adam/commands/show/show_cassandra_version.py +5 -18
  143. adam/commands/show/show_commands.py +20 -25
  144. adam/commands/show/show_host.py +1 -1
  145. adam/commands/show/show_login.py +20 -27
  146. adam/commands/show/show_params.py +2 -5
  147. adam/commands/show/show_processes.py +15 -19
  148. adam/commands/show/show_storage.py +10 -20
  149. adam/commands/watch.py +26 -29
  150. adam/config.py +5 -14
  151. adam/embedded_params.py +1 -1
  152. adam/log.py +4 -4
  153. adam/pod_exec_result.py +6 -3
  154. adam/repl.py +69 -115
  155. adam/repl_commands.py +52 -19
  156. adam/repl_state.py +161 -40
  157. adam/sql/sql_completer.py +52 -27
  158. adam/sql/sql_state_machine.py +131 -19
  159. adam/sso/authn_ad.py +6 -8
  160. adam/sso/authn_okta.py +4 -6
  161. adam/sso/cred_cache.py +3 -5
  162. adam/sso/idp.py +9 -12
  163. adam/utils.py +511 -9
  164. adam/utils_athena.py +145 -0
  165. adam/utils_audits.py +12 -103
  166. adam/utils_issues.py +32 -0
  167. adam/utils_k8s/app_clusters.py +28 -0
  168. adam/utils_k8s/app_pods.py +36 -0
  169. adam/utils_k8s/cassandra_clusters.py +30 -19
  170. adam/utils_k8s/cassandra_nodes.py +3 -3
  171. adam/utils_k8s/custom_resources.py +16 -17
  172. adam/utils_k8s/ingresses.py +2 -2
  173. adam/utils_k8s/jobs.py +7 -11
  174. adam/utils_k8s/k8s.py +87 -0
  175. adam/utils_k8s/kube_context.py +2 -2
  176. adam/utils_k8s/pods.py +89 -78
  177. adam/utils_k8s/secrets.py +4 -4
  178. adam/utils_k8s/service_accounts.py +5 -4
  179. adam/utils_k8s/services.py +2 -2
  180. adam/utils_k8s/statefulsets.py +1 -12
  181. adam/utils_local.py +4 -0
  182. adam/utils_net.py +4 -4
  183. adam/utils_repl/__init__.py +0 -0
  184. adam/utils_repl/automata_completer.py +48 -0
  185. adam/utils_repl/repl_completer.py +46 -0
  186. adam/utils_repl/state_machine.py +173 -0
  187. adam/utils_sqlite.py +137 -0
  188. adam/version.py +1 -1
  189. {kaqing-2.0.110.dist-info → kaqing-2.0.184.dist-info}/METADATA +1 -1
  190. kaqing-2.0.184.dist-info/RECORD +244 -0
  191. adam/commands/app.py +0 -67
  192. adam/commands/bash.py +0 -150
  193. adam/commands/cp.py +0 -95
  194. adam/commands/cql/cql_utils.py +0 -112
  195. adam/commands/devices.py +0 -118
  196. adam/commands/postgres/postgres_context.py +0 -239
  197. adam/commands/postgres/postgres_utils.py +0 -31
  198. adam/commands/reaper/reaper_session.py +0 -159
  199. adam/commands/show/show_app_actions.py +0 -56
  200. adam/commands/show/show_repairs.py +0 -47
  201. kaqing-2.0.110.dist-info/RECORD +0 -187
  202. {kaqing-2.0.110.dist-info → kaqing-2.0.184.dist-info}/WHEEL +0 -0
  203. {kaqing-2.0.110.dist-info → kaqing-2.0.184.dist-info}/entry_points.txt +0 -0
  204. {kaqing-2.0.110.dist-info → kaqing-2.0.184.dist-info}/top_level.txt +0 -0
adam/repl.py CHANGED
@@ -1,27 +1,24 @@
1
1
  import os
2
- import re
3
2
  import time
4
- import traceback
3
+ from typing import cast
5
4
  import click
6
- import concurrent
7
- from prompt_toolkit.completion import NestedCompleter
8
5
  from prompt_toolkit.key_binding import KeyBindings
9
6
 
10
7
  from adam.cli_group import cli
11
- from adam.commands.command import Command
8
+ from adam.commands.command import Command, InvalidArgumentsException, InvalidStateException
12
9
  from adam.commands.command_helpers import ClusterCommandHelper
10
+ from adam.commands.devices.devices import Devices
13
11
  from adam.commands.help import Help
14
- from adam.commands.postgres.postgres_context import PostgresContext
15
12
  from adam.config import Config
16
13
  from adam.utils_audits import Audits
17
14
  from adam.utils_k8s.kube_context import KubeContext
18
- from adam.utils_k8s.statefulsets import StatefulSets
19
15
  from adam.log import Log
20
16
  from adam.repl_commands import ReplCommands
21
17
  from adam.repl_session import ReplSession
22
18
  from adam.repl_state import ReplState
23
- from adam.utils import deep_merge_dicts, deep_sort_dict, lines_to_tabular, log2
19
+ from adam.utils import clear_wait_log_flag, debug_trace, deep_merge_dicts, deep_sort_dict, tabulize, log2, log_exc, log_timing
24
20
  from adam.apps import Apps
21
+ from adam.utils_repl.repl_completer import ReplCompleter
25
22
  from . import __version__
26
23
 
27
24
  def enter_repl(state: ReplState):
@@ -35,66 +32,13 @@ def enter_repl(state: ReplState):
35
32
  session = ReplSession().prompt_session
36
33
 
37
34
  def prompt_msg():
38
- msg = ''
39
- if state.device == ReplState.P:
40
- msg = f'{ReplState.P}:'
41
- pg: PostgresContext = PostgresContext.apply(state.namespace, state.pg_path) if state.pg_path else None
42
- if pg and pg.db:
43
- msg += pg.db
44
- elif pg and pg.host:
45
- msg += pg.host
46
- elif state.device == ReplState.A:
47
- msg = f'{ReplState.A}:'
48
- if state.app_env:
49
- msg += state.app_env
50
- if state.app_app:
51
- msg += f'/{state.app_app}'
52
- elif state.device == ReplState.L:
53
- msg = f'{ReplState.L}:'
54
- else:
55
- msg = f'{ReplState.C}:'
56
- if state.pod:
57
- # cs-d0767a536f-cs-d0767a536f-default-sts-0
58
- group = re.match(r".*?-.*?-(.*)", state.pod)
59
- msg += group[1]
60
- elif state.sts:
61
- # cs-d0767a536f-cs-d0767a536f-default-sts
62
- group = re.match(r".*?-.*?-(.*)", state.sts)
63
- msg += group[1]
35
+ msg = state.__str__()
64
36
 
65
37
  return f"{msg}$ " if state.bash_session else f"{msg}> "
66
38
 
67
39
  Log.log2(f'kaqing {__version__}')
68
40
 
69
- if state.device == ReplState.C:
70
- auto_enter = Config().get('repl.c.auto-enter', 'cluster')
71
- if auto_enter and auto_enter in ['cluster', 'first-pod']:
72
- ss = StatefulSets.list_sts_name_and_ns()
73
- if not ss:
74
- log2("No Cassandra clusters found.")
75
- elif not state.sts and len(ss) == 1:
76
- cluster = ss[0]
77
- state.sts = cluster[0]
78
- state.namespace = cluster[1]
79
- if auto_enter == 'first-pod':
80
- state.pod = f'{state.sts}-0'
81
- if KubeContext().in_cluster_namespace:
82
- Config().wait_log(f'Moving to the only Cassandra cluster: {state.sts}...')
83
- else:
84
- Config().wait_log(f'Moving to the only Cassandra cluster: {state.sts}@{state.namespace}...')
85
- elif state.device == ReplState.A:
86
- if not state.app_env:
87
- if app := Config().get('repl.a.auto-enter-app', 'c3/c3'):
88
- if app != 'no':
89
- ea = app.split('/')
90
- state.app_env = ea[0]
91
- if len(ea) > 1:
92
- state.app_app = ea[1]
93
- Config().wait_log(f'Moving to {state.app_env}/{state.app_app}...')
94
- else:
95
- Config().wait_log(f'Moving to {state.app_env}...')
96
- elif state.device == ReplState.P:
97
- Config().wait_log('Inspecting postgres database instances...')
41
+ Devices.device(state).enter(state)
98
42
 
99
43
  kb = KeyBindings()
100
44
 
@@ -102,34 +46,32 @@ def enter_repl(state: ReplState):
102
46
  def _(event):
103
47
  event.app.current_buffer.text = ''
104
48
 
105
- with concurrent.futures.ThreadPoolExecutor(max_workers=Config().get('audit.workers', 3)) as executor:
49
+ with Audits.offload() as exec:
106
50
  # warm up AWS lambda - this log line may timeout and get lost, which is fine
107
- executor.submit(Audits.log, 'entering kaqing repl', state.namespace, 'z', 0.0)
51
+ exec.submit(Audits.log, 'entering kaqing repl', state.namespace, 'z', 0.0)
108
52
 
109
53
  s0 = time.time()
110
54
 
111
55
  # use sorted command list only for auto-completion
112
56
  sorted_cmds = sorted(cmd_list, key=lambda cmd: cmd.command())
113
57
  while True:
58
+ cmd: str = None
114
59
  result = None
115
60
  try:
116
- completer = NestedCompleter.from_nested_dict({})
61
+ completer = ReplCompleter.from_nested_dict({})
117
62
  if not state.bash_session:
118
- completions = {}
119
- # app commands are available only on a: drive
120
- if state.device == ReplState.A and state.app_app:
121
- completions = Apps(path='apps.yaml').commands()
122
-
123
- for cmd in sorted_cmds:
124
- s1 = time.time()
125
- try:
126
- completions = deep_sort_dict(deep_merge_dicts(completions, cmd.completion(state)))
127
- finally:
128
- if Config().get('debugs.timings', False):
129
- log2(f'Timing auto-completion-calc {cmd.command()}: {time.time() - s1:.2f}')
130
-
131
- # print(json.dumps(completions, indent=4))
132
- completer = NestedCompleter.from_nested_dict(completions)
63
+ with log_timing('completion-calcs'):
64
+ completions = {}
65
+ # app commands are available only on a: drive
66
+ if state.device == ReplState.A and state.app_app:
67
+ completions = log_timing('actions', lambda: Apps(path='apps.yaml').commands())
68
+
69
+ for c in sorted_cmds:
70
+ with log_exc(f'* {c.command()} command returned None completions.'):
71
+ completions = log_timing(c.command(), lambda: deep_sort_dict(deep_merge_dicts(completions, c.completion(state))))
72
+
73
+ # print(json.dumps(completions, indent=4))
74
+ completer = ReplCompleter.from_nested_dict(completions)
133
75
 
134
76
  cmd = session.prompt(prompt_msg(), completer=completer, key_bindings=kb)
135
77
  s0 = time.time()
@@ -141,9 +83,40 @@ def enter_repl(state: ReplState):
141
83
 
142
84
  cmd = f'bash {cmd}'
143
85
 
144
- if cmd and cmd.strip(' ') and not (result := cmds.run(cmd, state)):
145
- # not served by any command in the chain; try SQL query or C3 action
146
- result = try_device_default_action(state, cmds, cmd_list, cmd)
86
+ def targetted(state: ReplState, cmd: str):
87
+ if not (cmd.startswith('@') and len(arry := cmd.split(' ')) > 1):
88
+ return state, cmd
89
+
90
+ if state.device == ReplState.A and state.app_app or state.device == ReplState.P:
91
+ state.push()
92
+
93
+ state.app_pod = arry[0].strip('@')
94
+ cmd = ' '.join(arry[1:])
95
+ elif state.device == ReplState.P:
96
+ state.push()
97
+
98
+ state.app_pod = arry[0].strip('@')
99
+ cmd = ' '.join(arry[1:])
100
+ elif state.sts:
101
+ state.push()
102
+
103
+ state.pod = arry[0].strip('@')
104
+ cmd = ' '.join(arry[1:])
105
+
106
+ return (state, cmd)
107
+
108
+ target, cmd = targetted(state, cmd)
109
+ try:
110
+ if cmd and cmd.strip(' ') and not (result := cmds.run(cmd, target)):
111
+ result = try_device_default_action(target, cmds, cmd_list, cmd)
112
+ except InvalidStateException:
113
+ pass
114
+ except InvalidArgumentsException:
115
+ pass
116
+
117
+ if result and type(result) is ReplState and (s := cast(ReplState, result).export_session) != state.export_session:
118
+ state.export_session = s
119
+
147
120
  except EOFError: # Handle Ctrl+D (EOF) for graceful exit
148
121
  break
149
122
  except Exception as e:
@@ -151,45 +124,26 @@ def enter_repl(state: ReplState):
151
124
  raise e
152
125
  else:
153
126
  log2(e)
154
- Config().debug(traceback.format_exc())
127
+ debug_trace()
155
128
  finally:
156
- Config().clear_wait_log_flag()
157
- if Config().get('debugs.timings', False) and 'cmd' in locals() and 's0' in locals():
158
- log2(f'Timing command {cmd}: {time.time() - s0:.2f}')
129
+ if not state.bash_session:
130
+ state.pop()
131
+
132
+ clear_wait_log_flag()
133
+ if cmd:
134
+ log_timing(f'command {cmd}', s0=s0)
159
135
 
160
136
  # offload audit logging
161
137
  if cmd and (state.device != ReplState.L or Config().get('audit.log-audit-queries', False)):
162
- executor.submit(Audits.log, cmd, state.namespace, state.device, time.time() - s0, get_audit_extra(result))
138
+ exec.submit(Audits.log, cmd, state.namespace, state.device, time.time() - s0, get_audit_extra(result))
163
139
 
164
140
  def try_device_default_action(state: ReplState, cmds: Command, cmd_list: list[Command], cmd: str):
165
- result = None
166
-
167
- c_sql_tried = False
168
- if state.device == ReplState.P:
169
- pg: PostgresContext = PostgresContext.apply(state.namespace, state.pg_path)
170
- if pg.db:
171
- c_sql_tried = True
172
- cmd = f'pg {cmd}'
173
- result = cmds.run(cmd, state)
174
- elif state.device == ReplState.A:
175
- if state.app_app:
176
- c_sql_tried = True
177
- cmd = f'app {cmd}'
178
- result = cmds.run(cmd, state)
179
- elif state.device == ReplState.L:
180
- c_sql_tried = True
181
- cmd = f'audit {cmd}'
182
- result = cmds.run(cmd, state)
183
- elif state.sts:
184
- c_sql_tried = True
185
- cmd = f'cql {cmd}'
186
- result = cmds.run(cmd, state)
187
-
188
- if not c_sql_tried:
141
+ action_taken, result = Devices.device(state).try_fallback_action(cmds, state, cmd)
142
+
143
+ if not action_taken:
189
144
  log2(f'* Invalid command: {cmd}')
190
145
  log2()
191
- lines = [c.help(state) for c in cmd_list if c.help(state)]
192
- log2(lines_to_tabular(lines, separator='\t'))
146
+ tabulize([c.help(state) for c in cmd_list if c.help(state)], separator='\t', to=2)
193
147
 
194
148
  return result
195
149
 
adam/repl_commands.py CHANGED
@@ -1,9 +1,13 @@
1
1
  from adam.commands.alter_tables import AlterTables
2
- from adam.commands.app import App
3
- from adam.commands.app_ping import AppPing
2
+ from adam.commands.app.app import App
3
+ from adam.commands.app.app_ping import AppPing
4
+ from adam.commands.app.show_app_actions import ShowAppActions
5
+ from adam.commands.app.show_app_id import ShowAppId
6
+ from adam.commands.app.show_app_queues import ShowAppQueues
4
7
  from adam.commands.audit.audit import Audit
5
- from adam.commands.audit.audit_repair_tables import AuditRepairTables
6
- from adam.commands.audit.audit_run import AuditRun
8
+ from adam.commands.cat import Cat
9
+ from adam.commands.code import Code
10
+ from adam.commands.download_file import DownloadFile
7
11
  from adam.commands.deploy.code_start import CodeStart
8
12
  from adam.commands.deploy.code_stop import CodeStop
9
13
  from adam.commands.deploy.deploy import Deploy
@@ -14,22 +18,44 @@ from adam.commands.deploy.undeploy import Undeploy
14
18
  from adam.commands.deploy.undeploy_frontend import UndeployFrontend
15
19
  from adam.commands.deploy.undeploy_pg_agent import UndeployPgAgent
16
20
  from adam.commands.deploy.undeploy_pod import UndeployPod
21
+ from adam.commands.devices.device_app import DeviceApp
22
+ from adam.commands.devices.device_auit_log import DeviceAuditLog
23
+ from adam.commands.devices.device_cass import DeviceCass
24
+ from adam.commands.devices.device_export import DeviceExport
25
+ from adam.commands.devices.device_postgres import DevicePostgres
26
+ from adam.commands.export.download_export_session import DownloadExportSession
27
+ from adam.commands.export.drop_export_database import DropExportDatabase
28
+ from adam.commands.export.export import ExportTables
29
+ from adam.commands.export.import_files import ImportCSVFiles
30
+ from adam.commands.export.import_session import ImportSession
31
+ from adam.commands.export.clean_up_export_sessions import CleanUpExportSessions
32
+ from adam.commands.export.clean_up_all_export_sessions import CleanUpAllExportSessions
33
+ from adam.commands.export.drop_export_databases import DropExportDatabases
34
+ from adam.commands.export.export_select import ExportSelect
35
+ from adam.commands.export.export_use import ExportUse
36
+ from adam.commands.export.export_select_x import ExportSelectX
37
+ from adam.commands.export.show_column_counts import ShowColumnCounts
38
+ from adam.commands.export.show_export_databases import ShowExportDatabases
39
+ from adam.commands.export.show_export_session import ShowExportSession
40
+ from adam.commands.export.show_export_sessions import ShowExportSessions
41
+ from adam.commands.find_files import FindLocalFiles
42
+ from adam.commands.find_processes import FindProcesses
43
+ from adam.commands.head import Head
44
+ from adam.commands.kubectl import Kubectl
17
45
  from adam.commands.shell import Shell
18
- from adam.commands.show.show_app_queues import ShowAppQueues
19
- from adam.commands.cp import ClipboardCopy
20
- from adam.commands.bash import Bash
46
+ from adam.commands.clipboard_copy import ClipboardCopy
47
+ from adam.commands.bash.bash import Bash
21
48
  from adam.commands.cd import Cd
22
49
  from adam.commands.check import Check
23
50
  from adam.commands.command import Command
24
51
  from adam.commands.cql.cqlsh import Cqlsh
25
- from adam.commands.devices import DeviceApp, DeviceAuditLog, DeviceCass, DevicePostgres
26
52
  from adam.commands.exit import Exit
27
53
  from adam.commands.medusa.medusa import Medusa
28
54
  from adam.commands.param_get import GetParam
29
55
  from adam.commands.issues import Issues
30
56
  from adam.commands.ls import Ls
31
57
  from adam.commands.nodetool import NodeTool
32
- from adam.commands.postgres.postgres import Postgres
58
+ from adam.commands.postgres.postgres import Postgres, PostgresPg
33
59
  from adam.commands.preview_table import PreviewTable
34
60
  from adam.commands.pwd import Pwd
35
61
  from adam.commands.reaper.reaper import Reaper
@@ -39,8 +65,6 @@ from adam.commands.restart import Restart
39
65
  from adam.commands.rollout import RollOut
40
66
  from adam.commands.param_set import SetParam
41
67
  from adam.commands.show.show import Show
42
- from adam.commands.show.show_app_actions import ShowAppActions
43
- from adam.commands.show.show_app_id import ShowAppId
44
68
  from adam.commands.show.show_cassandra_status import ShowCassandraStatus
45
69
  from adam.commands.show.show_cassandra_version import ShowCassandraVersion
46
70
  from adam.commands.show.show_commands import ShowKubectlCommands
@@ -48,7 +72,7 @@ from adam.commands.show.show_host import ShowHost
48
72
  from adam.commands.show.show_login import ShowLogin
49
73
  from adam.commands.show.show_params import ShowParams
50
74
  from adam.commands.show.show_processes import ShowProcesses
51
- from adam.commands.show.show_repairs import ShowRepairs
75
+ from adam.commands.show.show_cassandra_repairs import ShowCassandraRepairs
52
76
  from adam.commands.show.show_storage import ShowStorage
53
77
  from adam.commands.show.show_adam import ShowAdam
54
78
  from adam.commands.watch import Watch
@@ -56,7 +80,7 @@ from adam.commands.watch import Watch
56
80
  class ReplCommands:
57
81
  def repl_cmd_list() -> list[Command]:
58
82
  cmds: list[Command] = ReplCommands.navigation() + ReplCommands.cassandra_ops() + ReplCommands.postgres_ops() + \
59
- ReplCommands.app_ops() + ReplCommands.audit_ops() + ReplCommands.tools() + ReplCommands.exit()
83
+ ReplCommands.app_ops() + ReplCommands.audit_ops() + ReplCommands.export_ops() + ReplCommands.tools() + ReplCommands.exit()
60
84
 
61
85
  intermediate_cmds: list[Command] = [App(), Audit(), Reaper(), Repair(), Deploy(), Show(), Undeploy()]
62
86
  ic = [c.command() for c in intermediate_cmds]
@@ -75,24 +99,33 @@ class ReplCommands:
75
99
  return deduped
76
100
 
77
101
  def navigation() -> list[Command]:
78
- return [Ls(), PreviewTable(), DeviceApp(), DevicePostgres(), DeviceCass(), DeviceAuditLog(), Cd(), Pwd(), ClipboardCopy(),
102
+ return [Ls(), PreviewTable(), DeviceApp(), DevicePostgres(), DeviceCass(), DeviceAuditLog(), DeviceExport(),
103
+ Cd(), Cat(), Head(), DownloadFile(), FindLocalFiles(), FindProcesses(), Pwd(), ClipboardCopy(),
79
104
  GetParam(), SetParam(), ShowParams(), ShowKubectlCommands(), ShowLogin(), ShowAdam(), ShowHost()]
80
105
 
81
106
  def cassandra_ops() -> list[Command]:
82
- return [Cqlsh(), ShowCassandraStatus(), ShowCassandraVersion(), ShowRepairs(), ShowStorage(), ShowProcesses(), Check(), Issues(), NodeTool(), Report()] + \
83
- [AlterTables()] + Medusa.cmd_list() + [Restart(), RollOut(), Watch()] + Reaper.cmd_list() + Repair.cmd_list()
107
+ return [Cqlsh(), ShowCassandraStatus(), ShowCassandraVersion(), ShowCassandraRepairs(), ShowStorage(), ShowProcesses(),
108
+ Check(), Issues(), NodeTool(), Report(), AlterTables(), Bash(),
109
+ ExportTables(), ExportSelect(), ExportUse(), ShowExportDatabases(), ShowColumnCounts(),
110
+ DropExportDatabase(), DropExportDatabases(),
111
+ ShowExportSessions(), ShowExportSession(), DownloadExportSession(),
112
+ CleanUpExportSessions(), CleanUpAllExportSessions(), ImportSession(), ImportCSVFiles()] + \
113
+ Medusa().cmd_list() + [Restart(), RollOut(), Watch()] + Reaper().cmd_list() + Repair().cmd_list()
84
114
 
85
115
  def postgres_ops() -> list[Command]:
86
- return [Postgres(), DeployPgAgent(), UndeployPgAgent()]
116
+ return [Postgres(), DeployPgAgent(), UndeployPgAgent(), PostgresPg()]
87
117
 
88
118
  def app_ops() -> list[Command]:
89
119
  return [ShowAppActions(), ShowAppId(), ShowAppQueues(), AppPing(), App()]
90
120
 
91
121
  def audit_ops() -> list[Command]:
92
- return [Audit()] + Audit.cmd_list()
122
+ return [Audit()] + Audit().cmd_list()
123
+
124
+ def export_ops() -> list[Command]:
125
+ return [ExportSelectX(), DropExportDatabase(), DropExportDatabases(), ShowColumnCounts()]
93
126
 
94
127
  def tools() -> list[Command]:
95
- return [Bash(), Shell(), CodeStart(), CodeStop(), DeployFrontend(), UndeployFrontend(), DeployPod(), UndeployPod()]
128
+ return [Shell(), CodeStart(), CodeStop(), DeployFrontend(), UndeployFrontend(), DeployPod(), UndeployPod(), Kubectl(), Code()]
96
129
 
97
130
  def exit() -> list[Command]:
98
131
  return [Exit()]