nautobot-openapi 0.4.0

low level nautobot bindings (generated by openapi-generator)
Documentation
/*
 * API Documentation
 *
 * Source of truth and network automation platform
 *
 * The version of the OpenAPI document: 3.1.0 (3.1)
 *
 * Generated by: https://openapi-generator.tech
 */

/// RegularExpressionValidationRuleRequest : Serializer for `RegularExpressionValidationRule` objects.

#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct RegularExpressionValidationRuleRequest {
    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
    pub id: Option<uuid::Uuid>,
    #[serde(rename = "content_type")]
    pub content_type: String,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "field")]
    pub field: String,
    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    /// Optional error message to display when validation fails.
    #[serde(rename = "error_message", skip_serializing_if = "Option::is_none")]
    pub error_message: Option<String>,
    #[serde(rename = "regular_expression")]
    pub regular_expression: String,
    /// When enabled, the regular expression value is first processed as a Jinja2 template with access to the context of the data being validated in a variable named <code>object</code>.
    #[serde(rename = "context_processing", skip_serializing_if = "Option::is_none")]
    pub context_processing: Option<bool>,
    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<crate::models::ApprovalWorkflowStageResponseApprovalWorkflowStage>>,
    #[serde(rename = "custom_fields", skip_serializing_if = "Option::is_none")]
    pub custom_fields: Option<::std::collections::HashMap<String, serde_json::Value>>,
    #[serde(rename = "relationships", skip_serializing_if = "Option::is_none")]
    pub relationships: Option<
        ::std::collections::HashMap<
            String,
            crate::models::ApprovalWorkflowDefinitionRequestRelationshipsValue,
        >,
    >,
}

impl RegularExpressionValidationRuleRequest {
    /// Serializer for `RegularExpressionValidationRule` objects.
    pub fn new(
        content_type: String,
        name: String,
        field: String,
        regular_expression: String,
    ) -> RegularExpressionValidationRuleRequest {
        RegularExpressionValidationRuleRequest {
            id: None,
            content_type,
            name,
            field,
            enabled: None,
            error_message: None,
            regular_expression,
            context_processing: None,
            tags: None,
            custom_fields: None,
            relationships: None,
        }
    }
}