|
16 | 16 | // under the License. |
17 | 17 | package org.apache.cloudstack.api.command.admin.network; |
18 | 18 |
|
19 | | -import org.apache.log4j.Logger; |
20 | | - |
21 | 19 | import org.apache.cloudstack.api.APICommand; |
| 20 | +import org.apache.cloudstack.api.ApiConstants; |
22 | 21 | import org.apache.cloudstack.api.ApiErrorCode; |
| 22 | +import org.apache.cloudstack.api.Parameter; |
23 | 23 | import org.apache.cloudstack.api.ResponseObject.ResponseView; |
24 | 24 | import org.apache.cloudstack.api.ServerApiException; |
25 | 25 | import org.apache.cloudstack.api.command.user.network.UpdateNetworkCmd; |
26 | 26 | import org.apache.cloudstack.api.response.NetworkResponse; |
27 | | -import org.apache.cloudstack.context.CallContext; |
| 27 | +import org.apache.log4j.Logger; |
28 | 28 |
|
29 | 29 | import com.cloud.exception.ConcurrentOperationException; |
30 | 30 | import com.cloud.exception.InsufficientCapacityException; |
31 | 31 | import com.cloud.exception.InvalidParameterValueException; |
32 | 32 | import com.cloud.network.Network; |
33 | | -import com.cloud.user.Account; |
34 | | -import com.cloud.user.User; |
35 | 33 |
|
36 | 34 | @APICommand(name = "updateNetwork", description = "Updates a network", responseObject = NetworkResponse.class, responseView = ResponseView.Full, entityType = {Network.class}, |
37 | 35 | requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) |
38 | 36 | public class UpdateNetworkCmdByAdmin extends UpdateNetworkCmd { |
39 | 37 | public static final Logger s_logger = Logger.getLogger(UpdateNetworkCmdByAdmin.class.getName()); |
40 | 38 |
|
| 39 | + @Parameter(name= ApiConstants.HIDE_IP_ADDRESS_USAGE, type=CommandType.BOOLEAN, description="when true ip address usage for the network will not be exported by the listUsageRecords API") |
| 40 | + private Boolean hideIpAddressUsage; |
| 41 | + |
| 42 | + public Boolean getHideIpAddressUsage() { |
| 43 | + if (hideIpAddressUsage == null) { |
| 44 | + return false; |
| 45 | + } |
| 46 | + return hideIpAddressUsage; |
| 47 | + } |
41 | 48 |
|
42 | 49 | @Override |
43 | 50 | public void execute() throws InsufficientCapacityException, ConcurrentOperationException{ |
44 | | - User callerUser = _accountService.getActiveUser(CallContext.current().getCallingUserId()); |
45 | | - Account callerAccount = _accountService.getActiveAccountById(callerUser.getAccountId()); |
46 | 51 | Network network = _networkService.getNetwork(id); |
47 | 52 | if (network == null) { |
48 | 53 | throw new InvalidParameterValueException("Couldn't find network by id"); |
49 | 54 | } |
50 | 55 |
|
51 | | - Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount, |
52 | | - callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr(), getDisplayNetwork(), getCustomId(), getUpdateInSequence(),getForced()); |
53 | | - |
54 | | - |
| 56 | + Network result = _networkService.updateGuestNetwork(this); |
55 | 57 | if (result != null) { |
56 | 58 | NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Full, result); |
57 | 59 | response.setResponseName(getCommandName()); |
|
0 commit comments