VMWare-LabmanSoap

 view release on metacpan or  search on metacpan

lib/VMWare/LabmanSoap.pm  view on Meta::CPAN


	#Deploy the config to DVS
	$mySoapObj->ConfigurationDeployEx2($checked_out_config_id,2); # 2 is the id of the network

 	#Undeploy the config
 	$mySoapObj->ConfigurationUndeploy($chkd_out_id);

 	#Delete the config
 	$mySoapObj->ConfigurationDelete($chkd_out_id);

	#Check for last SOAP error
	if ($mySoapObj->{'LASTERROR'}->{'detail'}->{'message'}->{'format'}) { print };

=head1 DESCRIPTION

This module provides a Perl interface to VMWare's Labmanager SOAP interface. It has a one-to-one mapping for most of the commands exposed in the external API as well as a few commands exposed in the internal API. The most useful Internal API command ...

Using this module you can checkout, deploy, undeploy and delete configurations. You can also get lists of configurations and guest information as well.

Lab Manager is a product created by VMWare that provides development and test teams with a virtual environment to deploy systems and networks of systems in a short period of a time. 

=head1 METHODS

=head2 new

This method creates the Labmanager object.

=head3 Arguments

=over 4

=item * username

=item * password

=item * hostname

=item * organization

=item * workspace

=back

=cut

sub new
{
	my($class) = shift;
	my($self) = {};
	my($username) = shift;
	my($password) = shift;
	my($hostname) = shift;
	my($orgname) = shift;
	my($workspace) = shift;
	$self->{'soap'} = SOAP::Lite
		-> on_action(sub { return "http://vmware.com/labmanager/" . $_[1]; } )
		-> default_ns('http://vmware.com/labmanager')
		-> proxy('https://' . $hostname . '/LabManager/SOAP/LabManagerInternal.asmx');

	$self->{'soap'}->readable(1);
	$self->{'auth_header'} = SOAP::Header->new(
		name => 'AuthenticationHeader',
		attr => { xmlns => "http://vmware.com/labmanager" },
		value => { username => $username, password => $password, organizationname => $orgname, workspacename => $workspace  },
		);

	if ($self->{'soap'}->fault){ $self->{'LASTERROR'} = $self->{'soap'}->fault }

	bless($self, $class);
	return($self)
}

=head2 ConfigurationCapture


This method captures a Workspace configuration and saves it to a specified Lab Manager storage server with a name.  

=head3 Arguments

=over 4

=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it.

=item * New library name - The name that you want the captured config to be.

=back

=cut


sub ConfigurationCapture
{
	my($self) = shift;
	my($configID) = shift;
	my($newLibName) = shift;

	$self->{'ConfigurationCapture'} = 
		$self->{'soap'}->ConfigurationCapture( 
			$self->{'auth_header'}, 
			SOAP::Data->name('configurationId' => $configID )->type('s:int'),
	 		SOAP::Data->name('newLibraryName' => "${newLibName}")->type('s:string')
		 );

	if ($self->{'ConfigurationCapture'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationCapture'}->fault }

	return $self->{'ConfigurationCapture'}->result;
}


=head2 ConfigurationCheckout

This method checks out a configuration from the configuration library and moves it to the Workspace under a different name. It returns the ID of the checked out configuration in the WorkSpace.

=head3 Arguments

=over 4

=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it.

=item * New workspace name - The name you want the new config in the workspace to be.



( run in 3.117 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )