Metadata-Version: 2.2
Name: cloud-storage-manager
Version: 0.1.1
Summary: A unified interface for AWS S3 and Google Cloud Storage operations
Home-page: https://github.com/10XScale-in/cloud-storage-manager
Author: MUTHARASU
Author-email: MUTHARASU A <mutharasu39@gmail.com>
License: MIT License  
        
        Copyright (c) 2024 10xscale.ai  
        
        Permission is hereby granted, free of charge, to any person obtaining a copy  
        of this software and associated documentation files (the “Software”), to deal  
        in the Software without restriction, including without limitation the rights  
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
        copies of the Software, and to permit persons to whom the Software is furnished  
        to do so, subject to the following conditions:  
        
        The above copyright notice and this permission notice shall be included in all  
        copies or substantial portions of the Software.  
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  
        THE SOFTWARE.
        
Project-URL: Homepage, https://github.com/10XScale-in/cloud-storage-manager
Project-URL: Bug Tracker, https://github.com/10XScale-in/cloud-storage-manager/issues
Keywords: aws,s3,gcp,cloud storage,file upload,async
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
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: Framework :: AsyncIO
Classifier: Topic :: Internet :: File Transfer Protocol (FTP)
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aioboto3>=11.0.0
Requires-Dist: google-cloud-storage>=2.0.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.20.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: isort>=5.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"

# Cloud Storage Manager

A Python package for seamlessly managing file uploads across AWS S3 and Google Cloud Storage platforms.

## Features

- Unified interface for AWS S3 and Google Cloud Storage
- Async operations support
- Pre-signed URL generation
- Easy file upload and deletion
- Type-safe configuration using Pydantic
- Comprehensive error handling
- Logging support

## Installation

```bash
pip install cloud-storage-manager
```

## Quick Start

### AWS S3 Example

```python
import asyncio
from cloud_storage_manager import CloudStorageFactory, StorageProvider, StorageConfig, AwsConfig

async def main():
    # Configure AWS
    config = StorageConfig(
        aws=AwsConfig(
            bucket_name="my-bucket",
            access_key_id="your-access-key",
            secret_access_key="your-secret-key",
            region="us-east-1"  # optional, defaults to us-east-1
        )
    )
    
    # Create storage client
    storage = CloudStorageFactory.get_storage(StorageProvider.AWS, config)
    
    # Upload file
    cloud_path = await storage.upload("local/path/file.txt", "remote/path/file.txt")
    
    # Generate temporary URL
    url = await storage.get_public_url(cloud_path, expiration=3600)  # 1 hour expiration
    
    # Delete file
    success = await storage.delete(cloud_path)

asyncio.run(main())
```

### Google Cloud Storage Example

```python
import asyncio
from cloud_storage_manager import CloudStorageFactory, StorageProvider, StorageConfig, GcpConfig

async def main():
    # Configure GCP
    config = StorageConfig(
        gcp=GcpConfig(
            bucket_name="my-bucket",
            project_id="your-project-id",
            credentials={
                # Your service account credentials dictionary
            }
        )
    )
    
    # Create storage client
    storage = CloudStorageFactory.get_storage(StorageProvider.GCP, config)
    
    # Upload file
    cloud_path = await storage.upload("local/path/file.txt", "remote/path/file.txt")
    
    # Generate temporary URL
    url = await storage.get_public_url(cloud_path, expiration=3600)  # 1 hour expiration
    
    # Delete file
    success = await storage.delete(cloud_path)

asyncio.run(main())
```

## Error Handling

The package provides specific exceptions for different types of errors:

```python
from cloud_storage_manager import UploadError, DeleteError, DownloadError

try:
    await storage.upload("file.txt", "remote/file.txt")
except UploadError as e:
    print(f"Upload failed: {e}")
```

## Configuration

### AWS Configuration
- `bucket_name`: Name of your S3 bucket
- `access_key_id`: AWS access key ID
- `secret_access_key`: AWS secret access key
- `region`: AWS region (optional, defaults to us-east-1)

### GCP Configuration
- `bucket_name`: Name of your GCP bucket
- `project_id`: Your GCP project ID
- `credentials`: Service account credentials dictionary

## Development

To contribute to the project:

```bash
# Clone the repository
git clone https://github.com/yourusername/cloud-storage-manager.git

# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
