# $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 VserverCifsGroupPolicy Component Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::C::VserverCifsGroupPolicy =head1 DESCRIPTION C is a derived class of L. It represents access to an ONTAP VserverCifsGroupPolicy. A related class is L, which represents the past state of an ONTAP VserverCifsGroupPolicy. =head1 ATTRIBUTES =head2 command_interface See L =head2 vserver =cut package NACL::C::VserverCifsGroupPolicy; use strict; use warnings; use NACL::CS::VserverCifsGroupPolicy; use NACL::ComponentUtils qw (_optional_scalars); use base 'NACL::C::Component::ONTAP'; use Params::Validate qw(validate validate_with SCALAR ARRAYREF UNDEF); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use Data::Dumper; =head1 METHODS =head2 new my $VserverCifsGroupPolicy = NACL::C::VserverCifsGroupPolicy->new(command_interface=>$ci, vserver =>$vserver, ); Return a new VserverCifsGroupPolicy component object with the given attributes. =cut use Class::MethodMaker [scalar => 'vserver',]; 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 $VserverCifsGroupPolicy = NACL::C::VserverCifsGroupPolicy->find(command_interface => $ci, ...); my @VserverCifsGroupPolicys = NACL::C::VserverCifsGroupPolicy->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. =head2 state my $VserverCifsGroupPolicy_state = $NACL::C::VserverCifsGroupPolicy->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::VserverCifsGroupPolicy would return a NACL::CS::VserverCifsGroupPolicy 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. =cut =head2 update NACL::C::VserverCifsGroupPolicy->update( command_interface => $ci, vserver => $vserver, ...); or $VserverCifsGroupPolicy_object->update(...); (Class or instance method) This method is used to apply group policy settings defined in Active Directory. Uses a CMode CLI/ZAPI and 7Mode CLI APISet. Invokes "gpo-update" API for CMode ZAPI. Invokes "cifs gpupdate" command for 7Mode CLI. =over =item Options =over =item C<< command_interface => $command_interface >> (Required for class method, Not Applicable for instance method) See L =item C<< apiset_must => $ruleset >> (Optional) See L =item C<< apiset_should => $ruleset >> (Optional) See L =item C<< "vserver" => $vserver >> (Required for class method, Not Applicable for instance method) 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<< "extended_query" => $string >> (Optional) Applicable for CMode CLI. =item C<< 'force-reapply-all-settings' => $string >> Force Re-apply All Settings Applicable for CMode CLI =item C<< '*' >> This method takes all other options supported by "vserver cifs group-policy update" command in ONTAP. Applicable for CMode CLI. =back =back =over =item Exceptions =over =item C This exception is thrown when an attempt is made to perform update when An update is already in progress for Vserver =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 update { $Log->enter() if $may_enter; my ($pkg_or_obj, @args) = @_; $pkg_or_obj->_frontend_log_debug_opts(@args); my %opts = $pkg_or_obj->_common_validate_with( params => \@args, cli_cmd => 'vserver cifs group-policy update', , additional_spec => { _optional_scalars( qw( force-reapply-all-settings ) ) }, ); my $vserver; $opts{vserver_operated_on} = \$vserver; my $ret = $pkg_or_obj->call_on_apiset_with_exceptions( %opts, choices => [ { method => "_update_cmode_cli", interface => "CLI", set => "CMode", }, { method => "_update_cmode_zapi", interface => "ZAPI", set => "CMode", }, { method => "_update_7mode_cli", interface => "CLI", set => "7Mode", }, ], frontend => 'NACL::C::VserverCifsGroupPolicy::update', nacl_exceptions => [qw(UpdateInProgress)], ); $Log->exit() if $may_exit; return $ret; } ## end sub update sub _update_cmode_cli { $Log->enter() if $may_enter; my ($pkg_or_obj, @args) = @_; $pkg_or_obj->_base_backend_cmode_cli(@args, api => 'vserver_cifs_group_policy_update', ); $Log->exit() if $may_exit; } ## end sub _update_cmode_cli sub _update_cmode_zapi { $Log->enter() if $may_enter; my ($pkg_or_obj, @args) = @_; $pkg_or_obj->_base_backend_cmode_zapi(@args, api => 'gpo_update', ); $Log->exit() if $may_exit; } ## end sub _update_cmode_zapi sub _update_7mode_cli { $Log->enter() if $may_enter; my $pkg_or_obj = shift; my %opts = validate_with( params => \@_, spec => $pkg_or_obj->_backend_validate_spec(), allow_extra => 1 ); delete $opts{command_interface}; my $apiset = delete $opts{apiset}; $apiset->cifs_gpupdate(); $Log->exit() if $may_exit; } ## end sub _update_7mode_cli =head2 modify NACL::C::VserverCifsGroupPolicy->modify( command_interface => $ci, vserver => $vserver, ...); or $VserverCifsGroupPolicy_object->modify(...); (Class or instance method) This method is used to change group policy configuration. Uses a CMode CLI,ZAPI, 7Mode CLI APISet. Invokes "gpo-modify" API for CMode ZAPI. Invokes "options" command with option 'cifs.gpo.enable => on' for 7Mode CLI. Invokes "options" command with option 'cifs.gpo.enable => off' for 7Mode CLI. =over =item Options =over =item C<< command_interface => $command_interface >> (Required for class method, Not Applicable for instance method) See L =item C<< apiset_must => $ruleset >> (Optional) See L =item C<< apiset_should => $ruleset >> (Optional) See L =item C<< "vserver" => $vserver >> (Required for class method, Not Applicable for instance method) 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<< "status" => $string >> Applicable for CMode CLI. =item C<< "gpo-status-zapi" => $string >> Applicable for CMode CLI. =item C<< "extended_query" => $string >> (Optional) Applicable for CMode CLI. =item C<< '*' >> This method takes all other options supported by "vserver cifs group-policy modify" command in ONTAP. Applicable for CMode CLI. =back =back =over =item Exceptions =over =item C This exception is thrown when an attempt is made to perform modify and Group Policy is already enabled for Vserver =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_or_obj, @args) = @_; $pkg_or_obj->_frontend_log_debug_opts(@args); my %opts = $pkg_or_obj->_common_validate_with( params => \@args, additional_spec => { _optional_scalars( qw( status gpo-status-zapi ) ), }, cli_cmd => 'vserver cifs group-policy modify', ); my $vserver; $opts{vserver_operated_on} = \$vserver; my $ret = $pkg_or_obj->call_on_apiset_with_exceptions( %opts, choices => [ { method => "_modify_cmode_cli", interface => "CLI", set => "CMode", }, { method => "_modify_cmode_zapi", interface => "ZAPI", set => "CMode", }, { method => "_modify_7mode_cli", interface => "CLI", set => "7Mode", }, ], frontend => 'NACL::C::VserverCifsGroupPolicy::modify', nacl_exceptions => [qw(UpdateInProgress AlreadyModified)], ); $Log->exit() if $may_exit; return $ret; } ## end sub modify sub _modify_cmode_cli { $Log->enter() if $may_enter; my ($pkg_or_obj, @args) = @_; $pkg_or_obj->_base_backend_cmode_cli(@args, api => 'vserver_cifs_group_policy_modify', ); $Log->exit() if $may_exit; } ## end sub _modify_cmode_cli sub _modify_cmode_zapi { $Log->enter() if $may_enter; my ($pkg_or_obj, %opts) = @_; if($opts{'status'} eq 'enabled') { $opts{'is-gpo-enabled'} = 'true'; }elsif ($opts{'status'} eq 'disabled') { $opts{'is-gpo-enabled'} = 'false'; }else { $opts{'is-gpo-enabled'} = $opts{'status'}; } delete $opts{'status'} ; $pkg_or_obj->_base_backend_cmode_zapi( %opts, api => 'gpo_modify', copy => [qw(is-gpo-enabled)] , ); $Log->exit() if $may_exit; } ## end sub _modify_cmode_zapi sub _modify_7mode_cli { $Log->enter() if $may_enter; my $pkg_or_obj = shift; my %opts = validate_with( params => \@_, spec => $pkg_or_obj->_backend_validate_spec(), allow_extra => 1 ); delete $opts{command_interface}; my $apiset = delete $opts{apiset}; if ($opts{'status'} =~ /enabled/) { $apiset->options("cifs.gpo.enable" => 'on'); } elsif ($opts{'status'} =~ /disabled/) { $apiset->options("cifs.gpo.enable" => 'off'); } $Log->exit() if $may_exit; } ## end sub _modify_7mode_cli =head2 show_defined my $show_defined_obj = NACL::C::VserverCifsGroupPolicy->show_defined(command_interface => $ci, [ filter => { %filter } ,] [ requested_fields => [ @req_fields ]); or or my $show_defined_obj = $VserverCifsGroupPolicy_obj->show_defined(); (Class or Instance method) This method returns objects of the type L. my @show_defined_objs = NACL::C::VserverCifsGroupPolicy->show_defined(command_interface => $ci, [ filter => { %filter } ,] [ requested_fields => [ @req_fields ]); or my $show_defined_obj = $VserverCifsGroupPolicy_obj->show_defined(); (Class or Instance method) This method returns objects of the type L. This method accepts all the parameters accepted by L (requested_fields, filter, allow_empty) and has all of the other properties of fetch methods (callable in scalar or list context, throws a NoElementsFound exception if no matching elements are found) =cut sub show_defined { $Log->enter() if $may_enter; my $pkg_or_obj = shift; my %opts = $pkg_or_obj->_handle_obj_cs_like_calls(@_); require NACL::CS::VserverCifsGroupPolicyShowDefined; my @state_objs = NACL::CS::VserverCifsGroupPolicyShowDefined->fetch(@_); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } ## end sub show_defined =head2 show_applied my $show_applied_obj = NACL::C::VserverCifsGroupPolicy->show_applied(command_interface => $ci, [ filter => { %filter } ,] [ requested_fields => [ @req_fields ]); or my @show_applied_objs = NACL::C::VserverCifsGroupPolicy->show_applied(command_interface => $ci, [ filter => { %filter } ,] [ requested_fields => [ @req_fields ]); or my $show_applied_obj = $VserverCifsGroupPolicy_obj->show_applied(); (Class or Instance method) This method returns objects of the type L. =head2 show_applied my $show_applied_obj = NACL::C::VserverCifsGroupPolicy->show_applied(command_interface => $ci, [ filter => { %filter } ,] [ requested_fields => [ @req_fields ]); or my @show_applied_objs = NACL::C::VserverCifsGroupPolicy->show_applied(command_interface => $ci, [ filter => { %filter } ,] [ requested_fields => [ @req_fields ]); or my $show_applied_obj = $VserverCifsGroupPolicy_obj->show_applied(); (Class or Instance method) This method returns objects of the type L. This method accepts all the parameters accepted by L (requested_fields, filter, allow_empty) and has all of the other properties of fetch methods (callable in scalar or list context, throws a NoElementsFound exception if no matching elements are found) =cut sub show_applied { $Log->enter() if $may_enter; my $pkg_or_obj = shift; my %opts = $pkg_or_obj->_handle_obj_cs_like_calls(@_); require NACL::CS::VserverCifsGroupPolicyShowApplied; my @state_objs = NACL::CS::VserverCifsGroupPolicyShowApplied->fetch(@_); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } ## end sub show_applied __PACKAGE__->_load_event_class(); sub _primary_keys_validate_spec { return ('vserver' => {type => SCALAR | UNDEF, optional => 1},); } 1;