Skip to content

Commit

Permalink
Add Cat and a few other new 1.0 endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
polyfractal committed Jan 21, 2014
1 parent e36b6df commit 73b72b0
Show file tree
Hide file tree
Showing 21 changed files with 1,524 additions and 0 deletions.
83 changes: 83 additions & 0 deletions src/Elasticsearch/Endpoints/Cat/Aliases.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
/**
* User: zach
* Date: 01/20/2014
* Time: 14:34:49 pm
*/

namespace Elasticsearch\Endpoints\Cat;

use Elasticsearch\Endpoints\AbstractEndpoint;
use Elasticsearch\Common\Exceptions;

/**
* Class Aliases
*
* @category Elasticsearch
* @package Elasticsearch\Endpoints\Cat
* @author Zachary Tong <[email protected]>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
* @link http://elasticsearch.org
*/

class Aliases extends AbstractEndpoint
{
// A comma-separated list of alias names to return
private $name;


/**
* @param $name
*
* @return $this
*/
public function setName($name)
{
if (isset($name) !== true) {
return $this;
}

$this->name = $name;
return $this;
}


/**
* @return string
*/
protected function getURI()
{
$name = $this->name;
$uri = "/_cat/aliases";

if (isset($name) === true) {
$uri = "/_cat/aliases/$name";
}

return $uri;
}


/**
* @return string[]
*/
protected function getParamWhitelist()
{
return array(
'local',
'master_timeout',
'h',
'help',
'v',
);
}


/**
* @return string
*/
protected function getMethod()
{
return 'GET';
}
}
84 changes: 84 additions & 0 deletions src/Elasticsearch/Endpoints/Cat/Allocation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php
/**
* User: zach
* Date: 01/20/2014
* Time: 14:34:49 pm
*/

namespace Elasticsearch\Endpoints\Cat;

use Elasticsearch\Endpoints\AbstractEndpoint;
use Elasticsearch\Common\Exceptions;

/**
* Class Allocation
*
* @category Elasticsearch
* @package Elasticsearch\Endpoints\Cat
* @author Zachary Tong <[email protected]>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
* @link http://elasticsearch.org
*/

class Allocation extends AbstractEndpoint
{
// A comma-separated list of node IDs or names to limit the returned information
private $node_id;


/**
* @param $node_id
*
* @return $this
*/
public function setNode_Id($node_id)
{
if (isset($node_id) !== true) {
return $this;
}

$this->node_id = $node_id;
return $this;
}


/**
* @return string
*/
protected function getURI()
{
$node_id = $this->node_id;
$uri = "/_cat/allocation";

if (isset($node_id) === true) {
$uri = "/_cat/allocation/$node_id";
}

return $uri;
}


/**
* @return string[]
*/
protected function getParamWhitelist()
{
return array(
'bytes',
'local',
'master_timeout',
'h',
'help',
'v',
);
}


/**
* @return string
*/
protected function getMethod()
{
return 'GET';
}
}
63 changes: 63 additions & 0 deletions src/Elasticsearch/Endpoints/Cat/Count.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**
* User: zach
* Date: 01/20/2014
* Time: 14:34:49 pm
*/

namespace Elasticsearch\Endpoints\Cat;

use Elasticsearch\Endpoints\AbstractEndpoint;
use Elasticsearch\Common\Exceptions;

/**
* Class Count
*
* @category Elasticsearch
* @package Elasticsearch\Endpoints\Cat
* @author Zachary Tong <[email protected]>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
* @link http://elasticsearch.org
*/

class Count extends AbstractEndpoint
{
/**
* @return string
*/
protected function getURI()
{
$index = $this->index;
$uri = "/_cat/count";

if (isset($index) === true) {
$uri = "/_cat/count/$index";
}

return $uri;
}


/**
* @return string[]
*/
protected function getParamWhitelist()
{
return array(
'local',
'master_timeout',
'h',
'help',
'v',
);
}


/**
* @return string
*/
protected function getMethod()
{
return 'GET';
}
}
60 changes: 60 additions & 0 deletions src/Elasticsearch/Endpoints/Cat/Health.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* User: zach
* Date: 01/20/2014
* Time: 14:34:49 pm
*/

namespace Elasticsearch\Endpoints\Cat;

use Elasticsearch\Endpoints\AbstractEndpoint;
use Elasticsearch\Common\Exceptions;

/**
* Class Health
*
* @category Elasticsearch
* @package Elasticsearch\Endpoints\Cat
* @author Zachary Tong <[email protected]>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
* @link http://elasticsearch.org
*/

class Health extends AbstractEndpoint
{
/**
* @return string
*/
protected function getURI()
{
$uri = "/_cat/health";


return $uri;
}


/**
* @return string[]
*/
protected function getParamWhitelist()
{
return array(
'local',
'master_timeout',
'h',
'help',
'ts',
'v',
);
}


/**
* @return string
*/
protected function getMethod()
{
return 'GET';
}
}
55 changes: 55 additions & 0 deletions src/Elasticsearch/Endpoints/Cat/Help.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* User: zach
* Date: 01/20/2014
* Time: 14:34:49 pm
*/

namespace Elasticsearch\Endpoints\Cat;

use Elasticsearch\Endpoints\AbstractEndpoint;
use Elasticsearch\Common\Exceptions;

/**
* Class Help
*
* @category Elasticsearch
* @package Elasticsearch\Endpoints\Cat
* @author Zachary Tong <[email protected]>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
* @link http://elasticsearch.org
*/

class Help extends AbstractEndpoint
{
/**
* @return string
*/
protected function getURI()
{
$uri = "/_cat";


return $uri;
}


/**
* @return string[]
*/
protected function getParamWhitelist()
{
return array(
'help',
);
}


/**
* @return string
*/
protected function getMethod()
{
return 'GET';
}
}
Loading

0 comments on commit 73b72b0

Please sign in to comment.