package internal
import (
"context"
"crypto/tls"
"github.com/pkg/errors"
"gitlab.com/pcanilho/go-jira"
"net/http"
)
type jiraController struct {
client *jira.Client
ctx context.Context
username string
}
func NewJira(ctx context.Context, username, password, url string, skipVerifyTLS bool) (*jiraController, error) {
jiraHttpClient := jira.BasicAuthTransport{
Username: username,
Password: password,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: skipVerifyTLS},
},
}
client, err := jira.NewClient(jiraHttpClient.Client(), url)
if err != nil {
return nil, errors.Wrapf(err, "failed to authenticate with the Jira instance at [%s]", url)
}
if ctx == nil {
ctx = context.Background()
}
return &jiraController{ctx: ctx, client: client, username: username}, nil
}
|
The pages are generated with Golds v0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |