mirror of
https://github.com/Grace-Solutions/PSMinIO.git
synced 2026-08-23 02:29:04 +00:00
Major update: Enhanced documentation, comprehensive examples, and fixed remaining issues
- Updated README.md with modern feature descriptions and comprehensive overview - Enhanced docs/USAGE.md with advanced object listing, directory management, and chunked operations - Created examples/ directory with 6 comprehensive example scripts: * 01-Basic-Operations.ps1 - Fundamental operations for beginners * 02-Advanced-Object-Listing.ps1 - Filtering, sorting, and pagination * 03-Directory-Management.ps1 - Nested directory structures and organization * 04-Chunked-Operations.ps1 - Large file handling with performance optimization * 05-Bulk-Operations.ps1 - Batch processing and automation workflows * 06-Enterprise-Automation.ps1 - Enterprise monitoring, reporting, and compliance - Added comprehensive examples/README.md with usage patterns and best practices - Fixed directory creation warnings (now clean verbose logging) - Implemented missing Get-MinIOObject cmdlet with full filtering/sorting capabilities - Added timing and performance metrics to all operations - Enhanced chunked operations with multi-layer progress tracking - Improved error handling and resource cleanup - Removed temporary test files and cleaned up repository structure - All examples use proper PowerShell output (no Write-Host usage) - Professional logging with timestamps and structured output
This commit is contained in:
@@ -1,71 +1,154 @@
|
||||
# PSMinIO
|
||||
|
||||
A fully-fledged C# PowerShell binary module built on top of the [Minio](https://www.nuget.org/packages/Minio) .NET SDK for managing MinIO object storage operations.
|
||||
A comprehensive PowerShell module for MinIO object storage operations, built on the official [Minio .NET SDK](https://www.nuget.org/packages/Minio). Provides full-featured object storage management with enterprise-grade capabilities.
|
||||
|
||||
## Features
|
||||
|
||||
- **Cross-Platform Compatibility**: Built for .NET Standard 2.0, compatible with PowerShell 5.1+ and PowerShell 7+
|
||||
- **Comprehensive Bucket Operations**: Create, list, delete, and check bucket existence
|
||||
- **Object Management**: Upload, download, list, and delete objects with progress tracking
|
||||
- **Security & Policy Management**: Manage bucket policies and access controls
|
||||
- **Synchronous Operations**: All operations are synchronous for PowerShell compatibility
|
||||
- **Detailed Logging**: Centralized logging with timestamps when `-Verbose` is specified
|
||||
- **Progress Reporting**: Upload/download progress with percentages and time estimates
|
||||
- **🚀 High Performance**: Built for .NET Standard 2.0, compatible with PowerShell 5.1+ and PowerShell 7+
|
||||
- **📦 Complete Object Management**: Upload, download, list, and delete objects with advanced filtering and sorting
|
||||
- **🗂️ Flexible Directory Support**: Create nested folder structures with automatic directory creation
|
||||
- **⚡ Chunked Operations**: Large file uploads and downloads with resume capability and progress tracking
|
||||
- **🔒 Security & Policy Management**: Comprehensive bucket policy and access control management
|
||||
- **📊 Advanced Object Listing**: Filter by prefix, sort by multiple criteria, limit results, and exclude directories
|
||||
- **⏱️ Timing & Performance Metrics**: Detailed timing information and transfer speed reporting
|
||||
- **🔄 Progress Reporting**: Multi-layer progress tracking for file collections and chunked operations
|
||||
- **📝 Professional Logging**: Clean, timestamped logging with configurable verbosity levels
|
||||
- **🛡️ Robust Error Handling**: Graceful handling of network issues and edge cases
|
||||
|
||||
## Installation
|
||||
|
||||
### From Source
|
||||
```powershell
|
||||
# Clone the repository
|
||||
git clone https://github.com/yourusername/PSMinIO.git
|
||||
cd PSMinIO
|
||||
|
||||
# Build the module
|
||||
dotnet build PSMinIO.csproj --configuration Release
|
||||
|
||||
# Import the module
|
||||
Import-Module .\PSMinIO.psd1
|
||||
Import-Module .\Module\PSMinIO\PSMinIO.psd1
|
||||
```
|
||||
|
||||
### Direct Import
|
||||
```powershell
|
||||
# Import from local path
|
||||
Import-Module .\Module\PSMinIO\PSMinIO.psd1
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
```powershell
|
||||
# Configure connection
|
||||
Set-MinIOConfig -Endpoint 'https://minio.myorg.com' -AccessKey 'AKIA...' -SecretKey 'abc123' -UseSSL
|
||||
# Connect to MinIO server
|
||||
$connection = Connect-MinIO -Endpoint "https://minio.example.com" -AccessKey "your-access-key" -SecretKey "your-secret-key"
|
||||
|
||||
# Create a bucket
|
||||
New-MinIOBucket -BucketName 'my-bucket' -Verbose
|
||||
New-MinIOBucket -BucketName 'my-data-bucket' -Verbose
|
||||
|
||||
# Upload a file
|
||||
New-MinIOObject -BucketName 'my-bucket' -ObjectName 'data.txt' -FilePath 'C:\data.txt'
|
||||
# Upload files with automatic directory creation
|
||||
New-MinIOObject -BucketName 'my-data-bucket' -Files "document.pdf" -BucketDirectory "documents/2025/january"
|
||||
|
||||
# List objects
|
||||
Get-MinIOObject -BucketName 'my-bucket' -Prefix '2025/'
|
||||
# List objects with advanced filtering
|
||||
Get-MinIOObject -BucketName 'my-data-bucket' -Prefix "documents/" -SortBy "Size" -Descending -MaxObjects 10
|
||||
|
||||
# Download an object
|
||||
Get-MinIOObjectContent -BucketName 'my-bucket' -ObjectName 'data.txt' -FilePath 'C:\downloaded-data.txt'
|
||||
# Download with timing information
|
||||
Get-MinIOObjectContent -BucketName 'my-data-bucket' -ObjectName 'documents/2025/january/document.pdf' -FilePath 'C:\Downloads\document.pdf'
|
||||
|
||||
# Chunked upload for large files
|
||||
New-MinIOObjectChunked -BucketName 'my-data-bucket' -Files "large-video.mp4" -ChunkSize 10MB -BucketDirectory "media/videos"
|
||||
```
|
||||
|
||||
## Cmdlets
|
||||
## Available Cmdlets
|
||||
|
||||
### Connection Management
|
||||
- **`Connect-MinIO`** - Establish connection to MinIO server with SSL support and certificate validation options
|
||||
|
||||
### Bucket Operations
|
||||
- `Get-MinIOBucket` - Lists all buckets
|
||||
- `New-MinIOBucket` - Creates a new bucket
|
||||
- `Remove-MinIOBucket` - Deletes a bucket
|
||||
- `Test-MinIOBucketExists` - Checks if a bucket exists
|
||||
- **`Get-MinIOBucket`** - List all buckets with optional statistics
|
||||
- **`New-MinIOBucket`** - Create new buckets with region support
|
||||
- **`Remove-MinIOBucket`** - Delete buckets with safety confirmations
|
||||
- **`Test-MinIOBucketExists`** - Check bucket existence
|
||||
|
||||
### Object Operations
|
||||
- `Get-MinIOObject` - Lists objects in a bucket
|
||||
- `New-MinIOObject` - Uploads a file to a bucket
|
||||
- `Get-MinIOObjectContent` - Downloads an object
|
||||
- `Remove-MinIOObject` - Deletes an object
|
||||
- **`Get-MinIOObject`** - Advanced object listing with filtering, sorting, and pagination
|
||||
- Filter by prefix or exact object name
|
||||
- Sort by Name, Size, LastModified, or ETag (ascending/descending)
|
||||
- Limit results with MaxObjects
|
||||
- Exclude directories with ObjectsOnly
|
||||
- **`New-MinIOObject`** - Upload files with directory support
|
||||
- Single file or multiple file uploads
|
||||
- Automatic nested directory creation
|
||||
- Progress tracking and timing information
|
||||
- **`New-MinIOObjectChunked`** - Chunked uploads for large files
|
||||
- Configurable chunk sizes (1MB minimum)
|
||||
- Resume capability and multi-layer progress tracking
|
||||
- Automatic directory creation
|
||||
- **`Get-MinIOObjectContent`** - Download objects with progress tracking
|
||||
- **`Get-MinIOObjectContentChunked`** - Chunked downloads for large files
|
||||
- **`Remove-MinIOObject`** - Delete objects with confirmation prompts
|
||||
- **`New-MinIOFolder`** - Create folder structures in buckets
|
||||
|
||||
### Security & Policy
|
||||
- `Get-MinIOBucketPolicy` - Retrieves bucket policy
|
||||
- `Set-MinIOBucketPolicy` - Sets bucket policy
|
||||
### Security & Policy Management
|
||||
- **`Get-MinIOBucketPolicy`** - Retrieve bucket access policies
|
||||
- **`Set-MinIOBucketPolicy`** - Configure bucket access policies
|
||||
|
||||
### Utility
|
||||
- `Get-MinIOConfig` - Shows current configuration
|
||||
- `Set-MinIOConfig` - Sets connection configuration
|
||||
- `Get-MinIOStats` - Displays statistics and metrics
|
||||
### Monitoring & Statistics
|
||||
- **`Get-MinIOStats`** - Comprehensive server and bucket statistics with object counting limits
|
||||
|
||||
## Key Features in Detail
|
||||
|
||||
### 🗂️ Advanced Directory Support
|
||||
- **Nested Folder Creation**: Automatically create multi-level directory structures (e.g., `documents/2025/january/reports`)
|
||||
- **BucketDirectory Parameter**: Specify target directories for uploads without manual folder creation
|
||||
- **Clean Directory Handling**: Non-critical directory creation attempts with graceful fallback
|
||||
|
||||
### ⚡ Chunked Operations
|
||||
- **Large File Support**: Handle files of any size with configurable chunk sizes
|
||||
- **Resume Capability**: Interrupted transfers can be resumed (future enhancement)
|
||||
- **Multi-Layer Progress**: Track collection progress, file progress, and chunk progress simultaneously
|
||||
- **Performance Optimization**: Optimal chunk sizes for different network conditions
|
||||
|
||||
### 📊 Enhanced Object Listing
|
||||
```powershell
|
||||
# Advanced filtering and sorting examples
|
||||
Get-MinIOObject -BucketName "data" -Prefix "logs/" -SortBy "LastModified" -Descending -MaxObjects 50
|
||||
Get-MinIOObject -BucketName "media" -ObjectsOnly -SortBy "Size" -Descending
|
||||
Get-MinIOObject -BucketName "docs" -ObjectName "specific-file.pdf"
|
||||
```
|
||||
|
||||
### ⏱️ Performance Metrics
|
||||
All operations provide detailed timing information:
|
||||
- **Duration**: Precise operation timing
|
||||
- **Transfer Speed**: Formatted speed reporting (B/s, KB/s, MB/s, GB/s, TB/s)
|
||||
- **Progress Tracking**: Real-time progress updates during transfers
|
||||
|
||||
## Examples
|
||||
|
||||
See the [examples](./examples/) directory for comprehensive usage examples:
|
||||
- **Basic Operations**: Connection, bucket management, simple uploads/downloads
|
||||
- **Advanced Scenarios**: Chunked transfers, directory management, bulk operations
|
||||
- **Enterprise Patterns**: Policy management, monitoring, and automation scripts
|
||||
|
||||
## Requirements
|
||||
|
||||
- PowerShell 5.1+ or PowerShell 7+
|
||||
- .NET Framework 4.7.2+ (for PowerShell 5.1) or .NET Core/.NET 5+ (for PowerShell 7+)
|
||||
- **PowerShell**: 5.1+ or PowerShell 7+
|
||||
- **.NET Framework**: 4.7.2+ (for PowerShell 5.1) or .NET Core/.NET 5+ (for PowerShell 7+)
|
||||
- **MinIO Server**: Compatible with MinIO and Amazon S3 APIs
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
||||
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
||||
4. Push to the branch (`git push origin feature/amazing-feature`)
|
||||
5. Open a Pull Request
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
||||
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## Support
|
||||
|
||||
- 📖 **Documentation**: See [docs/USAGE.md](docs/USAGE.md) for detailed usage instructions
|
||||
- 🐛 **Issues**: Report bugs and request features via GitHub Issues
|
||||
- 💬 **Discussions**: Join the community discussions for questions and tips
|
||||
Reference in New Issue
Block a user