diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 31bbbe2..ad64e24 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,7 +14,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.1,8.2] + php: [8.1,8.2,8.3] laravel: [10.*] stability: [prefer-lowest, prefer-stable] include: @@ -32,7 +32,7 @@ jobs: with: php-version: ${{ matrix.php }} extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo - coverage: none + coverage: pcov - name: Setup problem matchers run: | diff --git a/composer.json b/composer.json index a5c5e38..934a6f1 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "php": "^8.1", "guzzlehttp/guzzle": "^7.2", "illuminate/contracts": "^10.0", - "sammyjo20/saloon-laravel": "^1.5", + "saloonphp/laravel-plugin": "^2.0", "spatie/laravel-package-tools": "^1.14.0" }, "require-dev": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 0f4952a..6efae51 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,5 @@ includes: - - ./vendor/nunomaduro/larastan/extension.neon + - ./vendor/larastan/larastan/extension.neon parameters: diff --git a/src/Domain/Account.php b/src/Domain/Account.php index 46e97d9..0e1004d 100644 --- a/src/Domain/Account.php +++ b/src/Domain/Account.php @@ -6,21 +6,23 @@ use SamuelMwangiW\Linode\DTO\AccountDTO; use SamuelMwangiW\Linode\Factory\AccountFactory; +use SamuelMwangiW\Linode\Saloon\AuthenticatedConnector; use SamuelMwangiW\Linode\Saloon\Requests\Account\GetRequest; class Account { /** * @return AccountDTO - * @throws \GuzzleHttp\Exception\GuzzleException * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public static function details(): AccountDTO { - $response = GetRequest::make() - ->send() + $request = GetRequest::make(); + + $response = AuthenticatedConnector::make() + ->send($request) ->throw(); return AccountFactory::make($response->json()); diff --git a/src/Domain/Billing.php b/src/Domain/Billing.php index 5f65723..c74d82a 100644 --- a/src/Domain/Billing.php +++ b/src/Domain/Billing.php @@ -7,21 +7,23 @@ use Illuminate\Support\Collection; use SamuelMwangiW\Linode\DTO\PlanDTO; use SamuelMwangiW\Linode\Factory\PlanFactory; +use SamuelMwangiW\Linode\Saloon\BaseConnector; use SamuelMwangiW\Linode\Saloon\Requests\Billing\PlansListRequest; class Billing { /** * @return Collection - * @throws \GuzzleHttp\Exception\GuzzleException * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function plans(): Collection { - return PlansListRequest::make() - ->send() + $request = PlansListRequest::make(); + + return BaseConnector::make() + ->send($request) ->throw() ->collect('data') ->map(fn (array $plan) => PlanFactory::make($plan)); diff --git a/src/Domain/Firewall.php b/src/Domain/Firewall.php index 65c59de..841d190 100644 --- a/src/Domain/Firewall.php +++ b/src/Domain/Firewall.php @@ -5,9 +5,10 @@ namespace SamuelMwangiW\Linode\Domain; use Illuminate\Support\Collection; -use Sammyjo20\Saloon\Http\SaloonResponse; +use Saloon\Contracts\Response; use SamuelMwangiW\Linode\DTO\FirewallDTO; use SamuelMwangiW\Linode\Factory\FirewallFactory; +use SamuelMwangiW\Linode\Saloon\AuthenticatedConnector; use SamuelMwangiW\Linode\Saloon\Requests\Firewall\CreateRequest; use SamuelMwangiW\Linode\Saloon\Requests\Firewall\DeleteRequest; use SamuelMwangiW\Linode\Saloon\Requests\Firewall\ListRequest; @@ -25,15 +26,16 @@ public function rules(): FirewallRule /** * @return Collection - * @throws \GuzzleHttp\Exception\GuzzleException * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function list(): Collection { - return ListRequest::make() - ->send() + $request = ListRequest::make(); + + return AuthenticatedConnector::make() + ->send($request) ->throw() ->collect('data') ->map(fn (array $firewall) => FirewallFactory::make($firewall)); @@ -42,49 +44,52 @@ public function list(): Collection /** * @param $firewallId * @return FirewallDTO - * @throws \GuzzleHttp\Exception\GuzzleException * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function show($firewallId): FirewallDTO { + $request = ShowRequest::make($firewallId); + return FirewallFactory::make( - data: ShowRequest::make($firewallId) - ->send() + data: AuthenticatedConnector::make() + ->send($request) ->throw() ->json() ); } /** - * @param $data - * @return void - * @throws \GuzzleHttp\Exception\GuzzleException + * @param array $data + * @return Collection * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ - public function create($data) + public function create(array $data): Collection { - CreateRequest::make($data) - ->send() + $request = CreateRequest::make($data); + + return AuthenticatedConnector::make() + ->send($request) ->throw() - ->collect()->dd(); + ->collect(); } /** * @param $firewallId - * @return SaloonResponse - * @throws \GuzzleHttp\Exception\GuzzleException + * @return Response * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ - public function destroy($firewallId): SaloonResponse + public function destroy($firewallId): Response { - return DeleteRequest::make($firewallId) - ->send() + $request = DeleteRequest::make($firewallId); + + return AuthenticatedConnector::make() + ->send($request) ->throw(); } } diff --git a/src/Domain/FirewallRule.php b/src/Domain/FirewallRule.php index bd2ef3b..80e9a1c 100644 --- a/src/Domain/FirewallRule.php +++ b/src/Domain/FirewallRule.php @@ -6,6 +6,7 @@ use SamuelMwangiW\Linode\DTO\FirewallRulesDTO; use SamuelMwangiW\Linode\Factory\FirewallRulesFactory; +use SamuelMwangiW\Linode\Saloon\AuthenticatedConnector; use SamuelMwangiW\Linode\Saloon\Requests\Firewall\Rules\ListRequest; class FirewallRule @@ -13,16 +14,17 @@ class FirewallRule /** * @param $firewallId * @return FirewallRulesDTO - * @throws \GuzzleHttp\Exception\GuzzleException * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function show($firewallId): FirewallRulesDTO { + $connector = AuthenticatedConnector::make(); + $request = ListRequest::make($firewallId); + return FirewallRulesFactory::make( - data: ListRequest::make($firewallId) - ->send() + data: $connector->send($request) ->throw() ->json() ); diff --git a/src/Domain/Image.php b/src/Domain/Image.php index 463a3e1..2adcfb2 100644 --- a/src/Domain/Image.php +++ b/src/Domain/Image.php @@ -7,6 +7,7 @@ use Illuminate\Support\Collection; use SamuelMwangiW\Linode\DTO\ImageDTO; use SamuelMwangiW\Linode\Factory\ImageFactory; +use SamuelMwangiW\Linode\Saloon\AuthenticatedConnector; use SamuelMwangiW\Linode\Saloon\Requests\Images\CreateRequest; use SamuelMwangiW\Linode\Saloon\Requests\Images\ListRequest; use SamuelMwangiW\Linode\Saloon\Requests\Images\ShowRequest; @@ -15,15 +16,16 @@ class Image { /** * @return Collection - * @throws \GuzzleHttp\Exception\GuzzleException * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function list(): Collection { - return ListRequest::make() - ->send() + $request = ListRequest::make(); + $connector = AuthenticatedConnector::make(); + + return $connector->send($request) ->throw() ->collect('data') ->map(fn (array $image) => ImageFactory::make($image)); @@ -32,15 +34,16 @@ public function list(): Collection /** * @param array $data * @return ImageDTO - * @throws \GuzzleHttp\Exception\GuzzleException * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function create(array $data): ImageDTO { - $image = CreateRequest::make($data) - ->send() + $request = CreateRequest::make($data); + $connector = AuthenticatedConnector::make(); + + $image = $connector->send($request) ->throw() ->json(); @@ -50,15 +53,16 @@ public function create(array $data): ImageDTO /** * @param string $id * @return ImageDTO - * @throws \GuzzleHttp\Exception\GuzzleException * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function show(string $id): ImageDTO { - $image = ShowRequest::make($id) - ->send() + $request = ShowRequest::make($id); + $connector = AuthenticatedConnector::make(); + + $image = $connector->send($request) ->throw() ->json(); diff --git a/src/Domain/Instance.php b/src/Domain/Instance.php index cb7c5fc..648ad59 100644 --- a/src/Domain/Instance.php +++ b/src/Domain/Instance.php @@ -4,15 +4,12 @@ namespace SamuelMwangiW\Linode\Domain; -use GuzzleHttp\Exception\GuzzleException; use Illuminate\Support\Collection; -use Sammyjo20\Saloon\Exceptions\SaloonException; -use Sammyjo20\Saloon\Exceptions\SaloonRequestException; -use Sammyjo20\Saloon\Http\SaloonResponse; -use SamuelMwangiW\Linode\DTO\DiskDTO; +use Saloon\Contracts\Response; use SamuelMwangiW\Linode\DTO\InstanceDTO; use SamuelMwangiW\Linode\Factory\DiskFactory; use SamuelMwangiW\Linode\Factory\InstanceFactory; +use SamuelMwangiW\Linode\Saloon\AuthenticatedConnector; use SamuelMwangiW\Linode\Saloon\Requests\Instance\CloneRequest; use SamuelMwangiW\Linode\Saloon\Requests\Instance\CreateRequest; use SamuelMwangiW\Linode\Saloon\Requests\Instance\DeleteRequest; @@ -25,16 +22,17 @@ class Instance { /** - * @return Collection - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException - * @throws \GuzzleHttp\Exception\GuzzleException + * @return Collection * @throws \ReflectionException - * @throws SaloonException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function list(): Collection { - return ListRequest::make() - ->send() + $request = ListRequest::make(); + $connector = AuthenticatedConnector::make(); + + return $connector->send($request) ->throw() ->collect('data') ->map(fn ($data) => InstanceFactory::make($data)); @@ -43,15 +41,16 @@ public function list(): Collection /** * @param string|int $instance * @return InstanceDTO - * @throws SaloonException - * @throws GuzzleException * @throws \ReflectionException - * @throws SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function show(string|int $instance): InstanceDTO { - $data = GetRequest::make($instance) - ->send() + $request = GetRequest::make($instance); + $connector = AuthenticatedConnector::make(); + + $data = $connector->send($request) ->throw() ->json(); @@ -60,16 +59,17 @@ public function show(string|int $instance): InstanceDTO /** * @param string|int $instance - * @return Collection - * @throws GuzzleException - * @throws SaloonException - * @throws SaloonRequestException + * @return Collection * @throws \ReflectionException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function disks(string|int $instance): Collection { - return DisksRequest::make($instance) - ->send() + $request = DisksRequest::make($instance); + $connector = AuthenticatedConnector::make(); + + return $connector->send($request) ->throw() ->collect('data') ->map(fn (array $disk) => DiskFactory::make($disk)); @@ -78,15 +78,16 @@ public function disks(string|int $instance): Collection /** * @param array $instance * @return InstanceDTO - * @throws GuzzleException - * @throws SaloonException - * @throws SaloonRequestException * @throws \ReflectionException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function create(array $instance): InstanceDTO { - $data = CreateRequest::make($instance) - ->send() + $request = CreateRequest::make($instance); + $connector = AuthenticatedConnector::make(); + + $data = $connector->send($request) ->throw() ->json(); @@ -97,15 +98,16 @@ public function create(array $instance): InstanceDTO * @param int $id * @param array $instance_details * @return InstanceDTO - * @throws GuzzleException - * @throws SaloonException - * @throws SaloonRequestException * @throws \ReflectionException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function update(int $id, array $instance_details): InstanceDTO { - $data = UpdateRequest::make($id, $instance_details) - ->send() + $request = UpdateRequest::make($id, $instance_details); + $connector = AuthenticatedConnector::make(); + + $data = $connector->send($request) ->throw() ->json(); @@ -116,15 +118,16 @@ public function update(int $id, array $instance_details): InstanceDTO * @param int $id * @param array $instance_details * @return InstanceDTO - * @throws GuzzleException - * @throws SaloonException - * @throws SaloonRequestException * @throws \ReflectionException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function clone(int $id, array $instance_details): InstanceDTO { - $data = CloneRequest::make($id, $instance_details) - ->send() + $request = CloneRequest::make($id, $instance_details); + $connector = AuthenticatedConnector::make(); + + $data = $connector->send($request) ->throw() ->json(); @@ -133,31 +136,31 @@ public function clone(int $id, array $instance_details): InstanceDTO /** * @param mixed $id - * @return SaloonResponse - * @throws GuzzleException - * @throws SaloonException - * @throws SaloonRequestException + * @return Response * @throws \ReflectionException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ - public function destroy(mixed $id): SaloonResponse + public function destroy(mixed $id): Response { - return DeleteRequest::make($id) - ->send() - ->throw(); + $request = DeleteRequest::make($id); + $connector = AuthenticatedConnector::make(); + + return $connector->send($request)->throw(); } /** * @param mixed $linodeId - * @return SaloonResponse - * @throws GuzzleException - * @throws SaloonException - * @throws SaloonRequestException + * @return Response * @throws \ReflectionException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ - public function shutdown(mixed $linodeId): SaloonResponse + public function shutdown(mixed $linodeId): Response { - return ShutdownRequest::make($linodeId) - ->send() - ->throw(); + $request = ShutdownRequest::make($linodeId); + $connector = AuthenticatedConnector::make(); + + return $connector->send($request)->throw(); } } diff --git a/src/Domain/Region.php b/src/Domain/Region.php index aae82a2..a795ffb 100644 --- a/src/Domain/Region.php +++ b/src/Domain/Region.php @@ -7,21 +7,23 @@ use Illuminate\Support\Collection; use SamuelMwangiW\Linode\DTO\RegionDTO; use SamuelMwangiW\Linode\Factory\RegionFactory; +use SamuelMwangiW\Linode\Saloon\BaseConnector; use SamuelMwangiW\Linode\Saloon\Requests\Regions\ListRequest; class Region { /** * @return Collection - * @throws \GuzzleHttp\Exception\GuzzleException * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function list(): Collection { - return ListRequest::make() - ->send() + $connector = BaseConnector::make(); + $request = ListRequest::make(); + + return $connector->send($request) ->throw() ->collect('data') ->map(fn (array $region) => RegionFactory::make($region)); diff --git a/src/Factory/RegionFactory.php b/src/Factory/RegionFactory.php index 2b0495c..4173bd1 100644 --- a/src/Factory/RegionFactory.php +++ b/src/Factory/RegionFactory.php @@ -19,7 +19,8 @@ public static function make(array $data): RegionDTO resolvers: collect( explode(',', $data['resolvers']['ipv4']) ) - ->map(fn ($ip) => new IPAddress($ip)), + ->map(fn (string $ip) => trim($ip)) + ->map(fn (string $ip) => new IPAddress($ip)), capabilities: collect($data['capabilities']), ); } diff --git a/src/Linode.php b/src/Linode.php index 45ec3b3..4290521 100755 --- a/src/Linode.php +++ b/src/Linode.php @@ -20,10 +20,9 @@ public static function __callStatic(string $name, array $arguments) /** * @return DTO\AccountDTO - * @throws \GuzzleHttp\Exception\GuzzleException * @throws \ReflectionException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonException - * @throws \Sammyjo20\Saloon\Exceptions\SaloonRequestException + * @throws \Saloon\Exceptions\InvalidResponseClassException + * @throws \Saloon\Exceptions\PendingRequestException */ public function account(): DTO\AccountDTO { diff --git a/src/Saloon/AuthenticatedConnector.php b/src/Saloon/AuthenticatedConnector.php index b4203e6..a7097e9 100644 --- a/src/Saloon/AuthenticatedConnector.php +++ b/src/Saloon/AuthenticatedConnector.php @@ -4,8 +4,8 @@ namespace SamuelMwangiW\Linode\Saloon; -use Sammyjo20\Saloon\Http\Auth\TokenAuthenticator; -use Sammyjo20\Saloon\Interfaces\AuthenticatorInterface; +use Saloon\Contracts\Authenticator; +use Saloon\Http\Auth\TokenAuthenticator; use SamuelMwangiW\Linode\Exceptions\CredentialsMissing; class AuthenticatedConnector extends BaseConnector @@ -13,9 +13,9 @@ class AuthenticatedConnector extends BaseConnector /** * @throws CredentialsMissing */ - public function defaultAuth(): AuthenticatorInterface + public function defaultAuth(): Authenticator { - $token = value(config('linode.token')); + $token = config('linode.token'); if (blank($token)) { throw new CredentialsMissing(); diff --git a/src/Saloon/BaseConnector.php b/src/Saloon/BaseConnector.php index 4fff1d1..fdf1d33 100644 --- a/src/Saloon/BaseConnector.php +++ b/src/Saloon/BaseConnector.php @@ -4,20 +4,17 @@ namespace SamuelMwangiW\Linode\Saloon; -use Sammyjo20\Saloon\Http\SaloonConnector; -use Sammyjo20\Saloon\Traits\Plugins\AcceptsJson; +use Saloon\Http\Connector; -class BaseConnector extends SaloonConnector +class BaseConnector extends Connector { - use AcceptsJson; - - public function defineBaseUrl(): string + public function resolveBaseUrl(): string { return config('linode.endpoint'); } /** - * @return array + * @return array */ public function defaultHeaders(): array { @@ -25,7 +22,7 @@ public function defaultHeaders(): array } /** - * @return array + * @return array */ public function defaultConfig(): array { diff --git a/src/Saloon/Requests/Account/GetRequest.php b/src/Saloon/Requests/Account/GetRequest.php index aea10c5..24745f8 100644 --- a/src/Saloon/Requests/Account/GetRequest.php +++ b/src/Saloon/Requests/Account/GetRequest.php @@ -8,7 +8,7 @@ class GetRequest extends AuthenticatedRequest { - public function defineEndpoint(): string + public function resolveEndpoint(): string { return 'account'; } diff --git a/src/Saloon/Requests/BaseRequest.php b/src/Saloon/Requests/BaseRequest.php index cc7e4b5..b189893 100644 --- a/src/Saloon/Requests/BaseRequest.php +++ b/src/Saloon/Requests/BaseRequest.php @@ -4,13 +4,10 @@ namespace SamuelMwangiW\Linode\Saloon\Requests; -use Sammyjo20\Saloon\Constants\Saloon; -use Sammyjo20\Saloon\Http\SaloonRequest; -use SamuelMwangiW\Linode\Saloon\BaseConnector; +use Saloon\Enums\Method; +use Saloon\Http\Request; -abstract class BaseRequest extends SaloonRequest +abstract class BaseRequest extends Request { - protected ?string $connector = BaseConnector::class; - - protected ?string $method = Saloon::GET; + protected Method $method = Method::GET; } diff --git a/src/Saloon/Requests/Billing/PlansListRequest.php b/src/Saloon/Requests/Billing/PlansListRequest.php index 7db17f5..6989b9f 100644 --- a/src/Saloon/Requests/Billing/PlansListRequest.php +++ b/src/Saloon/Requests/Billing/PlansListRequest.php @@ -8,7 +8,7 @@ class PlansListRequest extends BaseRequest { - public function defineEndpoint(): string + public function resolveEndpoint(): string { return 'linode/types'; } diff --git a/src/Saloon/Requests/Firewall/CreateRequest.php b/src/Saloon/Requests/Firewall/CreateRequest.php index 3a4439c..89f971a 100644 --- a/src/Saloon/Requests/Firewall/CreateRequest.php +++ b/src/Saloon/Requests/Firewall/CreateRequest.php @@ -4,27 +4,28 @@ namespace SamuelMwangiW\Linode\Saloon\Requests\Firewall; -use Sammyjo20\Saloon\Constants\Saloon; -use Sammyjo20\Saloon\Traits\Plugins\HasJsonBody; +use Saloon\Contracts\Body\HasBody; +use Saloon\Enums\Method; +use Saloon\Traits\Body\HasJsonBody; use SamuelMwangiW\Linode\Saloon\Requests\AuthenticatedRequest; -class CreateRequest extends AuthenticatedRequest +class CreateRequest extends AuthenticatedRequest implements HasBody { use HasJsonBody; - protected ?string $method = Saloon::POST; + protected Method $method = Method::POST; public function __construct( - private array $data + private readonly array $data ) { } - public function defaultData(): array + public function defaultBody(): array { return $this->data; } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return 'networking/firewalls'; } diff --git a/src/Saloon/Requests/Firewall/DeleteRequest.php b/src/Saloon/Requests/Firewall/DeleteRequest.php index 243ddb2..0e5587e 100644 --- a/src/Saloon/Requests/Firewall/DeleteRequest.php +++ b/src/Saloon/Requests/Firewall/DeleteRequest.php @@ -4,19 +4,19 @@ namespace SamuelMwangiW\Linode\Saloon\Requests\Firewall; -use Sammyjo20\Saloon\Constants\Saloon; +use Saloon\Enums\Method; use SamuelMwangiW\Linode\Saloon\Requests\AuthenticatedRequest; class DeleteRequest extends AuthenticatedRequest { - protected ?string $method = Saloon::DELETE; + protected Method $method = Method::DELETE; public function __construct( - private string $firewallId + private readonly string|int $firewallId ) { } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return "networking/firewalls/{$this->firewallId}"; } diff --git a/src/Saloon/Requests/Firewall/ListRequest.php b/src/Saloon/Requests/Firewall/ListRequest.php index 4e44e95..8c86bfd 100644 --- a/src/Saloon/Requests/Firewall/ListRequest.php +++ b/src/Saloon/Requests/Firewall/ListRequest.php @@ -8,7 +8,7 @@ class ListRequest extends AuthenticatedRequest { - public function defineEndpoint(): string + public function resolveEndpoint(): string { return 'networking/firewalls'; } diff --git a/src/Saloon/Requests/Firewall/Rules/ListRequest.php b/src/Saloon/Requests/Firewall/Rules/ListRequest.php index 3d88b71..8871450 100644 --- a/src/Saloon/Requests/Firewall/Rules/ListRequest.php +++ b/src/Saloon/Requests/Firewall/Rules/ListRequest.php @@ -9,11 +9,11 @@ class ListRequest extends AuthenticatedRequest { public function __construct( - private string $firewallId + private readonly string|int $firewallId ) { } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return "networking/firewalls/{$this->firewallId}/rules"; } diff --git a/src/Saloon/Requests/Firewall/ShowRequest.php b/src/Saloon/Requests/Firewall/ShowRequest.php index 5ed3854..9fc5ad0 100644 --- a/src/Saloon/Requests/Firewall/ShowRequest.php +++ b/src/Saloon/Requests/Firewall/ShowRequest.php @@ -9,11 +9,11 @@ class ShowRequest extends AuthenticatedRequest { public function __construct( - private string $firewallId + private readonly string|int $firewallId ) { } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return "networking/firewalls/{$this->firewallId}"; } diff --git a/src/Saloon/Requests/Images/CreateRequest.php b/src/Saloon/Requests/Images/CreateRequest.php index 788ebab..d87b52e 100644 --- a/src/Saloon/Requests/Images/CreateRequest.php +++ b/src/Saloon/Requests/Images/CreateRequest.php @@ -4,27 +4,28 @@ namespace SamuelMwangiW\Linode\Saloon\Requests\Images; -use Sammyjo20\Saloon\Constants\Saloon; -use Sammyjo20\Saloon\Traits\Plugins\HasJsonBody; +use Saloon\Contracts\Body\HasBody; +use Saloon\Enums\Method; +use Saloon\Traits\Body\HasJsonBody; use SamuelMwangiW\Linode\Saloon\Requests\AuthenticatedRequest; -class CreateRequest extends AuthenticatedRequest +class CreateRequest extends AuthenticatedRequest implements HasBody { use HasJsonBody; - protected ?string $method = Saloon::POST; + protected Method $method = Method::POST; public function __construct( - private array $data, + private readonly array $data, ) { } - public function defaultData(): array + public function defaultBody(): array { return $this->data; } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return 'images'; } diff --git a/src/Saloon/Requests/Images/ListRequest.php b/src/Saloon/Requests/Images/ListRequest.php index 167e88f..ca23792 100644 --- a/src/Saloon/Requests/Images/ListRequest.php +++ b/src/Saloon/Requests/Images/ListRequest.php @@ -8,7 +8,7 @@ class ListRequest extends AuthenticatedRequest { - public function defineEndpoint(): string + public function resolveEndpoint(): string { return 'images'; } diff --git a/src/Saloon/Requests/Images/ShowRequest.php b/src/Saloon/Requests/Images/ShowRequest.php index 56fb776..018d62d 100644 --- a/src/Saloon/Requests/Images/ShowRequest.php +++ b/src/Saloon/Requests/Images/ShowRequest.php @@ -9,11 +9,11 @@ class ShowRequest extends AuthenticatedRequest { public function __construct( - private string|int $imageId + private readonly string|int $imageId ) { } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return "images/{$this->imageId}"; } diff --git a/src/Saloon/Requests/Instance/CloneRequest.php b/src/Saloon/Requests/Instance/CloneRequest.php index 4c6cd1c..47b9170 100644 --- a/src/Saloon/Requests/Instance/CloneRequest.php +++ b/src/Saloon/Requests/Instance/CloneRequest.php @@ -4,28 +4,29 @@ namespace SamuelMwangiW\Linode\Saloon\Requests\Instance; -use Sammyjo20\Saloon\Constants\Saloon; -use Sammyjo20\Saloon\Traits\Plugins\HasJsonBody; +use Saloon\Contracts\Body\HasBody; +use Saloon\Enums\Method; +use Saloon\Traits\Body\HasJsonBody; use SamuelMwangiW\Linode\Saloon\Requests\AuthenticatedRequest; -class CloneRequest extends AuthenticatedRequest +class CloneRequest extends AuthenticatedRequest implements HasBody { use HasJsonBody; - protected ?string $method = Saloon::POST; + protected Method $method = Method::POST; public function __construct( - private string $instanceId, - private array $data, + private readonly string|int $instanceId, + private readonly array $data, ) { } - public function defaultData(): array + public function defaultBody(): array { return $this->data; } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return "linode/instances/{$this->instanceId}/clone"; } diff --git a/src/Saloon/Requests/Instance/CreateRequest.php b/src/Saloon/Requests/Instance/CreateRequest.php index e6fc5e4..6179928 100644 --- a/src/Saloon/Requests/Instance/CreateRequest.php +++ b/src/Saloon/Requests/Instance/CreateRequest.php @@ -4,26 +4,28 @@ namespace SamuelMwangiW\Linode\Saloon\Requests\Instance; -use Sammyjo20\Saloon\Constants\Saloon; -use Sammyjo20\Saloon\Traits\Plugins\HasJsonBody; +use Saloon\Contracts\Body\HasBody; +use Saloon\Enums\Method; +use Saloon\Traits\Body\HasJsonBody; use SamuelMwangiW\Linode\Saloon\Requests\AuthenticatedRequest; -class CreateRequest extends AuthenticatedRequest +class CreateRequest extends AuthenticatedRequest implements HasBody { use HasJsonBody; - protected ?string $method = Saloon::POST; + protected Method $method = Method::POST; - public function __construct(private array $data) - { + public function __construct( + private readonly array $data, + ) { } - public function defaultData(): array + public function defaultBody(): array { return $this->data; } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return 'linode/instances'; } diff --git a/src/Saloon/Requests/Instance/DeleteRequest.php b/src/Saloon/Requests/Instance/DeleteRequest.php index a1c4a83..b789149 100644 --- a/src/Saloon/Requests/Instance/DeleteRequest.php +++ b/src/Saloon/Requests/Instance/DeleteRequest.php @@ -4,19 +4,19 @@ namespace SamuelMwangiW\Linode\Saloon\Requests\Instance; -use Sammyjo20\Saloon\Constants\Saloon; +use Saloon\Enums\Method; use SamuelMwangiW\Linode\Saloon\Requests\AuthenticatedRequest; class DeleteRequest extends AuthenticatedRequest { - protected ?string $method = Saloon::DELETE; + protected Method $method = Method::DELETE; public function __construct( - private string $instanceId + private readonly string|int $instanceId, ) { } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return "linode/instances/{$this->instanceId}"; } diff --git a/src/Saloon/Requests/Instance/DisksRequest.php b/src/Saloon/Requests/Instance/DisksRequest.php index a196da3..a293e4a 100644 --- a/src/Saloon/Requests/Instance/DisksRequest.php +++ b/src/Saloon/Requests/Instance/DisksRequest.php @@ -9,11 +9,11 @@ class DisksRequest extends AuthenticatedRequest { public function __construct( - private string|int $instanceId + private readonly string|int $instanceId ) { } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return "linode/instances/{$this->instanceId}/disks"; } diff --git a/src/Saloon/Requests/Instance/GetRequest.php b/src/Saloon/Requests/Instance/GetRequest.php index b59ff53..c3fdcc6 100644 --- a/src/Saloon/Requests/Instance/GetRequest.php +++ b/src/Saloon/Requests/Instance/GetRequest.php @@ -9,11 +9,11 @@ class GetRequest extends AuthenticatedRequest { public function __construct( - private string|int $id + private readonly string|int $id, ) { } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return 'linode/instances/'.$this->id; } diff --git a/src/Saloon/Requests/Instance/ListRequest.php b/src/Saloon/Requests/Instance/ListRequest.php index 4ed2440..b8b66c6 100644 --- a/src/Saloon/Requests/Instance/ListRequest.php +++ b/src/Saloon/Requests/Instance/ListRequest.php @@ -8,7 +8,7 @@ class ListRequest extends AuthenticatedRequest { - public function defineEndpoint(): string + public function resolveEndpoint(): string { return 'linode/instances'; } diff --git a/src/Saloon/Requests/Instance/ShutdownRequest.php b/src/Saloon/Requests/Instance/ShutdownRequest.php index a2d5c13..24090b0 100644 --- a/src/Saloon/Requests/Instance/ShutdownRequest.php +++ b/src/Saloon/Requests/Instance/ShutdownRequest.php @@ -4,19 +4,19 @@ namespace SamuelMwangiW\Linode\Saloon\Requests\Instance; -use Sammyjo20\Saloon\Constants\Saloon; +use Saloon\Enums\Method; use SamuelMwangiW\Linode\Saloon\Requests\AuthenticatedRequest; class ShutdownRequest extends AuthenticatedRequest { - protected ?string $method = Saloon::POST; + protected Method $method = Method::POST; public function __construct( - private string $instanceId + private readonly string|int $instanceId ) { } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return "linode/instances/{$this->instanceId}/shutdown"; } diff --git a/src/Saloon/Requests/Instance/UpdateRequest.php b/src/Saloon/Requests/Instance/UpdateRequest.php index 4cf1312..ea337d3 100644 --- a/src/Saloon/Requests/Instance/UpdateRequest.php +++ b/src/Saloon/Requests/Instance/UpdateRequest.php @@ -4,28 +4,29 @@ namespace SamuelMwangiW\Linode\Saloon\Requests\Instance; -use Sammyjo20\Saloon\Constants\Saloon; -use Sammyjo20\Saloon\Traits\Plugins\HasJsonBody; +use Saloon\Contracts\Body\HasBody; +use Saloon\Enums\Method; +use Saloon\Traits\Body\HasJsonBody; use SamuelMwangiW\Linode\Saloon\Requests\AuthenticatedRequest; -class UpdateRequest extends AuthenticatedRequest +class UpdateRequest extends AuthenticatedRequest implements HasBody { use HasJsonBody; - protected ?string $method = Saloon::PUT; + protected Method $method = Method::PUT; public function __construct( - private string $instanceId, - private array $data, + private readonly string|int $instanceId, + private readonly array $data, ) { } - public function defaultData(): array + public function defaultBody(): array { return $this->data; } - public function defineEndpoint(): string + public function resolveEndpoint(): string { return "linode/instances/{$this->instanceId}"; } diff --git a/src/Saloon/Requests/Regions/ListRequest.php b/src/Saloon/Requests/Regions/ListRequest.php index 9eb0c9e..038ec5e 100644 --- a/src/Saloon/Requests/Regions/ListRequest.php +++ b/src/Saloon/Requests/Regions/ListRequest.php @@ -8,7 +8,7 @@ class ListRequest extends BaseRequest { - public function defineEndpoint(): string + public function resolveEndpoint(): string { return 'regions'; } diff --git a/tests/AccountTest.php b/tests/AccountTest.php index 9cb60ec..96b0a50 100644 --- a/tests/AccountTest.php +++ b/tests/AccountTest.php @@ -5,17 +5,20 @@ use SamuelMwangiW\Linode\DTO\AccountDTO; use SamuelMwangiW\Linode\Exceptions\CredentialsMissing; use SamuelMwangiW\Linode\Facades\Linode; +use SamuelMwangiW\Linode\Saloon\AuthenticatedConnector; use SamuelMwangiW\Linode\Saloon\Requests\Account\GetRequest; it('authenticate throws an exception when linode.config is not set', function () { config()->set('linode.token', ''); - GetRequest::make()->send()->throw(); + $request = GetRequest::make(); + + AuthenticatedConnector::make()->send($request)->throw(); })->throws(CredentialsMissing::class); it('linode returns an account') ->tap(fn () => fakeSaloonRequest(GetRequest::class)) ->expect(fn () => Linode::account()) ->toBeInstanceOf(AccountDTO::class) - ->company->toBe('mwangithegreat') - ->email->toBe('samuel@samuelmwangi.co.ke') - ->uid->toBe('D09103B1-20FE-11EA-B88C0CC47AEB2714'); + ->company->toBe('Test Company Unlimited') + ->email->toBe('user@example.com') + ->uid->toBe('D09103B1-FFFF-AAAA-B88C000000000004'); diff --git a/tests/Datasets/Firewall.php b/tests/Datasets/Firewall.php index 757eb51..32f7fad 100644 --- a/tests/Datasets/Firewall.php +++ b/tests/Datasets/Firewall.php @@ -2,5 +2,5 @@ declare(strict_types=1); -dataset('firewall-id', [71435]); -dataset('delete-id', [87488]); +dataset('firewall-id', [334556]); +dataset('delete-id', [334528]); diff --git a/tests/Datasets/Instance.php b/tests/Datasets/Instance.php index 2c5d497..3670776 100644 --- a/tests/Datasets/Instance.php +++ b/tests/Datasets/Instance.php @@ -2,13 +2,13 @@ declare(strict_types=1); -dataset('instance-id', [38948459]); -dataset('delete-instance-id', [38948357]); +dataset('instance-id', [54472202]); +dataset('delete-instance-id', [54472029]); dataset('image-id', ['linode/ubuntu20.04']); dataset( name: 'disk', dataset: [ - fn () => ['disk_id' => 61246188, 'label' => 'backup_disk', 'description' => 'Created in tests, delete'], + fn () => ['disk_id' => 48694547, 'label' => 'backup_disk', 'description' => 'Created in tests, delete'], ] ); @@ -20,7 +20,7 @@ 'image' => 'linode/ubuntu20.04', 'private_ip' => true, 'label' => 'pest-test-' . fake()->numerify(), - 'root_pass' => fake()->password(), + 'root_pass' => fake()->password(20), 'type' => 'g6-nanode-1', 'watchdog_enabled' => true, 'tags' => ['linode-sdk', 'test'], @@ -30,7 +30,7 @@ dataset('instance-clone', [ fn () => [ 'authorized_keys' => ['ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCo0z7DrPhlm6xFaexs+OhpVII3U3B36F6S/kmRlXGUeRkNOc4okmR8POAHAcctRM2c0kyDbhbX7E52efyEHvOCfvpjA23SIM+bxn0Do3az2lLZZQ3EDjgjkANHXPh4zOSPTYKMAivsT6JY521bQwDXa6oqrG36/wuJhHZWJLaCoq86KYpm2smcKe2W+5f/GWwXNNGBAqCfVA3MK0RbnTdyUL0AUJz3V+wLUAqqf3rSLJmthiKfvexxY1b9srhyM/V2R4zUplZgOl5FkQ8NVbHGSCHTx8q8vdDqMGTx1tdbvuiWsXnIIFoJHE4ZY7LVAbm+VoXmeiNpzn14xWNSM7hWh0AwAlZPviTVFAR+htffc45g2fIF9XDcvDFbCQBv3GpYMgcxMeE1IC4oLDbOhmDUgyonooY9ginmFM5HiVU8AaIKMqpBlX+618YHWD1GF2qL1IfQKiQXp+UvLHYOY9XpTjPyUw+Ku9BqCDiQma+ROhi39aAd/ZAWS5FOu3/s6Bk='], - 'authorized_users' => ['mwangithegreat'], + 'authorized_users' => ['test'], 'region' => 'eu-west', 'image' => 'linode/ubuntu20.04', 'private_ip' => true, diff --git a/tests/Fixtures/Saloon/delete/linode/instances/31294599.json b/tests/Fixtures/Saloon/delete/linode/instances/31294599.json new file mode 100644 index 0000000..f3ad0b6 --- /dev/null +++ b/tests/Fixtures/Saloon/delete/linode/instances/31294599.json @@ -0,0 +1 @@ +{"statusCode":200,"headers":{"Content-Type":"application\/json","Content-Length":"2","X-OAuth-Scopes":"*","X-Accepted-OAuth-Scopes":"linodes:read_write","X-Frame-Options":["DENY","DENY"],"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"HEAD, GET, OPTIONS, POST, PUT, DELETE","Access-Control-Allow-Headers":"Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter","X-Spec-Version":"4.171.0","X-Customer-UUID":"D09103B1-FFFF-AAAA-B88C000000000004","X-RateLimit-Limit":"400","X-RateLimit-Remaining":"399","X-RateLimit-Reset":"1706644595","Retry-After":"60","Access-Control-Allow-Credentials":"true","Access-Control-Expose-Headers":"X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status","Content-Security-Policy":"default-src 'none'","Vary":"Authorization, X-Filter","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Strict-Transport-Security":"max-age=31536000","Expires":"Tue, 30 Jan 2024 19:55:34 GMT","Cache-Control":"max-age=0, no-cache, no-store","Pragma":"no-cache","Date":"Tue, 30 Jan 2024 19:55:34 GMT","Connection":"keep-alive"},"data":"{}"} diff --git a/tests/Fixtures/Saloon/delete/networking/firewalls/29675.json b/tests/Fixtures/Saloon/delete/networking/firewalls/29675.json new file mode 100644 index 0000000..2da7706 --- /dev/null +++ b/tests/Fixtures/Saloon/delete/networking/firewalls/29675.json @@ -0,0 +1 @@ +{"statusCode":200,"headers":{"Content-Type":"application\/json","Content-Length":"2","X-OAuth-Scopes":"*","X-Accepted-OAuth-Scopes":"firewall:read_write","X-Frame-Options":["DENY","DENY"],"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"HEAD, GET, OPTIONS, POST, PUT, DELETE","Access-Control-Allow-Headers":"Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter","X-Spec-Version":"4.171.0","X-Customer-UUID":"D09103B1-FFFF-AAAA-B88C000000000004","X-RateLimit-Limit":"400","X-RateLimit-Remaining":"398","X-RateLimit-Reset":"1706631790","Retry-After":"0","Access-Control-Allow-Credentials":"true","Access-Control-Expose-Headers":"X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status","Content-Security-Policy":"default-src 'none'","Vary":"Authorization, X-Filter","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Strict-Transport-Security":"max-age=31536000","Expires":"Tue, 30 Jan 2024 16:23:09 GMT","Cache-Control":"max-age=0, no-cache, no-store","Pragma":"no-cache","Date":"Tue, 30 Jan 2024 16:23:09 GMT","Connection":"keep-alive"},"data":"{}"} diff --git a/tests/Fixtures/Saloon/get/account.json b/tests/Fixtures/Saloon/get/account.json new file mode 100644 index 0000000..34734b7 --- /dev/null +++ b/tests/Fixtures/Saloon/get/account.json @@ -0,0 +1,38 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "Content-Length": "680", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "account:read_only", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "Vary": [ + "Authorization, X-Filter", + "Authorization, X-Filter" + ], + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "399", + "X-RateLimit-Reset": "1706632201", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Expires": "Tue, 30 Jan 2024 16:29:01 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 16:29:01 GMT", + "Connection": "keep-alive" + }, + "data": "{\"company\": \"Test Company Unlimited\", \"email\": \"user@example.com\", \"first_name\": \"Samuel\", \"last_name\": \"Mwangi\", \"address_1\": \"P.O Box 123\", \"address_2\": \"\", \"city\": \"Nairobi\", \"state\": \"Nairobi City\", \"zip\": \"00100\", \"country\": \"KE\", \"phone\": \"\", \"balance\": 1000.0, \"tax_id\": \"\", \"billing_source\": \"linode\", \"credit_card\": {\"last_four\": \"1234\", \"expiry\": \"05\/2038\"}, \"balance_uninvoiced\": 0.09, \"active_since\": \"2007-08-19T09:18:33\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"LKE HA Control Planes\", \"Machine Images\", \"VPCs\"], \"active_promotions\": [], \"euuid\": \"D09103B1-FFFF-AAAA-B88C000000000004\"}" +} diff --git a/tests/Fixtures/Saloon/get/images.json b/tests/Fixtures/Saloon/get/images.json new file mode 100644 index 0000000..f1a6cb2 --- /dev/null +++ b/tests/Fixtures/Saloon/get/images.json @@ -0,0 +1,40 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "*", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "20", + "X-RateLimit-Remaining": "19", + "X-RateLimit-Reset": "1706642777", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Vary": [ + "authorization", + "x-filter", + "authorization", + "x-filter" + ], + "Expires": "Tue, 30 Jan 2024 19:25:16 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 19:25:16 GMT", + "Content-Length": "14034", + "Connection": "keep-alive" + }, + "data": "{\"data\": [{\"id\": \"linode\/almalinux8\", \"label\": \"AlmaLinux 8\", \"deprecated\": false, \"size\": 1700, \"created\": \"2021-05-18T14:28:38\", \"updated\": \"2023-12-06T21:13:45\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"AlmaLinux\", \"expiry\": null, \"eol\": \"2029-01-01T05:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/almalinux9\", \"label\": \"AlmaLinux 9\", \"deprecated\": false, \"size\": 1700, \"created\": \"2022-05-26T22:07:54\", \"updated\": \"2023-12-06T21:14:02\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"AlmaLinux\", \"expiry\": null, \"eol\": \"2032-05-31T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/alpine3.16\", \"label\": \"Alpine 3.16\", \"deprecated\": false, \"size\": 400, \"created\": \"2022-05-24T15:21:13\", \"updated\": \"2023-12-08T16:01:16\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Alpine\", \"expiry\": null, \"eol\": \"2024-05-23T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/alpine3.17\", \"label\": \"Alpine 3.17\", \"deprecated\": false, \"size\": 400, \"created\": \"2022-11-22T19:20:51\", \"updated\": \"2023-12-08T16:01:30\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Alpine\", \"expiry\": null, \"eol\": \"2024-11-22T05:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/alpine3.18\", \"label\": \"Alpine 3.18\", \"deprecated\": false, \"size\": 400, \"created\": \"2023-05-31T16:44:36\", \"updated\": \"2023-12-08T16:01:45\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Alpine\", \"expiry\": null, \"eol\": \"2025-05-09T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/alpine3.19\", \"label\": \"Alpine 3.19\", \"deprecated\": false, \"size\": 400, \"created\": \"2023-12-08T15:59:28\", \"updated\": \"2023-12-08T21:47:29\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Alpine\", \"expiry\": null, \"eol\": \"2025-11-01T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/arch\", \"label\": \"Arch Linux\", \"deprecated\": false, \"size\": 1500, \"created\": \"2016-06-13T20:31:34\", \"updated\": \"2023-12-11T17:33:30\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Arch\", \"expiry\": null, \"eol\": null, \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/centos7\", \"label\": \"CentOS 7\", \"deprecated\": false, \"size\": 2800, \"created\": \"2014-07-08T14:07:21\", \"updated\": \"2023-12-11T20:38:47\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"CentOS\", \"expiry\": null, \"eol\": \"2024-06-30T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/centos-stream8\", \"label\": \"CentOS Stream 8\", \"deprecated\": false, \"size\": 2600, \"created\": \"2021-01-21T19:52:49\", \"updated\": \"2023-12-11T20:39:05\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"CentOS\", \"expiry\": null, \"eol\": \"2024-05-31T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/centos-stream9\", \"label\": \"CentOS Stream 9\", \"deprecated\": false, \"size\": 1200, \"created\": \"2022-01-05T23:34:00\", \"updated\": \"2023-12-11T20:39:22\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"CentOS\", \"expiry\": null, \"eol\": \"2029-06-01T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/debian10\", \"label\": \"Debian 10\", \"deprecated\": false, \"size\": 1500, \"created\": \"2019-07-07T12:24:54\", \"updated\": \"2023-12-11T15:47:06\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Debian\", \"expiry\": null, \"eol\": \"2024-06-30T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/debian11\", \"label\": \"Debian 11\", \"deprecated\": false, \"size\": 1500, \"created\": \"2021-08-14T22:44:02\", \"updated\": \"2023-12-11T15:47:26\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Debian\", \"expiry\": null, \"eol\": \"2026-06-30T04:00:00\", \"status\": \"available\", \"capabilities\": [\"cloud-init\"]}, {\"id\": \"linode\/debian12\", \"label\": \"Debian 12\", \"deprecated\": false, \"size\": 1500, \"created\": \"2023-06-10T15:56:16\", \"updated\": \"2023-12-11T15:47:46\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Debian\", \"expiry\": null, \"eol\": \"2028-06-10T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/fedora38\", \"label\": \"Fedora 38\", \"deprecated\": false, \"size\": 1600, \"created\": \"2023-04-18T19:56:07\", \"updated\": \"2023-12-11T20:39:59\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Fedora\", \"expiry\": null, \"eol\": \"2024-05-14T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/fedora39\", \"label\": \"Fedora 39\", \"deprecated\": false, \"size\": 1800, \"created\": \"2023-11-07T17:51:27\", \"updated\": \"2023-12-11T20:40:17\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Fedora\", \"expiry\": null, \"eol\": \"2024-12-07T05:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/gentoo\", \"label\": \"Gentoo\", \"deprecated\": false, \"size\": 6500, \"created\": \"2016-10-25T17:31:25\", \"updated\": \"2023-12-19T17:46:59\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Gentoo\", \"expiry\": null, \"eol\": null, \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/kali\", \"label\": \"Kali Linux\", \"deprecated\": false, \"size\": 1536, \"created\": \"2022-02-28T17:08:42\", \"updated\": \"2023-12-06T18:17:09\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Kali\", \"expiry\": null, \"eol\": null, \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/debian11-kube-v1.26.1\", \"label\": \"Kubernetes 1.26.1 on Debian 11\", \"deprecated\": false, \"size\": 3500, \"created\": \"2023-03-02T22:29:06\", \"updated\": \"2023-03-02T22:29:06\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Debian\", \"expiry\": null, \"eol\": \"2026-07-01T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/debian11-kube-v1.26.12\", \"label\": \"Kubernetes 1.26.12 on Debian 11\", \"deprecated\": false, \"size\": 3500, \"created\": \"2024-01-04T15:10:25\", \"updated\": \"2024-01-04T15:10:25\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Debian\", \"expiry\": null, \"eol\": \"2026-07-01T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/debian11-kube-v1.26.3\", \"label\": \"Kubernetes 1.26.3 on Debian 11\", \"deprecated\": false, \"size\": 3500, \"created\": \"2023-03-31T13:27:47\", \"updated\": \"2023-03-31T14:24:28\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Debian\", \"expiry\": null, \"eol\": \"2026-07-01T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/debian11-kube-v1.27.5\", \"label\": \"Kubernetes 1.27.5 on Debian 11\", \"deprecated\": false, \"size\": 3500, \"created\": \"2023-09-06T17:13:46\", \"updated\": \"2023-09-06T17:13:46\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Debian\", \"expiry\": null, \"eol\": \"2026-07-01T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/debian11-kube-v1.27.9\", \"label\": \"Kubernetes 1.27.9 on Debian 11\", \"deprecated\": false, \"size\": 3500, \"created\": \"2024-01-04T15:09:04\", \"updated\": \"2024-01-04T15:10:35\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Debian\", \"expiry\": null, \"eol\": \"2026-07-01T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/debian11-kube-v1.28.3\", \"label\": \"Kubernetes 1.28.3 on Debian 11\", \"deprecated\": false, \"size\": 3500, \"created\": \"2023-11-21T19:38:58\", \"updated\": \"2023-11-21T19:38:58\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Debian\", \"expiry\": null, \"eol\": \"2026-07-01T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/opensuse15.5\", \"label\": \"openSUSE Leap 15.5\", \"deprecated\": false, \"size\": 1550, \"created\": \"2023-06-07T17:13:25\", \"updated\": \"2023-12-18T21:32:03\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"openSUSE\", \"expiry\": null, \"eol\": \"2024-12-07T05:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/rocky8\", \"label\": \"Rocky Linux 8\", \"deprecated\": false, \"size\": 2300, \"created\": \"2021-06-22T01:56:07\", \"updated\": \"2023-12-06T21:14:22\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Rocky\", \"expiry\": null, \"eol\": \"2029-05-31T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/rocky9\", \"label\": \"Rocky Linux 9\", \"deprecated\": false, \"size\": 2300, \"created\": \"2022-07-15T15:00:09\", \"updated\": \"2023-12-06T21:14:39\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Rocky\", \"expiry\": null, \"eol\": \"2032-05-31T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/slackware15.0\", \"label\": \"Slackware 15.0\", \"deprecated\": false, \"size\": 11000, \"created\": \"2022-02-04T23:25:47\", \"updated\": \"2023-12-14T19:52:17\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Slackware\", \"expiry\": null, \"eol\": null, \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/ubuntu20.04\", \"label\": \"Ubuntu 20.04 LTS\", \"deprecated\": false, \"size\": 2000, \"created\": \"2020-04-23T17:59:32\", \"updated\": \"2023-12-14T18:04:15\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Ubuntu\", \"expiry\": null, \"eol\": \"2025-04-23T04:00:00\", \"status\": \"available\", \"capabilities\": [\"cloud-init\"]}, {\"id\": \"linode\/ubuntu22.04\", \"label\": \"Ubuntu 22.04 LTS\", \"deprecated\": false, \"size\": 3500, \"created\": \"2022-04-21T16:57:06\", \"updated\": \"2023-12-14T18:04:32\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Ubuntu\", \"expiry\": null, \"eol\": \"2027-04-21T04:00:00\", \"status\": \"available\", \"capabilities\": [\"cloud-init\"]}, {\"id\": \"linode\/ubuntu23.04\", \"label\": \"Ubuntu 23.04\", \"deprecated\": false, \"size\": 3500, \"created\": \"2023-04-19T16:22:22\", \"updated\": \"2023-12-14T18:05:03\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Ubuntu\", \"expiry\": null, \"eol\": \"2024-01-20T05:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/ubuntu23.10\", \"label\": \"Ubuntu 23.10\", \"deprecated\": false, \"size\": 3500, \"created\": \"2023-10-12T16:36:39\", \"updated\": \"2023-12-14T18:05:19\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Ubuntu\", \"expiry\": null, \"eol\": \"2024-07-12T04:00:00\", \"status\": \"available\", \"capabilities\": [\"cloud-init\"]}, {\"id\": \"linode\/alpine3.15\", \"label\": \"Alpine 3.15\", \"deprecated\": true, \"size\": 400, \"created\": \"2021-11-24T16:58:12\", \"updated\": \"2024-01-03T18:22:30\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Alpine\", \"expiry\": null, \"eol\": \"2023-11-01T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/debian9\", \"label\": \"Debian 9\", \"deprecated\": true, \"size\": 1600, \"created\": \"2017-06-16T20:02:29\", \"updated\": \"2023-12-11T15:46:50\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Debian\", \"expiry\": null, \"eol\": \"2022-07-01T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/fedora37\", \"label\": \"Fedora 37\", \"deprecated\": true, \"size\": 1800, \"created\": \"2022-11-15T15:56:53\", \"updated\": \"2024-01-03T18:22:38\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Fedora\", \"expiry\": null, \"eol\": \"2023-12-15T05:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/opensuse15.4\", \"label\": \"openSUSE Leap 15.4\", \"deprecated\": true, \"size\": 1550, \"created\": \"2022-06-09T19:04:43\", \"updated\": \"2024-01-03T18:22:49\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"openSUSE\", \"expiry\": null, \"eol\": \"2023-12-07T05:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/slackware14.1\", \"label\": \"Slackware 14.1\", \"deprecated\": true, \"size\": 1000, \"created\": \"2013-11-25T16:11:02\", \"updated\": \"2013-11-25T16:11:02\", \"description\": null, \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Slackware\", \"expiry\": null, \"eol\": \"2024-01-01T05:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/slackware14.2\", \"label\": \"Slackware 14.2\", \"deprecated\": true, \"size\": 6000, \"created\": \"2016-10-13T13:14:34\", \"updated\": \"2024-01-03T18:26:26\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Slackware\", \"expiry\": null, \"eol\": \"2024-01-01T05:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/ubuntu16.04lts\", \"label\": \"Ubuntu 16.04 LTS\", \"deprecated\": true, \"size\": 2700, \"created\": \"2016-04-22T18:11:29\", \"updated\": \"2024-01-03T18:43:18\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Ubuntu\", \"expiry\": null, \"eol\": \"2026-04-23T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/ubuntu18.04\", \"label\": \"Ubuntu 18.04 LTS\", \"deprecated\": true, \"size\": 2700, \"created\": \"2018-04-26T22:23:37\", \"updated\": \"2024-01-03T18:42:43\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Ubuntu\", \"expiry\": null, \"eol\": \"2028-04-26T04:00:00\", \"status\": \"available\", \"capabilities\": []}, {\"id\": \"linode\/ubuntu22.10\", \"label\": \"Ubuntu 22.10\", \"deprecated\": true, \"size\": 3500, \"created\": \"2022-10-20T14:05:30\", \"updated\": \"2024-01-03T18:22:58\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Ubuntu\", \"expiry\": null, \"eol\": \"2023-07-20T04:00:00\", \"status\": \"available\", \"capabilities\": []}], \"page\": 1, \"pages\": 1, \"results\": 40}" +} diff --git a/tests/Fixtures/Saloon/get/images/linode/ubuntu20.04.json b/tests/Fixtures/Saloon/get/images/linode/ubuntu20.04.json new file mode 100644 index 0000000..d49f18c --- /dev/null +++ b/tests/Fixtures/Saloon/get/images/linode/ubuntu20.04.json @@ -0,0 +1 @@ +{"statusCode":200,"headers":{"Content-Type":"application\/json","Content-Length":"361","X-OAuth-Scopes":"*","X-Accepted-OAuth-Scopes":"images:read_only","X-Frame-Options":["DENY","DENY"],"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"HEAD, GET, OPTIONS, POST, PUT, DELETE","Access-Control-Allow-Headers":"Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter","X-Spec-Version":"4.171.0","Vary":["Authorization, X-Filter","Authorization, X-Filter"],"X-Customer-UUID":"D09103B1-FFFF-AAAA-B88C000000000004","X-RateLimit-Limit":"400","X-RateLimit-Remaining":"399","X-RateLimit-Reset":"1706642953","Retry-After":"60","Access-Control-Allow-Credentials":"true","Access-Control-Expose-Headers":"X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status","Content-Security-Policy":"default-src 'none'","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Strict-Transport-Security":"max-age=31536000","Expires":"Tue, 30 Jan 2024 19:28:12 GMT","Cache-Control":"max-age=0, no-cache, no-store","Pragma":"no-cache","Date":"Tue, 30 Jan 2024 19:28:12 GMT","Connection":"keep-alive"},"data":"{\"id\": \"linode\/ubuntu20.04\", \"label\": \"Ubuntu 20.04 LTS\", \"deprecated\": false, \"size\": 2000, \"created\": \"2020-04-23T17:59:32\", \"updated\": \"2023-12-14T18:04:15\", \"description\": \"\", \"created_by\": \"linode\", \"type\": \"manual\", \"is_public\": true, \"vendor\": \"Ubuntu\", \"expiry\": null, \"eol\": \"2025-04-23T04:00:00\", \"status\": \"available\", \"capabilities\": [\"cloud-init\"]}"} diff --git a/tests/Fixtures/Saloon/get/linode/instances.json b/tests/Fixtures/Saloon/get/linode/instances.json new file mode 100644 index 0000000..e606932 --- /dev/null +++ b/tests/Fixtures/Saloon/get/linode/instances.json @@ -0,0 +1,40 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "linodes:read_only", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "398", + "X-RateLimit-Reset": "1706643397", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Vary": [ + "authorization", + "x-filter", + "authorization", + "x-filter" + ], + "Expires": "Tue, 30 Jan 2024 19:35:37 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 19:35:37 GMT", + "Content-Length": "1564", + "Connection": "keep-alive" + }, + "data": "{\"data\": [{\"id\": 23969229, \"label\": \"mariadb\", \"group\": \"\", \"status\": \"running\", \"created\": \"2021-01-12T16:10:19\", \"updated\": \"2023-12-27T07:21:13\", \"type\": \"g6-nanode-1\", \"ipv4\": [\"1.1.1.1\", \"192.168.1.1\"], \"ipv6\": \"2a01:2a01::2a01:2a01:2a01:2a01\/128\", \"image\": \"linode\/ubuntu20.04\", \"region\": \"eu-west\", \"specs\": {\"disk\": 25600, \"memory\": 1024, \"vcpus\": 1, \"gpus\": 0, \"transfer\": 1000}, \"alerts\": {\"cpu\": 70, \"network_in\": 10, \"network_out\": 10, \"transfer_quota\": 80, \"io\": 10000}, \"backups\": {\"enabled\": false, \"available\": false, \"schedule\": {\"day\": null, \"window\": null}, \"last_successful\": null}, \"hypervisor\": \"kvm\", \"watchdog_enabled\": true, \"tags\": [\"production\"], \"host_uuid\": \"94ba71f7ae7d72483247f3e319d84a24645b283a\", \"has_user_data\": false}, {\"id\": 35328941, \"label\": \"insure-prod\", \"group\": \"\", \"status\": \"running\", \"created\": \"2022-03-12T19:52:55\", \"updated\": \"2024-01-12T18:34:39\", \"type\": \"g6-nanode-1\", \"ipv4\": [\"1.0.0.1\", \"192.168.6.9\"], \"ipv6\": \"2a01:2a01::2a01:2a01:2a01:2a02\/128\", \"image\": \"linode\/ubuntu20.04\", \"region\": \"eu-west\", \"specs\": {\"disk\": 25600, \"memory\": 1024, \"vcpus\": 1, \"gpus\": 0, \"transfer\": 1000}, \"alerts\": {\"cpu\": 90, \"network_in\": 10, \"network_out\": 10, \"transfer_quota\": 80, \"io\": 10000}, \"backups\": {\"enabled\": false, \"available\": false, \"schedule\": {\"day\": null, \"window\": null}, \"last_successful\": null}, \"hypervisor\": \"kvm\", \"watchdog_enabled\": true, \"tags\": [\"production\"], \"host_uuid\": \"654693bd6b52017b42d80802f0ac12d6a31712af\", \"has_user_data\": false}], \"page\": 1, \"pages\": 1, \"results\": 2}" +} diff --git a/tests/Fixtures/Saloon/get/linode/instances/31293947.json b/tests/Fixtures/Saloon/get/linode/instances/31293947.json new file mode 100644 index 0000000..079e361 --- /dev/null +++ b/tests/Fixtures/Saloon/get/linode/instances/31293947.json @@ -0,0 +1,38 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "Content-Length": "755", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "linodes:read_only", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "Vary": [ + "Authorization, X-Filter", + "Authorization, X-Filter" + ], + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "398", + "X-RateLimit-Reset": "1706643748", + "Retry-After": "14", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Expires": "Tue, 30 Jan 2024 19:42:13 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 19:42:13 GMT", + "Connection": "keep-alive" + }, + "data": "{\"id\": 23969229, \"label\": \"mariadb\", \"group\": \"\", \"status\": \"running\", \"created\": \"2021-01-12T16:10:19\", \"updated\": \"2023-12-27T07:21:13\", \"type\": \"g6-nanode-1\", \"ipv4\": [\"1.1.1.1\", \"192.168.1.1\"], \"ipv6\": \"2a01:2a01::2a01:2a01:2a01:2a01\/128\", \"image\": \"linode\/ubuntu20.04\", \"region\": \"eu-west\", \"specs\": {\"disk\": 25600, \"memory\": 1024, \"vcpus\": 1, \"gpus\": 0, \"transfer\": 1000}, \"alerts\": {\"cpu\": 70, \"network_in\": 10, \"network_out\": 10, \"transfer_quota\": 80, \"io\": 10000}, \"backups\": {\"enabled\": false, \"available\": false, \"schedule\": {\"day\": null, \"window\": null}, \"last_successful\": null}, \"hypervisor\": \"kvm\", \"watchdog_enabled\": true, \"tags\": [\"production\"], \"host_uuid\": \"94ba71f7ae7d72483247f3e319d84a24645b283a\", \"has_user_data\": false}" +} diff --git a/tests/Fixtures/Saloon/get/linode/instances/31293947/disks.json b/tests/Fixtures/Saloon/get/linode/instances/31293947/disks.json new file mode 100644 index 0000000..181b6ba --- /dev/null +++ b/tests/Fixtures/Saloon/get/linode/instances/31293947/disks.json @@ -0,0 +1 @@ +{"statusCode":200,"headers":{"Content-Type":"application\/json","Content-Length":"394","X-OAuth-Scopes":"*","X-Accepted-OAuth-Scopes":"linodes:read_only","X-Frame-Options":["DENY","DENY"],"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"HEAD, GET, OPTIONS, POST, PUT, DELETE","Access-Control-Allow-Headers":"Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter","X-Spec-Version":"4.171.0","Vary":["Authorization, X-Filter","Authorization, X-Filter"],"X-Customer-UUID":"D09103B1-FFFF-AAAA-B88C000000000004","X-RateLimit-Limit":"400","X-RateLimit-Remaining":"399","X-RateLimit-Reset":"1706643925","Retry-After":"60","Access-Control-Allow-Credentials":"true","Access-Control-Expose-Headers":"X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status","Content-Security-Policy":"default-src 'none'","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Strict-Transport-Security":"max-age=31536000","Expires":"Tue, 30 Jan 2024 19:44:24 GMT","Cache-Control":"max-age=0, no-cache, no-store","Pragma":"no-cache","Date":"Tue, 30 Jan 2024 19:44:24 GMT","Connection":"keep-alive"},"data":"{\"data\": [{\"id\": 48694547, \"status\": \"ready\", \"label\": \"Ubuntu 20.04 LTS Disk\", \"created\": \"2021-01-12T16:10:21\", \"updated\": \"2022-03-14T08:36:57\", \"filesystem\": \"ext4\", \"size\": 24088}, {\"id\": 48694548, \"status\": \"ready\", \"label\": \"512 MB Swap Image\", \"created\": \"2021-01-12T16:10:21\", \"updated\": \"2022-03-14T08:37:19\", \"filesystem\": \"swap\", \"size\": 1512}], \"page\": 1, \"pages\": 1, \"results\": 2}"} diff --git a/tests/Fixtures/Saloon/get/linode/types.json b/tests/Fixtures/Saloon/get/linode/types.json new file mode 100644 index 0000000..0e407b7 --- /dev/null +++ b/tests/Fixtures/Saloon/get/linode/types.json @@ -0,0 +1,39 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "X-OAuth-Scopes": "unknown", + "X-Accepted-OAuth-Scopes": "*", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "399", + "X-RateLimit-Reset": "1706645162", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Vary": [ + "authorization", + "x-filter", + "authorization", + "x-filter" + ], + "Expires": "Tue, 30 Jan 2024 20:05:02 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 20:05:02 GMT", + "Content-Length": "19677", + "Connection": "keep-alive" + }, + "data": "{\"data\": [{\"id\": \"g6-nanode-1\", \"label\": \"Nanode 1GB\", \"price\": {\"hourly\": 0.0075, \"monthly\": 5.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.009, \"monthly\": 6.0}, {\"id\": \"br-gru\", \"hourly\": 0.0105, \"monthly\": 7.0}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.003, \"monthly\": 2.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.0036, \"monthly\": 2.4}, {\"id\": \"br-gru\", \"hourly\": 0.004, \"monthly\": 2.8}]}}, \"memory\": 1024, \"disk\": 25600, \"transfer\": 1000, \"vcpus\": 1, \"gpus\": 0, \"network_out\": 1000, \"class\": \"nanode\", \"successor\": null}, {\"id\": \"g6-standard-1\", \"label\": \"Linode 2GB\", \"price\": {\"hourly\": 0.018, \"monthly\": 12.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.022, \"monthly\": 14.4}, {\"id\": \"br-gru\", \"hourly\": 0.025, \"monthly\": 16.8}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.004, \"monthly\": 2.5}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.0045, \"monthly\": 3.0}, {\"id\": \"br-gru\", \"hourly\": 0.005, \"monthly\": 3.5}]}}, \"memory\": 2048, \"disk\": 51200, \"transfer\": 2000, \"vcpus\": 1, \"gpus\": 0, \"network_out\": 2000, \"class\": \"standard\", \"successor\": null}, {\"id\": \"g6-standard-2\", \"label\": \"Linode 4GB\", \"price\": {\"hourly\": 0.036, \"monthly\": 24.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.043, \"monthly\": 28.8}, {\"id\": \"br-gru\", \"hourly\": 0.05, \"monthly\": 33.6}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.008, \"monthly\": 5.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.009, \"monthly\": 6.0}, {\"id\": \"br-gru\", \"hourly\": 0.01, \"monthly\": 7.0}]}}, \"memory\": 4096, \"disk\": 81920, \"transfer\": 4000, \"vcpus\": 2, \"gpus\": 0, \"network_out\": 4000, \"class\": \"standard\", \"successor\": null}, {\"id\": \"g6-standard-4\", \"label\": \"Linode 8GB\", \"price\": {\"hourly\": 0.072, \"monthly\": 48.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.086, \"monthly\": 57.6}, {\"id\": \"br-gru\", \"hourly\": 0.101, \"monthly\": 67.2}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.015, \"monthly\": 10.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.018, \"monthly\": 12.0}, {\"id\": \"br-gru\", \"hourly\": 0.021, \"monthly\": 14.0}]}}, \"memory\": 8192, \"disk\": 163840, \"transfer\": 5000, \"vcpus\": 4, \"gpus\": 0, \"network_out\": 5000, \"class\": \"standard\", \"successor\": null}, {\"id\": \"g6-standard-6\", \"label\": \"Linode 16GB\", \"price\": {\"hourly\": 0.144, \"monthly\": 96.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.173, \"monthly\": 115.2}, {\"id\": \"br-gru\", \"hourly\": 0.202, \"monthly\": 134.4}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.03, \"monthly\": 20.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.036, \"monthly\": 24.0}, {\"id\": \"br-gru\", \"hourly\": 0.042, \"monthly\": 28.0}]}}, \"memory\": 16384, \"disk\": 327680, \"transfer\": 8000, \"vcpus\": 6, \"gpus\": 0, \"network_out\": 6000, \"class\": \"standard\", \"successor\": null}, {\"id\": \"g6-standard-8\", \"label\": \"Linode 32GB\", \"price\": {\"hourly\": 0.288, \"monthly\": 192.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.346, \"monthly\": 230.4}, {\"id\": \"br-gru\", \"hourly\": 0.403, \"monthly\": 268.8}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.06, \"monthly\": 40.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.072, \"monthly\": 48.0}, {\"id\": \"br-gru\", \"hourly\": 0.084, \"monthly\": 56.0}]}}, \"memory\": 32768, \"disk\": 655360, \"transfer\": 16000, \"vcpus\": 8, \"gpus\": 0, \"network_out\": 7000, \"class\": \"standard\", \"successor\": null}, {\"id\": \"g6-standard-16\", \"label\": \"Linode 64GB\", \"price\": {\"hourly\": 0.576, \"monthly\": 384.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.691, \"monthly\": 460.8}, {\"id\": \"br-gru\", \"hourly\": 0.806, \"monthly\": 537.6}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.12, \"monthly\": 80.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.144, \"monthly\": 96.0}, {\"id\": \"br-gru\", \"hourly\": 0.168, \"monthly\": 112.0}]}}, \"memory\": 65536, \"disk\": 1310720, \"transfer\": 20000, \"vcpus\": 16, \"gpus\": 0, \"network_out\": 9000, \"class\": \"standard\", \"successor\": null}, {\"id\": \"g6-standard-20\", \"label\": \"Linode 96GB\", \"price\": {\"hourly\": 0.864, \"monthly\": 576.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 1.037, \"monthly\": 691.2}, {\"id\": \"br-gru\", \"hourly\": 1.21, \"monthly\": 806.4}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.18, \"monthly\": 120.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.216, \"monthly\": 144.0}, {\"id\": \"br-gru\", \"hourly\": 0.252, \"monthly\": 168.0}]}}, \"memory\": 98304, \"disk\": 1966080, \"transfer\": 20000, \"vcpus\": 20, \"gpus\": 0, \"network_out\": 10000, \"class\": \"standard\", \"successor\": null}, {\"id\": \"g6-standard-24\", \"label\": \"Linode 128GB\", \"price\": {\"hourly\": 1.152, \"monthly\": 768.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 1.382, \"monthly\": 921.6}, {\"id\": \"br-gru\", \"hourly\": 1.613, \"monthly\": 1075.2}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.24, \"monthly\": 160.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.288, \"monthly\": 192.0}, {\"id\": \"br-gru\", \"hourly\": 0.336, \"monthly\": 224.0}]}}, \"memory\": 131072, \"disk\": 2621440, \"transfer\": 20000, \"vcpus\": 24, \"gpus\": 0, \"network_out\": 11000, \"class\": \"standard\", \"successor\": null}, {\"id\": \"g6-standard-32\", \"label\": \"Linode 192GB\", \"price\": {\"hourly\": 1.728, \"monthly\": 1152.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 2.074, \"monthly\": 1382.4}, {\"id\": \"br-gru\", \"hourly\": 2.419, \"monthly\": 1612.8}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.36, \"monthly\": 240.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.432, \"monthly\": 288.0}, {\"id\": \"br-gru\", \"hourly\": 0.504, \"monthly\": 336.0}]}}, \"memory\": 196608, \"disk\": 3932160, \"transfer\": 20000, \"vcpus\": 32, \"gpus\": 0, \"network_out\": 12000, \"class\": \"standard\", \"successor\": null}, {\"id\": \"g7-highmem-1\", \"label\": \"Linode 24GB\", \"price\": {\"hourly\": 0.09, \"monthly\": 60.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.108, \"monthly\": 72.0}, {\"id\": \"br-gru\", \"hourly\": 0.126, \"monthly\": 84.0}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.0075, \"monthly\": 5.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.009, \"monthly\": 6.0}, {\"id\": \"br-gru\", \"hourly\": 0.0105, \"monthly\": 7.0}]}}, \"memory\": 24576, \"disk\": 20480, \"transfer\": 5000, \"vcpus\": 2, \"gpus\": 0, \"network_out\": 5000, \"class\": \"highmem\", \"successor\": null}, {\"id\": \"g7-highmem-2\", \"label\": \"Linode 48GB\", \"price\": {\"hourly\": 0.18, \"monthly\": 120.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.216, \"monthly\": 144.0}, {\"id\": \"br-gru\", \"hourly\": 0.252, \"monthly\": 168.0}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.015, \"monthly\": 10.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.018, \"monthly\": 12.0}, {\"id\": \"br-gru\", \"hourly\": 0.021, \"monthly\": 14.0}]}}, \"memory\": 49152, \"disk\": 40960, \"transfer\": 6000, \"vcpus\": 2, \"gpus\": 0, \"network_out\": 6000, \"class\": \"highmem\", \"successor\": null}, {\"id\": \"g7-highmem-4\", \"label\": \"Linode 90GB\", \"price\": {\"hourly\": 0.36, \"monthly\": 240.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.432, \"monthly\": 288.0}, {\"id\": \"br-gru\", \"hourly\": 0.504, \"monthly\": 336.0}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.03, \"monthly\": 20.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.036, \"monthly\": 24.0}, {\"id\": \"br-gru\", \"hourly\": 0.042, \"monthly\": 28.0}]}}, \"memory\": 92160, \"disk\": 92160, \"transfer\": 7000, \"vcpus\": 4, \"gpus\": 0, \"network_out\": 7000, \"class\": \"highmem\", \"successor\": null}, {\"id\": \"g7-highmem-8\", \"label\": \"Linode 150GB\", \"price\": {\"hourly\": 0.72, \"monthly\": 480.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.864, \"monthly\": 576.0}, {\"id\": \"br-gru\", \"hourly\": 1.008, \"monthly\": 672.0}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.06, \"monthly\": 40.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.072, \"monthly\": 48.0}, {\"id\": \"br-gru\", \"hourly\": 0.084, \"monthly\": 56.0}]}}, \"memory\": 153600, \"disk\": 204800, \"transfer\": 8000, \"vcpus\": 8, \"gpus\": 0, \"network_out\": 8000, \"class\": \"highmem\", \"successor\": null}, {\"id\": \"g7-highmem-16\", \"label\": \"Linode 300GB\", \"price\": {\"hourly\": 1.44, \"monthly\": 960.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 1.728, \"monthly\": 1152.0}, {\"id\": \"br-gru\", \"hourly\": 2.016, \"monthly\": 1344.0}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.12, \"monthly\": 80.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.144, \"monthly\": 96.0}, {\"id\": \"br-gru\", \"hourly\": 0.168, \"monthly\": 112.0}]}}, \"memory\": 307200, \"disk\": 348160, \"transfer\": 9000, \"vcpus\": 16, \"gpus\": 0, \"network_out\": 9000, \"class\": \"highmem\", \"successor\": null}, {\"id\": \"g6-dedicated-2\", \"label\": \"Dedicated 4GB\", \"price\": {\"hourly\": 0.054, \"monthly\": 36.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.065, \"monthly\": 43.2}, {\"id\": \"br-gru\", \"hourly\": 0.076, \"monthly\": 50.4}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.008, \"monthly\": 5.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.009, \"monthly\": 6.0}, {\"id\": \"br-gru\", \"hourly\": 0.01, \"monthly\": 7.0}]}}, \"memory\": 4096, \"disk\": 81920, \"transfer\": 4000, \"vcpus\": 2, \"gpus\": 0, \"network_out\": 4000, \"class\": \"dedicated\", \"successor\": null}, {\"id\": \"g6-dedicated-4\", \"label\": \"Dedicated 8GB\", \"price\": {\"hourly\": 0.108, \"monthly\": 72.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.13, \"monthly\": 86.4}, {\"id\": \"br-gru\", \"hourly\": 0.151, \"monthly\": 100.8}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.015, \"monthly\": 10.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.018, \"monthly\": 12.0}, {\"id\": \"br-gru\", \"hourly\": 0.021, \"monthly\": 14.0}]}}, \"memory\": 8192, \"disk\": 163840, \"transfer\": 5000, \"vcpus\": 4, \"gpus\": 0, \"network_out\": 5000, \"class\": \"dedicated\", \"successor\": null}, {\"id\": \"g6-dedicated-8\", \"label\": \"Dedicated 16GB\", \"price\": {\"hourly\": 0.216, \"monthly\": 144.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.259, \"monthly\": 172.8}, {\"id\": \"br-gru\", \"hourly\": 0.302, \"monthly\": 201.6}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.03, \"monthly\": 20.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.036, \"monthly\": 24.0}, {\"id\": \"br-gru\", \"hourly\": 0.042, \"monthly\": 28.0}]}}, \"memory\": 16384, \"disk\": 327680, \"transfer\": 6000, \"vcpus\": 8, \"gpus\": 0, \"network_out\": 6000, \"class\": \"dedicated\", \"successor\": null}, {\"id\": \"g6-dedicated-16\", \"label\": \"Dedicated 32GB\", \"price\": {\"hourly\": 0.432, \"monthly\": 288.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.518, \"monthly\": 345.6}, {\"id\": \"br-gru\", \"hourly\": 0.605, \"monthly\": 403.2}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.06, \"monthly\": 40.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.072, \"monthly\": 48.0}, {\"id\": \"br-gru\", \"hourly\": 0.084, \"monthly\": 56.0}]}}, \"memory\": 32768, \"disk\": 655360, \"transfer\": 7000, \"vcpus\": 16, \"gpus\": 0, \"network_out\": 7000, \"class\": \"dedicated\", \"successor\": null}, {\"id\": \"g6-dedicated-32\", \"label\": \"Dedicated 64GB\", \"price\": {\"hourly\": 0.864, \"monthly\": 576.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 1.037, \"monthly\": 691.2}, {\"id\": \"br-gru\", \"hourly\": 1.21, \"monthly\": 806.4}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.12, \"monthly\": 80.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.144, \"monthly\": 96.0}, {\"id\": \"br-gru\", \"hourly\": 0.168, \"monthly\": 112.0}]}}, \"memory\": 65536, \"disk\": 1310720, \"transfer\": 8000, \"vcpus\": 32, \"gpus\": 0, \"network_out\": 8000, \"class\": \"dedicated\", \"successor\": null}, {\"id\": \"g6-dedicated-48\", \"label\": \"Dedicated 96GB\", \"price\": {\"hourly\": 1.296, \"monthly\": 864.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 1.555, \"monthly\": 1036.8}, {\"id\": \"br-gru\", \"hourly\": 1.814, \"monthly\": 1209.6}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.18, \"monthly\": 120.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.216, \"monthly\": 144.0}, {\"id\": \"br-gru\", \"hourly\": 0.252, \"monthly\": 168.0}]}}, \"memory\": 98304, \"disk\": 1966080, \"transfer\": 9000, \"vcpus\": 48, \"gpus\": 0, \"network_out\": 9000, \"class\": \"dedicated\", \"successor\": null}, {\"id\": \"g6-dedicated-50\", \"label\": \"Dedicated 128GB\", \"price\": {\"hourly\": 1.728, \"monthly\": 1152.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 2.074, \"monthly\": 1382.4}, {\"id\": \"br-gru\", \"hourly\": 2.419, \"monthly\": 1612.8}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.24, \"monthly\": 160.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.288, \"monthly\": 192.0}, {\"id\": \"br-gru\", \"hourly\": 0.336, \"monthly\": 224.0}]}}, \"memory\": 131072, \"disk\": 2560000, \"transfer\": 10000, \"vcpus\": 50, \"gpus\": 0, \"network_out\": 10000, \"class\": \"dedicated\", \"successor\": null}, {\"id\": \"g6-dedicated-56\", \"label\": \"Dedicated 256GB\", \"price\": {\"hourly\": 3.456, \"monthly\": 2304.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 4.147, \"monthly\": 2764.8}, {\"id\": \"br-gru\", \"hourly\": 4.838, \"monthly\": 3225.6}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.3, \"monthly\": 200.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.36, \"monthly\": 240.0}, {\"id\": \"br-gru\", \"hourly\": 0.42, \"monthly\": 280.0}]}}, \"memory\": 262144, \"disk\": 5120000, \"transfer\": 11000, \"vcpus\": 56, \"gpus\": 0, \"network_out\": 11000, \"class\": \"dedicated\", \"successor\": null}, {\"id\": \"g6-dedicated-64\", \"label\": \"Dedicated 512GB\", \"price\": {\"hourly\": 6.912, \"monthly\": 4608.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 8.294, \"monthly\": 5529.6}, {\"id\": \"br-gru\", \"hourly\": 9.677, \"monthly\": 6451.2}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.36, \"monthly\": 240.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.432, \"monthly\": 288.0}, {\"id\": \"br-gru\", \"hourly\": 0.504, \"monthly\": 336.0}]}}, \"memory\": 524288, \"disk\": 7372800, \"transfer\": 12000, \"vcpus\": 64, \"gpus\": 0, \"network_out\": 12000, \"class\": \"dedicated\", \"successor\": null}, {\"id\": \"g1-gpu-rtx6000-1\", \"label\": \"Dedicated 32GB + RTX6000 GPU x1\", \"price\": {\"hourly\": 1.5, \"monthly\": 1000.0}, \"region_prices\": [], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.06, \"monthly\": 40.0}, \"region_prices\": []}}, \"memory\": 32768, \"disk\": 655360, \"transfer\": 16000, \"vcpus\": 8, \"gpus\": 1, \"network_out\": 10000, \"class\": \"gpu\", \"successor\": null}, {\"id\": \"g1-gpu-rtx6000-2\", \"label\": \"Dedicated 64GB + RTX6000 GPU x2\", \"price\": {\"hourly\": 3.0, \"monthly\": 2000.0}, \"region_prices\": [], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.12, \"monthly\": 80.0}, \"region_prices\": []}}, \"memory\": 65536, \"disk\": 1310720, \"transfer\": 20000, \"vcpus\": 16, \"gpus\": 2, \"network_out\": 10000, \"class\": \"gpu\", \"successor\": null}, {\"id\": \"g1-gpu-rtx6000-3\", \"label\": \"Dedicated 96GB + RTX6000 GPU x3\", \"price\": {\"hourly\": 4.5, \"monthly\": 3000.0}, \"region_prices\": [], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.18, \"monthly\": 120.0}, \"region_prices\": []}}, \"memory\": 98304, \"disk\": 1966080, \"transfer\": 20000, \"vcpus\": 20, \"gpus\": 3, \"network_out\": 10000, \"class\": \"gpu\", \"successor\": null}, {\"id\": \"g1-gpu-rtx6000-4\", \"label\": \"Dedicated 128GB + RTX6000 GPU x4\", \"price\": {\"hourly\": 6.0, \"monthly\": 4000.0}, \"region_prices\": [], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.24, \"monthly\": 160.0}, \"region_prices\": []}}, \"memory\": 131072, \"disk\": 2621440, \"transfer\": 20000, \"vcpus\": 24, \"gpus\": 4, \"network_out\": 10000, \"class\": \"gpu\", \"successor\": null}, {\"id\": \"g7-premium-2\", \"label\": \"Premium 4GB\", \"price\": {\"hourly\": 0.0645, \"monthly\": 43.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.078, \"monthly\": 51.84}, {\"id\": \"br-gru\", \"hourly\": 0.091, \"monthly\": 60.48}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.008, \"monthly\": 5.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.009, \"monthly\": 6.0}, {\"id\": \"br-gru\", \"hourly\": 0.01, \"monthly\": 7.0}]}}, \"memory\": 4096, \"disk\": 81920, \"transfer\": 4000, \"vcpus\": 2, \"gpus\": 0, \"network_out\": 4000, \"class\": \"premium\", \"successor\": null}, {\"id\": \"g7-premium-4\", \"label\": \"Premium 8GB\", \"price\": {\"hourly\": 0.129, \"monthly\": 86.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.156, \"monthly\": 103.68}, {\"id\": \"br-gru\", \"hourly\": 0.181, \"monthly\": 120.96}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.015, \"monthly\": 10.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.018, \"monthly\": 12.0}, {\"id\": \"br-gru\", \"hourly\": 0.021, \"monthly\": 14.0}]}}, \"memory\": 8192, \"disk\": 163840, \"transfer\": 5000, \"vcpus\": 4, \"gpus\": 0, \"network_out\": 5000, \"class\": \"premium\", \"successor\": null}, {\"id\": \"g7-premium-8\", \"label\": \"Premium 16GB\", \"price\": {\"hourly\": 0.2595, \"monthly\": 173.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.311, \"monthly\": 207.36}, {\"id\": \"br-gru\", \"hourly\": 0.363, \"monthly\": 241.92}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.03, \"monthly\": 20.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.036, \"monthly\": 24.0}, {\"id\": \"br-gru\", \"hourly\": 0.042, \"monthly\": 28.0}]}}, \"memory\": 16384, \"disk\": 327680, \"transfer\": 6000, \"vcpus\": 8, \"gpus\": 0, \"network_out\": 6000, \"class\": \"premium\", \"successor\": null}, {\"id\": \"g7-premium-16\", \"label\": \"Premium 32GB\", \"price\": {\"hourly\": 0.519, \"monthly\": 346.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.622, \"monthly\": 414.72}, {\"id\": \"br-gru\", \"hourly\": 0.726, \"monthly\": 483.84}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.06, \"monthly\": 40.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.072, \"monthly\": 48.0}, {\"id\": \"br-gru\", \"hourly\": 0.084, \"monthly\": 56.0}]}}, \"memory\": 32768, \"disk\": 655360, \"transfer\": 7000, \"vcpus\": 16, \"gpus\": 0, \"network_out\": 7000, \"class\": \"premium\", \"successor\": null}, {\"id\": \"g7-premium-32\", \"label\": \"Premium 64GB\", \"price\": {\"hourly\": 1.0365, \"monthly\": 691.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 1.244, \"monthly\": 829.44}, {\"id\": \"br-gru\", \"hourly\": 1.452, \"monthly\": 967.68}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.12, \"monthly\": 80.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.144, \"monthly\": 96.0}, {\"id\": \"br-gru\", \"hourly\": 0.168, \"monthly\": 112.0}]}}, \"memory\": 65536, \"disk\": 1310720, \"transfer\": 8000, \"vcpus\": 32, \"gpus\": 0, \"network_out\": 8000, \"class\": \"premium\", \"successor\": null}, {\"id\": \"g7-premium-48\", \"label\": \"Premium 96GB\", \"price\": {\"hourly\": 1.5555, \"monthly\": 1037.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 1.866, \"monthly\": 1244.16}, {\"id\": \"br-gru\", \"hourly\": 2.177, \"monthly\": 1451.52}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.18, \"monthly\": 120.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.216, \"monthly\": 144.0}, {\"id\": \"br-gru\", \"hourly\": 0.252, \"monthly\": 168.0}]}}, \"memory\": 98304, \"disk\": 1966080, \"transfer\": 9000, \"vcpus\": 48, \"gpus\": 0, \"network_out\": 9000, \"class\": \"premium\", \"successor\": null}, {\"id\": \"g7-premium-50\", \"label\": \"Premium 128GB\", \"price\": {\"hourly\": 2.073, \"monthly\": 1382.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 2.488, \"monthly\": 1658.88}, {\"id\": \"br-gru\", \"hourly\": 2.903, \"monthly\": 1935.36}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.24, \"monthly\": 160.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.288, \"monthly\": 192.0}, {\"id\": \"br-gru\", \"hourly\": 0.336, \"monthly\": 224.0}]}}, \"memory\": 131072, \"disk\": 2560000, \"transfer\": 10000, \"vcpus\": 50, \"gpus\": 0, \"network_out\": 10000, \"class\": \"premium\", \"successor\": null}, {\"id\": \"g7-premium-56\", \"label\": \"Premium 256GB\", \"price\": {\"hourly\": 4.1475, \"monthly\": 2765.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 4.977, \"monthly\": 3317.76}, {\"id\": \"br-gru\", \"hourly\": 5.806, \"monthly\": 3870.72}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.3, \"monthly\": 200.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.36, \"monthly\": 240.0}, {\"id\": \"br-gru\", \"hourly\": 0.42, \"monthly\": 280.0}]}}, \"memory\": 262144, \"disk\": 5120000, \"transfer\": 11000, \"vcpus\": 56, \"gpus\": 0, \"network_out\": 11000, \"class\": \"premium\", \"successor\": null}, {\"id\": \"g7-premium-64\", \"label\": \"Premium 512GB\", \"price\": {\"hourly\": 8.295, \"monthly\": 5530.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 9.953, \"monthly\": 6635.52}, {\"id\": \"br-gru\", \"hourly\": 11.612, \"monthly\": 7741.44}], \"addons\": {\"backups\": {\"price\": {\"hourly\": 0.36, \"monthly\": 240.0}, \"region_prices\": [{\"id\": \"id-cgk\", \"hourly\": 0.432, \"monthly\": 288.0}, {\"id\": \"br-gru\", \"hourly\": 0.504, \"monthly\": 336.0}]}}, \"memory\": 524288, \"disk\": 7372800, \"transfer\": 12000, \"vcpus\": 64, \"gpus\": 0, \"network_out\": 12000, \"class\": \"premium\", \"successor\": null}], \"page\": 1, \"pages\": 1, \"results\": 37}" +} diff --git a/tests/Fixtures/Saloon/get/networking/firewalls.json b/tests/Fixtures/Saloon/get/networking/firewalls.json new file mode 100644 index 0000000..df94682 --- /dev/null +++ b/tests/Fixtures/Saloon/get/networking/firewalls.json @@ -0,0 +1,40 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "firewall:read_only", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "399", + "X-RateLimit-Reset": "1706630644", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Vary": [ + "authorization", + "x-filter", + "authorization", + "x-filter" + ], + "Expires": "Tue, 30 Jan 2024 16:03:03 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 20 Apr 2420 16:03:03 GMT", + "Content-Length": "4273", + "Connection": "keep-alive" + }, + "data": "{\"data\": [{\"id\": 1096, \"label\": \"webservers\", \"created\": \"2021-05-24T20:55:22\", \"updated\": \"2024-01-26T10:33:27\", \"status\": \"enabled\", \"rules\": {\"inbound\": [{\"ports\": \"\", \"protocol\": \"TCP\", \"addresses\": {\"ipv6\": [\"::\/0\"]}, \"action\": \"DROP\", \"label\": \"no-v6\"}, {\"ports\": \"1-65535\", \"protocol\": \"TCP\", \"addresses\": {\"ipv4\": [\"127.0.0.1\/8\"]}, \"action\": \"ACCEPT\", \"label\": \"allow-local\", \"description\": \"Allow local IPS\"}, {\"ports\": \"80, 443\", \"protocol\": \"TCP\", \"addresses\": {\"ipv4\": [\"173.245.48.0\/20\", \"103.21.244.0\/22\", \"103.22.200.0\/22\", \"103.31.4.0\/22\", \"141.101.64.0\/18\", \"108.162.192.0\/18\", \"190.93.240.0\/20\", \"188.114.96.0\/20\", \"197.234.240.0\/22\", \"198.41.128.0\/17\", \"162.158.0.0\/15\", \"104.16.0.0\/13\", \"104.24.0.0\/14\", \"172.64.0.0\/13\", \"131.0.72.0\/22\"]}, \"action\": \"ACCEPT\", \"label\": \"accept-inbound-http-s-cloudflare\"}, {\"action\": \"ACCEPT\", \"addresses\": {\"ipv4\": [\"0.0.0.0\/0\"]}, \"ports\": \"18534\", \"protocol\": \"TCP\", \"label\": \"accept-inbound-SSH-18534\", \"description\": null}, {\"action\": \"ACCEPT\", \"addresses\": {\"ipv4\": [\"0.0.0.0\/0\"]}, \"ports\": \"22\", \"protocol\": \"TCP\", \"label\": \"accept-inbound-SSH\", \"description\": null}, {\"action\": \"ACCEPT\", \"addresses\": {\"ipv4\": [\"0.0.0.0\/0\"]}, \"ports\": \"80, 443\", \"protocol\": \"TCP\", \"label\": \"accept-inbound-HTTPS\", \"description\": null}], \"outbound\": [], \"inbound_policy\": \"DROP\", \"outbound_policy\": \"ACCEPT\"}, \"tags\": [], \"entities\": [{\"id\": 35328941, \"type\": \"linode\", \"label\": \"worker1-prod\", \"url\": \"\/v4\/linode\/instances\/87654321\"}]}, {\"id\": 6969, \"label\": \"databases\", \"created\": \"2021-08-04T06:49:32\", \"updated\": \"2024-01-23T21:14:22\", \"status\": \"enabled\", \"rules\": {\"inbound\": [{\"ports\": \"80, 443\", \"protocol\": \"TCP\", \"addresses\": {\"ipv4\": [\"0.0.0.0\/0\"], \"ipv6\": [\"::\/0\"]}, \"action\": \"ACCEPT\", \"label\": \"accept-inbound-HTTP\"}, {\"ports\": \"1555\", \"protocol\": \"TCP\", \"addresses\": {\"ipv4\": [\"0.0.0.0\/0\"]}, \"action\": \"ACCEPT\", \"label\": \"accept-inbound-SSH\"}, {\"action\": \"ACCEPT\", \"addresses\": {\"ipv4\": [\"0.0.0.0\/0\"]}, \"ports\": \"22\", \"protocol\": \"TCP\", \"label\": \"accept-inbound-SSH-ED\", \"description\": null}], \"outbound\": [], \"inbound_policy\": \"DROP\", \"outbound_policy\": \"ACCEPT\"}, \"tags\": [], \"entities\": []}, {\"id\": 420, \"label\": \"dmz\", \"created\": \"2022-06-28T12:37:22\", \"updated\": \"2023-11-27T04:32:59\", \"status\": \"enabled\", \"rules\": {\"inbound\": [{\"ports\": \"\", \"protocol\": \"TCP\", \"addresses\": {\"ipv4\": [\"127.0.0.1\/8\"]}, \"action\": \"ACCEPT\", \"label\": \"allow-local-tcp\"}, {\"protocol\": \"ICMP\", \"addresses\": {\"ipv4\": [\"127.0.0.1\/8\"]}, \"action\": \"ACCEPT\", \"label\": \"allow-local-icmp\"}, {\"ports\": \"\", \"protocol\": \"UDP\", \"addresses\": {\"ipv4\": [\"127.0.0.1\/8\"]}, \"action\": \"ACCEPT\", \"label\": \"allow-local-udp\"}], \"inbound_policy\": \"DROP\", \"outbound\": [{\"ports\": \"80\", \"protocol\": \"TCP\", \"addresses\": {\"ipv4\": [\"91.189.91.0\/24\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\"], \"ipv6\": [\"2a01:4f8:1c17:e53d::1\/128\"]}, \"action\": \"ACCEPT\", \"label\": \"allow-ubuntu-updates\", \"description\": null}, {\"ports\": \"53\", \"protocol\": \"UDP\", \"addresses\": {\"ipv4\": [\"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\"]}, \"action\": \"ACCEPT\", \"label\": \"accept-outbound-DNS\"}, {\"ports\": \"443\", \"protocol\": \"TCP\", \"addresses\": {\"ipv4\": [\"127.0.0.1\/8\"], \"ipv6\": [\"2600:3c00:1::607e:7742\/128\"]}, \"action\": \"ACCEPT\", \"label\": \"allow-longview\"}, {\"ports\": \"123\", \"protocol\": \"UDP\", \"addresses\": {\"ipv4\": [\"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\", \"127.0.0.1\/8\"], \"ipv6\": [\"2620:2d:4000:1::40\/128\", \"2620:2d:4000:1::3f\/128\", \"2620:2d:4000:1::41\/128\"]}, \"action\": \"ACCEPT\", \"label\": \"allow-timesync\"}, {\"action\": \"ACCEPT\", \"addresses\": {\"ipv4\": [\"0.0.0.0\/0\"], \"ipv6\": [\"::\/0\"]}, \"ports\": \"443\", \"protocol\": \"TCP\", \"label\": \"accept-outbound-HTTPS\", \"description\": null}], \"outbound_policy\": \"DROP\"}, \"tags\": [], \"entities\": [{\"id\": 42069, \"type\": \"linode\", \"label\": \"mariadb\", \"url\": \"\/v4\/linode\/instances\/12345678\"}]}], \"page\": 1, \"pages\": 1, \"results\": 3}" +} diff --git a/tests/Fixtures/Saloon/get/networking/firewalls/29666.json b/tests/Fixtures/Saloon/get/networking/firewalls/29666.json new file mode 100644 index 0000000..d762703 --- /dev/null +++ b/tests/Fixtures/Saloon/get/networking/firewalls/29666.json @@ -0,0 +1,38 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "Content-Length": "250", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "firewall:read_only", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "Vary": [ + "Authorization, X-Filter", + "Authorization, X-Filter" + ], + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "399", + "X-RateLimit-Reset": "1706631333", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Expires": "Tue, 30 Jan 2024 16:14:32 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 16:14:32 GMT", + "Connection": "keep-alive" + }, + "data": "{\"id\": 334528, \"label\": \"testing\", \"created\": \"2024-01-30T16:12:42\", \"updated\": \"2024-01-30T16:12:42\", \"status\": \"enabled\", \"rules\": {\"inbound\": [], \"inbound_policy\": \"ACCEPT\", \"outbound\": [], \"outbound_policy\": \"ACCEPT\"}, \"tags\": [], \"entities\": []}" +} diff --git a/tests/Fixtures/Saloon/get/networking/firewalls/29666/rules.json b/tests/Fixtures/Saloon/get/networking/firewalls/29666/rules.json new file mode 100644 index 0000000..b3a58e1 --- /dev/null +++ b/tests/Fixtures/Saloon/get/networking/firewalls/29666/rules.json @@ -0,0 +1,38 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "Content-Length": "587", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "firewall:read_only", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "Vary": [ + "Authorization, X-Filter", + "Authorization, X-Filter" + ], + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "399", + "X-RateLimit-Reset": "1706632127", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Expires": "Tue, 30 Jan 2024 16:27:46 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 16:27:46 GMT", + "Connection": "keep-alive" + }, + "data": "{\"inbound\": [{\"action\": \"ACCEPT\", \"addresses\": {\"ipv4\": [\"172.20.20.20\/32\", \"127.0.0.69\/32\"]}, \"ports\": \"22\", \"protocol\": \"TCP\", \"label\": \"accept-inbound-SSH\", \"description\": null}, {\"action\": \"ACCEPT\", \"addresses\": {\"ipv4\": [\"0.0.0.0\/0\"], \"ipv6\": [\"::\/0\"]}, \"ports\": \"80\", \"protocol\": \"TCP\", \"label\": \"accept-inbound-HTTP\", \"description\": null}, {\"action\": \"ACCEPT\", \"addresses\": {\"ipv4\": [\"0.0.0.0\/0\"], \"ipv6\": [\"::\/0\"]}, \"ports\": \"443\", \"protocol\": \"TCP\", \"label\": \"accept-inbound-HTTPS\", \"description\": null}], \"inbound_policy\": \"ACCEPT\", \"outbound\": [], \"outbound_policy\": \"ACCEPT\"}" +} diff --git a/tests/Fixtures/Saloon/get/regions.json b/tests/Fixtures/Saloon/get/regions.json new file mode 100644 index 0000000..931afc5 --- /dev/null +++ b/tests/Fixtures/Saloon/get/regions.json @@ -0,0 +1,39 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "X-OAuth-Scopes": "unknown", + "X-Accepted-OAuth-Scopes": "*", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "399", + "X-RateLimit-Reset": "1706645201", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Vary": [ + "authorization", + "x-filter", + "authorization", + "x-filter" + ], + "Expires": "Tue, 30 Jan 2024 20:05:41 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 20:05:41 GMT", + "Content-Length": "16552", + "Connection": "keep-alive" + }, + "data": "{\"data\": [{\"id\": \"ap-west\", \"label\": \"Mumbai, IN\", \"country\": \"in\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"GPU Linodes\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.105.34.5, 172.105.35.5, 172.105.36.5, 172.105.37.5, 172.105.38.5, 172.105.39.5, 172.105.40.5, 172.105.41.5, 172.105.42.5, 172.105.43.5\", \"ipv6\": \"2400:8904::f03c:91ff:fea5:659, 2400:8904::f03c:91ff:fea5:9282, 2400:8904::f03c:91ff:fea5:b9b3, 2400:8904::f03c:91ff:fea5:925a, 2400:8904::f03c:91ff:fea5:22cb, 2400:8904::f03c:91ff:fea5:227a, 2400:8904::f03c:91ff:fea5:924c, 2400:8904::f03c:91ff:fea5:f7e2, 2400:8904::f03c:91ff:fea5:2205, 2400:8904::f03c:91ff:fea5:9207\"}}, {\"id\": \"ca-central\", \"label\": \"Toronto, CA\", \"country\": \"ca\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.105.0.5, 172.105.3.5, 172.105.4.5, 172.105.5.5, 172.105.6.5, 172.105.7.5, 172.105.8.5, 172.105.9.5, 172.105.10.5, 172.105.11.5\", \"ipv6\": \"2600:3c04::f03c:91ff:fea9:f63, 2600:3c04::f03c:91ff:fea9:f6d, 2600:3c04::f03c:91ff:fea9:f80, 2600:3c04::f03c:91ff:fea9:f0f, 2600:3c04::f03c:91ff:fea9:f99, 2600:3c04::f03c:91ff:fea9:fbd, 2600:3c04::f03c:91ff:fea9:fdd, 2600:3c04::f03c:91ff:fea9:fe2, 2600:3c04::f03c:91ff:fea9:f68, 2600:3c04::f03c:91ff:fea9:f4a\"}}, {\"id\": \"ap-southeast\", \"label\": \"Sydney, AU\", \"country\": \"au\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.105.166.5, 172.105.169.5, 172.105.168.5, 172.105.172.5, 172.105.162.5, 172.105.170.5, 172.105.167.5, 172.105.171.5, 172.105.181.5, 172.105.161.5\", \"ipv6\": \"2400:8907::f03c:92ff:fe6e:ec8, 2400:8907::f03c:92ff:fe6e:98e4, 2400:8907::f03c:92ff:fe6e:1c58, 2400:8907::f03c:92ff:fe6e:c299, 2400:8907::f03c:92ff:fe6e:c210, 2400:8907::f03c:92ff:fe6e:c219, 2400:8907::f03c:92ff:fe6e:1c5c, 2400:8907::f03c:92ff:fe6e:c24e, 2400:8907::f03c:92ff:fe6e:e6b, 2400:8907::f03c:92ff:fe6e:e3d\"}}, {\"id\": \"us-iad\", \"label\": \"Washington, DC\", \"country\": \"us\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Managed Databases\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"139.144.192.62, 139.144.192.60, 139.144.192.61, 139.144.192.53, 139.144.192.54, 139.144.192.67, 139.144.192.69, 139.144.192.66, 139.144.192.52, 139.144.192.68\", \"ipv6\": \"2600:3c05::f03c:93ff:feb6:43b6, 2600:3c05::f03c:93ff:feb6:4365, 2600:3c05::f03c:93ff:feb6:43c2, 2600:3c05::f03c:93ff:feb6:e441, 2600:3c05::f03c:93ff:feb6:94ef, 2600:3c05::f03c:93ff:feb6:94ba, 2600:3c05::f03c:93ff:feb6:94a8, 2600:3c05::f03c:93ff:feb6:9413, 2600:3c05::f03c:93ff:feb6:9443, 2600:3c05::f03c:93ff:feb6:94e0\"}}, {\"id\": \"us-ord\", \"label\": \"Chicago, IL\", \"country\": \"us\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Managed Databases\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.232.0.17, 172.232.0.16, 172.232.0.21, 172.232.0.13, 172.232.0.22, 172.232.0.9, 172.232.0.19, 172.232.0.20, 172.232.0.15, 172.232.0.18\", \"ipv6\": \"2600:3c06::f03c:93ff:fed0:e5fc, 2600:3c06::f03c:93ff:fed0:e54b, 2600:3c06::f03c:93ff:fed0:e572, 2600:3c06::f03c:93ff:fed0:e530, 2600:3c06::f03c:93ff:fed0:e597, 2600:3c06::f03c:93ff:fed0:e511, 2600:3c06::f03c:93ff:fed0:e5f2, 2600:3c06::f03c:93ff:fed0:e5bf, 2600:3c06::f03c:93ff:fed0:e529, 2600:3c06::f03c:93ff:fed0:e5a3\"}}, {\"id\": \"fr-par\", \"label\": \"Paris, FR\", \"country\": \"fr\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Managed Databases\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.232.32.21, 172.232.32.23, 172.232.32.17, 172.232.32.18, 172.232.32.16, 172.232.32.22, 172.232.32.20, 172.232.32.14, 172.232.32.11, 172.232.32.12\", \"ipv6\": \"2600:3c07::f03c:93ff:fef2:2e63, 2600:3c07::f03c:93ff:fef2:2ec7, 2600:3c07::f03c:93ff:fef2:0dee, 2600:3c07::f03c:93ff:fef2:0d25, 2600:3c07::f03c:93ff:fef2:0de0, 2600:3c07::f03c:93ff:fef2:2e29, 2600:3c07::f03c:93ff:fef2:0dda, 2600:3c07::f03c:93ff:fef2:0d82, 2600:3c07::f03c:93ff:fef2:b3ac, 2600:3c07::f03c:93ff:fef2:b3a8\"}}, {\"id\": \"us-sea\", \"label\": \"Seattle, WA\", \"country\": \"us\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.232.160.19, 172.232.160.21, 172.232.160.17, 172.232.160.15, 172.232.160.18, 172.232.160.8, 172.232.160.12, 172.232.160.11, 172.232.160.14, 172.232.160.16\", \"ipv6\": \"2600:3c0a::f03c:93ff:fe54:c6da, 2600:3c0a::f03c:93ff:fe54:c691, 2600:3c0a::f03c:93ff:fe54:c68d, 2600:3c0a::f03c:93ff:fe54:c61e, 2600:3c0a::f03c:93ff:fe54:c653, 2600:3c0a::f03c:93ff:fe54:c64c, 2600:3c0a::f03c:93ff:fe54:c68a, 2600:3c0a::f03c:93ff:fe54:c697, 2600:3c0a::f03c:93ff:fe54:c60f, 2600:3c0a::f03c:93ff:fe54:c6a0\"}}, {\"id\": \"br-gru\", \"label\": \"Sao Paulo, BR\", \"country\": \"br\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.233.0.4, 172.233.0.9, 172.233.0.7, 172.233.0.12, 172.233.0.5, 172.233.0.13, 172.233.0.10, 172.233.0.6, 172.233.0.8, 172.233.0.11\", \"ipv6\": \"2600:3c0d::f03c:93ff:fe3d:51cb, 2600:3c0d::f03c:93ff:fe3d:51a7, 2600:3c0d::f03c:93ff:fe3d:51a9, 2600:3c0d::f03c:93ff:fe3d:5119, 2600:3c0d::f03c:93ff:fe3d:51fe, 2600:3c0d::f03c:93ff:fe3d:517c, 2600:3c0d::f03c:93ff:fe3d:5144, 2600:3c0d::f03c:93ff:fe3d:5170, 2600:3c0d::f03c:93ff:fe3d:51cc, 2600:3c0d::f03c:93ff:fe3d:516c\"}}, {\"id\": \"nl-ams\", \"label\": \"Amsterdam, NL\", \"country\": \"nl\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.233.33.36, 172.233.33.38, 172.233.33.35, 172.233.33.39, 172.233.33.34, 172.233.33.33, 172.233.33.31, 172.233.33.30, 172.233.33.37, 172.233.33.32\", \"ipv6\": \"2600:3c0e::f03c:93ff:fe9d:2d10, 2600:3c0e::f03c:93ff:fe9d:2d89, 2600:3c0e::f03c:93ff:fe9d:2d79, 2600:3c0e::f03c:93ff:fe9d:2d96, 2600:3c0e::f03c:93ff:fe9d:2da5, 2600:3c0e::f03c:93ff:fe9d:2d34, 2600:3c0e::f03c:93ff:fe9d:2d68, 2600:3c0e::f03c:93ff:fe9d:2d17, 2600:3c0e::f03c:93ff:fe9d:2d45, 2600:3c0e::f03c:93ff:fe9d:2d5c\"}}, {\"id\": \"se-sto\", \"label\": \"Stockholm, SE\", \"country\": \"se\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.232.128.24, 172.232.128.26, 172.232.128.20, 172.232.128.22, 172.232.128.25, 172.232.128.19, 172.232.128.23, 172.232.128.18, 172.232.128.21, 172.232.128.27\", \"ipv6\": \"2600:3c09::f03c:93ff:fea9:4dbe, 2600:3c09::f03c:93ff:fea9:4d63, 2600:3c09::f03c:93ff:fea9:4dce, 2600:3c09::f03c:93ff:fea9:4dbb, 2600:3c09::f03c:93ff:fea9:4d99, 2600:3c09::f03c:93ff:fea9:4d26, 2600:3c09::f03c:93ff:fea9:4de0, 2600:3c09::f03c:93ff:fea9:4d69, 2600:3c09::f03c:93ff:fea9:4dbf, 2600:3c09::f03c:93ff:fea9:4da6\"}}, {\"id\": \"in-maa\", \"label\": \"Chennai, IN\", \"country\": \"in\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.232.96.17, 172.232.96.26, 172.232.96.19, 172.232.96.20, 172.232.96.25, 172.232.96.21, 172.232.96.18, 172.232.96.22, 172.232.96.23, 172.232.96.24\", \"ipv6\": \"2600:3c08::f03c:93ff:fe7c:1135, 2600:3c08::f03c:93ff:fe7c:11f8, 2600:3c08::f03c:93ff:fe7c:11d2, 2600:3c08::f03c:93ff:fe7c:11a7, 2600:3c08::f03c:93ff:fe7c:11ad, 2600:3c08::f03c:93ff:fe7c:110a, 2600:3c08::f03c:93ff:fe7c:11f9, 2600:3c08::f03c:93ff:fe7c:1137, 2600:3c08::f03c:93ff:fe7c:11db, 2600:3c08::f03c:93ff:fe7c:1164\"}}, {\"id\": \"jp-osa\", \"label\": \"Osaka, JP\", \"country\": \"jp\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.233.64.44, 172.233.64.43, 172.233.64.37, 172.233.64.40, 172.233.64.46, 172.233.64.41, 172.233.64.39, 172.233.64.42, 172.233.64.45, 172.233.64.38\", \"ipv6\": \"2400:8905::f03c:93ff:fe9d:b085, 2400:8905::f03c:93ff:fe9d:b012, 2400:8905::f03c:93ff:fe9d:b09b, 2400:8905::f03c:93ff:fe9d:b0d8, 2400:8905::f03c:93ff:fe9d:259f, 2400:8905::f03c:93ff:fe9d:b006, 2400:8905::f03c:93ff:fe9d:b084, 2400:8905::f03c:93ff:fe9d:b0ce, 2400:8905::f03c:93ff:fe9d:25ea, 2400:8905::f03c:93ff:fe9d:b086\"}}, {\"id\": \"it-mil\", \"label\": \"Milan, IT\", \"country\": \"it\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.232.192.19, 172.232.192.18, 172.232.192.16, 172.232.192.20, 172.232.192.24, 172.232.192.21, 172.232.192.22, 172.232.192.17, 172.232.192.15, 172.232.192.23\", \"ipv6\": \"2600:3c0b::f03c:93ff:feba:d513, 2600:3c0b::f03c:93ff:feba:d5c3, 2600:3c0b::f03c:93ff:feba:d597, 2600:3c0b::f03c:93ff:feba:d5fb, 2600:3c0b::f03c:93ff:feba:d51f, 2600:3c0b::f03c:93ff:feba:d58e, 2600:3c0b::f03c:93ff:feba:d5d5, 2600:3c0b::f03c:93ff:feba:d534, 2600:3c0b::f03c:93ff:feba:d57c, 2600:3c0b::f03c:93ff:feba:d529\"}}, {\"id\": \"us-mia\", \"label\": \"Miami, FL\", \"country\": \"us\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.233.160.34, 172.233.160.27, 172.233.160.30, 172.233.160.29, 172.233.160.32, 172.233.160.28, 172.233.160.33, 172.233.160.26, 172.233.160.25, 172.233.160.31\", \"ipv6\": \"2a01:7e04::f03c:93ff:fead:d31f, 2a01:7e04::f03c:93ff:fead:d37f, 2a01:7e04::f03c:93ff:fead:d30c, 2a01:7e04::f03c:93ff:fead:d318, 2a01:7e04::f03c:93ff:fead:d316, 2a01:7e04::f03c:93ff:fead:d339, 2a01:7e04::f03c:93ff:fead:d367, 2a01:7e04::f03c:93ff:fead:d395, 2a01:7e04::f03c:93ff:fead:d3d0, 2a01:7e04::f03c:93ff:fead:d38e\"}}, {\"id\": \"id-cgk\", \"label\": \"Jakarta, ID\", \"country\": \"id\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.232.224.23, 172.232.224.32, 172.232.224.26, 172.232.224.27, 172.232.224.21, 172.232.224.24, 172.232.224.22, 172.232.224.20, 172.232.224.31, 172.232.224.28\", \"ipv6\": \"2600:3c0c::f03c:93ff:feed:a90b, 2600:3c0c::f03c:93ff:feed:a9a5, 2600:3c0c::f03c:93ff:feed:a935, 2600:3c0c::f03c:93ff:feed:a930, 2600:3c0c::f03c:93ff:feed:a95c, 2600:3c0c::f03c:93ff:feed:a9ad, 2600:3c0c::f03c:93ff:feed:a9f2, 2600:3c0c::f03c:93ff:feed:a9ff, 2600:3c0c::f03c:93ff:feed:a9c8, 2600:3c0c::f03c:93ff:feed:a96b\"}}, {\"id\": \"us-lax\", \"label\": \"Los Angeles, CA\", \"country\": \"us\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"VPCs\", \"Metadata\", \"Premium Plans\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"172.233.128.45, 172.233.128.38, 172.233.128.53, 172.233.128.37, 172.233.128.34, 172.233.128.36, 172.233.128.33, 172.233.128.39, 172.233.128.43, 172.233.128.44\", \"ipv6\": \"2a01:7e03::f03c:93ff:feb1:b789, 2a01:7e03::f03c:93ff:feb1:b717, 2a01:7e03::f03c:93ff:feb1:b707, 2a01:7e03::f03c:93ff:feb1:b7ab, 2a01:7e03::f03c:93ff:feb1:b7e2, 2a01:7e03::f03c:93ff:feb1:b709, 2a01:7e03::f03c:93ff:feb1:b7a6, 2a01:7e03::f03c:93ff:feb1:b750, 2a01:7e03::f03c:93ff:feb1:b76e, 2a01:7e03::f03c:93ff:feb1:b7a2\"}}, {\"id\": \"us-central\", \"label\": \"Dallas, TX\", \"country\": \"us\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"72.14.179.5, 72.14.188.5, 173.255.199.5, 66.228.53.5, 96.126.122.5, 96.126.124.5, 96.126.127.5, 198.58.107.5, 198.58.111.5, 23.239.24.5\", \"ipv6\": \"2600:3c00::2, 2600:3c00::9, 2600:3c00::7, 2600:3c00::5, 2600:3c00::3, 2600:3c00::8, 2600:3c00::6, 2600:3c00::4, 2600:3c00::c, 2600:3c00::b\"}}, {\"id\": \"us-west\", \"label\": \"Fremont, CA\", \"country\": \"us\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"173.230.145.5, 173.230.147.5, 173.230.155.5, 173.255.212.5, 173.255.219.5, 173.255.241.5, 173.255.243.5, 173.255.244.5, 74.207.241.5, 74.207.242.5\", \"ipv6\": \"2600:3c01::2, 2600:3c01::9, 2600:3c01::5, 2600:3c01::7, 2600:3c01::3, 2600:3c01::8, 2600:3c01::4, 2600:3c01::b, 2600:3c01::c, 2600:3c01::6\"}}, {\"id\": \"us-southeast\", \"label\": \"Atlanta, GA\", \"country\": \"us\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"GPU Linodes\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"74.207.231.5, 173.230.128.5, 173.230.129.5, 173.230.136.5, 173.230.140.5, 66.228.59.5, 66.228.62.5, 50.116.35.5, 50.116.41.5, 23.239.18.5\", \"ipv6\": \"2600:3c02::3, 2600:3c02::5, 2600:3c02::4, 2600:3c02::6, 2600:3c02::c, 2600:3c02::7, 2600:3c02::2, 2600:3c02::9, 2600:3c02::8, 2600:3c02::b\"}}, {\"id\": \"us-east\", \"label\": \"Newark, NJ\", \"country\": \"us\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"GPU Linodes\", \"Kubernetes\", \"Cloud Firewall\", \"Bare Metal\", \"Vlans\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"66.228.42.5, 96.126.106.5, 50.116.53.5, 50.116.58.5, 50.116.61.5, 50.116.62.5, 66.175.211.5, 97.107.133.4, 207.192.69.4, 207.192.69.5\", \"ipv6\": \"2600:3c03::7, 2600:3c03::4, 2600:3c03::9, 2600:3c03::6, 2600:3c03::3, 2600:3c03::c, 2600:3c03::5, 2600:3c03::b, 2600:3c03::2, 2600:3c03::8\"}}, {\"id\": \"eu-west\", \"label\": \"London, UK\", \"country\": \"gb\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"178.79.182.5, 176.58.107.5, 176.58.116.5, 176.58.121.5, 151.236.220.5, 212.71.252.5, 212.71.253.5, 109.74.192.20, 109.74.193.20, 109.74.194.20\", \"ipv6\": \"2a01:7e00::9, 2a01:7e00::3, 2a01:7e00::c, 2a01:7e00::5, 2a01:7e00::6, 2a01:7e00::8, 2a01:7e00::b, 2a01:7e00::4, 2a01:7e00::7, 2a01:7e00::2\"}}, {\"id\": \"ap-south\", \"label\": \"Singapore, SG\", \"country\": \"sg\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"GPU Linodes\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"139.162.11.5, 139.162.13.5, 139.162.14.5, 139.162.15.5, 139.162.16.5, 139.162.21.5, 139.162.27.5, 103.3.60.18, 103.3.60.19, 103.3.60.20\", \"ipv6\": \"2400:8901::5, 2400:8901::4, 2400:8901::b, 2400:8901::3, 2400:8901::9, 2400:8901::2, 2400:8901::8, 2400:8901::7, 2400:8901::c, 2400:8901::6\"}}, {\"id\": \"eu-central\", \"label\": \"Frankfurt, DE\", \"country\": \"de\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Object Storage\", \"GPU Linodes\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"139.162.130.5, 139.162.131.5, 139.162.132.5, 139.162.133.5, 139.162.134.5, 139.162.135.5, 139.162.136.5, 139.162.137.5, 139.162.138.5, 139.162.139.5\", \"ipv6\": \"2a01:7e01::5, 2a01:7e01::9, 2a01:7e01::7, 2a01:7e01::c, 2a01:7e01::2, 2a01:7e01::4, 2a01:7e01::3, 2a01:7e01::6, 2a01:7e01::b, 2a01:7e01::8\"}}, {\"id\": \"ap-northeast\", \"label\": \"Tokyo, JP\", \"country\": \"jp\", \"capabilities\": [\"Linodes\", \"NodeBalancers\", \"Block Storage\", \"Kubernetes\", \"Cloud Firewall\", \"Vlans\", \"Block Storage Migrations\", \"Managed Databases\"], \"status\": \"ok\", \"resolvers\": {\"ipv4\": \"139.162.66.5, 139.162.67.5, 139.162.68.5, 139.162.69.5, 139.162.70.5, 139.162.71.5, 139.162.72.5, 139.162.73.5, 139.162.74.5, 139.162.75.5\", \"ipv6\": \"2400:8902::3, 2400:8902::6, 2400:8902::c, 2400:8902::4, 2400:8902::2, 2400:8902::8, 2400:8902::7, 2400:8902::5, 2400:8902::b, 2400:8902::9\"}}], \"page\": 1, \"pages\": 1, \"results\": 24}" +} diff --git a/tests/Fixtures/Saloon/post/images.json b/tests/Fixtures/Saloon/post/images.json new file mode 100644 index 0000000..e88d659 --- /dev/null +++ b/tests/Fixtures/Saloon/post/images.json @@ -0,0 +1,35 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "Content-Length": "354", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "images:read_write,linodes:read_only", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "399", + "X-RateLimit-Reset": "1706643180", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Authorization, X-Filter", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Expires": "Tue, 30 Jan 2024 19:31:59 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 19:31:59 GMT", + "Connection": "keep-alive" + }, + "data": "{\"id\": \"private\/23608448\", \"label\": \"backup_disk\", \"description\": \"Created in tests, delete\", \"created\": \"2024-01-30T19:31:59\", \"updated\": \"2024-01-30T19:31:59\", \"size\": 24088, \"created_by\": \"test\", \"type\": \"manual\", \"is_public\": false, \"deprecated\": false, \"vendor\": null, \"expiry\": null, \"eol\": null, \"status\": \"creating\", \"capabilities\": []}" +} diff --git a/tests/Fixtures/Saloon/post/linode/instances.json b/tests/Fixtures/Saloon/post/linode/instances.json new file mode 100644 index 0000000..1bf08aa --- /dev/null +++ b/tests/Fixtures/Saloon/post/linode/instances.json @@ -0,0 +1,35 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "Content-Length": "773", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "linodes:read_write", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "10", + "X-RateLimit-Remaining": "9", + "X-RateLimit-Reset": "1706644042", + "Retry-After": "29", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Authorization, X-Filter", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Expires": "Tue, 30 Jan 2024 19:46:53 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 19:46:53 GMT", + "Connection": "keep-alive" + }, + "data": "{\"id\": 54472029, \"label\": \"pest-test-979\", \"group\": \"\", \"status\": \"provisioning\", \"created\": \"2018-01-01T00:01:01\", \"updated\": \"2018-01-01T00:01:01\", \"type\": \"g6-nanode-1\", \"ipv4\": [\"176.58.109.36\", \"192.168.196.203\"], \"ipv6\": \"2a01:7e00::f03c:94ff:fe39:53d7\/128\", \"image\": \"linode\/ubuntu20.04\", \"region\": \"eu-west\", \"specs\": {\"disk\": 25600, \"memory\": 1024, \"vcpus\": 1, \"gpus\": 0, \"transfer\": 1000}, \"alerts\": {\"cpu\": 90, \"network_in\": 10, \"network_out\": 10, \"transfer_quota\": 80, \"io\": 10000}, \"backups\": {\"enabled\": false, \"available\": false, \"schedule\": {\"day\": null, \"window\": null}, \"last_successful\": null}, \"hypervisor\": \"kvm\", \"watchdog_enabled\": true, \"tags\": [\"linode-sdk\", \"test\"], \"host_uuid\": \"21a153b9b8de9f11c1667053b995ee606f2f5215\", \"has_user_data\": false}" +} diff --git a/tests/Fixtures/Saloon/post/linode/instances/31293947/clone.json b/tests/Fixtures/Saloon/post/linode/instances/31293947/clone.json new file mode 100644 index 0000000..b04b9bf --- /dev/null +++ b/tests/Fixtures/Saloon/post/linode/instances/31293947/clone.json @@ -0,0 +1,35 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "Content-Length": "781", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "linodes:read_write", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "10", + "X-RateLimit-Remaining": "9", + "X-RateLimit-Reset": "1706644453", + "Retry-After": "30", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Authorization, X-Filter", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Expires": "Tue, 30 Jan 2024 19:53:42 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 19:53:42 GMT", + "Connection": "keep-alive" + }, + "data": "{\"id\": 54472202, \"label\": \"pest-clone-735\", \"group\": \"\", \"status\": \"offline\", \"created\": \"2018-01-01T00:01:01\", \"updated\": \"2018-01-01T00:01:01\", \"type\": \"g6-nanode-1\", \"ipv4\": [\"139.162.237.120\", \"192.168.196.32\"], \"ipv6\": \"2a01:7e00::f03c:94ff:fe39:0649\/128\", \"image\": \"linode\/ubuntu20.04\", \"region\": \"eu-west\", \"specs\": {\"disk\": 25600, \"memory\": 1024, \"vcpus\": 1, \"gpus\": 0, \"transfer\": 1000}, \"alerts\": {\"cpu\": 90, \"network_in\": 10, \"network_out\": 10, \"transfer_quota\": 80, \"io\": 10000}, \"backups\": {\"enabled\": false, \"available\": false, \"schedule\": {\"day\": null, \"window\": null}, \"last_successful\": null}, \"hypervisor\": \"kvm\", \"watchdog_enabled\": true, \"tags\": [\"linode-sdk\", \"test\", \"updated\"], \"host_uuid\": \"407deded74a8fcdacb182aa2e9b141f6b0b85dc6\", \"has_user_data\": false}" +} diff --git a/tests/Fixtures/Saloon/post/linode/instances/31293947/shutdown.json b/tests/Fixtures/Saloon/post/linode/instances/31293947/shutdown.json new file mode 100644 index 0000000..6228f33 --- /dev/null +++ b/tests/Fixtures/Saloon/post/linode/instances/31293947/shutdown.json @@ -0,0 +1,35 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "Content-Length": "2", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "linodes:read_write", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "399", + "X-RateLimit-Reset": "1706644658", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Authorization, X-Filter", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Expires": "Tue, 30 Jan 2024 19:56:37 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 19:56:37 GMT", + "Connection": "keep-alive" + }, + "data": "{}" +} diff --git a/tests/Fixtures/Saloon/put/linode/instances/31293947.json b/tests/Fixtures/Saloon/put/linode/instances/31293947.json new file mode 100644 index 0000000..f8707ee --- /dev/null +++ b/tests/Fixtures/Saloon/put/linode/instances/31293947.json @@ -0,0 +1,35 @@ +{ + "statusCode": 200, + "headers": { + "Content-Type": "application\/json", + "Content-Length": "786", + "X-OAuth-Scopes": "*", + "X-Accepted-OAuth-Scopes": "linodes:read_write", + "X-Frame-Options": [ + "DENY", + "DENY" + ], + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "HEAD, GET, OPTIONS, POST, PUT, DELETE", + "Access-Control-Allow-Headers": "Authorization, Origin, X-Requested-With, Content-Type, Accept, X-Filter", + "X-Spec-Version": "4.171.0", + "X-Customer-UUID": "D09103B1-FFFF-AAAA-B88C000000000004", + "X-RateLimit-Limit": "400", + "X-RateLimit-Remaining": "399", + "X-RateLimit-Reset": "1706644421", + "Retry-After": "60", + "Access-Control-Allow-Credentials": "true", + "Access-Control-Expose-Headers": "X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Status", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Authorization, X-Filter", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Strict-Transport-Security": "max-age=31536000", + "Expires": "Tue, 30 Jan 2024 19:52:40 GMT", + "Cache-Control": "max-age=0, no-cache, no-store", + "Pragma": "no-cache", + "Date": "Tue, 30 Jan 2024 19:52:40 GMT", + "Connection": "keep-alive" + }, + "data": "{\"id\": 54472029, \"label\": \"pest-test-updated-17\", \"group\": \"\", \"status\": \"running\", \"created\": \"2017-01-01T00:01:01\", \"updated\": \"2018-01-01T00:01:01\", \"type\": \"g6-nanode-1\", \"ipv4\": [\"176.58.109.36\", \"192.168.196.203\"], \"ipv6\": \"2a01:7e00::f03c:94ff:fe39:53d7\/128\", \"image\": \"linode\/ubuntu20.04\", \"region\": \"eu-west\", \"specs\": {\"disk\": 25600, \"memory\": 1024, \"vcpus\": 1, \"gpus\": 0, \"transfer\": 1000}, \"alerts\": {\"cpu\": 90, \"network_in\": 10, \"network_out\": 10, \"transfer_quota\": 80, \"io\": 10000}, \"backups\": {\"enabled\": false, \"available\": false, \"schedule\": {\"day\": null, \"window\": null}, \"last_successful\": null}, \"hypervisor\": \"kvm\", \"watchdog_enabled\": true, \"tags\": [\"linode-sdk\", \"test\", \"updated\"], \"host_uuid\": \"21a153b9b8de9f11c1667053b995ee606f2f5215\", \"has_user_data\": false}" +} diff --git a/tests/Fixtures/delete/linode/instances/31294599.json b/tests/Fixtures/delete/linode/instances/31294599.json deleted file mode 100644 index 0db3279..0000000 --- a/tests/Fixtures/delete/linode/instances/31294599.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} diff --git a/tests/Fixtures/delete/networking/firewalls/29675.json b/tests/Fixtures/delete/networking/firewalls/29675.json deleted file mode 100644 index 0db3279..0000000 --- a/tests/Fixtures/delete/networking/firewalls/29675.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} diff --git a/tests/Fixtures/get/account.json b/tests/Fixtures/get/account.json deleted file mode 100644 index 4a0f33f..0000000 --- a/tests/Fixtures/get/account.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "company": "mwangithegreat", - "email": "samuel@samuelmwangi.co.ke", - "first_name": "Samuel", - "last_name": "Mwangi", - "address_1": "P.O Box 123", - "address_2": "", - "city": "Nairobi", - "state": "Nairobi City", - "zip": "00100", - "country": "KE", - "phone": "", - "balance": -1.65, - "tax_id": "", - "credit_card": [ - { - "last_four": "8023", - "expiry": "06/2023" - } - ], - "balance_uninvoiced": 13.81, - "active_since": "2017-08-19T09:18:33", - "capabilities": [ - "Linodes", - "NodeBalancers", - "Block Storage", - "Object Storage", - "Kubernetes", - "Cloud Firewall", - "Vlans", - "Machine Images" - ], - "active_promotions": [], - "euuid": "D09103B1-20FE-11EA-B88C0CC47AEB2714" -} diff --git a/tests/Fixtures/get/images.json b/tests/Fixtures/get/images.json deleted file mode 100644 index 8fa1902..0000000 --- a/tests/Fixtures/get/images.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "data": [ - { - "created": "2021-08-14T22:44:02", - "created_by": "linode", - "deprecated": false, - "description": "Example Image description.", - "eol": "2026-07-01T04:00:00", - "expiry": null, - "id": "linode/debian11", - "is_public": true, - "label": "Debian 11", - "size": 2500, - "status": null, - "type": "manual", - "updated": "2021-08-14T22:44:02", - "vendor": "Debian" - } - ], - "page": 1, - "pages": 1, - "results": 1 -} diff --git a/tests/Fixtures/get/images/linode/ubuntu20.04.json b/tests/Fixtures/get/images/linode/ubuntu20.04.json deleted file mode 100644 index 8fd569e..0000000 --- a/tests/Fixtures/get/images/linode/ubuntu20.04.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "created": "2021-08-14T22:44:02", - "created_by": "linode", - "deprecated": false, - "description": "Example Image description.", - "eol": "2026-07-01T04:00:00", - "expiry": null, - "id": "linode/debian11", - "is_public": true, - "label": "Debian 11", - "size": 2500, - "status": null, - "type": "manual", - "updated": "2021-08-14T22:44:02", - "vendor": "Debian" -} diff --git a/tests/Fixtures/get/linode/instances.json b/tests/Fixtures/get/linode/instances.json deleted file mode 100644 index b77d36d..0000000 --- a/tests/Fixtures/get/linode/instances.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "data": [ - { - "alerts": { - "cpu": 180, - "io": 10000, - "network_in": 10, - "network_out": 10, - "transfer_quota": 80 - }, - "backups": { - "enabled": true, - "last_successful": "2018-01-01T00:01:01", - "schedule": { - "day": "Saturday", - "window": "W22" - } - }, - "created": "2018-01-01T00:01:01", - "group": "Linode-Group", - "hypervisor": "kvm", - "id": 123, - "image": "linode/debian10", - "ipv4": [ - "203.0.113.1", - "192.0.2.1" - ], - "ipv6": "c001:d00d::1337/128", - "label": "linode123", - "region": "us-east", - "specs": { - "disk": 81920, - "memory": 4096, - "transfer": 4000, - "vcpus": 2 - }, - "status": "running", - "tags": [ - "example tag", - "another example" - ], - "type": "g6-standard-1", - "updated": "2018-01-01T00:01:01", - "watchdog_enabled": true - } - ], - "page": 1, - "pages": 1, - "results": 1 -} diff --git a/tests/Fixtures/get/linode/instances/31293947.json b/tests/Fixtures/get/linode/instances/31293947.json deleted file mode 100644 index 8ec11bb..0000000 --- a/tests/Fixtures/get/linode/instances/31293947.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "alerts": { - "cpu": 180, - "io": 10000, - "network_in": 10, - "network_out": 10, - "transfer_quota": 80 - }, - "backups": { - "enabled": true, - "last_successful": "2018-01-01T00:01:01", - "schedule": { - "day": "Saturday", - "window": "W22" - } - }, - "created": "2018-01-01T00:01:01", - "group": "Linode-Group", - "hypervisor": "kvm", - "id": 123, - "image": "linode/debian10", - "ipv4": [ - "203.0.113.1", - "192.0.2.1" - ], - "ipv6": "c001:d00d::1337/128", - "label": "linode123", - "region": "us-east", - "specs": { - "disk": 81920, - "memory": 4096, - "transfer": 4000, - "vcpus": 2 - }, - "status": "running", - "tags": [ - "example tag", - "another example" - ], - "type": "g6-standard-1", - "updated": "2018-01-01T00:01:01", - "watchdog_enabled": true -} diff --git a/tests/Fixtures/get/linode/instances/31293947/disks.json b/tests/Fixtures/get/linode/instances/31293947/disks.json deleted file mode 100644 index 6aed307..0000000 --- a/tests/Fixtures/get/linode/instances/31293947/disks.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "data": [ - { - "created": "2018-01-01T00:01:01", - "filesystem": "ext4", - "id": 25674, - "label": "Debian 9 Disk", - "size": 48640, - "status": "ready", - "updated": "2018-01-01T00:01:01" - } - ], - "page": 1, - "pages": 1, - "results": 1 -} diff --git a/tests/Fixtures/get/linode/types.json b/tests/Fixtures/get/linode/types.json deleted file mode 100644 index fe7725f..0000000 --- a/tests/Fixtures/get/linode/types.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "data": [ - { - "addons": { - "backups": { - "price": { - "hourly": 0.008, - "monthly": 5 - } - } - }, - "class": "standard", - "disk": 81920, - "gpus": 0, - "id": "g6-standard-2", - "label": "Linode 4GB", - "memory": 4096, - "network_out": 1000, - "price": { - "hourly": 0.03, - "monthly": 20 - }, - "successor": null, - "transfer": 4000, - "vcpus": 2 - } - ], - "page": 1, - "pages": 1, - "results": 1 -} diff --git a/tests/Fixtures/get/networking/firewalls.json b/tests/Fixtures/get/networking/firewalls.json deleted file mode 100644 index a4a2013..0000000 --- a/tests/Fixtures/get/networking/firewalls.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "data": [ - { - "created": "2018-01-01T00:01:01", - "id": 123, - "label": "firewall123", - "rules": { - "inbound": [ - { - "action": "ACCEPT", - "addresses": { - "ipv4": [ - "192.0.2.0/24" - ], - "ipv6": [ - "2001:DB8::/32" - ] - }, - "description": "An example firewall rule description.", - "label": "firewallrule123", - "ports": "22-24, 80, 443", - "protocol": "TCP" - } - ], - "inbound_policy": "DROP", - "outbound": [ - { - "action": "ACCEPT", - "addresses": { - "ipv4": [ - "192.0.2.0/24" - ], - "ipv6": [ - "2001:DB8::/32" - ] - }, - "description": "An example firewall rule description.", - "label": "firewallrule123", - "ports": "22-24, 80, 443", - "protocol": "TCP" - } - ], - "outbound_policy": "DROP" - }, - "status": "enabled", - "tags": [ - "example tag", - "another example" - ], - "updated": "2018-01-02T00:01:01" - } - ], - "page": 1, - "pages": 1, - "results": 1 -} diff --git a/tests/Fixtures/get/networking/firewalls/29666.json b/tests/Fixtures/get/networking/firewalls/29666.json deleted file mode 100644 index dcb2477..0000000 --- a/tests/Fixtures/get/networking/firewalls/29666.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "created": "2018-01-01T00:01:01", - "id": 123, - "label": "firewall123", - "rules": { - "inbound": [ - { - "action": "ACCEPT", - "addresses": { - "ipv4": [ - "192.0.2.0/24" - ], - "ipv6": [ - "2001:DB8::/32" - ] - }, - "description": "An example firewall rule description.", - "label": "firewallrule123", - "ports": "22-24, 80, 443", - "protocol": "TCP" - } - ], - "inbound_policy": "DROP", - "outbound": [ - { - "action": "ACCEPT", - "addresses": { - "ipv4": [ - "192.0.2.0/24" - ], - "ipv6": [ - "2001:DB8::/32" - ] - }, - "description": "An example firewall rule description.", - "label": "firewallrule123", - "ports": "22-24, 80, 443", - "protocol": "TCP" - } - ], - "outbound_policy": "DROP" - }, - "status": "enabled", - "tags": [ - "example tag", - "another example" - ], - "updated": "2018-01-02T00:01:01" -} diff --git a/tests/Fixtures/get/networking/firewalls/29666/rules.json b/tests/Fixtures/get/networking/firewalls/29666/rules.json deleted file mode 100644 index 7106c0f..0000000 --- a/tests/Fixtures/get/networking/firewalls/29666/rules.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "inbound": [ - { - "action": "ACCEPT", - "addresses": { - "ipv4": [ - "192.0.2.0/24" - ], - "ipv6": [ - "2001:DB8::/32" - ] - }, - "description": "An example firewall rule description.", - "label": "firewallrule123", - "ports": "22-24, 80, 443", - "protocol": "TCP" - } - ], - "inbound_policy": "DROP", - "outbound": [ - { - "action": "ACCEPT", - "addresses": { - "ipv4": [ - "192.0.2.0/24" - ], - "ipv6": [ - "2001:DB8::/32" - ] - }, - "description": "An example firewall rule description.", - "label": "firewallrule123", - "ports": "22-24, 80, 443", - "protocol": "TCP" - } - ], - "outbound_policy": "DROP" -} diff --git a/tests/Fixtures/get/regions.json b/tests/Fixtures/get/regions.json deleted file mode 100644 index c8f8369..0000000 --- a/tests/Fixtures/get/regions.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "data": [ - { - "capabilities": [ - "Linodes", - "NodeBalancers", - "Block Storage", - "Object Storage" - ], - "country": "us", - "id": "us-east", - "resolvers": { - "ipv4": "192.0.2.0,192.0.2.1", - "ipv6": "2001:0db8::,2001:0db8::1" - }, - "status": "ok" - } - ], - "page": 1, - "pages": 1, - "results": 1 -} diff --git a/tests/Fixtures/post/images.json b/tests/Fixtures/post/images.json deleted file mode 100644 index 8fd569e..0000000 --- a/tests/Fixtures/post/images.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "created": "2021-08-14T22:44:02", - "created_by": "linode", - "deprecated": false, - "description": "Example Image description.", - "eol": "2026-07-01T04:00:00", - "expiry": null, - "id": "linode/debian11", - "is_public": true, - "label": "Debian 11", - "size": 2500, - "status": null, - "type": "manual", - "updated": "2021-08-14T22:44:02", - "vendor": "Debian" -} diff --git a/tests/Fixtures/post/linode/instances.json b/tests/Fixtures/post/linode/instances.json deleted file mode 100644 index a23c3dd..0000000 --- a/tests/Fixtures/post/linode/instances.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "alerts": { - "cpu": 180, - "io": 10000, - "network_in": 10, - "network_out": 10, - "transfer_quota": 80 - }, - "backups": { - "enabled": true, - "last_successful": "2018-01-01T00:01:01", - "schedule": { - "day": "Saturday", - "window": "W22" - } - }, - "created": "2018-01-01T00:01:01", - "group": "Linode-Group", - "hypervisor": "kvm", - "id": 123, - "image": "linode/debian10", - "ipv4": [ - "203.0.113.1", - "192.0.2.1" - ], - "ipv6": "c001:d00d::1337/128", - "label": "linode123", - "region": "us-east", - "specs": { - "disk": 81920, - "memory": 4096, - "transfer": 4000, - "vcpus": 2, - "gpus": 1 - }, - "status": "running", - "tags": [ - "example tag", - "another example" - ], - "type": "g6-standard-1", - "updated": "2018-01-01T00:01:01", - "watchdog_enabled": true -} diff --git a/tests/Fixtures/post/linode/instances/31293947/clone.json b/tests/Fixtures/post/linode/instances/31293947/clone.json deleted file mode 100644 index a23c3dd..0000000 --- a/tests/Fixtures/post/linode/instances/31293947/clone.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "alerts": { - "cpu": 180, - "io": 10000, - "network_in": 10, - "network_out": 10, - "transfer_quota": 80 - }, - "backups": { - "enabled": true, - "last_successful": "2018-01-01T00:01:01", - "schedule": { - "day": "Saturday", - "window": "W22" - } - }, - "created": "2018-01-01T00:01:01", - "group": "Linode-Group", - "hypervisor": "kvm", - "id": 123, - "image": "linode/debian10", - "ipv4": [ - "203.0.113.1", - "192.0.2.1" - ], - "ipv6": "c001:d00d::1337/128", - "label": "linode123", - "region": "us-east", - "specs": { - "disk": 81920, - "memory": 4096, - "transfer": 4000, - "vcpus": 2, - "gpus": 1 - }, - "status": "running", - "tags": [ - "example tag", - "another example" - ], - "type": "g6-standard-1", - "updated": "2018-01-01T00:01:01", - "watchdog_enabled": true -} diff --git a/tests/Fixtures/post/linode/instances/31293947/shutdown.json b/tests/Fixtures/post/linode/instances/31293947/shutdown.json deleted file mode 100644 index 0db3279..0000000 --- a/tests/Fixtures/post/linode/instances/31293947/shutdown.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} diff --git a/tests/Fixtures/put/linode/instances/31293947.json b/tests/Fixtures/put/linode/instances/31293947.json deleted file mode 100644 index 8ec11bb..0000000 --- a/tests/Fixtures/put/linode/instances/31293947.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "alerts": { - "cpu": 180, - "io": 10000, - "network_in": 10, - "network_out": 10, - "transfer_quota": 80 - }, - "backups": { - "enabled": true, - "last_successful": "2018-01-01T00:01:01", - "schedule": { - "day": "Saturday", - "window": "W22" - } - }, - "created": "2018-01-01T00:01:01", - "group": "Linode-Group", - "hypervisor": "kvm", - "id": 123, - "image": "linode/debian10", - "ipv4": [ - "203.0.113.1", - "192.0.2.1" - ], - "ipv6": "c001:d00d::1337/128", - "label": "linode123", - "region": "us-east", - "specs": { - "disk": 81920, - "memory": 4096, - "transfer": 4000, - "vcpus": 2 - }, - "status": "running", - "tags": [ - "example tag", - "another example" - ], - "type": "g6-standard-1", - "updated": "2018-01-01T00:01:01", - "watchdog_enabled": true -} diff --git a/tests/InstancesTest.php b/tests/InstancesTest.php index 7475ea3..73f07ab 100644 --- a/tests/InstancesTest.php +++ b/tests/InstancesTest.php @@ -60,11 +60,12 @@ ->toBeInstanceOf(InstanceDTO::class) ->hypervisor->toBe('kvm') ->specification->toBeInstanceOf(ServerSpecificationDTO::class) - ->created->toBeInstanceOf(Carbon::class) - ->created->isToday()->toBeTrue() + ->updated->toBeInstanceOf(Carbon::class) + ->created->isToday()->toBeFalse() + ->created->isPast()->toBeTrue() + ->updated->isToday()->toBeTrue() ->ips->toBeInstanceOf(Collection::class); -}) - ->with('instance-id', 'instance-update'); +})->with('instance-id', 'instance-update'); it('clones an instance', function (int $instance, array $updatedInstance) { fakeSaloonRequest(Instance\CloneRequest::class); @@ -83,7 +84,6 @@ it('destroys an instance') ->tap(fn () => fakeSaloonRequest(Instance\DeleteRequest::class)) ->with('delete-instance-id') -// ->markAsRisky() ->expect(fn ($instance) => Linode::instance()->destroy(value($instance))) ->status()->toBe(200); diff --git a/tests/Pest.php b/tests/Pest.php index f98b9b4..9e21dbe 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -2,8 +2,8 @@ declare(strict_types=1); -use Sammyjo20\Saloon\Http\MockResponse; -use Sammyjo20\SaloonLaravel\Facades\Saloon; +use Saloon\Http\Faking\MockResponse; +use Saloon\Laravel\Saloon; use SamuelMwangiW\Linode\Saloon\Requests; use SamuelMwangiW\Linode\Tests\TestCase; @@ -36,18 +36,7 @@ function fakeSaloonRequest(string $request): void throw new RuntimeException("{$request}/fixture mapping is missing"); } - $path = __DIR__ . "/Fixtures/{$fixtures[$request]}.json"; - - if (! file_exists($path)) { - throw new RuntimeException("Fixture {$path} for {$request} is missing"); - } - - $response = json_decode( - json: file_get_contents($path), - associative: true - ); - Saloon::fake([ - $request => MockResponse::make($response), + $request => MockResponse::fixture("{$fixtures[$request]}"), ]); } diff --git a/tests/SaloonTest.php b/tests/SaloonTest.php index be2099e..559bb77 100644 --- a/tests/SaloonTest.php +++ b/tests/SaloonTest.php @@ -7,17 +7,20 @@ it('fakes requests', function ($requestClass, $fixture) { fakeSaloonRequest($requestClass); - $expectedResponse = json_decode( - json:file_get_contents(__DIR__ . "/Fixtures/{$fixture}.json"), + $fixture = json_decode( + json:file_get_contents(__DIR__ . "/Fixtures/Saloon/{$fixture}.json"), associative: true ); - $receivedResponse = (new $requestClass()) - ->send() + $expectedResponse = json_decode(json: $fixture['data'], associative: true); + + $receivedResponse = \SamuelMwangiW\Linode\Saloon\AuthenticatedConnector::make() + ->send((new $requestClass())) ->throw() ->json(); expect($receivedResponse)->toBe($expectedResponse); })->with([ 'regions list request' => [Requests\Regions\ListRequest::class, 'get/regions'], + 'Linode types request' => [Requests\Billing\PlansListRequest::class, 'get/linode/types'], ]); diff --git a/tests/TestCase.php b/tests/TestCase.php index a04bf51..318d67c 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -5,7 +5,7 @@ namespace SamuelMwangiW\Linode\Tests; use Orchestra\Testbench\TestCase as Orchestra; -use Sammyjo20\SaloonLaravel\SaloonServiceProvider; +use Saloon\Laravel\SaloonServiceProvider; use SamuelMwangiW\Linode\LinodeServiceProvider; class TestCase extends Orchestra