-
Notifications
You must be signed in to change notification settings - Fork 613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AssumeRole support for rotating credentials #1265
Conversation
fee3556
to
0bdb7ab
Compare
4ff7491
to
30c09f7
Compare
package main
import (
"fmt"
"log"
"github.com/minio/minio-go/v6/pkg/credentials"
)
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.
creds, err := credentials.NewSTSAssumeRole("http://localhost:9000", credentials.STSAssumeRoleOptions{
AccessKey: "harsha",
SecretKey: "harsha123",
Location: "us-east-1",
})
if err != nil {
log.Fatalln(err)
}
v, err := creds.Get()
if err != nil {
log.Fatalln(err)
}
fmt.Println(v)
// mclnt, err := madmin.NewWithOptions("localhost:9000", &madmin.Options{
// Creds: creds,
// Secure: false,
// })
// if err != nil {
// log.Fatalln(err)
// }
// sinfo, err := mclnt.StorageInfo(context.Background())
// if err != nil {
// log.Fatalln(err)
// }
// fmt.Println(sinfo)
} @Alevsk is the way to use this change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments.
@harshavardhana your test code doesn't seem to work with MinIO master (2020/04/13 14:53:02 400 Bad Request), is this expected ?
This comment has been minimized.
This comment has been minimized.
30c09f7
to
adcc62b
Compare
adcc62b
to
70339c4
Compare
Runs perfectly fine
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM & tested
No description provided.