}
@Override
public void configure(BaseCloudAdapterConfig configuration)
throws ScalingGroupException {
ScalingGroupConfig scalingGroupConfig = configuration.getScalingGroup();
checkArgument(scalingGroupConfig != null, "missing scalingGroup config");
try {
// validate against client config schema
JsonValidator.validate(CONFIG_SCHEMA,
scalingGroupConfig.getConfig());
// parse and validate cloud login configuration
OpenStackScalingGroupConfig config = JsonUtils.toObject(
scalingGroupConfig.getConfig(),
OpenStackScalingGroupConfig.class);
config.validate();
this.config.set(config);
this.scalingGroupName.set(scalingGroupConfig.getName());
this.client.configure(config);
} catch (Exception e) {
Throwables.propagateIfInstanceOf(e, ScalingGroupException.class);
throw new ScalingGroupException(String.format(
"failed to apply configuration: %s", e.getMessage()), e);