This example is based on the code in the library_crud.py sample file.
For more information about storing the contents of a local library, see Content Library Storage.
Note: For a complete and up-to-date version of the sample code, see the
vSphere Automation SDK Python samples at GitHub.
... # 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 vSphere Automation 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]