Skip to content

Commit d340cf6

Browse files
Formatting to make check style happy and code clean ups
1 parent 6c89475 commit d340cf6

12 files changed

Lines changed: 292 additions & 505 deletions

File tree

api/src/main/java/com/cloud/network/vpc/NetworkACLItem.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
public interface NetworkACLItem extends InternalIdentity, Identity, Displayable {
2626

27+
@Override
2728
String getUuid();
2829

2930
Action getAction();
@@ -51,7 +52,7 @@ enum Action {
5152
Integer getSourcePortStart();
5253

5354
/**
54-
* @return last port of the source prot range. If this is null, that means only one port is mapped.
55+
* @return last port of the source port range. If this is null, that means only one port is mapped.
5556
*/
5657
Integer getSourcePortEnd();
5758

@@ -70,9 +71,6 @@ enum Action {
7071

7172
List<String> getSourceCidrList();
7273

73-
/**
74-
* @return
75-
*/
7674
TrafficType getTrafficType();
7775

7876
@Override

api/src/main/java/com/cloud/network/vpc/NetworkACLService.java

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -29,105 +29,61 @@
2929
public interface NetworkACLService {
3030
/**
3131
* Creates Network ACL for the specified VPC
32-
* @param name
33-
* @param description
34-
* @param vpcId
35-
* @param forDisplay TODO
36-
* @return
3732
*/
3833
NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay);
3934

4035
/**
4136
* Get Network ACL with specified Id
42-
* @param id
43-
* @return
4437
*/
4538
NetworkACL getNetworkACL(long id);
4639

4740
/**
4841
* List NetworkACLs by Id/Name/Network or Vpc it belongs to
49-
* @param cmd
50-
* @return
5142
*/
5243
Pair<List<? extends NetworkACL>, Integer> listNetworkACLs(ListNetworkACLListsCmd cmd);
5344

5445
/**
5546
* Delete specified network ACL. Deletion fails if the list is not empty
56-
* @param id
57-
* @return
5847
*/
5948
boolean deleteNetworkACL(long id);
6049

6150
/**
6251
* Associates ACL with specified Network
63-
* @param aclId
64-
* @param networkId
65-
* @return
66-
* @throws ResourceUnavailableException
6752
*/
6853
boolean replaceNetworkACL(long aclId, long networkId) throws ResourceUnavailableException;
6954

7055
/**
7156
* Applied ACL to associated networks
72-
* @param aclId
73-
* @return
74-
* @throws ResourceUnavailableException
7557
*/
7658
boolean applyNetworkACL(long aclId) throws ResourceUnavailableException;
7759

7860
/**
7961
* Creates a Network ACL Item within an ACL and applies the ACL to associated networks
80-
* @param createNetworkACLCmd
81-
* @return
8262
*/
8363
NetworkACLItem createNetworkACLItem(CreateNetworkACLCmd aclItemCmd);
8464

8565
/**
8666
* Return ACL item with specified Id
87-
* @param ruleId
88-
* @return
8967
*/
9068
NetworkACLItem getNetworkACLItem(long ruleId);
9169

9270
/**
9371
* Lists Network ACL Items by Id, Network, ACLId, Traffic Type, protocol
94-
* @param listNetworkACLsCmd
95-
* @return
9672
*/
9773
Pair<List<? extends NetworkACLItem>, Integer> listNetworkACLItems(ListNetworkACLsCmd cmd);
9874

9975
/**
10076
* Revoke ACL Item with specified Id
101-
* @param ruleId
102-
* @return
10377
*/
10478
boolean revokeNetworkACLItem(long ruleId);
10579

10680
/**
10781
* Updates existing aclItem applies to associated networks
108-
* @param id
109-
* @param protocol
110-
* @param sourceCidrList
111-
* @param trafficType
112-
* @param action
113-
* @param number
114-
* @param sourcePortStart
115-
* @param sourcePortEnd
116-
* @param icmpCode
117-
* @param icmpType
118-
* @param newUUID TODO
119-
* @param forDisplay TODO
120-
* @return
121-
* @throws ResourceUnavailableException
12282
*/
12383
NetworkACLItem updateNetworkACLItem(UpdateNetworkACLItemCmd updateNetworkACLItemCmd) throws ResourceUnavailableException;
12484

12585
/**
12686
* Associates ACL with specified Network
127-
* @param aclId
128-
* @param privateGatewayId
129-
* @return
130-
* @throws ResourceUnavailableException
13187
*/
13288
boolean replaceNetworkACLonPrivateGw(long aclId, long privateGatewayId) throws ResourceUnavailableException;
13389

api/src/main/java/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@
4040
import com.cloud.user.Account;
4141
import com.cloud.utils.net.NetUtils;
4242

43-
@APICommand(name = "createNetworkACL",
44-
description = "Creates a ACL rule in the given network (the network has to belong to VPC)",
45-
responseObject = NetworkACLItemResponse.class,
46-
requestHasSensitiveInfo = false,
47-
responseHasSensitiveInfo = false)
43+
@APICommand(name = "createNetworkACL", description = "Creates a ACL rule in the given network (the network has to belong to VPC)", responseObject = NetworkACLItemResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
4844
public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
4945
public static final Logger s_logger = Logger.getLogger(CreateNetworkACLCmd.class.getName());
5046

@@ -54,10 +50,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
5450
// ////////////// API parameters /////////////////////
5551
// ///////////////////////////////////////////////////
5652

57-
@Parameter(name = ApiConstants.PROTOCOL,
58-
type = CommandType.STRING,
59-
required = true,
60-
description = "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number")
53+
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description = "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number")
6154
private String protocol;
6255

6356
@Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of ACL")
@@ -75,20 +68,13 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
7568
@Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this ICMP message")
7669
private Integer icmpCode;
7770

78-
@Parameter(name = ApiConstants.NETWORK_ID,
79-
type = CommandType.UUID,
80-
entityType = NetworkResponse.class,
81-
description = "The network of the VM the ACL will be created for")
71+
@Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, description = "The network of the VM the ACL will be created for")
8272
private Long networkId;
8373

84-
@Parameter(name = ApiConstants.ACL_ID,
85-
type = CommandType.UUID,
86-
entityType = NetworkACLResponse.class,
87-
description = "The network of the VM the ACL will be created for")
74+
@Parameter(name = ApiConstants.ACL_ID, type = CommandType.UUID, entityType = NetworkACLResponse.class, description = "The network of the VM the ACL will be created for")
8875
private Long aclId;
8976

90-
@Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "the traffic type for the ACL,"
91-
+ "can be ingress or egress, defaulted to ingress if not specified")
77+
@Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "the traffic type for the ACL," + "can be ingress or egress, defaulted to ingress if not specified")
9278
private String trafficType;
9379

9480
@Parameter(name = ApiConstants.NUMBER, type = CommandType.INTEGER, description = "The network of the VM the ACL will be created for")
@@ -97,7 +83,8 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
9783
@Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny")
9884
private String action;
9985

100-
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
86+
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {
87+
RoleType.Admin})
10188
private Boolean display;
10289

10390
@Parameter(name = ApiConstants.ACL_REASON, type = CommandType.STRING, description = "A description indicating why the ACL rule is required.")
@@ -260,5 +247,4 @@ public void execute() throws ResourceUnavailableException {
260247
}
261248
}
262249
}
263-
264-
}
250+
}

api/src/main/java/org/apache/cloudstack/api/command/user/network/UpdateNetworkACLItemCmd.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
import com.cloud.network.vpc.NetworkACLItem;
3333
import com.cloud.user.Account;
3434

35-
@APICommand(name = "updateNetworkACLItem", description = "Updates ACL item with specified ID", responseObject = NetworkACLItemResponse.class,
36-
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
35+
@APICommand(name = "updateNetworkACLItem", description = "Updates ACL item with specified ID", responseObject = NetworkACLItemResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
3736
public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
3837
public static final Logger s_logger = Logger.getLogger(UpdateNetworkACLItemCmd.class.getName());
3938

@@ -43,16 +42,10 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
4342
// ////////////// API parameters /////////////////////
4443
// ///////////////////////////////////////////////////
4544

46-
@Parameter(name = ApiConstants.ID,
47-
type = CommandType.UUID,
48-
entityType = NetworkACLItemResponse.class,
49-
required = true,
50-
description = "the ID of the network ACL item")
45+
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkACLItemResponse.class, required = true, description = "the ID of the network ACL item")
5146
private Long id;
5247

53-
@Parameter(name = ApiConstants.PROTOCOL,
54-
type = CommandType.STRING,
55-
description = "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number")
48+
@Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "the protocol for the ACL rule. Valid values are TCP/UDP/ICMP/ALL or valid protocol number")
5649
private String protocol;
5750

5851
@Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of ACL")
@@ -70,8 +63,7 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
7063
@Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this ICMP message")
7164
private Integer icmpCode;
7265

73-
@Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "the traffic type for the ACL,"
74-
+ "can be Ingress or Egress, defaulted to Ingress if not specified")
66+
@Parameter(name = ApiConstants.TRAFFIC_TYPE, type = CommandType.STRING, description = "the traffic type for the ACL, can be Ingress or Egress, defaulted to Ingress if not specified")
7567
private String trafficType;
7668

7769
@Parameter(name = ApiConstants.NUMBER, type = CommandType.INTEGER, description = "The network of the vm the ACL will be created for")
@@ -80,7 +72,8 @@ public class UpdateNetworkACLItemCmd extends BaseAsyncCustomIdCmd {
8072
@Parameter(name = ApiConstants.ACTION, type = CommandType.STRING, description = "scl entry action, allow or deny")
8173
private String action;
8274

83-
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {RoleType.Admin})
75+
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the rule to the end user or not", since = "4.4", authorized = {
76+
RoleType.Admin})
8477
private Boolean display;
8578

8679
@Parameter(name = ApiConstants.ACL_REASON, type = CommandType.STRING, description = "A description indicating why the ACL rule is required.")
@@ -106,8 +99,9 @@ public Long getId() {
10699
public String getProtocol() {
107100
if (protocol != null) {
108101
return protocol.trim();
109-
} else
102+
} else {
110103
return null;
104+
}
111105
}
112106

113107
public List<String> getSourceCidrList() {

engine/components-api/src/main/java/com/cloud/network/vpc/NetworkACLManager.java

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -25,126 +25,67 @@ public interface NetworkACLManager {
2525

2626
/**
2727
* Creates Network ACL for the specified VPC
28-
* @param name
29-
* @param description
30-
* @param vpcId
31-
* @param forDisplay TODO
32-
* @return
3328
*/
3429
NetworkACL createNetworkACL(String name, String description, long vpcId, Boolean forDisplay);
3530

3631
/**
3732
* Fetches Network ACL with specified Id
38-
* @param id
39-
* @return
4033
*/
4134
NetworkACL getNetworkACL(long id);
4235

4336
/**
4437
* Applies the items in the ACL to all associated networks
45-
* @param aclId
46-
* @return
47-
* @throws ResourceUnavailableException
4838
*/
4939
boolean applyNetworkACL(long aclId) throws ResourceUnavailableException;
5040

5141
/**
5242
* Deletes the specified Network ACL
53-
* @param id
54-
* @return
5543
*/
5644
boolean deleteNetworkACL(NetworkACL acl);
5745

5846
/**
59-
* Associates acl with a network and applies the ACLItems
60-
* @param acl
61-
* @param network
62-
* @return
47+
* Associates ACL with a network and applies the ACLItems
6348
*/
6449
boolean replaceNetworkACL(NetworkACL acl, NetworkVO network) throws ResourceUnavailableException;
6550

6651
/**
6752
* Creates a Network ACL Item within an ACL and applies it to associated networks
68-
* @param sourcePortStart
69-
* @param sourcePortEnd
70-
* @param protocol
71-
* @param sourceCidrList
72-
* @param icmpCode
73-
* @param icmpType
74-
* @param trafficType
75-
* @param aclId
76-
* @param action
77-
* @param number
78-
* @param forDisplay TODO
79-
* @return
8053
*/
8154
NetworkACLItem createNetworkACLItem(NetworkACLItemVO networkACLItemVO);
8255

8356
/**
8457
* Returns Network ACL Item with specified Id
85-
* @param ruleId
86-
* @return
8758
*/
8859
NetworkACLItem getNetworkACLItem(long ruleId);
8960

9061
/**
9162
* Revoke ACL Item and apply changes
92-
* @param ruleId
93-
* @return
9463
*/
9564
boolean revokeNetworkACLItem(long ruleId);
9665

9766
/**
9867
* Revoke ACL Items for network and remove them in back-end. Db is not updated
99-
* @param networkId
100-
* @param userId
101-
* @param caller
102-
* @return
103-
* @throws ResourceUnavailableException
10468
*/
10569
boolean revokeACLItemsForNetwork(long networkId) throws ResourceUnavailableException;
10670

10771
/**
10872
* List network ACL items by network
109-
* @param guestNtwkId
110-
* @return
11173
*/
11274
List<NetworkACLItemVO> listNetworkACLItems(long guestNtwkId);
11375

11476
/**
115-
* Applies asscociated ACL to specified network
116-
* @param networkId
117-
* @return
118-
* @throws ResourceUnavailableException
77+
* Applies associated ACL to specified network
11978
*/
12079
boolean applyACLToNetwork(long networkId) throws ResourceUnavailableException;
12180

12281
/**
12382
* Updates and existing network ACL Item
124-
* @param id
125-
* @param protocol
126-
* @param sourceCidrList
127-
* @param trafficType
128-
* @param action
129-
* @param number
130-
* @param sourcePortStart
131-
* @param sourcePortEnd
132-
* @param icmpCode
133-
* @param icmpType
134-
* @param customId TODO
135-
* @param forDisplay TODO
136-
* @return
137-
* @throws ResourceUnavailableException
13883
*/
13984
NetworkACLItem updateNetworkACLItem(NetworkACLItemVO networkACLItemVO) throws ResourceUnavailableException;
14085

14186
/**
142-
* Associates acl with a network and applies the ACLItems
143-
* @param acl
144-
* @param gateway
145-
* @return
87+
* Associates ACL with a network and applies the ACLItems
14688
*/
147-
14889
boolean replaceNetworkACLForPrivateGw(NetworkACL acl, PrivateGateway gateway) throws ResourceUnavailableException;
14990

15091
boolean revokeACLItemsForPrivateGw(PrivateGateway gateway) throws ResourceUnavailableException;

0 commit comments

Comments
 (0)