Akeyless+Clearskies Custom Gitlab Producer/Rotator
Project description
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 usingrequested_scopesin the input payload. Restricts which scopes can be requested via the producer.allowed_group_ids(list[int]): Optional. Required if usingrequested_group_idin 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 setallowed_group_idsin 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 setallowed_scopesin 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clear_skies_akeyless_custom_gitlab-2.0.2.tar.gz.
File metadata
- Download URL: clear_skies_akeyless_custom_gitlab-2.0.2.tar.gz
- Upload date:
- Size: 55.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f2b304adedadf3db89bd86bcad1915d8ed08c4c4c64827b2269f189fd93dce0
|
|
| MD5 |
7d322dc61230d6d78f2c1f16b1bc194f
|
|
| BLAKE2b-256 |
65dd6f14058e1f8985783c28aa7a716bc10af76e827e499683edf47072b78bcb
|
File details
Details for the file clear_skies_akeyless_custom_gitlab-2.0.2-py3-none-any.whl.
File metadata
- Download URL: clear_skies_akeyless_custom_gitlab-2.0.2-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af13778f50476c428412e67832b94b2c71b2d2c497a0ce45423c08bb2f4231a9
|
|
| MD5 |
e38c10fe92fe72318578e8e8957695be
|
|
| BLAKE2b-256 |
9ddf90d58f64f3663bfadd01dd195bca82aa4665bfccba7bb23aa53c8fade5ab
|