Cisco-UCS
view release on metacpan or search on metacpan
lib/Cisco/UCS/Common/Fan.pm view on Meta::CPAN
package Cisco::UCS::Common::Fan;
use warnings;
use strict;
use Scalar::Util qw(weaken);
use Carp qw(croak);
our $VERSION = '0.51';
our @ATTRIBUTES = qw(dn id model operability power presence revision serial
thermal tray vendor voltage);
our %ATTRIBUTES = (
performance => 'perf',
oper_state => 'operState'
);
{
no strict 'refs';
while ( my ($pseudo, $attribute) = each %ATTRIBUTES ) {
*{ __PACKAGE__ . '::' . $pseudo } = sub {
my $self = shift;
return $self->{$attribute}
}
}
foreach my $attribute (@ATTRIBUTES) {
*{ __PACKAGE__ . '::' . $attribute } = sub {
my $self = shift;
return $self->{$attribute}
}
}
}
sub new {
my ( $class, %args ) = @_;
my $self = {};
bless $self, $class;
defined $args{dn}
? $self->{dn} = $args{dn}
: croak 'dn not defined';
defined $args{id}
? $self->{id} = $args{id}
: croak 'id not defined';
defined $args{ucs}
? weaken( $self->{ucs} = $args{ucs} )
: croak 'ucs not defined';
my %attr = %{ $self->{ucs}->resolve_dn(
dn => $self->{dn}
)
};
%attr = %{ exists $attr{outConfig}{equipmentFan}
? $attr{outConfig}{equipmentFan}
: $attr{outConfig}{equipmentFanModule}
};
while ( my ($k, $v ) = each %attr) { $self->{$k} = $v }
return $self;
}
1;
__END__
=head1 NAME
Cisco::UCS::Common::Fan - Class for operations with a Cisco UCS fan.
=cut
=head1 SYNOPSIS
print 'Thermal: '. $ucs->chassis(1)->fan_module(2)->fan(1)->thermal ."\n";
=head1 DESCRIPTION
Cisco::UCS::Common::Fan is a class providing operations with a Cisco UCS fan.
Note that you are not supposed to call the constructor yourself, rather a
Cisco::UCS::Common::Fan object is created automatically by method calls to
other L<Cisco::UCS> objects like L<Cisco::UCS::Chassis::FanModule>.
=head1 METHODS
=head3 dn
Returns the distinguished name of the Cisco::UCS::Common::Fan object in the
Cisco UCS management hierarchy.
=head3 id
Returns the numerical identifier of the fan object.
=head3 model
Returns the model number of the specified fan object.
=head3 serial
Returns the serial number of the fan object.
=head3 operability
( run in 0.971 second using v1.01-cache-2.11-cpan-5a3173703d6 )