.. | ||
docs | ||
examples/s3 | ||
api-datatypes.go | ||
api-error-response.go | ||
api-error-response_test.go | ||
api-get-object-file.go | ||
api-get-object.go | ||
api-get-policy.go | ||
api-get-policy_test.go | ||
api-list.go | ||
api-notification.go | ||
api-presigned.go | ||
api-put-bucket.go | ||
api-put-bucket_test.go | ||
api-put-object-common.go | ||
api-put-object-copy.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-datatypes.go | ||
api-stat.go | ||
api.go | ||
api_functional_v2_test.go | ||
api_functional_v4_test.go | ||
api_unit_test.go | ||
appveyor.yml | ||
bucket-cache.go | ||
bucket-cache_test.go | ||
bucket-notification.go | ||
bucket-policy.go | ||
bucket-policy_test.go | ||
constants.go | ||
CONTRIBUTING.md | ||
copy-conditions.go | ||
hook-reader.go | ||
LICENSE | ||
MAINTAINERS.md | ||
post-policy.go | ||
README.md | ||
request-signature-v2.go | ||
request-signature-v2_test.go | ||
request-signature-v4.go | ||
retry.go | ||
s3-endpoints.go | ||
signature-type.go | ||
tempfile.go | ||
test-utils_test.go | ||
utils.go | ||
utils_test.go |
Minio Golang Library for Amazon S3 Compatible Cloud Storage
The Minio Golang Client SDK provides simple APIs to access any Amazon S3 compatible object storage server.
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
This quickstart guide will show you how to install the client SDK and execute an example Golang program. For a complete list of APIs and examples, please take a look at the Golang Client API Reference documentation.
This document assumes that you have a working Golang setup in place.
Download from Github
$ go get -u github.com/minio/minio-go
Initialize Minio Client
You need four items in order to connect to Minio object storage server.
Params | Description |
---|---|
endpoint | URL to object storage service. |
accessKeyID | Access key is like user ID that uniquely identifies your account. |
secretAccessKey | Secret key is the password to your account. |
secure | Set this value to 'true' to enable secure (HTTPS) access. |
package main
import (
"fmt"
"github.com/minio/minio-go"
)
func main() {
// Use a secure connection.
ssl := true
// Initialize minio client object.
minioClient, err := minio.New("play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", ssl)
if err != nil {
fmt.Println(err)
return
}
}
Quick Start Example - File Uploader
This example program connects to an object storage server, makes a bucket on the server and then uploads a file to the bucket.
We will use the Minio server running at https://play.minio.io:9000 in this example. Feel free to use this service for testing and development. Access credentials shown in this example are open to the public.
FileUploader.go
package main
import "fmt"
import (
"log"
"github.com/minio/minio-go"
)
func main() {
// Use a secure connection.
ssl := true
// Initialize minio client object.
minioClient, err := minio.New("play.minio.io:9000", "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", ssl)
if err != nil {
log.Fatalln(err)
}
// Make a new bucket called mymusic.
err = minioClient.MakeBucket("mymusic", "us-east-1")
if err != nil {
log.Fatalln(err)
}
fmt.Println("Successfully created mymusic")
// Upload the zip file with FPutObject.
n, err := minioClient.FPutObject("mymusic", "golden-oldies.zip", "/tmp/golden-oldies.zip", "application/zip")
if err != nil {
log.Fatalln(err)
}
log.Printf("Successfully uploaded golden-oldies.zip of size %d\n", n)
}
Run FileUploader
$ go run file-uploader.go
$ Successfully created mymusic
$ Successfully uploaded golden-oldies.zip of size 17MiB
$ mc ls play/mymusic/
[2016-05-27 16:02:16 PDT] 17MiB golden-oldies.zip
API Reference
The full API Reference is available here.
API Reference : Bucket Operations
API Reference : Bucket policy Operations
API Reference : Bucket notification Operations
API Reference : File Object Operations
API Reference : Object Operations
API Reference : Presigned Operations
Full Examples
Full Examples : Bucket Operations
- listbuckets.go
- listobjects.go
- bucketexists.go
- makebucket.go
- removebucket.go
- listincompleteuploads.go
Full Examples : Bucket policy Operations
Full Examples : Bucket notification Operations
Full Examples : File Object Operations
Full Examples : Object Operations
Full Examples : Presigned Operations
Explore Further
- Complete Documentation
- Minio Golang Client SDK API Reference
- Go Music Player App- Full Application Example