handling

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIMigration added in v0.0.4

type APIMigration struct {
	SignedInstall bool `json:"signed-install"`
}

type AtlassianConnect

type AtlassianConnect struct {
	Authentication Authentication         `json:"authentication,omitempty"`
	BaseURL        string                 `json:"baseUrl,omitempty"`
	Description    string                 `json:"description,omitempty"`
	Key            string                 `json:"key,omitempty"`
	Lifecycle      Lifecycle              `json:"lifecycle,omitempty"`
	Modules        map[string]interface{} `json:"modules,omitempty"`
	Name           string                 `json:"name,omitempty"`
	Scopes         []string               `json:"scopes,omitempty"`
	Vendor         Vendor                 `json:"vendor,omitempty"`
	APIMigrations  APIMigration           `json:"apiMigrations,omitempty"`
}

AtlassianConnect is auto generated by github.com/perrito666/LAC from a json file

type Authentication

type Authentication struct {
	Type string `json:"type"`
}

Authentication is auto generated by github.com/perrito666/LAC from a json file

type ConditionParams

type ConditionParams struct {
	Expression string `json:"expression,omitempty"`
}

ConditionParams is auto generated by github.com/perrito666/LAC from a json file

type Conditions

type Conditions struct {
	Condition string          `json:"condition,omitempty"`
	Invert    bool            `json:"invert,omitempty"`
	Params    ConditionParams `json:"params,omitempty"`
	Or        []Conditions    `json:"or,omitempty"`
	And       []Conditions    `json:"and,omitempty"`
}

Conditions is auto generated by github.com/perrito666/LAC from a json file

type Description

type Description struct {
	Value string `json:"value"`
}

Description is auto generated by github.com/perrito666/LAC from a json file

type JiraHandleFunc

type JiraHandleFunc func(jii *storage.JiraInstallInformation, store storage.Store,
	w http.ResponseWriter, r *http.Request)

JiraHandleFunc represents an http handler func that also receives jira install information and access to storage.

type JiraIssueFields

type JiraIssueFields struct {
	Description Description `json:"description,omitempty"`
	Key         string      `json:"key,omitempty"`
	Name        Name        `json:"name,omitempty"`
	Type        string      `json:"type,omitempty"`
}

JiraIssueFields is auto generated by github.com/perrito666/LAC from a json file

type LifeCycleEvents

type LifeCycleEvents string

LifeCycleEvents are the possible events in the plugin lifecycle we can receive from JIRA.

const (
	// LCInstalled is invoked when the plugin is [re]installed
	LCInstalled LifeCycleEvents = "installled"
	// LCUnInstalled is invoked when the plugin is un installed
	LCUnInstalled LifeCycleEvents = "uninstallled"
	// LCEnabled is invoked when the plugin is enabled
	LCEnabled LifeCycleEvents = "enabled"
	// LCDisabled is invoked when the plugin is disabled
	LCDisabled LifeCycleEvents = "disabled"
)

type Lifecycle

type Lifecycle struct {
	Installed   string `json:"installed,omitempty"`
	UnInstalled string `json:"uninstalled,omitempty"`
	Enabled     string `json:"enabled,omitempty"`
	Disabled    string `json:"disabled,omitempty"`
}

Lifecycle is auto generated by github.com/perrito666/LAC from a json file

type Name

type Name struct {
	Value string `json:"value,omitempty"`
}

Name is auto generated by github.com/perrito666/LAC from a json file

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin represents an atlassian connect plugin instance

func NewPlugin

func NewPlugin(name, description, key, baseURL, baseRoute string,
	store storage.Store, logger *log.Logger,
	scopes []string, vendor Vendor, signedInstall bool) *Plugin

NewPlugin will create a new Plugin instance, as it is it will not be enough, you should add the necesary lifecycle events, webhooks, etc using the provided methods then obtain the Router handling all the events by invoking Router().

func (*Plugin) AddErrorCodeHandler

func (p *Plugin) AddErrorCodeHandler(st int, handler http.HandlerFunc)

AddErrorCodeHandler adds a handler for a given error code, if this status is raised we will pass on to the handler set for it. This is only done for our portion of the code, if you want this to be used inside your handler use Plugin.HandleErrorCode.

func (*Plugin) AddJiraIssueField

func (p *Plugin) AddJiraIssueField(f JiraIssueFields) error

AddJiraIssueField will add the passed issue field to the issue fields section, it will fail if it is already present. Details on the values of an JiraIssueField can be found at https://developer.atlassian.com/cloud/jira/platform/modules/issue-field/

func (*Plugin) AddLifecycleEvent

func (p *Plugin) AddLifecycleEvent(lce LifeCycleEvents, route string, f JiraHandleFunc) error

AddLifecycleEvent adds a handler for a given life cycle event, if already present it will fail.

func (*Plugin) AddWebPanel

func (p *Plugin) AddWebPanel(panelContainer string, wp WebPanel) error

AddWebPanel will add the passed webpanel to to the pased container and fail if already present. Possible panel containers are documented in https://developer.atlassian.com/cloud/jira/platform/about-jira-modules/ as locations.

func (*Plugin) AddWebhook

func (p *Plugin) AddWebhook(event string, route RoutePath, f JiraHandleFunc) error

AddWebhook will add a webhook to a given jira event (of the form jira:issue_updated) or fail if already present, a more exhaustive list is available in jira documentation at https://developer.atlassian.com/cloud/jira/platform/webhooks/

func (*Plugin) HandleErrorCode

func (p *Plugin) HandleErrorCode(st int, w http.ResponseWriter, r *http.Request)

HandleErrorCode uses the handler for the given error or plain sends the code.

func (*Plugin) InstallHandleFunc added in v0.0.4

func (p *Plugin) InstallHandleFunc(handler JiraHandleFunc) http.HandlerFunc

InstallHandleFunc returns the passed JiraHandleFunc wrapped into a layer of middleware that tries to parse the installation token, take this with several grains of salt.

func (*Plugin) Router

func (p *Plugin) Router(r *mux.Router) *mux.Router

Router returns a router for the handled cases in this plugin panel handlers are not covered here so if you want them you can add them to the returned router. The returned router is based on the passed one if provided.

func (*Plugin) UnverifiedHandleFunc

func (p *Plugin) UnverifiedHandleFunc(handler JiraHandleFunc) http.HandlerFunc

UnverifiedHandleFunc returns the passed JiraHandleFunc wrapped into a layer of middleware that only adds store.

func (*Plugin) UpdateJiraIssueField

func (p *Plugin) UpdateJiraIssueField(f JiraIssueFields) error

UpdateJiraIssueField will add the passed issue field to the issue fields section, it will replace it if already present.

func (*Plugin) UpdateLifecycleEvent

func (p *Plugin) UpdateLifecycleEvent(lce LifeCycleEvents, route string, f JiraHandleFunc) error

UpdateLifecycleEvent adds a handler for a given life cycle event, if already present it will replace it.

func (*Plugin) UpdateWebPanel

func (p *Plugin) UpdateWebPanel(panelContainer string, wp WebPanel) error

UpdateWebPanel will add the passed webpanel to to the pased container, if there is one in place it will be replaced.

func (*Plugin) UpdateWebhook

func (p *Plugin) UpdateWebhook(event string, route RoutePath, f JiraHandleFunc) error

UpdateWebhook will add a webhook to a given jira event, if already present it will be replaced.

func (*Plugin) VerifiedHandleFunc

func (p *Plugin) VerifiedHandleFunc(handler JiraHandleFunc) http.HandlerFunc

VerifiedHandleFunc returns the passed JiraHandleFunc wrapped into a verification check.

type RoutePath

type RoutePath struct {
	// contains filtered or unexported fields
}

RoutePath wraps in a crude way some url components so we can distinguish between the kind of URL that we pass to jira and the one we pass to the router.

func NewRoutePath

func NewRoutePath(path string, args map[string]string) RoutePath

NewRoutePath returns a new instance of RoutePath with the correct fields filled.

type Vendor

type Vendor struct {
	Name string `json:"name,omitempty"`
	URL  string `json:"url,omitempty"`
}

Vendor is auto generated by github.com/perrito666/LAC from a json file

type WebPanel

type WebPanel struct {
	Conditions []Conditions `json:"conditions,omitempty"`
	Context    string       `json:"context,omitempty"`
	Key        string       `json:"key,omitempty"`
	Location   string       `json:"location,omitempty"`
	Name       Name         `json:"name,omitempty"`
	URL        string       `json:"url,omitempty"`
	Weight     float64      `json:"weight,omitempty"`
}

WebPanel is auto generated by github.com/perrito666/LAC from a json file

type Webhooks

type Webhooks struct {
	Event string `json:"event,omitempty"`
	URL   string `json:"url,omitempty"`
}

Webhooks is auto generated by github.com/perrito666/LAC from a json file

Jump to

Keyboard shortcuts

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