vultr / vultr-php

The Official Vultr API PHP Wrapper

Home Page:https://www.vultr.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] - No way to create a firewall rule with FirewallService

mercymantis opened this issue · comments

The createFirewallRule function is missing in src/Services/Firewall/FirewallService.php file. After implementing it, I had trouble setting a subnet to 0.0.0.0/0 because getInitializedProps() routine wouldn't return properties with a value of 0.

I ended up writing this to get what I needed working.

  • public function createFirewallRule(string $group_id, FirewallRule $rule) : FirewallRule
  • {
  •  $properties = $rule->getInitializedProps();
    
  •  if ( !isset( $properties['subnet_size'] ) )
    
  •      $properties['subnet_size'] = 0;
    
  •  return $this->createObject('firewalls/'.$group_id.'/rules', new FirewallRule(), $properties);
    
  • }

Whoops, I forgot to implement this function.

I'll do that tomorrow.

This has been implemented.

Good luck have fun!