From e6dc506c05ac5ee0ec1c0c4fc1c7a3b3ae89ccf0 Mon Sep 17 00:00:00 2001 From: Ayushi Sharma Date: Mon, 9 Dec 2024 23:01:20 +0530 Subject: [PATCH] debug: create client with fresh sts token --- plugins/providers/maxcompute/provider.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/providers/maxcompute/provider.go b/plugins/providers/maxcompute/provider.go index c47bad88e..8e90f6ee9 100644 --- a/plugins/providers/maxcompute/provider.go +++ b/plugins/providers/maxcompute/provider.go @@ -7,6 +7,7 @@ import ( "slices" "strings" "sync" + "time" openapi "github.com/alibabacloud-go/darabonba-openapi/client" openapiv2 "github.com/alibabacloud-go/darabonba-openapi/v2/client" @@ -14,6 +15,7 @@ import ( sts "github.com/alibabacloud-go/sts-20150401/client" "github.com/aliyun/aliyun-odps-go-sdk/odps" "github.com/aliyun/aliyun-odps-go-sdk/odps/account" + "github.com/aliyun/aliyun-odps-go-sdk/odps/common" "github.com/aliyun/aliyun-odps-go-sdk/odps/restclient" "github.com/aliyun/aliyun-odps-go-sdk/odps/security" pv "github.com/goto/guardian/core/provider" @@ -412,13 +414,13 @@ func (p *provider) getRestClient(pc *domain.ProviderConfig) (*maxcompute.Client, func (p *provider) getOdpsClient(pc *domain.ProviderConfig, overrideRAMRole string) (*odps.Odps, error) { usingRAMRole := overrideRAMRole != "" - if usingRAMRole { - if client, ok := p.odpsClients[overrideRAMRole]; ok { - return client, nil - } - } else if client, ok := p.odpsClients[pc.URN]; ok { - return client, nil - } + // if usingRAMRole { + // if client, ok := p.odpsClients[overrideRAMRole]; ok { + // return client, nil + // } + // } else if client, ok := p.odpsClients[pc.URN]; ok { + // return client, nil + // } creds, err := p.getCreds(pc) if err != nil { @@ -433,6 +435,11 @@ func (p *provider) getOdpsClient(pc *domain.ProviderConfig, overrideRAMRole stri if err != nil { return nil, err } + + fmt.Println("gmt location ", common.GMT) + gmtTime := time.Now().In(common.GMT).Format(time.RFC1123) + fmt.Println("gmtTime: ", gmtTime) + var acc account.Account if creds.RAMRole != "" { acc = account.NewStsAccount(*clientConfig.AccessKeyId, *clientConfig.AccessKeySecret, *clientConfig.SecurityToken)