Skip to main content

A command-line tool for interacting with MinIO.

Project description

OSS Tool: MinIO File Management CLI

Overview

The 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:
{
    "endpoint": "xxxx:xxx",
    "access_key": "xx",
    "secret_key": "xx",
    "secure": false
}

Installation

pip install dguard_oss

Usage

The CLI offers the following commands:

General Syntax

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
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:

    oss upload ./example.txt
    
  • Upload a file to a specific bucket with the same file name:

    oss upload ./example.txt my_bucket
    
  • Upload a file to a specific bucket with a custom object name:

    oss upload ./example.txt my_bucket custom_name.txt
    
  • Upload a file and force bucket creation:

    oss upload ./example.txt my_bucket -y
    

2. Download Files

Downloads a file from a bucket in MinIO to the local system.

Syntax
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:

    oss download example.txt ./local_example.txt
    
  • Download a file from a specific bucket:

    oss download my_bucket example.txt ./local_example.txt
    

3. Help

Displays detailed help information about the CLI.

Syntax
oss help
Example
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:

    oss upload ./data.txt
    
  2. Uploading with automatic bucket creation:

    oss upload ./data.txt new_bucket -y
    

Download Example

  1. Downloading a file from the default bucket:

    oss download data.txt ./local_data.txt
    
  2. Downloading from a specific bucket:

    oss download my_bucket data.txt ./local_data.txt
    

Help

oss help

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dguard_oss-0.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dguard_oss-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file dguard_oss-0.0.1.tar.gz.

File metadata

  • Download URL: dguard_oss-0.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.7

File hashes

Hashes for dguard_oss-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9a61255687e7dfc617c753775d4e2f2939dd7ddae9594a56743ed66b315ecc1a
MD5 9843d796a9dba4e8a7449a3f2fcc3e3a
BLAKE2b-256 4fee3c67718c3823f526271294e420f66bc39393174ac70fcb0d1a206b076184

See more details on using hashes here.

File details

Details for the file dguard_oss-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: dguard_oss-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.7

File hashes

Hashes for dguard_oss-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 153e8eb7cc929d721d4916ab02f22061a163878adbc9ca7ea5360a9e453adbe2
MD5 d56e5f6050dea25416ad3753599b72a6
BLAKE2b-256 d735a41a946f6f4b367a274537bc8b4bbb51bbd8d3f548f4eacb70ab15cbf557

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page