diff --git a/README.md b/README.md index f3e619f..b782712 100644 --- a/README.md +++ b/README.md @@ -49,4 +49,4 @@ Here's a list of Hypernode API features implemented in the client. - Updating one or multiple Hypernode settings at once. - Querying/polling the logbook for the status of a job. -- Creating and cancelling Ephemeral Hypernode instances. +- Creating and cancelling Brancher Hypernode instances. diff --git a/src/HypernodeClient.php b/src/HypernodeClient.php index 8d1e6bd..629cb56 100644 --- a/src/HypernodeClient.php +++ b/src/HypernodeClient.php @@ -8,7 +8,7 @@ use Hypernode\Api\Exception\HypernodeApiClientException; use Hypernode\Api\Exception\HypernodeApiServerException; use Hypernode\Api\Service\App; -use Hypernode\Api\Service\EphemeralApp; +use Hypernode\Api\Service\BrancherApp; use Hypernode\Api\Service\Logbook; use Hypernode\Api\Service\Settings; use Psr\Http\Message\ResponseInterface; @@ -19,7 +19,7 @@ class HypernodeClient public HttpMethodsClientInterface $api; public App $app; - public EphemeralApp $ephemeralApp; + public BrancherApp $brancherApp; public Settings $settings; public Logbook $logbook; @@ -27,7 +27,7 @@ public function __construct(HttpMethodsClientInterface $apiClient) { $this->api = $apiClient; $this->app = new App($this); - $this->ephemeralApp = new EphemeralApp($this); + $this->brancherApp = new BrancherApp($this); $this->settings = new Settings($this); $this->logbook = new Logbook($this); } @@ -46,4 +46,4 @@ public function maybeThrowApiExceptions(ResponseInterface $response) throw new HypernodeApiClientException($response); } } -} \ No newline at end of file +} diff --git a/src/Service/App.php b/src/Service/App.php index d7f06aa..823316e 100644 --- a/src/Service/App.php +++ b/src/Service/App.php @@ -8,6 +8,6 @@ class App extends AbstractService { public const V2_APP_DETAIL_URL = "/v2/app/%s/"; public const V2_APP_CANCEL_URL = "/v2/app/%s/cancel/"; - public const V2_APP_EPHEMERAL_URL = "/v2/app/%s/ephemeral/"; + public const V2_APP_BRANCHER_URL = "/v2/app/%s/brancher/"; public const V1_APP_FLOWS_URL = "/logbook/v1/logbooks/%s/flows/"; } diff --git a/src/Service/EphemeralApp.php b/src/Service/BrancherApp.php similarity index 77% rename from src/Service/EphemeralApp.php rename to src/Service/BrancherApp.php index 95221d4..ae5b62f 100644 --- a/src/Service/EphemeralApp.php +++ b/src/Service/BrancherApp.php @@ -7,19 +7,19 @@ use Hypernode\Api\Exception\HypernodeApiClientException; use Hypernode\Api\Exception\HypernodeApiServerException; -class EphemeralApp extends AbstractService +class BrancherApp extends AbstractService { /** - * Create an ephemeral app for given parent app. + * Create an brancher app for given parent app. * * @param string $app Name of the parent app - * @return string Name of the ephemeral app + * @return string Name of the brancher app * @throws HypernodeApiClientException * @throws HypernodeApiServerException */ public function create(string $app): string { - $url = sprintf(App::V2_APP_EPHEMERAL_URL, $app); + $url = sprintf(App::V2_APP_BRANCHER_URL, $app); $response = $this->client->api->post($url); @@ -31,9 +31,9 @@ public function create(string $app): string } /** - * Cancel an ephemeral app. + * Cancel an brancher app. * - * @param string $app Name of the ephemeral app + * @param string $app Name of the brancher app * @return void * @throws HypernodeApiClientException * @throws HypernodeApiServerException @@ -46,4 +46,4 @@ public function cancel(string $app): void $this->client->maybeThrowApiExceptions($response); } -} \ No newline at end of file +} diff --git a/tests/unit/Service/EphemeralAppTest.php b/tests/unit/Service/BrancherAppTest.php similarity index 68% rename from tests/unit/Service/EphemeralAppTest.php rename to tests/unit/Service/BrancherAppTest.php index 075acc4..6a8e9c2 100644 --- a/tests/unit/Service/EphemeralAppTest.php +++ b/tests/unit/Service/BrancherAppTest.php @@ -9,27 +9,27 @@ use Hypernode\Api\Exception\HypernodeApiServerException; use Hypernode\Api\HypernodeClientTestCase; -class EphemeralAppTest extends HypernodeClientTestCase +class BrancherAppTest extends HypernodeClientTestCase { - public function testCreateEphemeralApp() + public function testCreateBrancherApp() { $this->responses->append( new Response(200, [], json_encode([ 'name' => 'johndoe-eph123456', 'parent' => 'johndoe', - 'type' => 'ephemeral', + 'type' => 'brancher', ])), ); - $ephemeralAppName = $this->client->ephemeralApp->create('johndoe'); + $brancherAppName = $this->client->brancherApp->create('johndoe'); $request = $this->responses->getLastRequest(); $this->assertEquals('POST', $request->getMethod()); - $this->assertEquals('/v2/app/johndoe/ephemeral/', $request->getUri()); - $this->assertEquals('johndoe-eph123456', $ephemeralAppName); + $this->assertEquals('/v2/app/johndoe/brancher/', $request->getUri()); + $this->assertEquals('johndoe-eph123456', $brancherAppName); } - public function testCreateEphemeralAppRaisesClientExceptions() + public function testCreateBrancherAppRaisesClientExceptions() { $badRequestResponse = new Response(400, [], json_encode([ 'non_field_errors' => ['Your request was invalid.'] @@ -38,10 +38,10 @@ public function testCreateEphemeralAppRaisesClientExceptions() $this->expectExceptionObject(new HypernodeApiClientException($badRequestResponse)); - $this->client->ephemeralApp->create('johndoe'); + $this->client->brancherApp->create('johndoe'); } - public function testCreateEphemeralAppRaisesServerExceptions() + public function testCreateBrancherAppRaisesServerExceptions() { $badRequestResponse = new Response(500, [], json_encode([ 'non_field_errors' => ['Something went wrong processing your request.'] @@ -50,23 +50,23 @@ public function testCreateEphemeralAppRaisesServerExceptions() $this->expectExceptionObject(new HypernodeApiServerException($badRequestResponse)); - $this->client->ephemeralApp->create('johndoe'); + $this->client->brancherApp->create('johndoe'); } - public function testCancelEphemeralApp() + public function testCancelBrancherApp() { $this->responses->append( new Response(204, [], null), ); - $this->client->ephemeralApp->cancel('johndoe-eph123456'); + $this->client->brancherApp->cancel('johndoe-eph123456'); $request = $this->responses->getLastRequest(); $this->assertEquals('POST', $request->getMethod()); $this->assertEquals('/v2/app/johndoe-eph123456/cancel/', $request->getUri()); } - public function testCancelEphemeralAppRaisesClientExceptions() + public function testCancelBrancherAppRaisesClientExceptions() { $badRequestResponse = new Response(400, [], json_encode([ 'non_field_errors' => ['Your request was invalid.'] @@ -75,10 +75,10 @@ public function testCancelEphemeralAppRaisesClientExceptions() $this->expectExceptionObject(new HypernodeApiClientException($badRequestResponse)); - $this->client->ephemeralApp->cancel('johndoe'); + $this->client->brancherApp->cancel('johndoe'); } - public function testCancelEphemeralAppRaisesServerExceptions() + public function testCancelBrancherAppRaisesServerExceptions() { $badRequestResponse = new Response(500, [], json_encode([ 'non_field_errors' => ['Something went wrong processing your request.'] @@ -87,6 +87,6 @@ public function testCancelEphemeralAppRaisesServerExceptions() $this->expectExceptionObject(new HypernodeApiServerException($badRequestResponse)); - $this->client->ephemeralApp->cancel('johndoe'); + $this->client->brancherApp->cancel('johndoe'); } }