# # Copyright (c) 2001-2013 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary QosPolicyGroup ComponentState Module (auto-generated by CGT) ## @author pbala@netapp.com, dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::QosPolicyGroup =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP QosPolicyGroup. A related class is L, which represents access to an ONTAP QosPolicyGroup. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the QosPolicyGroup element are the attributes of the QosPolicyGroup ComponentState. Additionally, the command_interface used to obtain the ComponentState object is also an attribute of the object. This makes it easier to obtain the component object corresponding to the CS object, using L. =over =item command_interface The command_interface with which the CS object was obtained. (Available in all CS objects regardless of requested_fields and the mode/interface) =item C<< min_latency_value >> Filled in for CMode CLI. =item C<< violation_detection_window >> Filled in for CMode CLI. =item C<< target_throughput >> Filled in for CMode CLI. =item C<< policy_group >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< violation_fraction >> Filled in for CMode CLI. =item C<< num_workloads >> Filled in for CMode CLI. =item C<< uuid >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< min_latency >> Filled in for CMode CLI. =item C<< target_latency_value >> Filled in for CMode CLI. =item C<< pgid >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping $value =item C<< max_throughput >> Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value Filled in for CMode CLI/ZAPI. =item C<< violation_threshold >> Filled in for CMode CLI. =item C<< lat_policy >> Filled in for CMode CLI. =item C<< target_latency >> Filled in for CMode CLI. =item C<< tput_policy >> Filled in for CMode CLI. =item C<< deactivation_priority >> Filled in for CMode CLI. =item C<< class >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< vsid >> Filled in for CMode CLI. =item C<< target_throughput_latency_cap >> Target Throughput Latency Limit Filled in for CMode CLI. =item C<< vserver >> Vserver Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< target_throughput_latency_cap_value >> Filled in for CMode CLI. =item C<< target_latency_enforcement_cap >> Target Latency Enforcement Limit Filled in for CMode CLI. =item C<< uuid_str >> Filled in for CMode CLI. =item C<< throughput_policy >> Throughput Policy Filled in for CMode CLI. =item C<< latency_policy >> Latency Policy Filled in for CMode CLI. =back =cut package NACL::CS::QosPolicyGroup; 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::C::_Mixins::QosPolicyGroup qw(:all); use NACL::Exceptions::InvalidChoice; use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ scalar => 'min_latency_value', scalar => 'violation_detection_window', scalar => 'target_throughput', scalar => 'policy_group', scalar => 'violation_fraction', scalar => 'num_workloads', scalar => 'uuid', scalar => 'min_latency', scalar => 'target_latency_value', scalar => 'pgid', scalar => 'max_throughput', scalar => 'violation_threshold', scalar => 'lat_policy', scalar => 'target_latency', scalar => 'tput_policy', scalar => 'deactivation_priority', scalar => 'class', scalar => 'vsid', scalar => 'target_throughput_latency_cap', scalar => 'vserver', scalar => 'target_throughput_latency_cap_value', scalar => 'target_latency_enforcement_cap', scalar => 'uuid_str', scalar => 'throughput_policy', scalar => 'latency_policy', ]; =head1 METHODS =head2 fetch my $QosPolicyGroup_state = NACL::CS::QosPolicyGroup->fetch(command_interface => $ci, ...); my @QosPolicyGroup_states = NACL::CS::QosPolicyGroup->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 CLI/ZAPI. Invokes "qos-policy-group-get-iter" 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, @args) = @_; my @state_objs = $pkg->SUPER::fetch( @args, choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode' }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode', check => '_cmode_zapi_check', }, ], exception_text => 'No matching qos policy-group(s) found', show_cmd => 'qos policy-group show', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } sub _fetch_cmode_cli { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(%opts, api => 'qos_policy_group_show',); $Log->exit() if $may_exit; return @state_objs; } sub _cmode_zapi_check { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; my @fields = (qw(deactivation-priority min-latency target-latency target-throughput violation-detection-window violation-fraction violation-threshold)); my @cli_only_fields = $pkg->_invalid_fields_check(%opts, _fields => \@fields); if (@cli_only_fields) { my $msg = 'The ZAPI implementation of ' . __PACKAGE__ . ' could not be used because the following CLI-only fields ' . "were provided through either requested_fields or filter:\n" . join (',', @cli_only_fields); $Log->comment($msg); $Log->exit() if $may_exit; NACL::Exceptions::InvalidChoice->throw($msg); } $Log->exit() if $may_exit; } sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; my $common_copy = $pkg->_common_zapi_copy(); my $common_map = $pkg->_common_zapi_map(); my @state_objs = $pkg->SUPER::_fetch_cmode_zapi( %opts, api => 'qos_policy_group_get_iter', copy => $common_copy, map => $common_map, # "vserver" will not be filled in policies that are not user-defined do_not_warn_for_missing_attribute => 1, ); $Log->exit() if $may_exit; return @state_objs; } sub _update_state_objs_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; $pkg->SUPER::_update_state_objs_cmode_zapi( %opts, zapi_field_translations => {hyphenate_value => ['class']}, ); $Log->exit() if $may_exit; } 1;