s3box

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

README

s3box

Tools and code snippets for S3 and S3 compatible storage services, such as Ceph RGW.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurlGen

func CurlGen(conf *aws.Config, method, url, body, md5 string, bodyType BodyType) string

CurlGen generate curl command to send s3 v2 request in terminal. It does not support ipv6 address, upload/download objects. The argument body should be an empty/json/xml string, url should be path style

Types

type BodyType

type BodyType int
const (
	NoBody BodyType = iota
	JSONBody
	XMLBody
	BinaryBody
)

type BoxClient

type BoxClient struct {
	// contains filtered or unexported fields
}

func NewBoxClient

func NewBoxClient(svc *s3.S3, httpClient *http.Client) *BoxClient

func (*BoxClient) PostObject

func (bc *BoxClient) PostObject(bucketName, objKey, date, encodedPolicy, region, filePath string, fields map[string]string) (*http.Response, error)

PostObject use form to upload object, fields should include all the necessary and optional fields except for x-amz-signature

type BucketCleaner

type BucketCleaner struct {
	// contains filtered or unexported fields
}

TODO modify print of result and error

func NewBucketCleaner

func NewBucketCleaner(svc *s3.S3) *BucketCleaner

func (*BucketCleaner) DeleteAllBuckets

func (c *BucketCleaner) DeleteAllBuckets(containedStr string) error

DeleteAllBuckets delete all buckets or all buckets contain a specified string of a user

func (*BucketCleaner) EmptyBucket

func (c *BucketCleaner) EmptyBucket(bucketName string, deleteWorkerNum, objChanCap int, multiDel, deleteBucket bool) error

EmptyBucket is to empty objects in the bucket concurrently. objChanCap is the capacity of channel to store the objects from listObjs multiDel decides whether to delete multiple objects in a request

type Signer

type Signer struct {
	Time        time.Time
	Credentials *credentials.Credentials
	Debug       aws.LogLevelType
	Logger      aws.Logger

	Query url.Values
	// contains filtered or unexported fields
}

func NewSigner

func NewSigner(config aws.Config, time time.Time) *Signer

NewSigner returns a Signer pointer configured with the aws.Config and time.Time

func (*Signer) Sign

func (v2 *Signer) Sign(r *http.Request) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL