use of com.amazonaws.services.rds.model.ModifyDBParameterGroupRequest in project Synapse-Stack-Builder by Sage-Bionetworks.
the class DatabaseParameterGroup method setValueIfNeeded.
/**
* Set the value of the given parameter if it does not already have the passed value.
*
* @param client
* @param map
* @param key
* @param value
* @return true if changed.
*/
boolean setValueIfNeeded(String paramGroupName, Map<String, Parameter> map, String key, String value) {
// Check the slow query log value
Parameter param = map.get(key);
if (param == null)
throw new IllegalStateException("Cannot find the expected DB parameter: " + key);
// Do we need to change it?
if (!value.equals(param.getParameterValue())) {
// We need to change the value.
ModifyDBParameterGroupRequest modifyRequest = new ModifyDBParameterGroupRequest();
modifyRequest.setDBParameterGroupName(paramGroupName);
List<Parameter> list = new LinkedList<Parameter>();
list.add(param);
param.setParameterValue(value);
param.setApplyMethod(ApplyMethod.Immediate);
modifyRequest.setParameters(list);
client.modifyDBParameterGroup(modifyRequest);
return true;
}
return false;
}
Aggregations