This example creates a local library with name AcmeLibrary , which is stored on the local file system where vCenter Server runs.
This example uses the steps that are described in the Create a Local Content Library procedure.
use Com::Vmware::Content::Library; use Data::GUID; # 1 - Create a StorageBacking instance of OTHER type, # backed by the vCenter Server file system. my $library_backing = new Com::Vmware::Content::Library::StorageBacking(); $library_backing->set_type( Com::Vmware::Content::Library::StorageBacking::Type::OTHER); $library_backing->set_storage_uri('file:///tmp'); # 2 - Create a library model to specify properties of the new library. my $library_model = new Com::Vmware::Content::LibraryModel(); $library_model->set_name('AcmeLibrary'); $library_model->set_type( Com::Vmware::Content::LibraryModel::LibraryType::LOCAL); $library_model->set_storage_backings( [$library_backing] ); # 3 - Call the create() method, passing the library model as a parameter. my $idem_token = Data::GUID->guid_string; my $local_library_stub = new Com::Vmware::Content::LocalLibrary($my_stub_config); $my_library_id = $local_library_stub.create(create_spec => library_model, client_token => $idem_token);