Commit Graph

74 Commits

Author SHA1 Message Date
Dietmar Maurer
00f3a6575c proxmox-api/src/format.rs: add missing docs 2019-12-02 19:50:04 +01:00
Dietmar Maurer
8f7127a9aa proxmox-api/src/cli/shellword.rs: re-export Quote from rustyline 2019-12-02 19:29:47 +01:00
Dietmar Maurer
a9275caa61 proxmox-api/src/cli/completion.rs: add more tests 2019-12-02 17:34:11 +01:00
Dietmar Maurer
f9d4dcc540 proxmox-api/src/cli/completion.rs: add help completion tests 2019-12-02 16:42:59 +01:00
Dietmar Maurer
1819b194a4 proxmox_api: add cli submodule (copied from proxmox-backup) 2019-12-02 11:49:58 +01:00
Dietmar Maurer
354cfabd37 proxmox-api: fix text_wrap() - use join instead of concat (separate by newlines) 2019-12-01 12:30:50 +01:00
Wolfgang Bumiller
9b07990086 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-25 15:07:18 +01:00
Dietmar Maurer
7e3b6944f6 proxmox_api: improve ApiStringFormat docs 2019-11-24 10:34:59 +01:00
Dietmar Maurer
e4d44ae7a3 proxmox-api: rename ApiStringFormat::Complex into ApiStringFormat::PropertyString 2019-11-24 09:51:45 +01:00
Dietmar Maurer
38abbed608 proxmox-api: improve schema docs 2019-11-23 17:00:36 +01:00
Dietmar Maurer
a3c62c420d proxmox-api: improve schema docs 2019-11-23 15:55:18 +01:00
Dietmar Maurer
6d31db9aca proxmox-api: further doc improvements 2019-11-23 14:13:52 +01:00
Dietmar Maurer
ed426cd99b proxmox-api: improve router docs 2019-11-23 14:08:44 +01:00
Dietmar Maurer
f02462039d proxmox-api - improve Router docs 2019-11-23 11:51:16 +01:00
Dietmar Maurer
c1ffee0901 proxmox-api: move impl ApiMethod to lib.rs 2019-11-23 10:58:32 +01:00
Dietmar Maurer
446ee31466 const_regex: fixup for previous commit 2019-11-23 10:48:36 +01:00
Dietmar Maurer
e89a52c30b proxmox-api: further cleanups
- improve docs
- move  ConstRegexPattern to const_regex.rs
2019-11-23 10:42:17 +01:00
Dietmar Maurer
fa83cbde13 proxmox-api/src/lib.rs: hide modules with inlined docs 2019-11-23 09:53:18 +01:00
Dietmar Maurer
edb41c1929 proxmox_api - ApiHandler: rename Async into AsyncHttp
And improve docs.
2019-11-23 08:54:07 +01:00
Dietmar Maurer
e06151b90e api: simplify ApiAsyncHandlerFn 2019-11-22 12:48:36 +01:00
Wolfgang Bumiller
f73ebb7209 api: add format module
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-22 09:28:22 +01:00
Wolfgang Bumiller
a6ce1e432b api: fully qualify types in exported macros
and move const_regex macro into a separate module

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 14:05:23 +01:00
Wolfgang Bumiller
c38d18484d api: move ApiMethod from router to top level
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:43:10 +01:00
Wolfgang Bumiller
c0266a17cd move HttpError to separate error module
the router doesn't actually use it

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:38:57 +01:00
Wolfgang Bumiller
2577effaf7 api: schema: avoid an extra temp string
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:32:42 +01:00
Wolfgang Bumiller
b489c2ceeb import the new api definitions
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:30:28 +01:00
Wolfgang Bumiller
068d56ed3d delete the old api macro stuff
to be replaced by a new set of macros for the current api
schema in proxmox-backup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-21 13:13:18 +01:00
Wolfgang Bumiller
617e25abba api: make ApiMethodInfo already require Send + Sync
ApiMethodInfo provides static information about a type

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-28 10:30:33 +02:00
Wolfgang Bumiller
eb4e28d7bf remove async_await feature gate
then we can build with beta as well

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-09-28 10:10:06 +02:00
Wolfgang Bumiller
ec1448cd29 [clippy] api: mostly noise reduction
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-22 09:45:39 +02:00
Wolfgang Bumiller
5be4143d92 api: allow () type, but panic when used as CLI input
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-16 09:44:25 +02:00
Wolfgang Bumiller
a7b9c8d89e fixup tests for router change
Signed-off-by: Wolfgang Bumiller <w.bumiller@errno.eu>
2019-08-15 20:26:18 +02:00
Wolfgang Bumiller
82f8df963e api: router: return Map on lookup
Instead of a Value, makes it easier to use the parameters
later on.

Signed-off-by: Wolfgang Bumiller <w.bumiller@errno.eu>
2019-08-15 11:02:09 +02:00
Wolfgang Bumiller
d78142302c formatting fixup
add #[rustfmt::skip] to our macros...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-05 09:45:14 +02:00
Wolfgang Bumiller
75e90ebb25 api: support HashSet<String> as api type
This is just an array of strings in json, or a
semicolon-separated string on the command line.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-01 11:20:11 +02:00
Wolfgang Bumiller
2a4af329a7 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-30 15:20:55 +02:00
Wolfgang Bumiller
fab0210287 api, macro: implement 'format' verifier for structs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-30 10:06:32 +02:00
Wolfgang Bumiller
b77733c8ef api: macro: implement minimum/maximum_length checks
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-29 14:40:04 +02:00
Wolfgang Bumiller
f1f4c14819 api: verify: rename Verify to TestMinMax
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-29 14:30:32 +02:00
Wolfgang Bumiller
20b8c709c6 api: add helper module for verifiers
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-29 14:16:05 +02:00
Wolfgang Bumiller
50eadf23fb macro: support Option in deserialization
When deserializing we currently expect all fields to be
available, but we actually want Option types to be truly
optional...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-19 14:50:23 +02:00
Wolfgang Bumiller
7cbc6d0962 api: add a meta module to help with macro impls
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-19 14:08:55 +02:00
Wolfgang Bumiller
cb2c260f87 default to not serializing None options
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-19 13:22:18 +02:00
Wolfgang Bumiller
18d6fc28b4 api: export derive_parse_cli_from_str
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-17 16:19:45 +02:00
Wolfgang Bumiller
205a9fc2aa api: split ApiHandler out of ApiMethodInfo
The method info part is not generic after all.
(Makes it easier to test different representations of
ApiHandler without having to adapt all the other methods as
well.)

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
2019-07-01 09:48:33 +02:00
Wolfgang Bumiller
916f9d945f api: WIP: don't depend on a specific Body type
For a T which is not directly a Body or Response<Body> type
    #[api]
    fn foo() -> T;
should not require a specific Body type.

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
2019-06-23 11:41:27 +02:00
Wolfgang Bumiller
c8e11115d2 api: replace handler() with call()
An `fn` type can be more annoying to produce in some generic
cases, and we haven't really needed it yet.

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
2019-06-23 11:19:49 +02:00
Wolfgang Bumiller
bd79dd8f02 api: make method body an associated type
This way we do not need to carry the body type into the CLI
router and can instead just require the body to be
Into<Bytes>.

This also makes more sense, because previously a method
could in theory implement multiple ApiMethodInfo types with
different bodies which seems pointless.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-19 15:16:40 +02:00
Wolfgang Bumiller
a202f3ce99 test update
use the 'newboth' command as well

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-18 13:14:33 +02:00
Wolfgang Bumiller
e085107119 api: fix Option<> types, implement bools, add tests
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-06-18 12:45:19 +02:00