Component - getAllComponentKeysByTemplateKeyAndServerId
Component - getAllComponentKeysByTemplateKeyAndServerId
Description :
This command returns a list of handles to all components that are based on a specified component template and server.
Each component is always associated with one template and one server. Multiple components based on the same template can be associated with the same server.
You can find a template key using commands such as getDBKeyByGroupAndName. You can determine a server ID using commands such as getServerIdByName .
Return type : DBKey
Command Input :
Variable Name | Variable Type | Description |
|---|---|---|
templateKey | DBKey | Handle of the component template for which you want to obtain component handles. |
deviceId | Integer | ID of the server for which you want to obtain component handles. |
Example
The following example gets the handle of a template and the ID of a server, then uses the retrieved template handle and server ID to get a list of the components associated with the template and server:
Script
TEMPLATE_GROUP="/Template_Group"
TEMPLATE="Template_Name"
SERVER_ID=`blcli Server getServerIdByName $SERVER`
TEMPLATE_KEY=`blcli Template getDBKeyByGroupAndName $TEMPLATE_GROUP $TEMPLATE`
COMPKEY_LIST=`blcli -v myProfile Component getAllComponentKeysByTemplateKeyAndServerId $TEMPLATE_KEY $SERVER_ID`