Class KubernetesYaml
This is a utility class that helps you load objects from YAML files.
Inheritance
KubernetesYaml
Namespace: k8s
Assembly: KubernetesClient.dll
Syntax
public static class KubernetesYaml
Methods
View Source
Deserialize<TValue>(Stream, bool)
Declaration
public static TValue Deserialize<TValue>(Stream yaml, bool strict = false)
Parameters
Returns
Type Parameters
View Source
Deserialize<TValue>(string, bool)
Declaration
public static TValue Deserialize<TValue>(string yaml, bool strict = false)
Parameters
Returns
Type Parameters
View Source
LoadAllFromFileAsync(string, IDictionary<string, Type>, bool)
Load a collection of objects from a file asynchronously
Declaration
public static Task<List<object>> LoadAllFromFileAsync(string fileName, IDictionary<string, Type> typeMap = null, bool strict = false)
Parameters
| Type |
Name |
Description |
| string |
fileName |
The name of the file to load from.
|
| IDictionary<string, Type> |
typeMap |
A map from apiVersion/kind to Type. For example "v1/Pod" -> typeof(V1Pod). If null, a default mapping will
be used.
|
| bool |
strict |
true if a strict deserializer should be used (throwing exception on unknown properties), false otherwise
|
Returns
View Source
LoadAllFromStreamAsync(Stream, IDictionary<string, Type>, bool)
Load a collection of objects from a stream asynchronously
caller is responsible for closing the stream
Declaration
public static Task<List<object>> LoadAllFromStreamAsync(Stream stream, IDictionary<string, Type> typeMap = null, bool strict = false)
Parameters
| Type |
Name |
Description |
| Stream |
stream |
The stream to load the objects from.
|
| IDictionary<string, Type> |
typeMap |
A map from apiVersion/kind to Type. For example "v1/Pod" -> typeof(V1Pod). If null, a default mapping will
be used.
|
| bool |
strict |
true if a strict deserializer should be used (throwing exception on unknown properties), false otherwise
|
Returns
View Source
LoadAllFromString(string, IDictionary<string, Type>, bool)
Load a collection of objects from a string
Declaration
public static List<object> LoadAllFromString(string content, IDictionary<string, Type> typeMap = null, bool strict = false)
Parameters
| Type |
Name |
Description |
| string |
content |
The string to load the objects from.
|
| IDictionary<string, Type> |
typeMap |
A map from apiVersion/kind to Type. For example "v1/Pod" -> typeof(V1Pod). If null, a default mapping will
be used.
|
| bool |
strict |
true if a strict deserializer should be used (throwing exception on unknown properties), false otherwise
|
Returns
| Type |
Description |
| List<object> |
collection of objects
|
View Source
LoadFromFileAsync<T>(string, bool)
Declaration
public static Task<T> LoadFromFileAsync<T>(string file, bool strict = false)
Parameters
Returns
Type Parameters
View Source
LoadFromStreamAsync<T>(Stream, bool)
Declaration
public static Task<T> LoadFromStreamAsync<T>(Stream stream, bool strict = false)
Parameters
Returns
Type Parameters
View Source
LoadFromString<T>(string, bool)
Declaration
[Obsolete("use Deserialize")]
public static T LoadFromString<T>(string content, bool strict = false)
Parameters
Returns
Type Parameters
View Source
SaveToString<T>(T)
Declaration
[Obsolete("use Serialize")]
public static string SaveToString<T>(T value)
Parameters
| Type |
Name |
Description |
| T |
value |
|
Returns
Type Parameters
View Source
Serialize(object)
Declaration
public static string Serialize(object value)
Parameters
| Type |
Name |
Description |
| object |
value |
|
Returns
View Source
SerializeAll(IEnumerable<object>)
Declaration
public static string SerializeAll(IEnumerable<object> values)
Parameters
Returns