This example shows how to use a datastore backing for a content library.

For more information about storing the contents of a local library, see Content Library Storage.

Note: For related code samples, see the vSphere Automation SDK Ruby samples at GitHub.
...

# Create a StorageBacking instance of type DATASTORE.
library_backing =
   Com::Vmware::Content::Library::StorageBacking.new
library_backing.type =
   Com::Vmware::Content::Library::StorageBacking::Type::DATASTORE

# Pass the value of the datastore managed object reference.
library_backing.datastore_id = 'datastore-123'

# 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]