Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion server/src/main/java/com/cloud/api/doc/ApiXmlDocWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,11 @@ private static void writeCommand(ObjectOutputStream out, String command) throws
}

boolean isAsync = ReflectUtil.isCmdClassAsync(clas, new Class<?>[] {BaseAsyncCmd.class, BaseAsyncCreateCmd.class});

apiCommand.setAsync(isAsync);

boolean isDeprecated = clas.getAnnotation(Deprecated.class) != null;
apiCommand.setDeprecated(isDeprecated);

Set<Field> fields = ReflectUtil.getAllFieldsForClass(clas, new Class<?>[] {BaseCmd.class, BaseAsyncCmd.class, BaseAsyncCreateCmd.class});

request = setRequestFields(fields);
Expand Down
9 changes: 9 additions & 0 deletions server/src/main/java/com/cloud/api/doc/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class Command implements Serializable{
private String sinceVersion = null;
private ArrayList<Argument> request;
private ArrayList<Argument> response;
private boolean isDeprecated;

public Command(String name, String description) {
this.name = name;
Expand Down Expand Up @@ -114,4 +115,12 @@ public String getUsage() {
public void setUsage(String usage) {
this.usage = usage;
}

public boolean isDeprecated() {
return isDeprecated;
}

public void setDeprecated(boolean deprecated) {
isDeprecated = deprecated;
}
}
5 changes: 4 additions & 1 deletion tools/apidoc/gen_toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,15 @@ def choose_category(fn):
dom = minidom.parse(data)
name = dom.getElementsByTagName('name')[0].firstChild.data
isAsync = dom.getElementsByTagName('isAsync')[0].firstChild.data
isDeprecated = dom.getElementsByTagName('isDeprecated')[0].firstChild.data
category = choose_category(fn)
if category not in categories:
categories[category] = []
categories[category].append({
'name': name,
'dirname': dirname_to_dirname[dirname],
'async': isAsync == 'true',
'deprecated': isDeprecated == 'true',
'user': dirname_to_user[dirname],
})
except ExpatError as e:
Expand All @@ -252,9 +254,10 @@ def choose_category(fn):
def xml_for(command):
name = command['name']
isAsync = command['async'] and ' (A)' or ''
isDeprecated = command['deprecated'] and ' (D)' or ''
dirname = command['dirname']
return '''<xsl:if test="name=\'%(name)s\'">
<li><a href="%(dirname)s/%(name)s.html"><xsl:value-of select="name"/>%(isAsync)s</a></li>
<li><a href="%(dirname)s/%(name)s.html"><xsl:value-of select="name"/>%(isAsync)s %(isDeprecated)s</a></li>
</xsl:if>
''' % locals()

Expand Down
1 change: 1 addition & 0 deletions tools/apidoc/generatetoc_header.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ version="1.0">
<span>Commands available through the developer API URL and the integration API URL.</span>
<div class="api_legends">
<p><span class="api_legends_async">(A)</span> implies that the command is asynchronous.</p>
<p><span class="api_legends_async">(D)</span> implies that the command is deprecated.</p>
<p>(*) implies element has a child.</p>
</div>