Module: FogExtensions::Gridscale::Server
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/fog_extensions/gridscale/server.rb
Instance Attribute Summary collapse
-
#interfaces_attributes ⇒ Object
Returns the value of attribute interfaces_attributes.
-
#ipv4_address ⇒ Object
Returns the value of attribute ipv4_address.
-
#ipv6_address ⇒ Object
Returns the value of attribute ipv6_address.
-
#mac ⇒ Object
Returns the value of attribute mac.
-
#object_uuid ⇒ Object
Returns the value of attribute object_uuid.
-
#server_uuid ⇒ Object
Returns the value of attribute server_uuid.
Instance Method Summary collapse
- #ip4_add_in ⇒ Object
- #ip6_add_in ⇒ Object
- #ip_addresses ⇒ Object
- #mac_addr ⇒ Object
- #reset ⇒ Object
- #state ⇒ Object
- #to_s ⇒ Object
- #vm_description ⇒ Object
Instance Attribute Details
#interfaces_attributes ⇒ Object
Returns the value of attribute interfaces_attributes.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def interfaces_attributes @interfaces_attributes end |
#ipv4_address ⇒ Object
Returns the value of attribute ipv4_address.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def ipv4_address @ipv4_address end |
#ipv6_address ⇒ Object
Returns the value of attribute ipv6_address.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def ipv6_address @ipv6_address end |
#mac ⇒ Object
Returns the value of attribute mac.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def mac @mac end |
#object_uuid ⇒ Object
Returns the value of attribute object_uuid.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def object_uuid @object_uuid end |
#server_uuid ⇒ Object
Returns the value of attribute server_uuid.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def server_uuid @server_uuid end |
Instance Method Details
#ip4_add_in ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 30 def ip4_add_in x = nil if interfaces_attributes != nil interfaces_attributes.each do |key, value| if value["ipv4_uuid"] !=nil && value["ipv4_uuid"] != "" x = service.ips.get(value["ipv4_uuid"]) end end end x.ip end |
#ip6_add_in ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 43 def ip6_add_in x = nil if interfaces_attributes != nil interfaces_attributes.each do |key, value| if value["ipv6_uuid"] !=nil && value["ipv6_uuid"] != "" x = service.ips.get(value["ipv6_uuid"]) end end end x.ip end |
#ip_addresses ⇒ Object
25 26 27 28 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 25 def ip_addresses [ipv4_address, ipv6_address].flatten.select(&:present?) end |
#mac_addr ⇒ Object
56 57 58 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 56 def mac_addr :mac end |
#reset ⇒ Object
17 18 19 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 17 def reset reboot end |
#state ⇒ Object
8 9 10 11 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 8 def state requires :status @state ||= status end |
#to_s ⇒ Object
13 14 15 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 13 def to_s name end |
#vm_description ⇒ Object
21 22 23 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 21 def vm_description format(_('%{cpus} CPUs and %{ram} memory'), :cpus => cores, :ram => memory) end |