Package io.kubernetes.client.util
Class Yaml
java.lang.Object
io.kubernetes.client.util.Yaml
The type Yaml.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDefines constructor logic for custom types in this library.static class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddModelMap(String apiGroupVersion, String kind, Class<?> clazz) Deprecated.static StringTakes an API object and returns a YAML String representing that object.static voidTakes an API object and writes a YAML string representing that object to the writer.static StringTakes an Iterator of YAML API objects and returns a YAML string representing all of themstatic voidTakes an Iterator of YAML API objects and writes a YAML String representing all of them.static org.yaml.snakeyaml.YamlDeprecated.static org.yaml.snakeyaml.YamlgetSnakeYaml(Class<?> type, org.yaml.snakeyaml.DumperOptions dumperOptions, org.yaml.snakeyaml.LoaderOptions loaderOptions, org.yaml.snakeyaml.TypeDescription... typeDescriptions) Instantiate a snake yaml with the target model type, and the dump/load option specified..static org.yaml.snakeyaml.YamlgetSnakeYaml(Class<?> type, org.yaml.snakeyaml.TypeDescription... typeDescriptions) Instantiate a snake yaml with the target model type specified..static ObjectLoad an API object from a YAML file.static ObjectLoad an API object from a stream of data.static ObjectLoad an API object from a YAML string representation.Load list of instantiated API objects from a YAML file.Load list of instantiated API objects from a stream of data.Load list of instantiated API objects from a YAML string representation.static <T> TLoad an API object from a YAML file.static <T> TLoad an API object from a YAML stream.static <T> TLoad an API object from a YAML string representation.static org.yaml.snakeyaml.TypeDescriptionnewGsonCompatibleTypeDescription(Class modelClass, String... gsonTaggedFields) Instantiate a newTypeDescriptionwhich will load theSerializedNamevia reflection so that yaml serialization can work for the custom gson serialized name.
-
Constructor Details
-
Yaml
public Yaml()
-
-
Method Details
-
load
Load an API object from a YAML string representation. Returns a concrete typed object (e.g. V1Pod)- Parameters:
content- The YAML content- Returns:
- An instantiation of the object.
- Throws:
IOException- If an error occurs while reading the YAML.
-
load
Load an API object from a YAML file. Returns a concrete typed object (e.g. V1Pod)- Parameters:
f- The file to load.- Returns:
- An instantiation of the object.
- Throws:
IOException- If an error occurs while reading the YAML.
-
load
Load an API object from a stream of data. Returns a concrete typed object (e.g. V1Pod)- Parameters:
reader- The stream to load.- Returns:
- An instantiation of the object.
- Throws:
IOException- If an error occurs while reading the YAML.
-
loadAs
Load an API object from a YAML string representation. Returns a concrete typed object using the type specified.- Parameters:
content- The YAML contentclazz- The class of object to return.- Returns:
- An instantiation of the object.
- Throws:
IOException- If an error occurs while reading the YAML.
-
loadAs
Load an API object from a YAML file. Returns a concrete typed object using the type specified.- Parameters:
f- The YAML fileclazz- The class of object to return.- Returns:
- An instantiation of the object.
- Throws:
IOException- If an error occurs while reading the YAML.
-
loadAs
Load an API object from a YAML stream. Returns a concrete typed object using the type specified.- Parameters:
reader- The YAML streamclazz- The class of object to return.- Returns:
- An instantiation of the object.
- Throws:
IOException- If an error occurs while reading the YAML.
-
loadAll
Load list of instantiated API objects from a YAML string representation. Returns list of concrete typed objects (e.g. { V1Pod, V1SERVICE })Order of API objects in list will be preserved according to order of objects in YAML string.
- Parameters:
content- The YAML content- Returns:
- List of instantiated objects.
- Throws:
IOException- If an error occurs while reading the YAML.
-
loadAll
Load list of instantiated API objects from a YAML file. Returns list of concrete typed objects (e.g. { V1Pod, V1SERVICE })Order of API objects in list will be preserved according to order of objects in YAML file.
- Parameters:
f- The file to load.- Returns:
- List of instantiated of the objects.
- Throws:
IOException- If an error occurs while reading the YAML.
-
loadAll
Load list of instantiated API objects from a stream of data. Returns list of concrete typed objects (e.g. { V1Pod, V1SERVICE })Order of API objects in list will be preserved according to order of objects in stream of data.
- Parameters:
reader- The stream to load.- Returns:
- List of instantiated of the objects.
- Throws:
IOException- If an error occurs while reading the YAML.
-
dump
Takes an API object and returns a YAML String representing that object.- Parameters:
object- The API object to dump.- Returns:
- A YAML String representing the API object.
-
dump
Takes an API object and writes a YAML string representing that object to the writer.- Parameters:
object- The API object to dumpwriter- The writer to write the YAML to.
-
dumpAll
Takes an Iterator of YAML API objects and returns a YAML string representing all of them- Parameters:
data- The list of YAML API objects- Returns:
- A String representing the list of YAML API objects.
-
dumpAll
public static void dumpAll(Iterator<? extends io.kubernetes.client.common.KubernetesType> data, Writer output) Takes an Iterator of YAML API objects and writes a YAML String representing all of them.- Parameters:
data- The list of YAML API objects.output- The writer to output the YAML String to.
-
getSnakeYaml
Deprecated.Instantiate a snake yaml with a defaultSafeConstructor.DEPRECATED: Use the parameterized "getSnakeYaml" constructing method below to get rid of vulnerability from dynamic type serialization.
- Returns:
- the snake yaml
-
getSnakeYaml
public static org.yaml.snakeyaml.Yaml getSnakeYaml(Class<?> type, org.yaml.snakeyaml.TypeDescription... typeDescriptions) Instantiate a snake yaml with the target model type specified.. Optionally, passing custom type descriptions if the target serialized name differs from the actual field name.- Parameters:
type- the target model typetypeDescriptions- additional type descriptions for customizing the serializer- Returns:
- the new snake yaml instance
-
getSnakeYaml
public static org.yaml.snakeyaml.Yaml getSnakeYaml(Class<?> type, org.yaml.snakeyaml.DumperOptions dumperOptions, org.yaml.snakeyaml.LoaderOptions loaderOptions, org.yaml.snakeyaml.TypeDescription... typeDescriptions) Instantiate a snake yaml with the target model type, and the dump/load option specified.. Optionally, passing custom type descriptions if the target serialized name differs from the actual field name.- Parameters:
type- the target model typedumperOptions- the dumper optionsloaderOptions- the loader optionstypeDescriptions- additional type descriptions for customizing the serializer- Returns:
- the new snake yaml instance
-
newGsonCompatibleTypeDescription
public static org.yaml.snakeyaml.TypeDescription newGsonCompatibleTypeDescription(Class modelClass, String... gsonTaggedFields) Instantiate a newTypeDescriptionwhich will load theSerializedNamevia reflection so that yaml serialization can work for the custom gson serialized name.- Parameters:
modelClass- the kubenretes api model classgsonTaggedFields- the custom serialized names tagged by gson- Returns:
- the type description
-
addModelMap
Deprecated.
-