mirror of
https://github.com/minio/minio.git
synced 2024-12-26 23:25:54 -05:00
Merge pull request #940 from harshavardhana/aws-sdk-go
Add documentation for aws-sdk-go
This commit is contained in:
commit
9680ceb54e
73
AWS-SDK-GO.md
Normal file
73
AWS-SDK-GO.md
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
15
README.md
15
README.md
@ -27,12 +27,15 @@ $ go get -u github.com/minio/minio
|
|||||||
|
|
||||||
### How to use Minio?
|
### How to use Minio?
|
||||||
|
|
||||||
~~~
|
```
|
||||||
NAME:
|
NAME:
|
||||||
minio server - Start Minio cloud storage server.
|
minio server - Start Minio cloud storage server.
|
||||||
|
|
||||||
USAGE:
|
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:
|
EXAMPLES:
|
||||||
1. Start minio server on Linux.
|
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
|
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
|
$ minio server min-free-disk 15% expiry 1h /home/shared/Documents
|
||||||
~~~
|
```
|
||||||
|
|
||||||
|
#### Start Minio server.
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
$ minio server ~/Photos
|
$ minio server ~/Photos
|
||||||
@ -68,6 +73,10 @@ Listening on http://127.0.0.1:9000
|
|||||||
Listening on http://172.30.2.17: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
|
### Contribute to Minio Project
|
||||||
Please follow Minio [Contributor's Guide](./CONTRIBUTING.md)
|
Please follow Minio [Contributor's Guide](./CONTRIBUTING.md)
|
||||||
|
|
||||||
|
@ -42,7 +42,10 @@ var serverCmd = cli.Command{
|
|||||||
minio {{.Name}} - {{.Usage}}
|
minio {{.Name}} - {{.Usage}}
|
||||||
|
|
||||||
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:
|
EXAMPLES:
|
||||||
1. Start minio server on Linux.
|
1. Start minio server on Linux.
|
||||||
|
Loading…
Reference in New Issue
Block a user