-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathcredentials.go
More file actions
32 lines (27 loc) · 849 Bytes
/
credentials.go
File metadata and controls
32 lines (27 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"encoding/json"
"fmt"
"log"
"os"
)
func DecryptFolderCredentials(url string, folderName string, username string, password string) error {
folder, _ := GetFolder(url, folderName, username, password)
credentials := folder.GetCredentials()
script := GetDecryptScriptForCredentials(credentials)
response := ExecuteGroovyScriptOnJenkins(script, url, username, password)
fmt.Println(response)
return nil
}
func ApplyFolderCredentials(url string, folderName string, username string, password string) error {
var credentials Credentials
err := json.NewDecoder(os.Stdin).Decode(&credentials)
if err != nil {
log.Fatal(err)
panic(err)
}
script := GetApplyScriptForCredentials(credentials, folderName)
response := ExecuteGroovyScriptOnJenkins(script, url, username, password)
fmt.Println(response)
return nil
}