netbox-openapi 0.5.4

low level netbox bindings (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Generic foreign-key (`GenericObjectRequest`) fields, derived from the
//! NetBox OpenAPI schema. Auto-generated by `scripts/generate.sh` - do not edit.

/// `(app_label.model, field)` pairs whose write payload is a NetBox
/// `GenericObjectRequest` (or array of them), and must therefore be encoded as
/// `{ "object_type": ..., "object_id": ... }` rather than a bare id.
pub const GENERIC_FK_FIELDS: &[(&str, &str)] = &[
    ("dcim.cable", "a_terminations"),
    ("dcim.cable", "b_terminations"),
];

/// Returns `true` if `field` on `model` (keyed as `app_label.model`, e.g.
/// `"dcim.cable"`) is a generic foreign key whose value must be wrapped.
pub fn is_generic_fk(model: &str, field: &str) -> bool {
    GENERIC_FK_FIELDS
        .iter()
        .any(|(m, f)| *m == model && *f == field)
}