# $Id$ # # Copyright (c) 2014 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary VolumeFileGetSpaceReservationInfo ComponentState Module ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::VolumeFileGetSpaceReservationInfo =head1 DESCRIPTION C is a derived class of L. Object(s) of this type are returned when NACL::C::VolumeFile->get_space_reservation_info() is invoked. (This module does not represent the state of any element, but is an object representation of the output obtained when NACL::C::VolumeFile->get_space_reservation_info() is invoked.) =head1 ATTRIBUTES The fields of the output are fields of the ComponentState object. =over =item C<< is_fill_enabled >> Is Fill Enabled Filled in for CMode ZAPI. =item C<< is_overwrite_enabled >> Is Overwrite Enabled Filled in for CMode ZAPI. =item C<< vserver >> Vserver Name For "filter" =item C<< path >> File Path Filled in for CMode ZAPI. For "filter" /vol/component_vserver_root_vol/file_1402025959 =back =cut package NACL::CS::VolumeFileGetSpaceReservationInfo; use base 'NACL::CS::ComponentState::ONTAP'; use strict; use warnings; use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use NACL::Exceptions::NoElementsFound qw(:try); use Class::MethodMaker [ scalar => 'path', scalar => 'vserver', scalar => 'is_fill_enabled', scalar => 'is_overwrite_enabled', ]; =head1 METHODS =head2 fetch my $VolumeFileSpace_state = NACL::CS::VolumeFileGetSpaceReservationInfo->fetch(command_interface => $ci, ...); my @VolumeFileSpace_states = NACL::CS::VolumeFileGetSpaceReservationInfo->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. Supports CMode ZAPI. Invokes "file-get-space-reservation-info" API for CMode ZAPI. =over =item Exceptions =over =item C When there are no elements matching the query specified or elements of that type doesn't exist, then this exception will be thrown. =back =back =cut sub fetch { $Log->enter() if $may_enter; my ($pkg_or_obj, @args) = @_; my @state_objs = $pkg_or_obj->SUPER::fetch( @args, choices => [ { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode' }, ], exception_text => 'No matching volume file(s) found', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } ## end sub fetch sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my ($pkg_or_obj, %opts) = @_; my $apiset = $opts{apiset}; my $command_interface = $opts{command_interface}; my %api_args = ( path => $opts{filter}->{path} ); $pkg_or_obj->_handle_zapi_vserver_context( api_opts => \%api_args, vserver => $opts{filter}->{vserver}, command_interface => $opts{command_interface}, ); my $response = $apiset->file_get_space_reservation_info(%api_args); my $output = $response->get_parsed_output()->[0]; my $obj = $pkg_or_obj->new(command_interface => $opts{command_interface}); $obj->_set_fields(row => $output); $Log->exit() if $may_exit; return $obj; } ## end sub _fetch_cmode_zapi 1;