# $Id$ # # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary VserverSecurityFileDirectory ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com, pkj@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::VserverSecurityFileDirectory =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP VserverSecurityFileDirectory. A related class is L, which represents access to an ONTAP VserverSecurityFileDirectory. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the VserverSecurityFileDirectory element are the attributes of the VserverSecurityFileDirectory 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<< expanded_dos_attr >> Expanded Dos Attributes Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: expanded-dos-attr =item C<< volume_name >> Volume Name Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: $value =item C<< share_name >> Share Name Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: $value =item C<< vserver >> Vserver Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For 'filter': ZAPI will be invoked in the context of the vserver specified to this option. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: The name of the vserver in whose context the ZAPI is invoked will be populated in this attribute =item C<< effective_style >> Effective Style, possible value(s) are unix,ntfs,mixed Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: effective-style =item C<< user_id >> Unix User Id Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: unix-user-id =item C<< text_dos_attr >> DOS Attributes in Text Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: text-dos-attr =item C<< path >> File Path Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: $value =item C<< lookup_names >> SID to Name Lookups, possible value(s) are true,false Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: $value =item C<< mode_bits >> Unix Mode Bits Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: unix-mode-bits =item C<< group_id >> Unix Group Id Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: unix-group-id =item C<< security_style >> Security Style, possible value(s) are unix,ntfs,mixed Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: security-style =item C<< acls >> ACLs (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $acls = $obj->acls(); # $acls contains a reference to the array of values my @acls = $obj->acls(); # @acls contains the array of values If this field needs to be passed to the filter hash, the value for this field should be passed in as an arrayref # filter => { acls = [ value1, value2...] } Filled in for CMode CLI =item C<< dos_attributes >> DOS Attributes Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: dos-attributes =item C<< text_mode_bits >> Unix Mode Bits in Text Filled in for CMode CLI =item C<< expand_mask >> Expand Bit Masks, possible value(s) are true,false Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object Output mapping: $value =back =head1 ADDITIONAL FILTER FIELDS These are the additional filter fields that can be provided in filter hash. =over =item C<< expand-mask >> Applicable for CMode CLI and ZAPI Possible values true,false =back =cut package NACL::CS::VserverSecurityFileDirectory; 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::APISet::Exceptions::NoMatchingEntriesException (); 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 => 'expanded_dos_attr', scalar => 'volume_name', scalar => 'share_name', scalar => 'vserver', scalar => 'effective_style', scalar => 'user_id', scalar => 'text_dos_attr', scalar => 'path', scalar => 'lookup_names', scalar => 'mode_bits', scalar => 'group_id', scalar => 'security_style', array => 'acls', scalar => 'dos_attributes', scalar => 'text_mode_bits', scalar => 'expand_mask', ]; =head1 METHODS =head2 fetch my $VserverSecurityFileDirectory_state = NACL::CS::VserverSecurityFileDirectory->fetch(command_interface => $ci, ...); my @VserverSecurityFileDirectory_states = NACL::CS::VserverSecurityFileDirectory->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 "file-directory-security-get" 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 security file-directory show', choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode' }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode' } ], exception_text => 'No matching vserver security file-directory(s) found', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } sub _fetch_cmode_cli { $Log->enter() if $may_enter; my $pkg = shift; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(@_, api => 'vserver_security_file_directory_show',); $Log->exit() if $may_exit; return @state_objs; } sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my $pkg = shift; my %opts = validate @_, $pkg->_fetch_backend_validate_spec(); my $apiset = $opts{apiset}; my $caught_exception; my $filedirectory_response; my %cmd_args; #Check if vserver is passed if (!defined $opts{filter}->{vserver}) { NATE::Exceptions::Argument->throw("Missing Argument Vserver. " . " file-directory-security-get command runs only in vserver context." ); } # ZAPI runs only in vserver context my $vserver = $pkg->_handle_zapi_vserver_context( api_opts => \%cmd_args, vserver => $opts{filter}->{vserver}, command_interface => $opts{command_interface} ); $pkg->_hash_copy( source => $opts{filter}, copy => [qw( expand-mask lookup-names path volume-name )], target => \%cmd_args, map => {'share-name' => 'cifs-share-name'} ); try { $filedirectory_response = $apiset->file_directory_security_get(%cmd_args); } catch NACL::APISet::Exceptions::NoMatchingEntriesException with { $Log->trace("Entry doesn't exist"); $caught_exception = 1; }; if ($caught_exception) { $Log->exit() if $may_exit; return; } my @state_objs; my $filedirectory_output = $filedirectory_response->get_parsed_output(); $filedirectory_output->[0]->{'path'} = $cmd_args{'path'}; my $acl_arr = $filedirectory_output->[0]->{'acls'}->[0]{'fsecurity-acl'}; @$acl_arr = grep { ref($_) ne 'HASH' } @$acl_arr; $filedirectory_output->[0]->{'acls'}->[0]{'fsecurity-acl'} = $acl_arr ; my $state_fields = $pkg->_zapi_hash_copy( source => $filedirectory_output->[0], copy => [ qw( lookup-names path volume-name security-style text-dos-attr effective-style dos-attributes expanded-dos-attr ) ], map => [ 'cifs-share-name' => 'share-name', 'unix-user-id' => 'user-id', 'unix-group-id' => 'group-id', 'unix-mode-bits' => 'mode-bits', 'acls' => [ make_zapi_array('acls'), ], ], ); $state_fields->{'acls'} = delete $state_fields->{'acls'}->[0]{'fsecurity-acl'} if (defined $state_fields->{'acls'}) ; my $obj = $pkg->new(command_interface => $opts{command_interface}); $obj->_set_fields(row => $state_fields); $obj->vserver($vserver); push @state_objs, $obj; $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_zapi sub _extra_filter_fields { $Log->enter() if $may_enter; $Log->exit() if $may_exit; return [qw( expand-mask )]; } 1;