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
 */

/// WritableEventRuleRequest : Adds an `owner` field for models which have a ForeignKey to users.Owner.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct WritableEventRuleRequest {
    #[serde(rename = "object_types")]
    pub object_types: Vec<String>,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    /// The types of event which will trigger this rule.
    #[serde(rename = "event_types")]
    pub event_types: Vec<EventTypes>,
    /// A set of conditions which determine whether the event will be generated.
    #[serde(
        rename = "conditions",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub conditions: Option<Option<serde_json::Value>>,
    /// * `webhook` - Webhook * `script` - Script * `notification` - Notification
    #[serde(rename = "action_type", skip_serializing_if = "Option::is_none")]
    pub action_type: Option<ActionType>,
    #[serde(rename = "action_object_type")]
    pub action_object_type: String,
    #[serde(
        rename = "action_object_id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub action_object_id: Option<Option<i64>>,
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
    #[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 = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<crate::models::NestedTagRequest>>,
}

impl WritableEventRuleRequest {
    /// Adds an `owner` field for models which have a ForeignKey to users.Owner.
    pub fn new(
        object_types: Vec<String>,
        name: String,
        event_types: Vec<EventTypes>,
        action_object_type: String,
    ) -> WritableEventRuleRequest {
        WritableEventRuleRequest {
            object_types,
            name,
            enabled: None,
            event_types,
            conditions: None,
            action_type: None,
            action_object_type,
            action_object_id: None,
            description: None,
            custom_fields: None,
            owner: None,
            tags: None,
        }
    }
}

/// The types of event which will trigger this rule.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum EventTypes {
    #[serde(rename = "object_created")]
    ObjectCreated,
    #[serde(rename = "object_updated")]
    ObjectUpdated,
    #[serde(rename = "object_deleted")]
    ObjectDeleted,
    #[serde(rename = "job_started")]
    JobStarted,
    #[serde(rename = "job_completed")]
    JobCompleted,
    #[serde(rename = "job_failed")]
    JobFailed,
    #[serde(rename = "job_errored")]
    JobErrored,
}

impl Default for EventTypes {
    fn default() -> EventTypes {
        Self::ObjectCreated
    }
}
/// * `webhook` - Webhook * `script` - Script * `notification` - Notification
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ActionType {
    #[serde(rename = "webhook")]
    Webhook,
    #[serde(rename = "script")]
    Script,
    #[serde(rename = "notification")]
    Notification,
}

impl Default for ActionType {
    fn default() -> ActionType {
        Self::Webhook
    }
}