glclient

package
v1.22.3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidScheme is returned when GitLab URL doesn't use HTTPS.
	ErrInvalidScheme = errors.New("GITLAB_URL must use https scheme")
	// ErrConfig is returned when configuration is invalid.
	ErrConfig = errors.New("invalid OAuth configuration")
	// ErrFlagNotFound is returned when a flag is not found.
	ErrFlagNotFound = errors.New("flag not found")
)

Functions

func DefaultBaseURL added in v1.22.2

func DefaultBaseURL() string

DefaultBaseURL returns the default GitLab URL or the URL specified by the GITLAB_URL environment variable.

func New

func New(ctx context.Context, cfg *Config) (*gitlab.Client, error)

New creates a GitLab client with proper validation and security checks.

Types

type BaseURLFlag added in v1.22.2

type BaseURLFlag url.URL

BaseURLFlag wraps a string to implement the `pflag.Value` interface. This type provides an implementation to customize the behavior of `--base-url` in the `cobra.Command` command-line interface.

func (*BaseURLFlag) Set added in v1.22.2

func (f *BaseURLFlag) Set(s string) error

Set sets the value of the flag. The value is sanitized by removing any trailing slashes and the `/api/v4` path from the end of the string. If the string is empty, it is set to the default base URL.

func (*BaseURLFlag) String added in v1.22.2

func (f *BaseURLFlag) String() string

func (*BaseURLFlag) Type added in v1.22.2

func (*BaseURLFlag) Type() string

type Config

type Config struct {
	AccessToken    string
	OAuthTokenFile string
	BaseURL        string // Optional
	ClientID       string
}

func NewConfig

func NewConfig(fs *pflag.FlagSet) (*Config, error)

NewConfig creates a new configuration by reading environment variables.

Jump to

Keyboard shortcuts

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