source: ogServer-Git/src/json.h @ a1aaad4

Last change on this file since a1aaad4 was 33b0c6f, checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago

Add POST /modes REST request

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

  • Property mode set to 100644
File size: 2.0 KB
Line 
1#ifndef _OG_JSON_H
2#define _OG_JSON_H
3
4#include <jansson.h>
5#include "schedule.h"
6
7int og_json_parse_string(json_t *element, const char **str);
8int og_json_parse_uint(json_t *element, uint32_t *integer);
9int og_json_parse_bool(json_t *element, bool *value);
10
11#define OG_PARAM_PART_NUMBER                    (1UL << 0)
12#define OG_PARAM_PART_CODE                      (1UL << 1)
13#define OG_PARAM_PART_FILESYSTEM                (1UL << 2)
14#define OG_PARAM_PART_SIZE                      (1UL << 3)
15#define OG_PARAM_PART_FORMAT                    (1UL << 4)
16#define OG_PARAM_PART_DISK                      (1UL << 5)
17#define OG_PARAM_PART_OS                        (1UL << 6)
18#define OG_PARAM_PART_USED_SIZE                 (1UL << 7)
19
20struct og_partition {
21        const char      *disk;
22        const char      *number;
23        const char      *code;
24        const char      *size;
25        const char      *filesystem;
26        const char      *format;
27        const char      *os;
28        const char      *used_size;
29};
30
31#define OG_PARTITION_MAX        4
32
33int og_json_parse_partition(json_t *element, struct og_partition *part,
34                            uint64_t required_flags);
35
36#define OG_CLIENTS_MAX  4096
37
38struct og_sync_params {
39        const char      *sync;
40        const char      *diff;
41        const char      *remove;
42        const char      *compress;
43        const char      *cleanup;
44        const char      *cache;
45        const char      *cleanup_cache;
46        const char      *remove_dst;
47        const char      *diff_id;
48        const char      *diff_name;
49        const char      *path;
50        const char      *method;
51};
52
53#define OG_PARAM_SCOPE_ID       (1UL << 0)
54#define OG_PARAM_SCOPE_TYPE     (1UL << 1)
55
56struct og_scope {
57        uint32_t        id;
58        const char      *type;
59};
60
61int og_json_parse_scope(json_t *element, struct og_scope *scope,
62                        const uint64_t required_flags);
63
64struct og_msg_params {
65        const char      *ips_array[OG_CLIENTS_MAX];
66        const char      *mac_array[OG_CLIENTS_MAX];
67        const char      *netmask_array[OG_CLIENTS_MAX];
68        unsigned int    ips_array_len;
69        const char      *wol_type;
70        char            run_cmd[4096];
71        const char      *disk;
72        const char      *partition;
73        const char      *repository;
74        const char      *name;
75        const char      *id;
76        const char      *code;
77        const char      *type;
78        const char      *profile;
79        const char      *cache;
80        const char      *cache_size;
81        bool            echo;
82        struct og_partition     partition_setup[OG_PARTITION_MAX];
83        struct og_sync_params sync_setup;
84        struct og_schedule_time time;
85        const char      *task_id;
86        uint64_t        flags;
87};
88
89#endif
Note: See TracBrowser for help on using the repository browser.