1 use crate::static_map
::StaticMap
;
3 pub type PropertyMap
<'a
> = StaticMap
<'a
, &'a
str, Jss
<'a
>>;
6 pub struct JssBoolean
<'a
> {
7 pub description
: &'a
str,
8 pub optional
: Option
<bool
>,
9 pub default: Option
<bool
>,
13 pub struct JssInteger
<'a
> {
14 pub description
: &'a
str,
15 pub optional
: Option
<bool
>,
16 pub minimum
: Option
<usize>,
17 pub maximum
: Option
<usize>,
18 pub default: Option
<usize>,
22 pub struct JssString
<'a
> {
23 pub description
: &'a
str,
24 pub optional
: Option
<bool
>,
25 pub default: Option
<&'a
str>,
26 pub min_length
: Option
<usize>,
27 pub max_length
: Option
<usize>,
31 pub struct JssArray
<'a
> {
32 pub description
: &'a
str,
33 pub optional
: Option
<bool
>,
34 pub items
: &'a Jss
<'a
>,
38 pub struct JssObject
<'a
> {
39 pub description
: &'a
str,
40 pub optional
: Option
<bool
>,
41 pub additional_properties
: Option
<bool
>,
42 pub properties
: &'a PropertyMap
<'a
>,
48 Boolean(JssBoolean
<'a
>),
49 Integer(JssInteger
<'a
>),
50 String(JssString
<'a
>),
51 Object(JssObject
<'a
>),
53 Reference { reference: &'a Jss<'a> }
,
56 pub static DEFAULTBOOL
: JssBoolean
= JssBoolean
{
63 macro_rules
! Boolean
{
64 ($
($name
:ident
=> $e
:expr
),*) => {{
65 Jss
::Boolean(JssBoolean { $($name: $e, )* ..DEFAULTBOOL}
)
69 pub static DEFAULTINTEGER
: JssInteger
= JssInteger
{
78 macro_rules
! Integer
{
79 ($
($name
:ident
=> $e
:expr
),*) => {{
80 Jss
::Integer(JssInteger { $($name: $e, )* ..DEFAULTINTEGER}
)
84 pub static DEFAULTSTRING
: JssString
= JssString
{
93 macro_rules
! ApiString
{
94 ($
($name
:ident
=> $e
:expr
),*) => {{
95 Jss
::String(JssString { $($name: $e, )* ..DEFAULTSTRING}
)
99 pub static DEFAULTARRAY
: JssArray
= JssArray
{
102 items
: &Jss
::Null
, // is this a reasonable default??
107 ($
($name
:ident
=> $e
:expr
),*) => {{
108 Jss
::Array(JssArray { $($name: $e, )* ..DEFAULTARRAY}
)
112 pub static EMPTYOBJECT
: PropertyMap
= PropertyMap { entries: &[] }
;
114 pub static DEFAULTOBJECT
: JssObject
= JssObject
{
117 additional_properties
: None
,
118 properties
: &EMPTYOBJECT
, // is this a reasonable default??
122 macro_rules
! Object
{
123 ($
($name
:ident
=> $e
:expr
),*) => {{
124 Jss
::Object(JssObject { $($name: $e, )* ..DEFAULTOBJECT}
)
129 // Standard Option Definitions
130 pub static PVE_VMID
: Jss
= Integer
!{
131 description
=> "The (unique) ID of the VM.",