Documentation ¶
Index ¶
- Constants
- func NewClient(token string, tokenType string, optFns ...gitprovider.ClientOption) (gitprovider.Client, error)
- type BranchClient
- type Client
- func (c *Client) HasTokenPermission(_ context.Context, _ gitprovider.TokenPermission) (bool, error)
- func (c *Client) OrgRepositories() gitprovider.OrgRepositoriesClient
- func (c *Client) Organizations() gitprovider.OrganizationsClient
- func (c *Client) ProviderID() gitprovider.ProviderID
- func (c *Client) Raw() interface{}
- func (c *Client) SupportedDomain() string
- func (c *Client) SupportedSSHDomain() string
- func (c *Client) UserRepositories() gitprovider.UserRepositoriesClient
- type CommitClient
- type DeployKeyClient
- func (c *DeployKeyClient) Create(_ context.Context, req gitprovider.DeployKeyInfo) (gitprovider.DeployKey, error)
- func (c *DeployKeyClient) Get(_ context.Context, deployKeyName string) (gitprovider.DeployKey, error)
- func (c *DeployKeyClient) List(_ context.Context) ([]gitprovider.DeployKey, error)
- func (c *DeployKeyClient) Reconcile(ctx context.Context, req gitprovider.DeployKeyInfo) (gitprovider.DeployKey, bool, error)
- type DeployTokenClient
- func (c *DeployTokenClient) Create(_ context.Context, req gitprovider.DeployTokenInfo) (gitprovider.DeployToken, error)
- func (c *DeployTokenClient) Get(_ context.Context, deployTokenName string) (gitprovider.DeployToken, error)
- func (c *DeployTokenClient) List(_ context.Context) ([]gitprovider.DeployToken, error)
- func (c *DeployTokenClient) Reconcile(ctx context.Context, req gitprovider.DeployTokenInfo) (gitprovider.DeployToken, bool, error)
- type FileClient
- type OrgRepositoriesClient
- func (c *OrgRepositoriesClient) Create(ctx context.Context, ref gitprovider.OrgRepositoryRef, ...) (gitprovider.OrgRepository, error)
- func (c *OrgRepositoriesClient) Get(ctx context.Context, ref gitprovider.OrgRepositoryRef) (gitprovider.OrgRepository, error)
- func (c *OrgRepositoriesClient) List(ctx context.Context, ref gitprovider.OrganizationRef) ([]gitprovider.OrgRepository, error)
- func (c *OrgRepositoriesClient) Reconcile(ctx context.Context, ref gitprovider.OrgRepositoryRef, ...) (gitprovider.OrgRepository, bool, error)
- type OrganizationsClient
- func (c *OrganizationsClient) Children(ctx context.Context, ref gitprovider.OrganizationRef) ([]gitprovider.Organization, error)
- func (c *OrganizationsClient) Get(ctx context.Context, ref gitprovider.OrganizationRef) (gitprovider.Organization, error)
- func (c *OrganizationsClient) List(ctx context.Context) ([]gitprovider.Organization, error)
- type PullRequestClient
- func (c *PullRequestClient) Create(_ context.Context, title, branch, baseBranch, description string) (gitprovider.PullRequest, error)
- func (c *PullRequestClient) Edit(ctx context.Context, number int, opts gitprovider.EditOptions) (gitprovider.PullRequest, error)
- func (c *PullRequestClient) Get(_ context.Context, number int) (gitprovider.PullRequest, error)
- func (c *PullRequestClient) List(_ context.Context) ([]gitprovider.PullRequest, error)
- func (c *PullRequestClient) Merge(_ context.Context, number int, mergeMethod gitprovider.MergeMethod, ...) error
- type TeamAccessClient
- func (c *TeamAccessClient) Create(ctx context.Context, req gitprovider.TeamAccessInfo) (gitprovider.TeamAccess, error)
- func (c *TeamAccessClient) Get(ctx context.Context, teamName string) (gitprovider.TeamAccess, error)
- func (c *TeamAccessClient) List(ctx context.Context) ([]gitprovider.TeamAccess, error)
- func (c *TeamAccessClient) Reconcile(ctx context.Context, req gitprovider.TeamAccessInfo) (gitprovider.TeamAccess, bool, error)
- type TeamsClient
- type TreeClient
- type UserRepositoriesClient
- func (c *UserRepositoriesClient) Create(ctx context.Context, ref gitprovider.UserRepositoryRef, ...) (gitprovider.UserRepository, error)
- func (c *UserRepositoriesClient) Get(ctx context.Context, ref gitprovider.UserRepositoryRef) (gitprovider.UserRepository, error)
- func (c *UserRepositoriesClient) GetUserLogin(ctx context.Context) (gitprovider.IdentityRef, error)
- func (c *UserRepositoriesClient) List(ctx context.Context, ref gitprovider.UserRef) ([]gitprovider.UserRepository, error)
- func (c *UserRepositoriesClient) Reconcile(ctx context.Context, ref gitprovider.UserRepositoryRef, ...) (gitprovider.UserRepository, bool, error)
Constants ¶
const (
// DefaultDomain specifies the default domain used as the backend.
DefaultDomain = "gitlab.com"
)
const ProviderID = gitprovider.ProviderID("gitlab")
ProviderID is the provider ID for GitLab.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(token string, tokenType string, optFns ...gitprovider.ClientOption) (gitprovider.Client, error)
NewClient creates a new gitlab.Client instance for GitLab API endpoints.
Types ¶
type BranchClient ¶ added in v0.1.0
type BranchClient struct {
// contains filtered or unexported fields
}
BranchClient operates on the branch for a specific repository.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an interface that allows talking to a Git provider.
func (*Client) HasTokenPermission ¶
func (c *Client) HasTokenPermission(_ context.Context, _ gitprovider.TokenPermission) (bool, error)
HasTokenPermission returns true if the given token has the given permissions.
func (*Client) OrgRepositories ¶
func (c *Client) OrgRepositories() gitprovider.OrgRepositoriesClient
OrgRepositories returns the OrgRepositoriesClient handling sets of repositories in an organization.
func (*Client) Organizations ¶
func (c *Client) Organizations() gitprovider.OrganizationsClient
Organizations returns the OrganizationsClient handling sets of organizations.
func (*Client) ProviderID ¶
func (c *Client) ProviderID() gitprovider.ProviderID
ProviderID returns the provider ID "gitlab". This field is set at client creation time, and can't be changed.
func (*Client) Raw ¶
func (c *Client) Raw() interface{}
Raw returns the Go GitLab client (github.com/xanzy *Client) used under the hood for accessing GitLab.
func (*Client) SupportedDomain ¶
SupportedDomain returns the domain endpoint for this client, e.g. "gitlab.com" or "my-custom-git-server.com:6443". This allows a higher-level user to know what Client to use for what endpoints. This field is set at client creation time, and can't be changed.
func (*Client) SupportedSSHDomain ¶
SupportedSSHDomain returns the ssh domain endpoint for this client, e.g. "gitlab.com" or "ssh.my-custom-git-server.com:6443". This allows a higher-level user to know what Client to use for what endpoints. This field is set at client creation time, and can't be changed.
func (*Client) UserRepositories ¶
func (c *Client) UserRepositories() gitprovider.UserRepositoriesClient
UserRepositories returns the UserRepositoriesClient handling sets of repositories for a user.
type CommitClient ¶ added in v0.1.0
type CommitClient struct {
// contains filtered or unexported fields
}
CommitClient operates on the commits for a specific repository.
func (*CommitClient) Create ¶ added in v0.1.0
func (c *CommitClient) Create(_ context.Context, branch string, message string, files []gitprovider.CommitFile) (gitprovider.Commit, error)
Create creates a commit with the given specifications.
func (*CommitClient) ListPage ¶ added in v0.1.0
func (c *CommitClient) ListPage(_ context.Context, branch string, perPage, page int) ([]gitprovider.Commit, error)
ListPage lists repository commits of the given page and page size.
type DeployKeyClient ¶
type DeployKeyClient struct {
// contains filtered or unexported fields
}
DeployKeyClient operates on the access deploy key list for a specific repository.
func (*DeployKeyClient) Create ¶
func (c *DeployKeyClient) Create(_ context.Context, req gitprovider.DeployKeyInfo) (gitprovider.DeployKey, error)
Create creates a deploy key with the given specifications.
ErrAlreadyExists will be returned if the resource already exists.
func (*DeployKeyClient) Get ¶
func (c *DeployKeyClient) Get(_ context.Context, deployKeyName string) (gitprovider.DeployKey, error)
Get returns the repository at the given path.
ErrNotFound is returned if the resource does not exist.
func (*DeployKeyClient) List ¶
func (c *DeployKeyClient) List(_ context.Context) ([]gitprovider.DeployKey, error)
List lists all repository deploy keys of the given deploy key type.
List returns all available repository deploy keys for the given type, using multiple paginated requests if needed.
func (*DeployKeyClient) Reconcile ¶
func (c *DeployKeyClient) Reconcile(ctx context.Context, req gitprovider.DeployKeyInfo) (gitprovider.DeployKey, bool, error)
Reconcile makes sure the given desired state (req) becomes the actual state in the backing Git provider.
If req doesn't exist under the hood, it is created (actionTaken == true). If req doesn't equal the actual state, the resource will be deleted and recreated (actionTaken == true). If req is already the actual state, this is a no-op (actionTaken == false).
type DeployTokenClient ¶ added in v0.15.0
type DeployTokenClient struct {
// contains filtered or unexported fields
}
DeployTokenClient operates on the access deploy token list for a specific repository.
func (*DeployTokenClient) Create ¶ added in v0.15.0
func (c *DeployTokenClient) Create(_ context.Context, req gitprovider.DeployTokenInfo) (gitprovider.DeployToken, error)
Create creates a deploy token with the given specifications.
ErrAlreadyExists will be returned if the resource already exists.
func (*DeployTokenClient) Get ¶ added in v0.15.0
func (c *DeployTokenClient) Get(_ context.Context, deployTokenName string) (gitprovider.DeployToken, error)
Get returns the repository at the given path.
ErrNotFound is returned if the resource does not exist.
func (*DeployTokenClient) List ¶ added in v0.15.0
func (c *DeployTokenClient) List(_ context.Context) ([]gitprovider.DeployToken, error)
List lists all repository deploy tokens of the given deploy token type.
List returns all available repository deploy tokens for the given type, using multiple paginated requests if needed.
func (*DeployTokenClient) Reconcile ¶ added in v0.15.0
func (c *DeployTokenClient) Reconcile(ctx context.Context, req gitprovider.DeployTokenInfo) (gitprovider.DeployToken, bool, error)
Reconcile makes sure the given desired state (req) becomes the actual state in the backing Git provider.
If req doesn't exist under the hood, it is created (actionTaken == true). If req doesn't equal the actual state, the resource will be deleted and recreated (actionTaken == true). If req is already the actual state, this is a no-op (actionTaken == false).
type FileClient ¶ added in v0.5.3
type FileClient struct {
// contains filtered or unexported fields
}
FileClient operates on the branch for a specific repository.
func (*FileClient) Get ¶ added in v0.5.3
func (c *FileClient) Get(ctx context.Context, path, branch string, optFns ...gitprovider.FilesGetOption) ([]*gitprovider.CommitFile, error)
Get fetches and returns the contents of a file or multiple files in a directory from a given branch and path with possible options of FilesGetOption If a file path is given, the contents of the file are returned If a directory path is given, the contents of the files in the path's root are returned
type OrgRepositoriesClient ¶
type OrgRepositoriesClient struct {
// contains filtered or unexported fields
}
OrgRepositoriesClient operates on repositories the user has access to.
func (*OrgRepositoriesClient) Create ¶
func (c *OrgRepositoriesClient) Create(ctx context.Context, ref gitprovider.OrgRepositoryRef, req gitprovider.RepositoryInfo, opts ...gitprovider.RepositoryCreateOption) (gitprovider.OrgRepository, error)
Create creates a repository for the given organization, with the data and options.
ErrAlreadyExists will be returned if the resource already exists.
func (*OrgRepositoriesClient) Get ¶
func (c *OrgRepositoriesClient) Get(ctx context.Context, ref gitprovider.OrgRepositoryRef) (gitprovider.OrgRepository, error)
Get returns the repository at the given path.
ErrNotFound is returned if the resource does not exist.
func (*OrgRepositoriesClient) List ¶
func (c *OrgRepositoriesClient) List(ctx context.Context, ref gitprovider.OrganizationRef) ([]gitprovider.OrgRepository, error)
List all repositories in the given organization.
List returns all available repositories, using multiple paginated requests if needed.
func (*OrgRepositoriesClient) Reconcile ¶
func (c *OrgRepositoriesClient) Reconcile(ctx context.Context, ref gitprovider.OrgRepositoryRef, req gitprovider.RepositoryInfo, opts ...gitprovider.RepositoryReconcileOption) (gitprovider.OrgRepository, bool, error)
Reconcile makes sure the given desired state (req) becomes the actual state in the backing Git provider.
If req doesn't exist under the hood, it is created (actionTaken == true). If req doesn't equal the actual state, the resource will be updated (actionTaken == true). If req is already the actual state, this is a no-op (actionTaken == false).
type OrganizationsClient ¶
type OrganizationsClient struct {
// contains filtered or unexported fields
}
OrganizationsClient operates on the groups the user has access to.
func (*OrganizationsClient) Children ¶
func (c *OrganizationsClient) Children(ctx context.Context, ref gitprovider.OrganizationRef) ([]gitprovider.Organization, error)
Children returns the immediate child-organizations for the specific OrganizationRef o. The OrganizationRef may point to any existing sub-organization.
Children returns all available organizations, using multiple paginated requests if needed.
func (*OrganizationsClient) Get ¶
func (c *OrganizationsClient) Get(ctx context.Context, ref gitprovider.OrganizationRef) (gitprovider.Organization, error)
Get a specific group the user has access to. This can refer to a sub-group in GitLab.
ErrNotFound is returned if the resource does not exist.
func (*OrganizationsClient) List ¶
func (c *OrganizationsClient) List(ctx context.Context) ([]gitprovider.Organization, error)
List all groups the specific user has access to.
List returns all available groups, using multiple paginated requests if needed.
type PullRequestClient ¶ added in v0.1.0
type PullRequestClient struct {
// contains filtered or unexported fields
}
PullRequestClient operates on the pull requests for a specific repository.
func (*PullRequestClient) Create ¶ added in v0.1.0
func (c *PullRequestClient) Create(_ context.Context, title, branch, baseBranch, description string) (gitprovider.PullRequest, error)
Create creates a pull request with the given specifications.
func (*PullRequestClient) Edit ¶ added in v0.10.0
func (c *PullRequestClient) Edit(ctx context.Context, number int, opts gitprovider.EditOptions) (gitprovider.PullRequest, error)
Edit modifies an existing MR. Please refer to "EditOptions" for details on which data can be edited.
func (*PullRequestClient) Get ¶ added in v0.3.0
func (c *PullRequestClient) Get(_ context.Context, number int) (gitprovider.PullRequest, error)
Get retrieves an existing pull request by number
func (*PullRequestClient) List ¶ added in v0.3.0
func (c *PullRequestClient) List(_ context.Context) ([]gitprovider.PullRequest, error)
List lists all pull requests in the repository
func (*PullRequestClient) Merge ¶ added in v0.3.0
func (c *PullRequestClient) Merge(_ context.Context, number int, mergeMethod gitprovider.MergeMethod, message string) error
Merge merges a pull request with the given specifications.
type TeamAccessClient ¶
type TeamAccessClient struct {
// contains filtered or unexported fields
}
TeamAccessClient operates on the teams list for a specific repository.
func (*TeamAccessClient) Create ¶
func (c *TeamAccessClient) Create(ctx context.Context, req gitprovider.TeamAccessInfo) (gitprovider.TeamAccess, error)
Create adds a given team to the repo's team access control list.
ErrAlreadyExists will be returned if the resource already exists.
func (*TeamAccessClient) Get ¶
func (c *TeamAccessClient) Get(ctx context.Context, teamName string) (gitprovider.TeamAccess, error)
Get a team within the specific organization.
name may include slashes, but must not be an empty string. Teams are sub-groups in GitLab.
ErrNotFound is returned if the resource does not exist.
func (*TeamAccessClient) List ¶
func (c *TeamAccessClient) List(ctx context.Context) ([]gitprovider.TeamAccess, error)
List lists the team access control list for this repository.
List returns all available team access lists, using multiple paginated requests if needed.
func (*TeamAccessClient) Reconcile ¶
func (c *TeamAccessClient) Reconcile(ctx context.Context, req gitprovider.TeamAccessInfo, ) (gitprovider.TeamAccess, bool, error)
Reconcile makes sure the given desired state (req) becomes the actual state in the backing Git provider.
If req doesn't exist under the hood, it is created (actionTaken == true). If req doesn't equal the actual state, the resource will be deleted and recreated (actionTaken == true). If req is already the actual state, this is a no-op (actionTaken == false).
type TeamsClient ¶
type TeamsClient struct {
// contains filtered or unexported fields
}
TeamsClient handles teams organization-wide.
func (*TeamsClient) Get ¶
func (c *TeamsClient) Get(ctx context.Context, teamName string) (gitprovider.Team, error)
Get a team within the specific organization.
teamName may include slashes, to point to e.g. subgroups in GitLab. teamName must not be an empty string.
ErrNotFound is returned if the resource does not exist.
func (*TeamsClient) List ¶
func (c *TeamsClient) List(ctx context.Context) ([]gitprovider.Team, error)
List all teams (recursively, in terms of subgroups) within the specific organization.
List returns all available organizations, using multiple paginated requests if needed.
type TreeClient ¶ added in v0.9.0
type TreeClient struct {
// contains filtered or unexported fields
}
TreeClient operates on the trees in a specific repository.
func (*TreeClient) Get ¶ added in v0.9.0
func (c *TreeClient) Get(ctx context.Context, sha string, recursive bool) (*gitprovider.TreeInfo, error)
Get returns a tree
type UserRepositoriesClient ¶
type UserRepositoriesClient struct {
// contains filtered or unexported fields
}
UserRepositoriesClient operates on repositories the user has access to.
func (*UserRepositoriesClient) Create ¶
func (c *UserRepositoriesClient) Create(ctx context.Context, ref gitprovider.UserRepositoryRef, req gitprovider.RepositoryInfo, opts ...gitprovider.RepositoryCreateOption, ) (gitprovider.UserRepository, error)
Create creates a repository for the given organization, with the data and options
ErrAlreadyExists will be returned if the resource already exists.
func (*UserRepositoriesClient) Get ¶
func (c *UserRepositoriesClient) Get(ctx context.Context, ref gitprovider.UserRepositoryRef) (gitprovider.UserRepository, error)
Get returns the repository at the given path.
ErrNotFound is returned if the resource does not exist.
func (*UserRepositoriesClient) GetUserLogin ¶ added in v0.19.0
func (c *UserRepositoriesClient) GetUserLogin(ctx context.Context) (gitprovider.IdentityRef, error)
GetUserLogin returns the current authenticated user.
func (*UserRepositoriesClient) List ¶
func (c *UserRepositoriesClient) List(ctx context.Context, ref gitprovider.UserRef) ([]gitprovider.UserRepository, error)
List all repositories in the given organization.
List returns all available repositories, using multiple paginated requests if needed.
func (*UserRepositoriesClient) Reconcile ¶
func (c *UserRepositoriesClient) Reconcile(ctx context.Context, ref gitprovider.UserRepositoryRef, req gitprovider.RepositoryInfo, opts ...gitprovider.RepositoryReconcileOption) (gitprovider.UserRepository, bool, error)
Reconcile makes sure the given desired state (req) becomes the actual state in the backing Git provider.
If req doesn't exist under the hood, it is created (actionTaken == true). If req doesn't equal the actual state, the resource will be updated (actionTaken == true). If req is already the actual state, this is a no-op (actionTaken == false).
Source Files ¶
- auth.go
- client.go
- client_organization_teams.go
- client_organizations.go
- client_repositories_org.go
- client_repositories_user.go
- client_repository_branch.go
- client_repository_commit.go
- client_repository_deploykey.go
- client_repository_deploytoken.go
- client_repository_file.go
- client_repository_pullrequest.go
- client_repository_teamaccess.go
- client_repository_tree.go
- gitlabclient.go
- resource_commit.go
- resource_deploykey.go
- resource_deploytoken.go
- resource_organization.go
- resource_pullrequest.go
- resource_repository.go
- resource_teamaccess.go
- util.go