Class: Fog::Generators::Compute::VcloudDirector::VmNetwork
- Inherits:
-
Object
- Object
- Fog::Generators::Compute::VcloudDirector::VmNetwork
- Defined in:
- lib/fog/vcloud_director/generators/compute/vm_network.rb
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
Instance Method Summary collapse
- #body(opts = {}) ⇒ Object
- #generate_xml ⇒ Object
- #header ⇒ Object
-
#initialize(attrs = {}) ⇒ VmNetwork
constructor
A new instance of VmNetwork.
- #ip_address ⇒ Object
- #ip_address=(new_ip_address) ⇒ Object
- #ip_address_allocation_mode ⇒ Object
- #ip_address_allocation_mode=(new_ip_address_allocation_mode) ⇒ Object
- #is_connected ⇒ Object
- #is_connected=(new_is_connected) ⇒ Object
- #network ⇒ Object
- #network=(new_network_name) ⇒ Object
- #tail ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ VmNetwork
Returns a new instance of VmNetwork.
41 42 43 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 41 def initialize(attrs={}) @attrs = attrs end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
39 40 41 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 39 def attrs @attrs end |
Instance Method Details
#body(opts = {}) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 97 def body(opts={}) body = <<EOF <ovf:Info>#{opts[:info]}</ovf:Info> <PrimaryNetworkConnectionIndex>#{opts[:primary_network_connection_index]}</PrimaryNetworkConnectionIndex> <NetworkConnection network="#{opts[:network]}" needsCustomization="#{opts[:needs_customization]}"> <NetworkConnectionIndex>#{opts[:network_connection_index]}</NetworkConnectionIndex> <IpAddress>#{opts[:ip_address]}</IpAddress> <IsConnected>#{opts[:is_connected]}</IsConnected> <MACAddress>#{opts[:mac_address]}</MACAddress> <IpAddressAllocationMode>#{opts[:ip_address_allocation_mode]}</IpAddressAllocationMode> </NetworkConnection> EOF end |
#generate_xml ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 45 def generate_xml output = "" output << header output << body(@attrs) output << tail output end |
#header ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 85 def header '<NetworkConnectionSection xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" ovf:required="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1.5 http://10.194.1.65/api/v1.5/schema/master.xsd">' end |
#ip_address ⇒ Object
61 62 63 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 61 def ip_address @attrs[:ip_address] end |
#ip_address=(new_ip_address) ⇒ Object
65 66 67 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 65 def ip_address=(new_ip_address) @attrs[:ip_address] = new_ip_address end |
#ip_address_allocation_mode ⇒ Object
77 78 79 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 77 def ip_address_allocation_mode @attrs[:ip_address_allocation_mode] end |
#ip_address_allocation_mode=(new_ip_address_allocation_mode) ⇒ Object
81 82 83 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 81 def ip_address_allocation_mode=(new_ip_address_allocation_mode) @attrs[:ip_address_allocation_mode] = new_ip_address_allocation_mode end |
#is_connected ⇒ Object
69 70 71 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 69 def is_connected @attrs[:is_connected] end |
#is_connected=(new_is_connected) ⇒ Object
73 74 75 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 73 def is_connected=(new_is_connected) @attrs[:is_connected] = new_is_connected end |
#network ⇒ Object
53 54 55 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 53 def network @attrs[:network] end |
#network=(new_network_name) ⇒ Object
57 58 59 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 57 def network=(new_network_name) @attrs[:network] = new_network_name end |
#tail ⇒ Object
113 114 115 |
# File 'lib/fog/vcloud_director/generators/compute/vm_network.rb', line 113 def tail '</NetworkConnectionSection>' end |