Class: Fog::Generators::Compute::VcloudDirector::NetworkConfigSection
- Inherits:
-
Object
- Object
- Fog::Generators::Compute::VcloudDirector::NetworkConfigSection
- Defined in:
- lib/fog/vcloud_director/generators/compute/network_config_section.rb
Overview
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #generate_xml ⇒ Object
-
#initialize(options = {}) ⇒ NetworkConfigSection
constructor
A new instance of NetworkConfigSection.
Constructor Details
#initialize(options = {}) ⇒ NetworkConfigSection
Returns a new instance of NetworkConfigSection.
9 10 11 |
# File 'lib/fog/vcloud_director/generators/compute/network_config_section.rb', line 9 def initialize(={}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/fog/vcloud_director/generators/compute/network_config_section.rb', line 7 def @options end |
Instance Method Details
#generate_xml ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fog/vcloud_director/generators/compute/network_config_section.rb', line 13 def generate_xml body = Nokogiri::XML::Builder.new do |xml| attrs = { :xmlns => 'http://www.vmware.com/vcloud/v1.5', 'xmlns:ovf' => 'http://schemas.dmtf.org/ovf/envelope/1' } xml.NetworkConfigSection(attrs){ xml['ovf'].Info [:NetworkConfig].each do |network_config| network_name = {networkName: network_config[:networkName]} if network_config[:networkName] xml.NetworkConfig(network_name){ xml.Description network_config[:Description] if configuration = network_config[:Configuration] xml.Configuration { if ipScopes = configuration[:IpScopes] xml.IpScopes { if ipScope = ipScopes[:IpScope] xml.IpScope { xml.IsInherited ipScope[:IsInherited] xml.Gateway ipScope[:Gateway] xml.Netmask ipScope[:Netmask] xml.Dns1 ipScope[:Dns1] if ipScope[:Dns1] xml.Dns2 ipScope[:Dns2] if ipScope[:Dns2] xml.IsEnabled ipScope[:IsEnabled] if ipScope[:IsEnabled] if ipRanges = ipScope[:IpRanges] xml.IpRanges { if ipRange = ipRanges[:IpRange] xml.IpRange { xml.StartAddress ipRange[:StartAddress] xml.EndAddress ipRange[:EndAddress] } end } end } end } end if parent_network = configuration[:ParentNetwork] xml.ParentNetwork({href: parent_network[:href], id: parent_network[:id], name: parent_network[:name]}) end xml.FenceMode configuration[:FenceMode] if configuration[:FenceMode] xml.RetainNetInfoAcrossDeployments configuration[:RetainNetInfoAcrossDeployments] if configuration[:RetainNetInfoAcrossDeployments] } end #Configuraton xml.IsDeployed configuration[:IsDeployed] if configuration[:IsDeployed] } end } end.to_xml end |