Index: trunk/extensions/OpenStackManager/OpenStackNovaSecurityGroupRule.php |
— | — | @@ -0,0 +1,43 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +# TODO: Make this an abstract class, and make the EC2 API a subclass |
| 5 | +class OpenStackNovaSecurityGroupRule { |
| 6 | + |
| 7 | + var $rule; |
| 8 | + |
| 9 | + function __construct( $apiInstanceResponse ) { |
| 10 | + $this->rule = $apiInstanceResponse; |
| 11 | + } |
| 12 | + |
| 13 | + function getToPort() { |
| 14 | + return $this->toPort; |
| 15 | + } |
| 16 | + |
| 17 | + function getFromPort() { |
| 18 | + return $this->fromPort; |
| 19 | + } |
| 20 | + |
| 21 | + function getIPProtocol() { |
| 22 | + return $this->ipProtocol; |
| 23 | + } |
| 24 | + |
| 25 | + function getIPRanges() { |
| 26 | + $ranges = array(); |
| 27 | + foreach ( $this->ipRanges as $iprange ) { |
| 28 | + $ranges[] = $iprange->cidrIp; |
| 29 | + } |
| 30 | + return $ranges; |
| 31 | + } |
| 32 | + |
| 33 | + function getGroups() { |
| 34 | + $groups = array(); |
| 35 | + foreach ( $this->groups as $group ) { |
| 36 | + $properties = array(); |
| 37 | + $properties['groupname'] = $group->groupName; |
| 38 | + $properties['project'] = $group->userId; |
| 39 | + $groups[] = $properties; |
| 40 | + } |
| 41 | + return $groups; |
| 42 | + } |
| 43 | + |
| 44 | +} |
Property changes on: trunk/extensions/OpenStackManager/OpenStackNovaSecurityGroupRule.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 45 | + native |
Index: trunk/extensions/OpenStackManager/OpenStackNovaSecurityGroup.php |
— | — | @@ -0,0 +1,33 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +# TODO: Make this an abstract class, and make the EC2 API a subclass |
| 5 | +class OpenStackNovaSecurityGroup { |
| 6 | + |
| 7 | + var $group; |
| 8 | + var $rules; |
| 9 | + |
| 10 | + function __construct( $apiInstanceResponse ) { |
| 11 | + $this->group = $apiInstanceResponse; |
| 12 | + $this->rules = array(); |
| 13 | + foreach ( $this->group->ipPermissions as $permission ) { |
| 14 | + $this->rules[] = new OpenStackNovaSecurityGroupRule( $permission ); |
| 15 | + } |
| 16 | + } |
| 17 | + |
| 18 | + function getGroupName() { |
| 19 | + return $this->group->groupName; |
| 20 | + } |
| 21 | + |
| 22 | + function getGroupDescription() { |
| 23 | + return $this->group->groupDescription; |
| 24 | + } |
| 25 | + |
| 26 | + function getOwner() { |
| 27 | + return $this->group->ownerId; |
| 28 | + } |
| 29 | + |
| 30 | + function getRules() { |
| 31 | + return $this->rules; |
| 32 | + } |
| 33 | + |
| 34 | +} |
Property changes on: trunk/extensions/OpenStackManager/OpenStackNovaSecurityGroup.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 35 | + native |