Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 20 additions & 23 deletions dth/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,26 @@ func getCredentials(ctx context.Context, param string, inCurrentAccount bool, sm
noSignRequest: false,
}

// No need to do anything if inCurrentAccount is true
if !inCurrentAccount {
if param == "" {
// no credential is required.
cred.noSignRequest = true
} else {
credStr := sm.GetSecret(ctx, &param)
if credStr != nil {
credMap := make(map[string]string)
err := json.Unmarshal([]byte(*credStr), &credMap)
if err != nil {
log.Printf("Warning - Unable to parse the credentials string, please make sure the it is a valid json format. - %s\n", err.Error())
} else {
cred.accessKey = credMap["access_key_id"]
cred.secretKey = credMap["secret_access_key"]
}
// log.Println(*credStr)
// log.Println(credMap)
} else {
log.Printf("Credential parameter %s ignored, use default configuration\n", param)
}
}
}
if param == "" {
// no credential is required if not in current account
cred.noSignRequest = !inCurrentAccount
} else {
credStr := sm.GetSecret(ctx, &param)
if credStr != nil {
credMap := make(map[string]string)
err := json.Unmarshal([]byte(*credStr), &credMap)
if err != nil {
log.Printf("Warning - Unable to parse the credentials string, please make sure the it is a valid json format. - %s\n", err.Error())
} else {
cred.accessKey = credMap["access_key_id"]
cred.secretKey = credMap["secret_access_key"]
}
// log.Println(*credStr)
// log.Println(credMap)
} else {
log.Printf("Credential parameter %s ignored, use default configuration\n", param)
}
}
return cred
}

Expand Down