/** * Unmarshals a stream. * @param is The {@link InputStream}. * @param <T> The target type. * @return * @throws KubernetesClientException */ public static <T> T unmarshal(InputStream is) throws KubernetesClientException { return unmarshal(is, JSON_MAPPER); }
private static boolean containsMultipleDocuments(String specFile) { String[] documents = splitSpecFile(specFile); int nValidDocuments = 0; for(String document : documents) { if(validate(document)) nValidDocuments++; } return nValidDocuments > 1; }
/** * Returns true if this entity has a valid non blank resourceVersion in its metadata */ public static boolean hasResourceVersion(HasMetadata entity) { return getResourceVersion(entity) != null; }
public static boolean isNotNullOrEmpty(String str) { return !isNullOrEmpty(str); }
public static String getSystemPropertyOrEnvVar(String systemPropertyName, String defaultValue) { return getSystemPropertyOrEnvVar(systemPropertyName, convertSystemPropertyNameToEnvVar(systemPropertyName), defaultValue); }
public static String getSystemPropertyOrEnvVar(String systemPropertyName) { return getSystemPropertyOrEnvVar(systemPropertyName, (String) null); }
public BaseClient(final Config config) throws KubernetesClientException { this(HttpClientUtils.createHttpClient(config), config); }
/** * Returns Qualified name for the specified Kubernetes Resource * * @param entity Kubernetes resource * @return */ public static String getQualifiedName(HasMetadata entity) { if (entity != null) { return "" + getNamespace(entity) + "/" + getName(entity); } else { return null; } }
public void waitUntilReady() { Utils.waitUntilReady(queue, 10, TimeUnit.SECONDS); }
/** * Returns a stream with the template parameter expressions replaced */ public static InputStream replaceValues(InputStream is, Map<String, String> valuesMap) { return new ReplaceValueStream(valuesMap).createInputStream(is); }
public static String getProperty(Map<String, Object> properties, String propertyName) { return getProperty(properties, propertyName, null); } }
public static String resolvePortFromEnvVarOrSystemProperty(String serviceName, String portName) { String envVarName = toServicePortEnvironmentVariable(serviceName, portName); return getEnvVarOrSystemProperty(envVarName, ""); }
public static String join(final Object[] array) { return join(array, ','); }
public static String resolveHostFromEnvVarOrSystemProperty(String serviceName) { return getEnvVarOrSystemProperty(toServiceHostEnvironmentVariable(serviceName), ""); }
public static String resolveProtocolFromEnvVarOrSystemProperty(String serviceName, String servicePort) { return getEnvVarOrSystemProperty(toEnvVariable(serviceName + PORT_SUFFIX + "_" + servicePort + PROTO_SUFFIX), DEFAULT_PROTO); }
private static String toServiceHostEnvironmentVariable(String serviceName) { return toEnvVariable(serviceName + HOST_SUFFIX); }
if (Utils.isNullOrEmpty(portName) || portName.endsWith(port.getName())) { for (EndpointAddress address : subset.getAddresses()) {
protected static <T> T unmarshal(InputStream is, TypeReference<T> type) throws KubernetesClientException { return Serialization.unmarshal(is, type); }
protected static <T> T unmarshal(InputStream is) throws KubernetesClientException { return Serialization.unmarshal(is); }
protected static <T> T unmarshal(InputStream is, final Class<T> type) throws KubernetesClientException { return Serialization.unmarshal(is, type); }