gitlab

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParceRepositoryFullName

func ParceRepositoryFullName(webURL string) string

Types

type Client

type Client interface {
	// Project
	Projects(opt *gitlab.ListProjectsOptions) ([]*gitlab.Project, error)
	// Pipeline
	ProjectPipelines(repositoryName string, opt *gitlab.ListProjectPipelinesOptions) (gitlab.PipelineList, error)
	ProjectPipelineJobs(repositoryName string, opt *gitlab.ListJobsOptions, pid int) ([]*gitlab.Job, error)
	// Lint
	Lint(content string) (*gitlab.LintResult, error)
	// User
	ProjectUsers(repositoryName string, opt *gitlab.ListProjectUserOptions) ([]*gitlab.ProjectUser, error)
	Users(opt *gitlab.ListUsersOptions) ([]*gitlab.User, error)
}

type GitlabProvider

type GitlabProvider struct {
	UI            ui.Ui
	GitClient     git.Client
	ConfigManager *config.ConfigManager
}

func NewProvider

func NewProvider(ui ui.Ui, gitClient git.Client, configManager *config.ConfigManager) *GitlabProvider

func (*GitlabProvider) GetClient

func (p *GitlabProvider) GetClient(remote *git.RemoteInfo) (Client, error)

func (*GitlabProvider) GetCurrentRemote

func (p *GitlabProvider) GetCurrentRemote() (*git.RemoteInfo, error)

func (*GitlabProvider) GetIssueClient added in v0.3.0

func (p *GitlabProvider) GetIssueClient(remote *git.RemoteInfo) (Issue, error)

func (*GitlabProvider) GetJobClient added in v0.4.0

func (p *GitlabProvider) GetJobClient(remote *git.RemoteInfo) (Job, error)

func (*GitlabProvider) GetMergeRequestClient added in v0.3.0

func (p *GitlabProvider) GetMergeRequestClient(remote *git.RemoteInfo) (MergeRequest, error)

func (*GitlabProvider) GetProjectVariableClient added in v0.5.0

func (p *GitlabProvider) GetProjectVariableClient(remote *git.RemoteInfo) (ProjectVariable, error)

func (*GitlabProvider) GetRepositoryClient added in v0.5.2

func (p *GitlabProvider) GetRepositoryClient(remote *git.RemoteInfo) (Repository, error)

func (*GitlabProvider) Init

func (p *GitlabProvider) Init() error

type Issue added in v0.3.0

type Issue interface {
	GetIssue(pid int, repositoryName string) (*gitlab.Issue, error)
	GetAllProjectIssues(opt *gitlab.ListIssuesOptions) ([]*gitlab.Issue, error)
	GetProjectIssues(opt *gitlab.ListProjectIssuesOptions, repositoryName string) ([]*gitlab.Issue, error)
	CreateIssue(opt *gitlab.CreateIssueOptions, repositoryName string) (*gitlab.Issue, error)
	UpdateIssue(opt *gitlab.UpdateIssueOptions, pid int, repositoryName string) (*gitlab.Issue, error)
}

type IssueClient added in v0.3.0

type IssueClient struct {
	Issue
	Client *gitlab.Client
}

func NewIssueClient added in v0.3.0

func NewIssueClient(client *gitlab.Client) *IssueClient

func (*IssueClient) CreateIssue added in v0.3.0

func (c *IssueClient) CreateIssue(opt *gitlab.CreateIssueOptions, repositoryName string) (*gitlab.Issue, error)

func (*IssueClient) GetAllProjectIssues added in v0.3.0

func (c *IssueClient) GetAllProjectIssues(opt *gitlab.ListIssuesOptions) ([]*gitlab.Issue, error)

func (*IssueClient) GetIssue added in v0.3.0

func (c *IssueClient) GetIssue(pid int, repositoryName string) (*gitlab.Issue, error)

func (*IssueClient) GetProjectIssues added in v0.3.0

func (c *IssueClient) GetProjectIssues(opt *gitlab.ListProjectIssuesOptions, repositoryName string) ([]*gitlab.Issue, error)

func (*IssueClient) UpdateIssue added in v0.3.0

func (c *IssueClient) UpdateIssue(opt *gitlab.UpdateIssueOptions, pid int, repositoryName string) (*gitlab.Issue, error)

type Job added in v0.4.0

type Job interface {
	GetProjectJobs(opt *gitlab.ListJobsOptions, repositoryName string) ([]gitlab.Job, error)
	GetJob(repositoryName string, jobID int) (*gitlab.Job, error)
	GetTraceFile(repositoryName string, jobID int) (io.Reader, error)
}

type JobClient added in v0.4.0

type JobClient struct {
	Job
	Client *gitlab.Client
}

func NewJobClient added in v0.4.0

func NewJobClient(client *gitlab.Client) *JobClient

func (*JobClient) GetJob added in v0.4.0

func (c *JobClient) GetJob(repositoryName string, jobID int) (*gitlab.Job, error)

func (*JobClient) GetProjectJobs added in v0.4.0

func (c *JobClient) GetProjectJobs(opt *gitlab.ListJobsOptions, repositoryName string) ([]gitlab.Job, error)

func (*JobClient) GetTraceFile added in v0.4.0

func (c *JobClient) GetTraceFile(repositoryName string, jobID int) (io.Reader, error)

type LabClient

type LabClient struct {
	Client *gitlab.Client
}

func NewLabClient

func NewLabClient(client *gitlab.Client) *LabClient

func (*LabClient) Lint added in v0.2.0

func (l *LabClient) Lint(content string) (*gitlab.LintResult, error)

func (*LabClient) ProjectPipelineJobs added in v0.3.0

func (l *LabClient) ProjectPipelineJobs(repositoryName string, opt *gitlab.ListJobsOptions, pid int) ([]*gitlab.Job, error)

func (*LabClient) ProjectPipelines added in v0.2.0

func (l *LabClient) ProjectPipelines(repositoryName string, opt *gitlab.ListProjectPipelinesOptions) (gitlab.PipelineList, error)

func (*LabClient) ProjectUsers added in v0.3.0

func (l *LabClient) ProjectUsers(repositoryName string, opt *gitlab.ListProjectUserOptions) ([]*gitlab.ProjectUser, error)

func (*LabClient) Projects added in v0.2.0

func (l *LabClient) Projects(opt *gitlab.ListProjectsOptions) ([]*gitlab.Project, error)

func (*LabClient) Users added in v0.3.0

func (l *LabClient) Users(opt *gitlab.ListUsersOptions) ([]*gitlab.User, error)

type MergeRequest added in v0.3.0

type MergeRequest interface {
	GetMergeRequest(pid int, repositoryName string) (*gitlab.MergeRequest, error)
	GetAllProjectMergeRequest(opt *gitlab.ListMergeRequestsOptions) ([]*gitlab.MergeRequest, error)
	GetProjectMargeRequest(opt *gitlab.ListProjectMergeRequestsOptions, repositoryName string) ([]*gitlab.MergeRequest, error)
	CreateMergeRequest(opt *gitlab.CreateMergeRequestOptions, repositoryName string) (*gitlab.MergeRequest, error)
	UpdateMergeRequest(opt *gitlab.UpdateMergeRequestOptions, pid int, repositoryName string) (*gitlab.MergeRequest, error)
}

type MergeRequestClient added in v0.3.0

type MergeRequestClient struct {
	MergeRequest
	Client *gitlab.Client
}

func NewMergeRequestClient added in v0.3.0

func NewMergeRequestClient(client *gitlab.Client) *MergeRequestClient

func (*MergeRequestClient) CreateMergeRequest added in v0.3.0

func (l *MergeRequestClient) CreateMergeRequest(opt *gitlab.CreateMergeRequestOptions, repositoryName string) (*gitlab.MergeRequest, error)

func (*MergeRequestClient) GetAllProjectMergeRequest added in v0.3.0

func (l *MergeRequestClient) GetAllProjectMergeRequest(opt *gitlab.ListMergeRequestsOptions) ([]*gitlab.MergeRequest, error)

func (*MergeRequestClient) GetMergeRequest added in v0.3.0

func (l *MergeRequestClient) GetMergeRequest(pid int, repositoryName string) (*gitlab.MergeRequest, error)

func (*MergeRequestClient) GetProjectMargeRequest added in v0.3.0

func (l *MergeRequestClient) GetProjectMargeRequest(opt *gitlab.ListProjectMergeRequestsOptions, repositoryName string) ([]*gitlab.MergeRequest, error)

func (*MergeRequestClient) UpdateMergeRequest added in v0.3.0

func (l *MergeRequestClient) UpdateMergeRequest(opt *gitlab.UpdateMergeRequestOptions, pid int, repositoryName string) (*gitlab.MergeRequest, error)

type MockLabClient

type MockLabClient struct {
	Client
	// Project
	MockProjects func(opt *gitlab.ListProjectsOptions) ([]*gitlab.Project, error)
	// Pipeline
	MockProjectPipelines    func(repositoryName string, opt *gitlab.ListProjectPipelinesOptions) (gitlab.PipelineList, error)
	MockProjectPipelineJobs func(repositoryName string, opt *gitlab.ListJobsOptions, pid int) ([]*gitlab.Job, error)
	// Lint
	MockLint func(content string) (*gitlab.LintResult, error)
	// User
	MockProjectUsers func(repositoryName string, opt *gitlab.ListProjectUserOptions) ([]*gitlab.ProjectUser, error)
	MockUsers        func(opt *gitlab.ListUsersOptions) ([]*gitlab.User, error)
}

func (*MockLabClient) Lint added in v0.2.0

func (m *MockLabClient) Lint(content string) (*gitlab.LintResult, error)

func (*MockLabClient) ProjectPipelineJobs added in v0.3.0

func (m *MockLabClient) ProjectPipelineJobs(repositoryName string, opt *gitlab.ListJobsOptions, pid int) ([]*gitlab.Job, error)

func (*MockLabClient) ProjectPipelines added in v0.2.0

func (m *MockLabClient) ProjectPipelines(repositoryName string, opt *gitlab.ListProjectPipelinesOptions) (gitlab.PipelineList, error)

func (*MockLabClient) ProjectUsers added in v0.3.0

func (m *MockLabClient) ProjectUsers(repositoryName string, opt *gitlab.ListProjectUserOptions) ([]*gitlab.ProjectUser, error)

func (*MockLabClient) Projects added in v0.2.0

func (m *MockLabClient) Projects(opt *gitlab.ListProjectsOptions) ([]*gitlab.Project, error)

func (*MockLabClient) Users added in v0.3.0

func (m *MockLabClient) Users(opt *gitlab.ListUsersOptions) ([]*gitlab.User, error)

type MockLabIssueClient added in v0.3.0

type MockLabIssueClient struct {
	Issue
	MockGetIssue            func(pid int, repositoryName string) (*gitlab.Issue, error)
	MockGetAllProjectIssues func(opt *gitlab.ListIssuesOptions) ([]*gitlab.Issue, error)
	MockGetProjectIssues    func(opt *gitlab.ListProjectIssuesOptions, repositoryName string) ([]*gitlab.Issue, error)
	MockCreateIssue         func(opt *gitlab.CreateIssueOptions, repositoryName string) (*gitlab.Issue, error)
	MockUpdateIssue         func(opt *gitlab.UpdateIssueOptions, pid int, repositoryName string) (*gitlab.Issue, error)
}

func (*MockLabIssueClient) CreateIssue added in v0.3.0

func (m *MockLabIssueClient) CreateIssue(opt *gitlab.CreateIssueOptions, repositoryName string) (*gitlab.Issue, error)

func (*MockLabIssueClient) GetAllProjectIssues added in v0.3.0

func (m *MockLabIssueClient) GetAllProjectIssues(opt *gitlab.ListIssuesOptions) ([]*gitlab.Issue, error)

func (*MockLabIssueClient) GetIssue added in v0.3.0

func (m *MockLabIssueClient) GetIssue(pid int, repositoryName string) (*gitlab.Issue, error)

func (*MockLabIssueClient) GetProjectIssues added in v0.3.0

func (m *MockLabIssueClient) GetProjectIssues(opt *gitlab.ListProjectIssuesOptions, repositoryName string) ([]*gitlab.Issue, error)

func (*MockLabIssueClient) UpdateIssue added in v0.3.0

func (m *MockLabIssueClient) UpdateIssue(opt *gitlab.UpdateIssueOptions, pid int, repositoryName string) (*gitlab.Issue, error)

type MockLabJobClient added in v0.4.0

type MockLabJobClient struct {
	Job
	MockGetProjectJobs func(opt *gitlab.ListJobsOptions, repositoryName string) ([]*gitlab.Job, error)
}

func (*MockLabJobClient) GetProjectJobs added in v0.4.0

func (m *MockLabJobClient) GetProjectJobs(opt *gitlab.ListJobsOptions, repositoryName string) ([]*gitlab.Job, error)

type MockLabMergeRequestClient added in v0.3.0

type MockLabMergeRequestClient struct {
	MergeRequest
	MockGetMergeRequest           func(pid int, repositoryName string) (*gitlab.MergeRequest, error)
	MockGetAllProjectMergeRequest func(opt *gitlab.ListMergeRequestsOptions) ([]*gitlab.MergeRequest, error)
	MockGetProjectMargeRequest    func(opt *gitlab.ListProjectMergeRequestsOptions, repositoryName string) ([]*gitlab.MergeRequest, error)
	MockCreateMergeRequest        func(opt *gitlab.CreateMergeRequestOptions, repositoryName string) (*gitlab.MergeRequest, error)
	MockUpdateMergeRequest        func(opt *gitlab.UpdateMergeRequestOptions, pid int, repositoryName string) (*gitlab.MergeRequest, error)
}

func (*MockLabMergeRequestClient) CreateMergeRequest added in v0.3.0

func (m *MockLabMergeRequestClient) CreateMergeRequest(opt *gitlab.CreateMergeRequestOptions, repositoryName string) (*gitlab.MergeRequest, error)

func (*MockLabMergeRequestClient) GetAllProjectMergeRequest added in v0.3.0

func (m *MockLabMergeRequestClient) GetAllProjectMergeRequest(opt *gitlab.ListMergeRequestsOptions) ([]*gitlab.MergeRequest, error)

func (*MockLabMergeRequestClient) GetMergeRequest added in v0.3.0

func (m *MockLabMergeRequestClient) GetMergeRequest(pid int, repositoryName string) (*gitlab.MergeRequest, error)

func (*MockLabMergeRequestClient) GetProjectMargeRequest added in v0.3.0

func (m *MockLabMergeRequestClient) GetProjectMargeRequest(opt *gitlab.ListProjectMergeRequestsOptions, repositoryName string) ([]*gitlab.MergeRequest, error)

func (*MockLabMergeRequestClient) UpdateMergeRequest added in v0.3.0

func (m *MockLabMergeRequestClient) UpdateMergeRequest(opt *gitlab.UpdateMergeRequestOptions, pid int, repositoryName string) (*gitlab.MergeRequest, error)

type MockProjectVariableClient added in v0.5.0

type MockProjectVariableClient struct {
	ProjectVariable
	MockGetVariables   func(repositoryName string) ([]*gitlab.ProjectVariable, error)
	MockCreateVariable func(repositoryName string, opt *gitlab.CreateVariableOptions) (*gitlab.ProjectVariable, error)
	MockUpdateVariable func(repositoryName string, key string, opt *gitlab.UpdateVariableOptions) (*gitlab.ProjectVariable, error)
	MockRemoveVariable func(repositoryName string, key string) error
}

func (*MockProjectVariableClient) CreateVariable added in v0.5.0

func (c *MockProjectVariableClient) CreateVariable(repositoryName string, opt *gitlab.CreateVariableOptions) (*gitlab.ProjectVariable, error)

func (*MockProjectVariableClient) GetVariables added in v0.5.0

func (c *MockProjectVariableClient) GetVariables(repositoryName string) ([]*gitlab.ProjectVariable, error)

func (*MockProjectVariableClient) RemoveVariable added in v0.5.0

func (c *MockProjectVariableClient) RemoveVariable(repositoryName string, key string) error

func (*MockProjectVariableClient) UpdateVariable added in v0.5.0

func (c *MockProjectVariableClient) UpdateVariable(repositoryName string, key string, opt *gitlab.UpdateVariableOptions) (*gitlab.ProjectVariable, error)

type MockProvider

type MockProvider struct {
	Provider
	MockInit                     func() error
	MockGetSpecificRemote        func(namespace, project string) *git.RemoteInfo
	MockGetCurrentRemote         func() (*git.RemoteInfo, error)
	MockGetClient                func(remote *git.RemoteInfo) (Client, error)
	MockGetIssueClient           func(remote *git.RemoteInfo) (Issue, error)
	MockGetMergeRequestClient    func(remote *git.RemoteInfo) (MergeRequest, error)
	MockGetProjectVariableClient func(remote *git.RemoteInfo) (ProjectVariable, error)
}

func (*MockProvider) GetClient

func (m *MockProvider) GetClient(remote *git.RemoteInfo) (Client, error)

func (*MockProvider) GetCurrentRemote

func (m *MockProvider) GetCurrentRemote() (*git.RemoteInfo, error)

func (*MockProvider) GetIssueClient added in v0.3.0

func (m *MockProvider) GetIssueClient(remote *git.RemoteInfo) (Issue, error)

func (*MockProvider) GetMergeRequestClient added in v0.3.0

func (m *MockProvider) GetMergeRequestClient(remote *git.RemoteInfo) (MergeRequest, error)

func (*MockProvider) GetProjectVariableClient added in v0.5.0

func (m *MockProvider) GetProjectVariableClient(remote *git.RemoteInfo) (ProjectVariable, error)

func (*MockProvider) Init

func (m *MockProvider) Init() error

type ProjectVariable added in v0.5.0

type ProjectVariable interface {
	GetVariables(repositoryName string) ([]*gitlab.ProjectVariable, error)
	CreateVariable(repositoryName string, opt *gitlab.CreateVariableOptions) (*gitlab.ProjectVariable, error)
	UpdateVariable(repositoryName string, key string, opt *gitlab.UpdateVariableOptions) (*gitlab.ProjectVariable, error)
	RemoveVariable(repositoryName string, key string) error
}

func NewProjectVariableClient added in v0.5.0

func NewProjectVariableClient(client *gitlab.Client) ProjectVariable

type ProjectVariableClient added in v0.5.0

type ProjectVariableClient struct {
	ProjectVariable
	Client *gitlab.Client
}

func (*ProjectVariableClient) CreateVariable added in v0.5.0

func (c *ProjectVariableClient) CreateVariable(repositoryName string, opt *gitlab.CreateVariableOptions) (*gitlab.ProjectVariable, error)

func (*ProjectVariableClient) GetVariables added in v0.5.0

func (c *ProjectVariableClient) GetVariables(repositoryName string) ([]*gitlab.ProjectVariable, error)

func (*ProjectVariableClient) RemoveVariable added in v0.5.0

func (c *ProjectVariableClient) RemoveVariable(repositoryName string, key string) error

func (*ProjectVariableClient) UpdateVariable added in v0.5.0

func (c *ProjectVariableClient) UpdateVariable(repositoryName string, key string, opt *gitlab.UpdateVariableOptions) (*gitlab.ProjectVariable, error)

type Provider

type Provider interface {
	Init() error
	GetCurrentRemote() (*git.RemoteInfo, error)
	GetClient(remote *git.RemoteInfo) (Client, error)
	GetJobClient(remote *git.RemoteInfo) (Job, error)
	GetIssueClient(remote *git.RemoteInfo) (Issue, error)
	GetMergeRequestClient(remote *git.RemoteInfo) (MergeRequest, error)
	GetProjectVariableClient(remote *git.RemoteInfo) (ProjectVariable, error)
	GetRepositoryClient(remote *git.RemoteInfo) (Repository, error)
}

type Repository added in v0.5.2

type Repository interface {
	GetTree(repositoryName string, opt *gitlab.ListTreeOptions) ([]*gitlab.TreeNode, error)
	GetFile(repositoryName string, filename string, opt *gitlab.GetRawFileOptions) (string, error)
}

func NewRepositoryClient added in v0.5.2

func NewRepositoryClient(client *gitlab.Client) Repository

type RepositoryClient added in v0.5.2

type RepositoryClient struct {
	ProjectVariable
	Client *gitlab.Client
}

func (*RepositoryClient) GetFile added in v0.5.2

func (c *RepositoryClient) GetFile(repositoryName string, filename string, opt *gitlab.GetRawFileOptions) (string, error)

func (*RepositoryClient) GetTree added in v0.5.2

func (c *RepositoryClient) GetTree(repositoryName string, opt *gitlab.ListTreeOptions) ([]*gitlab.TreeNode, error)

Jump to

Keyboard shortcuts

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