class BrocadeAPIClient::Ports
Ports
REST API Methods
Public Class Methods
new(http_client)
click to toggle source
# File lib/BrocadeAPIClient/ports.rb, line 13 def initialize(http_client) @http_client = http_client @base_url = '/resourcegroups/All' end
Public Instance Methods
allports()
click to toggle source
# File lib/BrocadeAPIClient/ports.rb, line 18 def allports api_url = @base_url + '/fcports' _response, _body = @http_client.get(api_url) end
change_persistentportstates(switchwwn, state, *portwwns)
click to toggle source
# File lib/BrocadeAPIClient/ports.rb, line 32 def change_persistentportstates(switchwwn, state, *portwwns) payload = {} api_url = @base_url + '/fcswitches/' + switchwwn.upcase + '/fcports/fcportpersistentstate' portwwns.map!(&:upcase) payload['fcPortState'] = state payload['fcPortWWNs'] = portwwns _response, _body = @http_client.post(api_url, body: payload) end
change_portstates(switchwwn, state, *portwwns)
click to toggle source
# File lib/BrocadeAPIClient/ports.rb, line 23 def change_portstates(switchwwn, state, *portwwns) payload = {} portwwns.map!(&:upcase) api_url = @base_url + '/fcswitches/' + switchwwn.upcase + '/fcports/fcportstate' payload['fcPortState'] = state payload['fcPortWWNs'] = portwwns _response, _body = @http_client.post(api_url, body: payload) end
set_portname(switchwwn, portwwn, portname)
click to toggle source
# File lib/BrocadeAPIClient/ports.rb, line 41 def set_portname(switchwwn, portwwn, portname) porthash = {} portarray = [] api_url = @base_url + '/fcswitches/' + switchwwn.upcase + '/fcports/fcportnames' porthash['fcPortWWN'] = portwwn.upcase porthash['fcPortName'] = portname portarray.push(porthash) payload = { 'fcPortNameChangeReqEntry' => portarray } _response, _body = @http_client.post(api_url, body: payload) end