Search in sources :

Example 11 with PropertyMetadata

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();
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata)

Example 12 with PropertyMetadata

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);
    }
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata)

Example 13 with PropertyMetadata

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;
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata) TreeMap(java.util.TreeMap)

Example 14 with PropertyMetadata

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;
}
Also used : PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata)

Example 15 with PropertyMetadata

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);
}
Also used : PropertyInfoRestRep(com.emc.storageos.model.property.PropertyInfoRestRep) PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

PropertyMetadata (com.emc.storageos.model.property.PropertyMetadata)19 Map (java.util.Map)7 PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)2 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 ArrayList (java.util.ArrayList)2 TreeMap (java.util.TreeMap)2 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)1 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1 PropertyInfoRestRep (com.emc.storageos.model.property.PropertyInfoRestRep)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 BadRequestException (com.emc.storageos.svcs.errorhandling.resources.BadRequestException)1 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)1 InvalidLockOwnerException (com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException)1 SyssvcException (com.emc.storageos.systemservices.exceptions.SyssvcException)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 HashMap (java.util.HashMap)1 Property (models.properties.Property)1