Skip to content

Commit faa379b

Browse files
committed
CLOUDSTACK-6752: IAM command class separation caused ApiDoc warning of
duplicated cmd class for the same api name.
1 parent e4e8931 commit faa379b

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

server/src/com/cloud/api/doc/ApiXmlDocWriter.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,21 @@ public static void main(String[] args) {
105105
for (Class<?> cmdClass : cmdClasses) {
106106
String apiName = cmdClass.getAnnotation(APICommand.class).name();
107107
if (s_apiNameCmdClassMap.containsKey(apiName)) {
108-
System.out.println("Warning, API Cmd class " + cmdClass.getName() + " has non-unique apiname" + apiName);
109-
continue;
108+
// handle API cmd separation into admin cmd and user cmd with the common api name
109+
Class<?> curCmd = s_apiNameCmdClassMap.get(apiName);
110+
if (curCmd.isAssignableFrom(cmdClass)) {
111+
// api_cmd map always keep the admin cmd class to get full response and parameters
112+
s_apiNameCmdClassMap.put(apiName, cmdClass);
113+
} else if (cmdClass.isAssignableFrom(curCmd)) {
114+
// just skip this one without warning
115+
continue;
116+
} else {
117+
System.out.println("Warning, API Cmd class " + cmdClass.getName() + " has non-unique apiname " + apiName);
118+
continue;
119+
}
120+
} else {
121+
s_apiNameCmdClassMap.put(apiName, cmdClass);
110122
}
111-
s_apiNameCmdClassMap.put(apiName, cmdClass);
112123
}
113124

114125
LinkedProperties preProcessedCommands = new LinkedProperties();

0 commit comments

Comments
 (0)