Class: OneviewSDK::API200::Switch

Inherits:
Resource
  • Object
show all
Defined in:
lib/oneview-sdk/resource/api200/switch.rb

Overview

Switch resource implementation

Direct Known Subclasses

OneviewSDK::API300::C7000::Switch

Constant Summary collapse

BASE_URI =
'/rest/switches'.freeze
TYPE_URI =
'/rest/switch-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

Instance Method Summary collapse

Methods inherited from Resource

#==, #[], #[]=, build_query, #create!, #deep_merge!, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #initialize, #like?, #retrieve!, #schema, schema, #set, #set_all, #to_file

Constructor Details

This class inherits a constructor from OneviewSDK::Resource

Class Method Details

.get_type(client, name) ⇒ Array

Retrieves the switch type with the name



63
64
65
66
# File 'lib/oneview-sdk/resource/api200/switch.rb', line 63

def self.get_type(client, name)
  results = get_types(client)
  results.find { |switch_type| switch_type['name'] == name }
end

.get_types(client) ⇒ Array

Retrieves the switch types



53
54
55
56
57
# File 'lib/oneview-sdk/resource/api200/switch.rb', line 53

def self.get_types(client)
  response = client.rest_get(TYPE_URI)
  response = client.response_handler(response)
  response['members']
end

Instance Method Details

#createObject

Method is not available

Raises:



28
29
30
# File 'lib/oneview-sdk/resource/api200/switch.rb', line 28

def create(*)
  unavailable_method
end

#deleteObject

Method is not available

Raises:



46
47
48
# File 'lib/oneview-sdk/resource/api200/switch.rb', line 46

def delete(*)
  unavailable_method
end

#environmental_configurationHash

Get settings that describe the environmental configuration



78
79
80
81
82
# File 'lib/oneview-sdk/resource/api200/switch.rb', line 78

def environmental_configuration
  ensure_client && ensure_uri
  response = @client.rest_get(@data['uri'] + '/environmentalConfiguration', {}, @api_version)
  @client.response_handler(response)
end

#refreshObject

Method is not available

Raises:



40
41
42
# File 'lib/oneview-sdk/resource/api200/switch.rb', line 40

def refresh(*)
  unavailable_method
end

#removetrue

Remove resource from OneView



24
# File 'lib/oneview-sdk/resource/api200/switch.rb', line 24

alias remove delete

#statistics(port_name = nil) ⇒ Hash

Get statistics for a switch or for the specified port.



71
72
73
74
# File 'lib/oneview-sdk/resource/api200/switch.rb', line 71

def statistics(port_name = nil)
  response = @client.rest_get("#{@data['uri']}/statistics/#{port_name}")
  response.body
end

#updateObject

Method is not available

Raises:



34
35
36
# File 'lib/oneview-sdk/resource/api200/switch.rb', line 34

def update(*)
  unavailable_method
end