# $Id$ # # Copyright (c) 2016 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary ComponentState Module for the method NACL::CS::ApplicationProvisionShowAggrModel->fetch() ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::ApplicationProvisionShowAggrModel =head1 DESCRIPTION C is a derived class of L. Object(s) of this type are returned when NACL::CS::ApplicationProvisionShowAggrModel->fetch() is invoked =head1 ATTRIBUTES The fields of the output are fields of the ComponentState object. =over =item C<< free_space >> Space Available for Provisioning Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< modeled_space >> Total Modeled Space for All Volumes Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< mirror >> Mirrored possible value(s) are, true,false Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< uuid >> UUID Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< node >> Node possible value(s) are, ,local Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< size >> Size Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< used_iops >> Current IOPs Filled in for CMode CLI/ZAPI iter =item C<< promised_iops >> IOPs Promised for All Volumes Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< optimal_iops >> Optimal IOPs Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< modeled_iops >> Total Modeled IOPs for All volumes Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< volcount >> Number of Volumes Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< used_space >> Used Space Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< home_name >> Home Node Name Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< aggregate >> Aggregate Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< storage_type >> Storage Type possible value(s) are, hdd , hybrid , lun , ssd , vmdisk Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< promised_space >> Space Promised for All Volumes Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< availsize >> Available Size Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< system_reserve_space >> System Reserved Space Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< cluster_id >> Home Cluster ID Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< used_iops_str >> Filled in for CMode CLI/ZAPI iter =item C<< free_iops >> IOPs Available for Provisioning Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =back =cut package NACL::CS::ApplicationProvisionShowAggrModel; use strict; use warnings; use Params::Validate qw(validate); 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 NACL::CS::ComponentState::ZapiSkip qw(make_zapi_skip); use NACL::CS::ComponentState::ZapiArray qw(make_zapi_array); use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ scalar => 'free_space', scalar => 'modeled_space', scalar => 'mirror', scalar => 'uuid', scalar => 'node', scalar => 'size', scalar => 'used_iops', scalar => 'promised_iops', scalar => 'optimal_iops', scalar => 'modeled_iops', scalar => 'volcount', scalar => 'used_space', scalar => 'home_name', scalar => 'aggregate', scalar => 'storage_type', scalar => 'promised_space', scalar => 'availsize', scalar => 'system_reserve_space', scalar => 'cluster_id', scalar => 'used_iops_str', scalar => 'free_iops', ]; =head1 METHODS =head2 fetch my $ApplicationProvisionShowAggrModel_state = NACL::CS::ApplicationProvisionShowAggrModel->fetch(command_interface => $ci, ...); my @ApplicationProvisionShowAggrModel_states = NACL::CS::ApplicationProvisionShowAggrModel->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. Uses CMode CLI/ZAPI. Invokes application-provisioning-aggr-get-iter API for CMode ZAPI iter. =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, @args) = @_; my @state_objs = $pkg->SUPER::fetch( @args, show_cmd => 'application provision show-aggr-model', choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode', zapi_type => 'none', }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode', zapi_type => 'iter', check => '_check_fetch_cmode_zapi_iter', }, ], exception_text => 'No matching ApplicationProvisionShowAggrModel(s) found', frontend => 'NACL::CS::ApplicationProvisionShowAggrModel::fetch', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } sub _fetch_cmode_cli { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(@args, api => 'application_provisioning_show_aggr_model',); $Log->exit() if $may_exit; return @state_objs; } sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_zapi( @args, copy => [ qw(free-space modeled-space mirror node uuid size promised-iops modeled-iops optimal-iops used-space volcount aggregate home-name storage-type promised-space availsize system-reserve-space cluster-id free-iops ) ], api => "application-provisioning-aggr-get-iter", ); $Log->exit() if $may_exit; return @state_objs; } sub _check_fetch_cmode_zapi_iter { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; my @invalid_fields = $pkg->_invalid_fields_check( filter => $opts{filter}, requested_fields => $opts{requested_fields}, _fields => [qw(used-iops )] ); if (@invalid_fields) { my $msg = 'The following fields provided ' . 'in the call to ' . $pkg . ' are not supported by the ' . 'iter ZAPI, so the ZAPI back-end is being ' . "skipped:" . join(', ', @invalid_fields); $Log->comment($msg); $Log->exit() if $may_exit; NACL::Exceptions::InvalidChoice->throw($msg); } $Log->exit() if $may_exit; } sub _update_state_objs_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; $pkg->SUPER::_update_state_objs_cmode_zapi(@args, zapi_field_translations => {hyphenate_value => [qw(storage-type)],},); $Log->exit() if $may_exit; } 1;