Documentation ¶
Index ¶
- type AzureReposClient
- func (client *AzureReposClient) AddPullRequestComment(ctx context.Context, _, repository, content string, pullRequestID int) error
- func (client *AzureReposClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, ...) error
- func (client *AzureReposClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error
- func (client *AzureReposClient) CreatePullRequest(ctx context.Context, ...) error
- func (client *AzureReposClient) CreateWebhook(ctx context.Context, owner, repository, branch, payloadURL string, ...) (string, string, error)
- func (client *AzureReposClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error
- func (client *AzureReposClient) DownloadRepository(ctx context.Context, _, repository, branch, localPath string) (err error)
- func (client *AzureReposClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)
- func (client *AzureReposClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)
- func (client *AzureReposClient) GetLatestCommit(ctx context.Context, _, repository, branch string) (CommitInfo, error)
- func (client *AzureReposClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)
- func (client *AzureReposClient) ListBranches(ctx context.Context, _, repository string) ([]string, error)
- func (client *AzureReposClient) ListOpenPullRequests(ctx context.Context, _, repository string) ([]PullRequestInfo, error)
- func (client *AzureReposClient) ListPullRequestComments(ctx context.Context, _, repository string, pullRequestID int) ([]CommentInfo, error)
- func (client *AzureReposClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)
- func (client *AzureReposClient) ListRepositories(ctx context.Context) (map[string][]string, error)
- func (client *AzureReposClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, ...) error
- func (client *AzureReposClient) TestConnection(ctx context.Context) error
- func (client *AzureReposClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error
- func (client *AzureReposClient) UpdateWebhook(ctx context.Context, ...) error
- func (client *AzureReposClient) UploadCodeScanning(ctx context.Context, owner, repository, branch, scanResults string) (string, error)
- type BitbucketCloudClient
- func (client *BitbucketCloudClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error
- func (client *BitbucketCloudClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, ...) error
- func (client *BitbucketCloudClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error
- func (client *BitbucketCloudClient) CreatePullRequest(ctx context.Context, ...) error
- func (client *BitbucketCloudClient) CreateWebhook(ctx context.Context, owner, repository, _, payloadURL string, ...) (string, string, error)
- func (client *BitbucketCloudClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error
- func (client *BitbucketCloudClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error
- func (client *BitbucketCloudClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)
- func (client *BitbucketCloudClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)
- func (client *BitbucketCloudClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)
- func (client *BitbucketCloudClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)
- func (client *BitbucketCloudClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)
- func (client *BitbucketCloudClient) ListOpenPullRequests(ctx context.Context, owner, repository string) (res []PullRequestInfo, err error)
- func (client *BitbucketCloudClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) (res []CommentInfo, err error)
- func (client *BitbucketCloudClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)
- func (client *BitbucketCloudClient) ListRepositories(ctx context.Context) (map[string][]string, error)
- func (client *BitbucketCloudClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, ...) error
- func (client *BitbucketCloudClient) TestConnection(ctx context.Context) error
- func (client *BitbucketCloudClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error
- func (client *BitbucketCloudClient) UpdateWebhook(ctx context.Context, owner, repository, _, payloadURL, token, webhookID string, ...) error
- func (client *BitbucketCloudClient) UploadCodeScanning(ctx context.Context, owner string, repository string, branch string, ...) (string, error)
- type BitbucketServerClient
- func (client *BitbucketServerClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error
- func (client *BitbucketServerClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, ...) error
- func (client BitbucketServerClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error
- func (client *BitbucketServerClient) CreatePullRequest(ctx context.Context, ...) error
- func (client *BitbucketServerClient) CreateWebhook(ctx context.Context, owner, repository, _, payloadURL string, ...) (string, string, error)
- func (client *BitbucketServerClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error
- func (client *BitbucketServerClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error
- func (client BitbucketServerClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)
- func (client *BitbucketServerClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)
- func (client *BitbucketServerClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)
- func (client *BitbucketServerClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)
- func (client *BitbucketServerClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)
- func (client *BitbucketServerClient) ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)
- func (client *BitbucketServerClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)
- func (client *BitbucketServerClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)
- func (client *BitbucketServerClient) ListRepositories(ctx context.Context) (map[string][]string, error)
- func (client *BitbucketServerClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, ...) error
- func (client *BitbucketServerClient) TestConnection(ctx context.Context) error
- func (client *BitbucketServerClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error
- func (client *BitbucketServerClient) UpdateWebhook(ctx context.Context, owner, repository, _, payloadURL, token, webhookID string, ...) error
- func (client *BitbucketServerClient) UploadCodeScanning(ctx context.Context, owner string, repository string, branch string, ...) (string, error)
- type BranchInfo
- type ClientBuilder
- func (builder *ClientBuilder) ApiEndpoint(apiEndpoint string) *ClientBuilder
- func (builder *ClientBuilder) Build() (VcsClient, error)
- func (builder *ClientBuilder) Logger(logger *log.Logger) *ClientBuilder
- func (builder *ClientBuilder) Project(project string) *ClientBuilder
- func (builder *ClientBuilder) Token(token string) *ClientBuilder
- func (builder *ClientBuilder) Username(username string) *ClientBuilder
- type CloneInfo
- type CommentInfo
- type CommitInfo
- type CommitStatus
- type GitHubClient
- func (client *GitHubClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error
- func (client *GitHubClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, ...) error
- func (client *GitHubClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error
- func (client *GitHubClient) CreatePullRequest(ctx context.Context, ...) error
- func (client *GitHubClient) CreateWebhook(ctx context.Context, owner, repository, _, payloadURL string, ...) (string, string, error)
- func (client *GitHubClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error
- func (client *GitHubClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error
- func (client *GitHubClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)
- func (client *GitHubClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)
- func (client *GitHubClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)
- func (client *GitHubClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)
- func (client *GitHubClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)
- func (client *GitHubClient) ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)
- func (client *GitHubClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)
- func (client *GitHubClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)
- func (client *GitHubClient) ListRepositories(ctx context.Context) (map[string][]string, error)
- func (client *GitHubClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, ...) error
- func (client *GitHubClient) TestConnection(ctx context.Context) error
- func (client *GitHubClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error
- func (client *GitHubClient) UpdateWebhook(ctx context.Context, owner, repository, _, payloadURL, token, webhookID string, ...) error
- func (client *GitHubClient) UploadCodeScanning(ctx context.Context, owner, repository, branch, scanResults string) (string, error)
- type GitLabClient
- func (client *GitLabClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error
- func (client *GitLabClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, ...) error
- func (client *GitLabClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error
- func (client *GitLabClient) CreatePullRequest(ctx context.Context, ...) error
- func (client *GitLabClient) CreateWebhook(ctx context.Context, owner, repository, branch, payloadURL string, ...) (string, string, error)
- func (client *GitLabClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error
- func (client *GitLabClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error
- func (client *GitLabClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)
- func (client *GitLabClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)
- func (client *GitLabClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)
- func (client *GitLabClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)
- func (client *GitLabClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)
- func (client *GitLabClient) ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)
- func (client *GitLabClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)
- func (client *GitLabClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)
- func (client *GitLabClient) ListRepositories(ctx context.Context) (map[string][]string, error)
- func (client *GitLabClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, ...) error
- func (client *GitLabClient) TestConnection(ctx context.Context) error
- func (client *GitLabClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error
- func (client *GitLabClient) UpdateWebhook(ctx context.Context, ...) error
- func (client *GitLabClient) UploadCodeScanning(ctx context.Context, owner string, repository string, branch string, ...) (string, error)
- type LabelInfo
- type Permission
- type PullRequestInfo
- type RepositoryInfo
- type VcsClient
- type VcsInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureReposClient ¶ added in v1.4.0
type AzureReposClient struct {
// contains filtered or unexported fields
}
Azure Devops API version 6
func NewAzureReposClient ¶ added in v1.4.0
func NewAzureReposClient(vcsInfo VcsInfo) (*AzureReposClient, error)
NewAzureReposClient create a new AzureReposClient
func (*AzureReposClient) AddPullRequestComment ¶ added in v1.4.0
func (client *AzureReposClient) AddPullRequestComment(ctx context.Context, _, repository, content string, pullRequestID int) error
AddPullRequestComment on Azure Repos
func (*AzureReposClient) AddSshKeyToRepository ¶ added in v1.4.0
func (client *AzureReposClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, permission Permission) error
AddSshKeyToRepository on Azure Repos
func (*AzureReposClient) CreateLabel ¶ added in v1.4.0
func (client *AzureReposClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error
CreateLabel on Azure Repos
func (*AzureReposClient) CreatePullRequest ¶ added in v1.4.0
func (client *AzureReposClient) CreatePullRequest(ctx context.Context, _, repository, sourceBranch, targetBranch, title, description string) error
CreatePullRequest on Azure Repos
func (*AzureReposClient) CreateWebhook ¶ added in v1.4.0
func (client *AzureReposClient) CreateWebhook(ctx context.Context, owner, repository, branch, payloadURL string, webhookEvents ...vcsutils.WebhookEvent) (string, string, error)
CreateWebhook on Azure Repos
func (*AzureReposClient) DeleteWebhook ¶ added in v1.4.0
func (client *AzureReposClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error
DeleteWebhook on Azure Repos
func (*AzureReposClient) DownloadRepository ¶ added in v1.4.0
func (client *AzureReposClient) DownloadRepository(ctx context.Context, _, repository, branch, localPath string) (err error)
DownloadRepository on Azure Repos
func (*AzureReposClient) GetCommitBySha ¶ added in v1.4.0
func (client *AzureReposClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)
GetCommitBySha on Azure Repos
func (*AzureReposClient) GetLabel ¶ added in v1.4.0
func (client *AzureReposClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)
GetLabel on Azure Repos
func (*AzureReposClient) GetLatestCommit ¶ added in v1.4.0
func (client *AzureReposClient) GetLatestCommit(ctx context.Context, _, repository, branch string) (CommitInfo, error)
GetLatestCommit on Azure Repos
func (*AzureReposClient) GetRepositoryInfo ¶ added in v1.4.0
func (client *AzureReposClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)
GetRepositoryInfo on Azure Repos
func (*AzureReposClient) ListBranches ¶ added in v1.4.0
func (client *AzureReposClient) ListBranches(ctx context.Context, _, repository string) ([]string, error)
ListBranches on Azure Repos
func (*AzureReposClient) ListOpenPullRequests ¶ added in v1.4.0
func (client *AzureReposClient) ListOpenPullRequests(ctx context.Context, _, repository string) ([]PullRequestInfo, error)
ListOpenPullRequests on Azure Repos
func (*AzureReposClient) ListPullRequestComments ¶ added in v1.4.0
func (client *AzureReposClient) ListPullRequestComments(ctx context.Context, _, repository string, pullRequestID int) ([]CommentInfo, error)
ListPullRequestComments returns all the pull request threads with their comments.
func (*AzureReposClient) ListPullRequestLabels ¶ added in v1.4.0
func (client *AzureReposClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)
ListPullRequestLabels on Azure Repos
func (*AzureReposClient) ListRepositories ¶ added in v1.4.0
ListRepositories on Azure Repos
func (*AzureReposClient) SetCommitStatus ¶ added in v1.4.0
func (client *AzureReposClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, owner, repository, ref, title, description, detailsURL string) error
SetCommitStatus on Azure Repos
func (*AzureReposClient) TestConnection ¶ added in v1.4.0
func (client *AzureReposClient) TestConnection(ctx context.Context) error
TestConnection on Azure Repos
func (*AzureReposClient) UnlabelPullRequest ¶ added in v1.4.0
func (client *AzureReposClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error
UnlabelPullRequest on Azure Repos
func (*AzureReposClient) UpdateWebhook ¶ added in v1.4.0
func (client *AzureReposClient) UpdateWebhook(ctx context.Context, owner, repository, branch, payloadURL, token, webhookID string, webhookEvents ...vcsutils.WebhookEvent) error
UpdateWebhook on Azure Repos
func (*AzureReposClient) UploadCodeScanning ¶ added in v1.4.0
func (client *AzureReposClient) UploadCodeScanning(ctx context.Context, owner, repository, branch, scanResults string) (string, error)
UploadCodeScanning on Azure Repos
type BitbucketCloudClient ¶
type BitbucketCloudClient struct {
// contains filtered or unexported fields
}
BitbucketCloudClient API version 2.0
func NewBitbucketCloudClient ¶
func NewBitbucketCloudClient(vcsInfo VcsInfo) (*BitbucketCloudClient, error)
NewBitbucketCloudClient create a new BitbucketCloudClient
func (*BitbucketCloudClient) AddPullRequestComment ¶ added in v1.1.0
func (client *BitbucketCloudClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error
AddPullRequestComment on Bitbucket cloud
func (*BitbucketCloudClient) AddSshKeyToRepository ¶ added in v1.1.0
func (client *BitbucketCloudClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, _ Permission) error
AddSshKeyToRepository on Bitbucket cloud, the deploy-key is always read-only.
func (*BitbucketCloudClient) CreateLabel ¶ added in v1.1.0
func (client *BitbucketCloudClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error
CreateLabel on Bitbucket cloud
func (*BitbucketCloudClient) CreatePullRequest ¶
func (client *BitbucketCloudClient) CreatePullRequest(ctx context.Context, owner, repository, sourceBranch, targetBranch, title, description string) error
CreatePullRequest on Bitbucket cloud
func (*BitbucketCloudClient) CreateWebhook ¶
func (client *BitbucketCloudClient) CreateWebhook(ctx context.Context, owner, repository, _, payloadURL string, webhookEvents ...vcsutils.WebhookEvent) (string, string, error)
CreateWebhook on Bitbucket cloud
func (*BitbucketCloudClient) DeleteWebhook ¶
func (client *BitbucketCloudClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error
DeleteWebhook on Bitbucket cloud
func (*BitbucketCloudClient) DownloadRepository ¶
func (client *BitbucketCloudClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error
DownloadRepository on Bitbucket cloud
func (*BitbucketCloudClient) GetCommitBySha ¶ added in v1.1.0
func (client *BitbucketCloudClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)
GetCommitBySha on Bitbucket cloud
func (*BitbucketCloudClient) GetLabel ¶ added in v1.1.0
func (client *BitbucketCloudClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)
GetLabel on Bitbucket cloud
func (*BitbucketCloudClient) GetLatestCommit ¶ added in v1.1.0
func (client *BitbucketCloudClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)
GetLatestCommit on Bitbucket cloud
func (*BitbucketCloudClient) GetRepositoryInfo ¶ added in v1.1.0
func (client *BitbucketCloudClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)
GetRepositoryInfo on Bitbucket cloud
func (*BitbucketCloudClient) ListBranches ¶
func (client *BitbucketCloudClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)
ListBranches on Bitbucket cloud
func (*BitbucketCloudClient) ListOpenPullRequests ¶ added in v1.2.0
func (client *BitbucketCloudClient) ListOpenPullRequests(ctx context.Context, owner, repository string) (res []PullRequestInfo, err error)
CreatePullRequest on Bitbucket cloud
func (*BitbucketCloudClient) ListPullRequestComments ¶ added in v1.2.0
func (client *BitbucketCloudClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) (res []CommentInfo, err error)
ListPullRequestComments on Bitbucket cloud
func (*BitbucketCloudClient) ListPullRequestLabels ¶ added in v1.1.0
func (client *BitbucketCloudClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)
ListPullRequestLabels on Bitbucket cloud
func (*BitbucketCloudClient) ListRepositories ¶
func (client *BitbucketCloudClient) ListRepositories(ctx context.Context) (map[string][]string, error)
ListRepositories on Bitbucket cloud
func (*BitbucketCloudClient) SetCommitStatus ¶
func (client *BitbucketCloudClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, owner, repository, ref, title, description, detailsURL string) error
SetCommitStatus on Bitbucket cloud
func (*BitbucketCloudClient) TestConnection ¶
func (client *BitbucketCloudClient) TestConnection(ctx context.Context) error
TestConnection on Bitbucket cloud
func (*BitbucketCloudClient) UnlabelPullRequest ¶ added in v1.1.0
func (client *BitbucketCloudClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error
UnlabelPullRequest on Bitbucket cloud
func (*BitbucketCloudClient) UpdateWebhook ¶
func (client *BitbucketCloudClient) UpdateWebhook(ctx context.Context, owner, repository, _, payloadURL, token, webhookID string, webhookEvents ...vcsutils.WebhookEvent) error
UpdateWebhook on Bitbucket cloud
type BitbucketServerClient ¶
type BitbucketServerClient struct {
// contains filtered or unexported fields
}
BitbucketServerClient API version 1.0
func NewBitbucketServerClient ¶
func NewBitbucketServerClient(vcsInfo VcsInfo) (*BitbucketServerClient, error)
NewBitbucketServerClient create a new BitbucketServerClient
func (*BitbucketServerClient) AddPullRequestComment ¶ added in v1.1.0
func (client *BitbucketServerClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error
AddPullRequestComment on Bitbucket server
func (*BitbucketServerClient) AddSshKeyToRepository ¶ added in v1.1.0
func (client *BitbucketServerClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, permission Permission) error
AddSshKeyToRepository on Bitbucket server
func (BitbucketServerClient) CreateLabel ¶ added in v1.1.0
func (client BitbucketServerClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error
CreateLabel on Bitbucket server
func (*BitbucketServerClient) CreatePullRequest ¶
func (client *BitbucketServerClient) CreatePullRequest(ctx context.Context, owner, repository, sourceBranch, targetBranch, title, description string) error
CreatePullRequest on Bitbucket server
func (*BitbucketServerClient) CreateWebhook ¶
func (client *BitbucketServerClient) CreateWebhook(ctx context.Context, owner, repository, _, payloadURL string, webhookEvents ...vcsutils.WebhookEvent) (string, string, error)
CreateWebhook on Bitbucket server
func (*BitbucketServerClient) DeleteWebhook ¶
func (client *BitbucketServerClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error
DeleteWebhook on Bitbucket server
func (*BitbucketServerClient) DownloadRepository ¶
func (client *BitbucketServerClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error
DownloadRepository on Bitbucket server
func (BitbucketServerClient) GetCommitBySha ¶ added in v1.1.0
func (client BitbucketServerClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)
GetCommitBySha on Bitbucket server
func (*BitbucketServerClient) GetLabel ¶ added in v1.1.0
func (client *BitbucketServerClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)
GetLabel on Bitbucket server
func (*BitbucketServerClient) GetLatestCommit ¶ added in v1.1.0
func (client *BitbucketServerClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)
GetLatestCommit on Bitbucket server
func (*BitbucketServerClient) GetRepositoryInfo ¶ added in v1.1.0
func (client *BitbucketServerClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)
GetRepositoryInfo on Bitbucket server
func (*BitbucketServerClient) ListBranches ¶
func (client *BitbucketServerClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)
ListBranches on Bitbucket server
func (*BitbucketServerClient) ListOpenPullRequests ¶ added in v1.2.0
func (client *BitbucketServerClient) ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)
ListOpenPullRequests on Bitbucket server
func (*BitbucketServerClient) ListPullRequestComments ¶ added in v1.2.0
func (client *BitbucketServerClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)
ListPullRequestComments on Bitbucket server
func (*BitbucketServerClient) ListPullRequestLabels ¶ added in v1.1.0
func (client *BitbucketServerClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)
ListPullRequestLabels on Bitbucket server
func (*BitbucketServerClient) ListRepositories ¶
func (client *BitbucketServerClient) ListRepositories(ctx context.Context) (map[string][]string, error)
ListRepositories on Bitbucket server
func (*BitbucketServerClient) SetCommitStatus ¶
func (client *BitbucketServerClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, _, _, ref, title, description, detailsURL string) error
SetCommitStatus on Bitbucket server
func (*BitbucketServerClient) TestConnection ¶
func (client *BitbucketServerClient) TestConnection(ctx context.Context) error
TestConnection on Bitbucket server
func (*BitbucketServerClient) UnlabelPullRequest ¶ added in v1.1.0
func (client *BitbucketServerClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error
UnlabelPullRequest on Bitbucket server
func (*BitbucketServerClient) UpdateWebhook ¶
func (client *BitbucketServerClient) UpdateWebhook(ctx context.Context, owner, repository, _, payloadURL, token, webhookID string, webhookEvents ...vcsutils.WebhookEvent) error
UpdateWebhook on Bitbucket server
type BranchInfo ¶ added in v1.2.0
type ClientBuilder ¶
type ClientBuilder struct {
// contains filtered or unexported fields
}
ClientBuilder builds VcsClient
func NewClientBuilder ¶
func NewClientBuilder(vcsProvider vcsutils.VcsProvider) *ClientBuilder
NewClientBuilder creates new ClientBuilder
func (*ClientBuilder) ApiEndpoint ¶
func (builder *ClientBuilder) ApiEndpoint(apiEndpoint string) *ClientBuilder
ApiEndpoint sets the API endpoint
func (*ClientBuilder) Build ¶
func (builder *ClientBuilder) Build() (VcsClient, error)
Build builds the VcsClient
func (*ClientBuilder) Logger ¶
func (builder *ClientBuilder) Logger(logger *log.Logger) *ClientBuilder
Logger sets the logger
func (*ClientBuilder) Project ¶ added in v1.4.0
func (builder *ClientBuilder) Project(project string) *ClientBuilder
Project sets the project
func (*ClientBuilder) Token ¶
func (builder *ClientBuilder) Token(token string) *ClientBuilder
Token sets the access token
func (*ClientBuilder) Username ¶
func (builder *ClientBuilder) Username(username string) *ClientBuilder
Username sets the username
type CloneInfo ¶ added in v1.1.0
type CloneInfo struct { // HTTP is a URL string to clone repository using HTTP(S)) protocol. HTTP string // SSH is a URL string to clone repository using SSH protocol. SSH string }
CloneInfo contains URLs that can be used to clone the repository.
type CommentInfo ¶ added in v1.2.0
type CommitInfo ¶ added in v1.1.0
type CommitInfo struct { // The SHA-1 hash of the commit Hash string // The author's name AuthorName string // The committer's name CommitterName string // The commit URL Url string // Seconds from epoch Timestamp int64 // The commit message Message string // The SHA-1 hashes of the parent commits ParentHashes []string }
CommitInfo contains the details of a commit
type CommitStatus ¶
type CommitStatus int
CommitStatus the status of the commit in the VCS
const ( // Pass means that the commit passed the tests Pass CommitStatus = iota // Fail means that the commit failed the tests Fail // Error means that an unexpected error occurred Error // InProgress means than the status check is in progress InProgress )
type GitHubClient ¶
type GitHubClient struct {
// contains filtered or unexported fields
}
GitHubClient API version 3
func NewGitHubClient ¶
func NewGitHubClient(vcsInfo VcsInfo) (*GitHubClient, error)
NewGitHubClient create a new GitHubClient
func (*GitHubClient) AddPullRequestComment ¶ added in v1.1.0
func (client *GitHubClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error
AddPullRequestComment on GitHub
func (*GitHubClient) AddSshKeyToRepository ¶ added in v1.1.0
func (client *GitHubClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, permission Permission) error
AddSshKeyToRepository on GitHub
func (*GitHubClient) CreateLabel ¶ added in v1.1.0
func (client *GitHubClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error
CreateLabel on GitHub
func (*GitHubClient) CreatePullRequest ¶
func (client *GitHubClient) CreatePullRequest(ctx context.Context, owner, repository, sourceBranch, targetBranch, title, description string) error
CreatePullRequest on GitHub
func (*GitHubClient) CreateWebhook ¶
func (client *GitHubClient) CreateWebhook(ctx context.Context, owner, repository, _, payloadURL string, webhookEvents ...vcsutils.WebhookEvent) (string, string, error)
CreateWebhook on GitHub
func (*GitHubClient) DeleteWebhook ¶
func (client *GitHubClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error
DeleteWebhook on GitHub
func (*GitHubClient) DownloadRepository ¶
func (client *GitHubClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error
DownloadRepository on GitHub
func (*GitHubClient) GetCommitBySha ¶ added in v1.1.0
func (client *GitHubClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)
GetCommitBySha on GitHub
func (*GitHubClient) GetLabel ¶ added in v1.1.0
func (client *GitHubClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)
GetLabel on GitHub
func (*GitHubClient) GetLatestCommit ¶ added in v1.1.0
func (client *GitHubClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)
GetLatestCommit on GitHub
func (*GitHubClient) GetRepositoryInfo ¶ added in v1.1.0
func (client *GitHubClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)
GetRepositoryInfo on GitHub
func (*GitHubClient) ListBranches ¶
func (client *GitHubClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)
ListBranches on GitHub
func (*GitHubClient) ListOpenPullRequests ¶ added in v1.2.0
func (client *GitHubClient) ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)
ListOpenPullRequests on GitHub
func (*GitHubClient) ListPullRequestComments ¶ added in v1.2.0
func (client *GitHubClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)
ListPullRequestComments on GitHub
func (*GitHubClient) ListPullRequestLabels ¶ added in v1.1.0
func (client *GitHubClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)
ListPullRequestLabels on GitHub
func (*GitHubClient) ListRepositories ¶
ListRepositories on GitHub
func (*GitHubClient) SetCommitStatus ¶
func (client *GitHubClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, owner, repository, ref, title, description, detailsURL string) error
SetCommitStatus on GitHub
func (*GitHubClient) TestConnection ¶
func (client *GitHubClient) TestConnection(ctx context.Context) error
TestConnection on GitHub
func (*GitHubClient) UnlabelPullRequest ¶ added in v1.1.0
func (client *GitHubClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error
UnlabelPullRequest on GitHub
func (*GitHubClient) UpdateWebhook ¶
func (client *GitHubClient) UpdateWebhook(ctx context.Context, owner, repository, _, payloadURL, token, webhookID string, webhookEvents ...vcsutils.WebhookEvent) error
UpdateWebhook on GitHub
func (*GitHubClient) UploadCodeScanning ¶ added in v1.3.0
func (client *GitHubClient) UploadCodeScanning(ctx context.Context, owner, repository, branch, scanResults string) (string, error)
UploadCodeScanning to GitHub Security tab
type GitLabClient ¶
type GitLabClient struct {
// contains filtered or unexported fields
}
GitLabClient API version 4
func NewGitLabClient ¶
func NewGitLabClient(vcsInfo VcsInfo) (*GitLabClient, error)
NewGitLabClient create a new GitLabClient
func (*GitLabClient) AddPullRequestComment ¶ added in v1.1.0
func (client *GitLabClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error
AddPullRequestComment on GitLab
func (*GitLabClient) AddSshKeyToRepository ¶ added in v1.1.0
func (client *GitLabClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, permission Permission) error
AddSshKeyToRepository on GitLab
func (*GitLabClient) CreateLabel ¶ added in v1.1.0
func (client *GitLabClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error
CreateLabel on GitLab
func (*GitLabClient) CreatePullRequest ¶
func (client *GitLabClient) CreatePullRequest(ctx context.Context, owner, repository, sourceBranch, targetBranch, title, description string) error
CreatePullRequest on GitLab
func (*GitLabClient) CreateWebhook ¶
func (client *GitLabClient) CreateWebhook(ctx context.Context, owner, repository, branch, payloadURL string, webhookEvents ...vcsutils.WebhookEvent) (string, string, error)
CreateWebhook on GitLab
func (*GitLabClient) DeleteWebhook ¶
func (client *GitLabClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error
DeleteWebhook on GitLab
func (*GitLabClient) DownloadRepository ¶
func (client *GitLabClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error
DownloadRepository on GitLab
func (*GitLabClient) GetCommitBySha ¶ added in v1.1.0
func (client *GitLabClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)
GetCommitBySha on GitLab
func (*GitLabClient) GetLabel ¶ added in v1.1.0
func (client *GitLabClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)
GetLabel on GitLub
func (*GitLabClient) GetLatestCommit ¶ added in v1.1.0
func (client *GitLabClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)
GetLatestCommit on GitLab
func (*GitLabClient) GetRepositoryInfo ¶ added in v1.1.0
func (client *GitLabClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)
GetRepositoryInfo on GitLab
func (*GitLabClient) ListBranches ¶
func (client *GitLabClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)
ListBranches on GitLab
func (*GitLabClient) ListOpenPullRequests ¶ added in v1.2.0
func (client *GitLabClient) ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)
ListOpenPullRequests on GitLab
func (*GitLabClient) ListPullRequestComments ¶ added in v1.2.0
func (client *GitLabClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)
ListPullRequestComments on GitLab
func (*GitLabClient) ListPullRequestLabels ¶ added in v1.1.0
func (client *GitLabClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)
ListPullRequestLabels on GitLab
func (*GitLabClient) ListRepositories ¶
ListRepositories on GitLab
func (*GitLabClient) SetCommitStatus ¶
func (client *GitLabClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, owner, repository, ref, title, description, detailsURL string) error
SetCommitStatus on GitLab
func (*GitLabClient) TestConnection ¶
func (client *GitLabClient) TestConnection(ctx context.Context) error
TestConnection on GitLab
func (*GitLabClient) UnlabelPullRequest ¶ added in v1.1.0
func (client *GitLabClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error
UnlabelPullRequest on GitLab
func (*GitLabClient) UpdateWebhook ¶
func (client *GitLabClient) UpdateWebhook(ctx context.Context, owner, repository, branch, payloadURL, token, webhookID string, webhookEvents ...vcsutils.WebhookEvent) error
UpdateWebhook on GitLab
type LabelInfo ¶ added in v1.1.0
type LabelInfo struct { Name string Description string // Label color is a hexadecimal color code, for example: 4AB548 Color string }
LabelInfo contains a label information
type Permission ¶ added in v1.1.0
type Permission int
Permission the ssh key permission on the VCS repository
const ( // Read permission Read Permission = iota // ReadWrite is either read and write permission ReadWrite )
type PullRequestInfo ¶ added in v1.2.0
type PullRequestInfo struct { ID int64 Source BranchInfo Target BranchInfo }
type RepositoryInfo ¶ added in v1.1.0
type RepositoryInfo struct {
CloneInfo CloneInfo
}
RepositoryInfo contains general information about repository.
type VcsClient ¶
type VcsClient interface { // TestConnection Returns nil if connection and authorization established successfully TestConnection(ctx context.Context) error // ListRepositories Returns a map between all accessible owners to their list of repositories ListRepositories(ctx context.Context) (map[string][]string, error) // ListBranches Lists all branches under the input repository // owner - User or organization // repository - VCS repository name ListBranches(ctx context.Context, owner, repository string) ([]string, error) // CreateWebhook Creates a webhook // owner - User or organization // repository - VCS repository name // branch - VCS branch name // payloadURL - URL to send the payload when a webhook event occurs // webhookEvents - The event type // Return the webhook ID, token and an error, if occurred CreateWebhook(ctx context.Context, owner, repository, branch, payloadURL string, webhookEvents ...vcsutils.WebhookEvent) (string, string, error) // UpdateWebhook Updates a webhook // owner - User or organization // repository - VCS repository name // branch - VCS branch name // payloadURL - URL to send the payload when a webhook event occurs // token - A token used to validate identity of the incoming webhook // webhookID - The webhook ID returned from a previous CreateWebhook command // webhookEvents - The event type UpdateWebhook(ctx context.Context, owner, repository, branch, payloadURL, token, webhookID string, webhookEvents ...vcsutils.WebhookEvent) error // DeleteWebhook Deletes a webhook // owner - User or organization // repository - VCS repository name // webhookID - The webhook ID returned from a previous CreateWebhook command DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error // SetCommitStatus Sets commit status // commitStatus - One of Pass, Fail, Error, or InProgress // owner - User or organization // repository - VCS repository name // ref - SHA, a branch name, or a tag name. // title - Title of the commit status // description - Description of the commit status // detailsUrl - The URL for component status link SetCommitStatus(ctx context.Context, commitStatus CommitStatus, owner, repository, ref, title, description, detailsURL string) error // DownloadRepository Downloads and extracts a VCS repository // owner - User or organization // repository - VCS repository name // branch - VCS branch name // localPath - Local file system path DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error // CreatePullRequest Creates a pull request between 2 different branches in the same repository // owner - User or organization // repository - VCS repository name // sourceBranch - Source branch // targetBranch - Target branch // title - Pull request title // description - Pull request description CreatePullRequest(ctx context.Context, owner, repository, sourceBranch, targetBranch, title, description string) error // AddPullRequestComment Adds a new comment on the requested pull request // owner - User or organization // repository - VCS repository name // content - The new comment content // pullRequestID - Pull request ID AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error // ListPullRequestComments Gets all comments assigned to a pull request. // owner - User or organization // repository - VCS repository name // pullRequestID - Pull request ID ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error) // ListOpenPullRequests Gets all open pull requests ids. // owner - User or organization // repository - VCS repository name ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error) // GetLatestCommit Gets the most recent commit of a branch // owner - User or organization // repository - VCS repository name // branch - The name of the branch GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error) // AddSshKeyToRepository Adds a public ssh key to a repository // owner - User or organization // repository - VCS repository name // keyName - Name of the key // publicKey - SSH public key // permission - Access permission of the key: read or readWrite AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, permission Permission) error // GetRepositoryInfo Returns information about repository. // owner - User or organization // repository - VCS repository name GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error) // GetCommitBySha Gets the commit by its SHA // owner - User or organization // repository - VCS repository name // sha - The commit hash GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error) // CreateLabel Creates a label in repository // owner - User or organization // repository - VCS repository name // labelInfo - The label info CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error // GetLabel Gets a label related to a repository. Returns (nil, nil) if label doesn't exist. // owner - User or organization // repository - VCS repository name // name - Label name GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error) // ListPullRequestLabels Gets all labels assigned to a pull request. // owner - User or organization // repository - VCS repository name // pullRequestID - Pull request ID ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error) // UnlabelPullRequest Removes a label from a pull request // owner - User or organization // repository - VCS repository name // name - Label name // pullRequestID - Pull request ID UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error // UploadCodeScanning Upload Scanning Analysis uploads a scanning analysis file to the relevant git provider // owner - User or organization // repository - VCS repository name // branch - The name of the branch // scan - Code scanning analysis UploadCodeScanning(ctx context.Context, owner, repository, branch, scanResults string) (string, error) }
VcsClient is a base class of all Vcs clients - GitHub, GitLab, Bitbucket server and cloud clients