Skip to content

Commit

Permalink
Merge branch 'fix/sts-assumerole-provider' into 'integration_2025-02-…
Browse files Browse the repository at this point in the history
…20_759074124290'

feat: [development task] core-update (1027606)

See merge request iaasng/volcengine-go-sdk!485
  • Loading branch information
BitsAdmin committed Feb 20, 2025
2 parents 3c79f9e + f4c99fc commit 3374df4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion volcengine/credentials/sts_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type StsAssumeRoleProvider struct {
AccountId string
Host string
Region string
Schema string
Timeout time.Duration
DurationSeconds int
}
Expand All @@ -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)
}
Expand Down
5 changes: 4 additions & 1 deletion volcengine/credentials/sts_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 3374df4

Please # to comment.