Metadata-Version: 2.4
Name: netherframe.discovery.gitlabhq.gitlab
Version: 0.5.0
Summary: GitLab resource discovery for Netherframe
Author: Sourabh Cheedella
Author-email: Sourabh Cheedella <cheedella.sourabh@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.15
Requires-Dist: netherframe-core>=0.14.0,<1.0.0
Requires-Dist: python-gitlab>=9.0.0
Requires-Python: >=3.15
Project-URL: Homepage, https://netherframe.arsenal.sh
Project-URL: Repository, https://github.com/arsenal-sh/netherframe
Description-Content-Type: text/markdown

# GitLab Discovery for Netherframe

This package provides resource discovery capabilities for GitLab infrastructure using the GitLab Terraform provider (`gitlabhq/gitlab`).

## Installation

```bash
pip install netherframe.discovery.gitlabhq.gitlab
```

## Usage

```python
from nf.core import App, Stack
from nf.discovery.gitlabhq.gitlab import GitLabDiscoverer

app = App()
stack = Stack(app, "gitlab-imported")

# Configure the discoverer
config = {
    "token": "your-gitlab-token",  # Or use GITLAB_TOKEN env var
    "base_url": "https://gitlab.com/api/v4",  # Optional, defaults to gitlab.com
}

# Discover and import resources
discoverer = GitLabDiscoverer()
resources, import_blocks = discoverer.discover_and_fold(
    stack=stack,
    config=config,
    filters={
        "project_ids": [123, 456],  # Optional: specific projects
        "group_ids": [789],  # Optional: specific groups
        "owned": True,  # Optional: only owned resources
    },
)

# Synthesize
app.synth()
```

## Supported Resources

The discoverer supports all major GitLab resources including:

- Projects
- Groups
- Users
- Deploy Keys
- Project Variables
- Group Variables
- Branches
- Tags
- Merge Requests
- Issues
- Runners
- And many more...

## Configuration

The discoverer requires GitLab API credentials:

- `token`: GitLab personal access token (can also use `GITLAB_TOKEN` env var)
- `base_url`: GitLab API base URL (defaults to `https://gitlab.com/api/v4`)
- `per_page`: Number of items per page for API requests (defaults to 100)

## Filters

You can filter discovered resources using:

- `project_ids`: List of specific project IDs to discover
- `group_ids`: List of specific group IDs to discover
- `owned`: Only discover resources owned by the authenticated user
- `membership`: Only discover resources where user is a member
- `min_access_level`: Minimum access level for discovered resources