]>
git.proxmox.com Git - proxmox.git/log
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>
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>
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>
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>
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>
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>
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>
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>
Dietmar Maurer [Mon, 16 Dec 2019 08:53:25 +0000 (09:53 +0100)]
implement ApiHandler::Async
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>
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>
Wolfgang Bumiller [Thu, 12 Dec 2019 14:35:30 +0000 (15:35 +0100)]
formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
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>
Dietmar Maurer [Mon, 9 Dec 2019 16:38:18 +0000 (17:38 +0100)]
proxmox-api/src/cli.rs: simplify cli setup using generics.
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
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>
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>
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>
Wolfgang Bumiller [Thu, 5 Dec 2019 10:35:33 +0000 (11:35 +0100)]
clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
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>
Wolfgang Bumiller [Thu, 5 Dec 2019 10:32:48 +0000 (11:32 +0100)]
formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Dietmar Maurer [Tue, 3 Dec 2019 06:55:53 +0000 (07:55 +0100)]
proxmox_api/src/format.rs - get_property_description: fix paragraph indention
Dietmar Maurer [Mon, 2 Dec 2019 19:06:14 +0000 (20:06 +0100)]
proxmox-api/src/format.rs: improve docs
Dietmar Maurer [Mon, 2 Dec 2019 18:50:04 +0000 (19:50 +0100)]
proxmox-api/src/format.rs: add missing docs
Dietmar Maurer [Mon, 2 Dec 2019 18:29:47 +0000 (19:29 +0100)]
proxmox-api/src/cli/shellword.rs: re-export Quote from rustyline
Dietmar Maurer [Mon, 2 Dec 2019 16:34:11 +0000 (17:34 +0100)]
proxmox-api/src/cli/completion.rs: add more tests
Dietmar Maurer [Mon, 2 Dec 2019 15:42:59 +0000 (16:42 +0100)]
proxmox-api/src/cli/completion.rs: add help completion tests
Dietmar Maurer [Mon, 2 Dec 2019 10:49:04 +0000 (11:49 +0100)]
proxmox_api: add cli submodule (copied from proxmox-backup)
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>
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>
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>
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>
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>
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>
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)
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>
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>
Wolfgang Bumiller [Thu, 28 Nov 2019 12:43:25 +0000 (13:43 +0100)]
api-macro: cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Thu, 28 Nov 2019 12:42:46 +0000 (13:42 +0100)]
api-macro: parse serde(rename) on enums
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Thu, 28 Nov 2019 11:21:46 +0000 (12:21 +0100)]
api-macro: experimental enum support
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Thu, 28 Nov 2019 10:15:37 +0000 (11:15 +0100)]
api-macro: support defining schemas for structs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Thu, 28 Nov 2019 09:42:34 +0000 (10:42 +0100)]
api-macro: support external types
See the test example:
assuming a `pub struct Foo` which implements `Serialize` and
`Deserialize`, we also expect it to provide a
`pub const Foo::API_SCHEMA: &Schema` like so:
#[derive(Deserialize, Serialize)]
pub struct StrongString(String);
impl StrongString {
pub const API_SCHEMA: &'static Schema =
&StringSchema::new("Some generic string")
.format(&ApiStringFormat::Enum(&["a", "b"]))
.schema();
}
Then we can use:
#[api(
input: {
properties: {
arg: { type: StrongString },
}
},
...
)]
fn my_api_func(arg: StrongString) -> Result<...> {
...
}
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Thu, 28 Nov 2019 08:29:45 +0000 (09:29 +0100)]
api-macro: tests: remove #![allow(dead_code)]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Thu, 28 Nov 2019 08:16:34 +0000 (09:16 +0100)]
api-macro: match the item type early
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Thu, 28 Nov 2019 08:13:32 +0000 (09:13 +0100)]
api-macro: move method handling to api/method.rs
We may want to add the ability to declare a Schema for
structs, so factorize function handling into its own file.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 13:46:20 +0000 (14:46 +0100)]
api-macro: update tests, cleanup some macro generated paths
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 13:44:16 +0000 (14:44 +0100)]
api-macro: convert function output to a json value
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 13:41:51 +0000 (14:41 +0100)]
api-macro: minor improvements
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 13:04:14 +0000 (14:04 +0100)]
api-macro: reduce code output a little
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 12:57:08 +0000 (13:57 +0100)]
api-macro: start actually extracting parameters
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 11:29:50 +0000 (12:29 +0100)]
api-macro: begin and explain the parameter mapping strategy
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 10:31:40 +0000 (11:31 +0100)]
api-macro: start looking at function parameter types
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 10:04:36 +0000 (11:04 +0100)]
api-macro: start checking some function signature parts
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 10:01:40 +0000 (11:01 +0100)]
api-macro: parse properties as attributes to #[api]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 10:01:12 +0000 (11:01 +0100)]
api-amcro: expose JSONObject::parse_inner as Parser
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 09:59:37 +0000 (10:59 +0100)]
api-macro: JSONValue to bool shortcut
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 09:48:00 +0000 (10:48 +0100)]
api-macro: factor out inner parser of JSONObject
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Wed, 27 Nov 2019 09:06:15 +0000 (10:06 +0100)]
api-macro: test: add 'protected' attribute
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Tue, 26 Nov 2019 13:20:29 +0000 (14:20 +0100)]
sortable-macro: fixup handle_error
Error cases need to include the original code in order for
the compiler to properly show the problematic code pointed
to by the Spans used in the compile_error!() output macro.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Tue, 26 Nov 2019 13:18:25 +0000 (14:18 +0100)]
api-macro: refactoring: split api macro function
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Tue, 26 Nov 2019 13:07:47 +0000 (14:07 +0100)]
api-macro: move json part to util module
The json value type is more of an intermediate step between
the TokenStream and the Schema type and should stay somewhat
independent of it. We may want to reuse it for the router?
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Tue, 26 Nov 2019 13:04:44 +0000 (14:04 +0100)]
api-macro: remove old unused files
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Tue, 26 Nov 2019 12:39:56 +0000 (13:39 +0100)]
api-macro: fix section iteration
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Tue, 26 Nov 2019 12:39:20 +0000 (13:39 +0100)]
api-macro: understand a 'Returns:' section in function doc comments
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Tue, 26 Nov 2019 12:34:41 +0000 (13:34 +0100)]
api-macro: correctly concatenate doc macros
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Tue, 26 Nov 2019 12:27:53 +0000 (13:27 +0100)]
api-macro: make type optional in some cases
Objects and arrays are now optionally identified by their
'properties' or 'items' property if their 'type' is left
out.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Tue, 26 Nov 2019 11:17:40 +0000 (12:17 +0100)]
api-macro: trim doc-comment when used as description
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Tue, 26 Nov 2019 11:16:05 +0000 (12:16 +0100)]
api-macro: rename elements to properties
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Mon, 25 Nov 2019 14:07:26 +0000 (15:07 +0100)]
replace builder-pattern api macro parser with json
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Mon, 25 Nov 2019 14:08:45 +0000 (15:08 +0100)]
run 'cargo fmt -- --check' in check target
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Mon, 25 Nov 2019 14:07:18 +0000 (15:07 +0100)]
formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Dietmar Maurer [Sun, 24 Nov 2019 09:34:59 +0000 (10:34 +0100)]
proxmox_api: improve ApiStringFormat docs
Dietmar Maurer [Sun, 24 Nov 2019 08:51:45 +0000 (09:51 +0100)]
proxmox-api: rename ApiStringFormat::Complex into ApiStringFormat::PropertyString
Dietmar Maurer [Sat, 23 Nov 2019 16:00:36 +0000 (17:00 +0100)]
proxmox-api: improve schema docs
Dietmar Maurer [Sat, 23 Nov 2019 14:55:18 +0000 (15:55 +0100)]
proxmox-api: improve schema docs
Dietmar Maurer [Sat, 23 Nov 2019 13:13:14 +0000 (14:13 +0100)]
proxmox-api: further doc improvements
Dietmar Maurer [Sat, 23 Nov 2019 13:08:44 +0000 (14:08 +0100)]
proxmox-api: improve router docs
Dietmar Maurer [Sat, 23 Nov 2019 10:51:16 +0000 (11:51 +0100)]
proxmox-api - improve Router docs
Dietmar Maurer [Sat, 23 Nov 2019 09:58:32 +0000 (10:58 +0100)]
proxmox-api: move impl ApiMethod to lib.rs
Dietmar Maurer [Sat, 23 Nov 2019 09:48:36 +0000 (10:48 +0100)]
const_regex: fixup for previous commit
Dietmar Maurer [Sat, 23 Nov 2019 09:42:17 +0000 (10:42 +0100)]
proxmox-api: further cleanups
- improve docs
- move ConstRegexPattern to const_regex.rs
Dietmar Maurer [Sat, 23 Nov 2019 08:53:18 +0000 (09:53 +0100)]
proxmox-api/src/lib.rs: hide modules with inlined docs
Dietmar Maurer [Sat, 23 Nov 2019 07:54:07 +0000 (08:54 +0100)]
proxmox_api - ApiHandler: rename Async into AsyncHttp
And improve docs.
Wolfgang Bumiller [Fri, 22 Nov 2019 08:54:29 +0000 (09:54 +0100)]
import a first draft of api macros
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Dietmar Maurer [Fri, 22 Nov 2019 11:48:36 +0000 (12:48 +0100)]
api: simplify ApiAsyncHandlerFn
Wolfgang Bumiller [Fri, 22 Nov 2019 08:28:22 +0000 (09:28 +0100)]
api: add format module
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Wolfgang Bumiller [Thu, 21 Nov 2019 13:00:25 +0000 (14:00 +0100)]
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>
Wolfgang Bumiller [Thu, 21 Nov 2019 12:43:10 +0000 (13:43 +0100)]
api: move ApiMethod from router to top level
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>