portainer-mcp/test_edge_api.sh
Adolfo Delorenzo 7a1abbe243 feat: add Portainer Edge MCP server
- Implement comprehensive edge computing functionality
- Add edge environment management (list, get, status, generate keys)
- Add edge stack operations (list, get, create, update, delete)
- Add edge group management (list, get, create, update, delete)
- Add edge job scheduling (list, get, create, delete)
- Add edge settings configuration (get, update)
- Create test scripts for edge API validation
- Add comprehensive README documentation for edge server
- Include nginx stack creation script from earlier testing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-18 23:59:56 -03:00

44 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Test Portainer Edge API endpoints
echo "🚀 Testing Portainer Edge API"
echo "URL: $PORTAINER_URL"
echo "API Key: ***${PORTAINER_API_KEY: -4}"
echo ""
# Test edge environments
echo "🌐 Testing Edge Environments..."
curl -s -H "X-API-Key: $PORTAINER_API_KEY" \
"$PORTAINER_URL/api/endpoints?types=4" | jq '.[] | select(.Type == 4) | {name: .Name, id: .Id, status: .Status}' 2>/dev/null || echo "No edge environments found or jq not installed"
echo ""
# Test edge groups
echo "👥 Testing Edge Groups..."
curl -s -H "X-API-Key: $PORTAINER_API_KEY" \
"$PORTAINER_URL/api/edge_groups" | jq '.[0:3] | .[] | {name: .Name, id: .Id, dynamic: .Dynamic}' 2>/dev/null || echo "No edge groups found or jq not installed"
echo ""
# Test edge stacks
echo "📚 Testing Edge Stacks..."
curl -s -H "X-API-Key: $PORTAINER_API_KEY" \
"$PORTAINER_URL/api/edge_stacks" | jq '.[0:3] | .[] | {name: .Name, id: .Id, groups: .EdgeGroups}' 2>/dev/null || echo "No edge stacks found or jq not installed"
echo ""
# Test edge jobs
echo "💼 Testing Edge Jobs..."
curl -s -H "X-API-Key: $PORTAINER_API_KEY" \
"$PORTAINER_URL/api/edge_jobs" | jq '.[0:3] | .[] | {name: .Name, id: .Id, recurring: .Recurring}' 2>/dev/null || echo "No edge jobs found or jq not installed"
echo ""
# Test edge settings
echo "⚙️ Testing Edge Settings..."
curl -s -H "X-API-Key: $PORTAINER_API_KEY" \
"$PORTAINER_URL/api/settings" | jq '.Edge | {checkin: .CheckinInterval, command: .CommandInterval, ping: .PingInterval}' 2>/dev/null || echo "Failed to get edge settings or jq not installed"
echo ""
echo "✅ Edge API test completed!"