mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
update STS examples to use latest v7 APIs
This commit is contained in:
parent
00124c56d9
commit
4442382c16
@ -20,6 +20,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
@ -112,13 +113,13 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
clnt, err := minio.NewWithOptions(u.Host, opts)
|
clnt, err := minio.New(u.Host, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d := bytes.NewReader([]byte("Hello, World"))
|
d := bytes.NewReader([]byte("Hello, World"))
|
||||||
n, err := clnt.PutObject("my-bucketname", "my-objectname", d, d.Size(), minio.PutObjectOptions{})
|
n, err := clnt.PutObject(context.Background(), "my-bucketname", "my-objectname", d, d.Size(), minio.PutObjectOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
@ -221,13 +221,13 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
clnt, err := minio.NewWithOptions(u.Host, opts)
|
clnt, err := minio.New(u.Host, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(fmt.Errorf("Error while initializing Minio client, %s", err))
|
log.Println(fmt.Errorf("Error while initializing Minio client, %s", err))
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
buckets, err := clnt.ListBuckets()
|
buckets, err := clnt.ListBuckets(r.Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(fmt.Errorf("Error while listing buckets, %s", err))
|
log.Println(fmt.Errorf("Error while listing buckets, %s", err))
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
|
Loading…
Reference in New Issue
Block a user