stubbed in jira output

This commit is contained in:
Colin Henry 2015-10-12 23:16:05 -07:00
parent 7b8c214418
commit 65f2455009
3 changed files with 39 additions and 5 deletions

View File

@ -42,9 +42,9 @@ func newIssue(f []string) *issue {
} }
} }
func toJSON(i *issue) string { func toJSON(i *issue) []byte {
b, _ := json.Marshal(i) b, _ := json.Marshal(i)
return string(b) return b
} }
func toIssueType(t string) string { func toIssueType(t string) string {

36
jira.go Normal file
View File

@ -0,0 +1,36 @@
package main
import (
"bytes"
"crypto/tls"
"fmt"
"net/http"
)
// func init() {
// client =
// }
func submitIssue(i []string) error {
client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}
issue := newIssue(i)
issueJSON := toJSON(issue)
uri := fmt.Sprintf("%s/rest/api/2/issue/", svr)
req, _ := http.NewRequest("POST", uri, bytes.NewBuffer(issueJSON))
req.Header.Set("Content-Type", "application/json")
req.SetBasicAuth(*user, *pass)
/*resp*/ _, err := client.Do(req)
if err != nil {
return err
}
return nil
}

View File

@ -26,8 +26,6 @@ func main() {
bufrdr.ReadLine() bufrdr.ReadLine()
csvrdr := csv.NewReader(bufrdr) csvrdr := csv.NewReader(bufrdr)
processIssue(csvrdr, printJSON) processIssue(csvrdr, printJSON)
fmt.Println("I GET HERE!")
} }
func processIssue(r *csv.Reader, process func(issue []string) error) error { func processIssue(r *csv.Reader, process func(issue []string) error) error {
@ -55,6 +53,6 @@ func printCSV(issue []string) error {
} }
func printJSON(issue []string) error { func printJSON(issue []string) error {
i := newIssue(issue) i := newIssue(issue)
fmt.Println(toJSON(i)) fmt.Println(string(toJSON(i)))
return nil return nil
} }