mirror of
https://github.com/rclone/rclone.git
synced 2025-01-22 14:19:56 +01:00
backend/s3: replace deprecated session.New() with session.NewSession()
This commit is contained in:
parent
0c6f14c694
commit
fef2c6bf7a
@ -1039,6 +1039,12 @@ func s3Connection(opt *Options) (*s3.S3, *session.Session, error) {
|
|||||||
def := defaults.Get()
|
def := defaults.Get()
|
||||||
def.Config.HTTPClient = lowTimeoutClient
|
def.Config.HTTPClient = lowTimeoutClient
|
||||||
|
|
||||||
|
// start a new AWS session
|
||||||
|
awsSession, err := session.NewSession()
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, errors.Wrap(err, "NewSession")
|
||||||
|
}
|
||||||
|
|
||||||
// first provider to supply a credential set "wins"
|
// first provider to supply a credential set "wins"
|
||||||
providers := []credentials.Provider{
|
providers := []credentials.Provider{
|
||||||
// use static credentials if they're present (checked by provider)
|
// use static credentials if they're present (checked by provider)
|
||||||
@ -1058,7 +1064,7 @@ func s3Connection(opt *Options) (*s3.S3, *session.Session, error) {
|
|||||||
|
|
||||||
// Pick up IAM role in case we're on EC2
|
// Pick up IAM role in case we're on EC2
|
||||||
&ec2rolecreds.EC2RoleProvider{
|
&ec2rolecreds.EC2RoleProvider{
|
||||||
Client: ec2metadata.New(session.New(), &aws.Config{
|
Client: ec2metadata.New(awsSession, &aws.Config{
|
||||||
HTTPClient: lowTimeoutClient,
|
HTTPClient: lowTimeoutClient,
|
||||||
}),
|
}),
|
||||||
ExpiryWindow: 3 * time.Minute,
|
ExpiryWindow: 3 * time.Minute,
|
||||||
|
Loading…
Reference in New Issue
Block a user