mirror of
https://github.com/katanemo/plano.git
synced 2026-04-30 03:16:28 +02:00
Update docs to Plano (#639)
This commit is contained in:
parent
15fbb6c3af
commit
e224cba3e3
139 changed files with 4407 additions and 24735 deletions
|
|
@ -0,0 +1,44 @@
|
|||
from flask import Flask, request, jsonify
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route("/agent/device_summary", methods=["POST"])
|
||||
def get_device_summary():
|
||||
"""
|
||||
Endpoint to retrieve device statistics based on device IDs and an optional time range.
|
||||
"""
|
||||
data = request.get_json()
|
||||
|
||||
# Validate 'device_ids' parameter
|
||||
device_ids = data.get("device_ids")
|
||||
if not device_ids or not isinstance(device_ids, list):
|
||||
return (
|
||||
jsonify({"error": "'device_ids' parameter is required and must be a list"}),
|
||||
400,
|
||||
)
|
||||
|
||||
# Validate 'time_range' parameter (optional, defaults to 7)
|
||||
time_range = data.get("time_range", 7)
|
||||
if not isinstance(time_range, int):
|
||||
return jsonify({"error": "'time_range' must be an integer"}), 400
|
||||
|
||||
# Simulate retrieving statistics for the given device IDs and time range
|
||||
# In a real application, you would query your database or external service here
|
||||
statistics = []
|
||||
for device_id in device_ids:
|
||||
# Placeholder for actual data retrieval
|
||||
stats = {
|
||||
"device_id": device_id,
|
||||
"time_range": f"Last {time_range} days",
|
||||
"data": f"Statistics data for device {device_id} over the last {time_range} days.",
|
||||
}
|
||||
statistics.append(stats)
|
||||
|
||||
response = {"statistics": statistics}
|
||||
|
||||
return jsonify(response), 200
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
prompt_targets:
|
||||
- name: get_device_statistics
|
||||
description: Retrieve and present the relevant data based on the specified devices and time range
|
||||
|
||||
path: /agent/device_summary
|
||||
parameters:
|
||||
- name: device_ids
|
||||
type: list
|
||||
description: A list of device identifiers (IDs) to reboot.
|
||||
required: true
|
||||
- name: time_range
|
||||
type: int
|
||||
description: The number of days in the past over which to retrieve device statistics
|
||||
required: false
|
||||
default: 7
|
||||
Loading…
Add table
Add a link
Reference in a new issue