diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index d21d45c2..e350a685 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -32,7 +32,7 @@ }, { "ImportPath": "github.com/minio/minio-go", - "Rev": "b867992492c229ad22953ba160d09f3d2184e041" + "Rev": "749fed960d9ca0c720983f5ebc6ee016e2b26462" }, { "ImportPath": "github.com/minio/minio/pkg/iodine", diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/README.md b/Godeps/_workspace/src/github.com/minio/minio-go/README.md index 36b9bc8b..853800a8 100644 --- a/Godeps/_workspace/src/github.com/minio/minio-go/README.md +++ b/Godeps/_workspace/src/github.com/minio/minio-go/README.md @@ -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 diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/api.go b/Godeps/_workspace/src/github.com/minio/minio-go/api.go index 83dd057a..53c89f7b 100644 --- a/Godeps/_workspace/src/github.com/minio/minio-go/api.go +++ b/Godeps/_workspace/src/github.com/minio/minio-go/api.go @@ -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 diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/bucketexists.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/bucketexists.go new file mode 100644 index 00000000..04c18f44 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/bucketexists.go @@ -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") +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropallincompleteuploads.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropallincompleteuploads.go new file mode 100644 index 00000000..123b4e53 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropallincompleteuploads.go @@ -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") +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropincompleteuploads.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropincompleteuploads.go new file mode 100644 index 00000000..15c0cf1a --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/dropincompleteuploads.go @@ -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") +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getbucketacl.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getbucketacl.go new file mode 100644 index 00000000..5d531cab --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getbucketacl.go @@ -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) + +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getobject.go index f81b3744..52964462 100644 --- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getobject.go +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getobject.go @@ -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) } diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getpartialobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getpartialobject.go new file mode 100644 index 00000000..8cf54333 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/getpartialobject.go @@ -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) + } +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listbuckets.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listbuckets.go index 1a2ee74d..42dc0bad 100644 --- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listbuckets.go +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listbuckets.go @@ -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) } diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listobjects.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listobjects.go index a1e6caeb..cfa24c8a 100644 --- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listobjects.go +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/listobjects.go @@ -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) } diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/makebucket.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/makebucket.go new file mode 100644 index 00000000..3bd19615 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/makebucket.go @@ -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") +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/putobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/putobject.go index ba478bfe..5161b2d5 100644 --- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/putobject.go +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/putobject.go @@ -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) } diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/removebucket.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/removebucket.go new file mode 100644 index 00000000..ecd70fd8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/removebucket.go @@ -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") + +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/removeobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/removeobject.go new file mode 100644 index 00000000..dbf67bff --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/removeobject.go @@ -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") +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/setbucketacl.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/setbucketacl.go new file mode 100644 index 00000000..2e4cc747 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/setbucketacl.go @@ -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) + } + +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/statobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/statobject.go new file mode 100644 index 00000000..9f886773 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/statobject.go @@ -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) +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/testfile b/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/testfile deleted file mode 100644 index 294f4016..00000000 Binary files a/Godeps/_workspace/src/github.com/minio/minio-go/examples/play/testfile and /dev/null differ diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/bucketexists.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/bucketexists.go new file mode 100644 index 00000000..c3ed7202 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/bucketexists.go @@ -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") +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropallincompleteuploads.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropallincompleteuploads.go new file mode 100644 index 00000000..da061252 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropallincompleteuploads.go @@ -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") +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropincompleteuploads.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropincompleteuploads.go new file mode 100644 index 00000000..f6eb8505 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/dropincompleteuploads.go @@ -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") +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getbucketacl.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getbucketacl.go new file mode 100644 index 00000000..1f2ad817 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getbucketacl.go @@ -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) + +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getpartialobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getpartialobject.go new file mode 100644 index 00000000..683c4e71 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/getpartialobject.go @@ -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) + } +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/makebucket.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/makebucket.go new file mode 100644 index 00000000..665c9fc1 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/makebucket.go @@ -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") +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/putobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/putobject.go index 010b8ced..4ba688b3 100644 --- a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/putobject.go +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/putobject.go @@ -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) } diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removebucket.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removebucket.go new file mode 100644 index 00000000..f07d8f77 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removebucket.go @@ -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") + +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removeobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removeobject.go new file mode 100644 index 00000000..183e47a4 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/removeobject.go @@ -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") +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/setbucketacl.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/setbucketacl.go new file mode 100644 index 00000000..42a02f56 --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/setbucketacl.go @@ -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) + } + +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/statobject.go b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/statobject.go new file mode 100644 index 00000000..7c50607d --- /dev/null +++ b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/statobject.go @@ -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) +} diff --git a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/testfile b/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/testfile deleted file mode 100644 index 294f4016..00000000 Binary files a/Godeps/_workspace/src/github.com/minio/minio-go/examples/s3/testfile and /dev/null differ