Java Example of
Creating a Library Item
This example
shows how to create an empty library item that stores an ISO image file.
This example uses the steps that are
described in the
Create an Empty Library Item
procedure.
For related code
samples, see the
vSphere Automation SDK Java
samples at GitHub.
... // Create an instance of the ItemModel class and specify the item settings. ItemModel libItemSpec = new ItemModel(); libItemSpec.setName("ESXi ISO image"); libItemSpec.setDescription("ISO image with the latest security patches for ESXi"); libItemSpec.setType("iso"); // Associate the item with an existing content library. libItemSpec.setLibraryId("<content_library_ID>"); // Create the new Item instance, using the specified model. Item libItemService = this.vapiAuthHelper.getStubFactory().createStub(Item.class, sessionStubconfig); String itemID = UUID.randomUUID().toString(); String newItem = libItemService.create(itemID, libItemSpec);