Documentation ¶
Index ¶
- Constants
- func CloneIssue(jc Client, parent *jira.Issue) (*jira.Issue, error)
- func DeleteRemoteLinkViaURL(jc Client, issueID, url string) (bool, error)
- func GetIssueQaContact(issue *jira.Issue) (*jira.User, error)
- func GetIssueTargetVersion(issue *jira.Issue) (*[]*jira.Version, error)
- func GetUnknownField(field string, issue *jira.Issue, fn func() interface{}) error
- func HandleJiraError(response *jira.Response, err error) error
- func IsNotFound(err error) bool
- func JiraErrorBody(err error) string
- func JiraErrorStatusCode(err error) int
- func NewNotFoundError(err error) error
- func UpdateStatus(jc Client, issueID, statusName string) error
- type BasicAuthGenerator
- type BearerAuthGenerator
- type Client
- type CreateIssueError
- type JiraError
- type NotFoundError
- type Option
- type Options
- type SecurityLevel
Constants ¶
const ( StatusNew = "NEW" StatusBacklog = "BACKLOG" StatusAssigned = "ASSIGNED" StatusInProgress = "IN PROGRESS" StatusModified = "MODIFIED" StatusPost = "POST" StatusOnDev = "ON_DEV" StatusOnQA = "ON_QA" StatusVerified = "VERIFIED" StatusReleasePending = "RELEASE PENDING" StatusClosed = "CLOSED" )
These are all the current valid states for Red Hat bugs in jira
Variables ¶
This section is empty.
Functions ¶
func CloneIssue ¶
CloneIssue copies an issue struct, clears unsettable fields, creates a new issue using the updated struct, and then links the new issue as a clone to the original.
func DeleteRemoteLinkViaURL ¶
DeleteRemoteLinkViaURL identifies and removes a remote link from an issue the has the provided URL. The returned bool indicates whether a change was made during the operation as a remote link with the URL not existing is not consider an error for this function.
func GetIssueQaContact ¶
func GetIssueQaContact(issue *jira.Issue) (*jira.User, error)
func GetIssueTargetVersion ¶
func GetIssueTargetVersion(issue *jira.Issue) (*[]*jira.Version, error)
func GetUnknownField ¶
func HandleJiraError ¶
HandleJiraError collapses cryptic Jira errors to include response bodies if it's detected that the original error holds no useful context in the first place
func IsNotFound ¶
func JiraErrorBody ¶
JiraErrorBody will identify if an error is a JiraError and return the stored response body if it is; if it is not, an empty string will be returned
func JiraErrorStatusCode ¶
JiraErrorStatusCode will identify if an error is a JiraError and return the stored status code if it is; if it is not, `-1` will be returned
func NewNotFoundError ¶
func UpdateStatus ¶
UpdateStatus updates an issue's status by identifying the ID of the provided statusName and then doing the status transition using the provided client to update the issue.
Types ¶
type BasicAuthGenerator ¶
type BasicAuthGenerator func() (username, password string)
type BearerAuthGenerator ¶
type BearerAuthGenerator func() (token string)
type Client ¶
type Client interface { GetIssue(id string) (*jira.Issue, error) // SearchWithContext will search for tickets according to the jql // Jira API docs: https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-query-issues SearchWithContext(ctx context.Context, jql string, options *jira.SearchOptions) ([]jira.Issue, *jira.Response, error) UpdateIssue(*jira.Issue) (*jira.Issue, error) CreateIssue(*jira.Issue) (*jira.Issue, error) CreateIssueLink(*jira.IssueLink) error // CloneIssue copies an issue struct, clears unsettable fields, creates a new // issue using the updated struct, and then links the new issue as a clone to // the original. CloneIssue(*jira.Issue) (*jira.Issue, error) GetTransitions(issueID string) ([]jira.Transition, error) DoTransition(issueID, transitionID string) error // UpdateStatus updates an issue's status by identifying the ID of the provided // statusName and then doing the status transition to update the issue. UpdateStatus(issueID, statusName string) error // GetIssueSecurityLevel returns the security level of an issue. If no security level // is set for the issue, the returned SecurityLevel and error will both be nil and // the issue will follow the default project security level. GetIssueSecurityLevel(*jira.Issue) (*SecurityLevel, error) // GetIssueQaContact get the user details for the QA contact. The QA contact is a custom field in Jira GetIssueQaContact(*jira.Issue) (*jira.User, error) // GetIssueTargetVersion get the issue Target Release. The target release is a custom field in Jira GetIssueTargetVersion(issue *jira.Issue) (*[]*jira.Version, error) // FindUser returns all users with a field matching the queryParam (ex: email, display name, etc.) FindUser(queryParam string) ([]*jira.User, error) GetRemoteLinks(id string) ([]jira.RemoteLink, error) AddRemoteLink(id string, link *jira.RemoteLink) (*jira.RemoteLink, error) UpdateRemoteLink(id string, link *jira.RemoteLink) error DeleteLink(id string) error DeleteRemoteLink(issueID string, linkID int) error // DeleteRemoteLinkViaURL identifies and removes a remote link from an issue // the has the provided URL. The returned bool indicates whether a change // was made during the operation as a remote link with the URL not existing // is not consider an error for this function. DeleteRemoteLinkViaURL(issueID, url string) (bool, error) ForPlugin(plugin string) Client AddComment(issueID string, comment *jira.Comment) (*jira.Comment, error) ListProjects() (*jira.ProjectList, error) JiraClient() *jira.Client JiraURL() string Used() bool WithFields(fields logrus.Fields) Client GetProjectVersions(project string) ([]*jira.Version, error) }
type CreateIssueError ¶
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
func (NotFoundError) Is ¶
func (NotFoundError) Is(target error) bool
type Option ¶
type Option func(*Options)
func WithBasicAuth ¶
func WithBasicAuth(basicAuth BasicAuthGenerator) Option
func WithBearerAuth ¶
func WithBearerAuth(token BearerAuthGenerator) Option
func WithFields ¶
type Options ¶
type Options struct { BasicAuth BasicAuthGenerator BearerAuth BearerAuthGenerator LogFields logrus.Fields }
type SecurityLevel ¶
type SecurityLevel struct { Self string `json:"self"` ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` }
func GetIssueSecurityLevel ¶
func GetIssueSecurityLevel(issue *jira.Issue) (*SecurityLevel, error)
GetIssueSecurityLevel returns the security level of an issue. If no security level is set for the issue, the returned SecurityLevel and error will both be nil and the issue will follow the default project security level.