This example shows how to assign a tag to ClusterComputeResource.
use Com::Vmware::Cis::Tagging::TagAssociation; use Com::Vmware::Vapi::Std::DynamicID; # Use vSphere SDK for Perl to find cluster MORef. my $cluster_view = Vim::find_entity_view( view_type => 'ClusterComputeReource', filter => { name => $my_cluster_name } ); # Convert MORef to dynamic ID. my $moref = $cluster_view{'mo_ref'}; my $dynamic_id = new Com::Vmware::Vapi::Std::DynamicID(); $dynamic_id->set_type($moref->{'type'}); $dynamic_id->set_id($moref->{'value'}); # Attach tag ID to dynamic ID of target. my $association_stub = $my_stub_factory->create_stub( 'service_name' => 'Com::Vmware::Cis::Tagging::Association', 'stub_config' => $my_stub_config); $association_stub.attach($my_tag_id, $dynamic_id);