Documentation
¶
Index ¶
Constants ¶
View Source
const ( HeaderGithubSignature = "x-hub-signature-256" HeaderRunnerSignature = "x-deepsource-signature-256" HeaderRunnerID = "x-deepsource-runner-id" HeaderAppID = "x-deepsource-app-id" HeaderContentType = "Content-Type" )
View Source
const (
HeaderInstallationID = "X-Installation-Id"
)
View Source
const (
HeaderValueGithubAccept = "application/vnd.github+json"
)
Variables ¶
View Source
var ( ErrAppNotFound = errors.New("could not find app") ErrInvalidHandler = errors.New("invalid handler") )
View Source
var ( HTTPErrUnknown = &HTTPError{Code: http.StatusInternalServerError, Message: "unknown error"} HTTPErrAppNotFound = &HTTPError{Code: http.StatusNotFound, Message: "invalid webhook url or the app does not exist"} HTTPErrInvalidRequest = &HTTPError{Code: http.StatusBadRequest, Message: "invalid request"} HTTPErrSignatureMismatch = &HTTPError{Code: http.StatusUnauthorized, Message: "signature mismatch"} HTTPErrUpstreamFailed = &HTTPError{Code: http.StatusBadGateway, Message: "failed to proxy request"} HTTPErrUpstreamBad = &HTTPError{Code: http.StatusBadGateway, Message: "upstream returned bad response"} )
View Source
var ( ErrInvalidSignature = errors.New("invalid signature") ErrMandatoryArgsMissing = errors.New("mandatory args missing") )
View Source
var (
ErrConfigNotFound = errors.New("config not found")
)
View Source
var (
GithubURLAccessTokenFmt = "/app/installations/%s/access_tokens"
)
Functions ¶
func ErrEchoResponse ¶
Types ¶
type APIProxy ¶
type APIProxy struct {
// contains filtered or unexported fields
}
func (*APIProxy) GenerateAccessToken ¶
GenerateAccessToken generates a short lived access token for the Github App using the JWT token.
func (*APIProxy) GenerateJWT ¶
GenerateJWT generates a signed JWT token for the Github App.
func (*APIProxy) InstallationURL ¶
type APIProxyFactory ¶
type APIProxyFactory struct {
// contains filtered or unexported fields
}
func NewAPIProxyFactory ¶
func NewAPIProxyFactory(apps map[string]*App, client *http.Client) *APIProxyFactory
type APIRequest ¶
type HTTPError ¶
type HTTPError struct {
Message string `json:"error"`
Code int `json:"-"`
// contains filtered or unexported fields
}
func (*HTTPError) WithInternal ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(apiF *APIProxyFactory, webhookF *WebhookProxyFactory) (*Handler, error)
func (*Handler) AuthenticatedRemoteURL ¶
func (*Handler) HandleInstallation ¶
HandleInstallation redirects the user to the installation page on Github.
type InstallationRequest ¶
type InstallationRequest struct {
AppID string `param:"app_id"`
}
type WebhookProxy ¶
type WebhookProxy struct {
// contains filtered or unexported fields
}
func NewWebhookProxy ¶
func NewWebhookProxy(app *App, runner *model.Runner, deepsource *model.DeepSource, client *http.Client) (*WebhookProxy, error)
func (*WebhookProxy) VerifySignature ¶
func (p *WebhookProxy) VerifySignature(signature string, body []byte) error
type WebhookProxyFactory ¶
type WebhookProxyFactory struct {
// contains filtered or unexported fields
}
func NewWebhookProxyFactory ¶
func NewWebhookProxyFactory(runner *model.Runner, deepsource *model.DeepSource, apps map[string]*App, client *http.Client) *WebhookProxyFactory
func (*WebhookProxyFactory) New ¶
func (g *WebhookProxyFactory) New(appID string) (*WebhookProxy, error)
type WebhookRequest ¶
type WebhookRequest struct {
AppID string `param:"app_id"`
}
Click to show internal directories.
Click to hide internal directories.