From 961c04cae992eadb42d286d2f85f8a675bdc68c8 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 29 Jan 2018 14:17:40 -0800 Subject: Upgrading server dependancies (#8154) --- .../minio/minio-go/examples/s3/bucketexists.go | 3 +- .../minio/minio-go/examples/s3/composeobject.go | 3 +- .../minio/minio-go/examples/s3/copyobject.go | 3 +- .../minio-go/examples/s3/fgetobject-context.go | 54 +++++++++++++++ .../minio/minio-go/examples/s3/fgetobject.go | 5 +- .../minio-go/examples/s3/fputencrypted-object.go | 80 ++++++++++++++++++++++ .../minio-go/examples/s3/fputobject-context.go | 53 ++++++++++++++ .../minio/minio-go/examples/s3/fputobject.go | 7 +- .../minio-go/examples/s3/get-encrypted-object.go | 3 +- .../minio-go/examples/s3/getbucketnotification.go | 3 +- .../minio/minio-go/examples/s3/getbucketpolicy.go | 3 +- .../minio-go/examples/s3/getobject-context.go | 73 ++++++++++++++++++++ .../minio/minio-go/examples/s3/getobject.go | 5 +- .../minio-go/examples/s3/listbucketpolicies.go | 3 +- .../minio/minio-go/examples/s3/listbuckets.go | 3 +- .../minio-go/examples/s3/listincompleteuploads.go | 3 +- .../minio/minio-go/examples/s3/listobjects-N.go | 3 +- .../minio/minio-go/examples/s3/listobjects.go | 3 +- .../minio/minio-go/examples/s3/listobjectsV2.go | 3 +- .../minio/minio-go/examples/s3/makebucket.go | 3 +- .../minio-go/examples/s3/presignedgetobject.go | 3 +- .../minio-go/examples/s3/presignedheadobject.go | 3 +- .../minio-go/examples/s3/presignedpostpolicy.go | 3 +- .../minio-go/examples/s3/presignedputobject.go | 3 +- .../minio-go/examples/s3/put-encrypted-object.go | 5 +- .../minio-go/examples/s3/putobject-context.go | 68 ++++++++++++++++++ .../examples/s3/putobject-getobject-sse.go | 20 +++--- .../minio-go/examples/s3/putobject-progress.go | 9 ++- .../examples/s3/putobject-s3-accelerate.go | 10 ++- .../minio-go/examples/s3/putobject-streaming.go | 5 +- .../minio/minio-go/examples/s3/putobject.go | 9 ++- .../examples/s3/removeallbucketnotification.go | 3 +- .../minio/minio-go/examples/s3/removebucket.go | 3 +- .../minio-go/examples/s3/removeincompleteupload.go | 3 +- .../minio/minio-go/examples/s3/removeobject.go | 3 +- .../minio/minio-go/examples/s3/removeobjects.go | 12 ++-- .../minio-go/examples/s3/setbucketnotification.go | 3 +- .../minio/minio-go/examples/s3/setbucketpolicy.go | 3 +- .../minio/minio-go/examples/s3/statobject.go | 5 +- 39 files changed, 431 insertions(+), 58 deletions(-) create mode 100644 vendor/github.com/minio/minio-go/examples/s3/fgetobject-context.go create mode 100644 vendor/github.com/minio/minio-go/examples/s3/fputencrypted-object.go create mode 100644 vendor/github.com/minio/minio-go/examples/s3/fputobject-context.go create mode 100644 vendor/github.com/minio/minio-go/examples/s3/getobject-context.go create mode 100644 vendor/github.com/minio/minio-go/examples/s3/putobject-context.go (limited to 'vendor/github.com/minio/minio-go/examples/s3') diff --git a/vendor/github.com/minio/minio-go/examples/s3/bucketexists.go b/vendor/github.com/minio/minio-go/examples/s3/bucketexists.go index 945510db8..20dea30a3 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/bucketexists.go +++ b/vendor/github.com/minio/minio-go/examples/s3/bucketexists.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/composeobject.go b/vendor/github.com/minio/minio-go/examples/s3/composeobject.go index 8aec6c158..2f76ff053 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/composeobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/composeobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2016 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/copyobject.go b/vendor/github.com/minio/minio-go/examples/s3/copyobject.go index c1d92d73a..a7c3eca45 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/copyobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/copyobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2016 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/fgetobject-context.go b/vendor/github.com/minio/minio-go/examples/s3/fgetobject-context.go new file mode 100644 index 000000000..6004baa14 --- /dev/null +++ b/vendor/github.com/minio/minio-go/examples/s3/fgetobject-context.go @@ -0,0 +1,54 @@ +// +build ignore + +/* + * 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. + * 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" + + "context" + + "github.com/minio/minio-go" +) + +func main() { + // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname, my-objectname + // and my-filename.csv 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) + } + + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) + defer cancel() + + if err := s3Client.FGetObjectWithContext(ctx, "my-bucketname", "my-objectname", "my-filename.csv", minio.GetObjectOptions{}); err != nil { + log.Fatalln(err) + } + log.Println("Successfully saved my-filename.csv") + +} diff --git a/vendor/github.com/minio/minio-go/examples/s3/fgetobject.go b/vendor/github.com/minio/minio-go/examples/s3/fgetobject.go index bef756dd6..819a34f91 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/fgetobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/fgetobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. @@ -38,7 +39,7 @@ func main() { log.Fatalln(err) } - if err := s3Client.FGetObject("my-bucketname", "my-objectname", "my-filename.csv"); err != nil { + if err := s3Client.FGetObject("my-bucketname", "my-objectname", "my-filename.csv", minio.GetObjectOptions{}); err != nil { log.Fatalln(err) } log.Println("Successfully saved my-filename.csv") diff --git a/vendor/github.com/minio/minio-go/examples/s3/fputencrypted-object.go b/vendor/github.com/minio/minio-go/examples/s3/fputencrypted-object.go new file mode 100644 index 000000000..96eec7e8f --- /dev/null +++ b/vendor/github.com/minio/minio-go/examples/s3/fputencrypted-object.go @@ -0,0 +1,80 @@ +// +build ignore + +/* + * 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. + * 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" + "github.com/minio/minio-go/pkg/encrypt" +) + +func main() { + // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-testfile, my-bucketname and + // my-objectname 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) + } + + // Specify a local file that we will upload + filePath := "my-testfile" + + //// Build an asymmetric key from private and public files + // + // privateKey, err := ioutil.ReadFile("private.key") + // if err != nil { + // t.Fatal(err) + // } + // + // publicKey, err := ioutil.ReadFile("public.key") + // if err != nil { + // t.Fatal(err) + // } + // + // asymmetricKey, err := NewAsymmetricKey(privateKey, publicKey) + // if err != nil { + // t.Fatal(err) + // } + //// + + // Build a symmetric key + symmetricKey := encrypt.NewSymmetricKey([]byte("my-secret-key-00")) + + // Build encryption materials which will encrypt uploaded data + cbcMaterials, err := encrypt.NewCBCSecureMaterials(symmetricKey) + if err != nil { + log.Fatalln(err) + } + + // Encrypt file content and upload to the server + n, err := s3Client.FPutEncryptedObject("my-bucketname", "my-objectname", filePath, cbcMaterials) + if err != nil { + log.Fatalln(err) + } + + log.Println("Uploaded", "my-objectname", " of size: ", n, "Successfully.") +} diff --git a/vendor/github.com/minio/minio-go/examples/s3/fputobject-context.go b/vendor/github.com/minio/minio-go/examples/s3/fputobject-context.go new file mode 100644 index 000000000..d7c941c2b --- /dev/null +++ b/vendor/github.com/minio/minio-go/examples/s3/fputobject-context.go @@ -0,0 +1,53 @@ +// +build ignore + +/* + * 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. + * 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" + + "context" + + "github.com/minio/minio-go" +) + +func main() { + // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname, my-objectname + // and my-filename.csv 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) + } + + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) + defer cancel() + + if _, err := s3Client.FPutObjectWithContext(ctx, "my-bucketname", "my-objectname", "my-filename.csv", minio.PutObjectOptions{ContentType: "application/csv"}); err != nil { + log.Fatalln(err) + } + log.Println("Successfully uploaded my-filename.csv") +} diff --git a/vendor/github.com/minio/minio-go/examples/s3/fputobject.go b/vendor/github.com/minio/minio-go/examples/s3/fputobject.go index f4e60acff..34d876804 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/fputobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/fputobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. @@ -38,7 +39,9 @@ func main() { log.Fatalln(err) } - if _, err := s3Client.FPutObject("my-bucketname", "my-objectname", "my-filename.csv", "application/csv"); err != nil { + if _, err := s3Client.FPutObject("my-bucketname", "my-objectname", "my-filename.csv", minio.PutObjectOptions{ + ContentType: "application/csv", + }); err != nil { log.Fatalln(err) } log.Println("Successfully uploaded my-filename.csv") diff --git a/vendor/github.com/minio/minio-go/examples/s3/get-encrypted-object.go b/vendor/github.com/minio/minio-go/examples/s3/get-encrypted-object.go index 8f51f26ae..9783bebe8 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/get-encrypted-object.go +++ b/vendor/github.com/minio/minio-go/examples/s3/get-encrypted-object.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/getbucketnotification.go b/vendor/github.com/minio/minio-go/examples/s3/getbucketnotification.go index 67f010ef3..19349baaf 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/getbucketnotification.go +++ b/vendor/github.com/minio/minio-go/examples/s3/getbucketnotification.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015, 2016 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/getbucketpolicy.go b/vendor/github.com/minio/minio-go/examples/s3/getbucketpolicy.go index e5f960403..f9ac89b61 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/getbucketpolicy.go +++ b/vendor/github.com/minio/minio-go/examples/s3/getbucketpolicy.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015, 2016 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/getobject-context.go b/vendor/github.com/minio/minio-go/examples/s3/getobject-context.go new file mode 100644 index 000000000..c7d41707a --- /dev/null +++ b/vendor/github.com/minio/minio-go/examples/s3/getobject-context.go @@ -0,0 +1,73 @@ +// +build ignore + +/* + * 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. + * 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" + "time" + + "context" + + "github.com/minio/minio-go" +) + +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) + } + + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) + defer cancel() + + opts := minio.GetObjectOptions{} + opts.SetModified(time.Now().Round(10 * time.Minute)) // get object if was modified within the last 10 minutes + reader, err := s3Client.GetObjectWithContext(ctx, "my-bucketname", "my-objectname", opts) + if err != nil { + log.Fatalln(err) + } + defer reader.Close() + + localFile, err := os.Create("my-testfile") + if err != nil { + log.Fatalln(err) + } + defer localFile.Close() + + stat, err := reader.Stat() + if err != nil { + log.Fatalln(err) + } + + if _, err := io.CopyN(localFile, reader, stat.Size); err != nil { + log.Fatalln(err) + } +} diff --git a/vendor/github.com/minio/minio-go/examples/s3/getobject.go b/vendor/github.com/minio/minio-go/examples/s3/getobject.go index 96bb85505..e17ef8172 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/getobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/getobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. @@ -40,7 +41,7 @@ func main() { log.Fatalln(err) } - reader, err := s3Client.GetObject("my-bucketname", "my-objectname") + reader, err := s3Client.GetObject("my-bucketname", "my-objectname", minio.GetObjectOptions{}) if err != nil { log.Fatalln(err) } diff --git a/vendor/github.com/minio/minio-go/examples/s3/listbucketpolicies.go b/vendor/github.com/minio/minio-go/examples/s3/listbucketpolicies.go index 19a2d1b2b..43edd0c3d 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/listbucketpolicies.go +++ b/vendor/github.com/minio/minio-go/examples/s3/listbucketpolicies.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015, 2016 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/listbuckets.go b/vendor/github.com/minio/minio-go/examples/s3/listbuckets.go index 81a99e627..5eae587b4 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/listbuckets.go +++ b/vendor/github.com/minio/minio-go/examples/s3/listbuckets.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/listincompleteuploads.go b/vendor/github.com/minio/minio-go/examples/s3/listincompleteuploads.go index 34771e44b..a5a79b603 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/listincompleteuploads.go +++ b/vendor/github.com/minio/minio-go/examples/s3/listincompleteuploads.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/listobjects-N.go b/vendor/github.com/minio/minio-go/examples/s3/listobjects-N.go index 5dde36746..55bceb470 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/listobjects-N.go +++ b/vendor/github.com/minio/minio-go/examples/s3/listobjects-N.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/listobjects.go b/vendor/github.com/minio/minio-go/examples/s3/listobjects.go index 4fd5c069a..1da2e3faa 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/listobjects.go +++ b/vendor/github.com/minio/minio-go/examples/s3/listobjects.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/listobjectsV2.go b/vendor/github.com/minio/minio-go/examples/s3/listobjectsV2.go index b52b4dab8..190aec36b 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/listobjectsV2.go +++ b/vendor/github.com/minio/minio-go/examples/s3/listobjectsV2.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2016 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/makebucket.go b/vendor/github.com/minio/minio-go/examples/s3/makebucket.go index ae222a8af..419c96cf2 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/makebucket.go +++ b/vendor/github.com/minio/minio-go/examples/s3/makebucket.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/presignedgetobject.go b/vendor/github.com/minio/minio-go/examples/s3/presignedgetobject.go index 11be0c0a4..fd7fb9e8d 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/presignedgetobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/presignedgetobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/presignedheadobject.go b/vendor/github.com/minio/minio-go/examples/s3/presignedheadobject.go index 0332049e5..8dbc0a4b7 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/presignedheadobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/presignedheadobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/presignedpostpolicy.go b/vendor/github.com/minio/minio-go/examples/s3/presignedpostpolicy.go index 3f37cef38..205ac95a3 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/presignedpostpolicy.go +++ b/vendor/github.com/minio/minio-go/examples/s3/presignedpostpolicy.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/presignedputobject.go b/vendor/github.com/minio/minio-go/examples/s3/presignedputobject.go index 3db6f6e7b..b2f8b4f82 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/presignedputobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/presignedputobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/put-encrypted-object.go b/vendor/github.com/minio/minio-go/examples/s3/put-encrypted-object.go index b8f7e12f2..cdf09ac53 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/put-encrypted-object.go +++ b/vendor/github.com/minio/minio-go/examples/s3/put-encrypted-object.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. @@ -75,7 +76,7 @@ func main() { } // Encrypt file content and upload to the server - n, err := s3Client.PutEncryptedObject("my-bucketname", "my-objectname", file, cbcMaterials, nil, nil) + n, err := s3Client.PutEncryptedObject("my-bucketname", "my-objectname", file, cbcMaterials) if err != nil { log.Fatalln(err) } diff --git a/vendor/github.com/minio/minio-go/examples/s3/putobject-context.go b/vendor/github.com/minio/minio-go/examples/s3/putobject-context.go new file mode 100644 index 000000000..acc923f7e --- /dev/null +++ b/vendor/github.com/minio/minio-go/examples/s3/putobject-context.go @@ -0,0 +1,68 @@ +// +build ignore + +/* + * 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. + * 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" + "os" + "time" + + "context" + + "github.com/minio/minio-go" +) + +func main() { + // Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-testfile, my-bucketname and + // my-objectname 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) + } + + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) + defer cancel() + + object, err := os.Open("my-testfile") + if err != nil { + log.Fatalln(err) + } + defer object.Close() + + objectStat, err := object.Stat() + if err != nil { + log.Fatalln(err) + } + + n, err := s3Client.PutObjectWithContext(ctx, "my-bucketname", "my-objectname", object, objectStat.Size(), minio.PutObjectOptions{ + ContentType: "application/octet-stream", + }) + if err != nil { + log.Fatalln(err) + } + log.Println("Uploaded", "my-objectname", " of size: ", n, "Successfully.") +} diff --git a/vendor/github.com/minio/minio-go/examples/s3/putobject-getobject-sse.go b/vendor/github.com/minio/minio-go/examples/s3/putobject-getobject-sse.go index 92e6a4840..3d3b2fd2d 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/putobject-getobject-sse.go +++ b/vendor/github.com/minio/minio-go/examples/s3/putobject-getobject-sse.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 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,7 +25,6 @@ import ( "encoding/base64" "io/ioutil" "log" - "net/http" minio "github.com/minio/minio-go" ) @@ -54,24 +54,24 @@ func main() { // of the encryption key or to decrypt the contents of the // encrypted object. That means, if you lose the encryption // key, you lose the object. - var metadata = map[string][]string{ - "x-amz-server-side-encryption-customer-algorithm": []string{"AES256"}, - "x-amz-server-side-encryption-customer-key": []string{encryptionKey}, - "x-amz-server-side-encryption-customer-key-MD5": []string{encryptionKeyMD5}, + var metadata = map[string]string{ + "x-amz-server-side-encryption-customer-algorithm": "AES256", + "x-amz-server-side-encryption-customer-key": encryptionKey, + "x-amz-server-side-encryption-customer-key-MD5": encryptionKeyMD5, } // minioClient.TraceOn(os.Stderr) // Enable to debug. - _, err = minioClient.PutObjectWithMetadata("mybucket", "my-encrypted-object.txt", content, metadata, nil) + _, err = minioClient.PutObject("mybucket", "my-encrypted-object.txt", content, 11, minio.PutObjectOptions{UserMetadata: metadata}) if err != nil { log.Fatalln(err) } - var reqHeaders = minio.RequestHeaders{Header: http.Header{}} + opts := minio.GetObjectOptions{} for k, v := range metadata { - reqHeaders.Set(k, v[0]) + opts.Set(k, v) } coreClient := minio.Core{minioClient} - reader, _, err := coreClient.GetObject("mybucket", "my-encrypted-object.txt", reqHeaders) + reader, _, err := coreClient.GetObject("mybucket", "my-encrypted-object.txt", opts) if err != nil { log.Fatalln(err) } diff --git a/vendor/github.com/minio/minio-go/examples/s3/putobject-progress.go b/vendor/github.com/minio/minio-go/examples/s3/putobject-progress.go index 26e77b9e6..0e92dd65e 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/putobject-progress.go +++ b/vendor/github.com/minio/minio-go/examples/s3/putobject-progress.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. @@ -39,7 +40,7 @@ func main() { log.Fatalln(err) } - reader, err := s3Client.GetObject("my-bucketname", "my-objectname") + reader, err := s3Client.GetObject("my-bucketname", "my-objectname", minio.GetObjectOptions{}) if err != nil { log.Fatalln(err) } @@ -54,10 +55,8 @@ func main() { // the Reads inside. progress := pb.New64(objectInfo.Size) progress.Start() + n, err := s3Client.PutObject("my-bucketname", "my-objectname-progress", reader, objectInfo.Size, minio.PutObjectOptions{ContentType: "application/octet-stream", Progress: progress}) - n, err := s3Client.PutObjectWithProgress("my-bucketname", "my-objectname-progress", reader, map[string][]string{ - "Content-Type": []string{"application/octet-stream"}, - }, progress) if err != nil { log.Fatalln(err) } diff --git a/vendor/github.com/minio/minio-go/examples/s3/putobject-s3-accelerate.go b/vendor/github.com/minio/minio-go/examples/s3/putobject-s3-accelerate.go index a26415c7a..06345cd87 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/putobject-s3-accelerate.go +++ b/vendor/github.com/minio/minio-go/examples/s3/putobject-s3-accelerate.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2016 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. @@ -48,7 +49,12 @@ func main() { } defer object.Close() - n, err := s3Client.PutObject("my-bucketname", "my-objectname", object, "application/octet-stream") + objectStat, err := object.Stat() + if err != nil { + log.Fatalln(err) + } + + n, err := s3Client.PutObject("my-bucketname", "my-objectname", object, objectStat.Size(), minio.PutObjectOptions{ContentType: "application/octet-stream"}) if err != nil { log.Fatalln(err) } diff --git a/vendor/github.com/minio/minio-go/examples/s3/putobject-streaming.go b/vendor/github.com/minio/minio-go/examples/s3/putobject-streaming.go index d10407dbd..85b78dd45 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/putobject-streaming.go +++ b/vendor/github.com/minio/minio-go/examples/s3/putobject-streaming.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2016 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. @@ -45,7 +46,7 @@ func main() { } defer object.Close() - n, err := s3Client.PutObjectStreaming("my-bucketname", "my-objectname", object) + n, err := s3Client.PutObject("my-bucketname", "my-objectname", object, -1, minio.PutObjectOptions{}) if err != nil { log.Fatalln(err) } diff --git a/vendor/github.com/minio/minio-go/examples/s3/putobject.go b/vendor/github.com/minio/minio-go/examples/s3/putobject.go index caa731302..b9e4ff16c 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/putobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/putobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. @@ -44,8 +45,12 @@ func main() { log.Fatalln(err) } defer object.Close() + objectStat, err := object.Stat() + if err != nil { + log.Fatalln(err) + } - n, err := s3Client.PutObject("my-bucketname", "my-objectname", object, "application/octet-stream") + n, err := s3Client.PutObject("my-bucketname", "my-objectname", object, objectStat.Size(), minio.PutObjectOptions{ContentType: "application/octet-stream"}) if err != nil { log.Fatalln(err) } diff --git a/vendor/github.com/minio/minio-go/examples/s3/removeallbucketnotification.go b/vendor/github.com/minio/minio-go/examples/s3/removeallbucketnotification.go index 0f5f3a74d..1186afad8 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/removeallbucketnotification.go +++ b/vendor/github.com/minio/minio-go/examples/s3/removeallbucketnotification.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015, 2016 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/removebucket.go b/vendor/github.com/minio/minio-go/examples/s3/removebucket.go index fb013ca24..7a7737ee0 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/removebucket.go +++ b/vendor/github.com/minio/minio-go/examples/s3/removebucket.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/removeincompleteupload.go b/vendor/github.com/minio/minio-go/examples/s3/removeincompleteupload.go index d486182af..31cc8790b 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/removeincompleteupload.go +++ b/vendor/github.com/minio/minio-go/examples/s3/removeincompleteupload.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/removeobject.go b/vendor/github.com/minio/minio-go/examples/s3/removeobject.go index 13b00b41e..7e5848576 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/removeobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/removeobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/removeobjects.go b/vendor/github.com/minio/minio-go/examples/s3/removeobjects.go index 594606929..b912bc85d 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/removeobjects.go +++ b/vendor/github.com/minio/minio-go/examples/s3/removeobjects.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. @@ -20,7 +21,6 @@ package main import ( "log" - "strconv" "github.com/minio/minio-go" ) @@ -44,8 +44,12 @@ func main() { // Send object names that are needed to be removed to objectsCh go func() { defer close(objectsCh) - for i := 0; i < 10; i++ { - objectsCh <- "/path/to/my-objectname" + strconv.Itoa(i) + // List all objects from a bucket-name with a matching prefix. + for object := range s3Client.ListObjects("my-bucketname", "my-prefixname", true, doneCh) { + if object.Err != nil { + log.Fatalln(object.Err) + } + objectsCh <- object.Key } }() diff --git a/vendor/github.com/minio/minio-go/examples/s3/setbucketnotification.go b/vendor/github.com/minio/minio-go/examples/s3/setbucketnotification.go index 5fe1e318e..b5af30f06 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/setbucketnotification.go +++ b/vendor/github.com/minio/minio-go/examples/s3/setbucketnotification.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015, 2016 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/setbucketpolicy.go b/vendor/github.com/minio/minio-go/examples/s3/setbucketpolicy.go index 40906ee92..c81fb5050 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/setbucketpolicy.go +++ b/vendor/github.com/minio/minio-go/examples/s3/setbucketpolicy.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015, 2016 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. diff --git a/vendor/github.com/minio/minio-go/examples/s3/statobject.go b/vendor/github.com/minio/minio-go/examples/s3/statobject.go index 4c5453a07..0b27a83b3 100644 --- a/vendor/github.com/minio/minio-go/examples/s3/statobject.go +++ b/vendor/github.com/minio/minio-go/examples/s3/statobject.go @@ -1,7 +1,8 @@ // +build ignore /* - * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2015 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. @@ -37,7 +38,7 @@ func main() { if err != nil { log.Fatalln(err) } - stat, err := s3Client.StatObject("my-bucketname", "my-objectname") + stat, err := s3Client.StatObject("my-bucketname", "my-objectname", minio.StatObjectOptions{}) if err != nil { log.Fatalln(err) } -- cgit v1.2.3-1-g7c22