/*
 * Artifact Keeper API
 *
 * Enterprise artifact registry supporting 45+ package formats.
 *
 * The version of the OpenAPI document: 1.2.1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// RoutingRule : A single routing rule that maps an incoming path to a rewritten path.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct RoutingRule {
    /// Regex pattern matched against the full request path. Use capture groups to extract portions for the rewrite template.
    #[serde(rename = "path_pattern")]
    pub path_pattern: String,
    /// Rewrite template. Use `$1`, `$2`, etc. to reference captured groups from `path_pattern`.
    #[serde(rename = "rewrite_to")]
    pub rewrite_to: String,
}

impl RoutingRule {
    /// A single routing rule that maps an incoming path to a rewritten path.
    pub fn new(path_pattern: String, rewrite_to: String) -> RoutingRule {
        RoutingRule {
            path_pattern,
            rewrite_to,
        }
    }
}

