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

com.jelastic.api.data.DockerTemplateLabel Maven / Gradle / Ivy

The newest version!
/*Server class MD5: 329c6be029f40dbbb000b50b69ca44c2*/
package com.jelastic.api.data;

import com.jelastic.api.system.service.utils.NodeUtils;
import java.util.*;

/**
 * @name Jelastic API Client
 * @version 8.11.2
 * @copyright Jelastic, Inc.
 */
public enum DockerTemplateLabel {

    NODE_TYPE("nodeType", false),
    NODE_MISSION("nodeMission", false),
    NAME("name", false),
    VERSION("version", false),
    SOURCE_URL("sourceUrl", false),
    CONTEXT_REGEXP("contextRegex", false),
    APP_USER("appUser", false, new HashSet<>(Arrays.asList("user")), "root"),
    ADMIN_USER("adminUser", false, String.class, "root"),
    ADMIN_URL("adminUrl", false),
    ADMIN_URLS("adminUrls", false),
    ENGINE_TYPE("engineType", false, new String[] { NodeUtils.NODE_MISSION_COMPUTE }, new boolean[] { true }),
    ENGINE_NAME("engineName", false),
    ENGINE_GROUP_ID("engineGroupId", false),
    SINGLE_CONTEXT("singleContext", false, Boolean.class),
    JEM("jem", false, Boolean.class, Boolean.FALSE),
    DESCRIPTION("description", false),
    LOG_FOLDER("logFolder", false, String.class, "/var/log"),
    LOG_FOLDER_USER("logFolderUser", false, String.class, "root"),
    RESTART_ON_EXT_IP_CHANGE("restartOnExtIpChange", false, Boolean.class, Boolean.TRUE),
    COMPATIBLE_VERSIONS("compatibleVersions", false),
    LAST_COMPATIBLE_VERSION("lastCompatibleVersion", false),
    COMPATIBLE_VZ_TYPES("compatibleVzTypes", false),
    EMAIL_TEMPLATE("emailTemplate", false),
    EMAIL_TEMPLATE_RESET_PASSWORD("emailTemplateResetPassword", false, new HashSet<>(Arrays.asList("emailTemplateResetPwd", "emailTemplateResetServicePwd")), String.class),
    SUB_DOMAIN("subDomain", false),
    PORT("port", false, Integer.class, 80),
    EXT_IP_REQUIRED("extIpRequired", false, new HashSet<>(Arrays.asList("extIp")), Boolean.class, Boolean.FALSE),
    CUSTOM_ACTIONS("customActions", false, new HashSet<>(Arrays.asList("actions")), String.class),
    HIGH_AVAILABILITY("highAvailability", false, new HashSet<>(Arrays.asList("ha")), Boolean.class, Boolean.FALSE),
    WEB_ACCESS("webAccess", false, new HashSet<>(Arrays.asList("web")), Boolean.class, Boolean.FALSE),
    CLUSTER_ENABLED("clusterEnabled", false, new HashSet<>(Arrays.asList("cluster")), Boolean.class, Boolean.FALSE),
    CUSTOM_SSL("customSSL", false, new HashSet<>(Arrays.asList("ssl", "isCustomSslSupport")), Boolean.class, Boolean.FALSE),
    RESET_PASSWORD("resetPassword", false, new HashSet<>(Arrays.asList("resetPswd")), Boolean.class, Boolean.FALSE),
    VCS_SUPPORT("isVcsSupport", false, new HashSet<>(Arrays.asList("vcs")), Boolean.class, Boolean.FALSE),
    CAN_BE_EXPORTED("canBeExported", false, new HashSet<>(Arrays.asList("export")), Boolean.class, Boolean.FALSE),
    NODE_TYPE_ALIAS("nodeTypeAlias", false),
    NODE_VERSION("nodeVersion", false, String.class, "0"),
    ENGINE_VERSION("engineVersion", false),
    ENGINE("engine", false),
    CLOUDLETS_MIN_COUNT("cloudletsMinCount", false, Integer.class),
    CLOUDLETS_COUNT("cloudletsCount", false, Integer.class),
    SCALING_MODE("scalingMode", false, String.class),
    OS_TEMPLATE("osTemplate", false, String.class),
    DISTRO_TEMPLATE("distroTemplate", false, String.class),
    SKIP_DEFAULT("skipDefault", false, Boolean.class, Boolean.FALSE),
    CLUSTER("cluster", false, String.class),
    IS_DOWNGRADABLE("isDowngradable", false, Boolean.class, Boolean.TRUE);

    private String name;

    private Set aliases = new HashSet<>();

    private boolean requiredDefault;

    private Map requiredsByNodeMission = new HashMap();

    private Class clazz = String.class;

    private Object defaultValue = null;

    private DockerTemplateLabel(String name, boolean requiredDefault, String[] nodeMissions, boolean[] requires) {
        this(name, requiredDefault);
        for (int i = 0; i < nodeMissions.length; i++) {
            this.requiredsByNodeMission.put(nodeMissions[i], requires[i]);
        }
    }

    private DockerTemplateLabel(String name, boolean requiredDefault) {
        this.name = name;
        this.requiredDefault = requiredDefault;
    }

    private DockerTemplateLabel(String name, boolean requiredDefault, Class clazz) {
        this.name = name;
        this.requiredDefault = requiredDefault;
        this.clazz = clazz;
    }

    private DockerTemplateLabel(String name, boolean requiredDefault, Class clazz, Object defaultValue) {
        this.name = name;
        this.requiredDefault = requiredDefault;
        this.clazz = clazz;
        this.defaultValue = defaultValue;
    }

    private DockerTemplateLabel(String name, boolean requiredDefault, Set aliases, Class clazz) {
        this.name = name;
        this.requiredDefault = requiredDefault;
        this.aliases = aliases;
        this.clazz = clazz;
    }

    private DockerTemplateLabel(String name, boolean requiredDefault, Set aliases, Class clazz, Object defaultValue) {
        this.name = name;
        this.requiredDefault = requiredDefault;
        this.aliases = aliases;
        this.clazz = clazz;
        this.defaultValue = defaultValue;
    }

    private DockerTemplateLabel(String name, boolean requiredDefault, Set aliases, Object defaultValue) {
        this.name = name;
        this.requiredDefault = requiredDefault;
        this.aliases = aliases;
        this.defaultValue = defaultValue;
    }

    public String getName() {
        return name;
    }

    public Object getDefaultValue() {
        return defaultValue;
    }

    @Override
    public String toString() {
        return name;
    }

    public static DockerTemplateLabel parse(String name) {
        for (DockerTemplateLabel cartridgeProperty : DockerTemplateLabel.values()) {
            if (cartridgeProperty.toString().equalsIgnoreCase(name)) {
                return cartridgeProperty;
            }
        }
        throw new IllegalArgumentException("Can't parse '" + name + "' to " + DockerTemplateLabel.class.getName());
    }

    public boolean isRequired(String nodeMission) {
        Boolean required = requiredsByNodeMission.get(nodeMission);
        return required != null ? required : this.requiredDefault;
    }

    public Set getAliases() {
        return aliases;
    }

    public Set getAllNames() {
        Set allNames = new HashSet<>(aliases);
        allNames.add(name);
        return allNames;
    }

    public Class getClazz() {
        return clazz;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy