# This is the data structure it accepts, this is the output of get_vm_network # # {:type=>"application/vnd.vmware.vcloud.networkConnectionSection+xml", # :href=> # "https://example.com/api/vApp/vm-8b74d95a-ee91-4f46-88d8-fc92be0dbaae/networkConnectionSection/", # :id=>"vm-8b74d95a-ee91-4f46-88d8-fc92be0dbaae", # :primary_network_connection_index=>0, # :network=>"DevOps - Dev Network Connection", # :needs_customization=>true, # :network_connection_index=>0, # :ip_address=>"10.192.0.130", # :is_connected=>true, # :mac_address=>"00:50:56:01:00:8d", # :ip_address_allocation_mode=>"POOL"} # # # This is what it generates # # # Specifies the available VM network connections # 0 # # 0 # 10.192.0.130 # true # 00:50:56:01:00:8d # POOL # # # # module Fog module Generators module Compute module VcloudDirector class VmNetwork attr_reader :attrs def initialize(attrs={}) @attrs = attrs end def generate_xml output = "" output << header output << body(@attrs) output << tail output end def network @attrs[:network] end def network=(new_network_name) @attrs[:network] = new_network_name end def ip_address @attrs[:ip_address] end def ip_address=(new_ip_address) @attrs[:ip_address] = new_ip_address end def is_connected @attrs[:is_connected] end def is_connected=(new_is_connected) @attrs[:is_connected] = new_is_connected end def ip_address_allocation_mode @attrs[:ip_address_allocation_mode] end def ip_address_allocation_mode=(new_ip_address_allocation_mode) @attrs[:ip_address_allocation_mode] = new_ip_address_allocation_mode end def header '' end def body(opts={}) body = <#{opts[:info]} #{opts[:primary_network_connection_index]} #{opts[:network_connection_index]} #{opts[:ip_address]} #{opts[:is_connected]} #{opts[:mac_address]} #{opts[:ip_address_allocation_mode]} EOF end def tail '' end end end end end end