Class: OneviewSDK::API200::NetworkSet
- Defined in:
- lib/oneview-sdk/resource/api200/network_set.rb
Overview
Network set resource implementation
Direct Known Subclasses
Constant Summary collapse
- BASE_URI =
'/rest/network-sets'.freeze
Constants inherited from Resource
Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Class Method Summary collapse
-
.get_without_ethernet(client) ⇒ Array
Lists network sets excluding ethernet networks.
Instance Method Summary collapse
-
#add_ethernet_network(ethernet_network) ⇒ Object
Adds an ethernet network to the network set.
-
#get_without_ethernet ⇒ OneviewSDK::NetworkSet
Lists network set excluding ethernet networks.
-
#initialize(client, params = {}, api_ver = nil) ⇒ NetworkSet
constructor
Create a resource object, associate it with a client, and set its properties.
-
#remove_ethernet_network(ethernet_network) ⇒ Object
Removes an ethernet network from the network set.
-
#set_native_network(ethernet_network) ⇒ Object
Sets the native network for the network set.
Methods inherited from Resource
#==, #[], #[]=, build_query, #create, #create!, #deep_merge!, #delete, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #like?, #refresh, #retrieve!, #schema, schema, #set, #set_all, #to_file, #update
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ NetworkSet
Create a resource object, associate it with a client, and set its properties.
24 25 26 27 28 29 30 31 |
# File 'lib/oneview-sdk/resource/api200/network_set.rb', line 24 def initialize(client, params = {}, api_ver = nil) super # Default values: @data['connectionTemplateUri'] ||= nil @data['nativeNetworkUri'] ||= nil @data['networkUris'] ||= [] @data['type'] ||= 'network-set' end |
Class Method Details
.get_without_ethernet(client) ⇒ Array
Lists network sets excluding ethernet networks
55 56 57 58 |
# File 'lib/oneview-sdk/resource/api200/network_set.rb', line 55 def self.get_without_ethernet(client) response = client.rest_get(BASE_URI + '/withoutEthernet') client.response_handler(response) end |
Instance Method Details
#add_ethernet_network(ethernet_network) ⇒ Object
Adds an ethernet network to the network set
42 43 44 |
# File 'lib/oneview-sdk/resource/api200/network_set.rb', line 42 def add_ethernet_network(ethernet_network) @data['networkUris'] << ethernet_network['uri'] unless @data['networkUris'].include?(ethernet_network['uri']) end |
#get_without_ethernet ⇒ OneviewSDK::NetworkSet
Lists network set excluding ethernet networks
62 63 64 65 |
# File 'lib/oneview-sdk/resource/api200/network_set.rb', line 62 def get_without_ethernet response = @client.rest_get(@data['uri'] + '/withoutEthernet') @client.response_handler(response) end |
#remove_ethernet_network(ethernet_network) ⇒ Object
Removes an ethernet network from the network set
48 49 50 |
# File 'lib/oneview-sdk/resource/api200/network_set.rb', line 48 def remove_ethernet_network(ethernet_network) @data['networkUris'].delete(ethernet_network['uri']) if @data['networkUris'].include?(ethernet_network['uri']) end |
#set_native_network(ethernet_network) ⇒ Object
Sets the native network for the network set
35 36 37 38 |
# File 'lib/oneview-sdk/resource/api200/network_set.rb', line 35 def set_native_network(ethernet_network) @data['nativeNetworkUri'] = ethernet_network['uri'] @data['networkUris'] << ethernet_network['uri'] unless @data['networkUris'].include?(ethernet_network['uri']) end |