Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/Compute/Enums/MachineState.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,23 @@

namespace Cbws\Sdk\Compute\Enums;

use Cbws\Grpc\Compute\V1alpha1\Machine\State;

enum MachineState: int
{
case Unspecified = State::STATE_UNSPECIFIED;
case Unspecified = 0;

case Provisioning = State::STATE_PROVISIONING;
case Provisioning = 1;

case Staging = State::STATE_STAGING;
case Staging = 2;

case Running = State::STATE_RUNNING;
case Running = 3;

case Stopping = State::STATE_STOPPING;
case Stopping = 4;

case Suspending = State::STATE_SUSPENDING;
case Suspending = 5;

case Suspended = State::STATE_SUSPENDED;
case Suspended = 6;

case Repairing = State::STATE_REPAIRING;
case Repairing = 7;

case Terminated = State::STATE_TERMINATED;
case Terminated = 8;
}
8 changes: 8 additions & 0 deletions tests/Integration/Compute/MachinesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Cbws\Sdk\Compute\Client;
use Cbws\Sdk\Compute\Models\Machine;
use Cbws\Sdk\Compute\Requests\ListMachinesRequest;
use PHPUnit\Framework\TestCase;

class MachinesTest extends TestCase
Expand Down Expand Up @@ -53,6 +54,13 @@ public function test_list_machines(): void
self::assertGreaterThan(0, count($response->getMachines()), 'Expected at least one machine');
}

public function test_list_machines_without_state(): void
{
assert($this->client !== null);
$response = $this->client->machines()->list((new ListMachinesRequest())->withoutState());
self::assertGreaterThan(0, count($response->getMachines()), 'Expected at least one machine');
}

public function test_get_machine(): void
{
assert($this->client !== null);
Expand Down
Loading