Metadata-Version: 2.1
Name: cloudweave
Version: 1.0.0
Summary: A unified, authenticated multi-cloud utility package
Home-page: https://github.com/macbee280/cloudweavw
Author: Gabe DiMartino
Author-email: gdimartino@gabedimartino.com
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.0.0
Requires-Dist: typing-extensions>=4.0.0
Requires-Dist: boto3>=1.26.0
Requires-Dist: botocore>=1.29.0
Requires-Dist: mypy_boto3_ecs
Requires-Dist: mypy_boto3_ec2
Requires-Dist: mypy_boto3_autoscaling
Requires-Dist: mypy_boto3_dynamodb
Requires-Dist: mypy_boto3_sqs
Requires-Dist: mypy_boto3_s3
Requires-Dist: mypy_boto3_secretsmanager
Requires-Dist: mypy_boto3_ses
Requires-Dist: mypy_boto3_logs
Requires-Dist: mypy_boto3_cloudwatch
Requires-Dist: firebase-admin>=6.0.0
Requires-Dist: google-cloud-firestore>=2.10.0
Requires-Dist: google-auth
Requires-Dist: google-cloud-storage
Requires-Dist: google-cloud-bigquery
Requires-Dist: google-cloud-pubsub
Requires-Dist: google-cloud-datastore
Requires-Dist: google-cloud-spanner
Requires-Dist: google-cloud-translate
Requires-Dist: google-cloud-logging
Requires-Dist: google-cloud-vision
Requires-Dist: google-cloud-language
Requires-Dist: google-cloud-secret-manager
Requires-Dist: google-cloud-monitoring
Requires-Dist: pymongo>=4.3.0
Requires-Dist: uuid>=1.30.0

# MultiCloud Utils

A unified, authenticated multi-cloud utility package for seamless integration with various cloud providers.

## Overview

MultiCloud Utils provides a simple, secure interface for working with multiple cloud services through a single authentication point. This package streamlines access to databases, storage, logging, and notification services across AWS, GCP, and other cloud providers.

## Features

- **Single Authentication Point**: Access all cloud services through one authenticated manager
- **Cross-Cloud Support**: Work with multiple cloud providers using consistent interfaces
- **Modular Components**:
  - Database (DynamoDB, Firestore, MongoDB)
  - Storage (S3, GCS)
  - Logging (Local, CloudWatch, GCP Logging, Loki)
  - Notifications (Email via AWS SES, Google Gmail)
- **Secure Access Control**: API key-based authentication for all package functionality
- **Extensible Design**: Easily add support for additional cloud services

## Installation

```bash
pip install multicloud_utils
```

For specific cloud provider support:

```bash
pip install multicloud_utils[aws]  # AWS-specific dependencies
pip install multicloud_utils[gcp]  # GCP-specific dependencies
pip install multicloud_utils[mongodb]  # MongoDB-specific dependencies
pip install multicloud_utils[aws,gcp]  # Multiple providers
```

## Quick Start

```python
from multicloud_utils import get_auth_manager, DatabaseType, StorageType, LoggerType

# Initialize with your API key
auth = get_auth_manager("your-secret-api-key")

# Get a logger
logger = auth.get_logger(
    logger_type=LoggerType.LOCAL,
    namespace="my_app",
    log_level="info"
)

# Get a database
db = auth.get_database(
    db_type=DatabaseType.FIRESTORE,
    namespace="my_app",
    project_id="my-gcp-project"
)

# Get a storage instance
storage = auth.get_storage(
    storage_type=StorageType.S3,
    namespace="my_app",
    region="us-east-1",
    default_bucket="my-bucket"
)

# Log something
logger.info("Application started")

# Use the storage
storage.upload_file("local_file.txt", None, "destination_path/file.txt")

# Use the database with Pydantic models
from pydantic import BaseModel

class User(BaseModel):
    id: str = None
    name: str
    email: str

# Register model
db.register_model(User, "users")

# Create a user
user = User(name="Test User", email="test@example.com")
user_id = db.put_item(user)
```

## Components

### Authentication Manager

The central gateway to all package functionality:

```python
# Initialize
auth = get_auth_manager("your-secret-api-key")

# Alternative quick init
from multicloud_utils import init_auth
auth = init_auth("your-secret-api-key")
```

### Database

Support for multiple database backends with a unified interface:

```python
# Get Firestore instance
firestore_db = auth.get_database(
    db_type=DatabaseType.FIRESTORE,
    namespace="my_app",
    project_id="my-gcp-project"
)

# Get DynamoDB instance
dynamo_db = auth.get_database(
    db_type=DatabaseType.DYNAMODB,
    namespace="my_app",
    opt={"region": "us-east-1"}
)

# Get MongoDB instance
mongo_db = auth.get_database(
    db_type=DatabaseType.MONGODB,
    namespace="my_app",
    connection_string="mongodb://localhost:27017/",
    database_name="myapp"
)
```

### Storage

Unified interface for cloud storage services:

```python
# Get S3 storage
s3 = auth.get_storage(
    storage_type=StorageType.S3,
    namespace="my_app",
    region="us-east-1",
    default_bucket="my-bucket"
)

# Get GCS storage
gcs = auth.get_storage(
    storage_type=StorageType.GCS,
    namespace="my_app",
    project_id="my-gcp-project",
    default_bucket="my-gcs-bucket"
)

# Storage operations
s3.upload_file("local_file.txt", None, "path/in/bucket.txt")
s3.download_file(None, "path/in/bucket.txt", "local_destination.txt")
content = s3.read_file(None, "path/in/bucket.txt")
```

### Logging

Multi-destination logging with a consistent interface:

```python
# Local logging
local_logger = auth.get_logger(
    logger_type=LoggerType.LOCAL,
    namespace="my_app",
    log_level="info",
    log_file="app.log"
)

# AWS CloudWatch logging
aws_logger = auth.get_logger(
    logger_type=LoggerType.AWS,
    namespace="my_app",
    region="us-east-1",
    dimensions={"Service": "API"}
)

# GCP Cloud Logging
gcp_logger = auth.get_logger(
    logger_type=LoggerType.GCP,
    namespace="my_app",
    project_id="my-gcp-project"
)

# Log messages
local_logger.info("Application started")
local_logger.error("Something went wrong", {"path": "/api/users", "status": 500})
```

### Notifications

Email notifications with template support:

```python
# Get notification manager
notifier = auth.get_notification_manager(
    default_provider="aws",
    aws_options={
        "region": "us-east-1",
        "sender_email": "no-reply@example.com"
    }
)

# Send an email
notifier.send_email(
    recipient="user@example.com",
    subject="Welcome to Our Service",
    body="Hello! Thanks for signing up."
)

# Send with HTML template from storage
notifier.send_email(
    recipient="user@example.com",
    subject="Your Report is Ready",
    body={
        "template": {
            "storage_type": "s3",
            "bucket": "email-templates",
            "path": "welcome-email.html"
        }
    },
    options={
        "template_variables": {
            "user_name": "John Doe",
            "company_name": "Example Inc."
        }
    }
)
```

## Development

### Running Tests

```bash
# Test Firestore functionality
python tests/test_firestore.py --api-key "your-secret-api-key" --credentials "path/to/credentials.json"

# Test DynamoDB functionality
python tests/test_dynamodb.py --api-key "your-secret-api-key" --region "us-east-1"

# Test storage functionality
python tests/test_storage.py --api-key "your-secret-api-key" --storage-type "s3" --bucket "my-bucket" --source-path "test.txt" --local-path "downloaded.txt"
```

## License

MIT License

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## Contact

Gabe DiMartino - gdimartino@gabedimartino.com

Project Link: [https://github.com/macbee280/multicloud_utils](https://github.com/macbee280/multicloud_utils)
