summaryrefslogtreecommitdiff
path: root/examples/s3
diff options
context:
space:
mode:
Diffstat (limited to 'examples/s3')
-rw-r--r--examples/s3/bucketexists.go6
-rw-r--r--examples/s3/composeobject.go19
-rw-r--r--examples/s3/copyobject.go6
-rw-r--r--examples/s3/disableversioning.go47
-rw-r--r--examples/s3/enableversioning.go47
-rw-r--r--examples/s3/fgetobject-context.go6
-rw-r--r--examples/s3/fgetobject.go6
-rw-r--r--examples/s3/fputencrypted-object.go9
-rw-r--r--examples/s3/fputobject-context.go6
-rw-r--r--examples/s3/fputobject.go6
-rw-r--r--examples/s3/get-encrypted-object.go8
-rw-r--r--examples/s3/getbucketlifecycle.go6
-rw-r--r--examples/s3/getbucketnotification.go6
-rw-r--r--examples/s3/getbucketobjectlockconfig.go56
-rw-r--r--examples/s3/getbucketpolicy.go6
-rw-r--r--examples/s3/getobject-client-encryption.go6
-rw-r--r--examples/s3/getobject-context.go6
-rw-r--r--examples/s3/getobject.go6
-rw-r--r--examples/s3/getobjectacl.go6
-rw-r--r--examples/s3/getobjectretention.go48
-rw-r--r--examples/s3/listbuckets.go6
-rw-r--r--examples/s3/listincompleteuploads.go6
-rw-r--r--examples/s3/listobjects-N.go6
-rw-r--r--examples/s3/listobjects.go6
-rw-r--r--examples/s3/listobjectsV2.go6
-rw-r--r--examples/s3/listobjectsV2WithMetadata.go58
-rw-r--r--examples/s3/makebucket.go6
-rw-r--r--examples/s3/makebucketwithobjectlock.go47
-rw-r--r--examples/s3/presignedgetobject.go6
-rw-r--r--examples/s3/presignedheadobject.go6
-rw-r--r--examples/s3/presignedpostpolicy.go6
-rw-r--r--examples/s3/presignedputobject.go6
-rw-r--r--examples/s3/put-encrypted-object.go8
-rw-r--r--examples/s3/putobject-client-encryption.go6
-rw-r--r--examples/s3/putobject-context.go6
-rw-r--r--examples/s3/putobject-getobject-sse.go9
-rw-r--r--examples/s3/putobject-progress.go6
-rw-r--r--examples/s3/putobject-s3-accelerate.go6
-rw-r--r--examples/s3/putobject-streaming.go6
-rw-r--r--examples/s3/putobject.go6
-rw-r--r--examples/s3/putobjectretention.go54
-rw-r--r--examples/s3/removeallbucketnotification.go6
-rw-r--r--examples/s3/removebucket.go6
-rw-r--r--examples/s3/removeincompleteupload.go6
-rw-r--r--examples/s3/removeobject.go6
-rw-r--r--examples/s3/removeobjectoptions.go49
-rw-r--r--examples/s3/removeobjects.go6
-rw-r--r--examples/s3/selectobject.go6
-rw-r--r--examples/s3/setbucketlifecycle.go6
-rw-r--r--examples/s3/setbucketnotification.go6
-rw-r--r--examples/s3/setbucketobjectlockconfig.go54
-rw-r--r--examples/s3/setbucketpolicy.go6
-rw-r--r--examples/s3/statobject.go6
53 files changed, 603 insertions, 144 deletions
diff --git a/examples/s3/bucketexists.go b/examples/s3/bucketexists.go
index 20dea30..e4b0a3a 100644
--- a/examples/s3/bucketexists.go
+++ b/examples/s3/bucketexists.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/composeobject.go b/examples/s3/composeobject.go
index 2f76ff0..78bfe95 100644
--- a/examples/s3/composeobject.go
+++ b/examples/s3/composeobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,8 @@ package main
import (
"log"
- minio "github.com/minio/minio-go"
+ minio "github.com/minio/minio-go/v6"
+ "github.com/minio/minio-go/v6/pkg/encrypt"
)
func main() {
@@ -44,27 +45,27 @@ func main() {
// Prepare source decryption key (here we assume same key to
// decrypt all source objects.)
- decKey := minio.NewSSEInfo([]byte{1, 2, 3}, "")
+ decKey, _ := encrypt.NewSSEC([]byte{1, 2, 3})
// Source objects to concatenate. We also specify decryption
// key for each
- src1 := minio.NewSourceInfo("bucket1", "object1", &decKey)
+ src1 := minio.NewSourceInfo("bucket1", "object1", decKey)
src1.SetMatchETagCond("31624deb84149d2f8ef9c385918b653a")
- src2 := minio.NewSourceInfo("bucket2", "object2", &decKey)
+ src2 := minio.NewSourceInfo("bucket2", "object2", decKey)
src2.SetMatchETagCond("f8ef9c385918b653a31624deb84149d2")
- src3 := minio.NewSourceInfo("bucket3", "object3", &decKey)
+ src3 := minio.NewSourceInfo("bucket3", "object3", decKey)
src3.SetMatchETagCond("5918b653a31624deb84149d2f8ef9c38")
// Create slice of sources.
srcs := []minio.SourceInfo{src1, src2, src3}
// Prepare destination encryption key
- encKey := minio.NewSSEInfo([]byte{8, 9, 0}, "")
+ encKey, _ := encrypt.NewSSEC([]byte{8, 9, 0})
// Create destination info
- dst, err := minio.NewDestinationInfo("bucket", "object", &encKey, nil)
+ dst, err := minio.NewDestinationInfo("bucket", "object", encKey, nil)
if err != nil {
log.Fatalln(err)
}
diff --git a/examples/s3/copyobject.go b/examples/s3/copyobject.go
index a7c3eca..1c3f65a 100644
--- a/examples/s3/copyobject.go
+++ b/examples/s3/copyobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import (
"log"
"time"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/disableversioning.go b/examples/s3/disableversioning.go
new file mode 100644
index 0000000..bbaec5e
--- /dev/null
+++ b/examples/s3/disableversioning.go
@@ -0,0 +1,47 @@
+// +build ignore
+
+/*
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2019 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"
+
+ minio "github.com/minio/minio-go/v6"
+)
+
+func main() {
+ // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname are
+ // dummy values, please replace them with original values.
+
+ // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
+ // This boolean value is the last argument for New().
+
+ // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
+ // determined based on the Endpoint value.
+ s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true)
+ if err != nil {
+ log.Fatalln(err)
+ }
+
+ err = s3Client.DisableVersioning("my-bucketname")
+ if err != nil {
+ log.Fatalln(err)
+ }
+ log.Println("Disabled")
+}
diff --git a/examples/s3/enableversioning.go b/examples/s3/enableversioning.go
new file mode 100644
index 0000000..58179be
--- /dev/null
+++ b/examples/s3/enableversioning.go
@@ -0,0 +1,47 @@
+// +build ignore
+
+/*
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2019 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"
+
+ minio "github.com/minio/minio-go/v6"
+)
+
+func main() {
+ // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname are
+ // dummy values, please replace them with original values.
+
+ // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
+ // This boolean value is the last argument for New().
+
+ // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
+ // determined based on the Endpoint value.
+ s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true)
+ if err != nil {
+ log.Fatalln(err)
+ }
+
+ err = s3Client.EnableVersioning("my-bucketname")
+ if err != nil {
+ log.Fatalln(err)
+ }
+ log.Println("Enabled")
+}
diff --git a/examples/s3/fgetobject-context.go b/examples/s3/fgetobject-context.go
index 6004baa..f3dc74d 100644
--- a/examples/s3/fgetobject-context.go
+++ b/examples/s3/fgetobject-context.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import (
"context"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/fgetobject.go b/examples/s3/fgetobject.go
index 819a34f..76dd59f 100644
--- a/examples/s3/fgetobject.go
+++ b/examples/s3/fgetobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/fputencrypted-object.go b/examples/s3/fputencrypted-object.go
index 5da9f9d..95eefea 100644
--- a/examples/s3/fputencrypted-object.go
+++ b/examples/s3/fputencrypted-object.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,9 +22,8 @@ package main
import (
"log"
- "github.com/minio/minio-go/pkg/encrypt"
-
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
+ "github.com/minio/minio-go/v6/pkg/encrypt"
)
func main() {
diff --git a/examples/s3/fputobject-context.go b/examples/s3/fputobject-context.go
index d7c941c..0aa300c 100644
--- a/examples/s3/fputobject-context.go
+++ b/examples/s3/fputobject-context.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import (
"context"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/fputobject.go b/examples/s3/fputobject.go
index 34d8768..2fc3595 100644
--- a/examples/s3/fputobject.go
+++ b/examples/s3/fputobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/get-encrypted-object.go b/examples/s3/get-encrypted-object.go
index 62a06d5..260770d 100644
--- a/examples/s3/get-encrypted-object.go
+++ b/examples/s3/get-encrypted-object.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,8 +24,8 @@ import (
"log"
"os"
- "github.com/minio/minio-go"
- "github.com/minio/minio-go/pkg/encrypt"
+ "github.com/minio/minio-go/v6"
+ "github.com/minio/minio-go/v6/pkg/encrypt"
)
func main() {
diff --git a/examples/s3/getbucketlifecycle.go b/examples/s3/getbucketlifecycle.go
index 2e3ef41..1982a76 100644
--- a/examples/s3/getbucketlifecycle.go
+++ b/examples/s3/getbucketlifecycle.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import (
"os"
"strings"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/getbucketnotification.go b/examples/s3/getbucketnotification.go
index 19349ba..1d711fc 100644
--- a/examples/s3/getbucketnotification.go
+++ b/examples/s3/getbucketnotification.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/getbucketobjectlockconfig.go b/examples/s3/getbucketobjectlockconfig.go
new file mode 100644
index 0000000..ddd9f92
--- /dev/null
+++ b/examples/s3/getbucketobjectlockconfig.go
@@ -0,0 +1,56 @@
+// +build ignore
+
+/*
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2019 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 (
+ "fmt"
+ "log"
+
+ minio "github.com/minio/minio-go/v6"
+)
+
+func main() {
+ // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname are
+ // dummy values, please replace them with original values.
+
+ // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
+ // This boolean value is the last argument for New().
+
+ // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
+ // determined based on the Endpoint value.
+ s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true)
+ if err != nil {
+ log.Fatalln(err)
+ }
+
+ // s3Client.TraceOn(os.Stderr)
+
+ // Get object lock configuration.
+ mode, validity, unit, err := s3Client.GetBucketObjectLockConfig("my-bucketname")
+ if err != nil {
+ log.Fatalln(err)
+ }
+
+ if mode != nil {
+ fmt.Printf("%v mode is enabled for %v %v for bucket 'my-bucketname'\n", *mode, *validity, *unit)
+ } else {
+ fmt.Println("No mode is enabled for bucket 'my-bucketname'")
+ }
+}
diff --git a/examples/s3/getbucketpolicy.go b/examples/s3/getbucketpolicy.go
index e5b5940..b10e933 100644
--- a/examples/s3/getbucketpolicy.go
+++ b/examples/s3/getbucketpolicy.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import (
"os"
"strings"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/getobject-client-encryption.go b/examples/s3/getobject-client-encryption.go
index 6b06073..33fb0d2 100644
--- a/examples/s3/getobject-client-encryption.go
+++ b/examples/s3/getobject-client-encryption.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2018 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2018 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import (
"os"
"path"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
"github.com/minio/sio"
"golang.org/x/crypto/argon2"
)
diff --git a/examples/s3/getobject-context.go b/examples/s3/getobject-context.go
index c7d4170..1764d8a 100644
--- a/examples/s3/getobject-context.go
+++ b/examples/s3/getobject-context.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import (
"context"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/getobject.go b/examples/s3/getobject.go
index e17ef81..eab9fc5 100644
--- a/examples/s3/getobject.go
+++ b/examples/s3/getobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import (
"log"
"os"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/getobjectacl.go b/examples/s3/getobjectacl.go
index f2bbd95..f557009 100644
--- a/examples/s3/getobjectacl.go
+++ b/examples/s3/getobjectacl.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2018-2019 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2018-2019 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import (
"fmt"
"log"
- minio "github.com/minio/minio-go"
+ minio "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/getobjectretention.go b/examples/s3/getobjectretention.go
new file mode 100644
index 0000000..527f8a2
--- /dev/null
+++ b/examples/s3/getobjectretention.go
@@ -0,0 +1,48 @@
+// +build ignore
+
+/*
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2019 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/v6"
+)
+
+func main() {
+ // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname, my-objectname and
+ // my-testfile are dummy values, please replace them with original values.
+
+ // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
+ // This boolean value is the last argument for New().
+
+ // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
+ // determined based on the Endpoint value.
+ s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESS-KEY-HERE", "YOUR-SECRET-KEY-HERE", true)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ m, t, err = s3Client.GetObjectRetention("my-bucket", "my-object", "")
+ if err != nil {
+ log.Fatalln(err)
+ }
+ log.Println("Get object retention successful, Mode: ", m.String(), " Retainuntil Date ", t.String())
+}
diff --git a/examples/s3/listbuckets.go b/examples/s3/listbuckets.go
index 5eae587..9b1e23e 100644
--- a/examples/s3/listbuckets.go
+++ b/examples/s3/listbuckets.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/listincompleteuploads.go b/examples/s3/listincompleteuploads.go
index a5a79b6..da9bf59 100644
--- a/examples/s3/listincompleteuploads.go
+++ b/examples/s3/listincompleteuploads.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import (
"fmt"
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/listobjects-N.go b/examples/s3/listobjects-N.go
index 55bceb4..12afbbd 100644
--- a/examples/s3/listobjects-N.go
+++ b/examples/s3/listobjects-N.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"fmt"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/listobjects.go b/examples/s3/listobjects.go
index 1da2e3f..34fed84 100644
--- a/examples/s3/listobjects.go
+++ b/examples/s3/listobjects.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"fmt"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/listobjectsV2.go b/examples/s3/listobjectsV2.go
index 190aec3..7443e8b 100644
--- a/examples/s3/listobjectsV2.go
+++ b/examples/s3/listobjectsV2.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"fmt"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/listobjectsV2WithMetadata.go b/examples/s3/listobjectsV2WithMetadata.go
new file mode 100644
index 0000000..77eb509
--- /dev/null
+++ b/examples/s3/listobjectsV2WithMetadata.go
@@ -0,0 +1,58 @@
+// +build ignore
+
+/*
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2019 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 (
+ "fmt"
+
+ "github.com/minio/minio-go/v6"
+)
+
+func main() {
+ // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname and my-prefixname
+ // are dummy values, please replace them with original values.
+
+ // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
+ // This boolean value is the last argument for New().
+
+ // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
+ // determined based on the Endpoint value.
+ s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true)
+ if err != nil {
+ fmt.Println(err)
+ return
+ }
+
+ // Create a done channel to control 'ListObjects' go routine.
+ doneCh := make(chan struct{})
+
+ // Indicate to our routine to exit cleanly upon return.
+ defer close(doneCh)
+
+ // List all objects from a bucket-name with a matching prefix.
+ for object := range s3Client.ListObjectsV2WithMetadata("my-bucketname", "my-prefixname", true, doneCh) {
+ if object.Err != nil {
+ fmt.Println(object.Err)
+ return
+ }
+ fmt.Println(object)
+ }
+ return
+}
diff --git a/examples/s3/makebucket.go b/examples/s3/makebucket.go
index 419c96c..1e17995 100644
--- a/examples/s3/makebucket.go
+++ b/examples/s3/makebucket.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/makebucketwithobjectlock.go b/examples/s3/makebucketwithobjectlock.go
new file mode 100644
index 0000000..af52dd0
--- /dev/null
+++ b/examples/s3/makebucketwithobjectlock.go
@@ -0,0 +1,47 @@
+// +build ignore
+
+/*
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2019 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"
+
+ minio "github.com/minio/minio-go/v6"
+)
+
+func main() {
+ // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname are
+ // dummy values, please replace them with original values.
+
+ // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
+ // This boolean value is the last argument for New().
+
+ // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
+ // determined based on the Endpoint value.
+ s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true)
+ if err != nil {
+ log.Fatalln(err)
+ }
+
+ err = s3Client.MakeBucketWithObjectLock("my-bucketname", "us-east-1")
+ if err != nil {
+ log.Fatalln(err)
+ }
+ log.Println("Success")
+}
diff --git a/examples/s3/presignedgetobject.go b/examples/s3/presignedgetobject.go
index fd7fb9e..dc870a0 100644
--- a/examples/s3/presignedgetobject.go
+++ b/examples/s3/presignedgetobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import (
"net/url"
"time"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/presignedheadobject.go b/examples/s3/presignedheadobject.go
index 8dbc0a4..8cec788 100644
--- a/examples/s3/presignedheadobject.go
+++ b/examples/s3/presignedheadobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import (
"net/url"
"time"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/presignedpostpolicy.go b/examples/s3/presignedpostpolicy.go
index 205ac95..25e0f74 100644
--- a/examples/s3/presignedpostpolicy.go
+++ b/examples/s3/presignedpostpolicy.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import (
"log"
"time"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/presignedputobject.go b/examples/s3/presignedputobject.go
index b2f8b4f..d200faa 100644
--- a/examples/s3/presignedputobject.go
+++ b/examples/s3/presignedputobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import (
"log"
"time"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/put-encrypted-object.go b/examples/s3/put-encrypted-object.go
index 48b9367..7d4cde2 100644
--- a/examples/s3/put-encrypted-object.go
+++ b/examples/s3/put-encrypted-object.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,8 +23,8 @@ import (
"log"
"os"
- "github.com/minio/minio-go"
- "github.com/minio/minio-go/pkg/encrypt"
+ "github.com/minio/minio-go/v6"
+ "github.com/minio/minio-go/v6/pkg/encrypt"
)
func main() {
diff --git a/examples/s3/putobject-client-encryption.go b/examples/s3/putobject-client-encryption.go
index 77d83b4..0c0d7bb 100644
--- a/examples/s3/putobject-client-encryption.go
+++ b/examples/s3/putobject-client-encryption.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2018 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2018 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import (
"os"
"path"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
"github.com/minio/sio"
"golang.org/x/crypto/argon2"
)
diff --git a/examples/s3/putobject-context.go b/examples/s3/putobject-context.go
index acc923f..6a476d4 100644
--- a/examples/s3/putobject-context.go
+++ b/examples/s3/putobject-context.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ import (
"context"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/putobject-getobject-sse.go b/examples/s3/putobject-getobject-sse.go
index 4e459b5..110c323 100644
--- a/examples/s3/putobject-getobject-sse.go
+++ b/examples/s3/putobject-getobject-sse.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,9 +24,8 @@ import (
"io/ioutil"
"log"
- "github.com/minio/minio-go/pkg/encrypt"
-
- minio "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
+ "github.com/minio/minio-go/v6/pkg/encrypt"
)
func main() {
diff --git a/examples/s3/putobject-progress.go b/examples/s3/putobject-progress.go
index 0e92dd6..54ce7cb 100644
--- a/examples/s3/putobject-progress.go
+++ b/examples/s3/putobject-progress.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import (
"log"
"github.com/cheggaaa/pb"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/putobject-s3-accelerate.go b/examples/s3/putobject-s3-accelerate.go
index 06345cd..d36af0a 100644
--- a/examples/s3/putobject-s3-accelerate.go
+++ b/examples/s3/putobject-s3-accelerate.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import (
"log"
"os"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/putobject-streaming.go b/examples/s3/putobject-streaming.go
index 85b78dd..a90e472 100644
--- a/examples/s3/putobject-streaming.go
+++ b/examples/s3/putobject-streaming.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import (
"log"
"os"
- minio "github.com/minio/minio-go"
+ minio "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/putobject.go b/examples/s3/putobject.go
index b9e4ff1..31969e0 100644
--- a/examples/s3/putobject.go
+++ b/examples/s3/putobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import (
"log"
"os"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/putobjectretention.go b/examples/s3/putobjectretention.go
new file mode 100644
index 0000000..b0db21a
--- /dev/null
+++ b/examples/s3/putobjectretention.go
@@ -0,0 +1,54 @@
+// +build ignore
+
+/*
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2019 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"
+ "time"
+
+ "github.com/minio/minio-go/v6"
+)
+
+func main() {
+ // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname, my-objectname and
+ // my-testfile are dummy values, please replace them with original values.
+
+ // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
+ // This boolean value is the last argument for New().
+
+ // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
+ // determined based on the Endpoint value.
+ s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESS-KEY-HERE", "YOUR-SECRET-KEY-HERE", true)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ t := time.Date(2020, time.November, 18, 14, 0, 0, 0, time.UTC)
+ m := minio.RetentionMode(minio.Governance)
+ opts := minio.PutObjectRetentionOptions{
+ GovernanceBypass: true,
+ RetainUntilDate: &t,
+ Mode: &m,
+ }
+ err = s3Client.PutObjectRetention("my-bucket", "my-object", opts)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ log.Println("Set object retention on my-object successfully.")
+}
diff --git a/examples/s3/removeallbucketnotification.go b/examples/s3/removeallbucketnotification.go
index 1186afa..afd8ce1 100644
--- a/examples/s3/removeallbucketnotification.go
+++ b/examples/s3/removeallbucketnotification.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/removebucket.go b/examples/s3/removebucket.go
index 7a7737e..7f2295e 100644
--- a/examples/s3/removebucket.go
+++ b/examples/s3/removebucket.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/removeincompleteupload.go b/examples/s3/removeincompleteupload.go
index 31cc879..9b941ea 100644
--- a/examples/s3/removeincompleteupload.go
+++ b/examples/s3/removeincompleteupload.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/removeobject.go b/examples/s3/removeobject.go
index 7e58485..967ec8c 100644
--- a/examples/s3/removeobject.go
+++ b/examples/s3/removeobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/removeobjectoptions.go b/examples/s3/removeobjectoptions.go
new file mode 100644
index 0000000..926d80e
--- /dev/null
+++ b/examples/s3/removeobjectoptions.go
@@ -0,0 +1,49 @@
+// +build ignore
+
+/*
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2019 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/v6"
+)
+
+func main() {
+ // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname, my-objectname and
+ // my-testfile are dummy values, please replace them with original values.
+
+ // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
+ // This boolean value is the last argument for New().
+
+ // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
+ // determined based on the Endpoint value.
+ s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESS-KEY-HERE", "YOUR-SECRET-KEY-HERE", true)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ opts := minio.RemoveObjectOptions{
+ GovernanceBypass: true,
+ }
+ err = s3Client.RemoveObjectWithOptions("my-bucket", "my-object", opts)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ log.Println("Remove object successful")
+}
diff --git a/examples/s3/removeobjects.go b/examples/s3/removeobjects.go
index a581134..d453bee 100644
--- a/examples/s3/removeobjects.go
+++ b/examples/s3/removeobjects.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/selectobject.go b/examples/s3/selectobject.go
index e23ccf8..e7a8370 100644
--- a/examples/s3/selectobject.go
+++ b/examples/s3/selectobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2018 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2018 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ import (
"log"
"os"
- minio "github.com/minio/minio-go"
+ minio "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/setbucketlifecycle.go b/examples/s3/setbucketlifecycle.go
index 7eaa946..362caa8 100644
--- a/examples/s3/setbucketlifecycle.go
+++ b/examples/s3/setbucketlifecycle.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/setbucketnotification.go b/examples/s3/setbucketnotification.go
index b5af30f..bb6ab5e 100644
--- a/examples/s3/setbucketnotification.go
+++ b/examples/s3/setbucketnotification.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/setbucketobjectlockconfig.go b/examples/s3/setbucketobjectlockconfig.go
new file mode 100644
index 0000000..8034969
--- /dev/null
+++ b/examples/s3/setbucketobjectlockconfig.go
@@ -0,0 +1,54 @@
+// +build ignore
+
+/*
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2019 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"
+
+ minio "github.com/minio/minio-go/v6"
+)
+
+func main() {
+ // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname are
+ // dummy values, please replace them with original values.
+
+ // Requests are always secure (HTTPS) by default. Set secure=false to enable insecure (HTTP) access.
+ // This boolean value is the last argument for New().
+
+ // New returns an Amazon S3 compatible client object. API compatibility (v2 or v4) is automatically
+ // determined based on the Endpoint value.
+ s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true)
+ if err != nil {
+ log.Fatalln(err)
+ }
+
+ // s3Client.TraceOn(os.Stderr)
+
+ // Set object lock configuration.
+ mode := minio.Governance
+ validity := uint(30)
+ unit := minio.Days
+
+ err = s3Client.SetBucketObjectLockConfig("my-bucketname", &mode, &validity, &unit)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ log.Println("Success")
+}
diff --git a/examples/s3/setbucketpolicy.go b/examples/s3/setbucketpolicy.go
index bc42da8..6076278 100644
--- a/examples/s3/setbucketpolicy.go
+++ b/examples/s3/setbucketpolicy.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {
diff --git a/examples/s3/statobject.go b/examples/s3/statobject.go
index 0b27a83..9e8fec6 100644
--- a/examples/s3/statobject.go
+++ b/examples/s3/statobject.go
@@ -1,8 +1,8 @@
// +build ignore
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * Copyright 2015-2017 Minio, Inc.
+ * MinIO Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2015-2017 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ package main
import (
"log"
- "github.com/minio/minio-go"
+ "github.com/minio/minio-go/v6"
)
func main() {