Bahn: aisupport, Analyse-O2C-C2S, awesome-bahn-mcp-servers, beam-mcp,
Confluence_Bot, db-planet-mcp-server, O2C-Harness, project-audit,
Projekt-KIQ-HP, teamlandkarte-mcp
Dhive: Jury-Voting
Privat: CV, NoteGraph (NOTE: NoteGraph needs complete redo after consolidation)
Shared: AI-Orchestrator, OrgMyLife, power_skills_and_more
Shared/references: symphony (read-only)
Bahn repos remain available as independent remotes - this monorepo
pulls them in via subtree, the originals are untouched.
95 lines
2.6 KiB
Python
95 lines
2.6 KiB
Python
"""Data models for the PAT Manager system."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from enum import Enum
|
|
|
|
|
|
class PatStatus(Enum):
|
|
"""Classification status for a PAT after expiry check."""
|
|
|
|
HEALTHY = "healthy"
|
|
EXPIRING_SOON = "expiring soon"
|
|
EXPIRED = "expired"
|
|
CHECK_FAILED = "check failed"
|
|
|
|
|
|
class AlertChannel(Enum):
|
|
"""Supported alert delivery channels."""
|
|
|
|
ORGMYLIFE = "orgmylife"
|
|
EMAIL = "email"
|
|
|
|
|
|
@dataclass
|
|
class PatEntry:
|
|
"""A single PAT entry in the registry.
|
|
|
|
Attributes:
|
|
service: The service this PAT belongs to (GitLab, Jira, Confluence, OrgMyLife).
|
|
token_name: Human-readable identifier for the token (max 128 chars).
|
|
expiry_date: ISO 8601 date string (YYYY-MM-DD) or None if no expiry.
|
|
renewal_method: How the token is renewed - "auto" or "manual".
|
|
"""
|
|
|
|
service: str
|
|
token_name: str
|
|
expiry_date: str | None
|
|
renewal_method: str
|
|
|
|
|
|
@dataclass
|
|
class CheckResult:
|
|
"""Result of checking a single PAT's expiry status.
|
|
|
|
Attributes:
|
|
entry: The PAT entry that was checked.
|
|
status: Classification result (healthy, expiring soon, expired, check failed).
|
|
days_remaining: Days until expiry, or None if check failed or no expiry date.
|
|
error_message: Error details, populated only for check_failed status.
|
|
stale_warning: True if API succeeds but stored expiry_date has passed.
|
|
"""
|
|
|
|
entry: PatEntry
|
|
status: PatStatus
|
|
days_remaining: int | None
|
|
error_message: str | None
|
|
stale_warning: bool = False
|
|
|
|
|
|
@dataclass
|
|
class RotationResult:
|
|
"""Result of a GitLab token rotation attempt.
|
|
|
|
Attributes:
|
|
success: Whether the rotation completed successfully.
|
|
new_token: The new token value from GitLab, or None on failure.
|
|
new_expiry_date: The new expiry date from GitLab, or None on failure.
|
|
error_message: Error details on failure, or None on success.
|
|
entry: The PAT entry that was rotated, or None if not set.
|
|
old_expiry_date: The previous expiry date before rotation, or None.
|
|
"""
|
|
|
|
success: bool
|
|
new_token: str | None
|
|
new_expiry_date: str | None
|
|
error_message: str | None
|
|
entry: PatEntry | None = None
|
|
old_expiry_date: str | None = None
|
|
|
|
|
|
@dataclass
|
|
class AlertResult:
|
|
"""Result of sending an alert notification.
|
|
|
|
Attributes:
|
|
sent: Whether the alert was delivered successfully.
|
|
channel: Which alert channel was used.
|
|
error_message: Error details on failure, or None on success.
|
|
"""
|
|
|
|
sent: bool
|
|
channel: AlertChannel
|
|
error_message: str | None
|