Skip to content

Commit

Permalink
doc: add YAML serialization example in the cheatsheet
Browse files Browse the repository at this point in the history
closes #2363
  • Loading branch information
Decat-SimonA committed Aug 17, 2020
1 parent e8c47dc commit b983991
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/CHEATSHEET.md
Expand Up @@ -34,6 +34,7 @@ This document contains common usages of different resources using Fabric8 Kubern
* [List Options](#list-options)
* [Delete Options](#delete-options)
* [Watch Options](#watch-options)
* [Serializing to yaml](#serializing-to-yaml)

* [OpenShift Client DSL Usage](#openshift-client-dsl-usage)
* [Initializing OpenShift Client](#initializing-openshift-client)
Expand Down Expand Up @@ -2173,6 +2174,16 @@ client.pods().watch(new ListOptionsBuilder().withTimeoutSeconds(30L).build(), ne
});
```

#### Serializing to yaml
Resources can be exported to a yaml String via the `SerializationUtils` class:
```
Pod myPod;
String myPodAsYaml = SerializationUtils.dumpAsYaml(myPod);
// Your pod might have some state that you don't really care about, to remove it:
String myPodAsYamlWithoutRuntimeState = dumpWithoutRuntimeStateAsYaml(myPod);
```

### OpenShift Client DSL Usage

Fabric8 Kubernetes Client also has an extension for OpenShift. It is pretty much the same as Kubernetes Client but has support for some additional OpenShift resources.
Expand Down

0 comments on commit b983991

Please sign in to comment.