forked from JointCloud/pcm-hpc
54 lines
1004 B
Go
54 lines
1004 B
Go
package ac
|
|
|
|
import (
|
|
"log"
|
|
"sync"
|
|
)
|
|
|
|
type token struct {
|
|
sync.RWMutex
|
|
client *client
|
|
options *JobOptions
|
|
log log.Logger
|
|
}
|
|
|
|
type ACTokenResp struct {
|
|
Msg string
|
|
Code string
|
|
Data []*ACTokenData
|
|
}
|
|
type ACTokenData struct {
|
|
ClusterName string
|
|
ClusterId string
|
|
Token string
|
|
}
|
|
|
|
func newToken(client *client, options *ClientOptions) (*token, error) {
|
|
token := &token{
|
|
RWMutex: sync.RWMutex{},
|
|
client: nil,
|
|
options: nil,
|
|
log: log.Logger{},
|
|
}
|
|
return token, nil
|
|
}
|
|
func (t *token) GetToken(options ClientOptions) string {
|
|
//var respAC hpcAC.ACTokenResp
|
|
//var tokenString string
|
|
//httpClient := resty.New().R()
|
|
//params := map[string]string{
|
|
// "user": options.User,
|
|
// "password": options.Password,
|
|
// "orgId": options.OrgId,
|
|
//}
|
|
//
|
|
//httpClient.SetHeaders(params).SetResult(&respAC).Post(options.TokenUrl)
|
|
//for _, dt := range respAC.Data {
|
|
// if dt.ClusterId == "11276" {
|
|
// tokenString = dt.Token
|
|
// }
|
|
//}
|
|
tokenString := ""
|
|
return tokenString
|
|
}
|