diff --git a/src/Models/Firewalls/Firewall.php b/src/Models/Firewalls/Firewall.php index 6cb2f9d..3b4d9d2 100644 --- a/src/Models/Firewalls/Firewall.php +++ b/src/Models/Firewalls/Firewall.php @@ -122,7 +122,9 @@ public static function parse($input): ?self } foreach ($input->applied_to as $a) { - $appliedTo[] = new FirewallResource($a->type, new Server($a->server->id)); + if($a->type === 'server'){ + $appliedTo[] = new FirewallResource($a->type, new Server($a->server->id)); + } } return new self($input->id, $input->name, $rules, $appliedTo, get_object_vars($input->labels), $input->created); diff --git a/tests/Unit/Models/Firewalls/fixtures/firewall.json b/tests/Unit/Models/Firewalls/fixtures/firewall.json index 423feca..6bd0e12 100644 --- a/tests/Unit/Models/Firewalls/fixtures/firewall.json +++ b/tests/Unit/Models/Firewalls/fixtures/firewall.json @@ -27,6 +27,12 @@ "server": { "id": 42 } + }, + { + "type": "label_selector", + "label_selector": { + "applied_to_resources": [] + } } ] } diff --git a/tests/Unit/Models/Firewalls/fixtures/firewalls.json b/tests/Unit/Models/Firewalls/fixtures/firewalls.json index c8ef6d8..92ba7f7 100644 --- a/tests/Unit/Models/Firewalls/fixtures/firewalls.json +++ b/tests/Unit/Models/Firewalls/fixtures/firewalls.json @@ -28,6 +28,12 @@ "server": { "id": 42 } + }, + { + "type": "label_selector", + "label_selector": { + "applied_to_resources": [] + } } ] }