mirror of
https://github.com/restic/restic.git
synced 2026-01-21 06:14:38 -05:00
| .. | ||
| examples | ||
| api-definitions.go | ||
| api-error-response.go | ||
| api-get-object-file.go | ||
| api-get.go | ||
| api-list.go | ||
| api-presigned.go | ||
| api-put-bucket.go | ||
| api-put-object-common.go | ||
| api-put-object-file.go | ||
| api-put-object-multipart.go | ||
| api-put-object-progress.go | ||
| api-put-object-readat.go | ||
| api-put-object.go | ||
| api-remove.go | ||
| api-s3-definitions.go | ||
| api-stat.go | ||
| api.go | ||
| api_functional_v2_test.go | ||
| api_functional_v4_test.go | ||
| api_unit_test.go | ||
| appveyor.yml | ||
| bucket-acl.go | ||
| bucket-cache.go | ||
| constants.go | ||
| CONTRIBUTING.md | ||
| hook-reader.go | ||
| INSTALLGO.md | ||
| LICENSE | ||
| MAINTAINERS.md | ||
| post-policy.go | ||
| README.md | ||
| request-signature-v2.go | ||
| request-signature-v4.go | ||
| s3-endpoints.go | ||
| signature-type.go | ||
| tempfile.go | ||
| utils.go | ||
Minio Go Library for Amazon S3 Compatible Cloud Storage 
Description
Minio Go library is a simple client library for S3 compatible cloud storage servers. Supports AWS Signature Version 4 and 2. AWS Signature Version 4 is chosen as default.
List of supported cloud storage providers.
-
AWS Signature Version 4
- Amazon S3
- Minio
-
AWS Signature Version 2
- Google Cloud Storage (Compatibility Mode)
- Openstack Swift + Swift3 middleware
- Ceph Object Gateway
- Riak CS
Install
If you do not have a working Golang environment, please follow Install Golang.
$ go get github.com/minio/minio-go
Example
ListBuckets()
This example shows how to List your buckets.
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
// Requests are always secure (HTTPS) by default. Set insecure=true to enable insecure (HTTP) access.
// This boolean value is the last argument for New().
// New returns an Amazon S3 compatible client object. API copatibality (v2 or v4) is automatically
// determined based on the Endpoint value.
s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESS-KEY-HERE", "YOUR-SECRET-KEY-HERE", false)
if err != nil {
log.Fatalln(err)
}
buckets, err := s3Client.ListBuckets()
if err != nil {
log.Fatalln(err)
}
for _, bucket := range buckets {
log.Println(bucket)
}
}
Documentation
Bucket Operations.
- MakeBucket(bucketName, BucketACL, location) error
- BucketExists(bucketName) error
- RemoveBucket(bucketName) error
- GetBucketACL(bucketName) (BucketACL, error)
- SetBucketACL(bucketName, BucketACL) error)
- ListBuckets() []BucketInfo
- ListObjects(bucketName, objectPrefix, recursive, chan<- struct{}) <-chan ObjectInfo
- ListIncompleteUploads(bucketName, prefix, recursive, chan<- struct{}) <-chan ObjectMultipartInfo
Object Operations.
- PutObject(bucketName, objectName, io.Reader, contentType) error
- GetObject(bucketName, objectName) (*Object, error)
- StatObject(bucketName, objectName) (ObjectInfo, error)
- RemoveObject(bucketName, objectName) error
- RemoveIncompleteUpload(bucketName, objectName) <-chan error
File Object Operations.
- FPutObject(bucketName, objectName, filePath, contentType) (size, error)
- FGetObject(bucketName, objectName, filePath) error
Presigned Operations.
- PresignedGetObject(bucketName, objectName, time.Duration) (string, error)
- PresignedPutObject(bucketName, objectName, time.Duration) (string, error)
- PresignedPostPolicy(NewPostPolicy()) (map[string]string, error)