Skip to content

Commit 0c38485

Browse files
committed
Added missing descriptions to a bunch of api commands
1 parent 07aa1d6 commit 0c38485

11 files changed

Lines changed: 68 additions & 79 deletions

File tree

api/src/com/cloud/api/commands/CreateTemplateCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd {
4747
//////////////// API parameters /////////////////////
4848
/////////////////////////////////////////////////////
4949

50-
@Parameter(name=ApiConstants.BITS, type=CommandType.INTEGER)
50+
@Parameter(name=ApiConstants.BITS, type=CommandType.INTEGER, description="32 or 64 bit")
5151
private Integer bits;
5252

5353
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the template. This is usually used for display purposes.")

api/src/com/cloud/api/commands/RegisterPreallocatedLunCmd.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,17 @@ public class RegisterPreallocatedLunCmd extends BaseCmd {
3333
//////////////// API parameters /////////////////////
3434
/////////////////////////////////////////////////////
3535

36-
//FIXME - add description
37-
@Parameter(name=ApiConstants.DISK_SIZE, type=CommandType.LONG, required=true)
36+
@Parameter(name=ApiConstants.DISK_SIZE, type=CommandType.LONG, required=true, description="Volume size")
3837
private Long diskSize;
3938

40-
//FIXME - add description
41-
@Parameter(name=ApiConstants.LUN, type=CommandType.INTEGER, required=true)
39+
@Parameter(name=ApiConstants.LUN, type=CommandType.INTEGER, required=true, description="Lun id")
4240
private Integer lun;
4341

4442
//FIXME - add description
4543
@Parameter(name=ApiConstants.PORTAL, type=CommandType.STRING, required=true)
4644
private String portal;
4745

48-
//FIXME - add description
49-
@Parameter(name=ApiConstants.TAGS, type=CommandType.STRING)
46+
@Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="tags for the volume")
5047
private String tags;
5148

5249
@Parameter(name=ApiConstants.TARGET_IQN, type=CommandType.STRING, required=true, description="the target IQN on the storage host where LUN is created")

api/src/com/cloud/api/response/DiskOfferingResponse.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ public class DiskOfferingResponse extends BaseResponse {
4545
@SerializedName(ApiConstants.CREATED) @Param(description="the date this disk offering was created")
4646
private Date created;
4747

48-
@SerializedName("ismirrored")
49-
private Boolean mirrored;
50-
51-
@SerializedName("iscustomized")
48+
@SerializedName("iscustomized") @Param(description="true if disk offering uses custom size, false otherwise")
5249
private Boolean customized;
5350

5451
@SerializedName(ApiConstants.TAGS) @Param(description="the tags for the disk offering")
@@ -110,14 +107,6 @@ public void setCreated(Date created) {
110107
this.created = created;
111108
}
112109

113-
public Boolean isMirrored() {
114-
return mirrored;
115-
}
116-
117-
public void setMirrored(Boolean mirrored) {
118-
this.mirrored = mirrored;
119-
}
120-
121110
public String getTags() {
122111
return tags;
123112
}

api/src/com/cloud/api/response/ExtractResponse.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class ExtractResponse extends BaseResponse {
4242
@SerializedName("accountid") @Param(description="the account id to which the extracted object belongs")
4343
private Long accountId;
4444

45-
@SerializedName("resultstring") @Param(description="")
45+
@SerializedName("resultstring") @Param(expose=false)
4646
private String resultString;
4747

4848
@SerializedName(ApiConstants.CREATED) @Param(description="the time and date the object was created")
@@ -51,11 +51,9 @@ public class ExtractResponse extends BaseResponse {
5151
@SerializedName(ApiConstants.STATE) @Param(description="the state of the extracted object")
5252
private String state;
5353

54-
//FIXME - add description
55-
@SerializedName("storagetype")
54+
@SerializedName("storagetype") @Param(description="type of the storage")
5655
private String storageType;
5756

58-
//FIXME - add description
5957
@SerializedName("storage")
6058
private String storage;
6159

api/src/com/cloud/api/response/HypervisorResponse.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package com.cloud.api.response;
22

33
import com.cloud.api.ApiConstants;
4+
import com.cloud.serializer.Param;
45
import com.google.gson.annotations.SerializedName;
56

67
public class HypervisorResponse extends BaseResponse {
7-
@SerializedName(ApiConstants.NAME)
8+
@SerializedName(ApiConstants.NAME) @Param(description="Hypervisor name")
89
private String name;
910

1011
public String getName() {

api/src/com/cloud/api/response/NetworkResponse.java

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.List;
44

55
import com.cloud.api.ApiConstants;
6+
import com.cloud.network.Networks;
67
import com.cloud.serializer.Param;
78
import com.google.gson.annotations.SerializedName;
89

@@ -17,20 +18,16 @@ public class NetworkResponse extends BaseResponse{
1718
@SerializedName("displaytext") @Param(description="the displaytext of the network")
1819
private String displaytext;
1920

20-
//TODO - add description
21-
@SerializedName("broadcastdomaintype")
21+
@SerializedName("broadcastdomaintype") @Param(description="Broadcast domain type of the network")
2222
private String broadcastDomainType;
2323

24-
//TODO - add description
25-
@SerializedName("traffictype")
24+
@SerializedName("traffictype") @Param(description="the traffic type of the network")
2625
private String trafficType;
2726

28-
//TODO - add description
29-
@SerializedName("gateway")
27+
@SerializedName("gateway") @Param(description="the network's gateway")
3028
private String gateway;
3129

32-
//TODO - add description
33-
@SerializedName("netmask")
30+
@SerializedName("netmask") @Param(description="the network's netmask")
3431
private String netmask;
3532

3633
@SerializedName("startip") @Param(description="the start ip of the network")
@@ -39,61 +36,47 @@ public class NetworkResponse extends BaseResponse{
3936
@SerializedName("endip") @Param(description="the end ip of the network")
4037
private String endIp;
4138

42-
//TODO - add description
43-
@SerializedName("zoneid")
39+
@SerializedName("zoneid") @Param(description="zone id of the network")
4440
private Long zoneId;
4541

46-
//TODO - add description
47-
@SerializedName("networkofferingid")
42+
@SerializedName("networkofferingid") @Param(description="network offering id the network is created from")
4843
private Long networkOfferingId;
4944

50-
//TODO - add description
51-
@SerializedName("networkofferingname")
45+
@SerializedName("networkofferingname") @Param(description="name of the network offering the network is created from")
5246
private String networkOfferingName;
5347

54-
//TODO - add description
55-
@SerializedName("networkofferingdisplaytext")
48+
@SerializedName("networkofferingdisplaytext") @Param(description="display text of the network offering the network is created from")
5649
private String networkOfferingDisplayText;
5750

58-
//TODO - add description
59-
@SerializedName("networkofferingavailability")
51+
@SerializedName("networkofferingavailability") @Param(description="availability of the network offering the network is created from")
6052
private String networkOfferingAvailability;
6153

62-
63-
//TODO - add description
64-
@SerializedName("isshared")
54+
@SerializedName("isshared") @Param(description="true if network is shared, false otherwise")
6555
private Boolean isShared;
6656

67-
//TODO - add description
68-
@SerializedName("issystem")
57+
@SerializedName("issystem") @Param(description="true if network is system, false otherwise")
6958
private Boolean isSystem;
7059

71-
//TODO - add description
72-
@SerializedName("state")
60+
@SerializedName("state") @Param(description="state of the network")
7361
private String state;
7462

7563
//TODO - add description
7664
@SerializedName("related")
7765
private Long related;
7866

79-
//TODO - add description
80-
@SerializedName("broadcasturi")
67+
@SerializedName("broadcasturi") @Param(description="broadcast uri of the network")
8168
private String broadcastUri;
8269

83-
//TODO - add description
84-
@SerializedName("dns1")
70+
@SerializedName("dns1") @Param(description="the first dns for the network")
8571
private String dns1;
8672

87-
//TODO - add description
88-
@SerializedName("dns2")
73+
@SerializedName("dns2") @Param(description="the second dns for the network")
8974
private String dns2;
9075

91-
//TODO - add description
92-
@SerializedName("type")
76+
@SerializedName("type") @Param(description="the type of the network")
9377
private String type;
9478

95-
//TODO - add description
96-
@SerializedName("vlan")
79+
@SerializedName("vlan") @Param(description="the vlan of the network")
9780
private String vlan;
9881

9982
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the account associated with the network")

api/src/com/cloud/api/response/VolumeResponse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ public class VolumeResponse extends BaseResponse {
8181
@SerializedName("storagetype") @Param(description="shared or local storage")
8282
private String storageType;
8383

84-
@SerializedName("sourceid")
84+
@SerializedName("sourceid") @Param(description="Id of the snapshot or diskOffering volume is created from")
8585
private Long sourceId;
8686

87-
@SerializedName("sourcetype")
87+
@SerializedName("sourcetype") @Param(description="Type of the source the volume is created from. Can be: Snapshot,DiskOffering")
8888
private String sourceType;
8989

90-
@SerializedName(ApiConstants.HYPERVISOR)
90+
@SerializedName(ApiConstants.HYPERVISOR) @Param(description="Hypervisor the volume belongs to")
9191
private String hypervisor;
9292

9393
@SerializedName(ApiConstants.DISK_OFFERING_ID) @Param(description="ID of the disk offering")

api/src/com/cloud/api/response/ZoneResponse.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,18 @@ public class ZoneResponse extends BaseResponse {
4242

4343
@SerializedName(ApiConstants.INTERNAL_DNS2) @Param(description="the second internal DNS for the Zone")
4444
private String internalDns2;
45-
46-
//FIXME - add description. This parameter is called "vnet" in updateZone, and vlan in createZone - figure out which one is right.
47-
@SerializedName(ApiConstants.VLAN)
45+
46+
@SerializedName(ApiConstants.VLAN) @Param(description="the vlan range of the zone")
4847
private String vlan;
4948

5049
@SerializedName(ApiConstants.GUEST_CIDR_ADDRESS) @Param(description="the guest CIDR address for the Zone")
5150
private String guestCidrAddress;
5251

53-
//FIXME - do we need 2 parameters below at all?
52+
//TODO - generate description
5453
@SerializedName("status")
5554
private String status;
5655

57-
@SerializedName(ApiConstants.DISPLAY_TEXT)
56+
@SerializedName(ApiConstants.DISPLAY_TEXT) @Param(description="the display text of the zone")
5857
private String displayText;
5958

6059
@SerializedName(ApiConstants.DOMAIN) @Param(description="Domain name for the Vms in the zone")

api/src/com/cloud/serializer/Param.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
public @interface Param {
2626
String name() default "";
2727
String propName() default "";
28-
String description() default "";
28+
String description() default "";
29+
boolean expose() default true;
2930
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,11 @@ public static void main (String[] args) {
203203
StringBuffer newParameters = new StringBuffer();
204204
newParameters.append("\n\t\t\tNew parameters: ");
205205
for (Argument newArg: newReqArgs) {
206-
newParameters.append(newArg.getName() + ", ");
206+
String isRequiredParam = "optional";
207+
if (newArg.isRequired()) {
208+
isRequiredParam = "required";
209+
}
210+
newParameters.append(newArg.getName() + " (" + isRequiredParam + "), ");
207211
}
208212
newParameters.delete(newParameters.length()-2, newParameters.length()-1);
209213
out.write(newParameters.toString());

0 commit comments

Comments
 (0)