* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 * @link http://elastic.co */ class Create extends AbstractEndpoint { // A repository name private $repository; /** * @param array $body * * @throws \Elasticsearch\Common\Exceptions\InvalidArgumentException * @return $this */ public function setBody($body) { if (isset($body) !== true) { return $this; } $this->body = $body; return $this; } /** * @param $repository * * @return $this */ public function setRepository($repository) { if (isset($repository) !== true) { return $this; } $this->repository = $repository; return $this; } /** * @throws \Elasticsearch\Common\Exceptions\RuntimeException * @return string */ public function getURI() { if (isset($this->repository) !== true) { throw new Exceptions\RuntimeException( 'repository is required for Create' ); } $repository = $this->repository; $uri = "/_snapshot/$repository"; if (isset($repository) === true) { $uri = "/_snapshot/$repository"; } return $uri; } /** * @return string[] */ public function getParamWhitelist() { return array( 'master_timeout', 'timeout', 'verify' ); } /** * @return array * @throws \Elasticsearch\Common\Exceptions\RuntimeException */ public function getBody() { if (isset($this->body) !== true) { throw new Exceptions\RuntimeException('Body is required for Create Repository'); } return $this->body; } /** * @return string */ public function getMethod() { return 'PUT'; } }