All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.dekorate.minikube.adapter.MinikubeConfigAdapter Maven / Gradle / Ivy

There is a newer version: 4.1.4
Show newest version
package io.dekorate.minikube.adapter;

import io.dekorate.kubernetes.config.AzureDiskVolume;
import io.dekorate.kubernetes.config.PersistentVolumeClaimVolume;
import io.dekorate.kubernetes.config.Port;
import io.dekorate.kubernetes.config.Label;
import io.dekorate.kubernetes.config.Mount;
import java.lang.String;
import io.dekorate.kubernetes.config.Env;
import io.dekorate.kubernetes.config.Probe;
import io.dekorate.kubernetes.config.ResourceRequirements;
import io.dekorate.kubernetes.config.Item;
import io.dekorate.kubernetes.config.Container;
import io.dekorate.kubernetes.annotation.CronJobConcurrencyPolicy;
import io.dekorate.kubernetes.annotation.ServiceType;
import io.dekorate.kubernetes.config.EmptyDirVolume;
import java.util.List;
import io.dekorate.kubernetes.annotation.JobRestartPolicy;
import io.dekorate.kubernetes.annotation.Protocol;
import io.dekorate.kubernetes.config.Job;
import java.lang.Boolean;
import io.dekorate.kubernetes.config.AwsElasticBlockStoreVolume;
import java.util.stream.Collectors;
import io.dekorate.kubernetes.config.ConfigMapVolume;
import io.dekorate.kubernetes.config.SecretVolume;
import io.dekorate.kubernetes.annotation.JobCompletionMode;
import io.dekorate.minikube.config.MinikubeConfigBuilder;
import io.dekorate.kubernetes.config.Annotation;
import io.dekorate.kubernetes.config.AzureFileVolume;
import io.dekorate.kubernetes.config.HostAlias;
import io.dekorate.project.Project;
import io.dekorate.minikube.annotation.Minikube;
import io.dekorate.kubernetes.annotation.ImagePullPolicy;
import io.dekorate.kubernetes.config.CronJob;
import io.dekorate.project.BuildInfo;
import java.lang.Object;
import io.dekorate.project.ScmInfo;
import java.util.Arrays;
import io.dekorate.minikube.config.MinikubeConfig;
import java.util.Map;
import io.dekorate.kubernetes.config.GitRepoVolume;

 /**
  * Generated
  */
public class MinikubeConfigAdapter{
  public static MinikubeConfig adapt(Minikube instance) {
    return newBuilder(instance).build();
  }
  public static MinikubeConfigBuilder newBuilder(Minikube instance) {
    return new MinikubeConfigBuilder(new MinikubeConfig(null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            Arrays.asList(instance.ports()).stream().map(i ->new Port(i.name(),
            i.containerPort(),
            i.hostPort(),
            i.nodePort(),
            i.path(),
            i.protocol())).collect(Collectors.toList()).toArray(new Port[0]),
            instance.serviceType(),
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null));
  }
  public static MinikubeConfig adapt(Map map) {
    return new MinikubeConfig(
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
               Arrays.stream((Map[])(map instanceof Map ? ((Map)map).getOrDefault("ports" , new Map[0]) : new Map[0])).map(i ->new Port(
               (String)(i instanceof Map ? ((Map)i).getOrDefault("name", null) : null),
               (java.lang.Integer)(i instanceof Map ? ((Map)i).getOrDefault("containerPort", null) : null),
               (java.lang.Integer)(i instanceof Map ? ((Map)i).getOrDefault("hostPort", 0) : 0),
               (java.lang.Integer)(i instanceof Map ? ((Map)i).getOrDefault("nodePort", 0) : 0),
               (String)(i instanceof Map ? ((Map)i).getOrDefault("path", "/") : "/"),
               io.dekorate.kubernetes.annotation.Protocol.valueOf(String.valueOf(i instanceof Map ? ((Map)i).getOrDefault("protocol","TCP") : "TCP")))).toArray(size-> new Port[size]),
               (ServiceType)(map instanceof Map ? ( ((Map)map).getOrDefault("serviceType", null) != null ? io.dekorate.kubernetes.annotation.ServiceType.valueOf(String.valueOf(((Map)map).getOrDefault("serviceType", null))) : null ) : null),
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null);
  }
  public static MinikubeConfigBuilder newBuilder(Map map) {
    return new MinikubeConfigBuilder(new MinikubeConfig(
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
               Arrays.stream((Map[])(map instanceof Map ? ((Map)map).getOrDefault("ports" , new Map[0]) : new Map[0])).map(i ->new Port(
               (String)(i instanceof Map ? ((Map)i).getOrDefault("name", null) : null),
               (java.lang.Integer)(i instanceof Map ? ((Map)i).getOrDefault("containerPort", null) : null),
               (java.lang.Integer)(i instanceof Map ? ((Map)i).getOrDefault("hostPort", 0) : 0),
               (java.lang.Integer)(i instanceof Map ? ((Map)i).getOrDefault("nodePort", 0) : 0),
               (String)(i instanceof Map ? ((Map)i).getOrDefault("path", "/") : "/"),
               io.dekorate.kubernetes.annotation.Protocol.valueOf(String.valueOf(i instanceof Map ? ((Map)i).getOrDefault("protocol","TCP") : "TCP")))).toArray(size-> new Port[size]),
               (ServiceType)(map instanceof Map ? ( ((Map)map).getOrDefault("serviceType", null) != null ? io.dekorate.kubernetes.annotation.ServiceType.valueOf(String.valueOf(((Map)map).getOrDefault("serviceType", null))) : null ) : null),
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null));
  }
  public static String[] toStringArray(Object o) {
            if (o instanceof String[]) {
          return (String[]) o;
        }
        if (o instanceof String) {
          String s =  (String) o;
          return s.split(",[ ]*");
        }
        else if (o instanceof List) {
          List c = (List) o;
          String[] result = new String[c.size()]; 
          for (int i=0; i <= c.size(); i++) {
            result[i] = String.valueOf(c.get(i));
          }
          return result;
        }
        return new String[0];
    

  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy