Merge pull request #797 from harshavardhana/pr_out_bring_in_new_changes_from_minio_go

Bring in new changes from minio-go
This commit is contained in:
Harshavardhana
2015-06-13 22:16:55 -07:00
30 changed files with 907 additions and 25 deletions
+1 -1
View File
@@ -32,7 +32,7 @@
},
{
"ImportPath": "github.com/minio/minio-go",
"Rev": "b867992492c229ad22953ba160d09f3d2184e041"
"Rev": "749fed960d9ca0c720983f5ebc6ee016e2b26462"
},
{
"ImportPath": "github.com/minio/minio/pkg/iodine",
+18 -5
View File
@@ -12,7 +12,7 @@ package main
import (
"log"
"github.com/minio/minio-go"
)
@@ -37,10 +37,23 @@ func main() {
## Documentation
* [PutObject(string, string, int64, io.Reader) error](examples/s3/putobject.go)
* [GetObject(string, string) (io.Reader, struct{}, error)](examples/s3/getobject.go)
* [ListObjects(string, string, bool) <-chan struct{}](examples/s3/listobjects.go)
* [ListBuckets() <-chan struct{}](examples/s3/listbuckets.go)
### Bucket Level
* [MakeBucket(bucket, acl) error](examples/s3/makebucket.go)
* [BucketExists(bucket) error](examples/s3/bucketexists.go)
* [RemoveBucket(bucket) error](examples/s3/removebucket.go)
* [GetBucketACL(bucket) (BucketACL, error)](examples/s3/getbucketacl.go)
* [SetBucketACL(bucket, BucketACL) error)](examples/s3/setbucketacl.go)
* [ListObjects(bucket, prefix, recursive) <-chan ObjectStat](examples/s3/listobjects.go)
* [ListBuckets() <-chan BucketStat](examples/s3/listbuckets.go)
* [DropAllIncompleteUploads(bucket) <-chan error](examples/s3/dropallincompleteuploads.go)
* [DropIncompleteUploads(bucket, object) <-chan error](examples/s3/dropincompleteuploads.go)
### Object Level
* [PutObject(bucket, object, size, io.Reader) error](examples/s3/putobject.go)
* [GetObject(bucket, object) (io.Reader, ObjectStat, error)](examples/s3/getobject.go)
* [GetPartialObject(bucket, object, offset, length) (io.Reader, ObjectStat, error)](examples/s3/getpartialobject.go)
* [StatObject(bucket, object) (ObjectStat, error)](examples/s3/statobject.go)
* [RemoveObject(bucket, object) error](examples/s3/removeobject.go)
### API Reference
+1 -1
View File
@@ -467,7 +467,7 @@ func (a api) PutObject(bucket, object, contentType string, size int64, data io.R
}
return a.continueObjectUpload(bucket, object, inProgressUploadID, size, data)
}
return errors.New("Unexpected control flow")
return errors.New("Unexpected control flow, please report this error at https://github.com/minio/minio-go/issues")
}
// StatObject verify if object exists and you have permission to access it
@@ -0,0 +1,42 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
err = s3Client.BucketExists("mybucket")
if err != nil {
log.Fatalln(err)
}
log.Println("Success")
}
@@ -0,0 +1,43 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
for err := range s3Client.DropAllIncompleteUploads("mybucket") {
if err != nil {
log.Fatalln(err)
}
}
log.Println("Success")
}
@@ -0,0 +1,43 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
for err := range s3Client.DropIncompleteUploads("mybucket", "myobject") {
if err != nil {
log.Fatalln(err)
}
}
log.Println("Success")
}
@@ -0,0 +1,43 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
acl, err := s3Client.GetBucketACL("mybucket")
if err != nil {
log.Fatalln(err)
}
log.Println(acl)
}
@@ -28,15 +28,15 @@ import (
func main() {
config := minio.Config{
AccessKeyID: "",
SecretAccessKey: "",
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
playClient, err := minio.New(config)
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
reader, stat, err := playClient.GetPartialObject("mybucket", "myobject", 0, 0)
reader, stat, err := s3Client.GetObject("mybucket", "myobject")
if err != nil {
log.Fatalln(err)
}
@@ -0,0 +1,53 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"io"
"log"
"os"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
reader, stat, err := s3Client.GetPartialObject("mybucket", "myobject", 0, 10)
if err != nil {
log.Fatalln(err)
}
localfile, err := os.Create("testfile")
if err != nil {
log.Fatalln(err)
}
defer localfile.Close()
if _, err = io.CopyN(localfile, reader, stat.Size); err != nil {
log.Fatalln(err)
}
}
@@ -26,15 +26,15 @@ import (
func main() {
config := minio.Config{
AccessKeyID: "",
SecretAccessKey: "",
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
playClient, err := minio.New(config)
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
for bucket := range playClient.ListBuckets() {
for bucket := range s3Client.ListBuckets() {
if bucket.Err != nil {
log.Fatalln(bucket.Err)
}
@@ -26,15 +26,15 @@ import (
func main() {
config := minio.Config{
AccessKeyID: "",
SecretAccessKey: "",
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
playClient, err := minio.New(config)
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
for object := range playClient.ListObjects("mybucket", "", true) {
for object := range s3Client.ListObjects("mybucket", "", true) {
if object.Err != nil {
log.Fatalln(object.Err)
}
@@ -0,0 +1,42 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
err = s3Client.MakeBucket("mybucket", "")
if err != nil {
log.Fatalln(err)
}
log.Println("Success")
}
@@ -27,11 +27,11 @@ import (
func main() {
config := minio.Config{
AccessKeyID: "",
SecretAccessKey: "",
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
playClient, err := minio.New(config)
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
@@ -40,14 +40,13 @@ func main() {
log.Fatalln(err)
}
defer object.Close()
objectInfo, err := object.Stat()
if err != nil {
object.Close()
log.Fatalln(err)
}
err = playClient.PutObject("mybucket", "myobject", objectInfo.Size(), object)
err = s3Client.PutObject("mybucket", "myobject", "application/octet-stream", objectInfo.Size(), object)
if err != nil {
log.Fatalln(err)
}
@@ -0,0 +1,43 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
err = s3Client.RemoveBucket("mybucket")
if err != nil {
log.Fatalln(err)
}
log.Println("Success")
}
@@ -0,0 +1,42 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
er = s3Client.RemoveObject("mybucket", "myobject")
if err != nil {
log.Fatalln(err)
}
log.Println("Success")
}
@@ -0,0 +1,42 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
err = s3Client.SetBucketACL("mybucket", minio.BucketACL("public-read-write"))
if err != nil {
log.Fatalln(err)
}
}
@@ -0,0 +1,42 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://play.minio.io:9000",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
stat, err := s3Client.StatObject("mybucket", "myobject")
if err != nil {
log.Fatalln(err)
}
log.Println(stat)
}
Binary file not shown.
@@ -0,0 +1,42 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://s3.amazonaws.com",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
err = s3Client.BucketExists("mybucket")
if err != nil {
log.Fatalln(err)
}
log.Println("Success")
}
@@ -0,0 +1,43 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://s3.amazonaws.com",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
for err := range s3Client.DropAllIncompleteUploads("mybucket") {
if err != nil {
log.Fatalln(err)
}
}
log.Println("Success")
}
@@ -0,0 +1,43 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://s3.amazonaws.com",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
for err := range s3Client.DropIncompleteUploads("mybucket", "myobject") {
if err != nil {
log.Fatalln(err)
}
}
log.Println("Success")
}
@@ -0,0 +1,43 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://s3.amazonaws.com",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
acl, err := s3Client.GetBucketACL("mybucket")
if err != nil {
log.Fatalln(err)
}
log.Println(acl)
}
@@ -0,0 +1,53 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"io"
"log"
"os"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://s3.amazonaws.com",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
reader, stat, err := s3Client.GetPartialObject("mybucket", "myobject", 0, 10)
if err != nil {
log.Fatalln(err)
}
localfile, err := os.Create("testfile")
if err != nil {
log.Fatalln(err)
}
defer localfile.Close()
if _, err = io.CopyN(localfile, reader, stat.Size); err != nil {
log.Fatalln(err)
}
}
@@ -0,0 +1,42 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://s3.amazonaws.com",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
err = s3Client.MakeBucket("mybucket", "")
if err != nil {
log.Fatalln(err)
}
log.Println("Success")
}
+1 -1
View File
@@ -46,7 +46,7 @@ func main() {
log.Fatalln(err)
}
err = s3Client.PutObject("mybucket", "myobject", objectInfo.Size(), object)
err = s3Client.PutObject("mybucket", "myobject", "application/octet-stream", objectInfo.Size(), object)
if err != nil {
log.Fatalln(err)
}
@@ -0,0 +1,43 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://s3.amazonaws.com",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
err = s3Client.RemoveBucket("mybucket")
if err != nil {
log.Fatalln(err)
}
log.Println("Success")
}
@@ -0,0 +1,42 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://s3.amazonaws.com",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
er = s3Client.RemoveObject("mybucket", "myobject")
if err != nil {
log.Fatalln(err)
}
log.Println("Success")
}
@@ -0,0 +1,42 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://s3.amazonaws.com",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
err = s3Client.SetBucketACL("mybucket", minio.BucketACL("public-read-write"))
if err != nil {
log.Fatalln(err)
}
}
@@ -0,0 +1,42 @@
// +build ignore
/*
* Minimal object storage library (C) 2015 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package main
import (
"log"
"github.com/minio/minio-go"
)
func main() {
config := minio.Config{
AccessKeyID: "YOUR-ACCESS-KEY-HERE",
SecretAccessKey: "YOUR-PASSWORD-HERE",
Endpoint: "https://s3.amazonaws.com",
}
s3Client, err := minio.New(config)
if err != nil {
log.Fatalln(err)
}
stat, err := s3Client.StatObject("mybucket", "myobject")
if err != nil {
log.Fatalln(err)
}
log.Println(stat)
}
Binary file not shown.