plugin

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package plugin provides the implementation of the JVS plugin interface.

Error is a concrete error implementation.

Package plugin provides the implementation of the JVS plugin interface.

Package validator provides functions to validate jira issue against validation criteria.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JiraPlugin

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

JiraPlugin is the implementation of jvspb.Validator interface.

func NewJiraPlugin

func NewJiraPlugin(ctx context.Context, cfg *PluginConfig) (*JiraPlugin, error)

NewJiraPlugin creates a new JiraPlugin.

func (*JiraPlugin) GetUIData

func (j *JiraPlugin) GetUIData(ctx context.Context, req *jvspb.GetUIDataRequest) (*jvspb.UIData, error)

func (*JiraPlugin) Validate

Validate returns the validation result.

type Match added in v0.0.4

type Match struct {
	MatchedIssues []int    `json:"matchedIssues"`
	Errors        []string `json:"errors"`
}

Match reports a single match result of the match request.

type MatchResult added in v0.0.4

type MatchResult struct {
	Matches []*Match `json:"matches"`
}

MatchResult reports full list of result of the match request.

type PluginConfig

type PluginConfig struct {
	// JIRAEndpoint is the base uri to form the [JIRA REST API uri]. It has the
	// format of:
	//     https://host:port/context/rest/api-name/api-version
	//
	// [JIRA REST API url]: https://developer.atlassian.com/server/jira/platform/rest-apis/#uri-structure
	JIRAEndpoint string

	// Jql is the [JQL] query specifying validation criteria.
	//
	// [JQL]: https://support.atlassian.com/jira-service-management-cloud/docs/use-advanced-search-with-jira-query-language-jql/
	Jql string

	// JIRAAccount is the user name used in [JIRA Basic Auth].
	//
	// [JIRA Basic Auth]: https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/
	JIRAAccount string

	// APITokenSecretID is the resource name of the
	// [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] for the API
	// token in the format `projects/*/secrets/*/versions/*`.
	APITokenSecretID string

	// DisplaNname is for display, e.g. for the web UI.
	DisplayName string

	// Hint is for what value to put as the justification.
	Hint string

	// IssueBaseURL is used to construct a URL that can be clicked.
	IssueBaseURL string
}

PluginConfig defines the set over environment variables required for running the plugin.

func (*PluginConfig) ToFlags

func (cfg *PluginConfig) ToFlags(set *cli.FlagSet) *cli.FlagSet

ToFlags binds the config to the give cli.FlagSet and returns it.

func (*PluginConfig) Validate

func (cfg *PluginConfig) Validate() error

Validate checks if the config is valid.

type Validator added in v0.0.4

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

Validator validates jira issue against validation criteria.

func NewValidator added in v0.0.4

func NewValidator(baseURL, jql, account, apiToken string) (*Validator, error)

NewValidator creates a new validator.

func (*Validator) MatchIssue added in v0.0.4

func (v *Validator) MatchIssue(ctx context.Context, issueKey string) (*MatchResult, error)

MatchIssue checks the jira issue against the JQL criteria.

Jump to

Keyboard shortcuts

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