# # Copyright (c) 2001-2013 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary VserverExportPolicyRule ComponentState Module ## @author Dheeraj.K@netapp.com, dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::VserverExportPolicyRule =head1 DESCRIPTION C is a derived class of L. It represents the state of Vserver Export Policy Rule. A related class is L, which represents access to an Vserver Export Policy Rule. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the element are the attributes of the ComponentState. =over =item C<< vserver >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $value =item C<< policyname >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $value =item C<< ruleindex >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $value =item C<< protocol >> (Array) Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: @array =item C<< clientmatch >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $value =item C<< rorule >> (Array) Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: @value =item C<< rwrule >> (Array) Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: @array =item C<< anon >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $array =item C<< superuser >> (Array) Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: @array =item C<< allow_suid >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $value =item C<< allow_dev >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $value =item C<< ntfs_unix_security_ops >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $value =item C<< ntfs_unix_security_ops_vs >> Filled in for CMode CLI. =item C<< chown_mode >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $value =item C<< chown_mode_vs >> Filled in for CMode CLI. =back =cut package NACL::CS::VserverExportPolicyRule; use strict; use warnings; use Params::Validate qw(validate); use NACL::ComponentUtils qw(_dump_one Dumper); use base 'NACL::CS::ComponentState::ONTAP'; 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 Class::MethodMaker [ scalar => 'vserver', scalar => 'policyname', scalar => 'ruleindex', array => 'protocol', scalar => 'clientmatch', array => 'rorule', array => 'rwrule', scalar => 'anon', array => 'superuser', scalar => 'allow_suid', scalar => 'allow_dev', scalar => 'ntfs_unix_security_ops', scalar => 'ntfs_unix_security_ops_vs', scalar => 'chown_mode', scalar => 'chown_mode_vs', ]; sub isa { $Log->enter() if $may_enter; my ($pkg_or_obj, $kind) = @_; my $isa = $pkg_or_obj->_build_isa( kind => $kind, alias => 'NACL::CS::ExportPolicyRule' ); $Log->exit() if $may_exit; return $isa; } =head1 METHODS =head2 fetch my $node_state = NACL::CS::VserverExportPolicyRule->fetch(command_interface=>$ci,...); my @node_states = NACL::CS::VserverExportPolicyRule->fetch(command_interface=>$ci,...); see L Supports CMode CLI/ZAPI APISet. Invokes "export-rule-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 = shift; my @state_objs = $pkg->SUPER::fetch( @_, show_cmd => 'vserver export-policy rule show', choices => [ { method => "_fetch_cmode_cli", interface => "CLI", set => "CMode", }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode', }, ], exception_text => 'No matching vserver export policy rule(s) found' ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } ## end sub fetch sub _fetch_cmode_cli { my $pkg = shift; return $pkg->SUPER::_fetch_cmode_cli(@_, api => "vserver_export_policy_rule_show"); } sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my $pkg = shift; my %opts = @_; my $map = { "protocol" => [make_zapi_array('protocol'), make_zapi_skip('access-protocol')], "ruleindex" => "rule-index", "chown-mode" => "export-chown-mode", "policyname" => "policy-name", "clientmatch" => "client-match", "allow-dev" => "is-allow-dev-is-enabled", "vserver" => "vserver-name", "rorule" => [make_zapi_array('ro-rule'), make_zapi_skip('security-flavor')], "allow-suid" => "is-allow-set-uid-enabled", "ntfs-unix-security-ops" => "export-ntfs-unix-security-ops", "rwrule" => [make_zapi_array('rw-rule'), make_zapi_skip('security-flavor')], "superuser" => [ make_zapi_array('super-user-security'), make_zapi_skip('security-flavor') ], "anon" => "anonymous-user-id", }; my @states = $pkg->SUPER::_fetch_cmode_zapi( %opts, api => "export-rule-get-iter", map => $map, ); $Log->exit() if $may_exit; return @states; } ## end sub _fetch_cmode_zapi 1;