oncall-engine/engine/apps/grafana_plugin/sync_data.py
Joey Orlando 673d2e9595
feat: persist is_grafana_irm_enabled from backend plugin sync data (#5171)
# What this PR does

Will start persisting the `organization.is_grafana_irm_enabled` flag
from the backend plugin's sync data that is sent to the oncall backend.
The implications of this are that when `is_grafana_irm_enabled` is set
to True, we will:
- start using `grafana-irm-app` prefixed RBAC permissions (RBAC
permissions for `grafana-irm-app`, as well as `grafana-oncall-app`, are
already being synced to the OnCall backend since
https://github.com/grafana/irm/pull/200 was merged/deployed)
- start building UI URLs w/ `grafana-irm-app` instead of
`grafana-oncall-app`

## Which issue(s) this PR closes

Closes https://github.com/grafana/irm/issues/242

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-10-11 14:57:59 -04:00

51 lines
856 B
Python

from dataclasses import dataclass
from typing import Dict, List, Optional
@dataclass
class SyncPermission:
action: str
@dataclass
class SyncUser:
id: int
name: str
login: str
email: str
role: str
avatar_url: str
permissions: List[SyncPermission]
teams: Optional[List[int]]
@dataclass
class SyncTeam:
team_id: int
name: str
email: str
avatar_url: str
@dataclass
class SyncSettings:
stack_id: int
org_id: int
license: str
oncall_api_url: str
oncall_token: str
grafana_url: str
grafana_token: str
rbac_enabled: bool
incident_enabled: bool
incident_backend_url: str
labels_enabled: bool
irm_enabled: bool
@dataclass
class SyncData:
users: List[SyncUser]
teams: List[SyncTeam]
team_members: Dict[int, List[int]]
settings: SyncSettings