Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
type ActionType int
ActionType enumerates the different actions we need to take
const ( NotRelevant ActionType = iota // This action is not relevant, ignore CreateNew // Create a new QA Update // Destroy and replace an existing QA Destroy // Destroy an existing QA )
Various action types
func (ActionType) String ¶
func (i ActionType) String() string
type BadSignature ¶
type BadSignature struct{}
BadSignature is the error type for invalid signatures
func (BadSignature) Error ¶
func (bs BadSignature) Error() string
type GitHubEvent ¶
type GitHubEvent struct { Action string `json:"action"` //PR Repository GitHubEventRepository `json:"repository"` //PR/Push PullRequest GitHubEventPullRequest `json:"pull_request"` //PR Sender GitHubEventUser }
GitHubEvent represents an incoming GitHub webhook payload
func (GitHubEvent) Type ¶
func (event GitHubEvent) Type() GitHubEventType
Type returns the event type
type GitHubEventPullRequest ¶
type GitHubEventPullRequest struct { Number uint `json:"number"` User GitHubEventUser `json:"user"` Head GitHubPRReference `json:"head"` Base GitHubPRReference `json:"base"` }
GitHubEventPullRequest models a pull request in a GH webhook
type GitHubEventRepository ¶
GitHubEventRepository models a repository in a GH webhook
type GitHubEventType ¶
type GitHubEventType int
GitHubEventType enumerates the types of webhook events we support
const ( // UnknownEvent is an unknown webhook event UnknownEvent GitHubEventType = iota // PullRequestEvent is a PR event PullRequestEvent )
func (GitHubEventType) String ¶
func (i GitHubEventType) String() string
type GitHubEventUser ¶
type GitHubEventUser struct {
Login string `json:"login"`
}
GitHubEventUser models a user in a GH webhook
type GitHubEventWebhook ¶
type GitHubEventWebhook struct {
// contains filtered or unexported fields
}
GitHubEventWebhook is an object that processes incoming GitHub webhooks
func NewGitHubEventWebhook ¶
func NewGitHubEventWebhook(rc ghclient.RepoClient, secret string, typepath string, dl persistence.EventLoggerDataLayer) *GitHubEventWebhook
NewGitHubEventWebhook returns a GitHubEventWebhook object using the supplied dependencies
func (*GitHubEventWebhook) GenerateSignatureString ¶
func (ge *GitHubEventWebhook) GenerateSignatureString(body []byte) string
GenerateSignatureString calculates the hub signature string for the supplied body
func (*GitHubEventWebhook) New ¶
func (ge *GitHubEventWebhook) New(body []byte, deliveryID uuid.UUID, sig string) (WebhookResponse, error)
New processes a new incoming request body from GitHub, validates it and returns necessary info to create a QA if needed. First param will be false if event is not relevant but there is no error otherwise.
type GitHubPRReference ¶
GitHubPRReference represents a PR head/base reference
type WebhookEventHandler ¶
type WebhookEventHandler interface { GenerateSignatureString(body []byte) string New(body []byte, sig string) (ActionType, *models.RepoRevisionData, error) }
WebhookEventHandler describes an object that can handle incoming webhooks
type WebhookResponse ¶
type WebhookResponse struct { Action ActionType RRD *models.RepoRevisionData Logger *eventlogger.Logger }