class OneviewSDK::API200::Interconnect

Interconnect resource implementation

Constants

BASE_URI
TYPE_URI
UNIQUE_IDENTIFIERS

Public Class Methods

get_type(client, name) click to toggle source

Retrieves the interconnect type with name @param [OneviewSDK::Client] client The client object for the OneView appliance @param [String] name Interconnect type name @return [Array] Interconnect type

# 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) click to toggle source

Retrieves interconnect types @param [OneviewSDK::Client] client The client object for the OneView appliance

# 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
new(client, params = {}, api_ver = nil) click to toggle source

Create a resource object, associate it with a client, and set its properties. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Hash] params The options for this resource (key-value pairs) @param [Integer] api_ver The api version to use when interracting with this resource.

Calls superclass method OneviewSDK::Resource::new
# File lib/oneview-sdk/resource/api200/interconnect.rb, line 26
def initialize(client, params = {}, api_ver = nil)
  super
  # Default values:
  @data['type'] ||= 'InterconnectV3'
end

Public Instance Methods

create(*) click to toggle source

Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available

# File lib/oneview-sdk/resource/api200/interconnect.rb, line 34
def create(*)
  unavailable_method
end
delete(*) click to toggle source

Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available

# File lib/oneview-sdk/resource/api200/interconnect.rb, line 46
def delete(*)
  unavailable_method
end
name_servers() click to toggle source

Retrieves the named servers for this interconnect

# 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) click to toggle source

Updates specific attributes for a given interconnect resource @param [String] operation operation to be performed @param [String] path path @param [String] value value

# 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() click to toggle source

Triggers the reset port protection action

# 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) click to toggle source

Get statistics for an interconnect, for the specified port or subport @param [String] portName port to retrieve statistics @param [String] subportNumber subport to retrieve statistics

# 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(*) click to toggle source

Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available

# File lib/oneview-sdk/resource/api200/interconnect.rb, line 40
def update(*)
  unavailable_method
end
update_port(portName, attributes) click to toggle source

Updates an interconnect port @param [String] portName port name @param [Hash] attributes hash with attributes and values to be changed

# 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