ref: refs/heads/jr_ntp
commit e16d137d5c348747fe54f425e41ebb0f981023fd
Author: Ladislav Slezak
Date: Thu Sep 10 15:20:56 2009 +0200
system plugin - added REST documentation and examples
---
plugins/system/public/system/restdoc/.gitignore | 3 +
plugins/system/restdoc/api.txt | 54 +++++++++++++++++++++++
plugins/system/restdoc/reboot_request.xml | 9 ++++
plugins/system/restdoc/reboot_response.xml | 9 ++++
plugins/system/restdoc/system.xml | 9 ++++
5 files changed, 84 insertions(+), 0 deletions(-)
diff --git a/plugins/system/public/system/restdoc/.gitignore b/plugins/system/public/system/restdoc/.gitignore
new file mode 100644
index 0000000..b66eeae
--- /dev/null
+++ b/plugins/system/public/system/restdoc/.gitignore
@@ -0,0 +1,3 @@
+index.html
+*.xml
+*.xsd
diff --git a/plugins/system/restdoc/api.txt b/plugins/system/restdoc/api.txt
new file mode 100644
index 0000000..70c318e
--- /dev/null
+++ b/plugins/system/restdoc/api.txt
@@ -0,0 +1,54 @@
+= YaST REST Service Documentation
+== System Service
+
+ Only authenticated users are allowed to access the API. Authentication is done
+ by sending a Basic HTTP Authorisation header.
+
+ All names aren't allowed to contain spaces, slashes or colons.
+
+
+== Table of Contents
+
+Contents:
+
+== Formats
+
+ The system REST service supports only XML and JSON input/output formats.
+
+== Overview
+
+ This module provides access to the basic system component. Curretly it provides only reboot and shutdown actions.
+
+ The module uses HAL as the backend, HAL daemon must be running to perform reboot/shutdown actions.
+
+== PolicyKit Access Rights
+
+ The following PolicyKit permissions are needed to execute reboot and shutdown:
+
+ Reboot: org.freedesktop.hal.power-management.reboot
+
+ Shutdown: org.freedesktop.hal.power-management.shutdown
+
+== System Actions
+
+
+GET /system
+
+ Get the list of supported system actions. The list contains actions like <i>reboot</i> or <i>shutdown</i>.
+
+ CURL Example: curl -u <user> http://localhost:8080/system.xml
+
+XmlResult: system
+
+
+PUT /system
+
+ Trigger a system action. Set active flag to true for the action which should be started - see the XML example file.
+
+ CURL example: curl -u <user> -X PUT -H 'Content-type: text/xml' -d @reboot_request.xml http://localhost:8080/system.xml
+
+XmlBody: reboot_request
+
+XmlResult: reboot_response
+
+
diff --git a/plugins/system/restdoc/reboot_request.xml b/plugins/system/restdoc/reboot_request.xml
new file mode 100644
index 0000000..ebf8eb7
--- /dev/null
+++ b/plugins/system/restdoc/reboot_request.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<system>
+ <shutdown>
+ <active type="boolean">false</active>
+ </shutdown>
+ <reboot>
+ <active type="boolean">true</active>
+ </reboot>
+</system>
diff --git a/plugins/system/restdoc/reboot_response.xml b/plugins/system/restdoc/reboot_response.xml
new file mode 100644
index 0000000..1d4805a
--- /dev/null
+++ b/plugins/system/restdoc/reboot_response.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<actions>
+ <shutdown>
+ <active type="boolean">false</active>
+ </shutdown>
+ <reboot>
+ <active type="boolean">true</active>
+ </reboot>
+</actions>
diff --git a/plugins/system/restdoc/system.xml b/plugins/system/restdoc/system.xml
new file mode 100644
index 0000000..8997cb8
--- /dev/null
+++ b/plugins/system/restdoc/system.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<actions>
+ <shutdown>
+ <active type="boolean">false</active>
+ </shutdown>
+ <reboot>
+ <active type="boolean">false</active>
+ </reboot>
+</actions>
\ No newline at end of file
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org