cloudx-proxy 0.4.8__py3-none-any.whl → 0.4.9__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.
cloudx_proxy/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.4.8'
21
- __version_tuple__ = version_tuple = (0, 4, 8)
20
+ __version__ = version = '0.4.9'
21
+ __version_tuple__ = version_tuple = (0, 4, 9)
cloudx_proxy/cli.py CHANGED
@@ -1,5 +1,7 @@
1
1
  import os
2
2
  import sys
3
+ import re
4
+ from pathlib import Path
3
5
  import click
4
6
  from . import __version__
5
7
  from .core import CloudXProxy
@@ -123,5 +125,104 @@ def setup(profile: str, ssh_key: str, ssh_config: str, aws_env: str, use_1passwo
123
125
  print(f"\n\033[91mError: {str(e)}\033[0m", file=sys.stderr)
124
126
  sys.exit(1)
125
127
 
128
+ @cli.command()
129
+ @click.option('--ssh-config', help='SSH config file to use (default: ~/.ssh/vscode/config)')
130
+ @click.option('--environment', help='Filter hosts by environment (e.g., dev, prod)')
131
+ @click.option('--detailed', is_flag=True, help='Show detailed information including instance IDs')
132
+ def list(ssh_config: str, environment: str, detailed: bool):
133
+ """List configured cloudx-proxy SSH hosts.
134
+
135
+ This command parses the SSH configuration file and displays all configured cloudx-proxy hosts.
136
+ Hosts are grouped by environment for easier navigation.
137
+
138
+ Example usage:
139
+ cloudx-proxy list
140
+ cloudx-proxy list --environment dev
141
+ cloudx-proxy list --ssh-config ~/.ssh/cloudx/config
142
+ cloudx-proxy list --detailed
143
+ """
144
+ try:
145
+ # Determine SSH config file path
146
+ if ssh_config:
147
+ config_file = Path(os.path.expanduser(ssh_config))
148
+ else:
149
+ config_file = Path(os.path.expanduser("~/.ssh/vscode/config"))
150
+
151
+ if not config_file.exists():
152
+ print(f"SSH config file not found: {config_file}")
153
+ print("Run 'cloudx-proxy setup' to create a configuration.")
154
+ sys.exit(1)
155
+
156
+ # Read SSH config file
157
+ config_content = config_file.read_text()
158
+
159
+ # Parse hosts using regex
160
+ # Match Host entries for cloudx hosts
161
+ host_pattern = r'Host\s+(cloudx-[^\s]+)(?:\s*\n(?:(?!\s*Host\s+).)*?HostName\s+([^\s]+))?'
162
+ hosts = re.finditer(host_pattern, config_content, re.DOTALL)
163
+
164
+ # Group hosts by environment
165
+ environments = {}
166
+ generic_hosts = []
167
+
168
+ for match in hosts:
169
+ hostname = match.group(1)
170
+ instance_id = match.group(2) if match.group(2) else "N/A"
171
+
172
+ # Skip generic patterns like cloudx-* or cloudx-dev-*
173
+ if hostname.endswith('*'):
174
+ generic_hosts.append((hostname, instance_id))
175
+ continue
176
+
177
+ # Extract environment from hostname (format: cloudx-{env}-{name})
178
+ parts = hostname.split('-')
179
+ if len(parts) >= 3:
180
+ env = parts[1]
181
+ name = '-'.join(parts[2:])
182
+
183
+ # Filter by environment if specified
184
+ if environment and env != environment:
185
+ continue
186
+
187
+ if env not in environments:
188
+ environments[env] = []
189
+
190
+ environments[env].append((hostname, name, instance_id))
191
+
192
+ # Display results
193
+ if not environments and not generic_hosts:
194
+ print("No cloudx-proxy hosts configured.")
195
+ print("Run 'cloudx-proxy setup' to configure a host.")
196
+ return
197
+
198
+ # Print header
199
+ print(f"\n\033[1;95m=== cloudx-proxy Configured Hosts ===\033[0m\n")
200
+
201
+ # Print generic patterns if any and detailed mode
202
+ if generic_hosts and detailed:
203
+ print("\033[1;94mGeneric Patterns:\033[0m")
204
+ for hostname, instance_id in generic_hosts:
205
+ print(f" {hostname}")
206
+ print()
207
+
208
+ # Print environments and hosts
209
+ for env, hosts in sorted(environments.items()):
210
+ print(f"\033[1;94mEnvironment: {env}\033[0m")
211
+ for hostname, name, instance_id in sorted(hosts, key=lambda x: x[1]):
212
+ if detailed:
213
+ print(f" {name} \033[90m({hostname})\033[0m -> \033[93m{instance_id}\033[0m")
214
+ else:
215
+ print(f" {name} \033[90m({hostname})\033[0m")
216
+ print()
217
+
218
+ # Print usage hint
219
+ print("\033[1;93mUsage:\033[0m")
220
+ print(" Connect with SSH: \033[96mssh <hostname>\033[0m")
221
+ print(" Connect with VSCode: Use Remote Explorer in VSCode")
222
+
223
+ except Exception as e:
224
+ print(f"Error: {str(e)}", file=sys.stderr)
225
+ sys.exit(1)
226
+
126
227
  if __name__ == '__main__':
127
228
  cli()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: cloudx-proxy
3
- Version: 0.4.8
3
+ Version: 0.4.9
4
4
  Summary: SSH proxy command to connect VSCode with Cloud9/CloudX instance using AWS Systems Manager
5
5
  Author-email: easytocloud <info@easytocloud.com>
6
6
  License: MIT License
@@ -329,6 +329,33 @@ uvx cloudx-proxy connect i-0123456789abcdef0 22 --profile myprofile --aws-env pr
329
329
 
330
330
  Note: The connect command is typically used through the SSH ProxyCommand configuration set up by the setup command. You rarely need to run it directly unless testing the connection.
331
331
 
332
+ #### List Command
333
+ ```bash
334
+ uvx cloudx-proxy list [OPTIONS]
335
+ ```
336
+
337
+ Options:
338
+ - `--ssh-config` (optional): Path to the SSH config file to use. If not specified, uses ~/.ssh/vscode/config.
339
+ - `--environment` (optional): Filter hosts by environment (e.g., dev, prod). If not specified, shows all environments.
340
+ - `--detailed` (flag): Show detailed information including instance IDs.
341
+
342
+ Example usage:
343
+ ```bash
344
+ # List all configured hosts
345
+ uvx cloudx-proxy list
346
+
347
+ # List hosts in a specific environment
348
+ uvx cloudx-proxy list --environment dev
349
+
350
+ # List hosts with detailed information
351
+ uvx cloudx-proxy list --detailed
352
+
353
+ # List hosts from a custom SSH config
354
+ uvx cloudx-proxy list --ssh-config ~/.ssh/cloudx/config
355
+ ```
356
+
357
+ The list command displays all configured cloudx-proxy hosts, grouped by environment. It provides a quick overview of available connections and can help troubleshoot SSH configuration issues.
358
+
332
359
  ### VSCode
333
360
 
334
361
  1. Click the "Remote Explorer" icon in the VSCode sidebar
@@ -0,0 +1,12 @@
1
+ cloudx_proxy/_1password.py,sha256=uxyCfVvO1eQrOfYRojst_LN2DV4fIwxM5moaQTn3wQY,5853
2
+ cloudx_proxy/__init__.py,sha256=ZZ2O_m9OFJm18AxMSuYJt4UjSuSqyJlYRaZMoets498,61
3
+ cloudx_proxy/_version.py,sha256=Qwhf0l82NvpFOo7vXgVkyz_7G2at6sShXP6BTYAt98I,511
4
+ cloudx_proxy/cli.py,sha256=COcaXVgdIKtnKFmXYaxVVtNbxTmuBNcVJeUD-dv5qUo,9355
5
+ cloudx_proxy/core.py,sha256=RF3bX5MQiokRKjYEPnfWdKywGdtoVUvV2xZqm9uOl1g,8135
6
+ cloudx_proxy/setup.py,sha256=QrInbZdghpAYn064h02KmpA9r-nEbVm-LyTcXLxSmXY,39823
7
+ cloudx_proxy-0.4.9.dist-info/LICENSE,sha256=i7P2OR4zsJYsMWcCUDe_B9ZfGi9bU0K5I2nKfDrW_N8,1068
8
+ cloudx_proxy-0.4.9.dist-info/METADATA,sha256=RJfOtddbnCQ_RMkPJqkiVj7lhbxALVWUQTtlMgHyEgc,19995
9
+ cloudx_proxy-0.4.9.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
10
+ cloudx_proxy-0.4.9.dist-info/entry_points.txt,sha256=HGt743N2lVlKd7O1qWq3C0aEHyS5PjPnxzDHh7hwtSg,54
11
+ cloudx_proxy-0.4.9.dist-info/top_level.txt,sha256=2wtEote1db21j-VvkCJFfT-dLlauuG5indjggYh3xDg,13
12
+ cloudx_proxy-0.4.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- cloudx_proxy/_1password.py,sha256=uxyCfVvO1eQrOfYRojst_LN2DV4fIwxM5moaQTn3wQY,5853
2
- cloudx_proxy/__init__.py,sha256=ZZ2O_m9OFJm18AxMSuYJt4UjSuSqyJlYRaZMoets498,61
3
- cloudx_proxy/_version.py,sha256=o3eBGRx-4NPvQqJw5bXvji0vq6MJg2dOBQcPNjPjLMw,511
4
- cloudx_proxy/cli.py,sha256=EP1UxY4eotFEIBIU8ullIVc3QulbovxVdG4rLVePRWQ,5306
5
- cloudx_proxy/core.py,sha256=RF3bX5MQiokRKjYEPnfWdKywGdtoVUvV2xZqm9uOl1g,8135
6
- cloudx_proxy/setup.py,sha256=QrInbZdghpAYn064h02KmpA9r-nEbVm-LyTcXLxSmXY,39823
7
- cloudx_proxy-0.4.8.dist-info/LICENSE,sha256=i7P2OR4zsJYsMWcCUDe_B9ZfGi9bU0K5I2nKfDrW_N8,1068
8
- cloudx_proxy-0.4.8.dist-info/METADATA,sha256=ms0KA2KpPOWQ8Wsb_lXaZkbHzoKKKB4fiot8IP6ZcKQ,19102
9
- cloudx_proxy-0.4.8.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
10
- cloudx_proxy-0.4.8.dist-info/entry_points.txt,sha256=HGt743N2lVlKd7O1qWq3C0aEHyS5PjPnxzDHh7hwtSg,54
11
- cloudx_proxy-0.4.8.dist-info/top_level.txt,sha256=2wtEote1db21j-VvkCJFfT-dLlauuG5indjggYh3xDg,13
12
- cloudx_proxy-0.4.8.dist-info/RECORD,,