gitlabclient

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

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