plugin

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package plugin provides the implementation of the JVS plugin interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type ExchangeResponse

type ExchangeResponse struct {
	AccessToken string `json:"token"`
}

ExchangeResponse is the GitHub API response of requesting an access token for the GitHub App installation with requested repositories and permissions.

type GitHubPlugin

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

GitHubPlugin is the implementation of jvspb.Validator interface.

See: https://pkg.go.dev/github.com/abcxyz/jvs@v0.1.4/apis/v0#Validator

func NewGitHubPlugin

func NewGitHubPlugin(ctx context.Context, ghClient *github.Client, ghApp *githubapp.GitHubApp, cfg *PluginConfig) *GitHubPlugin

NewGitHubPlugin creates a new GitHubPlugin.

func (*GitHubPlugin) GetUIData

func (g *GitHubPlugin) GetUIData(ctx context.Context, req *jvspb.GetUIDataRequest) (*jvspb.UIData, error)

GetUIData returns UIData for jvs ui service to use.

func (*GitHubPlugin) Validate

Validate returns the validation result.

type PluginConfig

type PluginConfig struct {
	// ID of the GitHub APP we use to authenticate.
	GitHubAppID string
	// Installation ID of the github app.
	GitHubAppInstallationID string
	// The private Key PEM obtained for github app.
	GitHubAppPrivateKeyPEM string

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

	// GitHubPluginHint is for what value to put as the justification.
	GitHubPluginHint 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 validates if the config is valid.

type Validator

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

Validator validates github issue against validation criteria.

func NewValidator

func NewValidator(ghClinet *github.Client, ghApp *githubapp.GitHubApp) *Validator

NewValidator creates a validator.

func (*Validator) MatchIssue

func (v *Validator) MatchIssue(ctx context.Context, issueURL string) (*pluginGitHubIssue, error)

MatchIssue parses issue info from provided issueURL and validate if the issue is valid.

Directories

Path Synopsis
Package keyutil provides commonly used test functions to generate RSA keys.
Package keyutil provides commonly used test functions to generate RSA keys.

Jump to

Keyboard shortcuts

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