This example is based on the code in the content_library_workflow.py sample file located in the following vCloud Suite SDK for Python directory: /client/samples/src/com/vmware/vcloud/suite/sample/workflow.

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

from com.vmware import content_client
from com.vmware.content import library_client

# Create a StorageBacking instance of datastore type.
library_backing = library_client.StorageBacking()
library_backing.type = library_client.StorageBacking.Type.DATASTORE

# Pass the value of the datastore managed object reference. 
# The vCloud Suite SDK for Python contains
# the GetDatastoreByName class, which sample resource is located in the 
# /client/samples/src/com/vmware/vcloud/suite/sample/vim/helpers/ directory. 
# You can use the utility to retrieve the managed object reference of the datastore entity.
library_backing.datastore_id = ‘datastore-123’

# Create a LibraryModel that represents a local library backed on a datastore.
library_model = content_client.LibraryModel()
library_model.name = ‘AcmeLibrary’
library_model.storage_backings = [library_backing]