Class: OneviewSDK::API200::Interconnect
- Defined in:
- lib/oneview-sdk/resource/api200/interconnect.rb
Overview
Interconnect resource implementation
Direct Known Subclasses
OneviewSDK::API300::C7000::Interconnect, OneviewSDK::API300::Synergy::Interconnect
Constant Summary collapse
- BASE_URI =
'/rest/interconnects'.freeze
- TYPE_URI =
'/rest/interconnect-types'.freeze
- UNIQUE_IDENTIFIERS =
%w(name uri serialNumber).freeze
Constants inherited from Resource
Resource::DEFAULT_REQUEST_HEADER
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Class Method Summary collapse
-
.get_type(client, name) ⇒ Array
Retrieves the interconnect type with name.
-
.get_types(client) ⇒ Object
Retrieves interconnect types.
Instance Method Summary collapse
-
#create ⇒ Object
Method is not available.
-
#delete ⇒ Object
Method is not available.
-
#initialize(client, params = {}, api_ver = nil) ⇒ Interconnect
constructor
Create a resource object, associate it with a client, and set its properties.
-
#name_servers ⇒ Object
Retrieves the named servers for this interconnect.
-
#patch(operation, path, value) ⇒ Object
Updates specific attributes for a given interconnect resource.
-
#reset_port_protection ⇒ Object
Triggers the reset port protection action.
-
#statistics(portName = nil, subportNumber = nil) ⇒ Object
Get statistics for an interconnect, for the specified port or subport.
-
#update ⇒ Object
Method is not available.
-
#update_port(portName, attributes) ⇒ Object
Updates an interconnect port.
Methods inherited from Resource
#==, #[], #[]=, build_query, #create!, #deep_merge!, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, #like?, #refresh, #retrieve!, #schema, schema, #set, #set_all, #to_file
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ Interconnect
Create a resource object, associate it with a client, and set its properties.
26 27 28 29 30 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 26 def initialize(client, params = {}, api_ver = nil) super # Default values: @data['type'] ||= 'InterconnectV3' end |
Class Method Details
.get_type(client, name) ⇒ Array
Retrieves the interconnect type with name
62 63 64 65 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 62 def self.get_type(client, name) results = get_types(client) results.find { |interconnect_type| interconnect_type['name'] == name } end |
.get_types(client) ⇒ Object
Retrieves interconnect types
52 53 54 55 56 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 52 def self.get_types(client) response = client.rest_get(TYPE_URI) response = client.response_handler(response) response['members'] end |
Instance Method Details
#create ⇒ Object
Method is not available
34 35 36 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 34 def create(*) unavailable_method end |
#delete ⇒ Object
Method is not available
46 47 48 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 46 def delete(*) unavailable_method end |
#name_servers ⇒ Object
Retrieves the named servers for this interconnect
68 69 70 71 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 68 def name_servers response = @client.rest_get(@data['uri'] + '/nameServers') response.body end |
#patch(operation, path, value) ⇒ Object
Updates specific attributes for a given interconnect resource
108 109 110 111 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 108 def patch(operation, path, value) response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }]) @client.response_handler(response) end |
#reset_port_protection ⇒ Object
Triggers the reset port protection action
99 100 101 102 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 99 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
88 89 90 91 92 93 94 95 96 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 88 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
Method is not available
40 41 42 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 40 def update(*) unavailable_method end |
#update_port(portName, attributes) ⇒ Object
Updates an interconnect port
76 77 78 79 80 81 82 83 |
# File 'lib/oneview-sdk/resource/api200/interconnect.rb', line 76 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 |