]> git.proxmox.com Git - proxmox.git/log
proxmox.git
4 years agoapi-macro: add expanded data to tests for verification
Wolfgang Bumiller [Wed, 8 Jan 2020 09:41:29 +0000 (10:41 +0100)]
api-macro: add expanded data to tests for verification

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi: add test-harness feature
Wolfgang Bumiller [Wed, 8 Jan 2020 09:22:41 +0000 (10:22 +0100)]
api: add test-harness feature

If enabled, the Schema type implements Eq and PartialEq for
testing the api macro better.

Note that these implementations don't make all too much
since since they also compare `dyn Fn` types which do not
implement Eq. Since they're also `&'static` they can't
really be runtime closures, so this should be fine, we know
they'll always point to some regular function.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: support empty api macro on structs
Wolfgang Bumiller [Wed, 8 Jan 2020 09:09:41 +0000 (10:09 +0100)]
api-macro: support empty api macro on structs

The description comes from the doc comment, the field types
and description from field doc comments and types.
Previously we needed to add at least the hint that the
schema is an object schema. Now we support an empty #[api]
attribute as well.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: support renamed struct fields
Wolfgang Bumiller [Wed, 8 Jan 2020 09:06:48 +0000 (10:06 +0100)]
api-macro: support renamed struct fields

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: support rename_all in enums
Wolfgang Bumiller [Tue, 7 Jan 2020 14:29:56 +0000 (15:29 +0100)]
api-macro: support rename_all in enums

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: start using serde attribute helpers
Wolfgang Bumiller [Tue, 7 Jan 2020 14:23:52 +0000 (15:23 +0100)]
api-macro: start using serde attribute helpers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: prepare to support serde::rename_all
Wolfgang Bumiller [Tue, 7 Jan 2020 14:10:55 +0000 (15:10 +0100)]
api-macro: prepare to support serde::rename_all

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: more option type handling
Wolfgang Bumiller [Tue, 7 Jan 2020 12:37:33 +0000 (13:37 +0100)]
api-macro: more option type handling

infer_type now also returns whether it was encapsualted in
an Option<>. So `type: String, optional: true` is now
inferred propertly from `Option<String>`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: derive optional values correctly
Wolfgang Bumiller [Tue, 7 Jan 2020 12:19:13 +0000 (13:19 +0100)]
api-macro: derive optional values correctly

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: reorganize field iteration
Wolfgang Bumiller [Tue, 7 Jan 2020 12:18:21 +0000 (13:18 +0100)]
api-macro: reorganize field iteration

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: error on extraneous fields
Wolfgang Bumiller [Tue, 7 Jan 2020 12:16:12 +0000 (13:16 +0100)]
api-macro: error on extraneous fields

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: add basic struct handling
Wolfgang Bumiller [Tue, 7 Jan 2020 12:09:19 +0000 (13:09 +0100)]
api-macro: add basic struct handling

- handle doc comments for descriptions
- infer fields from structs when possible
- perform some basic error checking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: factor out type inference for reuse with structs
Wolfgang Bumiller [Tue, 7 Jan 2020 12:09:08 +0000 (13:09 +0100)]
api-macro: factor out type inference for reuse with structs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: split struct handling into newtype, regular, unit, ...
Wolfgang Bumiller [Tue, 7 Jan 2020 11:11:04 +0000 (12:11 +0100)]
api-macro: split struct handling into newtype, regular, unit, ...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: derive descriptions for structs
Wolfgang Bumiller [Tue, 7 Jan 2020 10:59:24 +0000 (11:59 +0100)]
api-macro: derive descriptions for structs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agocargo: switch to use packaged crates by default
Fabian Grünbichler [Fri, 3 Jan 2020 08:39:52 +0000 (09:39 +0100)]
cargo: switch to use packaged crates by default

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agotools: remove accidentally commited debian/files
Fabian Grünbichler [Fri, 3 Jan 2020 06:28:24 +0000 (07:28 +0100)]
tools: remove accidentally commited debian/files

it's a build artifact, no need to version control it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoversion bump
Wolfgang Bumiller [Thu, 2 Jan 2020 13:35:40 +0000 (14:35 +0100)]
version bump

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: drop unused dev-dependencies
Wolfgang Bumiller [Thu, 2 Jan 2020 13:25:09 +0000 (14:25 +0100)]
api-macro: drop unused dev-dependencies

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoreadme: add cargo config for packaged crates
Fabian Grünbichler [Thu, 2 Jan 2020 13:07:12 +0000 (14:07 +0100)]
readme: add cargo config for packaged crates

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-tools: reference valgrind_request via git
Fabian Grünbichler [Thu, 2 Jan 2020 12:33:01 +0000 (13:33 +0100)]
proxmox-tools: reference valgrind_request via git

to allow using 'cargo XXX' with cargo config pointing to packaged
sources instead of crates.io

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agosys: add a bunch of error helpers
Wolfgang Bumiller [Thu, 2 Jan 2020 12:36:21 +0000 (13:36 +0100)]
sys: add a bunch of error helpers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosys: add some helpful macros
Wolfgang Bumiller [Thu, 2 Jan 2020 12:30:30 +0000 (13:30 +0100)]
sys: add some helpful macros

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: bump bytes to 0.5
Wolfgang Bumiller [Thu, 2 Jan 2020 11:45:07 +0000 (12:45 +0100)]
api-macro: bump bytes to 0.5

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomore versioning fixups
Wolfgang Bumiller [Mon, 30 Dec 2019 11:33:13 +0000 (12:33 +0100)]
more versioning fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years ago-dev bump for proxmox crate as well
Wolfgang Bumiller [Mon, 30 Dec 2019 11:05:57 +0000 (12:05 +0100)]
-dev bump for proxmox crate as well

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd a 'Versioning' readme section
Wolfgang Bumiller [Mon, 30 Dec 2019 10:50:30 +0000 (11:50 +0100)]
add a 'Versioning' readme section

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump proxmox-tools to 0.1.1-dev.1
Wolfgang Bumiller [Mon, 30 Dec 2019 10:27:37 +0000 (11:27 +0100)]
bump proxmox-tools to 0.1.1-dev.1

We now use this between package releases.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: fs: default to 644 for mode in replace_file
Wolfgang Bumiller [Mon, 30 Dec 2019 09:05:57 +0000 (10:05 +0100)]
tools: fs: default to 644 for mode in replace_file

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox: initial packaging
Fabian Grünbichler [Wed, 18 Dec 2019 09:32:41 +0000 (10:32 +0100)]
proxmox: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-api-macro: initial packaging
Fabian Grünbichler [Tue, 17 Dec 2019 15:26:58 +0000 (16:26 +0100)]
proxmox-api-macro: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-sortable-macro: initial packaging
Fabian Grünbichler [Tue, 17 Dec 2019 15:22:33 +0000 (16:22 +0100)]
proxmox-sortable-macro: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-sys: initial packaging
Fabian Grünbichler [Tue, 17 Dec 2019 15:08:52 +0000 (16:08 +0100)]
proxmox-sys: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-sys: update lazy-static to 1.4
Fabian Grünbichler [Tue, 17 Dec 2019 15:05:49 +0000 (16:05 +0100)]
proxmox-sys: update lazy-static to 1.4

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-api: use proxmox-tools package in d/rules
Fabian Grünbichler [Tue, 17 Dec 2019 14:35:48 +0000 (15:35 +0100)]
proxmox-api: use proxmox-tools package in d/rules

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-api: initial packaging
Fabian Grünbichler [Tue, 17 Dec 2019 14:16:01 +0000 (15:16 +0100)]
proxmox-api: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-api: update rustyline to 5.0.5
Fabian Grünbichler [Tue, 17 Dec 2019 14:16:06 +0000 (15:16 +0100)]
proxmox-api: update rustyline to 5.0.5

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-api: update lazy_static to 1.4
Fabian Grünbichler [Tue, 17 Dec 2019 14:01:07 +0000 (15:01 +0100)]
proxmox-api: update lazy_static to 1.4

which is available in Debian unstable.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-tools: initial packaging
Fabian Grünbichler [Tue, 17 Dec 2019 13:46:11 +0000 (14:46 +0100)]
proxmox-tools: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-tools: update regex and lazy_static
Fabian Grünbichler [Tue, 17 Dec 2019 13:46:35 +0000 (14:46 +0100)]
proxmox-tools: update regex and lazy_static

to those versions available in Debian unstable

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoadd a top level doc comment to fs submodule
Wolfgang Bumiller [Thu, 19 Dec 2019 11:01:36 +0000 (12:01 +0100)]
add a top level doc comment to fs submodule

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump nix to 0.16
Wolfgang Bumiller [Thu, 19 Dec 2019 08:26:52 +0000 (09:26 +0100)]
bump nix to 0.16

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agolinux/procfs: add read_proc_stat
Thomas Lamprecht [Wed, 18 Dec 2019 11:45:31 +0000 (12:45 +0100)]
linux/procfs: add read_proc_stat

For now we just parse the CPU "time-spent" counters and calculate the
CPU usage of the whole system. As we do not want a total average we
use a state-full implementation, which calculates the usage since the
last request (if older than 1 second).

Somewhat modeled after our Perl version of this. But for the "total"
we do not use the:
> ($ctime - $last_proc_stat->{ctime}) * $clock_ticks * $cpucount;
calculation, but just add _all_ fields together, as that is the total
of CPU time.

Use a Reader-Writer lock to sync updating. First check under the
reader lock if the data is recent enough, else update it under the
writer lock.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocleanup
Wolfgang Bumiller [Wed, 18 Dec 2019 12:41:17 +0000 (13:41 +0100)]
cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: create_path: return whether the dir was created
Wolfgang Bumiller [Wed, 18 Dec 2019 12:40:11 +0000 (13:40 +0100)]
tools: create_path: return whether the dir was created

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: create_dir: pass EEXIST to the caller
Wolfgang Bumiller [Wed, 18 Dec 2019 12:37:10 +0000 (13:37 +0100)]
tools: create_dir: pass EEXIST to the caller

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: fix create_path: don't use O_PATH
Wolfgang Bumiller [Wed, 18 Dec 2019 12:13:43 +0000 (13:13 +0100)]
tools: fix create_path: don't use O_PATH

open(2) says file descriptors opened with O_PATH cannot be
passed to fchmod(), fchown(), etc.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoformatting fixup
Wolfgang Bumiller [Wed, 18 Dec 2019 12:13:34 +0000 (13:13 +0100)]
formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosrc/cli/format.rs - print_help: by default, use verbose output for simply commands
Dietmar Maurer [Wed, 18 Dec 2019 12:06:39 +0000 (13:06 +0100)]
src/cli/format.rs - print_help: by default, use verbose output for simply commands

4 years agoapi/macro: add NumberSchema
Thomas Lamprecht [Wed, 18 Dec 2019 10:14:57 +0000 (11:14 +0100)]
api/macro: add NumberSchema

Adapted from the integer schema, uses f64 type.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoreplace create_dir_chown with create_dir using CreateOptions
Wolfgang Bumiller [Wed, 18 Dec 2019 10:09:23 +0000 (11:09 +0100)]
replace create_dir_chown with create_dir using CreateOptions

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agodeprecate file_set_contents{,_full}
Wolfgang Bumiller [Wed, 18 Dec 2019 09:46:28 +0000 (10:46 +0100)]
deprecate file_set_contents{,_full}

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: replace_file, make options not an option...
Wolfgang Bumiller [Wed, 18 Dec 2019 09:04:21 +0000 (10:04 +0100)]
tools: replace_file, make options not an option...

CreateOptions::new() creates an all-None option set anyway

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: introduce replace_file
Wolfgang Bumiller [Wed, 18 Dec 2019 09:00:54 +0000 (10:00 +0100)]
tools: introduce replace_file

nicer api with CreateOptions
see doc-comments for more info

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agodrop derive-builder dependency
Wolfgang Bumiller [Wed, 18 Dec 2019 09:00:30 +0000 (10:00 +0100)]
drop derive-builder dependency

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoremove old router macro documentation
Wolfgang Bumiller [Wed, 18 Dec 2019 08:40:40 +0000 (09:40 +0100)]
remove old router macro documentation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: remove now-unnecessary PropertySchema type
Wolfgang Bumiller [Mon, 16 Dec 2019 12:06:57 +0000 (13:06 +0100)]
api-macro: remove now-unnecessary PropertySchema type

Schemas can now generally refer to an externally defined
schema.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: generalized '{ schema: PATH }' schemas
Wolfgang Bumiller [Mon, 16 Dec 2019 11:11:52 +0000 (12:11 +0100)]
api-macro: generalized '{ schema: PATH }' schemas

allow 'schema: PATH' outside object property context

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: support 'async fn' with new async api method
Wolfgang Bumiller [Mon, 16 Dec 2019 10:13:26 +0000 (11:13 +0100)]
api-macro: support 'async fn' with new async api method

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoimplement ApiHandler::Async
Dietmar Maurer [Mon, 16 Dec 2019 08:53:25 +0000 (09:53 +0100)]
implement ApiHandler::Async

4 years agoapi: update url crate to 2.1
Wolfgang Bumiller [Fri, 13 Dec 2019 10:30:06 +0000 (11:30 +0100)]
api: update url crate to 2.1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoupdate bytes to 0.5
Wolfgang Bumiller [Thu, 12 Dec 2019 14:35:36 +0000 (15:35 +0100)]
update bytes to 0.5

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoformatting fixup
Wolfgang Bumiller [Thu, 12 Dec 2019 14:35:30 +0000 (15:35 +0100)]
formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoupdates for hyper 0.13 release
Wolfgang Bumiller [Thu, 12 Dec 2019 12:06:40 +0000 (13:06 +0100)]
updates for hyper 0.13 release

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox-api/src/cli.rs: simplify cli setup using generics.
Dietmar Maurer [Mon, 9 Dec 2019 16:38:18 +0000 (17:38 +0100)]
proxmox-api/src/cli.rs: simplify cli setup using generics.

4 years agoproxmox-api/src/cli/format.rs - generate_nested_usage: fix formating with empty prefix
Dietmar Maurer [Fri, 6 Dec 2019 09:13:12 +0000 (10:13 +0100)]
proxmox-api/src/cli/format.rs - generate_nested_usage: fix formating with empty prefix

4 years agoapi: add 'router' and 'cli' features
Wolfgang Bumiller [Thu, 5 Dec 2019 12:36:05 +0000 (13:36 +0100)]
api: add 'router' and 'cli' features

Move API types into the router module and make router and
cli optional.

This way the 'router' module is the only thing with a
dependency on 'hyper', allowing the use of the schema alone
without pulling in the entire hyper stack.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi: use http::{Parts,Response,Method}
Wolfgang Bumiller [Thu, 5 Dec 2019 12:18:19 +0000 (13:18 +0100)]
api: use http::{Parts,Response,Method}

hyper just reexports them

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomore clippy fixups
Wolfgang Bumiller [Thu, 5 Dec 2019 11:28:05 +0000 (12:28 +0100)]
more clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoclippy fixups
Wolfgang Bumiller [Thu, 5 Dec 2019 10:35:33 +0000 (11:35 +0100)]
clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoformatting fixup
Wolfgang Bumiller [Thu, 5 Dec 2019 10:33:12 +0000 (11:33 +0100)]
formatting fixup

please run `make` to check formatting before committing

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoformatting fixup
Wolfgang Bumiller [Thu, 5 Dec 2019 10:32:48 +0000 (11:32 +0100)]
formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: allow methods without return types
Wolfgang Bumiller [Wed, 4 Dec 2019 13:27:57 +0000 (14:27 +0100)]
api-macro: allow methods without return types

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: don't return Null without return schema
Wolfgang Bumiller [Wed, 4 Dec 2019 13:24:32 +0000 (14:24 +0100)]
api-macro: don't return Null without return schema

serde_json turns () into Null anyway, so there's no need to
check this!

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: get enum description from doc comments
Wolfgang Bumiller [Wed, 4 Dec 2019 10:52:03 +0000 (11:52 +0100)]
api-macro: get enum description from doc comments

instead of:
    #[api(description: "Some description.")]
    pub enum { ... }

support:
    #[api]
    /// Some description.
    pub enum { ... }

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: move doc-comment reading to util
Wolfgang Bumiller [Wed, 4 Dec 2019 10:47:27 +0000 (11:47 +0100)]
api-macro: move doc-comment reading to util

The function attribute reader doesn't read any other
attributes anymore, so make it reusable!

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi: let ConstRegexPattern deref to Regex
Wolfgang Bumiller [Wed, 4 Dec 2019 10:06:00 +0000 (11:06 +0100)]
api: let ConstRegexPattern deref to Regex

This way we can just use `SOME_REGEX.is_match()` again
without having to explicitly call `(SOME_REGEX.regex_obj)()`
first.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: rename SimpleIdent to FieldName
Wolfgang Bumiller [Wed, 4 Dec 2019 08:06:31 +0000 (09:06 +0100)]
api-macro: rename SimpleIdent to FieldName

Initially it was a wrapper around Ident to avoid some
copies, but now it's what we use to allow hyphenated names
for fields in objects (as `syn::Ident` doesn't allow that at
all), so give it a more fitting name.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: support hyphenated parameter names
Wolfgang Bumiller [Tue, 3 Dec 2019 12:34:37 +0000 (13:34 +0100)]
api-macro: support hyphenated parameter names

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: drop ToTokens for SimpleIdent
Wolfgang Bumiller [Tue, 3 Dec 2019 10:58:35 +0000 (11:58 +0100)]
api-macro: drop ToTokens for SimpleIdent

The user must be explicit about whether the ident or string
is required.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: drop Deref of SimpleIdent
Wolfgang Bumiller [Tue, 3 Dec 2019 10:57:01 +0000 (11:57 +0100)]
api-macro: drop Deref of SimpleIdent

The user must always be explicit about whether the Ident or
the String is required, since they may differ.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: fixup idents in SimpleIdent
Wolfgang Bumiller [Tue, 3 Dec 2019 10:56:27 +0000 (11:56 +0100)]
api-macro: fixup idents in SimpleIdent

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: remove Into<Ident> for SimpleIdent
Wolfgang Bumiller [Tue, 3 Dec 2019 10:55:14 +0000 (11:55 +0100)]
api-macro: remove Into<Ident> for SimpleIdent

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: allow referencing external schemas in properties
Wolfgang Bumiller [Tue, 3 Dec 2019 10:11:46 +0000 (11:11 +0100)]
api-macro: allow referencing external schemas in properties

Reference a predefined BACKUP_ARCHIVE_NAME StringSchema like
this:
    #[api(
        input: {
            properties: {
                archive: {
                    optional: true,
                    schema: BACKUP_ARCHIVE_NAME,
                },
            }
        }
    )]
    fn get_archive(archive: String) -> Result<(), Error> {
        ...
    }

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox_api/src/format.rs - get_property_description: fix paragraph indention
Dietmar Maurer [Tue, 3 Dec 2019 06:55:53 +0000 (07:55 +0100)]
proxmox_api/src/format.rs - get_property_description: fix paragraph indention

4 years agoproxmox-api/src/format.rs: improve docs
Dietmar Maurer [Mon, 2 Dec 2019 19:06:14 +0000 (20:06 +0100)]
proxmox-api/src/format.rs: improve docs

4 years agoproxmox-api/src/format.rs: add missing docs
Dietmar Maurer [Mon, 2 Dec 2019 18:50:04 +0000 (19:50 +0100)]
proxmox-api/src/format.rs: add missing docs

4 years agoproxmox-api/src/cli/shellword.rs: re-export Quote from rustyline
Dietmar Maurer [Mon, 2 Dec 2019 18:29:47 +0000 (19:29 +0100)]
proxmox-api/src/cli/shellword.rs: re-export Quote from rustyline

4 years agoproxmox-api/src/cli/completion.rs: add more tests
Dietmar Maurer [Mon, 2 Dec 2019 16:34:11 +0000 (17:34 +0100)]
proxmox-api/src/cli/completion.rs: add more tests

4 years agoproxmox-api/src/cli/completion.rs: add help completion tests
Dietmar Maurer [Mon, 2 Dec 2019 15:42:59 +0000 (16:42 +0100)]
proxmox-api/src/cli/completion.rs: add help completion tests

4 years agoproxmox_api: add cli submodule (copied from proxmox-backup)
Dietmar Maurer [Mon, 2 Dec 2019 10:49:04 +0000 (11:49 +0100)]
proxmox_api: add cli submodule (copied from proxmox-backup)

4 years agoapi-macro: allow inferring some types automatically
Wolfgang Bumiller [Mon, 2 Dec 2019 10:45:37 +0000 (11:45 +0100)]
api-macro: allow inferring some types automatically

non-optional boolean, string and integer types can be
inferred from the function

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: test optional value invocation
Wolfgang Bumiller [Mon, 2 Dec 2019 10:12:34 +0000 (11:12 +0100)]
api-macro: test optional value invocation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: allow skipping `input` schema
Wolfgang Bumiller [Mon, 2 Dec 2019 10:00:04 +0000 (11:00 +0100)]
api-macro: allow skipping `input` schema

when there are no parameters

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: add test with no parameters
Wolfgang Bumiller [Mon, 2 Dec 2019 09:55:28 +0000 (10:55 +0100)]
api-macro: add test with no parameters

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: allow 'bool' and rust int types
Wolfgang Bumiller [Mon, 2 Dec 2019 09:54:57 +0000 (10:54 +0100)]
api-macro: allow 'bool' and rust int types

in place of Boolean and Integer

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: make return schema optional
Wolfgang Bumiller [Mon, 2 Dec 2019 09:38:33 +0000 (10:38 +0100)]
api-macro: make return schema optional

and support returning () from methods

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox-api: fix text_wrap() - use join instead of concat (separate by newlines)
Dietmar Maurer [Sun, 1 Dec 2019 11:29:26 +0000 (12:29 +0100)]
proxmox-api: fix text_wrap() - use join instead of concat (separate by newlines)

4 years agoapi-macro: some more test code
Wolfgang Bumiller [Thu, 28 Nov 2019 12:49:14 +0000 (13:49 +0100)]
api-macro: some more test code

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: fixup
Wolfgang Bumiller [Thu, 28 Nov 2019 12:47:42 +0000 (13:47 +0100)]
api-macro: fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>