Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s3: Force a prefix removal using a special header #12504

Merged
merged 2 commits into from
Jun 16, 2021

Conversation

vadmeste
Copy link
Member

Description

An S3 client can send x-minio-force-delete to remove a prefix.

Motivation and Context

Help the user to quickly remove a prefix, this is a MinIO extension

How to test this PR?

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#!/usr/bin/env python3

def remove_prefix(self, bucket, prefix):
    if bucket is None or bucket == "":
        raise Exception('bucket name is invalid')
    if prefix is None or prefix == "":
        raise Exception('prefix name is invalid')
    self._execute('DELETE', bucket, prefix, headers={'x-minio-force-delete': 'true'})

from minio import Minio
setattr(Minio, "remove_prefix", remove_prefix)

minioClient = Minio(
        'localhost:9000',
        access_key='minio',
        secret_key='minio123',
        secure=False
        )

minioClient.remove_prefix('testbucket', 'prefix/')

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (If yes, please add commit-id or PR # here)
  • Documentation updated
  • Unit tests added/updated

An S3 client can send x-minio-force-delete to remove a prefix.
cmd/erasure-object.go Outdated Show resolved Hide resolved
cmd/erasure-object.go Outdated Show resolved Hide resolved
Co-authored-by: Harshavardhana <harsha@minio.io>
@minio-trusted
Copy link
Contributor

Mint Automation

Test Result
mint-large-bucket.sh ✔️
mint-fs.sh ✔️
mint-gateway-s3.sh ✔️
mint-erasure.sh ✔️
mint-dist-erasure.sh ✔️
mint-zoned.sh ✔️
mint-gateway-nas.sh ✔️
mint-compress-encrypt-dist-erasure.sh ✔️
Deleting image on docker hub
Deleting image locally

@harshavardhana harshavardhana merged commit 7722b91 into minio:master Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants