# $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::ApplicationProvisionShowVolumeModel->fetch() ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::ApplicationProvisionShowVolumeModel =head1 DESCRIPTION C is a derived class of L. Object(s) of this type are returned when NACL::CS::ApplicationProvisionShowVolumeModel->fetch() is invoked. ((This module does not represent the state of any element, but is an object repesentation of the output obtained when NACL::C::ApplicationProvision->show_volume_model() is invoked.) =head1 ATTRIBUTES The fields of the output are fields of the ComponentState object. =over =item C<< modeled_space >> Modeled Space Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< msid >> Volume Master Data Set ID Filled in for CMode CLI/ZAPI iter =item C<< dsid >> Volume Data Set ID Filled in for CMode CLI/ZAPI iter =item C<< uuid >> UUID of the Volume Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< promised_iops >> Promised Total IOPs Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< modeled_iops >> Modeled IOPs Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< modeled_iops_reason >> Modeled IOPs Reason possible value(s) are, media,deleted,policy,thick Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< application_uuid >> Application UUID Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< used_space >> Physical Used Size Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< qos_policy_group >> QoS Policy Group Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< aggregate >> Aggregate Name Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< modeled_space_reason >> Modeled Space Reason possible value(s) are, actual,deleted,policy,thick Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< volume >> Volume Name Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< vserver >> Vserver Name Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< promised_space >> Promised Space Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< application >> Application Name Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< space_guarantee >> Space Guarantee Style possible value(s) are, none,volume Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< aggregate_uuid >> UUID of the Containing Aggregate Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =item C<< msid_str >> Filled in for CMode CLI/ZAPI iter =item C<< dsid_str >> Filled in for CMode CLI/ZAPI iter =item C<< type >> Volume Type possible value(s) are, RW,DP Filled in for CMode CLI/ZAPI iter Mapping for CMode ZAPI iter: =back =cut package NACL::CS::ApplicationProvisionShowVolumeModel; 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 => 'modeled_space', scalar => 'msid', scalar => 'dsid', scalar => 'uuid', scalar => 'promised_iops', scalar => 'modeled_iops', scalar => 'modeled_iops_reason', scalar => 'application_uuid', scalar => 'used_space', scalar => 'qos_policy_group', scalar => 'aggregate', scalar => 'modeled_space_reason', scalar => 'volume', scalar => 'vserver', scalar => 'promised_space', scalar => 'application', scalar => 'space_guarantee', scalar => 'aggregate_uuid', scalar => 'msid_str', scalar => 'dsid_str', scalar => 'type', ]; =head1 METHODS =head2 fetch my $ApplicationProvisionShowVolumeModel_state = NACL::CS::ApplicationProvisionShowVolumeModel->fetch(command_interface => $ci, ...); my @ApplicationProvisionShowVolumeModel_states = NACL::CS::ApplicationProvisionShowVolumeModel->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-volume-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-volume-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 ApplicationProvisionShowVolumeModel(s) found', frontend => 'NACL::CS::ApplicationProvisionShowVolumeModel::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_volume_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(modeled-space uuid promised-iops modeled-iops modeled-iops-reason qos-policy-group used-space application-uuid aggregate modeled-space-reason volume vserver application promised-space aggregate-uuid space-guarantee type ) ], api => "application-provisioning-volume-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(msid dsid)] ); 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(modeled-iops-reason modeled-space-reason space-guarantee)], }, ); $Log->exit() if $may_exit; } 1;