jira

package module
v0.0.0-...-ae36d4e Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeComment

func MakeComment(issueID, body string) message.Composer

MakeComment returns a self-contained composer for posting a comment to a single JIRA issue. This composer will override the issue set in the JIRA sender. The composer will not have a priority set

func MakeCommentSender

func MakeCommentSender(ctx context.Context, id string, opts *Options) (send.Sender, error)

MakeCommentSender is the same as NewJiraCommentLogger but uses a warning level of Trace

func MakeIssue

func MakeIssue(issue *Issue) message.Composer

MakeIssue creates a jiraMessage instance with the given JiraIssue.

func MakeIssueSender

func MakeIssueSender(ctx context.Context, opts *Options) (send.Sender, error)

MakeIssueSender is the same as NewJiraLogger but uses a warning level of Trace

func NewIssue

func NewIssue(project, summary string, fields ...Field) message.Composer

NewIssue creates and returns a fully formed jiraMessage, which implements message.Composer. project string and summary string are required, and any number of additional fields may be included. Fields with keys Reporter, Assignee, Type, and Labels will be specifically assigned to respective fields in the new jiraIssue included in the jiraMessage, (e.g. JiraIssue.Reporter, etc), and all other fields will be included in jiraIssue.Fields.

func Oauth1Client

func Oauth1Client(ctx context.Context, credentials JiraOauthCredentials) (*http.Client, error)

Oauth1Client is used to generate a http.Client that supports OAuth 1.0, to be used as the HTTP client in the Jira client implementation above

Types

type BasicAuth

type BasicAuth struct {
	UseBasicAuth bool
	Username     string
	Password     string
}

type Comment

type Comment struct {
	IssueID string `bson:"issue_id,omitempty" json:"issue_id,omitempty" yaml:"issue_id,omitempty"`
	Body    string `bson:"body" json:"body" yaml:"body"`
}

Comment represents a single comment to post to the given JIRA issue

type Field

type Field struct {
	Key   string
	Value any
}

Field is a struct composed of a key-value pair.

type Issue

type Issue struct {
	IssueKey    string   `bson:"issue_key" json:"issue_key" yaml:"issue_key"`
	Project     string   `bson:"project" json:"project" yaml:"project"`
	Summary     string   `bson:"summary" json:"summary" yaml:"summary"`
	Description string   `bson:"description" json:"description" yaml:"description"`
	Reporter    string   `bson:"reporter" json:"reporter" yaml:"reporter"`
	Assignee    string   `bson:"assignee" json:"assignee" yaml:"assignee"`
	Type        string   `bson:"type" json:"type" yaml:"type"`
	Components  []string `bson:"components" json:"components" yaml:"components"`
	Labels      []string `bson:"labels" json:"labels" yaml:"labels"`
	FixVersions []string `bson:"versions" json:"versions" yaml:"versions"`
	// ... other fields
	Fields   map[string]any `bson:"fields" json:"fields" yaml:"fields"`
	Callback func(string)   `bson:"-" json:"-" yaml:"-"`
}

Issue requires project and summary to create a real jira issue. Other fields depend on permissions given to the specific project, and all fields must be legitimate custom fields defined for the project. To see whether you have the right permissions to create an issue with certain fields, check your JIRA interface on the web.

type JiraOauthCredentials

type JiraOauthCredentials struct {
	PrivateKey  []byte
	AccessToken string
	TokenSecret string
	ConsumerKey string
}

type Oauth1

type Oauth1 struct {
	PrivateKey  []byte
	AccessToken string
	TokenSecret string
	ConsumerKey string
}

type Options

type Options struct {
	Name          string // Name of the journaler
	BaseURL       string // URL of the JIRA instance
	BasicAuthOpts BasicAuth
	Oauth1Opts    Oauth1
	HTTPClient    *http.Client
	// contains filtered or unexported fields
}

Options include configurations for the JIRA client

func (*Options) Validate

func (o *Options) Validate() error

Validate inspects the contents of JiraOptions struct and returns an error in case of missing any required fields.

Jump to

Keyboard shortcuts

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