use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.
the class SshConfigurator method getDefaultVersion.
private String getDefaultVersion() {
Map<String, PropertyMetadata> metadata = PropertiesMetadata.getGlobalMetadata();
PropertyMetadata prop = metadata.get(SSH_CONFIG_VERSION);
return prop.getDefaultValue();
}
use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.
the class PropertiesConfigurationValidator method getValidPropValue.
/**
* Validate the property using the properties metadata, for property
* resetting or updating.
*
* @param propertyName
* @param propertyValue
* @param userMutated
* @return
*/
public String getValidPropValue(String propertyName, String propertyValue, boolean userMutated, boolean bReset) {
Map<String, PropertyMetadata> metadataMap = getMetaData();
PropertyMetadata metaData = metadataMap.get(propertyName);
if (metaData == null) {
throw APIException.badRequests.propertyIsNotValid(propertyName);
}
// allowed for that property.
if (userMutated) {
if (metaData.getUserMutable() != null ? metaData.getUserMutable() : false) {
return validateProperty(propertyName, propertyValue, metaData, bReset);
} else {
throw APIException.badRequests.changePropertyIsNotAllowed(propertyName);
}
} else {
return validateProperty(propertyName, propertyValue, metaData, bReset);
}
}
use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.
the class PasswordServiceTest method getPropsMetaData.
public Map<String, PropertyMetadata> getPropsMetaData() {
Map<String, PropertyMetadata> metadata = new TreeMap();
PropertyMetadata proxyuser_metadata = setPropMetaData("Encrypted password for the 'proxyuser' account", "Encrypted (SHA-512) password for the local 'proxyuser' account.", "encryptedstring", 255, "Security", true, true, false, true, false, "", true);
PropertyMetadata sysmonitor_metadata = setPropMetaData("Encrypted password for the 'sysmonitor' account", "Encrypted password for the 'sysmonitor' account.", "string", 255, "Security", true, true, false, true, false, "$6$BIu9aQ6$wBnn9Tn.CUuuoi/JZe.oAOmUDIVCqHpXeem7ZHO5R7dPg2hul8tNCBzwumKrFw8A0qm.LH8YvMJUaN2AL1JVc0", true);
PropertyMetadata root_metadata = setPropMetaData("Encrypted password for the 'root' account", "Encrypted (SHA-512) password for the local 'root' account.", "string", 255, "Security", true, true, false, true, false, "$6$eBIu9aQ6$wBnn9Tn.CUuuoi/JZe.oAOmUDIVCqHpXeem7ZHO5R7dPg2hul8tNCBzwumKrFw8A0qm.LH8YvMJUaN2AL1JVc0", false);
PropertyMetadata svcuser_metadata = setPropMetaData("Encrypted password for the 'svcuser' account", "Encrypted (SHA-512) password for the local 'svcuser' account.", "string", 255, "Security", true, true, false, true, false, "$6$eBIu9aQ6$wBnn9Tn.CUuuoi/JZe.oAOmUDIVCqHpXeem7ZHO5R7dPg2hul8tNCBzwumKrFw8A0qm.LH8YvMJUaN2AL1JVc0", false);
metadata.put("system_proxyuser_encpassword", proxyuser_metadata);
metadata.put("system_sysmonitor_encpassword", sysmonitor_metadata);
metadata.put("system_root_encpassword", root_metadata);
metadata.put("system_svcuser_encpassword", svcuser_metadata);
return metadata;
}
use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.
the class LocalPasswordHandlerTestBase method setPropMetaData.
public PropertyMetadata setPropMetaData(String label, String description, String type, int maxLen, String tag, Boolean advanced, Boolean userMutable, Boolean userConfigurable, Boolean reconfigRequired, Boolean rebootRequired, String value, Boolean controlNodeOnly) {
PropertyMetadata metaData = new PropertyMetadata();
metaData.setLabel(label);
metaData.setDescription(description);
metaData.setType(type);
metaData.setMaxLen(maxLen);
metaData.setTag(tag);
metaData.setAdvanced(advanced);
metaData.setUserMutable(userMutable);
metaData.setUserConfigurable(userConfigurable);
metaData.setReconfigRequired(reconfigRequired);
metaData.setRebootRequired(rebootRequired);
metaData.setValue(value);
metaData.setControlNodeOnly(controlNodeOnly);
return metaData;
}
use of com.emc.storageos.model.property.PropertyMetadata in project coprhd-controller by CoprHD.
the class ConfigService method resetProps.
/**
* Reset configuration properties to their default values. Properties with
* no default values will remain unchanged
*
* @brief Reset system properties
* @param propertyList property list
* @prereq Cluster state should be STABLE
* @return Cluster information
*/
@POST
@Path("properties/reset/")
@CheckPermission(roles = { Role.SECURITY_ADMIN, Role.RESTRICTED_SECURITY_ADMIN })
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response resetProps(PropertyList propertyList, @QueryParam("removeObsolete") String forceRemove) throws Exception {
// get metadata
Map<String, PropertyMetadata> metadata = PropertiesMetadata.getGlobalMetadata();
// get target property set
PropertyInfoRestRep targetPropInfo = getTargetPropsCommon();
// get reset property set
PropertyInfoRestRep resetProps = getResetProps(propertyList, targetPropInfo.getAllProperties(), metadata);
// get obsolete property set
List<String> obsoleteProps = isSet(forceRemove) ? getObsoleteProps(targetPropInfo.getAllProperties(), metadata) : null;
// update properties with default value
return updatePropertiesCommon(resetProps, obsoleteProps);
}
Aggregations