mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
ApiDiscovery: Fix response add response class that will hold api response
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
parent
3df026bd51
commit
f170075558
@ -16,18 +16,15 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@EntityReference(value = Account.class)
|
||||
public class ApiDiscoveryResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the name of the api command")
|
||||
private String name;
|
||||
@ -41,11 +38,18 @@ public class ApiDiscoveryResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.IS_ASYNC) @Param(description="true if api is asynchronous")
|
||||
private Boolean isAsync;
|
||||
|
||||
@SerializedName("related") @Param(description="comma separated related apis")
|
||||
private String related;
|
||||
|
||||
@SerializedName(ApiConstants.PARAMS) @Param(description="the list params the api accepts", responseObject = ApiParameterResponse.class)
|
||||
private Set<ApiParameterResponse> params;
|
||||
|
||||
@SerializedName(ApiConstants.RESPONSE) @Param(description="api response fields", responseObject = ApiResponseResponse.class)
|
||||
private Set<ApiResponseResponse> apiResponse;
|
||||
|
||||
public ApiDiscoveryResponse(){
|
||||
params = new HashSet<ApiParameterResponse>();
|
||||
apiResponse = new HashSet<ApiResponseResponse>();
|
||||
isAsync = false;
|
||||
}
|
||||
|
||||
@ -65,6 +69,18 @@ public class ApiDiscoveryResponse extends BaseResponse {
|
||||
this.isAsync = isAsync;
|
||||
}
|
||||
|
||||
public String getRelated() {
|
||||
return related;
|
||||
}
|
||||
|
||||
public void setRelated(String related) {
|
||||
this.related = related;
|
||||
}
|
||||
|
||||
public Set<ApiParameterResponse> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(Set<ApiParameterResponse> params) {
|
||||
this.params = params;
|
||||
}
|
||||
@ -72,4 +88,8 @@ public class ApiDiscoveryResponse extends BaseResponse {
|
||||
public void addParam(ApiParameterResponse param) {
|
||||
this.params.add(param);
|
||||
}
|
||||
|
||||
public void addApiResponse(ApiResponseResponse apiResponse) {
|
||||
this.apiResponse.add(apiResponse);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,9 @@ public class ApiParameterResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.SINCE) @Param(description="version of CloudStack the api was introduced in")
|
||||
private String since;
|
||||
|
||||
@SerializedName("related") @Param(description="comma separated related apis to get the parameter")
|
||||
private String related;
|
||||
|
||||
public ApiParameterResponse(){
|
||||
}
|
||||
|
||||
@ -67,4 +70,12 @@ public class ApiParameterResponse extends BaseResponse {
|
||||
this.since = since;
|
||||
}
|
||||
|
||||
public String getRelated() {
|
||||
return related;
|
||||
}
|
||||
|
||||
public void setRelated(String related) {
|
||||
this.related = related;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
public class ApiResponseResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.NAME) @Param(description="the name of the api response field")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.DESCRIPTION) @Param(description="description of the api response field")
|
||||
private String description;
|
||||
|
||||
@SerializedName(ApiConstants.TYPE) @Param(description="response field type")
|
||||
private String type;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user