# $Id$ # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary Abstract base class for HyperV components ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::C::ComponentState::HyperV =head1 SYNOPSIS use base 'NACL::C::ComponentState::HyperV'; =head1 DESCRIPTION NACL::C::ComponentState::HyperV is an abstract base class for all HyperV ComponentState libraries. It is derived from L and it provides HyperV specific component base class methods. =head1 ATTRIBUTES Same as those of L. (command interfaces are constrained to be sub-classes of C.) =cut package NACL::CS::ComponentState::HyperV; use strict; use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use warnings; use base 'NACL::CS::ComponentState'; use Params::Validate qw(:all); use NACL::APISet::Exceptions::ResponseException qw(:try); use Class::MethodMaker [ scalar => [ { -type => 'NACL::C::HyperV' }, 'command_interface' ], ]; sub get_ref { $Log->enter(); my ($self, @args) = @_; my %opts = validate_with( params => \@args, spec => { ref => { type => SCALAR }, ref_of => { type => SCALAR }, record => { type => SCALARREF}, apiset => { isa => "NACL::APISet", } } ); my $record = $opts{record}; my $req = $opts{ref_of} . ".get_record"; my $apiset = $opts{apiset}; my $ref = $opts{ref}; try { $$record = $apiset->simple_request($req, $ref)->get_parsed_output(); } catch NACL::APISet::Exceptions::ResponseException with { my $ex = shift; $ex->throw() if ($ex->text() !~ /HANDLE_INVALID/); }; $Log->exit(); } sub get_name { $Log->enter(); my ($self, @args) = @_; my %opts = validate_with( params => \@args, spec => { ref => { type => SCALAR }, ref_of => { type => SCALAR }, apiset => { isa => "NACL::APISet", } } ); my $req = $opts{ref_of} . ".get_name_label"; my $apiset = $opts{apiset}; my $ref = $opts{ref}; $Log->exit(); return $apiset->simple_request($req, $ref)->get_parsed_output()->[0]; } 1;