Skip to content

Commit 8559b4e

Browse files
committed
api: Annotate loadbalancer related cmd and response classes
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent 94e7add commit 8559b4e

11 files changed

Lines changed: 57 additions & 50 deletions

‎api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818

1919
import java.util.List;
2020

21+
import org.apache.cloudstack.api.response.FirewallRuleResponse;
22+
import org.apache.cloudstack.api.response.UserVmResponse;
2123
import org.apache.log4j.Logger;
2224

2325
import org.apache.cloudstack.api.ApiConstants;
2426
import org.apache.cloudstack.api.BaseAsyncCmd;
2527
import org.apache.cloudstack.api.BaseCmd;
26-
import org.apache.cloudstack.api.IdentityMapper;
2728
import org.apache.cloudstack.api.Implementation;
2829
import org.apache.cloudstack.api.Parameter;
2930
import org.apache.cloudstack.api.ServerApiException;
@@ -45,12 +46,12 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
4546
//////////////// API parameters /////////////////////
4647
/////////////////////////////////////////////////////
4748

48-
@IdentityMapper(entityTableName="firewall_rules")
49-
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the load balancer rule")
49+
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
50+
required=true, description="the ID of the load balancer rule")
5051
private Long id;
5152

52-
@IdentityMapper(entityTableName="vm_instance")
53-
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_IDS, type=CommandType.LIST, collectionType=CommandType.LONG, required=true, description="the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)")
53+
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType = UserVmResponse.class,
54+
required=true, description="the list of IDs of the virtual machine that are being assigned to the load balancer rule(i.e. virtualMachineIds=1,2,3)")
5455
private List<Long> virtualMachineIds;
5556

5657
/////////////////////////////////////////////////////

‎api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
import java.util.Map;
2121

22+
import org.apache.cloudstack.api.response.FirewallRuleResponse;
2223
import org.apache.log4j.Logger;
2324

2425
import org.apache.cloudstack.api.ApiConstants;
2526
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
2627
import org.apache.cloudstack.api.BaseCmd;
27-
import org.apache.cloudstack.api.IdentityMapper;
2828
import org.apache.cloudstack.api.Implementation;
2929
import org.apache.cloudstack.api.Parameter;
3030
import org.apache.cloudstack.api.ServerApiException;
@@ -51,8 +51,8 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd {
5151
// ////////////// API parameters /////////////////////
5252
// ///////////////////////////////////////////////////
5353

54-
@IdentityMapper(entityTableName="firewall_rules")
55-
@Parameter(name = ApiConstants.LBID, type = CommandType.LONG, required = true, description = "the ID of the load balancer rule")
54+
@Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class,
55+
required = true, description = "the ID of the load balancer rule")
5656
private Long lbRuleId;
5757

5858
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "the description of the LB Stickiness policy")

‎api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
import org.apache.cloudstack.api.ApiConstants;
2424
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
2525
import org.apache.cloudstack.api.BaseCmd;
26-
import org.apache.cloudstack.api.IdentityMapper;
2726
import org.apache.cloudstack.api.Implementation;
2827
import org.apache.cloudstack.api.Parameter;
2928
import org.apache.cloudstack.api.ServerApiException;
29+
import org.apache.cloudstack.api.response.DomainResponse;
30+
import org.apache.cloudstack.api.response.IPAddressResponse;
3031
import org.apache.cloudstack.api.response.LoadBalancerResponse;
32+
import org.apache.cloudstack.api.response.NetworkResponse;
33+
import org.apache.cloudstack.api.response.ZoneResponse;
3134
import com.cloud.async.AsyncJob;
3235
import com.cloud.dc.DataCenter;
3336
import com.cloud.dc.DataCenter.NetworkType;
@@ -66,12 +69,12 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
6669
@Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.INTEGER, required=true, description="the private port of the private ip address/virtual machine where the network traffic will be load balanced to")
6770
private Integer privatePort;
6871

69-
@IdentityMapper(entityTableName="user_ip_address")
70-
@Parameter(name=ApiConstants.PUBLIC_IP_ID, type=CommandType.LONG, description="public ip address id from where the network traffic will be load balanced from")
72+
@Parameter(name=ApiConstants.PUBLIC_IP_ID, type=CommandType.UUID, entityType = IPAddressResponse.class,
73+
description="public ip address id from where the network traffic will be load balanced from")
7174
private Long publicIpId;
7275

73-
@IdentityMapper(entityTableName="data_center")
74-
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=false, description="zone where the load balancer is going to be created. This parameter is required when LB service provider is ElasticLoadBalancerVm")
76+
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
77+
required=false, description="zone where the load balancer is going to be created. This parameter is required when LB service provider is ElasticLoadBalancerVm")
7578
private Long zoneId;
7679

7780
@Parameter(name=ApiConstants.PUBLIC_PORT, type=CommandType.INTEGER, required=true, description="the public port from where the network traffic will be load balanced from")
@@ -85,15 +88,15 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
8588
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="the account associated with the load balancer. Must be used with the domainId parameter.")
8689
private String accountName;
8790

88-
@IdentityMapper(entityTableName="domain")
89-
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the domain ID associated with the load balancer")
91+
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
92+
description="the domain ID associated with the load balancer")
9093
private Long domainId;
9194

9295
@Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from")
9396
private List<String> cidrlist;
9497

95-
@IdentityMapper(entityTableName="networks")
96-
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="The guest network this " +
98+
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class,
99+
description="The guest network this " +
97100
"rule will be created for. Required when public Ip address is not associated with any Guest network yet (VPC case)")
98101
private Long networkId;
99102

‎api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.command.user.loadbalancer;
1818

19+
import org.apache.cloudstack.api.response.LBStickinessResponse;
1920
import org.apache.log4j.Logger;
2021

2122
import org.apache.cloudstack.api.ApiConstants;
2223
import org.apache.cloudstack.api.BaseAsyncCmd;
2324
import org.apache.cloudstack.api.BaseCmd;
24-
import org.apache.cloudstack.api.IdentityMapper;
2525
import org.apache.cloudstack.api.Implementation;
2626
import org.apache.cloudstack.api.Parameter;
2727
import org.apache.cloudstack.api.ServerApiException;
@@ -41,8 +41,8 @@ public class DeleteLBStickinessPolicyCmd extends BaseAsyncCmd {
4141
// ////////////// API parameters /////////////////////
4242
// ///////////////////////////////////////////////////
4343

44-
@IdentityMapper(entityTableName="load_balancer_stickiness_policies")
45-
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the LB stickiness policy")
44+
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = LBStickinessResponse.class,
45+
required = true, description = "the ID of the LB stickiness policy")
4646
private Long id;
4747

4848
// ///////////////////////////////////////////////////

‎api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.command.user.loadbalancer;
1818

19+
import org.apache.cloudstack.api.response.FirewallRuleResponse;
1920
import org.apache.log4j.Logger;
2021

2122
import org.apache.cloudstack.api.ApiConstants;
2223
import org.apache.cloudstack.api.BaseAsyncCmd;
2324
import org.apache.cloudstack.api.BaseCmd;
24-
import org.apache.cloudstack.api.IdentityMapper;
2525
import org.apache.cloudstack.api.Implementation;
2626
import org.apache.cloudstack.api.Parameter;
2727
import org.apache.cloudstack.api.ServerApiException;
@@ -41,8 +41,8 @@ public class DeleteLoadBalancerRuleCmd extends BaseAsyncCmd {
4141
//////////////// API parameters /////////////////////
4242
/////////////////////////////////////////////////////
4343

44-
@IdentityMapper(entityTableName="firewall_rules")
45-
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the load balancer rule")
44+
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
45+
required=true, description="the ID of the load balancer rule")
4646
private Long id;
4747

4848

‎api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
import java.util.ArrayList;
2020
import java.util.List;
2121

22+
import org.apache.cloudstack.api.response.FirewallRuleResponse;
2223
import org.apache.log4j.Logger;
2324

2425
import org.apache.cloudstack.api.ApiConstants;
2526
import org.apache.cloudstack.api.BaseListCmd;
26-
import org.apache.cloudstack.api.IdentityMapper;
2727
import org.apache.cloudstack.api.Implementation;
2828
import org.apache.cloudstack.api.Parameter;
2929
import org.apache.cloudstack.api.response.LBStickinessResponse;
@@ -43,21 +43,17 @@ public class ListLBStickinessPoliciesCmd extends BaseListCmd {
4343
// ///////////////////////////////////////////////////
4444
// ////////////// API parameters /////////////////////
4545
// ///////////////////////////////////////////////////
46-
@IdentityMapper(entityTableName="firewall_rules")
47-
@Parameter(name = ApiConstants.LBID, type = CommandType.LONG, required = true, description = "the ID of the load balancer rule")
46+
@Parameter(name = ApiConstants.LBID, type = CommandType.UUID, entityType = FirewallRuleResponse.class,
47+
required = true, description = "the ID of the load balancer rule")
4848
private Long lbRuleId;
4949

50-
51-
5250
// ///////////////////////////////////////////////////
5351
// ///////////////// Accessors ///////////////////////
5452
// ///////////////////////////////////////////////////
5553
public Long getLbRuleId() {
5654
return lbRuleId;
5755
}
5856

59-
60-
6157
// ///////////////////////////////////////////////////
6258
// ///////////// API Implementation///////////////////
6359
// ///////////////////////////////////////////////////

‎api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
import java.util.ArrayList;
2020
import java.util.List;
2121

22+
import org.apache.cloudstack.api.response.FirewallRuleResponse;
2223
import org.apache.log4j.Logger;
2324

2425
import org.apache.cloudstack.api.ApiConstants;
2526
import org.apache.cloudstack.api.BaseListCmd;
26-
import org.apache.cloudstack.api.IdentityMapper;
2727
import org.apache.cloudstack.api.Implementation;
2828
import org.apache.cloudstack.api.Parameter;
2929
import org.apache.cloudstack.api.response.ListResponse;
@@ -43,8 +43,8 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
4343
@Parameter(name=ApiConstants.APPLIED, type=CommandType.BOOLEAN, description="true if listing all virtual machines currently applied to the load balancer rule; default is true")
4444
private Boolean applied;
4545

46-
@IdentityMapper(entityTableName="firewall_rules")
47-
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the load balancer rule")
46+
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
47+
required=true, description="the ID of the load balancer rule")
4848
private Long id;
4949

5050
/////////////////////////////////////////////////////

‎api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323

2424
import org.apache.cloudstack.api.ApiConstants;
2525
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
26-
import org.apache.cloudstack.api.IdentityMapper;
2726
import org.apache.cloudstack.api.Implementation;
2827
import org.apache.cloudstack.api.Parameter;
28+
import org.apache.cloudstack.api.response.FirewallRuleResponse;
29+
import org.apache.cloudstack.api.response.IPAddressResponse;
2930
import org.apache.cloudstack.api.response.ListResponse;
3031
import org.apache.cloudstack.api.response.LoadBalancerResponse;
32+
import org.apache.cloudstack.api.response.UserVmResponse;
33+
import org.apache.cloudstack.api.response.ZoneResponse;
3134
import com.cloud.network.rules.LoadBalancer;
3235
import com.cloud.utils.Pair;
3336

@@ -41,23 +44,23 @@ public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd {
4144
// ////////////// API parameters /////////////////////
4245
// ///////////////////////////////////////////////////
4346

44-
@IdentityMapper(entityTableName="firewall_rules")
45-
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the ID of the load balancer rule")
47+
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class,
48+
description = "the ID of the load balancer rule")
4649
private Long id;
4750

4851
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the load balancer rule")
4952
private String loadBalancerRuleName;
5053

51-
@IdentityMapper(entityTableName="user_ip_address")
52-
@Parameter(name = ApiConstants.PUBLIC_IP_ID, type = CommandType.LONG, description = "the public IP address id of the load balancer rule ")
54+
@Parameter(name = ApiConstants.PUBLIC_IP_ID, type = CommandType.UUID, entityType = IPAddressResponse.class,
55+
description = "the public IP address id of the load balancer rule ")
5356
private Long publicIpId;
5457

55-
@IdentityMapper(entityTableName="vm_instance")
56-
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.LONG, description = "the ID of the virtual machine of the load balancer rule")
58+
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class,
59+
description = "the ID of the virtual machine of the load balancer rule")
5760
private Long virtualMachineId;
5861

59-
@IdentityMapper(entityTableName="data_center")
60-
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.LONG, description = "the availability zone ID")
62+
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class,
63+
description = "the availability zone ID")
6164
private Long zoneId;
6265

6366
// ///////////////////////////////////////////////////

‎api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
import org.apache.cloudstack.api.ApiConstants;
2424
import org.apache.cloudstack.api.BaseAsyncCmd;
2525
import org.apache.cloudstack.api.BaseCmd;
26-
import org.apache.cloudstack.api.IdentityMapper;
2726
import org.apache.cloudstack.api.Implementation;
2827
import org.apache.cloudstack.api.Parameter;
2928
import org.apache.cloudstack.api.ServerApiException;
29+
import org.apache.cloudstack.api.response.FirewallRuleResponse;
30+
import org.apache.cloudstack.api.response.UserVmResponse;
3031
import org.apache.cloudstack.api.response.SuccessResponse;
3132
import com.cloud.event.EventTypes;
3233
import com.cloud.exception.InvalidParameterValueException;
@@ -45,12 +46,12 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd {
4546
//////////////// API parameters /////////////////////
4647
/////////////////////////////////////////////////////
4748

48-
@IdentityMapper(entityTableName="firewall_rules")
49-
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="The ID of the load balancer rule")
49+
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
50+
required=true, description="The ID of the load balancer rule")
5051
private Long id;
5152

52-
@IdentityMapper(entityTableName="vm_instance")
53-
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_IDS, type=CommandType.LIST, required = true, collectionType=CommandType.LONG, description="the list of IDs of the virtual machines that are being removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)")
53+
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_IDS, type=CommandType.LIST, required = true, collectionType=CommandType.UUID, entityType = UserVmResponse.class,
54+
description="the list of IDs of the virtual machines that are being removed from the load balancer rule (i.e. virtualMachineIds=1,2,3)")
5455
private List<Long> virtualMachineIds;
5556

5657
/////////////////////////////////////////////////////

‎api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.command.user.loadbalancer;
1818

19+
import org.apache.cloudstack.api.response.FirewallRuleResponse;
1920
import org.apache.log4j.Logger;
2021

2122
import org.apache.cloudstack.api.ApiConstants;
2223
import org.apache.cloudstack.api.BaseAsyncCmd;
2324
import org.apache.cloudstack.api.BaseCmd;
24-
import org.apache.cloudstack.api.IdentityMapper;
2525
import org.apache.cloudstack.api.Implementation;
2626
import org.apache.cloudstack.api.Parameter;
2727
import org.apache.cloudstack.api.ServerApiException;
@@ -46,8 +46,8 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd {
4646
@Parameter(name=ApiConstants.DESCRIPTION, type=CommandType.STRING, description="the description of the load balancer rule", length=4096)
4747
private String description;
4848

49-
@IdentityMapper(entityTableName="firewall_rules")
50-
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the id of the load balancer rule to update")
49+
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class,
50+
required=true, description="the id of the load balancer rule to update")
5151
private Long id;
5252

5353
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the load balancer rule")

0 commit comments

Comments
 (0)