Class: HP::Cloud::SecurityGroupHelper
- Inherits:
-
BaseHelper
- Object
- BaseHelper
- HP::Cloud::SecurityGroupHelper
- Defined in:
- lib/hpcloud/security_group_helper.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from BaseHelper
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(connection, foggy = nil) ⇒ SecurityGroupHelper
constructor
A new instance of SecurityGroupHelper.
- #save ⇒ Object
Methods inherited from BaseHelper
#destroy, #is_valid?, #set_error, #to_hash
Constructor Details
#initialize(connection, foggy = nil) ⇒ SecurityGroupHelper
Returns a new instance of SecurityGroupHelper.
31 32 33 34 35 36 37 38 |
# File 'lib/hpcloud/security_group_helper.rb', line 31 def initialize(connection, foggy = nil) super(connection, foggy) return if foggy.nil? @id = foggy.id @name = foggy.name @description = foggy.description @tenant_id = foggy.tenant_id end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
25 26 27 |
# File 'lib/hpcloud/security_group_helper.rb', line 25 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
25 26 27 |
# File 'lib/hpcloud/security_group_helper.rb', line 25 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
25 26 27 |
# File 'lib/hpcloud/security_group_helper.rb', line 25 def name @name end |
Class Method Details
.get_keys ⇒ Object
27 28 29 |
# File 'lib/hpcloud/security_group_helper.rb', line 27 def self.get_keys() return [ "id", "name", "description" ] end |
Instance Method Details
#save ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/hpcloud/security_group_helper.rb', line 40 def save return false if is_valid? == false if @fog.nil? hsh = {:name => @name, :description => @description} security_group = @connection.network.security_groups.new(hsh) if security_group.nil? set_error("Error creating security group") return false end security_group.save @fog = security_group @id = security_group.id return true else raise "Update not implemented" end end |