monitorconfig
This commit is contained in:
27
backend/modules/monitor_config/routes.py
Normal file
27
backend/modules/monitor_config/routes.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# pyrefly: ignore [missing-import]
|
||||
from flask import Blueprint
|
||||
|
||||
from modules.monitor_config.controller import (
|
||||
get_monitor_config,
|
||||
update_monitor_config,
|
||||
test_connection
|
||||
)
|
||||
|
||||
# Khởi tạo Blueprint cho Module Monitor Config
|
||||
# Blueprint này sẽ được đăng ký dưới prefix /api/devices trong app.py
|
||||
monitor_config_bp = Blueprint("monitor_config", __name__)
|
||||
|
||||
# Đăng ký các endpoints cấu hình giám sát thiết bị:
|
||||
# Luồng đi:
|
||||
# 1. Client gửi request tương ứng tới endpoint.
|
||||
# 2. Flask định tuyến (routing) request dựa trên method và url path.
|
||||
# 3. Chuyển tiếp request cho hàm xử lý tương ứng trong controller.py.
|
||||
|
||||
# GET /api/devices/<device_id>/monitor-config -> Lấy cấu hình giám sát
|
||||
monitor_config_bp.route("/<device_id>/monitor-config", methods=["GET"])(get_monitor_config)
|
||||
|
||||
# PUT /api/devices/<device_id>/monitor-config -> Cập nhật cấu hình giám sát
|
||||
monitor_config_bp.route("/<device_id>/monitor-config", methods=["PUT"])(update_monitor_config)
|
||||
|
||||
# POST /api/devices/<device_id>/monitor-config/test -> Kiểm tra kết nối (Ping/SNMP)
|
||||
monitor_config_bp.route("/<device_id>/monitor-config/test", methods=["POST"])(test_connection)
|
||||
Reference in New Issue
Block a user