# # Copyright (c) 2001-2014 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary VserverCifsCharacterMapping Component Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::C::VserverCifsCharacterMapping =head1 DESCRIPTION C is a derived class of L. It represents access to an ONTAP VserverCifsCharacterMapping. A related class is L, which represents the past state of an ONTAP VserverCifsCharacterMapping. =head1 ATTRIBUTES =head2 command_interface See L =head2 volume =head2 vserver =cut package NACL::C::VserverCifsCharacterMapping; use strict; use warnings; use NACL::CS::VserverCifsCharacterMapping; use NACL::ComponentUtils qw (_optional_scalars Dumper); use NATE::Exceptions::Argument qw(:try); use base 'NACL::C::Component::ONTAP'; use Params::Validate qw(validate_with SCALAR ARRAYREF SCALARREF); use NATE::Log qw(log_global); use NACL::CS::ComponentState::ZapiSkip qw(make_zapi_skip); use NACL::CS::ComponentState::ZapiArray qw(make_zapi_array); use NACL::C::Exceptions::VserverCifsCharacterMapping::AlreadyExists; use NACL::C::Exceptions::VserverCifsCharacterMapping::DoesNotExist; =head1 METHODS =head2 new my $VserverCifsCharacterMapping = NACL::C::VserverCifsCharacterMapping->new( command_interface => $ci, 'volume' => $volume, 'vserver' => $vserver, ); Return a new VserverCifsCharacterMapping component object with the given attributes. =cut use Class::MethodMaker [ scalar => 'volume', scalar => 'vserver', ]; my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); =head2 find my $VserverCifsCharacterMapping_obj = NACL::C::VserverCifsCharacterMapping->find(command_interface => $ci, ...); my @VserverCifsCharacterMapping_objs = NACL::C::VserverCifsCharacterMapping->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 VserverCifsCharacterMapping_state = $VserverCifsCharacterMapping_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::VserverCifsCharacterMapping would return a NACL::CS::VserverCifsCharacterMapping 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 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 create my $VserverCifsCharacterMapping_obj = NACL::C::VserverCifsCharacterMapping->create( command_interface => $ci, 'volume' => $volume, 'vserver' => $vserver, ...); (Class method) This method is used to create character mapping on a volume. Uses CMode CLI/ZAPI . Invokes cifs-character-mapping-create 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<< 'volume' => $volume >> (Required) Volume Name Applicable for CMode CLI/ZAPI =item C<< 'vserver' => $vserver >> (Required) Vserver Applicable for CMode CLI/ZAPI =item C<< 'mapping' => [ $mapping1, $mapping2, ... ] >> (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 =item C<< '*' >> This method takes all other options supported by "vserver cifs character mapping create" command in ONTAP =item C<< other_options >> This method takes other common options described in L =back =back =over =item Exceptions =over =item C This type of exception gets thrown if an attempt is made to delete a character mapping which does not exists. =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 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 => {'mapping' => {type => ARRAYREF, optional => 1},}, api => 'vserver_cifs_character_mapping_create', ); my $vserver; $opts{vserver_operated_on} = \$vserver; try { $pkg->call_on_apiset( %opts, choices => [ { method => '_create_cmode_cli', interface => 'CLI', set => 'CMode', }, { method => '_create_cmode_zapi', interface => 'ZAPI', set => 'CMode', }, ], frontend => 'NACL::C::VserverCifsCharacterMapping::create', ); } catch NACL::APISet::Exceptions::ResponseException with { my $exception = $_[0]; NACL::C::Exceptions::VserverCifsCharacterMapping::AlreadyExists ->detect_convert_and_throw(exception => $exception); $Log->exit() if $may_exit; $exception->throw(); }; my $obj = $pkg->new( command_interface => $opts{command_interface}, volume => $opts{'volume'}, vserver => $vserver, ); $Log->exit() if $may_exit; return $obj; } sub _create_cmode_cli { $Log->enter() if $may_enter; my ($pkg, @opts) = @_; $pkg->_base_backend_cmode_cli(@opts, api => 'vserver_cifs_character_mapping_create',); $Log->exit() if $may_exit; } sub _create_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @opts) = @_; my $copy = [qw(mapping volume)]; $pkg->_base_backend_cmode_zapi( @opts, api => 'cifs-character-mapping-create', copy => $copy, ); $Log->exit() if $may_exit; } =head2 delete NACL::C::VserverCifsCharacterMapping->delete( command_interface => $ci, 'volume' => $volume, 'vserver' => $vserver, ...); or $VserverCifsCharacterMapping_obj->delete(...); (Class or instance method) This method is used to delete character mapping on a volume. Uses CMode CLI/ZAPI . Invokes cifs-character-mapping-destroy for CMode Zapi =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<< 'volume' => $volume >> (Required for class method, Not Applicable for instance method) Volume Name Applicable for CMode CLI/ZAPI =item C<< 'vserver' => $vserver >> (Required for class method, Not Applicable for instance method) Vserver Applicable for CMode CLI/ZAPI =item C<< '*' >> This method takes all other options supported by "vserver cifs character mapping delete" command in ONTAP =item C<< other_options >> This method takes other common options described in L =back =back =over =item Exceptions =over =item C This type of exception gets thrown if an attempt is made to delete a character mapping which does not exists. =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 delete { $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, api => 'vserver_cifs_character_mapping_delete', ); my $vserver; $opts{vserver_operated_on} = \$vserver; try { $pkg_or_obj->call_on_apiset( %opts, choices => [ { method => '_delete_cmode_cli', interface => 'CLI', set => 'CMode', }, { method => '_delete_cmode_zapi', interface => 'ZAPI', set => 'CMode', }, ], frontend => 'NACL::C::VserverCifsCharacterMapping::delete', ); } catch NACL::APISet::Exceptions::ResponseException with { my $exception = $_[0]; NACL::C::Exceptions::VserverCifsCharacterMapping::DoesNotExist ->detect_convert_and_throw(exception => $exception); $Log->exit() if $may_exit; $exception->throw(); }; $Log->exit() if $may_exit; } sub _delete_cmode_cli { $Log->enter() if $may_enter; my ($pkg_or_obj, @opts) = @_; $pkg_or_obj->_base_backend_cmode_cli(@opts, api => 'vserver_cifs_character_mapping_delete',); $Log->exit() if $may_exit; } sub _delete_cmode_zapi { $Log->enter() if $may_enter; my ($pkg_or_obj, @opts) = @_; my $copy = [qw(volume)]; $pkg_or_obj->_base_backend_cmode_zapi( @opts, api => 'cifs-character-mapping-destroy', copy => $copy, ); $Log->exit() if $may_exit; } =head2 modify NACL::C::VserverCifsCharacterMapping->modify( command_interface => $ci, 'volume' => $volume, 'vserver' => $vserver, ...); or $VserverCifsCharacterMapping_obj->modify(...); (Class or instance method) This method is used to modify character mapping on a volume. Uses CMode CLI/ZAPI . Invokes cifs-character-mapping-modify for CMode Zapi =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<< 'volume' => $volume >> (Required for class method, Not Applicable for instance method) Volume Name Applicable for CMode CLI/ZAPI =item C<< 'vserver' => $vserver >> (Required for class method, Not Applicable for instance method) Vserver Applicable for CMode CLI/ZAPI =item C<< 'mapping' => [ $mapping1, $mapping2, ... ] >> (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 =item C<< '*' >> This method takes all other options supported by "vserver cifs character mapping modify" command in ONTAP =item C<< other_options >> This method takes other common options described in L =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_or_obj, @args) = @_; $pkg_or_obj->_frontend_log_debug_opts(@args); my %opts = $pkg_or_obj->_common_validate_with( params => \@args, additional_spec => {'mapping' => {type => ARRAYREF, optional => 1},}, api => 'vserver_cifs_character_mapping_modify', ); my $vserver; $opts{vserver_operated_on} = \$vserver; $pkg_or_obj->call_on_apiset( %opts, choices => [ { method => '_modify_cmode_cli', interface => 'CLI', set => 'CMode', }, { method => '_modify_cmode_zapi', interface => 'ZAPI', set => 'CMode', }, ], frontend => 'NACL::C::VserverCifsCharacterMapping::modify', ); $Log->exit() if $may_exit; } sub _modify_cmode_cli { $Log->enter() if $may_enter; my ($pkg_or_obj, @opts) = @_; $pkg_or_obj->_base_backend_cmode_cli(@opts, api => 'vserver_cifs_character_mapping_modify',); $Log->exit() if $may_exit; } sub _modify_cmode_zapi { $Log->enter() if $may_enter; my ($pkg_or_obj, @opts) = @_; my $copy = [qw(mapping volume)]; $pkg_or_obj->_base_backend_cmode_zapi( @opts, api => 'cifs-character-mapping-modify', copy => $copy, ); $Log->exit() if $may_exit; } __PACKAGE__->_load_event_class(); sub _primary_keys_validate_spec { return ( 'volume' => {type => SCALAR}, 'vserver' => {type => SCALAR}, ); } 1;