stackport 0.1.0__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.
- backend/__init__.py +0 -0
- backend/aws_client.py +22 -0
- backend/cache.py +24 -0
- backend/config.py +14 -0
- backend/main.py +53 -0
- backend/routes/__init__.py +0 -0
- backend/routes/resources.py +248 -0
- backend/routes/s3.py +169 -0
- backend/routes/stats.py +158 -0
- stackport-0.1.0.dist-info/METADATA +102 -0
- stackport-0.1.0.dist-info/RECORD +19 -0
- stackport-0.1.0.dist-info/WHEEL +5 -0
- stackport-0.1.0.dist-info/entry_points.txt +2 -0
- stackport-0.1.0.dist-info/licenses/LICENSE +21 -0
- stackport-0.1.0.dist-info/top_level.txt +1 -0
- ui/dist/assets/index-CRqBg0t6.js +360 -0
- ui/dist/assets/index-Is3dIbZM.css +1 -0
- ui/dist/favicon.png +0 -0
- ui/dist/index.html +17 -0
backend/routes/stats.py
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import time
|
|
3
|
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
4
|
+
|
|
5
|
+
from fastapi import APIRouter
|
|
6
|
+
|
|
7
|
+
from backend.aws_client import get_client
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
from backend.cache import cache
|
|
11
|
+
from backend.config import STACKPORT_SERVICES
|
|
12
|
+
|
|
13
|
+
router = APIRouter()
|
|
14
|
+
|
|
15
|
+
SERVICE_REGISTRY: dict[str, list[tuple[str, str, str, str]]] = {
|
|
16
|
+
"s3": [("buckets", "s3", "list_buckets", "Buckets")],
|
|
17
|
+
"sqs": [("queues", "sqs", "list_queues", "QueueUrls")],
|
|
18
|
+
"sns": [("topics", "sns", "list_topics", "Topics")],
|
|
19
|
+
"dynamodb": [("tables", "dynamodb", "list_tables", "TableNames")],
|
|
20
|
+
"lambda": [("functions", "lambda", "list_functions", "Functions")],
|
|
21
|
+
"iam": [
|
|
22
|
+
("roles", "iam", "list_roles", "Roles"),
|
|
23
|
+
("users", "iam", "list_users", "Users"),
|
|
24
|
+
("policies", "iam", "list_policies", "Policies"),
|
|
25
|
+
],
|
|
26
|
+
"logs": [("log_groups", "logs", "describe_log_groups", "logGroups")],
|
|
27
|
+
"ssm": [("parameters", "ssm", "describe_parameters", "Parameters")],
|
|
28
|
+
"secretsmanager": [("secrets", "secretsmanager", "list_secrets", "SecretList")],
|
|
29
|
+
"kinesis": [("streams", "kinesis", "list_streams", "StreamNames")],
|
|
30
|
+
"events": [
|
|
31
|
+
("rules", "events", "list_rules", "Rules"),
|
|
32
|
+
("event_buses", "events", "list_event_buses", "EventBuses"),
|
|
33
|
+
],
|
|
34
|
+
"ec2": [
|
|
35
|
+
("instances", "ec2", "describe_instances", "Reservations"),
|
|
36
|
+
("vpcs", "ec2", "describe_vpcs", "Vpcs"),
|
|
37
|
+
("subnets", "ec2", "describe_subnets", "Subnets"),
|
|
38
|
+
("security_groups", "ec2", "describe_security_groups", "SecurityGroups"),
|
|
39
|
+
("volumes", "ec2", "describe_volumes", "Volumes"),
|
|
40
|
+
],
|
|
41
|
+
"route53": [("hosted_zones", "route53", "list_hosted_zones", "HostedZones")],
|
|
42
|
+
"kms": [("keys", "kms", "list_keys", "Keys")],
|
|
43
|
+
"cloudformation": [("stacks", "cloudformation", "list_stacks", "StackSummaries")],
|
|
44
|
+
"stepfunctions": [
|
|
45
|
+
("state_machines", "stepfunctions", "list_state_machines", "stateMachines"),
|
|
46
|
+
],
|
|
47
|
+
"rds": [
|
|
48
|
+
("db_instances", "rds", "describe_db_instances", "DBInstances"),
|
|
49
|
+
("db_clusters", "rds", "describe_db_clusters", "DBClusters"),
|
|
50
|
+
],
|
|
51
|
+
"ecs": [
|
|
52
|
+
("clusters", "ecs", "list_clusters", "clusterArns"),
|
|
53
|
+
("task_definitions", "ecs", "list_task_definitions", "taskDefinitionArns"),
|
|
54
|
+
],
|
|
55
|
+
"monitoring": [
|
|
56
|
+
("alarms", "cloudwatch", "describe_alarms", "MetricAlarms"),
|
|
57
|
+
("dashboards", "cloudwatch", "list_dashboards", "DashboardEntries"),
|
|
58
|
+
],
|
|
59
|
+
"ses": [("identities", "ses", "list_identities", "Identities")],
|
|
60
|
+
"acm": [("certificates", "acm", "list_certificates", "CertificateSummaryList")],
|
|
61
|
+
"wafv2": [("web_acls", "wafv2", "list_web_acls", "WebACLs")],
|
|
62
|
+
"ecr": [("repositories", "ecr", "describe_repositories", "repositories")],
|
|
63
|
+
"elasticache": [("cache_clusters", "elasticache", "describe_cache_clusters", "CacheClusters")],
|
|
64
|
+
"glue": [
|
|
65
|
+
("databases", "glue", "get_databases", "DatabaseList"),
|
|
66
|
+
("crawlers", "glue", "get_crawlers", "Crawlers"),
|
|
67
|
+
],
|
|
68
|
+
"athena": [("workgroups", "athena", "list_work_groups", "WorkGroups")],
|
|
69
|
+
"apigateway": [("apis", "apigatewayv2", "get_apis", "Items")],
|
|
70
|
+
"firehose": [("delivery_streams", "firehose", "list_delivery_streams", "DeliveryStreamNames")],
|
|
71
|
+
"cognito-idp": [("user_pools", "cognito-idp", "list_user_pools", "UserPools")],
|
|
72
|
+
"cognito-identity": [("identity_pools", "cognito-identity", "list_identity_pools", "IdentityPools")],
|
|
73
|
+
"elasticmapreduce": [("clusters", "emr", "list_clusters", "Clusters")],
|
|
74
|
+
"elasticloadbalancing": [("load_balancers", "elbv2", "describe_load_balancers", "LoadBalancers")],
|
|
75
|
+
"elasticfilesystem": [("file_systems", "efs", "describe_file_systems", "FileSystems")],
|
|
76
|
+
"cloudfront": [("distributions", "cloudfront", "list_distributions", "DistributionList")],
|
|
77
|
+
"appsync": [("graphql_apis", "appsync", "list_graphql_apis", "graphqlApis")],
|
|
78
|
+
"sts": [],
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_start_time = time.time()
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@router.get("/health")
|
|
85
|
+
def health():
|
|
86
|
+
return {"status": "ok", "uptime_seconds": round(time.time() - _start_time, 1)}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# Some APIs require extra parameters to call
|
|
90
|
+
_METHOD_KWARGS: dict[tuple[str, str], dict] = {
|
|
91
|
+
("cognito-idp", "list_user_pools"): {"MaxResults": 60},
|
|
92
|
+
("cognito-identity", "list_identity_pools"): {"MaxResults": 60},
|
|
93
|
+
("wafv2", "list_web_acls"): {"Scope": "REGIONAL"},
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _count_items(resp, response_key: str) -> int:
|
|
98
|
+
"""Extract item count from a response, handling nested structures."""
|
|
99
|
+
items = resp.get(response_key, [])
|
|
100
|
+
# cloudfront list_distributions returns {"DistributionList": {"Items": [...]}}
|
|
101
|
+
if isinstance(items, dict) and "Items" in items:
|
|
102
|
+
return len(items.get("Items", []) or [])
|
|
103
|
+
if isinstance(items, list):
|
|
104
|
+
return len(items)
|
|
105
|
+
return 0
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _probe_service(service: str) -> tuple[str, dict]:
|
|
109
|
+
"""Probe a single service and return (service_name, result_dict)."""
|
|
110
|
+
registry_entries = SERVICE_REGISTRY.get(service)
|
|
111
|
+
if not registry_entries:
|
|
112
|
+
return service, {"status": "unavailable", "resources": {}}
|
|
113
|
+
|
|
114
|
+
resources: dict[str, int] = {}
|
|
115
|
+
try:
|
|
116
|
+
for resource_type, boto3_service, method_name, response_key in registry_entries:
|
|
117
|
+
client = get_client(boto3_service)
|
|
118
|
+
method = getattr(client, method_name)
|
|
119
|
+
kwargs = _METHOD_KWARGS.get((boto3_service, method_name), {})
|
|
120
|
+
try:
|
|
121
|
+
resp = method(**kwargs)
|
|
122
|
+
resources[resource_type] = _count_items(resp, response_key)
|
|
123
|
+
except Exception:
|
|
124
|
+
logger.debug("Failed to probe %s/%s", service, resource_type, exc_info=True)
|
|
125
|
+
resources[resource_type] = 0
|
|
126
|
+
return service, {"status": "available", "resources": resources}
|
|
127
|
+
except Exception:
|
|
128
|
+
logger.warning("Service %s unavailable", service, exc_info=True)
|
|
129
|
+
return service, {"status": "unavailable", "resources": {}}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@router.get("/stats")
|
|
133
|
+
def get_stats():
|
|
134
|
+
cached = cache.get("stats")
|
|
135
|
+
if cached is not None:
|
|
136
|
+
return cached
|
|
137
|
+
|
|
138
|
+
enabled_services = [s.strip() for s in STACKPORT_SERVICES.split(",") if s.strip()]
|
|
139
|
+
services: dict = {}
|
|
140
|
+
total_resources = 0
|
|
141
|
+
|
|
142
|
+
with ThreadPoolExecutor(max_workers=min(len(enabled_services), 10)) as executor:
|
|
143
|
+
futures = {executor.submit(_probe_service, svc): svc for svc in enabled_services}
|
|
144
|
+
for future in as_completed(futures):
|
|
145
|
+
svc_name, result = future.result()
|
|
146
|
+
services[svc_name] = result
|
|
147
|
+
total_resources += sum(result["resources"].values())
|
|
148
|
+
|
|
149
|
+
# Sort services alphabetically for stable dashboard ordering
|
|
150
|
+
sorted_services = dict(sorted(services.items()))
|
|
151
|
+
|
|
152
|
+
response = {
|
|
153
|
+
"services": sorted_services,
|
|
154
|
+
"total_resources": total_resources,
|
|
155
|
+
"uptime_seconds": round(time.time() - _start_time, 1),
|
|
156
|
+
}
|
|
157
|
+
cache.set("stats", response, ttl=5)
|
|
158
|
+
return response
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stackport
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Universal AWS resource browser for local emulators
|
|
5
|
+
Author: Davi Reis Vieira
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/DaviReisVieira/stackport
|
|
8
|
+
Project-URL: Repository, https://github.com/DaviReisVieira/stackport
|
|
9
|
+
Project-URL: Issues, https://github.com/DaviReisVieira/stackport/issues
|
|
10
|
+
Keywords: aws,localstack,s3,browser,devtools,emulator
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Framework :: FastAPI
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Testing
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: fastapi>=0.115.0
|
|
25
|
+
Requires-Dist: uvicorn>=0.30.0
|
|
26
|
+
Requires-Dist: boto3>=1.35.0
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# StackPort
|
|
30
|
+
|
|
31
|
+
[](https://github.com/DaviReisVieira/stackport/actions/workflows/ci.yml)
|
|
32
|
+
[](https://pypi.org/project/stackport/)
|
|
33
|
+
[](https://hub.docker.com/r/davireis/stackport)
|
|
34
|
+
[](https://opensource.org/licenses/MIT)
|
|
35
|
+
|
|
36
|
+
Universal AWS resource browser for local emulators. Works with **LocalStack**, **MiniStack**, **Moto**, or any AWS-compatible endpoint.
|
|
37
|
+
|
|
38
|
+
<!-- TODO: Add screenshot here -->
|
|
39
|
+
<!--  -->
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- Browse and inspect resources across **35 AWS services**
|
|
44
|
+
- S3 file browser with folder navigation, search, pagination, and download
|
|
45
|
+
- Dashboard with service health, resource counts, and auto-refresh
|
|
46
|
+
- Single Docker image, zero AWS dependencies
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
### pip
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install stackport
|
|
54
|
+
AWS_ENDPOINT_URL=http://localhost:4566 stackport
|
|
55
|
+
# Open http://localhost:8080
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Docker
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
docker run -p 8080:8080 -e AWS_ENDPOINT_URL=http://host.docker.internal:4566 davireis/stackport
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Docker Compose
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
curl -O https://raw.githubusercontent.com/DaviReisVieira/stackport/main/docker-compose.yml
|
|
68
|
+
docker compose up -d
|
|
69
|
+
# Open http://localhost:8080
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
| Variable | Default | Description |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `AWS_ENDPOINT_URL` | `http://localhost:4566` | Target AWS endpoint |
|
|
77
|
+
| `AWS_REGION` | `us-east-1` | AWS region |
|
|
78
|
+
| `AWS_ACCESS_KEY_ID` | `test` | AWS access key |
|
|
79
|
+
| `AWS_SECRET_ACCESS_KEY` | `test` | AWS secret key |
|
|
80
|
+
| `STACKPORT_PORT` | `8080` | StackPort server port |
|
|
81
|
+
| `STACKPORT_SERVICES` | *(35 services)* | Comma-separated services to probe |
|
|
82
|
+
|
|
83
|
+
## Supported Services (35)
|
|
84
|
+
|
|
85
|
+
ACM, API Gateway, AppSync, Athena, CloudFormation, CloudFront, Cognito (IDP + Identity), DynamoDB, EC2, ECR, ECS, ElastiCache, EFS, ELB, EMR, EventBridge, Firehose, Glue, IAM, Kinesis, KMS, Lambda, CloudWatch Logs, CloudWatch Monitoring, RDS, Route 53, S3, Secrets Manager, SES, SNS, SQS, SSM, Step Functions, WAFv2
|
|
86
|
+
|
|
87
|
+
S3 has a dedicated file browser. All other services use the generic resource table with detail view.
|
|
88
|
+
|
|
89
|
+
## Development
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/DaviReisVieira/stackport.git
|
|
93
|
+
cd stackport
|
|
94
|
+
pip install -e .
|
|
95
|
+
cd ui && npm install && npm run dev
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for full details.
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
backend/aws_client.py,sha256=rNt-qQqeCy54Hb3gPKxtSuVnDKViGTl8M5fgV63XrpI,526
|
|
3
|
+
backend/cache.py,sha256=6OF0I9cyi7fmfCr5QBrYxvvWGulHDhzOr340Hz9vR6Y,567
|
|
4
|
+
backend/config.py,sha256=YFrWTMHCOhJ5jmg4ytGwoDTtRIHgdpKryxZPe75PGv4,767
|
|
5
|
+
backend/main.py,sha256=peVDdrrK5mVfMX7BuBh2o_qDEMSnVfM8stgF-7g4fiQ,1550
|
|
6
|
+
backend/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
backend/routes/resources.py,sha256=z97_ph8oLYLPWfL1gkhpYzaWDkUiTCAbuNZOhnD45pI,9911
|
|
8
|
+
backend/routes/s3.py,sha256=J1ZpekThENncS1ddi10BasRSRBfti78asjQY-0MVr_g,5259
|
|
9
|
+
backend/routes/stats.py,sha256=_4yhy2Cwk7iv2-356Ci3azm0rswmIGAVaXsRSSUch0Y,6872
|
|
10
|
+
stackport-0.1.0.dist-info/licenses/LICENSE,sha256=58bwgd-mfpDxJnsVLaUd8vpVdhrsufjHNoBv6IMlS5Q,1071
|
|
11
|
+
ui/dist/favicon.png,sha256=0xof-VmBrejR01bF6At7sxsxbQpL_cbhA9XzjFIAaY8,38314
|
|
12
|
+
ui/dist/index.html,sha256=WSoujeiRMoSatVgCRLHbAn3dl5uAwp9vSVakfz4V6bk,452
|
|
13
|
+
ui/dist/assets/index-CRqBg0t6.js,sha256=imUrDe2KAbHRgORYqtJ94xI2KiRU-aIjg0ngjELBWkw,408923
|
|
14
|
+
ui/dist/assets/index-Is3dIbZM.css,sha256=8Cg-AelGUt0uLM4bgXv2uX5iVfpMH7w_s_ubAf3wIV0,25321
|
|
15
|
+
stackport-0.1.0.dist-info/METADATA,sha256=72RzL-l4ku-oPyTBK-p1O5e8c1X0nwtHuGQ73WNTH_M,3585
|
|
16
|
+
stackport-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
17
|
+
stackport-0.1.0.dist-info/entry_points.txt,sha256=T4aCL0UM7BHwKodc8AFp41bhoVfApgbPkjeJz9IwMhI,47
|
|
18
|
+
stackport-0.1.0.dist-info/top_level.txt,sha256=o0r_qMzzBDDtK9APrv2QVcIw9oc00JRmCEsTE2-AFr0,8
|
|
19
|
+
stackport-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 DaviReisVieira
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
backend
|