Cisco-UCS
view release on metacpan or search on metacpan
lib/Cisco/UCS.pm view on Meta::CPAN
The primary aim of this package is to provide a simplified and abstract
interface to this management heirachy.
=head2 METHODS
=head3 new ( CLUSTER, PORT, PROTO, USERNAME, PASSWORD )
my $ucs = Cisco::UCS->new (
cluster => $cluster,
port => $port,
proto => $proto,
username => $username,
passwd => $passwd
);
Constructor method. Creates a new Cisco::UCS object representing a connection
to the Cisco UCSM XML API.
Parameters are:
=over 3
=item cluster
The common name of the target cluster. This name should be resolvable on the
host from which the script is run.
=item username
The username to use for the connection. This username needs to have the
correct RBAC role for the operations that one intends to perform.
=item passwd
The plaintext password of the username specified for the B<username> attribute
for the connection.
=item port
The port on which to connect to the UCSM XML API on the target cluster. This
parameter is optional and will default to 443 if not provided.
=item proto
The protocol with which to connect to the UCSM XML API on the target cluster.
This value is optional hould be one of 'http' or 'https' and will default to
'https' if not provided.
=back
=head3 login ()
$ucs->login;
print "Authentication token is $ucs->cookie\n";
Creates a connection to the XML API interface of a USCM management instance.
If sucessful, the attributes of the UCSM management instance are inherited by
the object. Most important of these parameters is 'cookie' representing the
authetication token that uniquely identifies the connection and which is
subsequently passed transparently on all further communications.
The default time-out value for a token is 10 minutes, therefore if you intend
to create a long-running session you should periodically call refresh.
=head3 refresh ()
$ucs->refresh;
Resets the expiry time limit of the existing authentication token to the
default timeout period of 10m. Usually not necessary for short-lived
connections.
=head3 logout ()
$ucs->logout;
Expires the current authentication token. This method should always be called
on completion of a script to expire the authentication token and free the
current session for use by others. The UCS XML API has a maximum number of
available connections, and a maximum number of sessions per user. In order to
ensure that the session remain available (especially if using common
credentials), you should always call this method on completion of a script, as
an argument to die, or in any eval where a script may fail and exit before
logging out;
=head3 cookie ()
print $ucs->cookie;
Returns the value of the authentication token.
=head3 cluster ()
print $ucs->cluster;
Returns the value of cluster as given in the constructor.
=head3 dn ()
print $ucs->dn;
Returns the distinguished name that specifies the base scope of the Cisco::UCS
object.
=cut
=head3 get_error_id ( $ID )
my %error = $ucs->get_error_id($id);
while (my($key,$value) = each %error) {
print "$key:\t$value\n";
}
B<This method is deprecated, please use the equivalent get_error method>.
Returns a hash containing the UCSM event detail for the given error id. This
method takes a single argument; the UCSM error_id of the desired error.
=cut
( run in 0.909 second using v1.01-cache-2.11-cpan-39bf76dae61 )