Show / Hide Table of Contents

Class KubernetesYaml

This is a utility class that helps you load objects from YAML files.

Inheritance
object
KubernetesYaml
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
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
Type Name Description
Stream yaml
bool strict
Returns
Type Description
TValue
Type Parameters
Name Description
TValue
View Source

Deserialize<TValue>(string, bool)

Declaration
public static TValue Deserialize<TValue>(string yaml, bool strict = false)
Parameters
Type Name Description
string yaml
bool strict
Returns
Type Description
TValue
Type Parameters
Name Description
TValue
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
Type Description
Task<List<object>>

collection of objects

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
Type Description
Task<List<object>>

collection of objects

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
Type Name Description
string file
bool strict
Returns
Type Description
Task<T>
Type Parameters
Name Description
T
View Source

LoadFromStreamAsync<T>(Stream, bool)

Declaration
public static Task<T> LoadFromStreamAsync<T>(Stream stream, bool strict = false)
Parameters
Type Name Description
Stream stream
bool strict
Returns
Type Description
Task<T>
Type Parameters
Name Description
T
View Source

LoadFromString<T>(string, bool)

Declaration
[Obsolete("use Deserialize")]
public static T LoadFromString<T>(string content, bool strict = false)
Parameters
Type Name Description
string content
bool strict
Returns
Type Description
T
Type Parameters
Name Description
T
View Source

SaveToString<T>(T)

Declaration
[Obsolete("use Serialize")]
public static string SaveToString<T>(T value)
Parameters
Type Name Description
T value
Returns
Type Description
string
Type Parameters
Name Description
T
View Source

Serialize(object)

Declaration
public static string Serialize(object value)
Parameters
Type Name Description
object value
Returns
Type Description
string
View Source

SerializeAll(IEnumerable<object>)

Declaration
public static string SerializeAll(IEnumerable<object> values)
Parameters
Type Name Description
IEnumerable<object> values
Returns
Type Description
string
  • View Source
In this article
Back to top Generated by DocFX