[−][src]Struct ktmpl::Template
A Kubernetes manifest template and the values for each of its parameters.
Methods
impl Template
[src]
pub fn new(
template_contents: String,
parameter_values: ParameterValues,
secrets: Option<Secrets>
) -> Result<Self, String>
[src]
template_contents: String,
parameter_values: ParameterValues,
secrets: Option<Secrets>
) -> Result<Self, String>
Creates a new template.
Parameters
- template_contents: The YAML template file's contents.
- parameter_values: A map of the template's parameters and the user-supplied values for each.
- secrets: A list of Kubernetes secrets whose data keys should be Base64 encoded after parameter interpolation.
Errors
Returns an error if:
- There was more than one YAML document present in the template contents.
- The YAML document did not contain an "objects" key or it was not an array value.
- The YAML document did not contain a "parameters" key or it was not an array value.
- One of the parameters doesn't have a "name" key.
- One of the parameters specifies an invalid "parameterType".
- One of the parameters requires a value which wasn't supplied.
- Any of the provided secrets were not found in the template.
- There was an error in the structure of a secret that prevented its data from being Base64 encoded.
pub fn process(self) -> Result<String, String>
[src]
Interpolates the parameters' values into the YAML template, returning the results.
Errors
Returns an error if the processed template was not valid YAML, or if any specified secrets could not be found and Base64 encoded.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,