# $Id: //depot/prod/test/main/lib/NACL/CS/Datasource.pm $ # # Copyright (c) 2013 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary Datasource ComponentState Module (auto-generated by OCUM CGT) ## @author dl-mpo-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::DFM::Datasource =head1 DESCRIPTION C is a derived class of L. It represents the state of a Datasource. A related class is L, which represents access to OCUM Datasource. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the Datasource element are the attributes of the Datasource ComponentState. =over =item C<< protocol >> =item C<< communication_status >> =item C<< analysis_status_message >> =item C<< analysis_status >> =item C<< port >> =item C<< hostname_or_ip >> =item C<< datasource_id >> =item C<< acquisition_status_message >> =item C<< acquisition_status >> =back =cut package NACL::CS::DFM::Datasource; use strict; use warnings; use Params::Validate qw(validate validate_with SCALAR ARRAYREF HASHREF); use NACL::ComponentUtils qw(Dumper); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use base 'NACL::CS::ComponentState::DFM'; use Class::MethodMaker [ new => [ '-hash', 'new' ], scalar => 'protocol', scalar => 'communication_status', scalar => 'analysis_status_message', scalar => 'analysis_status', scalar => 'port', scalar => 'hostname_or_ip', scalar => 'datasource_id', scalar => 'acquisition_status_message', scalar => 'acquisition_status', ]; =head1 METHODS =head2 fetch my $state = NACL::CS::DFM::Datasource->fetch(command_interface => $ci, ...); my @states = NACL::CS::DFM::Datasource->fetch(command_interface => $ci, ...); (Class method) Discovers which elements are present and returns their state in ComponentState objects. Called in scalar context it returns only one state object, in list context it returns all state objects. See L for a more detailed description along with a complete explanation of the options it accepts. =cut sub fetch { $Log->enter() if $may_enter; my $pkg = shift; my @state_objs = $pkg->SUPER::fetch( @_, choices => [ { method => '_fetch_zapi', interface => 'ZAPI', set => 'DFM', }, ], exception_text => 'No matching Datasource(s) found.', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } sub _fetch_zapi { $Log->enter() if $may_enter; my $pkg = shift; my @state_objs = $pkg->SUPER::_fetch_dfm_zapi( @_, api => 'datasource-list-info-iter', ); $Log->exit() if $may_exit; return @state_objs; } sub _extra_filter_fields { $Log->enter() if $may_enter; $Log->exit() if $may_exit; return [ qw( datasource-id ) ]; } 1;