# # Copyright (c) 2001-2013 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary VserverFpolicyPolicyScope Component Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com, benjaram@netapp.com ## @status shared ## @pod here =head1 NAME NACL::C::VserverFpolicyPolicyScope =head1 DESCRIPTION C is a derived class of L. It represents access to an ONTAP VserverFpolicyPolicyScope. A related class is L, which represents the past state of an ONTAP VserverFpolicyPolicyScope. However, since it does not have any primary keys, 'find' and 'state' do not work for this component. (This component is considered a 'singleton', i.e. there is only one row shown by the relevant 'show' command) =cut =head1 ATTRIBUTES =head2 vserver =head2 policy_name =cut package NACL::C::VserverFpolicyPolicyScope; use strict; use warnings; use NACL::CS::VserverFpolicyPolicyScope; use NACL::ComponentUtils qw ( _optional_scalars ); use base 'NACL::C::Component::ONTAP'; use Params::Validate qw(validate validate_with SCALAR ARRAYREF); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use NATE::BaseException qw(:try); use NACL::C::Exceptions::VserverFpolicyPolicyScope::AlreadyExists (); use NACL::C::Exceptions::VserverFpolicyPolicyScope::DoesNotExist (); =head1 METHODS =head2 new my $VserverFpolicyPolicyScope = NACL::C::VserverFpolicyPolicyScope->new( command_interface => $ci, ); Return a new VserverFpolicyPolicyScope component object with the given attributes. =cut use Class::MethodMaker [ scalar => 'vserver', scalar => 'policy_name', ]; sub init { $Log->enter() if $may_enter; my ($self, @args) = @_; $self->SUPER::init(@args); $self->_vserver_context_init(@args); $Log->exit() if $may_exit; } =head2 find my $VserverFpolicyPolicyScope_obj = NACL::C::VserverFpolicyPolicyScope->find(command_interface => $ci, ...); my @VserverFpolicyPolicyScope_objs = NACL::C::VserverFpolicyPolicyScope->find(command_interface => $ci, ...); (Class method) A constructor of sorts, which discovers which elements are present (by interacting with the given command interface). In an array context it creates a component object for each present element and returns them. In a scalar context it creates a component object for just one element. This method is generally not implemented in individual components. The base class (L provides an implementation. See for a more detailed description along with explanation of all the options accepted. Uses a CMode CLI/ZAPI APISet. =head2 state my VserverFpolicyPolicyScope_state = $VserverFpolicyPolicyScope_obj->state(); (Instance method) Fetch the current state of the element associated with this component, and return a Component State object corresponding to this component (calling this on NACL::C::VserverFpolicyPolicyScope would return a NACL::CS::VserverFpolicyPolicyScope object) This method is generally not implemented in individual components. The base class (L provides an implementation. See for a more detailed description along with explanation of all the options accepted. Uses a CMode CLI/ZAPI APISet. =cut =head2 delete NACL::C::VserverFpolicyPolicyScope->delete( command_interface => $ci, ...); (Class method) This method is used to delete Scope. Uses a CMode CLI/ZAPI APISet. Invokes "fpolicy-policy-scope-delete" API for CMode ZAPI. =over =item Options =over =item C<< command_interface => $command_interface >> (Required) See L =item C<< apiset_must => $ruleset >> (Optional) See L =item C<< apiset_should => $ruleset >> (Optional) See L =item C<< 'vserver' => $string >> Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: ZAPI will be invoked in the context of the vserver specified to this option. =item C<< 'policy-name' => $string >> Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: policy-name =item C<< 'method-timeout' => $time_in_seconds >> (Optional) The default NATE timeout is 60 seconds. If the command might take more time to complete, this option can be used to specify a larger timeout value. The value should be provided in seconds. =item C<< "extended_query" => $string >> (Optional) Applicable for CMode CLI. =item C<< '*' >> This method takes all other options supported by "vserver fpolicy policy scope delete" command in ONTAP. Applicable for CMode CLI. =back =back =over =item Exceptions =over =item C In general, Component methods propagate the exceptions thrown from underlying API layer and the details of those exceptions are described in the L of user guide. =item C This exception is thrown when we attempt to delete a non-existing policy scope. =back =back =cut sub delete { $Log->enter() if $may_enter; my ($pkg, @args) = @_; $pkg->_frontend_log_debug_opts(@args); my %opts = $pkg->_common_validate_with( params => \@args, cli_cmd => 'vserver fpolicy policy scope delete', ); my $vserver; $opts{vserver_operated_on} = \$vserver; $pkg->call_on_apiset_with_exceptions( %opts, choices => [ { method => '_delete_cmode_cli', interface => 'CLI', set => 'CMode', }, { method => '_delete_cmode_zapi', interface => 'ZAPI', set => 'CMode', }, ], frontend => 'NACL::C::VserverFpolicyPolicyScope::delete', nacl_exceptions => [qw(DoesNotExist)] ); $Log->exit() if $may_exit; } ## end sub delete sub _delete_cmode_cli { $Log->enter() if $may_enter; my ($pkg, @args) = @_; $pkg->_base_backend_cmode_cli(@args, api => 'vserver_fpolicy_policy_scope_delete', ); $Log->exit() if $may_exit; } ## end sub _delete_cmode_cli sub _delete_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; $pkg->_base_backend_cmode_zapi(@args, api => 'fpolicy_policy_scope_delete', copy => [qw( policy-name )], ); $Log->exit() if $may_exit; } ## end sub _delete_cmode_zapi =head2 modify NACL::C::VserverFpolicyPolicyScope->modify( command_interface => $ci, ...); (Class method) This method is used to modify Scope. Uses a CMode CLI/ZAPI APISet. Invokes "fpolicy-policy-scope-modify" API for CMode ZAPI. =over =item Options =over =item C<< command_interface => $command_interface >> (Required) See L =item C<< apiset_must => $ruleset >> (Optional) See L =item C<< apiset_should => $ruleset >> (Optional) See L =item C<< 'vserver' => $string >> Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: ZAPI will be invoked in the context of the vserver specified to this option. =item C<< 'policy-name' => $string >> Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: policy-name =item C<< 'shares-to-include' => [ $shares-to-include1, $shares-to-include2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: shares-to-include =item C<< 'export-policies-to-include' => [ $export-policies-to-include1, $export-policies-to-include2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: export-policies-to-include =item C<< 'shares-to-exclude' => [ $shares-to-exclude1, $shares-to-exclude2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: shares-to-exclude =item C<< 'file-extensions-to-include' => [ $file-extensions-to-include1, $file-extensions-to-include2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: file-extensions-to-include =item C<< 'volumes-to-exclude' => [ $volumes-to-exclude1, $volumes-to-exclude2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: volumes-to-exclude =item C<< 'export-policies-to-exclude' => [ $export-policies-to-exclude1, $export-policies-to-exclude2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: export-policies-to-exclude =item C<< 'file-extensions-to-exclude' => [ $file-extensions-to-exclude1, $file-extensions-to-exclude2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: file-extensions-to-exclude =item C<< 'volumes-to-include' => [ $volumes-to-include1, $volumes-to-include2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: volumes-to-include =item C<< 'method-timeout' => $time_in_seconds >> (Optional) The default NATE timeout is 60 seconds. If the command might take more time to complete, this option can be used to specify a larger timeout value. The value should be provided in seconds. =item C<< 'enable-file-extension-check-on-directories' => $string >> *Enable File Extension Check on Directories, possible value(s) are true,false Applicable for CMode CLI =item C<< 'is-file-extension-check-on-directories-enabled' => $string >> *Is File Extension Check on Directories Enabled, possible value(s) are true,false Applicable for CMode CLI/ZAPI Maps to : CM ZAPI : check-extensions-on-directories =item C<< "extended_query" => $string >> (Optional) Applicable for CMode CLI. =item C<< '*' >> This method takes all other options supported by "vserver fpolicy policy scope modify" command in ONTAP. Applicable for CMode CLI. =back =back =over =item Exceptions =over =item C In general, Component methods propagate the exceptions thrown from underlying API layer and the details of those exceptions are described in the L of user guide. =back =back =cut sub modify { $Log->enter() if $may_enter; my ($pkg, @args) = @_; $pkg->_frontend_log_debug_opts(@args); my %opts = $pkg->_common_validate_with( params => \@args, additional_spec => { _optional_scalars( qw( enable-file-extension-check-on-directories is-file-extension-check-on-directories-enabled ) ), 'shares-to-include' => {type => ARRAYREF, optional => 1}, 'export-policies-to-include' => {type => ARRAYREF, optional => 1}, 'shares-to-exclude' => {type => ARRAYREF, optional => 1}, 'file-extensions-to-include' => {type => ARRAYREF, optional => 1}, 'volumes-to-exclude' => {type => ARRAYREF, optional => 1}, 'export-policies-to-exclude' => {type => ARRAYREF, optional => 1}, 'file-extensions-to-exclude' => {type => ARRAYREF, optional => 1}, 'volumes-to-include' => {type => ARRAYREF, optional => 1}, }, api => 'vserver_fpolicy_policy_scope_modify', ); my $vserver; $opts{vserver_operated_on} = \$vserver; $pkg->call_on_apiset( %opts, choices => [ { method => '_modify_cmode_cli', interface => 'CLI', set => 'CMode', }, { method => '_modify_cmode_zapi', interface => 'ZAPI', set => 'CMode', }, ], frontend => 'NACL::C::VserverFpolicyPolicyScope::modify', ); $Log->exit() if $may_exit; } ## end sub modify sub _modify_cmode_cli { $Log->enter() if $may_enter; my ($pkg, @args) = @_; $pkg->_base_backend_cmode_cli(@args, api => 'vserver_fpolicy_policy_scope_modify',); $Log->exit() if $may_exit; } ## end sub _modify_cmode_cli sub _modify_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; $pkg->_base_backend_cmode_zapi( %opts, api => 'fpolicy_policy_scope_modify', copy => [ qw( policy-name shares-to-include export-policies-to-include shares-to-exclude file-extensions-to-include volumes-to-exclude export-policies-to-exclude file-extensions-to-exclude volumes-to-include ) ], map => { 'is-file-extension-check-on-directories-enabled' => 'check-extensions-on-directories', }, frontend_method => 'modify', ); $Log->exit() if $may_exit; } ## end sub _modify_cmode_zapi =head2 create my $VserverFpolicyPolicyScope_obj = NACL::C::VserverFpolicyPolicyScope->create( command_interface => $ci, ...); (Class method) This method is used to create Scope. Uses a CMode CLI/ZAPI APISet. Invokes "fpolicy-policy-scope-create" API for CMode ZAPI. =over =item Options =over =item C<< command_interface => $command_interface >> (Required) See L =item C<< apiset_must => $ruleset >> (Optional) See L =item C<< apiset_should => $ruleset >> (Optional) See L =item C<< 'vserver' => $string >> Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: ZAPI will be invoked in the context of the vserver specified to this option. =item C<< 'policy-name' => $string >> Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: policy-name =item C<< 'shares-to-include' => [ $shares-to-include1, $shares-to-include2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: shares-to-include =item C<< 'export-policies-to-include' => [ $export-policies-to-include1, $export-policies-to-include2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: export-policies-to-include =item C<< 'shares-to-exclude' => [ $shares-to-exclude1, $shares-to-exclude2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: shares-to-exclude =item C<< 'file-extensions-to-include' => [ $file-extensions-to-include1, $file-extensions-to-include2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: file-extensions-to-include =item C<< 'volumes-to-exclude' => [ $volumes-to-exclude1, $volumes-to-exclude2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: volumes-to-exclude =item C<< 'export-policies-to-exclude' => [ $export-policies-to-exclude1, $export-policies-to-exclude2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: export-policies-to-exclude =item C<< 'file-extensions-to-exclude' => [ $file-extensions-to-exclude1, $file-extensions-to-exclude2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: file-extensions-to-exclude =item C<< 'volumes-to-include' => [ $volumes-to-include1, $volumes-to-include2, ... ] >> (Arrayref, even if only a single value is to be sent it should specified as an arrayref containing that single value) Applicable for CMode CLI/ZAPI. Maps to: CM ZAPI: volumes-to-include =item C<< 'method-timeout' => $time_in_seconds >> (Optional) The default NATE timeout is 60 seconds. If the command might take more time to complete, this option can be used to specify a larger timeout value. The value should be provided in seconds. =item C<< 'check-extensions-on-directories' => $string >> Applicable for CMode CLI =item C<< 'enable-file-extension-check-on-directories' => $string >> *Enable File Extension Check on Directories (default: false), possible value(s) are true,false Applicable for CMode CLI =item C<< 'is-file-extension-check-on-directories-enabled' => $string >> *Is File Extension Check on Directories Enabled (default: false), possible value(s) are true,false Applicable for CMode CLI/ZAPI Maps to: CM ZAPI: check-extensions-on-directories =item C<< "extended_query" => $string >> (Optional) Applicable for CMode CLI. =item C<< '*' >> This method takes all other options supported by "vserver fpolicy policy scope create" command in ONTAP. Applicable for CMode CLI. =back =back =over =item Exceptions =over =item C In general, Component methods propagate the exceptions thrown from underlying API layer and the details of those exceptions are described in the L of user guide. =item C This exception is thrown when we attempt to create an existing policy scope. =back =back =cut sub create { $Log->enter() if $may_enter; my ($pkg, @args) = @_; $pkg->_frontend_log_debug_opts(@args); my %opts = $pkg->_common_validate_with( params => \@args, additional_spec => { _optional_scalars( qw( check-extensions-on-directories enable-file-extension-check-on-directories is-file-extension-check-on-directories-enabled ) ), 'shares-to-include' => {type => ARRAYREF, optional => 1}, 'export-policies-to-include' => {type => ARRAYREF, optional => 1}, 'shares-to-exclude' => {type => ARRAYREF, optional => 1}, 'file-extensions-to-include' => {type => ARRAYREF, optional => 1}, 'volumes-to-exclude' => {type => ARRAYREF, optional => 1}, 'export-policies-to-exclude' => {type => ARRAYREF, optional => 1}, 'file-extensions-to-exclude' => {type => ARRAYREF, optional => 1}, 'volumes-to-include' => {type => ARRAYREF, optional => 1}, }, api => 'vserver_fpolicy_policy_scope_create', ); my $vserver; $opts{vserver_operated_on} = \$vserver; $pkg->call_on_apiset_with_exceptions( %opts, choices => [ { method => '_create_cmode_cli', interface => 'CLI', set => 'CMode', }, { method => '_create_cmode_zapi', interface => 'ZAPI', set => 'CMode', }, ], frontend => 'NACL::C::VserverFpolicyPolicyScope::create', nacl_exceptions => [qw(AlreadyExists)] ); my $obj = $pkg->new( command_interface => $opts{'command_interface'}, 'policy-name' => $opts{'policy-name'}, vserver => $opts{'vserver'}, ); $Log->exit() if $may_exit; return $obj; } ## end sub create sub _create_cmode_cli { $Log->enter() if $may_enter; my ($pkg, @args) = @_; $pkg->_base_backend_cmode_cli(@args, api => 'vserver_fpolicy_policy_scope_create',); $Log->exit() if $may_exit; } ## end sub _create_cmode_cli sub _create_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; $pkg->_base_backend_cmode_zapi( %opts, api => 'fpolicy_policy_scope_create', copy => [ qw( policy-name shares-to-include export-policies-to-include shares-to-exclude file-extensions-to-include volumes-to-exclude export-policies-to-exclude file-extensions-to-exclude volumes-to-include), ], map => { 'is-file-extension-check-on-directories-enabled' => 'check-extensions-on-directories', }, frontend_method => 'create', ); $Log->exit() if $may_exit; } ## end sub _create_cmode_zapi __PACKAGE__->_load_event_class(); sub _primary_keys_validate_spec { return ( vserver => {type => SCALAR, optional => 1}, 'policy-name' => {type => SCALAR}, ); } ## end sub _primary_keys_validate_spec 1;