Java Example of Assigning a Tag to a Content Library
This example is based on code in the TaggingWorkflow.java sample file.
This example uses the steps that are described in the Assign the Tag to a Content Library procedure.
Note: For a complete and
up-to-date version of the sample code, see the
vSphere
Automation SDK Java samples at GitHub.
... // 1 - Create a dynamic type ID for the content library. DynamicID libraryDynamicId = new DynamicID(Library.RESOURCE_TYPE, myLibrary.getId()); // 2- Attach the tag to the ClusterComputeResource managed object. TagAssociation tagAssociationStub = myStubFactory.createStub(TagAssociation.class, myStubConfig); tagAssociationStub.attach(myLibrary.getId(), libraryDynamicId);