Skip to main content

gitlab

Gitlab dynamic producer for Akeyless

The payload for this producer looks like:

{
  "id": 12345,
  "personal_access_token": "YOUR_PERSONAL_ACCESS_TOKEN",
  "group_id": 67890,
  "scopes": ["read_api"],
  "access_level": 20,
  "api_url": "https://gitlab.com/api/v4"
}

Call clearskies_akeyless_custom_gitlab.build_clearskies_akeyless_custom_gitlab_producer() to initialize the create/rotate/revoke endpoints. You can optionally provide the url parameter which will add a prefix to the endpoints. This can then be attached to a clearskies context or an endpoint group:

If used as a producer, it will use the provided credentials to fetch and return Gitlab credentials or tokens. It can also rotate the credentials you provide. Additionally, it supports revoking credentials when they are no longer needed.

Payload Schema

The main payload for this producer must include:

  • id (int): Required. The ID of the GitLab group access token.
  • personal_access_token (str): Required. Personal access token with permissions to manage group access tokens.
  • group_id (int): Required. The GitLab group ID for which the token is managed.
  • scopes (list[str]): Required. List of permission scopes for the token (default: ["read_api"]).
  • access_level (int): Required. Access level for the token (default: 20, Reporter).
  • api_url (str): Optional. Base URL for the GitLab API (default: "https://gitlab.com/api/v4").
  • allowed_scopes (list[str]): Optional. Required if using requested_scopes in the input payload. Restricts which scopes can be requested via the producer.
  • allowed_group_ids (list[int]): Optional. Required if using requested_group_id in the input payload. Restricts which group IDs can be requested via the producer.

Input Payload Schema

You can also provide an input payload with additional parameters:

  • requested_group_id (int): Optional. The group ID requested for token operations. If used, you must set allowed_group_ids in the main payload to restrict which groups can be requested.
  • cache_id (str): Optional. An identifier for caching purposes.
  • requested_scopes (list[str]): Optional. List of scopes requested for the token. If used, you must set allowed_scopes in the main payload to restrict which scopes can be requested.

Note: If you use requested_group_id or requested_scopes in the input payload, you must set the corresponding allowed fields in the main payload to enforce restrictions.

# Install uv if not already installed
uv add clear-skies-akeyless-custom-gitlab
pip install clear-skies-akeyless-custom-gitlab

or

pipenv install clear-skies-akeyless-custom-gitlab

or

poetry add clear-skies-akeyless-custom-gitlab

Development

To set up your development environment with pre-commit hooks:

# Install uv if not already installed
pip install uv

# Create a virtual environment and install all dependencies (including dev)
uv sync


# Install dev dependencies (including ruff, black, mypy) in the project environment
uv pip install .[dev]

# Install pre-commit hooks
uv run pre-commit install

# Optionally, run pre-commit on all files
uv run pre-commit run --all-files

Usage Example

import clearskies
import clearskies_akeyless_custom_gitlab

producer = clearskies_akeyless_custom_gitlab.build_clearskies_akeyless_custom_gitlab_producer()

wsgi = clearskies.contexts.WsgiRef(producer)
wsgi()

Which you can test directly using calls like:

curl 'http://localhost:9090/sync/create' -d '{"payload":"{\"id\":12345,\"personal_access_token\":\"YOUR_PERSONAL_ACCESS_TOKEN\",\"group_id\":67890,\"scopes\":[\"read_api\"],\"access_level\":20}"}'

curl 'http://localhost:8080/sync/rotate' -d '{"payload":"{\"id\":12345,\"personal_access_token\":\"YOUR_PERSONAL_ACCESS_TOKEN\",\"group_id\":67890,\"scopes\":[\"read_api\"],\"access_level\":20}"}'

curl 'http://localhost:8080/sync/revoke' -d '{"payload":"{\"placeholder\":\"YOUR_VALUE_HERE\"}"}'

NOTE: Akeyless doesn't store your payload as JSON, even when you put in a JSON payload. Instead, it ends up as a stringified-json (hence the escaped apostrophes in the above example commands). This is normal, and normally invisible to you, unless you try to invoke the endpoints yourself.

Metadata

Release files for clear-skies-akeyless-custom-gitlab 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clear-skies-akeyless-custom-gitlab 2.0.2
File Size Uploaded
clear_skies_akeyless_custom_gitlab-2.0.2.tar.gz 55.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clear-skies-akeyless-custom-gitlab 2.0.2
File Interpreter ABI Platform
clear_skies_akeyless_custom_gitlab-2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 65.1 kB

Release files / clear_skies_akeyless_custom_gitlab-2.0.2.tar.gz

Download URL clear_skies_akeyless_custom_gitlab-2.0.2.tar.gz
Size 55.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4f2b304adedadf3db89bd86bcad1915d8ed08c4c4c64827b2269f189fd93dce0
BLAKE2b-256 checksum
How to use checksums
65dd6f14058e1f8985783c28aa7a716bc10af76e827e499683edf47072b78bcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.16

Release files / clear_skies_akeyless_custom_gitlab-2.0.2-py3-none-any.whl

Download URL clear_skies_akeyless_custom_gitlab-2.0.2-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af13778f50476c428412e67832b94b2c71b2d2c497a0ce45423c08bb2f4231a9
BLAKE2b-256 checksum
How to use checksums
9ddf90d58f64f3663bfadd01dd195bca82aa4665bfccba7bb23aa53c8fade5ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.16

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page