sktlib 0.1.5

the library for the template creator for kubernetes resources
Documentation
use crate::core::deployment::Deployment;
use crate::core::models::Port;
use crate::core::service::Service;
use crate::stringifyer::build_string;

pub struct ManifestCreator {

}

impl ManifestCreator {
    pub fn new() -> ManifestCreator {
        ManifestCreator {}
    }

    pub fn create_deployment(&self, name: &str, image: &str) -> Result<String, String> {
        let deployment = Deployment::new(name.to_string(), image.to_string());
        Ok(build_string(deployment))
    }

    pub fn create_service(&self, name: &str, target: &str, port: i32) -> Result<String, String> {
        let service = Service::new(name.to_string(), target.to_string(), vec![
            Port{
                protocol: "TCP".to_string(),
                port,
                target_port: port,
            }]
        );
        Ok(build_string(service))
    }
}