From f4c99fc938b62e43d93411feec07a6413e194dd6 Mon Sep 17 00:00:00 2001 From: "xiujie.1" Date: Wed, 12 Feb 2025 15:55:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20sts=20provider=20support=20specifying=20?= =?UTF-8?q?region=E3=80=81schema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- volcengine/credentials/sts_credentials.go | 6 +++++- volcengine/credentials/sts_provider.go | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/volcengine/credentials/sts_credentials.go b/volcengine/credentials/sts_credentials.go index 989f1acf..28ec7206 100644 --- a/volcengine/credentials/sts_credentials.go +++ b/volcengine/credentials/sts_credentials.go @@ -15,6 +15,7 @@ type StsAssumeRoleProvider struct { AccountId string Host string Region string + Schema string Timeout time.Duration DurationSeconds int } @@ -27,11 +28,14 @@ type StsAssumeRoleTime struct { func StsAssumeRole(p *StsAssumeRoleProvider) (*Credentials, *StsAssumeRoleTime, error) { ins := sts.NewInstance() if p.Region != "" { - ins.SetRegion(p.Region) + ins.Client.ServiceInfo.Credentials.Region = p.Region } if p.Host != "" { ins.SetHost(p.Host) } + if p.Schema != "" { + ins.SetSchema(p.Schema) + } if p.Timeout > 0 { ins.Client.SetTimeout(p.Timeout) } diff --git a/volcengine/credentials/sts_provider.go b/volcengine/credentials/sts_provider.go index 20465271..388c85ef 100644 --- a/volcengine/credentials/sts_provider.go +++ b/volcengine/credentials/sts_provider.go @@ -19,11 +19,14 @@ type StsProvider struct { func (s *StsProvider) Retrieve() (Value, error) { ins := sts.NewInstance() if s.Region != "" { - ins.SetRegion(s.Region) + ins.Client.ServiceInfo.Credentials.Region = s.Region } if s.Host != "" { ins.SetHost(s.Host) } + if s.Schema != "" { + ins.SetSchema(s.Schema) + } if s.Timeout > 0 { ins.Client.SetTimeout(s.Timeout) }