ticketing

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateHash

func GenerateHash(data string) string

Types

type Credentials

type Credentials struct {
	AgentID string
}

type Github

type Github struct {
	Client      *github.Client
	Context     context.Context
	Credentials GithubCredentials
	Config      config.Config
	Logger      zap.SugaredLogger
}

func NewGithub

func NewGithub(c config.Config, logger zap.SugaredLogger) *Github

func (*Github) Connect

func (g *Github) Connect() error

func (*Github) Create

func (g *Github) Create(ticket *Ticket) error

func (*Github) Fetch

func (g *Github) Fetch(ticket *Ticket) error

func (*Github) FetchRemoteTicket

func (g *Github) FetchRemoteTicket(remoteData interface{}) (Ticket, error)

func (*Github) GenerateTemplate

func (g *Github) GenerateTemplate(ticket *Ticket) (TicketTemplate, error)

func (*Github) ParseCredentials

func (g *Github) ParseCredentials(creds interface{}) error

func (*Github) TicketExists

func (g *Github) TicketExists(ticket *Ticket) (bool, database.TicketDetails, error)

func (*Github) Update

func (g *Github) Update(ticket *Ticket) error

type GithubCredentials

type GithubCredentials struct {
	Credentials
	AccessToken    string `json:"access_token"`
	InstallationID string `json:"installation_id"`
	GithubRepo
}

type GithubRepo

type GithubRepo struct {
	Repo  string `json:"repo"`
	Owner string `json:"owner"`
}

type Hash

type Hash string

type Jira

type Jira struct {
	Client      *jira.Client
	Context     context.Context
	Config      config.Config
	Logger      zap.SugaredLogger
	Credentials JiraCredentials
}

func NewJira

func NewJira(c config.Config, logger zap.SugaredLogger) *Jira

func (*Jira) Connect

func (j *Jira) Connect() error

func (*Jira) Create

func (j *Jira) Create(ticket *Ticket) error

func (Jira) Fetch

func (j Jira) Fetch(ticket *Ticket) error

func (Jira) FetchRemoteTicket

func (j Jira) FetchRemoteTicket(data interface{}) (Ticket, error)

func (*Jira) GenerateTemplate

func (j *Jira) GenerateTemplate(ticket *Ticket) (TicketTemplate, error)

func (*Jira) ParseCredentials

func (j *Jira) ParseCredentials(creds interface{}) error

func (Jira) TicketExists

func (j Jira) TicketExists(ticket *Ticket) (bool, database.TicketDetails, error)

func (Jira) Update

func (j Jira) Update(ticket *Ticket) error

nolint: gocyclo

type JiraCredentials

type JiraCredentials struct {
	Username    string `json:"username"`
	Token       string `json:"token"`
	Host        string `json:"host"`
	JiraProject `json:"jira_project"`
	Credentials
}

type JiraProject

type JiraProject struct {
	Name string `json:"name,omitempty"`
	Key  string `json:"key,omitempty"`
}

type Status

type Status string

type Ticket

type Ticket struct {
	Level         string `json:"level"`
	LevelNumber   string `json:"level_number"`
	Bug           string `json:"bug"`
	Raw           string `json:"raw"`
	AgentID       string `json:"agent_id"`
	Line          string `json:"line"`
	File          string `json:"file"`
	TimesReported int    `json:"times_reported" default:"1"`

	RemoteID      string      `json:"remote_id"`
	RemoteDetails interface{} `json:"remote_details"`
	Hash          Hash        `json:"hash"`
	State         string      `json:"state"`
	RemoteLink    string      `json:"remote_link"`
	RemoteSystem  string      `json:"remote_system"`
}

type TicketID

type TicketID string

type TicketTemplate

type TicketTemplate struct {
	Title  string      `json:"title"`
	Body   interface{} `json:"body"`
	Labels []string    `json:"labels"`
	Level  string      `json:"level"`
}

type Ticketing

type Ticketing struct {
	Config config.Config
	Logger zap.SugaredLogger
}

func NewTicketing

func NewTicketing(c config.Config, logger zap.SugaredLogger) *Ticketing

func (Ticketing) CreateTicket

func (t Ticketing) CreateTicket(ticket *Ticket) error

func (Ticketing) CreateTicketHandler

func (t Ticketing) CreateTicketHandler(w http.ResponseWriter, r *http.Request)

func (Ticketing) TicketCreate

func (t Ticketing) TicketCreate(system TicketingSystem, creds database.TicketingCredentials, ticket *Ticket) error

type TicketingSystem

type TicketingSystem interface {
	Connect() error

	ParseCredentials(interface{}) error
	FetchRemoteTicket(interface{}) (Ticket, error)

	Create(*Ticket) error
	Update(*Ticket) error
	Fetch(*Ticket) error

	GenerateTemplate(*Ticket) (TicketTemplate, error)
	TicketExists(*Ticket) (bool, database.TicketDetails, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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