public class KubernetesResourceUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
API_EXTENSIONS_VERSION |
static String |
API_VERSION |
| Constructor and Description |
|---|
KubernetesResourceUtil() |
| Modifier and Type | Method and Description |
|---|---|
static io.fabric8.kubernetes.api.model.HasMetadata |
getKubernetesResource(String defaultApiVersion,
String apiExtensionsVersion,
File file)
Read a Kubernetes resource fragment and add meta information extracted from the filename
to the resource descriptor.
|
static String |
getNameWithSuffix(String name,
String kind) |
static File[] |
listResourceFragments(File resourceDir) |
static io.fabric8.kubernetes.api.model.KubernetesListBuilder |
readResourceFragmentsFrom(String apiVersion,
String apiExtensionsVersion,
File[] resourceFiles)
Read all Kubernetes resource fragments from a directory and create a
KubernetesListBuilder which
can be adapted later. |
static String |
toJson(Object resource) |
static String |
toYaml(Object resource) |
static File |
writeResource(Object resource,
File target,
ResourceFileType resourceFileType) |
public static final String API_VERSION
public static final String API_EXTENSIONS_VERSION
public static io.fabric8.kubernetes.api.model.KubernetesListBuilder readResourceFragmentsFrom(String apiVersion, String apiExtensionsVersion, File[] resourceFiles) throws IOException
KubernetesListBuilder which
can be adapted later.apiVersion - the api version to useresourceFiles - files to add.IOExceptionpublic static io.fabric8.kubernetes.api.model.HasMetadata getKubernetesResource(String defaultApiVersion, String apiExtensionsVersion, File file) throws IOException
defaultApiVersion - the API version to add if not given.apiExtensionsVersion - the API version for extensionsfile - file to read, whose name must match FILENAME_PATTERN. @return map holding the fragmentIOExceptionpublic static String toYaml(Object resource) throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingExceptionpublic static String toJson(Object resource) throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingExceptionpublic static File writeResource(Object resource, File target, ResourceFileType resourceFileType) throws IOException
IOExceptionCopyright © 2016. All rights reserved.