gitlab

package
v0.3.35 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Copyright (C) 2021-2023, Kubefirst

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyTokenPermissions

func VerifyTokenPermissions(gitlabToken string) error

VerifyTokenPermissions compares scope of the provided token to the required scopes for kubefirst functionality

Types

type DeployTokenCreateParameters

type DeployTokenCreateParameters struct {
	Name     string
	Username string
	Scopes   []string
}

DeployTokenCreateParameters holds values to be passed to a function to create deploy tokens

type GitLabWrapper

type GitLabWrapper struct {
	Client          *gitlab.Client
	ParentGroupID   int
	ParentGroupPath string
}

GitLabWrapper holds gitlab cloud client info and provides and interface to its functions

func NewGitLabClient

func NewGitLabClient(token string, parentGroupName string) (GitLabWrapper, error)

NewGitLabClient instantiates a wrapper to communicate with GitLab It sets the path and ID of the group under which resources will be managed

func (*GitLabWrapper) AddUserSSHKey

func (gl *GitLabWrapper) AddUserSSHKey(keyTitle string, keyValue string) error

AddUserSSHKey

func (*GitLabWrapper) CheckProjectExists

func (gl *GitLabWrapper) CheckProjectExists(projectName string) (bool, error)

CheckProjectExists within a parent group

func (*GitLabWrapper) CreateGroupDeployToken added in v0.1.7

func (gl *GitLabWrapper) CreateGroupDeployToken(groupID int, p *DeployTokenCreateParameters) (string, error)

CreateGroupDeployToken creates a deploy token for a group If no groupID (0 by default) argument is provided, the parent group ID is used If a group deploy token already exists, it will be deleted and recreated

func (*GitLabWrapper) CreateProjectDeployToken

func (gl *GitLabWrapper) CreateProjectDeployToken(projectName string, p *DeployTokenCreateParameters) (string, error)

CreateProjectDeployToken

func (*GitLabWrapper) DeleteContainerRegistryRepository

func (gl *GitLabWrapper) DeleteContainerRegistryRepository(projectName string, repositoryID int) error

DeleteProjectContainerRegistryRepository

func (*GitLabWrapper) DeleteGroupRunners

func (gl *GitLabWrapper) DeleteGroupRunners(runners []gitlab.Runner) error

DeleteGroupRunners deletes provided runners for a parent group

func (*GitLabWrapper) DeleteProjectWebhook

func (gl *GitLabWrapper) DeleteProjectWebhook(projectName string, url string) error

DeleteProjectWebhook

func (*GitLabWrapper) DeleteUserSSHKey

func (gl *GitLabWrapper) DeleteUserSSHKey(keyTitle string) error

DeleteUserSSHKey

func (*GitLabWrapper) GetProjectContainerRegistryRepositories

func (gl *GitLabWrapper) GetProjectContainerRegistryRepositories(projectName string) ([]gitlab.RegistryRepository, error)

GetProjectContainerRegistryRepositories

func (*GitLabWrapper) GetProjectID

func (gl *GitLabWrapper) GetProjectID(projectName string) (int, error)

GetProjectID returns a project's ID scoped to the parent group

func (*GitLabWrapper) GetProjects

func (gl *GitLabWrapper) GetProjects() ([]gitlab.Project, error)

GetProjects for a specific parent group by ID

func (*GitLabWrapper) GetSubGroups

func (gl *GitLabWrapper) GetSubGroups() ([]gitlab.Group, error)

GetSubGroups for a specific parent group by ID

func (*GitLabWrapper) GetUserSSHKeys

func (gl *GitLabWrapper) GetUserSSHKeys() ([]*gitlab.SSHKey, error)

GetUserSSHKeys

func (*GitLabWrapper) ListGroupDeployTokens added in v0.1.7

func (gl *GitLabWrapper) ListGroupDeployTokens(groupID int) ([]gitlab.DeployToken, error)

ListGroupDeployTokens

func (*GitLabWrapper) ListGroupRunners

func (gl *GitLabWrapper) ListGroupRunners() ([]gitlab.Runner, error)

ListGroupRunners returns all registered runners for a parent group

func (*GitLabWrapper) ListProjectDeployTokens

func (gl *GitLabWrapper) ListProjectDeployTokens(projectName string) ([]gitlab.DeployToken, error)

ListProjectDeployTokens

func (*GitLabWrapper) ListProjectWebhooks

func (gl *GitLabWrapper) ListProjectWebhooks(projectID int) ([]gitlab.ProjectHook, error)

ListProjectWebhooks returns all webhooks for a project

Jump to

Keyboard shortcuts

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