netbox_openapi/models/
writable_data_source_request.rs

1/*
2 * NetBox REST API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 4.4.2-Docker-3.4.1 (4.4)
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// WritableDataSourceRequest : Adds support for custom fields and tags.
12
13#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
14pub struct WritableDataSourceRequest {
15    #[serde(rename = "name")]
16    pub name: String,
17    #[serde(rename = "type")]
18    pub r#type: String,
19    #[serde(rename = "source_url")]
20    pub source_url: String,
21    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
22    pub enabled: Option<bool>,
23    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
24    pub description: Option<String>,
25    /// * `1` - Minutely * `60` - Hourly * `720` - 12 hours * `1440` - Daily * `10080` - Weekly * `43200` - 30 days
26    #[serde(
27        rename = "sync_interval",
28        default,
29        with = "::serde_with::rust::double_option",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub sync_interval: Option<Option<SyncInterval>>,
33    #[serde(
34        rename = "parameters",
35        default,
36        with = "::serde_with::rust::double_option",
37        skip_serializing_if = "Option::is_none"
38    )]
39    pub parameters: Option<Option<serde_json::Value>>,
40    /// Patterns (one per line) matching files to ignore when syncing
41    #[serde(rename = "ignore_rules", skip_serializing_if = "Option::is_none")]
42    pub ignore_rules: Option<String>,
43    #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
44    pub comments: Option<String>,
45    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
46    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
47}
48
49impl WritableDataSourceRequest {
50    /// Adds support for custom fields and tags.
51    pub fn new(name: String, r#type: String, source_url: String) -> WritableDataSourceRequest {
52        WritableDataSourceRequest {
53            name,
54            r#type,
55            source_url,
56            enabled: None,
57            description: None,
58            sync_interval: None,
59            parameters: None,
60            ignore_rules: None,
61            comments: None,
62            custom_fields: None,
63        }
64    }
65}
66
67/// * `1` - Minutely * `60` - Hourly * `720` - 12 hours * `1440` - Daily * `10080` - Weekly * `43200` - 30 days
68#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
69pub enum SyncInterval {
70    #[serde(rename = "1")]
71    Variant1,
72    #[serde(rename = "60")]
73    Variant60,
74    #[serde(rename = "720")]
75    Variant720,
76    #[serde(rename = "1440")]
77    Variant1440,
78    #[serde(rename = "10080")]
79    Variant10080,
80    #[serde(rename = "43200")]
81    Variant43200,
82    #[serde(rename = "null")]
83    Null,
84}
85
86impl Default for SyncInterval {
87    fn default() -> SyncInterval {
88        Self::Variant1
89    }
90}