Class: VCloudSdk::Xml::NetworkConfigSection

Inherits:
Wrapper
  • Object
show all
Defined in:
lib/cloud/vcloud/xml/wrapper_classes/network_config_section.rb

Instance Method Summary collapse

Methods inherited from Wrapper

#==, #[], #[]=, #add_child, #attribute_with_ns, #content, #content=, #create_child, #create_qualified_name, #create_xpath_query, #doc_namespaces, #get_nodes, #href, #initialize, #name, #to_s, #type, #urn, #xpath

Constructor Details

This class inherits a constructor from VCloudSdk::Xml::Wrapper

Instance Method Details

#add_network_config(config) ⇒ Object



9
10
11
12
13
14
# File 'lib/cloud/vcloud/xml/wrapper_classes/network_config_section.rb', line 9

def add_network_config(config)
  unless config.is_a? NetworkConfig
    raise CloudError, "Only NetworkConfig can be added to #{self.class}"
  end
  add_child(config)
end

#delete_network_config(net_name) ⇒ Object

Raises:

  • (ObjectNotFoundError)


16
17
18
19
20
21
# File 'lib/cloud/vcloud/xml/wrapper_classes/network_config_section.rb', line 16

def delete_network_config(net_name)
  net_config = network_configs.find {|n| n.network_name == net_name }
  raise ObjectNotFoundError,
    "Cannot delete network #{net_name}: not found" unless net_config
  net_config.node.remove
end

#network_configsObject



5
6
7
# File 'lib/cloud/vcloud/xml/wrapper_classes/network_config_section.rb', line 5

def network_configs
  get_nodes("NetworkConfig")
end