You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CLOUDSTACK-9602: Improve resource limits comprehension in listResources (#1554)
Add resource type name in request and response for listResources API call.
This adds in the response a new attribute typename with the String value for the corresponding resource enum.
{
"capacitytotal": 0,
"capacityused": 0,
"percentused": "0",
"type": 19,
"typename": "gpu",
"zoneid": "381d0a95-ed4a-4ad9-b41c-b97073c1a433",
"zonename": "ch-dk-2"
}
Signed-off-by: Marc-Aurèle Brothier <m@brothier.org>
@@ -58,6 +60,21 @@ public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd
58
60
+ "11 - SecondaryStorage. Total secondary storage space (in GiB) a user can use. ")
59
61
privateIntegerresourceType;
60
62
63
+
@Parameter(name = ApiConstants.RESOURCE_TYPE_NAME, type = CommandType.STRING, description = "Type of resource (wins over resourceType if both are provided). Values are: "
64
+
+ "user_vm - Instance. Number of instances a user can create. "
65
+
+ "public_ip - IP. Number of public IP addresses an account can own. "
66
+
+ "volume - Volume. Number of disk volumes an account can own. "
67
+
+ "snapshot - Snapshot. Number of snapshots an account can own. "
68
+
+ "template - Template. Number of templates an account can register/create. "
69
+
+ "project - Project. Number of projects an account can own. "
70
+
+ "network - Network. Number of networks an account can own. "
71
+
+ "vpc - VPC. Number of VPC an account can own. "
72
+
+ "cpu - CPU. Number of CPU an account can allocate for his resources. "
73
+
+ "memory - Memory. Amount of RAM an account can allocate for his resources. "
74
+
+ "primary_storage - PrimaryStorage. Total primary storage space (in GiB) a user can use. "
75
+
+ "secondary_storage - SecondaryStorage. Total secondary storage space (in GiB) a user can use. ")
Copy file name to clipboardExpand all lines: api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@
16
16
// under the License.
17
17
packageorg.apache.cloudstack.api.response;
18
18
19
+
importcom.cloud.configuration.Resource;
19
20
importcom.google.gson.annotations.SerializedName;
20
21
21
22
importorg.apache.cloudstack.api.ApiConstants;
@@ -49,6 +50,10 @@ public class ResourceCountResponse extends BaseResponse implements ControlledEnt
49
50
@Param(description = "resource type. Values include 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.")
50
51
privateStringresourceType;
51
52
53
+
@SerializedName(ApiConstants.RESOURCE_TYPE_NAME)
54
+
@Param(description = "resource type name. Values include user_vm, public_ip, volume, snapshot, template, project, network, vpc, cpu, memory, primary_storage, secondary_storage.")
55
+
privateStringresourceTypeName;
56
+
52
57
@SerializedName("resourcecount")
53
58
@Param(description = "resource count")
54
59
privatelongresourceCount;
@@ -68,8 +73,9 @@ public void setDomainName(String domainName) {
Copy file name to clipboardExpand all lines: api/src/org/apache/cloudstack/api/response/ResourceLimitResponse.java
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@
16
16
// under the License.
17
17
packageorg.apache.cloudstack.api.response;
18
18
19
+
importcom.cloud.configuration.Resource;
19
20
importcom.google.gson.annotations.SerializedName;
20
21
21
22
importorg.apache.cloudstack.api.ApiConstants;
@@ -44,6 +45,10 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt
44
45
@Param(description = "resource type. Values include 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11. See the resourceType parameter for more information on these values.")
45
46
privateStringresourceType;
46
47
48
+
@SerializedName(ApiConstants.RESOURCE_TYPE_NAME)
49
+
@Param(description = "resource type name. Values include user_vm, public_ip, volume, snapshot, template, project, network, vpc, cpu, memory, primary_storage, secondary_storage.")
50
+
privateStringresourceTypeName;
51
+
47
52
@SerializedName("max")
48
53
@Param(description = "the maximum number of the resource. A -1 means the resource currently has no limit.")
49
54
privateLongmax;
@@ -76,8 +81,9 @@ public void setDomainName(String domainName) {
0 commit comments