public function addDatabase($site, $db, $cluster_map = NULL)
{
$variables = array('site' => $site);
$options = array();
if (is_array($cluster_map) && !empty($cluster_map)) {
foreach ($cluster_map as $env => $db_cluster) {
if (is_string($env) && !empty($env) && intval($db_cluster) > 0) {
$options[$env] = array('db_cluster' => (string) $db_cluster);
}
}
}
$body = array('db' => $db);
if (count($options) > 0) {
$body['options'] = $options;
}
$body = Json::encode($body);
$request = $this->post(array('{+base_path}/sites/{site}/dbs.json', $variables), null, $body);
return new Response\Task($request);
}