from common.rpc.utils import create_service, requires_master_secret service = create_service(__name__) @requires_master_secret @service.route("/api/paste_text") def paste_text(*, data: str, name: str = None, is_private: bool = False): ... @requires_master_secret @service.route("/api/get_paste") def get_paste(*, name: str) -> str: ... def get_paste_url(name: str): return f"https://paste.cs61a.org/{name}"
from common.rpc.utils import create_service, requires_master_secret service = create_service(__name__, "code") @requires_master_secret @service.route("/api/create_code_shortlink") def create_code_shortlink(name: str, contents: str, staff_only: bool = True, link: str = None): ...
from typing import Dict, Optional from common.rpc.utils import create_service, requires_master_secret service = create_service(__name__, "deploy.hosted") @requires_master_secret @service.route("/api/list_apps") def list_apps(): ... @requires_master_secret @service.route("/api/new") def new(*, img: str, name: Optional[str] = None, env: Dict[str, str] = {}): ... @requires_master_secret @service.route("/api/stop") def stop(*, name: str): ... @requires_master_secret @service.route("/api/run") def run(*, name: str): ...
from typing import Dict from common.rpc.utils import create_service, requires_master_secret service = create_service(__name__, providers=["https://cs162.org/autograder/"]) @requires_master_secret @service.route("/api/send_email") def send_email( *, sender: str, target: str, subject: str, body: str, attachments: Dict[str, str] = {}, ): ...
from typing import List, Dict from common.rpc.utils import ( create_service, requires_master_secret, requires_access_token, ) service = create_service(__name__, "ag-master") @requires_master_secret @service.route("/api/trigger_jobs") def trigger_jobs(*, assignment_id: str, jobs: List[str]): ... @service.route("/api/get_submission") def get_submission(*, job_id: str) -> Dict: ... @service.route("/api/handle_output") def handle_output(*, output: str, job_id: str): ... @service.route("/api/set_failure") def set_failure(*, job_id: str, result: str): ...
from typing import Optional from common.rpc.utils import create_service, requires_access_token service = create_service(__name__, override="sb") @requires_access_token @service.route("/api/update_file") def update_file( *, path: str, encoded_file_contents: Optional[str] = None, symlink: Optional[str] = None, delete: bool = False, ): ... @requires_access_token @service.route("/api/get_server_hashes") def get_server_hashes(): ... @requires_access_token @service.route("/api/run_make_command", streaming=True) def run_make_command(*, target: str): ...
from typing import Tuple from common.rpc.utils import create_service, requires_master_secret service = create_service("buildserver-hosted-worker") @requires_master_secret @service.route("/api/build_worker_build") def build_worker_build(*, pr_number: int, sha: str) -> Tuple[bool, str]: ...
from typing import List from common.rpc.utils import create_service service = create_service(__name__, "ag-worker") @service.route("/api/ping_worker") def ping_worker(): ... @service.route("/api/batch_grade") def batch_grade(*, command: str, jobs: List[str], grading_zip: str): ...