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.
from com.vmware import content_client from com.vmware.content import library_client import uuid # 1 - Create a storage backing instance on a local file system. library_backing = library_client.StorageBacking() library_backing.type = library_client.StorageBacking.Type.OTHER library_backing.storage_uri = ’file:///tmp’ # 2 - Create a Library model to specify properties of the new library. library_model = content_client.LibraryModel() library_model.type = content_client.LibraryModel.LibraryType.LOCAL library_model.name = ’AcmeLibrary’ library_model.storage_backings = [library_backing] # 3 - Call the create() method, passing the library model as a parameter. idem_token = str(uuid.uuid4()) local_library_stub = content_client.LocalLibrary(my_stub_config) library_id = local_library_stub.create(create_spec=library_model, client_token=idem_token)