Documentation ¶
Index ¶
- type AzureDevopsRequestValidator
- type DefaultAzureDevopsRequestValidator
- type DefaultGithubRequestValidator
- type DefaultGitlabRequestParserValidator
- type GithubRequestValidator
- type GitlabRequestParserValidator
- type HTTPError
- type HTTPResponse
- type VCSEventsController
- func (e *VCSEventsController) HandleAzureDevopsPullRequestCommentedEvent(w http.ResponseWriter, event *azuredevops.Event, azuredevopsReqID string)
- func (e *VCSEventsController) HandleAzureDevopsPullRequestEvent(w http.ResponseWriter, event *azuredevops.Event, azuredevopsReqID string)
- func (e *VCSEventsController) HandleBitbucketCloudCommentEvent(w http.ResponseWriter, body []byte, reqID string)
- func (e *VCSEventsController) HandleBitbucketServerCommentEvent(w http.ResponseWriter, body []byte, reqID string)
- func (e *VCSEventsController) HandleGithubCommentEvent(event *github.IssueCommentEvent, githubReqID string, ...) HTTPResponse
- func (e *VCSEventsController) HandleGithubPullRequestEvent(logger logging.SimpleLogging, pullEvent *github.PullRequestEvent, ...) HTTPResponse
- func (e *VCSEventsController) HandleGitlabCommentEvent(w http.ResponseWriter, event gitlab.MergeCommentEvent)
- func (e *VCSEventsController) HandleGitlabMergeRequestEvent(w http.ResponseWriter, event gitlab.MergeEvent)
- func (e *VCSEventsController) Post(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureDevopsRequestValidator ¶
type AzureDevopsRequestValidator interface { // Validate returns the JSON payload of the request. // If both username and password values have a length greater than zero, // it checks that the credentials match those configured in Atlantis. // If either username or password have a length of zero, the payload is // returned without further checking. Validate(r *http.Request, user []byte, pass []byte) ([]byte, error) }
AzureDevopsRequestValidator handles checking if Azure DevOps requests contain a valid Basic authentication username and password.
type DefaultAzureDevopsRequestValidator ¶
type DefaultAzureDevopsRequestValidator struct{}
DefaultAzureDevopsRequestValidator handles checking if Azure DevOps requests contain the correct Basic auth username and password.
func (*DefaultAzureDevopsRequestValidator) Validate ¶
func (d *DefaultAzureDevopsRequestValidator) Validate(r *http.Request, user []byte, pass []byte) ([]byte, error)
Validate returns the JSON payload of the request. If secret is not empty, it checks that the request was signed by secret and returns an error if it was not. If secret is empty, it does not check if the request was signed.
type DefaultGithubRequestValidator ¶
type DefaultGithubRequestValidator struct{}
DefaultGithubRequestValidator handles checking if GitHub requests are signed properly by the secret.
type DefaultGitlabRequestParserValidator ¶
type DefaultGitlabRequestParserValidator struct{}
DefaultGitlabRequestParserValidator parses and validates GitLab requests.
func (*DefaultGitlabRequestParserValidator) ParseAndValidate ¶
func (d *DefaultGitlabRequestParserValidator) ParseAndValidate(r *http.Request, secret []byte) (interface{}, error)
ParseAndValidate returns the JSON payload of the request. See GitlabRequestParserValidator.ParseAndValidate().
type GithubRequestValidator ¶
type GithubRequestValidator interface { // Validate returns the JSON payload of the request. // If secret is not empty, it checks that the request was signed // by secret and returns an error if it was not. // If secret is empty, it does not check if the request was signed. Validate(r *http.Request, secret []byte) ([]byte, error) }
GithubRequestValidator handles checking if GitHub requests are signed properly by the secret.
type GitlabRequestParserValidator ¶
type GitlabRequestParserValidator interface { // ParseAndValidate validates that the request has a token header matching secret. // If the secret does not match it returns an error. // If secret is empty it does not check the token header. // It then parses the request as a GitLab object depending on the header // provided by GitLab identifying the webhook type. If the webhook type // is not recognized it will return nil but will not return an error. // Usage: // event, err := GitlabRequestParserValidator.ParseAndValidate(r, secret) // if err != nil { // return // } // switch event := event.(type) { // case gitlab.MergeCommentEvent: // // handle // case gitlab.MergeEvent: // // handle // default: // // unsupported event // } ParseAndValidate(r *http.Request, secret []byte) (interface{}, error) }
GitlabRequestParserValidator parses and validates GitLab requests.
type HTTPError ¶ added in v0.19.3
type HTTPError struct {
// contains filtered or unexported fields
}
type HTTPResponse ¶ added in v0.19.3
type HTTPResponse struct {
// contains filtered or unexported fields
}
type VCSEventsController ¶
type VCSEventsController struct { CommandRunner events.CommandRunner PullCleaner events.PullCleaner Logger logging.SimpleLogging Scope tally.Scope Parser events.EventParsing CommentParser events.CommentParsing ApplyDisabled bool EmojiReaction string ExecutableName string // GithubWebhookSecret is the secret added to this webhook via the GitHub // UI that identifies this call as coming from GitHub. If empty, no // request validation is done. GithubWebhookSecret []byte GithubRequestValidator GithubRequestValidator GitlabRequestParserValidator GitlabRequestParserValidator // GitlabWebhookSecret is the secret added to this webhook via the GitLab // UI that identifies this call as coming from GitLab. If empty, no // request validation is done. GitlabWebhookSecret []byte RepoAllowlistChecker *events.RepoAllowlistChecker // SilenceAllowlistErrors controls whether we write an error comment on // pull requests from non-allowlisted repos. SilenceAllowlistErrors bool // SupportedVCSHosts is which VCS hosts Atlantis was configured upon // startup to support. SupportedVCSHosts []models.VCSHostType VCSClient vcs.Client TestingMode bool // BitbucketWebhookSecret is the secret added to this webhook via the Bitbucket // UI that identifies this call as coming from Bitbucket. If empty, no // request validation is done. BitbucketWebhookSecret []byte // AzureDevopsWebhookUser is the Basic authentication username added to this // webhook via the Azure DevOps UI that identifies this call as coming from your // Azure DevOps Team Project. If empty, no request validation is done. // For more information, see https://docs.microsoft.com/en-us/azure/devops/service-hooks/services/webhooks?view=azure-devops AzureDevopsWebhookBasicUser []byte // AzureDevopsWebhookPassword is the Basic authentication password added to this // webhook via the Azure DevOps UI that identifies this call as coming from your // Azure DevOps Team Project. If empty, no request validation is done. AzureDevopsWebhookBasicPassword []byte AzureDevopsRequestValidator AzureDevopsRequestValidator }
VCSEventsController handles all webhook requests which signify 'events' in the VCS host, ex. GitHub.
func (*VCSEventsController) HandleAzureDevopsPullRequestCommentedEvent ¶
func (e *VCSEventsController) HandleAzureDevopsPullRequestCommentedEvent(w http.ResponseWriter, event *azuredevops.Event, azuredevopsReqID string)
HandleAzureDevopsPullRequestCommentedEvent handles comment events from Azure DevOps where Atlantis commands can come from. It's exported to make testing easier. Sometimes we may want data from the parent azuredevops.Event struct, so we handle type checking here. Requires Resource Version 2.0 of the Pull Request Commented On webhook payload.
func (*VCSEventsController) HandleAzureDevopsPullRequestEvent ¶
func (e *VCSEventsController) HandleAzureDevopsPullRequestEvent(w http.ResponseWriter, event *azuredevops.Event, azuredevopsReqID string)
HandleAzureDevopsPullRequestEvent will delete any locks associated with the pull request if the event is a pull request closed event. It's exported to make testing easier.
func (*VCSEventsController) HandleBitbucketCloudCommentEvent ¶
func (e *VCSEventsController) HandleBitbucketCloudCommentEvent(w http.ResponseWriter, body []byte, reqID string)
HandleBitbucketCloudCommentEvent handles comment events from Bitbucket.
func (*VCSEventsController) HandleBitbucketServerCommentEvent ¶
func (e *VCSEventsController) HandleBitbucketServerCommentEvent(w http.ResponseWriter, body []byte, reqID string)
HandleBitbucketServerCommentEvent handles comment events from Bitbucket.
func (*VCSEventsController) HandleGithubCommentEvent ¶
func (e *VCSEventsController) HandleGithubCommentEvent(event *github.IssueCommentEvent, githubReqID string, logger logging.SimpleLogging) HTTPResponse
HandleGithubCommentEvent handles comment events from GitHub where Atlantis commands can come from. It's exported to make testing easier.
func (*VCSEventsController) HandleGithubPullRequestEvent ¶
func (e *VCSEventsController) HandleGithubPullRequestEvent(logger logging.SimpleLogging, pullEvent *github.PullRequestEvent, githubReqID string) HTTPResponse
HandleGithubPullRequestEvent will delete any locks associated with the pull request if the event is a pull request closed event. It's exported to make testing easier.
func (*VCSEventsController) HandleGitlabCommentEvent ¶
func (e *VCSEventsController) HandleGitlabCommentEvent(w http.ResponseWriter, event gitlab.MergeCommentEvent)
HandleGitlabCommentEvent handles comment events from GitLab where Atlantis commands can come from. It's exported to make testing easier.
func (*VCSEventsController) HandleGitlabMergeRequestEvent ¶
func (e *VCSEventsController) HandleGitlabMergeRequestEvent(w http.ResponseWriter, event gitlab.MergeEvent)
HandleGitlabMergeRequestEvent will delete any locks associated with the pull request if the event is a merge request closed event. It's exported to make testing easier.
func (*VCSEventsController) Post ¶
func (e *VCSEventsController) Post(w http.ResponseWriter, r *http.Request)
Post handles POST webhook requests.