We need the list of instance id (like externald in server list) to be used as backend for Cloudformation based catalog item.
Using Morpheus api /instances, shows the instance name but cannot get AWS instance id like i-xxxxx. I have tried Instances Wiki but it does not provided full instance list as well as InstanceId is number. Servers and Servers Wiki not provided the result as well.
Hi Ripon_Banik,
you can achieve it by using REST option list, please find the REST endpoint,
/api/servers?name=
O/P :- servers.externalId
/api/instances/?name=
O/P :- instances.containerDetails.server.externalId
Thanks
Velan
1 Like
@vsenthilkarasu Thanks but it does not work as well, I am using typehead but it is not allowing me to select multiple servers as well -
-
Type AWS ALB Targets (typeahead) <%= customOptions.albtargets %>
Even when I select I server I am getting only the server name, not the external id,
Here is my Morpheus API query in the Option list -
if (input.cloudlist && input.grouplist) {
for (var x = 0; x < data.length; x++) {
results.push({name:data.name, value:data.externalId});
}
}
But it returns name, not the externalId.
you have mentioned as servers.externalId but it does not show any servers in typehead box at all.
Hi Ripon_Banik,
REST Option List sample below.
Translation Script:
for(var x=0;x <data.servers.length; x++){
results.push({name: data.servers.name,value: data.servers.externalId})
}
Request Script:
results=[{name: “zoneId”,value: input.vsClouds}]
for the typeahead option, please ensure “ALLOW MULTIPLE SELECTIONS” is checked.
The output would be “[i-0a8e257cc829972e5, i-00e8dfe5a1498dcd4]” if you select 2 AWS servers in typeahead.
Thanks
Velan
@vsenthilkarasu Thanks. I am now able to get the severs, but it is not listing all the servers, so I modified the query as below but it is showing error:
query - https://xxx/api/servers?max=2200
error: Error Making HTTP Request for https://xxxx/api/servers?max=2200 - null
Also If I create two variables with the same option list to select server 1 and server 2, it does not populate data at all.
N.B. max=100 seems to work.