# $Id: $ # # Copyright (c) 2013 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary VserverSecurityFileDirectoryNtfs Task Module ## @author kathar.hidayath@netapp.com, dl-nacl-dev ## @status shared ## @pod here package NACL::STask::VserverSecurityFileDirectoryNtfs; use strict; use warnings; use NACL::STask::_Fsecurity qw(:all); use base qw(NACL::C::VserverSecurityFileDirectoryNtfs NACL::STask::STask); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use Params::Validate qw(validate SCALAR BOOLEAN SCALARREF); use NATE::Exceptions::Argument qw(:try); use NACL::APISet::Exceptions::ResponseException (); use NACL::Exceptions::VerifyFailure (); =head1 NAME NACL::STask::VserverSecurityFileDirectoryNtfs =head1 DESCRIPTION C provide methods to create, purge vserver security file directory ntfs in ONTAP. It is created on top of C component Since it is derived class of C, we can use all the methods of C from the object of this task. =head1 ATTRIBUTES =head2 command_interface (Required) A component object that represents the host to which to send commands See L. =head2 vserver (Required) The name of the Vserver to be used =head2 ntfs-sd (Required) Security Descriptor Name to be created =head1 METHODS =head2 create my $Ntfs_obj = NACL::STask::VserverSecurityFileDirectoryNtfs->create( 'command_interface' => $ci, 'vserver' => $vserver, 'ntfs-sd' => $ntfs_sd, 'nacltask_if_exists' => $action # default die %other_options, ); (Class Method) This method is used to create a file security ntfs. If ntfs already exists, it will perform the action based on "nacltask_if_exists" parameter. Default behavior would be "die". Uses CMode CLI/ZAPI. =over =item Options =over =item C<< command_interface => $command_interface >> (Required) See L =item C<< 'vserver' => $vserver >> (Required) Name of the vserver to be used. =item C<< 'ntfs-sd' => $ntfs_sd >> (Required) Security Descriptor Name =item C<< apiset_must => $ruleset >> (Optional) See L =item C<< apiset_should => $ruleset >> (Optional) See L =item C<< "nacltask_if_exists => $action" >> (Optional) What to do if the ntfs to be created already exists. If $action is "die", then fail with an exception. If action is "purge", then purge the ntfs descriptor(see the "purge" method, below) before creating a new one. If $action is "reuse", It will return the object of existing ntfs descriptor. =item C<< "nacltask_verify => $action" >> (Optional) The user of this library can specify to verify whether the Ntfs is created or not. If the action is 0, which is default, it wont verify the creation. If the user sets the action to 1, it will verify the it using the component state of this library. =item C<< "_was_created => \$scalar" >> (Optional) When this option is provided with a reference to a scalar variable, the variable gets filled in with a boolean value describing whether the descriptor was available (value will be 0; this scenario is possible when if_exists => "reuse") or whether the ntfs descriptor was created (value will be 1). This is necessary to determine whether the ntfs descriptor needs to be cleaned up later. my $was_created; my $ntfs_obj = NACL::STask::VserverSecurityFileDirectoryNtfs->create( $nacltask_if_exists => 'reuse', _was_created => \$was_created, %other_opts ); # Operate on $ntfs_obj here # ... # Now determine whether to clean up the ntfs, since we're not sure # whether we reused an existing ntfs or created a new one if ($was_created) { # New ntfs descriptor was created. Clean it up. $ntfs_obj->purge(); } command_interface, apiset_must, apiset_should, mode, etc. All of the other various options to NACL::C::VserverSecurityFileDirectoryNtfs->create L<< NACL::C::VserverSecurityFileDirectoryNtfs->create| lib-NACL-C-VserverSecurityFileDirectoryNtfs-pm/create >> =back =back =over =item Exceptions =over =item C This type of exception is thrown when an attempt is made to create vserver security file directory ntfs that already exists. =item C This type of exception is thrown when verification fails for the created vserver security file directory ntfs. =back =back =cut sub create { $Log->enter() if $may_enter; my $pkg = shift; my $self = $pkg->_add_create_helper( @_, method => 'create' ); $Log->exit() if $may_exit; return $self; } ## end sub create =head2 purge $Ntfs_obj->purge(); (or) NACL::STask::VserverSecurityFileDirectoryNtfs->purge( 'command_interface' => $ci, 'vserver' => $vserver_name, 'ntfs-sd' => $ntfs_sd, 'nacltask_verify' => 1, ); (Class or instance method) This method is used to remove a file security ntfs descriptor. Uses a CMode CLI/ZAPI APISet. =over =item Options =over =item C<< command_interface => $ci >> (Required for class method, Not Applicable for instance method) A component object that represents the host which to send commands. See NACL::C::Component::command_interface =item C<< 'vserver' => $vserver >> (Required for class method, Not Applicable for instance method) Name of the vserver to be used. =item C<< 'ntfs-sd' => $ntfs_sd >> (Required for class method, Not Applicable for instance method) Security Descriptor Name =item C<< nacltask_verify => $nacltask_verify_boolean >> (Optional) If '0' (default), verification will not be performed. If '1', verification will be performed to ensure that the deletion did happen successfully. =item C<< nacltask_if_purged => $nacltask_if_purged >> (Optional) If 'pass' (default), It will pass if the descriptor is already deleted. If 'fail', It will fail if the descriptor is already deleted. L<< NACL::C::VserverSecurityFileDirectoryNtfs->delete| lib-NACL-C-VserverSecurityFileDirectoryNtfs-pm/delete >> =back =back =over =item Exceptions =over =item C This type of exception is thrown when an attempt is made to delete vserver security file directory ntfs that does not exists. =item C This type of exception is thrown when verification fails for the deleted vserver security file directory ntfs. =back =back =cut sub purge { $Log->enter() if $may_enter; my $pkg_or_obj = shift; $pkg_or_obj->_purge_helper( @_, method => 'delete' ); $Log->exit() if $may_exit; } ## end sub purge 1;