r80132 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80131‎ | r80132 | r80133 >
Date:23:38, 12 January 2011
Author:laner
Status:deferred
Tags:
Comment:
Adding in some backend support for security groups
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackNovaSecurityGroup.php (added) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaSecurityGroupRule.php (added) (history)

Diff [purge]

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
145 + 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
135 + native

Status & tagging log