mirror of https://github.com/apache/cloudstack.git
marvin_refactor: Exposing the entity that an API acts upon from API discovery
eg: dedicatePublicIpRange acts on VlanIpRange entities. So does listVlanIpRanges,
listapisresponse: {
count: 1,
api: [
{
name: "dedicatePublicIpRange",
description: "Dedicates a Public IP range to an account",
isasync: false,
related: "listVlanIpRanges",
params: [],
response: [],
entity: "VlanIpRange"
}
]
}
}
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
5ecdcd9ec1
commit
42c30f59a7
|
|
@ -79,6 +79,7 @@ public class ApiConstants {
|
|||
public static final String END_IP = "endip";
|
||||
public static final String END_IPV6 = "endipv6";
|
||||
public static final String END_PORT = "endport";
|
||||
public static final String ENTITY = "entity";
|
||||
public static final String ENTRY_TIME = "entrytime";
|
||||
public static final String FETCH_LATEST = "fetchlatest";
|
||||
public static final String FIRSTNAME = "firstname";
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@ public class ApiDiscoveryResponse extends BaseResponse {
|
|||
@SerializedName(ApiConstants.TYPE) @Param(description="response field type")
|
||||
private String type;
|
||||
|
||||
@SerializedName(ApiConstants.ENTITY) @Param(description="the entity/resource the API operates on")
|
||||
private String entity;
|
||||
|
||||
public ApiDiscoveryResponse(){
|
||||
params = new HashSet<ApiParameterResponse>();
|
||||
apiResponse = new HashSet<ApiResponseResponse>();
|
||||
|
|
@ -84,7 +87,6 @@ public class ApiDiscoveryResponse extends BaseResponse {
|
|||
this.isAsync = isAsync;
|
||||
}
|
||||
|
||||
|
||||
public boolean getAsync() {
|
||||
return isAsync;
|
||||
}
|
||||
|
|
@ -112,4 +114,12 @@ public class ApiDiscoveryResponse extends BaseResponse {
|
|||
public void addApiResponse(ApiResponseResponse apiResponse) {
|
||||
this.apiResponse.add(apiResponse);
|
||||
}
|
||||
|
||||
public String getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void setEntity(String entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,8 @@ public class ApiDiscoveryServiceImpl extends ComponentLifecycleBase implements A
|
|||
responseApiNameListMap.get(responseName).add(apiName);
|
||||
}
|
||||
response.setRelated(responseName);
|
||||
|
||||
String entity = apiCmdAnnotation.responseObject().getSimpleName();
|
||||
response.setEntity(entity.replaceAll("Response", ""));
|
||||
|
||||
Field[] responseFields = apiCmdAnnotation.responseObject().getDeclaredFields();
|
||||
for(Field responseField: responseFields) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue