2021-11-27 17:59:21 -05:00
|
|
|
from typing import Dict, List
|
2021-11-21 11:11:20 -05:00
|
|
|
|
|
|
|
from zope.interface import Interface
|
|
|
|
|
|
|
|
from .IUser import IUser
|
|
|
|
|
|
|
|
|
|
|
|
class ICloudService(Interface):
|
|
|
|
"""Performs operations on the CSC Cloud."""
|
|
|
|
|
|
|
|
def create_account(user: IUser):
|
|
|
|
"""
|
|
|
|
Activate an LDAP account in CloudStack for the given user.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def purge_accounts() -> Dict:
|
|
|
|
"""
|
|
|
|
Delete CloudStack accounts which correspond to expired CSC accounts.
|
|
|
|
A warning message will be emailed to users one week before their
|
|
|
|
cloud account is deleted.
|
|
|
|
Another message will be emailed to the users after their cloud account
|
|
|
|
has been deleted.
|
|
|
|
"""
|
2021-11-27 17:59:21 -05:00
|
|
|
|
|
|
|
def create_vhost(username: str, domain: str, ip_address: str):
|
|
|
|
"""
|
|
|
|
Create a new vhost record for the given domain and IP address.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def delete_vhost(username: str, domain: str):
|
|
|
|
"""
|
|
|
|
Delete the vhost record for the given user and domain.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def get_vhosts(username: str) -> List[Dict]:
|
|
|
|
"""
|
|
|
|
Get the vhost records for the given user. Each record has the form
|
|
|
|
{
|
|
|
|
"domain": "app.username.m.csclub.cloud",
|
|
|
|
"ip_address": "172.19.134.12"
|
|
|
|
}
|
|
|
|
"""
|