(t string, host string, token string, ownerGuid string)
| 1121 | ) |
| 1122 | |
| 1123 | func GetWSPolicies(t string, host string, token string, ownerGuid string) (ws []WorkspacePolicy, err error) { |
| 1124 | var response = "" |
| 1125 | url := fmt.Sprint(host, "/api/smartide/workspacepolicy/getList") |
| 1126 | |
| 1127 | httpClient := CreateHttpClientEnableRetry() |
| 1128 | response, err = httpClient.Get(url, map[string]string{"ownerGuid": ownerGuid, "type": t}, map[string]string{"Content-Type": "application/json", "x-token": token}) |
| 1129 | // response, err = Get(url, map[string]string{"ownerGuid": ownerGuid, "type": t}, map[string]string{"Content-Type": "application/json", "x-token": token}); |
| 1130 | if response != "" { |
| 1131 | l := &WSPolicyResponse{} |
| 1132 | //err = json.Unmarshal([]byte(response), l) |
| 1133 | if err = json.Unmarshal([]byte(response), l); err == nil { |
| 1134 | if l.Code == 0 && (len(l.Data.Workspacepolicies) != 0) { |
| 1135 | return l.Data.Workspacepolicies, err |
| 1136 | } |
| 1137 | } |
| 1138 | } |
| 1139 | return []WorkspacePolicy{}, err |
| 1140 | } |
| 1141 | |
| 1142 | // Add publickey to .ssh/authorized_keys file on remote host(vm mode) |
| 1143 | func (instance *SSHRemote) AddPublicKeyIntoAuthorizedkeys() { |
no test coverage detected