
org.xlcloud.service.ReservedParameterName Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2012 AMG.lab, a Bull Group Company
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xlcloud.service;
import org.xlcloud.service.heat.template.commons.HeatTemplateValue;
import org.xlcloud.service.heat.template.commons.functions.Ref;
/**
* Enum that contains parameter names that have special purpose in the XLcloud system.
*
* @author Tomek Adamczewski, AMG.net
* @author Konrad Król, AMG.net
* @author Krzysztof Szafrański, AMG.net
*/
public enum ReservedParameterName {
DEFAULT_INSTANCE_TYPE_PARAM_NAME("xlcloud:defaultInstanceType", new Ref("xlcloud:defaultInstanceType")),
DEFAULT_IMAGE_ID_PARAM_NAME("xlcloud:defaultImageId", new Ref("xlcloud:defaultImageId")),
DEFAULT_KEY_NAME_PARAM_NAME("xlcloud:defaultKeyName", new Ref("xlcloud:defaultKeyName")),
LAYER_SUBNET_UUID("xlcloud:layerSubnetUuid", null),
PUBLIC_NETWORK_UUID("xlcloud:public_network_uuid", null),
RESERVATION_ID("xlcloud:reservationId", null),
BROKER_IP("xlcloud:brokerAddress", new Ref("xlcloud:brokerAddress")),
BROKER_PORT("xlcloud:brokerPort", new Ref("xlcloud:brokerPort")),
BROKER_USERNAME("xlcloud:brokerUsername", new Ref("xlcloud:brokerUsername")),
BROKER_PASSWORD("xlcloud:brokerPassword", new Ref("xlcloud:brokerPassword")),
XMS_ADDRESS("xlcloud:xmsAddress", new Ref("xlcloud:xmsAddress")),
STACK_SECRET("xlcloud:stackSecret", new Ref("xlcloud:stackSecret")),
STACK_ID("xlcloud:stackId", new Ref("AWS::StackId"));
private final String paramName;
private final HeatTemplateValue defaultValue;
public static final String RUNLIST_CUSTOM_SUFFIX = "_custom";
public static final String RUNLIST_DEFAULT_SUFFIX = "_default";
public static final String RUNLIST_SUFFIX_REGEXP = "("+RUNLIST_CUSTOM_SUFFIX+"|"+RUNLIST_DEFAULT_SUFFIX+")";
/**
* @param paramName
* - name of the parameter or regular expression
* @param useAsRegexp
* - it indicates whether parameter name should be used as simple string or regexp
*/
private ReservedParameterName( String paramName, HeatTemplateValue defaultValue ) {
this.paramName = paramName;
this.defaultValue = defaultValue;
}
/**
* @return parameter name
*/
public String paramName() {
return paramName;
}
public HeatTemplateValue defaultValue() {
return defaultValue;
}
public static ReservedParameterName fromName(String name) {
for (ReservedParameterName param : values()) {
if (name.equals(param.paramName())) {
return param;
}
}
return null;
}
/**
* Indicates whether given name is reserved.
* @param name
* - parameter name to be verified
* @return {code true} if the given name is reserved, {@code false} otherwise
*/
public static boolean isReservedName(String name) {
return fromName(name) != null;
}
/**
* Indicates whether given name is not reserved.
* @param name
* - parameter name to be verified
* @return {code true} if the given name is not reserved, {@code false} otherwise
*/
public static boolean isNotReservedName(String name) {
return !isReservedName(name);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy