gitlabclient

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 4 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 gitlabclient provides utilities for creating and configuring a GitLab API client. It retrieves the GitLab personal access token from the environment variable `GITLAB_API_KEY` and determines the GitLab BaseURL from either the provided input or environment variables. If no BaseURL is specified, it defaults to `https://gitlab.com/`.

Typical usage:

client, err := gitlabclient.LoadClient(input)
if err != nil {
    // handle error
}

The package relies on:

  • github.com/simon-fredrich/function-gitlab-importer/input/v1beta1 for input structure
  • gitlab.com/gitlab-org/api/client-go for GitLab API interactions
  • github.com/crossplane/function-sdk-go/errors for error handling

This package is intended for use in a Crossplane Composition Function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadClient

func LoadClient(in *v1beta1.Input) (*gitlab.Client, error)

LoadClient initializes and returns a GitLab API client for use in Crossplane functions. It retrieves the GitLab personal access token from the environment variable `GITLAB_API_KEY`. If the token is missing, an error is returned.

The GitLab BaseURL is resolved in the following order:

  1. From the provided Crossplane function input (`in.BaseURL`).
  2. From the environment variable `GITLAB_URL`.
  3. Defaults to `https://gitlab.com/` if neither is provided.

The function then creates a new GitLab client using the token and the resolved BaseURL, appending `/api/v4` to the URL.

Returns:

  • A configured *gitlab.Client instance if successful.
  • An error if the token is missing or the client cannot be created.

This helper is designed for Crossplane function implementations that need to interact with the GitLab API in a dynamic and configurable way.

Types

This section is empty.

Jump to

Keyboard shortcuts

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