diff --git a/src/Requests/Control/ConfigureIndex.php b/src/Requests/Control/ConfigureIndex.php index 4fbc7b3..fa877c4 100644 --- a/src/Requests/Control/ConfigureIndex.php +++ b/src/Requests/Control/ConfigureIndex.php @@ -47,7 +47,7 @@ public function __construct( */ public function resolveEndpoint(): string { - return '/databases/' . $this->name; + return '/indexes/' . $this->name; } /** @@ -56,8 +56,12 @@ public function resolveEndpoint(): string protected function defaultBody(): array { return [ - 'replicas' => $this->replicas, - 'pod_type' => $this->pod_type, + 'spec' => [ + 'pod' => [ + 'replicas' => $this->replicas, + 'pod_type' => $this->pod_type, + ], + ] ]; } diff --git a/src/Requests/Control/DeleteIndex.php b/src/Requests/Control/DeleteIndex.php index 262856f..b604ab9 100644 --- a/src/Requests/Control/DeleteIndex.php +++ b/src/Requests/Control/DeleteIndex.php @@ -23,7 +23,7 @@ class DeleteIndex extends Request /** * @var Method */ - protected Method $method = Method::POST; + protected Method $method = Method::DELETE; /** * @param string $name @@ -37,7 +37,7 @@ public function __construct( */ public function resolveEndpoint(): string { - return '/databases/' . $this->name; + return '/indexes/' . $this->name; } /** diff --git a/src/Requests/Control/DescribeIndex.php b/src/Requests/Control/DescribeIndex.php index 174dbcd..cff1979 100644 --- a/src/Requests/Control/DescribeIndex.php +++ b/src/Requests/Control/DescribeIndex.php @@ -52,7 +52,7 @@ public function __construct( */ public function resolveEndpoint(): string { - return '/databases/' . $this->name; + return '/indexes/' . $this->name; } /** diff --git a/src/Requests/Control/ListIndexes.php b/src/Requests/Control/ListIndexes.php index aa37f76..31f1219 100644 --- a/src/Requests/Control/ListIndexes.php +++ b/src/Requests/Control/ListIndexes.php @@ -14,23 +14,15 @@ */ class ListIndexes extends Request { - /** - * @var Method - */ + protected Method $method = Method::GET; - /** - * @return string - */ + public function resolveEndpoint(): string { - return '/databases'; + return '/indexes'; } - /** - * @param Response $response - * @return bool|null - */ public function hasRequestFailed(Response $response): ?bool { return $response->status() !== 200; diff --git a/src/Resources/Control/IndexResource.php b/src/Resources/Control/IndexResource.php index b4d7dce..b68c9b4 100644 --- a/src/Resources/Control/IndexResource.php +++ b/src/Resources/Control/IndexResource.php @@ -15,10 +15,9 @@ public function __construct(protected Connector $connector) parent::__construct($connector); } - - public function describe(): Response + public function list(): Response { - return $this->connector->send(new Index\DescribeIndex()); + return $this->connector->send(new Index\ListIndexes()); } public function createPod( @@ -74,18 +73,26 @@ public function createServerless( } - public function list(): Response + + public function describe(string $name): Response { - return $this->connector->send(new Index\ListIndexes()); + return $this->connector->send(new Index\DescribeIndex( + name: $name + )); } - public function configure(string $pod_type, int $replicas): Response + public function configure(string $name, string $pod_type, int $replicas): Response { - return $this->connector->send(new Index\ConfigureIndex($replicas, $pod_type)); + return $this->connector->send(new Index\ConfigureIndex( + name: $name, + replicas: $replicas, + pod_type: $pod_type)); } - public function delete(): Response + public function delete(string $name): Response { - return $this->connector->send(new Index\DeleteIndex()); + return $this->connector->send(new Index\DeleteIndex( + name: $name + )); } } \ No newline at end of file