-
Mohammad Torkashvand authoredMohammad Torkashvand authored
crm.py 828 B
"""A module that returns the customers available in :term:`GSO`.
For the time being, it's hardcoded to only contain GEANT as a customer, since this is needed for the deployment of phase
1.
"""
from typing import Any
class CustomerNotFoundError(Exception):
"""Exception raised when a customer is not found."""
def all_customers() -> list[dict]:
"""Hardcoded list of customers available in :term:`GSO`."""
return [
{
"id": "8f0df561-ce9d-4d9c-89a8-7953d3ffc961",
"name": "GEANT",
},
]
def get_customer_by_name(name: str) -> dict[str, Any]:
"""Try to get a customer by their name."""
for customer in all_customers():
if customer["name"] == name:
return customer
msg = f"Customer {name} not found"
raise CustomerNotFoundError(msg)