Class: RedfishClient::Root
- Defined in:
- lib/redfish_client/root.rb
Overview
Root resource represents toplevel entry point into Redfish service data. Its main purpose is to provide authentication support for the API.
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#event_listener ⇒ EventListener?
Return event listener.
-
#find(oid) ⇒ Resource?
Find Redfish service object by OData ID field.
-
#find!(oid) ⇒ Resource
Find Redfish service object by OData ID field.
-
#login(username, password) ⇒ Object
Authenticate against the service.
-
#logout ⇒ Object
Sign out of the service.
Methods inherited from Resource
#[], #delete, #dig, #get, #initialize, #key?, #method_missing, #patch, #post, #refresh, #request, #respond_to_missing?, #to_s, #wait
Constructor Details
This class inherits a constructor from RedfishClient::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RedfishClient::Resource
Instance Method Details
#event_listener ⇒ EventListener?
Return event listener.
If the service does not support SSE, this function will return nil.
36 37 38 39 40 41 |
# File 'lib/redfish_client/root.rb', line 36 def event_listener address = dig("EventService", "ServerSentEventUri") return nil if address.nil? EventListener.new(ServerSentEvents.create_client(address)) end |
#find(oid) ⇒ Resource?
Find Redfish service object by OData ID field.
16 17 18 19 20 |
# File 'lib/redfish_client/root.rb', line 16 def find(oid) find!(oid) rescue NoResource nil end |
#find!(oid) ⇒ Resource
Find Redfish service object by OData ID field.
27 28 29 |
# File 'lib/redfish_client/root.rb', line 27 def find!(oid) Resource.new(@connector, oid: oid) end |
#login(username, password) ⇒ Object
Authenticate against the service.
Calling this method will select the appropriate method of authentication and try to login using provided credentials.
52 53 54 55 56 57 |
# File 'lib/redfish_client/root.rb', line 52 def login(username, password) @connector.set_auth_info( username, password, auth_test_path, session_path ) @connector.login end |
#logout ⇒ Object
Sign out of the service.
60 61 62 |
# File 'lib/redfish_client/root.rb', line 60 def logout @connector.logout end |