# Dguard OSS Tool: MinIO File Management CLI
## Overview
The Dguard OSS Tool is a command-line interface (CLI) utility for managing file uploads and downloads with a MinIO object storage server. It simplifies the process of uploading files, downloading objects, and handling bucket operations with user-friendly defaults and optional automation features.
---
## Features
- Upload files to a specified or default bucket in MinIO.
- Download objects from a specified bucket in MinIO.
- Automatically create buckets if they do not exist (interactive or forced mode).
- Default settings for frequently used operations.
- Detailed help and usage examples.
---
## Prerequisites
1. **Python**: Ensure Python 3.7 or higher is installed on your system.
2. **MinIO Server**: Access to a MinIO server with proper credentials.
3. **Configuration File**: Create a configuration file `config.json` in the `~/.dguard_oss` directory with the following structure:
```json
{
"endpoint": "xxxx:xxx",
"access_key": "xx",
"secret_key": "xx",
"secure": false
}
```
---
## Installation
```bash
pip install dguard_oss
```
---
## Usage
The CLI offers the following commands:
### General Syntax
```bash
oss <command> [arguments] [options]
```
### Commands
#### 1. **Upload Files**
Uploads a file to a bucket in MinIO. If the bucket does not exist, the tool can create it interactively or automatically with the `-y` option.
##### Syntax
```bash
oss upload <file_path> [bucket] [object_name] [-y] [--id=<config_id>]
```
##### Parameters
- `file_path` (required): Path to the file to be uploaded.
- `bucket` (optional): Target bucket name. Defaults to `temp`.
- `object_name` (optional): Name for the object in the bucket. Defaults to the file name.
- `-y` (optional): Automatically creates the bucket if it does not exist.
- `--id` (optional): Configuration ID to use (default: `config`).
##### Examples
- Upload a file to the default bucket:
```bash
oss upload ./example.txt
```
- Upload a file to a specific bucket with the same file name:
```bash
oss upload ./example.txt my_bucket
```
- Upload a file to a specific bucket with a custom object name:
```bash
oss upload ./example.txt my_bucket custom_name.txt
```
- Upload a file and force bucket creation:
```bash
oss upload ./example.txt my_bucket -y
```
#### 2. **Download Files**
Downloads a file from a bucket in MinIO to the local system.
##### Syntax
```bash
oss download [bucket] <object_name> <save_path> [--id=<config_id>]
```
##### Parameters
- `bucket` (optional): Source bucket name. Defaults to `temp`.
- `object_name` (required): Name of the object in the bucket to download.
- `save_path` (required): Path to save the downloaded file locally.
- `--id` (optional): Configuration ID to use (default: `config`).
##### Examples
- Download a file from the default bucket:
```bash
oss download example.txt ./local_example.txt
```
- Download a file from a specific bucket:
```bash
oss download my_bucket example.txt ./local_example.txt
```
#### 3. **Help**
Displays detailed help information about the CLI.
##### Syntax
```bash
oss help
```
##### Example
```bash
oss help
```
---
## Workflow Details
1. **Upload Workflow**:
- If the target bucket does not exist, the tool will prompt the user to create it.
- The `-y` option skips prompts and automatically creates the bucket.
- The object name defaults to the file name if not specified.
2. **Download Workflow**:
- Ensures the specified object and bucket exist before attempting to download.
- Saves the object locally at the specified `save_path`.
---
## Error Handling
- Invalid arguments or missing required parameters will result in an error message and display the help information.
- Bucket or object access errors are captured and reported with detailed messages.
---
## Examples
### Upload Example
1. Uploading a file to the default bucket:
```bash
oss upload ./data.txt
```
2. Uploading with automatic bucket creation:
```bash
oss upload ./data.txt new_bucket -y
```
### Download Example
1. Downloading a file from the default bucket:
```bash
oss download data.txt ./local_data.txt
```
2. Downloading from a specific bucket:
```bash
oss download my_bucket data.txt ./local_data.txt
```
### Help
```bash
oss help
```
---
## License
This project is licensed under the MIT License. See the `LICENSE` file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/nuaazs/dguard_oss",
"name": "dguard-oss",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Zhao Sheng",
"author_email": "zhaosheng@lyxxkj.com.cn",
"download_url": "https://files.pythonhosted.org/packages/15/15/8a985e50eb0f294aa3c7d2c62d1b971a7ce08d8ffb394fa11edb7977ded9/dguard_oss-0.1.2.tar.gz",
"platform": null,
"description": "# Dguard OSS Tool: MinIO File Management CLI\n\n## Overview\nThe Dguard OSS Tool is a command-line interface (CLI) utility for managing file uploads and downloads with a MinIO object storage server. It simplifies the process of uploading files, downloading objects, and handling bucket operations with user-friendly defaults and optional automation features.\n\n---\n\n## Features\n- Upload files to a specified or default bucket in MinIO.\n- Download objects from a specified bucket in MinIO.\n- Automatically create buckets if they do not exist (interactive or forced mode).\n- Default settings for frequently used operations.\n- Detailed help and usage examples.\n\n---\n\n## Prerequisites\n1. **Python**: Ensure Python 3.7 or higher is installed on your system.\n2. **MinIO Server**: Access to a MinIO server with proper credentials.\n3. **Configuration File**: Create a configuration file `config.json` in the `~/.dguard_oss` directory with the following structure:\n```json\n{\n \"endpoint\": \"xxxx:xxx\",\n \"access_key\": \"xx\",\n \"secret_key\": \"xx\",\n \"secure\": false\n}\n```\n\n---\n\n## Installation\n```bash\npip install dguard_oss\n```\n\n---\n\n## Usage\nThe CLI offers the following commands:\n\n### General Syntax\n```bash\noss <command> [arguments] [options]\n```\n\n### Commands\n\n#### 1. **Upload Files**\nUploads a file to a bucket in MinIO. If the bucket does not exist, the tool can create it interactively or automatically with the `-y` option.\n\n##### Syntax\n```bash\noss upload <file_path> [bucket] [object_name] [-y] [--id=<config_id>]\n```\n\n##### Parameters\n- `file_path` (required): Path to the file to be uploaded.\n- `bucket` (optional): Target bucket name. Defaults to `temp`.\n- `object_name` (optional): Name for the object in the bucket. Defaults to the file name.\n- `-y` (optional): Automatically creates the bucket if it does not exist.\n- `--id` (optional): Configuration ID to use (default: `config`).\n\n##### Examples\n- Upload a file to the default bucket:\n ```bash\n oss upload ./example.txt\n ```\n\n- Upload a file to a specific bucket with the same file name:\n ```bash\n oss upload ./example.txt my_bucket\n ```\n\n- Upload a file to a specific bucket with a custom object name:\n ```bash\n oss upload ./example.txt my_bucket custom_name.txt\n ```\n\n- Upload a file and force bucket creation:\n ```bash\n oss upload ./example.txt my_bucket -y\n ```\n\n#### 2. **Download Files**\nDownloads a file from a bucket in MinIO to the local system.\n\n##### Syntax\n```bash\noss download [bucket] <object_name> <save_path> [--id=<config_id>]\n```\n\n##### Parameters\n- `bucket` (optional): Source bucket name. Defaults to `temp`.\n- `object_name` (required): Name of the object in the bucket to download.\n- `save_path` (required): Path to save the downloaded file locally.\n- `--id` (optional): Configuration ID to use (default: `config`).\n\n##### Examples\n- Download a file from the default bucket:\n ```bash\n oss download example.txt ./local_example.txt\n ```\n\n- Download a file from a specific bucket:\n ```bash\n oss download my_bucket example.txt ./local_example.txt\n ```\n\n#### 3. **Help**\nDisplays detailed help information about the CLI.\n\n##### Syntax\n```bash\noss help\n```\n\n##### Example\n```bash\noss help\n```\n\n---\n\n## Workflow Details\n1. **Upload Workflow**:\n - If the target bucket does not exist, the tool will prompt the user to create it.\n - The `-y` option skips prompts and automatically creates the bucket.\n - The object name defaults to the file name if not specified.\n\n2. **Download Workflow**:\n - Ensures the specified object and bucket exist before attempting to download.\n - Saves the object locally at the specified `save_path`.\n\n---\n\n## Error Handling\n- Invalid arguments or missing required parameters will result in an error message and display the help information.\n- Bucket or object access errors are captured and reported with detailed messages.\n\n---\n\n## Examples\n\n### Upload Example\n1. Uploading a file to the default bucket:\n ```bash\n oss upload ./data.txt\n ```\n\n2. Uploading with automatic bucket creation:\n ```bash\n oss upload ./data.txt new_bucket -y\n ```\n\n### Download Example\n1. Downloading a file from the default bucket:\n ```bash\n oss download data.txt ./local_data.txt\n ```\n\n2. Downloading from a specific bucket:\n ```bash\n oss download my_bucket data.txt ./local_data.txt\n ```\n\n### Help\n```bash\noss help\n```\n\n---\n\n## License\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A command-line tool for interacting with MinIO.",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/nuaazs/dguard_oss"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d280b1f211c67da6a791b4bb9e234b9c7b94a565d30f83d9cd712746b480ad7b",
"md5": "c5a50aff66a068f9b33336e550573939",
"sha256": "bfde18cba7a1f7087ae93fcf8714d26cb5423d62828b6503a0c3432cdd96d0d6"
},
"downloads": -1,
"filename": "dguard_oss-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c5a50aff66a068f9b33336e550573939",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 5925,
"upload_time": "2024-12-12T02:24:59",
"upload_time_iso_8601": "2024-12-12T02:24:59.389189Z",
"url": "https://files.pythonhosted.org/packages/d2/80/b1f211c67da6a791b4bb9e234b9c7b94a565d30f83d9cd712746b480ad7b/dguard_oss-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "15158a985e50eb0f294aa3c7d2c62d1b971a7ce08d8ffb394fa11edb7977ded9",
"md5": "4c71421cb580652d7025726174777d3b",
"sha256": "643c7c2d2b340d78772f87b48db4a801a37003b41a885ce6e21ea9dfa29a4e36"
},
"downloads": -1,
"filename": "dguard_oss-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "4c71421cb580652d7025726174777d3b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5293,
"upload_time": "2024-12-12T02:25:04",
"upload_time_iso_8601": "2024-12-12T02:25:04.185666Z",
"url": "https://files.pythonhosted.org/packages/15/15/8a985e50eb0f294aa3c7d2c62d1b971a7ce08d8ffb394fa11edb7977ded9/dguard_oss-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-12 02:25:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nuaazs",
"github_project": "dguard_oss",
"github_not_found": true,
"lcname": "dguard-oss"
}