Orchestrator Function: vCenter VAPI Plugin Get Tags

by Simon Sparks · January 17, 2026

To use this function add it to the class library file named vCenterVAPIService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: vCenterVAPIService.ts

Function findTagsByCategoryID

private findTagsByCategoryID(objVAPIClient: VAPIClient, strTagCategoryID: string): com_vmware_cis_tagging_tag__model[] {

    let objVAPITaggingTag: com_vmware_cis_tagging_tag = new com_vmware_cis_tagging_tag(objVAPIClient);

    let arrTagIDs: string[] = objVAPITaggingTag.list_tags_for_category(strTagCategoryID);

    let arrVMwareCISTaggingTagModel: com_vmware_cis_tagging_tag__model[] = arrTagIDs.map((strTagID: string): com_vmware_cis_tagging_tag__model => {
        let objVMwareCISTaggingTagModel: com_vmware_cis_tagging_tag__model = objVAPITaggingTag.get(strTagID);

        return objVMwareCISTaggingTagModel;
    });

    return arrVMwareCISTaggingTagModel;
}

Function findTagIDByNameFromSpecificCategoryID

private findTagIDByNameFromSpecificCategoryID(objVAPIClient: VAPIClient, strTagName: string, strTagCategoryID: string): string {

    let arrVMwareCISTaggingTagModel: com_vmware_cis_tagging_tag__model[] = this.findTagsByCategoryID(objVAPIClient, strTagCategoryID);

    let objVMwareCISTaggingTagModel: com_vmware_cis_tagging_tag__model = arrVMwareCISTaggingTagModel.find((objVMwareCISTaggingTagModel: com_vmware_cis_tagging_tag__model): boolean => {

        return objVMwareCISTaggingTagModel.name === strTagName;
    });

    return objVMwareCISTaggingTagModel.id;

}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like