-
Notifications
You must be signed in to change notification settings - Fork 11
AMQP API
A request always has the following structure:
{
"action": <action_type>,
"collection": <collection_name>,
"id": <id>,
"attributes": {
<key1>: <value1>,
<key2>: <value2>,
<key3>: <value3>
},
"filters": {
<filter1>: <value1>,
<filter2>: <value2>,
<filter3>: <value3>
},
}-
actionandcollectionare mandatory - For a
readaction, if theidis not specified, the request will get a list of resources available in thecollection.
Here's an example of renaming a group name student to students:
- Go to section "Groups" of this. It will be the
collection_name - Pick the right action,
update - Id is mandatory, it's the group name.
- Fill the attributes section. The key is
new_name. Set it tostudents
{
"collection": "groups",
"action": "update",
"id": "student",
"attributes": {
"new_name": "students"
}
}Filters can be applied to any request. You can filter by:
- Uuid:
uuids - Hostname:
hostnames(matches wildcards) - IP Address:
ip_addresses - MAC Address:
mac_addresses
Example:
{
"collection": "hosts",
"action": "read",
"filters": {"hostnames": ["*.guardis.be", "*.guardis.com"]}
}Retrieves informations about a group.
-
id: The group name. -
attributes: A list of informations to retrieve.
Available informations are:
hostname-
macormac_addresses memtotalipuptimeplatform
Execute command on remote hosts.
-
id(mandatory): The command. -
attributes: None
Retrieves informations about a group.
-
id: The group name. -
attributes: None
Creates a group with the given name
-
id(mandatory): The group name -
attributes: None
Changes a group name.
-
id(mandatory): The group name -
attributes:-
new_name: The new name
-
Deletes a group.
-
id(mandatory): The group name -
attributes: None
Gets information about user.
-
id: The user name. -
attributes: None
Creates a user.
-
id(mandatory): The user name. -
attributes:-
password: The user's password (clear text) -
login_group: The user's main group -
groups: Additionnal groups of the user (comma separated string)
-
Updates a user.
-
id(mandatory): The user name. -
attributes:-
password: The user's password (clear text) -
login_group: The user's main group -
add_to_groups: Add user to these groups(comma separated string) -
remove_from_groups: Remove user from these groups(comma separated string) -
set_groups: Resets then sets groups for user
-
Deletes a user with the force flag.
-
id(mandatory): The user name -
attributes: Nona
Gets the status installation of a package. Installed or not.
-
id: The package name. -
attributes: None
Installs a package.
-
id(mandatory): The package name. -
attributes: None
Updates a package.
-
id: The package name. If not specified, it will update all packages -
attributes: None
Removes a package.
-
id(mandatory): The package name. -
attributes: None
Retrieves the status of a service. (running, enabled)
-
id(mandatory): The service name. -
attributes: None
Enable/disable and starts/stop a serevice
-
id(mandatory): The service name. -
attributes:-
enabled: True/False -
running: True/False
-
Retrieves the owner, group, and mode of a file.
-
id: The file name. -
attributes:-
get_content: (boolean) Additionnaly retrieves the file content -
md5: (boolean) Calculates the file's md5sum
-
Creates a file. Sets the owner, group, mode, and content of a file.
-
id: The file name. -
attributes:-
owner: Sets the file owner (the user must exist) -
group: Sets the file group (the group must exist) -
mode: Sets the file mode -
content: (string) The file content as a string -
content_by_url: (url) Fetch the content from this url -
encoding: Currently supported (None/base64)
-
Deletes a file
-
id: The file name. -
attributes: None
Returns the managed hypervisors, the virtual machines on a given hypervisor or information about a virtual machine.
The id attribute is the hypervisor's id. Those ids are specified in a configuration file ('/etc/synapse/hypervisors.conf').
If none of the hypervisor's id or the virtual machine's name is given, then the response will contain a list of the managed hypervisors ids.
-
id: The hypervisor's name. -
attributes:-
name: The virtual machine name on the specified hypervisor. If the name of the virtual machine is not specified, then it returns the defined virtual machines on the specified hypervisor.
-
Creates and provisions a virtual machine.
-
id(mandatory): The hypervisor's name. -
attributes:-
name(mandatory)(string): vm name. -
type(mandatory)(string): hypervisor type. -
memory(mandatory)(integer): domain memory. -
kernel_path(mandatory)(string): path to the vmlinuz file on the local machine where synapse runs. It can also be an URL. In this case, the file is downloaded to the /tmp/ directory -
initrd_path(mandatory)(string): same as vmlinuz but for initrd.img -
num_cpu(integer): number of CPU. Default: 1. -
arch_type(string): CPU architecture. Default: i686. -
cmd_line(string): kernel parameters like "ks=<path_to_kickstart_file>". Default: "". -
boot_dev(string): boot device. Default: "hd". -
disk_driver(string): disk driver name ("tap", "tap2", "phy", or "file" for xen and "qemu" for qemu). Default: "qemu". -
disk_type(string): disk type ("aio" for xen and "raw", "bochs", "qcow2", or "qed" for qemu). Default: "raw" -
disk_size_unit(string): unit of disk size. Default: "M".- "B", "bytes" or undefined for bytes
- "K", "KB" or "KiB" for kilobytes
- "M", "MB" or "MiB" for megabytes
- "G", "GB" or "GiB" for gigabytes
- "T", "TB" or "TiB" for terabytes).
-
disk_size(integer): disk size. Default: 3072. -
bridged(boolean): tells if the domain is bridged to an interface. Default: true -
bridge_mac_address(string): MAC address for the bridge interface. Automatically generated when no specified. -
bridge_interface(string): interface of the bridge. Default: "br0". -
vnc_port(integer): port for VNC display. Default: -1 (auto) -
storage_name(string): storage name. Default: generated
-
Update domain settings.
-
id(mandatory): The hypervisor's name. -
attributes:-
name(mandatory)(string): The virtual machine name on the specified hypervisor. -
status(string): domain status after update. It can be "running", "paused", "shutdown", "shutoff" or "rebooting". -
disk_size(integer): disk size -
disk_size_unit(string): unit of disk size -
memory(integer): memory size in kilobytes -
num_cpu(integer): number of CPU
-
Delete a domain and even it's storage if specified.
-
id(mandatory): The hypervisor's name. -
attributes:-
name(mandatory)(string): The virtual machine name on the specified hypervisor. -
delete_volumes(boolean): tells if the disk volume has to be removed too
-