diff --git a/AWS-SDK-GO.md b/AWS-SDK-GO.md new file mode 100644 index 000000000..b6b4e176a --- /dev/null +++ b/AWS-SDK-GO.md @@ -0,0 +1,73 @@ +## Using aws-sdk-go with Minio + +aws-sdk-go is the official AWS SDK for the Go programming language. This document covers +how to use aws-sdk-go with Minio server. + +### Install AWS SDK S3 service + +```sh +$ go get github.com/aws/aws-sdk-go/service/s3 +``` + +### List all buckets on Minio + +```go +package main + +import ( + "fmt" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/service/s3" +) + +func main() { + // Create an S3 service object in the "milkyway" region + s3Client := s3.New(&aws.Config{ + Credentials: credentials.NewStaticCredentials("", "", ""), + Endpoint: aws.String("http://localhost:9000"), + Region: aws.String("milkyway"), + DisableSSL: aws.Bool(true), + S3ForcePathStyle: aws.Bool(true), + }) + + cparams := &s3.CreateBucketInput{ + Bucket: aws.String("newbucket"), // Required + } + _, err := s3Client.CreateBucket(cparams) + if err != nil { + // Message from an error. + fmt.Println(err.Error()) + return + } + + var lparams *s3.ListBucketsInput + // Call the ListBuckets() Operation + resp, err := s3Client.ListBuckets(lparams) + if err != nil { + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} +``` + +Populate your AccessKeyId and SecretAccessKey credentials and run the program as shown below. + +```sh +$ go run aws-sdk-minio.go +{ + Buckets: [{ + CreationDate: 2015-10-22 01:46:04 +0000 UTC, + Name: "newbucket" + }], + Owner: { + DisplayName: "minio", + ID: "minio" + } +} +``` \ No newline at end of file diff --git a/README.md b/README.md index a96e5b609..d02d5a8a6 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,15 @@ $ go get -u github.com/minio/minio ### How to use Minio? -~~~ +``` NAME: minio server - Start Minio cloud storage server. USAGE: - minio server [OPTIONS] PATH + minio server [OPTION VALUE] PATH + + OPTION = expiry VALUE = NN[h|m|s] [DEFAULT=Unlimited] + OPTION = min-free-disk VALUE = NN% [DEFAULT: 10%] EXAMPLES: 1. Start minio server on Linux. @@ -49,7 +52,9 @@ EXAMPLES: 5. Start minio server with minimum free disk threshold to 15% with auto expiration set to 1h $ minio server min-free-disk 15% expiry 1h /home/shared/Documents -~~~ +``` + +#### Start Minio server. ~~~ $ minio server ~/Photos @@ -68,6 +73,10 @@ Listening on http://127.0.0.1:9000 Listening on http://172.30.2.17:9000 ~~~ +#### How to use AWS SDK with Minio? + +Please follow the documentation here - [Using aws-sdk-go with Minio server](./AWS-SDK-GO.md) + ### Contribute to Minio Project Please follow Minio [Contributor's Guide](./CONTRIBUTING.md) diff --git a/server-main.go b/server-main.go index 431b76cff..afca8f0f8 100644 --- a/server-main.go +++ b/server-main.go @@ -42,7 +42,10 @@ var serverCmd = cli.Command{ minio {{.Name}} - {{.Usage}} USAGE: - minio {{.Name}} [OPTIONS] PATH + minio {{.Name}} [OPTION VALUE] PATH + + OPTION = expiry VALUE = NN[h|m|s] [DEFAULT=Unlimited] + OPTION = min-free-disk VALUE = NN% [DEFAULT: 10%] EXAMPLES: 1. Start minio server on Linux.