public class KubernetesUtils extends Object
Constructor and Description |
---|
KubernetesUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
copyFile(String source,
String destination)
Copy file from source to destination.
|
static void |
deleteDirectory(String path)
Deletes a given directory.
|
static String |
extractBalxName(String balxFilePath)
Extract the ballerina file name from a given file path
|
static Map<String,String> |
getMap(List<org.wso2.ballerinalang.compiler.tree.expressions.BLangRecordLiteral.BLangRecordKeyValue> keyValues)
Generate map by splitting keyValues.
|
static String |
getValidName(String name)
Returns valid kubernetes name.
|
static boolean |
isBlank(String str) |
static void |
printDebug(String msg)
Prints a debug message.
|
static void |
printError(String msg)
Prints an Error message.
|
static void |
printInstruction(String msg)
Prints an Instruction message.
|
static byte[] |
readFileContent(Path targetFilePath)
Read contents of a File.
|
static String |
resolveValue(String variable)
Resolve variable value from environment variable if $env{} is used.
|
static void |
writeToFile(String context,
String targetFilePath)
Write content to a File.
|
public static void writeToFile(String context, String targetFilePath) throws IOException
context
- context of the filetargetFilePath
- target file pathIOException
- If an error occurs when writing to a filepublic static byte[] readFileContent(Path targetFilePath) throws KubernetesPluginException
targetFilePath
- target file pathKubernetesPluginException
- If an error occurs when reading filepublic static void copyFile(String source, String destination) throws KubernetesPluginException
source
- source file pathdestination
- destination file pathKubernetesPluginException
public static String extractBalxName(String balxFilePath)
balxFilePath
- balx file path.public static void printError(String msg)
msg
- message to be printedpublic static void printDebug(String msg)
msg
- message to be printedpublic static void printInstruction(String msg)
msg
- message to be printedpublic static void deleteDirectory(String path) throws KubernetesPluginException
path
- path to directoryKubernetesPluginException
- if an error occurs while deletingpublic static boolean isBlank(String str)
public static String resolveValue(String variable) throws KubernetesPluginException
variable
- variable valueKubernetesPluginException
public static Map<String,String> getMap(List<org.wso2.ballerinalang.compiler.tree.expressions.BLangRecordLiteral.BLangRecordKeyValue> keyValues)
keyValues
- key value paris.Copyright © 2018 WSO2. All rights reserved.