mirror of https://github.com/apache/cloudstack.git
api_refactor: entity annotation and fix parameter
- Add Entity annotation - Annotate few responses - Fix Parameter annotation to have entityType Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
parent
99875a165f
commit
ee0a4a41d0
|
|
@ -17,10 +17,13 @@
|
|||
package com.cloud.api.response;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.Entity;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@Entity(value = Domain.class)
|
||||
public class DomainResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the ID of the domain")
|
||||
private IdentityProxy id = new IdentityProxy("domain");
|
||||
|
|
|
|||
|
|
@ -19,11 +19,14 @@ package com.cloud.api.response;
|
|||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.Entity;
|
||||
import com.cloud.vm.InstanceGroup;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Entity(value = InstanceGroup.class)
|
||||
public class InstanceGroupResponse extends BaseResponse implements ControlledEntityResponse{
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the id of the instance group")
|
||||
private IdentityProxy id = new IdentityProxy("instance_group");
|
||||
|
|
|
|||
|
|
@ -19,11 +19,14 @@ package com.cloud.api.response;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.Entity;
|
||||
import com.cloud.projects.ProjectAccount;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Entity(value = ProjectAccount.class)
|
||||
public class NetworkResponse extends BaseResponse implements ControlledEntityResponse{
|
||||
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the id of the network")
|
||||
|
|
|
|||
|
|
@ -19,11 +19,14 @@ package com.cloud.api.response;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.Entity;
|
||||
import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Entity(value = SecurityGroup.class)
|
||||
public class SecurityGroupResponse extends BaseResponse implements ControlledEntityResponse{
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the ID of the security group")
|
||||
private IdentityProxy id = new IdentityProxy("security_group");
|
||||
|
|
|
|||
|
|
@ -20,11 +20,14 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.Entity;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Entity(value = VirtualMachine.class)
|
||||
public class UserVmResponse extends BaseResponse implements ControlledEntityResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="the ID of the virtual machine")
|
||||
private IdentityProxy id = new IdentityProxy("vm_instance");
|
||||
|
|
|
|||
|
|
@ -19,11 +19,14 @@ package com.cloud.api.response;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.Entity;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.utils.IdentityProxy;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Entity(value = DataCenter.class)
|
||||
public class ZoneResponse extends BaseResponse {
|
||||
@SerializedName(ApiConstants.ID) @Param(description="Zone id")
|
||||
private IdentityProxy id = new IdentityProxy("data_center");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
// 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;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/* There is a one on one mapping between the Entity and the EntityResponse
|
||||
* to the OTW layer. Value is the actual entity class it refers to.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Entity {
|
||||
Class[] value() default {};
|
||||
}
|
||||
|
|
@ -37,6 +37,8 @@ public @interface Parameter {
|
|||
|
||||
CommandType collectionType() default CommandType.OBJECT;
|
||||
|
||||
Class<?>[] entityType() default Object.class;
|
||||
|
||||
boolean expose() default true;
|
||||
|
||||
boolean includeInApiDoc() default true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue