assets_guardian.plugins.gitlab.repository

Classes

GitlabRepository(client)

Repository to access raw data from the GitLab API.

class assets_guardian.plugins.gitlab.repository.GitlabRepository(client: HttpClient)[source]

Bases: object

Repository to access raw data from the GitLab API.

Uses HttpClient to perform requests to the API v4.

Initializes the repository with an HTTP client.

Parameters:

client – HttpClient instance configured for the GitLab API.

get_accesses_for_user(user_id: int | str) list[dict[str, Any]][source]

Retrieves memberships of a user to projects and groups.

Parameters:

user_id – GitLab user identifier.

Returns:

List of memberships with a β€˜pid’ field added to match the collector’s expectations.

get_raw_groups() list[dict[str, Any]][source]

Retrieves all accessible GitLab groups.

Returns:

List of raw dictionaries representing groups.

get_raw_projects() list[dict[str, Any]][source]

Retrieves all accessible GitLab projects.

Returns:

List of raw dictionaries representing projects.

get_raw_user_details(user_id: int | str) dict[str, Any][source]

Retrieves details of a specific user (necessary for IPs etc).

Parameters:

user_id – GitLab user identifier.

Returns:

Raw dictionary representing user details.

get_raw_users() list[dict[str, Any]][source]

Retrieves all GitLab users.

Returns:

List of raw dictionaries representing users.