summaryrefslogtreecommitdiffstats
path: root/src/json.h
Commit message (Collapse)AuthorAgeFilesLines
* #915 Add POST /repository/addJavier Sánchez Parra2022-07-011-0/+5
| | | | | | | | | | | | | | This method adds a new repository to the database. Request: POST /repository/add { "name": "Repository 1", "ip": "192.168.56.10" } Response: 200 OK
* #915 Fix create image payload parsingJose M. Guisado2021-10-191-0/+1
| | | | | | | | | | | | | | | | | Commit 141b0797e17f616d6 introduced command scheduling rest api to ogserver. Part of this changeset included og_json_parse_create_image as a utility funtion to parse the json payload of a "create image" command. og_json_parse_create_image did not include the parsing of optional parameters "description", "center_id" and "group_id". New components like ogCP or ogCLI use these parameters. Fix this by adding a struct og_image member to the struct og_msg_params and assigning it when processing a "create image" command. This could be extended to further payload parsing for image related commands in the future.
* #915 Add POST /task/add methodJavier Sánchez Parra2021-07-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the possibility to create a task with procedures and other tasks integrated as steps. Note: "steps" parameter is optional and "steps" array object order defines execution order. Request: POST /task/add { "center": "1", "name": "task", "description": "My task", "steps": [ { "procedure": 4 }, { "task": 1 }, { "procedure": 24 } ] } Response: 200 OK This commit also add task case to procedure's step processing. Otherwise, gcc prints the following warning: src/rest.c: In function ‘og_procedure_add_steps’: src/rest.c:4089:17: warning: enumeration value ‘OG_STEP_TASK’ not handled in switch [-Wswitch] 4089 | switch (step->type) { | ^~~~~~
* constify json parse helper functionOpenGnSys Support Team2021-06-101-5/+5
| | | | | json_t * parameter is not modified, constify to allow compiler to spew warnings in case the function tries to modify it.
* move json function declarations to json.hOpenGnSys Support Team2021-06-101-0/+4
| | | | | | | | These function declarations belong to json.h: int og_json_parse_partition_setup(json_t *element, struct og_msg_params *params); int og_json_parse_create_image(json_t *element, struct og_msg_params *params); int og_json_parse_restore_image(json_t *element, struct og_msg_params *params);
* #915 Add commands and procedures to procedure creationJavier Sánchez Parra2021-06-101-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the possibility to create a procedure with commands and other procedures integrated as steps. Note: "steps" parameter is optional and "steps" array object order defines execution order. Request: POST /procedure/add { "center": "1", "name": "procedure", "description": "My procedure", "steps": [ { "command": "wol", "params": { "type": "broadcast" } }, { "procedure": 22 }, { "command": "poweroff", "params": {} } ] } Response: 200 OK This commit also updates unit tests for /procedure/add POST method to include steps.
* #915 Add schedule/commandJose M. Guisado2021-06-091-0/+6
| | | | | | | | | Enables ogserver to schedule commands (also referred as actions in legacy web console jargon). This feature enables ogserver to write in the "acciones" table in order to have full capabilities for command scheduling purposes, thus not depending in the legacy web console to insert into "acciones" table.
* #1037 Add disk typeJavier Sánchez Parra2021-05-261-0/+2
| | | | | | | Add ogServer support for parsing and storing in the DB disk type data from ogClient refresh response. See also commits with #1037 in ogClient and WebConsole repo.
* #915 Add /center/add POST methodJose M. Guisado2021-04-081-0/+1
| | | | | | | | | Adds POST method to add centers (organizational unit), required payload parameter is the name, and an additional comment is optional. {"name": "ACME"} {"name": "ACME", "comment": "Some comment"}
* #1008 Restore support for 4 disks and 16 partitionsJavier Sánchez Parra2020-11-181-1/+2
| | | | | | | | ogServer expects to receive information of 1 disk and 4 partitions from ogClient. Previous ogServer versions support several disks and partitions. Add ogServer support for 4 disks and 16 partitions.
* #941 Add og_json_parse_string_copy(...) functionRoberto Hueso Gómez2020-10-061-0/+1
| | | | | This function provides an easy way to copy the content of a json string into a regular C string.
* #1004 Handle new fields in /image/create responseJavier Sánchez Parra2020-09-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | ogClient now includes more information regarding the new image. This patch modifies ogServer to support new elements sent in ogClient /image/create response and store them in the database. Example of new /image/create response: { "disk": "1", "partition": "1", "code": "131", "id": "1", "name": "ubuntu", "repository": "192.168.56.10", "software": "Ubuntu 18.04.5 LTS \naccountsservice 0.6.45\n...", "clonator": "PARTCLONE", "compressor": "LZOP", "filesystem": "EXTFS", "datasize": 2100000 } New fields are "clonator", "compressor", "filesystem" and "datasize".
* Add POST /modes REST requestRoberto Hueso Gómez2020-07-061-0/+11
| | | | | | | | | | | | | This patch implements HTTP POST /modes request which can change the mode of any particular scope. Request: POST /modes { "scope": {"id": 1, "type": "computer"}, "mode": "pxe" } Response: 200 OK
* #990 Use client broadcast address on WoLJavier Sánchez Parra2020-07-031-0/+1
| | | | | | | | | | | | | | | | Some universities have computers in a different subnet where the ogServer is, but ogServer WoL functionality only supported to send packet to its own subnets. This commit solves this. Now ogServer sends two WoL packets per client, one with the broadcast address of the interface indicated in the config file, the other with the broadcast address calculated with the address and netmask of the client. To ensure that the second WoL works correctly you must configure correctly the IP and netmask of the clients. Also, you have to configure the network of your organization to route WoL packet to the correct subnet.
* #971 rename sources folder to srcOpenGnSys Support Team2020-06-261-0/+77
Use the same folder as in ogClient.