Commit aa06bc06 authored by Cyril Plisko's avatar Cyril Plisko

Add Outputs and Parameters

parent 97667262
Pipeline #81159297 failed with stage
in 4 minutes and 21 seconds
......@@ -93,8 +93,16 @@ impl Template {
self
}
pub fn output(&mut self) -> &mut Self {
unimplemented!()
pub fn parameter(&mut self, name: impl Into<String>, parameter: Parameter) -> &mut Self {
let name = name.into();
self.parameters.insert(name, parameter);
self
}
pub fn output(&mut self, name: impl Into<String>, output: Output) -> &mut Self {
let name = name.into();
self.outputs.insert(name, output);
self
}
pub fn json(&self) -> String {
......
use serde::Serialize;
#[derive(Clone, Debug, Serialize)]
pub struct Output;
pub struct Output {
description: String,
value: String,
export: String,
}
use serde::Serialize;
#[derive(Clone, Debug, Default, Serialize)]
pub struct Parameter {
allowed_pattern: String,
allowed_values: Vec<String>,
constraint_description: String,
default: String,
description: String,
max_length: u64,
max_value: u64,
min_length: u64,
min_value: u64,
no_echo: bool,
r#type: DataType,
}
impl Parameter {
pub fn string() -> Self {
let r#type = DataType::String;
Self {
r#type,
..Self::default()
}
}
pub fn number() -> Self {
let r#type = DataType::Number;
Self {
r#type,
..Self::default()
}
}
}
#[derive(Clone, Debug, Serialize)]
pub struct Parameter;
pub enum DataType {
String,
Number,
}
impl Default for DataType {
fn default() -> Self {
Self::String
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment