This example assigns a tag to a content library.

This example uses the steps that are described in the Assign the Tag to a Content Library procedure.

import com.vmware.vapi.std.DynamicID;
import com.vmware.cis.TagAssociation;
 
// 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);