Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions exosphere-runtimes/cloud-storage-runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual Environment
venv/
env/
ENV/
.env
.venv/

# IDE
.vscode/
*.swp
*.swo
.idea/
*.iws
*.iml
*.ipr


# Local development
.env.local
.env.development.local
.env.test.local
.env.production.local

# Database
*.db
*.sqlite3

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

#logs
*.log
logs/*.*
!logs/.gitkeep

# local files
files/
!files/.gitkeep
1 change: 1 addition & 0 deletions exosphere-runtimes/cloud-storage-runtime/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
Empty file.
14 changes: 14 additions & 0 deletions exosphere-runtimes/cloud-storage-runtime/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from dotenv import load_dotenv
from exospherehost import Runtime
from nodes.list_s3_files import ListS3FilesNode

# Load environment variables from .env file
# EXOSPHERE_STATE_MANAGER_URI is the URI of the state manager
# EXOSPHERE_API_KEY is the key of the runtime
load_dotenv()

Runtime(
name="cloud-storage-runtime",
namespace="exospherehost",
nodes=[ListS3FilesNode]
).start()
Empty file.
39 changes: 39 additions & 0 deletions exosphere-runtimes/cloud-storage-runtime/nodes/list_s3_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import boto3
import os

from exospherehost import BaseNode
from typing import List
from pydantic import BaseModel


class ListS3FilesNode(BaseNode):

class Inputs(BaseModel):
bucket_name: str
prefix: str = ''
files_only: bool = False
recursive: bool = False

class Outputs(BaseModel):
key: str

class Secrets(BaseModel):
aws_access_key_id: str = os.getenv("S3_ACCESS_KEY_ID")
aws_secret_access_key: str = os.getenv("S3_SECRET_ACCESS_KEY")
aws_region: str = os.getenv("S3_REGION")

async def execute(self) -> List[Outputs]:
print(self.inputs)

s3_client = boto3.client(
's3',
aws_access_key_id=os.getenv("S3_ACCESS_KEY_ID"),
aws_secret_access_key=os.getenv("S3_SECRET_ACCESS_KEY"),
region_name=os.getenv("S3_REGION")
)
response = s3_client.list_objects_v2(Bucket=self.inputs.bucket_name, Prefix=self.inputs.prefix)

return [
self.Outputs(key=data['Key'])
for data in response['Contents']
]
10 changes: 10 additions & 0 deletions exosphere-runtimes/cloud-storage-runtime/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[project]
name = "cloud-storage-runtime"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"boto3>=1.40.1",
"python-dotenv>=1.1.1",
]
106 changes: 106 additions & 0 deletions exosphere-runtimes/cloud-storage-runtime/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading