pcm-hpc/ac/client_impl.go

58 lines
1.2 KiB
Go

package ac
type client struct {
clusterUrl string
tokenUrl string
stateUrl string
user string
password string
orgId string
endPoint string
token string
clusterID string
baseEndpoint string
acStatus map[string]string
}
func (c *client) Token(options ClientOptions) (Token, error) {
token, _ := newToken(c, &options)
return token, nil
}
func (c *client) Job(options JobOptions) (Job, error) {
job, _ := newJob(c, &options)
return job, nil
}
func newClient(options ClientOptions) (Client, error) {
status := map[string]string{
"statQ": "Pending",
"statR": "Running",
"statE": "Pending",
"statC": "Completed",
"statH": "Pending",
"statS": "Pending",
"statW": "Pending",
"statX": "Other",
}
c := &client{
clusterUrl: options.ClusterUrl,
tokenUrl: options.TokenUrl,
stateUrl: options.StateUrl,
user: options.User,
password: options.Password,
orgId: options.OrgId,
endPoint: options.EndPoint,
token: "",
clusterID: options.ClusterID,
baseEndpoint: options.BaseEndpoint,
acStatus: status,
}
t, _ := newToken(c, &options)
tokenString := t.GetToken(options)
c.token = tokenString
return c, nil
}