Add documentation for aws-sdk-go

This commit is contained in:
Harshavardhana 2015-10-22 01:31:09 -07:00
parent 485da0cb91
commit fc5a1d7408
3 changed files with 89 additions and 4 deletions

73
AWS-SDK-GO.md Normal file
View File

@ -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("<YOUR-ACCESS-ID>", "<YOUR-SECRET-ID>", ""),
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"
}
}
```

View File

@ -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)

View File

@ -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.