MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / GetWSPolicies

Function GetWSPolicies

cli/pkg/common/sshremote.go:1123–1140  ·  view source on GitHub ↗
(t string, host string, token string, ownerGuid string)

Source from the content-addressed store, hash-verified

1121)
1122
1123func 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)
1143func (instance *SSHRemote) AddPublicKeyIntoAuthorizedkeys() {

Callers 2

ExecSSHkeyPolicyMethod · 0.85
GetSSHkeyPolicyIdRsaFunction · 0.85

Calls 2

GetMethod · 0.45

Tested by

no test coverage detected