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.

require 'Com/Vmware/Content'
require 'Com/Vmware/Content/Library'
require 'securerandom'

# 1 - Create a StorageBacking instance of OTHER type,
#     backed by the vCenter Server file system.
library_backing =
   Com::Vmware::Content::Library::StorageBacking.new
library_backing.type =
   Com::Vmware::Content::Library::StorageBacking::Type::OTHER
library_backing.storage_uri = 'file:///tmp'

# 2 - Create a library model to specify properties of the new library.
library_model =
   Com::Vmware::Content::LibraryModel.new
library_model.name = 'AcmeLibrary'
library_model.type =
   Com::Vmware::Content::LibraryModel::LibraryType::LOCAL
library_model.storage_backings = [library_backing]

# 3 - Call the create() method, passing the library model as a parameter.
idem_token = SecureRandom.uuid
$my_local_library_stub =
   Com::Vmware::Content::LocalLibrary.new $my_stub_config
$my_library_id = $my_local_library_stub.create(create_spec=library_model,
                                               client_token=idem_token)