Name: minio-go
Owner: Wellcome Trust Sanger Institute - Human Genetics Informatics
Description: Minio Go Library for Amazon S3 compatible cloud storage
Forked from: minio/minio-go
Created: 2017-03-22 11:23:55.0
Updated: 2017-03-22 11:23:57.0
Pushed: 2017-03-31 22:51:31.0
Homepage: http://minio.io/downloads/#minio-sdk
Size: 3933
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
The Minio Go Client SDK provides simple APIs to access any Amazon S3 compatible object storage.
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 Minio client SDK, connect to Minio, and provide a walkthrough for a simple file uploader. For a complete list of APIs and examples, please take a look at the Go Client API Reference.
This document assumes that you have a working Go development environment.
et -u github.com/minio/minio-go
Minio client requires the following four parameters specified to connect to an Amazon S3 compatible object storage.
| Parameter | Description|
| :— | :— |
| endpoint | URL to object storage service. |
| accessKeyID | Access key is the 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. |
age main
rt (
"github.com/minio/minio-go"
"log"
main() {
endpoint := "play.minio.io:9000"
accessKeyID := "Q3AM3UQ867SPQQA43P2F"
secretAccessKey := "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
useSSL := true
// Initialize minio client object.
minioClient, err := minio.New(endpoint, accessKeyID, secretAccessKey, useSSL)
if err != nil {
log.Fatalln(err)
}
log.Println("%v", minioClient) // minioClient is now setup
This example program connects to an object storage server, creates a bucket and 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.
age main
rt (
"github.com/minio/minio-go"
"log"
main() {
endpoint := "play.minio.io:9000"
accessKeyID := "Q3AM3UQ867SPQQA43P2F"
secretAccessKey := "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
useSSL := true
// Initialize minio client object.
minioClient, err := minio.New(endpoint, accessKeyID, secretAccessKey, useSSL)
if err != nil {
log.Fatalln(err)
}
// Make a new bucked called mymusic.
bucketName := "mymusic"
location := "us-east-1"
err = minioClient.MakeBucket(bucketName, location)
if err != nil {
// Check to see if we already own this bucket (which happens if you run this twice)
exists, err := minioClient.BucketExists(bucketName)
if err == nil && exists {
log.Printf("We already own %s\n", bucketName)
} else {
log.Fatalln(err)
}
}
log.Printf("Successfully created %s\n", bucketName)
// Upload the zip file
objectName := "golden-oldies.zip"
filePath := "/tmp/golden-oldies.zip"
contentType := "application/zip"
// Upload the zip file with FPutObject
n, err := minioClient.FPutObject(bucketName, objectName, filePath, contentType)
if err != nil {
log.Fatalln(err)
}
log.Printf("Successfully uploaded %s of size %d\n", objectName, n)
un file-uploader.go
/08/13 17:03:28 Successfully created mymusic
/08/13 17:03:40 Successfully uploaded golden-oldies.zip of size 16253413
s play/mymusic/
6-05-27 16:02:16 PDT] 17MiB golden-oldies.zip
The full API Reference is available here.
SetBucketNotification
GetBucketNotification
RemoveAllBucketNotification
ListenBucketNotification
(Minio Extension)