Class: OneviewSDK::Interconnect
- Defined in:
- lib/oneview-sdk/resource/interconnect.rb
Overview
Interconnect resource implementation
Constant Summary collapse
- BASE_URI =
'/rest/interconnects'.freeze
- TYPE_URI =
'/rest/interconnect-types'.freeze
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Class Method Summary collapse
-
.get_type(client, name) ⇒ Array
Retrieve interconnect ype with name.
-
.get_types(client) ⇒ Object
Retrieve interconnect types.
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
-
#initialize(client, params = {}, api_ver = nil) ⇒ Interconnect
constructor
A new instance of Interconnect.
-
#name_servers ⇒ Object
Retrieve named servers for this interconnect.
-
#reset_port_protection ⇒ Object
Triggers a reset of port protection.
-
#statistics(portName = nil, subportNumber = nil) ⇒ Object
Get statistics for an interconnect, for the specified port or subport.
- #update ⇒ Object
-
#update_attribute(operation, path, value) ⇒ Object
Update specific attributes of a given interconnect resource.
-
#update_port(portName, attributes) ⇒ Object
Updates an interconnect port.
Methods inherited from Resource
#==, #[], #[]=, #create!, #each, #eql?, #exists?, find_by, from_file, get_all, #like?, #refresh, #retrieve!, #schema, schema, #set, #set_all, #to_file
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ Interconnect
Returns a new instance of Interconnect.
7 8 9 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 7 def initialize(client, params = {}, api_ver = nil) super end |
Class Method Details
.get_type(client, name) ⇒ Array
Retrieve interconnect ype with name
35 36 37 38 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 35 def self.get_type(client, name) results = get_types(client) results.find { |interconnect_type| interconnect_type['name'] == name } end |
.get_types(client) ⇒ Object
Retrieve interconnect types
25 26 27 28 29 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 25 def self.get_types(client) response = client.rest_get(TYPE_URI) response = client.response_handler(response) response['members'] end |
Instance Method Details
#create ⇒ Object
11 12 13 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 11 def create unavailable_method end |
#delete ⇒ Object
19 20 21 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 19 def delete unavailable_method end |
#name_servers ⇒ Object
Retrieve named servers for this interconnect
41 42 43 44 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 41 def name_servers response = @client.rest_get(@data['uri'] + '/nameServers') response.body end |
#reset_port_protection ⇒ Object
Triggers a reset of port protection
72 73 74 75 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 72 def reset_port_protection response = @client.rest_put(@data['uri'] + '/resetportprotection') @client.response_handler(response) end |
#statistics(portName = nil, subportNumber = nil) ⇒ Object
Get statistics for an interconnect, for the specified port or subport
61 62 63 64 65 66 67 68 69 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 61 def statistics(portName = nil, subportNumber = nil) uri = if subportNumber.nil? "#{@data['uri']}/statistics/#{portName}" else "#{@data['uri']}/statistics/#{portName}/subport/#{subportNumber}" end response = @client.rest_get(uri) response.body end |
#update ⇒ Object
15 16 17 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 15 def update unavailable_method end |
#update_attribute(operation, path, value) ⇒ Object
Update specific attributes of a given interconnect resource
81 82 83 84 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 81 def update_attribute(operation, path, value) response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }]) @client.response_handler(response) end |
#update_port(portName, attributes) ⇒ Object
Updates an interconnect port
49 50 51 52 53 54 55 56 |
# File 'lib/oneview-sdk/resource/interconnect.rb', line 49 def update_port(portName, attributes) @data['ports'].each do |port| next unless port['name'] == portName attributes.each { |key, value| port[key.to_s] = value } response = @client.rest_put(@data['uri'] + '/ports', 'body' => port) @client.response_handler(response) end end |