Mojo::Redfish::Client - A Redfish client with a Mojo flair
my $client = Mojo::Redfish::Client->new(host => '192.168.0.1'); my $system = $client->root->get('/Systems')->get('/Members')->first; my $name = $system->value('/Name'); say "Name: $name";
Redfish is a modern standards-based system for querying computer systems for information. It replaces the existing IPMI "standard", such as it was, both in standardization and in using JSON over HTTP rather than binary protocols.
Mojo::Redfish::Client is, as the name suggests, a client for Redfish. It works to smooth out some of the common pain points of working with Redfish, especially the task of walking the data structure to find relevant information.
This is still a work-in-progress, however the author uses it in work application so every effort will be made to keep the api reasonably stable while improving where possible.
Mojo::Redfish::Client inherits all attributes from Mojo::Base and implements the following new ones.
The per-operation concurrency limit. This is not a global concurrency, it only limits concurrency when a single operation would make several concurrent requests within it. For example (and the only current case), "get_p" in Mojo::Redfish::Client on an array. If zero (or otherwise falsey), no concurrency limit will be applied. Default is 5.
5
The Redfish host.
Password used for authentication by the default "ua" (with "username").
If true, the default "ua" will establish the connection using SSL/TLS by setting the request scheme to https. If false, the request scheme will be http. If not defined, the url scheme will not be set. Default is true.
https
http
Session token to be used by the default "ua", overrides "username" and "password".
The instance of Mojo::UserAgent used to make requests. The default is an instance which subscribes to "prepare" in Mojo::UserAgent to set authentication and ssl.
Username used for authentication by the default "ua" (with "password").
Mojo::Redfish::Client inherits all methods from Mojo::Base and implements the following new ones.
my $result = $client->get('/redfish/v1/Systems');
Requests the requested url via the "ua". Returns an instance of Mojo::Redfish::Client::Result. Dies on errors (the exact exception and behavior is subject to change).
Same as "get" but returns a Mojo::Promise that resolves to the result.
my $result = $client->root;
Requests the Redfish root url (/redfish/v1) from the "host" via "get" or fetches a cached copy. Caches and returns the result.
/redfish/v1
# same as (except for the caching) my $result = $client->get('/redfish/v1');
Same as "root" but returns a Mojo::Promise that resolves to the (possibly cached) root result.
This module is still in early development. Future work will include
Session management
This module's development was sponsored by ServerCentral Turing Group.
http://github.com/jberger/Mojo-Redfish-Client
Joel Berger, <joel.a.berger@gmail.com>
None yet.
Copyright (C) 2019 by "AUTHOR" and "CONTRIBUTORS"
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Mojo::Redfish::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Redfish::Client
CPAN shell
perl -MCPAN -e shell install Mojo::Redfish::Client
For more information on module installation, please visit the detailed CPAN module installation guide.