gitlab

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gitlab implements the GitLab connector: read-only discovery of projects, effective permissions, and CI/CD variable metadata (PRD section 22, Phase 5).

Safety property: the GitLab variables API returns variable VALUES. This connector reads the endpoint for inventory purposes but stores only names and protection flags - values are dropped before anything reaches the graph. A unit test enforces this.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	GetCurrentUser(ctx context.Context) (login, name string, err error)
	ListProjects(ctx context.Context) ([]Project, error)
	ListVariables(ctx context.Context, projectPath string) ([]Variable, error)
}

API abstracts the GitLab API calls the connector needs.

type Connector

type Connector struct {
	// contains filtered or unexported fields
}

Connector discovers GitLab infrastructure.

func New

func New(opts Options) *Connector

New returns a GitLab connector.

func (*Connector) Discover

Discover implements connectors.Connector.

func (*Connector) Name

func (c *Connector) Name() string

Name implements connectors.Connector.

type Options

type Options struct {
	API API
}

Options configures the connector.

type Project

type Project struct {
	Name          string
	Path          string // path with namespace, e.g. "org/payments-api"
	Visibility    string
	DefaultBranch string
	// AccessLevel is the authenticated principal's effective access
	// (10 guest, 20 reporter, 30 developer, 40 maintainer, 50 owner).
	AccessLevel int
}

Project is a discovered project.

type RestAPI

type RestAPI struct {
	// contains filtered or unexported fields
}

RestAPI implements API against a GitLab instance (gitlab.com or self-hosted) using a personal access token. All calls are read-only.

func NewRestAPI

func NewRestAPI(baseURL, token string) (*RestAPI, error)

NewRestAPI builds a REST client. baseURL is e.g. https://gitlab.com (no trailing slash, no /api suffix).

func (*RestAPI) GetCurrentUser

func (a *RestAPI) GetCurrentUser(ctx context.Context) (string, string, error)

GetCurrentUser implements API.

func (*RestAPI) ListProjects

func (a *RestAPI) ListProjects(ctx context.Context) ([]Project, error)

ListProjects implements API.

func (*RestAPI) ListVariables

func (a *RestAPI) ListVariables(ctx context.Context, projectPath string) ([]Variable, error)

ListVariables implements API. The API response includes `value`; it is decoded into a struct without a value field so values are dropped at the parse boundary.

type Variable

type Variable struct {
	Key       string
	Masked    bool
	Protected bool
}

Variable is CI/CD variable metadata. The API's value field is intentionally absent.

Jump to

Keyboard shortcuts

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