jira

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package jira manages the communication with a Jira server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDescriptionText

func GenerateDescriptionText(ticketDescription, findingID, teamID string) string

GenerateDescriptionText generate description using the original description and the finding and team identifiers.

func GenerateIdentificationText

func GenerateIdentificationText(findingID, teamID string) string

GenerateIdentificationText generate the part of the description that contains the identifiers.

Types

type Client

type Client struct {
	Issuer
}

Client represents a specific Jira client.

func NewClient

func NewClient(url, token string) (*Client, error)

NewClient instantiates a client using go-jira library.

func (*Client) CreateTicket

func (cl *Client) CreateTicket(ticket model.Ticket) (model.Ticket, error)

CreateTicket creates a ticket in Jira.

func (*Client) FindTicket

func (cl *Client) FindTicket(projectKey, vulnerabilityIssueType, text string) (model.Ticket, error)

FindTicket search tickets and return the first one if it exists. The arguments needed to search a ticket are the project key, the issue type and a text that have to be present on the ticket description. Return a nil ticket if not found.

func (*Client) GetTicket

func (cl *Client) GetTicket(id string) (model.Ticket, error)

GetTicket retrieves a ticket from Jira. Return an empty ticket if not found.

type Issuer

type Issuer interface {
	Get(issueID string, options *gojira.GetQueryOptions) (*gojira.Issue, *gojira.Response, error)
	Search(jql string, options *gojira.SearchOptions) ([]gojira.Issue, *gojira.Response, error)
	Create(issue *gojira.Issue) (*gojira.Issue, *gojira.Response, error)
}

Issuer manages all the operations related with the ticket tracker issues.

type TicketTrackingClient

type TicketTrackingClient interface {
	GetTicket(id string) (model.Ticket, error)
	FindTicket(projectKey, vulnerabilityIssueType, text string) (model.Ticket, error)
	CreateTicket(ticket model.Ticket) (model.Ticket, error)
}

TicketTrackingClient defines the API of the adapter for a third-party client.

type TrackerClient

type TrackerClient struct {
	Client TicketTrackingClient
	Logger echo.Logger
	URL    string
}

TrackerClient represents a Jira ticket tracker client.

func New

func New(url, token string, logger echo.Logger) (*TrackerClient, error)

New instantiates a new Jira connection.

func (*TrackerClient) CreateTicket

func (tc *TrackerClient) CreateTicket(ticket model.Ticket) (model.Ticket, error)

CreateTicket creates a ticket in Jira.

func (*TrackerClient) GetTicket

func (tc *TrackerClient) GetTicket(id string) (model.Ticket, error)

GetTicket retrieves a ticket from Jira. Return an empty ticket if not found.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL