netbox-openapi 0.6.0

low level netbox bindings (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
/*
 * NetBox REST API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 4.6.2 (4.6)
 *
 * Generated by: https://openapi-generator.tech
 */

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ExtrasCustomFieldsCreateRequest {
    #[serde(rename = "object_types")]
    pub object_types: Vec<String>,
    /// The type of data this custom field holds  * `text` - Text * `longtext` - Text (long) * `integer` - Integer * `decimal` - Decimal * `boolean` - Boolean (true/false) * `date` - Date * `datetime` - Date & time * `url` - URL * `json` - JSON * `select` - Selection * `multiselect` - Multiple selection * `object` - Object * `multiobject` - Multiple objects
    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
    pub r#type: Option<RHashType>,
    #[serde(
        rename = "related_object_type",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub related_object_type: Option<Option<String>>,
    /// Internal field name
    #[serde(rename = "name")]
    pub name: String,
    /// Name of the field as displayed to users (if not provided, 'the field's name will be used)
    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    /// Custom fields within the same group will be displayed together
    #[serde(rename = "group_name", skip_serializing_if = "Option::is_none")]
    pub group_name: Option<String>,
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// This field is required when creating new objects or editing an existing object.
    #[serde(rename = "required", skip_serializing_if = "Option::is_none")]
    pub required: Option<bool>,
    /// The value of this field must be unique for the assigned object
    #[serde(rename = "unique", skip_serializing_if = "Option::is_none")]
    pub unique: Option<bool>,
    /// Weighting for search. Lower values are considered more important. Fields with a search weight of zero will be ignored.
    #[serde(rename = "search_weight", skip_serializing_if = "Option::is_none")]
    pub search_weight: Option<i32>,
    /// Loose matches any instance of a given string; exact matches the entire field.  * `disabled` - Disabled * `loose` - Loose * `exact` - Exact
    #[serde(rename = "filter_logic", skip_serializing_if = "Option::is_none")]
    pub filter_logic: Option<FilterLogic>,
    /// Specifies whether the custom field is displayed in the UI  * `always` - Always * `if-set` - If set * `hidden` - Hidden
    #[serde(rename = "ui_visible", skip_serializing_if = "Option::is_none")]
    pub ui_visible: Option<UiVisible>,
    /// Specifies whether the custom field value can be edited in the UI  * `yes` - Yes * `no` - No * `hidden` - Hidden
    #[serde(rename = "ui_editable", skip_serializing_if = "Option::is_none")]
    pub ui_editable: Option<UiEditable>,
    /// Replicate this value when cloning objects
    #[serde(rename = "is_cloneable", skip_serializing_if = "Option::is_none")]
    pub is_cloneable: Option<bool>,
    /// Default value for the field (must be a JSON value). Encapsulate strings with double quotes (e.g. \"Foo\").
    #[serde(
        rename = "default",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub default: Option<Option<serde_json::Value>>,
    /// Filter the object selection choices using a query_params dict (must be a JSON value).Encapsulate strings with double quotes (e.g. \"Foo\").
    #[serde(
        rename = "related_object_filter",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub related_object_filter: Option<Option<serde_json::Value>>,
    /// Fields with higher weights appear lower in a form.
    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
    pub weight: Option<i32>,
    /// Minimum allowed value (for numeric fields)
    #[serde(
        rename = "validation_minimum",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub validation_minimum: Option<Option<f64>>,
    /// Maximum allowed value (for numeric fields)
    #[serde(
        rename = "validation_maximum",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub validation_maximum: Option<Option<f64>>,
    /// Regular expression to enforce on text field values. Use ^ and $ to force matching of entire string. For example, <code>^[A-Z]{3}$</code> will limit values to exactly three uppercase letters.
    #[serde(rename = "validation_regex", skip_serializing_if = "Option::is_none")]
    pub validation_regex: Option<String>,
    /// A JSON schema definition for validating the custom field value
    #[serde(
        rename = "validation_schema",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub validation_schema: Option<Option<serde_json::Value>>,
    #[serde(
        rename = "choice_set",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub choice_set: Option<Option<Box<crate::models::CustomFieldRequestChoiceSet>>>,
    #[serde(
        rename = "owner",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub owner: Option<Option<Box<crate::models::AsnRangeRequestOwner>>>,
    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
    pub comments: Option<String>,
}

impl ExtrasCustomFieldsCreateRequest {
    pub fn new(object_types: Vec<String>, name: String) -> ExtrasCustomFieldsCreateRequest {
        ExtrasCustomFieldsCreateRequest {
            object_types,
            r#type: None,
            related_object_type: None,
            name,
            label: None,
            group_name: None,
            description: None,
            required: None,
            unique: None,
            search_weight: None,
            filter_logic: None,
            ui_visible: None,
            ui_editable: None,
            is_cloneable: None,
            default: None,
            related_object_filter: None,
            weight: None,
            validation_minimum: None,
            validation_maximum: None,
            validation_regex: None,
            validation_schema: None,
            choice_set: None,
            owner: None,
            comments: None,
        }
    }
}

/// The type of data this custom field holds  * `text` - Text * `longtext` - Text (long) * `integer` - Integer * `decimal` - Decimal * `boolean` - Boolean (true/false) * `date` - Date * `datetime` - Date & time * `url` - URL * `json` - JSON * `select` - Selection * `multiselect` - Multiple selection * `object` - Object * `multiobject` - Multiple objects
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum RHashType {
    #[serde(rename = "text")]
    Text,
    #[serde(rename = "longtext")]
    Longtext,
    #[serde(rename = "integer")]
    Integer,
    #[serde(rename = "decimal")]
    Decimal,
    #[serde(rename = "boolean")]
    Boolean,
    #[serde(rename = "date")]
    Date,
    #[serde(rename = "datetime")]
    Datetime,
    #[serde(rename = "url")]
    Url,
    #[serde(rename = "json")]
    Json,
    #[serde(rename = "select")]
    Select,
    #[serde(rename = "multiselect")]
    Multiselect,
    #[serde(rename = "object")]
    Object,
    #[serde(rename = "multiobject")]
    Multiobject,
}

impl Default for RHashType {
    fn default() -> RHashType {
        Self::Text
    }
}
/// Loose matches any instance of a given string; exact matches the entire field.  * `disabled` - Disabled * `loose` - Loose * `exact` - Exact
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum FilterLogic {
    #[serde(rename = "disabled")]
    Disabled,
    #[serde(rename = "loose")]
    Loose,
    #[serde(rename = "exact")]
    Exact,
}

impl Default for FilterLogic {
    fn default() -> FilterLogic {
        Self::Disabled
    }
}
/// Specifies whether the custom field is displayed in the UI  * `always` - Always * `if-set` - If set * `hidden` - Hidden
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum UiVisible {
    #[serde(rename = "always")]
    Always,
    #[serde(rename = "if-set")]
    IfSet,
    #[serde(rename = "hidden")]
    Hidden,
}

impl Default for UiVisible {
    fn default() -> UiVisible {
        Self::Always
    }
}
/// Specifies whether the custom field value can be edited in the UI  * `yes` - Yes * `no` - No * `hidden` - Hidden
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum UiEditable {
    #[serde(rename = "yes")]
    Yes,
    #[serde(rename = "no")]
    No,
    #[serde(rename = "hidden")]
    Hidden,
}

impl Default for UiEditable {
    fn default() -> UiEditable {
        Self::Yes
    }
}