DaanHoogland commented on a change in pull request #3240: [WIP DO NOT MERGE]
api: instance and template details are free text
URL: https://github.com/apache/cloudstack/pull/3240#discussion_r289804069
##########
File path: server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
##########
@@ -3399,6 +3407,50 @@ else if (!template.isPublicTemplate() &&
caller.getType() != Account.ACCOUNT_TYP
hypervisorType, true, cmd.listInReadyState(),
permittedAccounts, caller, listProjectResourcesCriteria, tags, showRemovedISO,
null, null);
}
+ @Override
+ public DetailOptionsResponse listDetailOptions(final ListDetailOptionsCmd
cmd) {
+ final ResourceObjectType type = cmd.getResourceType();
+ final String resourceUuid = cmd.getResourceId();
+ final Map<String, List<String>> options = new HashMap<>();
+ switch (type) {
+ case Template:
+ case UserVm:
+ HypervisorType hypervisorType = HypervisorType.None;
+ if (!Strings.isNullOrEmpty(resourceUuid) &&
ResourceObjectType.Template.equals(type)) {
+ hypervisorType =
_templateDao.findByUuid(resourceUuid).getHypervisorType();
+ }
+ if (!Strings.isNullOrEmpty(resourceUuid) &&
ResourceObjectType.UserVm.equals(type)) {
+ hypervisorType =
_vmInstanceDao.findByUuid(resourceUuid).getHypervisorType();
+ }
+ fillVMOrTemplateDetailOptions(options, hypervisorType);
+ break;
+ default:
+ throw new CloudRuntimeException("Resource type not
supported.");
+ }
+ return new DetailOptionsResponse(options);
+ }
+
+ private void fillVMOrTemplateDetailOptions(final Map<String, List<String>>
options, final HypervisorType hypervisorType) {
+ if (options == null) {
+ throw new CloudRuntimeException("Invalid/null detail-options
response object passed");
+ }
+
+ options.put(VmDetailConstants.KEYBOARD, Arrays.asList("uk", "us",
"jp", "fr"));
Review comment:
I don't think we should maintain the possible values in the queryService.
Rather ask them from the VO?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services