Skip to content

Commit d6f44a4

Browse files
author
Alex Huang
committed
merged from master
2 parents fac2270 + e68294d commit d6f44a4

89 files changed

Lines changed: 904 additions & 660 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import com.cloud.network.Network;
3232
import com.cloud.user.UserContext;
3333

34-
@APICommand(description="Creates a private network", responseObject=NetworkResponse.class)
34+
//@APICommand(description="Creates a private network", responseObject=NetworkResponse.class)
3535
public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
3636
public static final Logger s_logger = Logger.getLogger(CreatePrivateNetworkCmd.class.getName());
3737

@@ -153,6 +153,7 @@ public void create() throws ResourceAllocationException {
153153

154154
if (result != null) {
155155
this.setEntityId(result.getId());
156+
this.setEntityUuid(result.getUuid());
156157
} else {
157158
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a Private network");
158159
}
@@ -190,8 +191,4 @@ public String getEventDescription() {
190191

191192
}
192193

193-
@Override
194-
public String getEntityTable() {
195-
return "networks";
196-
}
197194
}

api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import com.cloud.user.Account;
2626
import com.cloud.user.UserContext;
2727

28-
@APICommand(description="Destroys console proxy", responseObject=SuccessResponse.class)
28+
//@APICommand(description="Destroys console proxy", responseObject=SuccessResponse.class)
2929
public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
3030
public static final Logger s_logger = Logger.getLogger(DestroyConsoleProxyCmd.class.getName());
3131

api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
2828
import com.cloud.storage.snapshot.SnapshotSchedule;
2929

30-
@APICommand(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
30+
//@APICommand(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
3131
public class ListRecurringSnapshotScheduleCmd extends BaseListCmd {
3232
private static final String s_name = "listrecurringsnapshotscheduleresponse";
3333

api/src/com/cloud/exception/CloudException.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
// under the License.
1717
package com.cloud.exception;
1818

19-
import com.cloud.utils.IdentityProxy;
2019
import java.util.ArrayList;
2120
import com.cloud.utils.exception.CSExceptionErrorCode;
22-
import com.cloud.utils.AnnotationHelper;
2321

2422
/**
2523
* by the API response serializer. Any exceptions that are thrown by
@@ -56,6 +54,7 @@ public void addProxyObject(String uuid) {
5654
return;
5755
}
5856

57+
5958
public ArrayList<String> getIdProxyList() {
6059
return idList;
6160
}

api/src/org/apache/cloudstack/acl/APIAccessChecker.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@
1616
// under the License.
1717
package org.apache.cloudstack.acl;
1818

19-
import java.util.Properties;
20-
19+
import org.apache.cloudstack.acl.RoleType;
2120
import com.cloud.exception.PermissionDeniedException;
22-
import com.cloud.user.Account;
23-
import com.cloud.user.User;
2421
import com.cloud.utils.component.Adapter;
2522

2623
/**
2724
* APIAccessChecker checks the ownership and access control to API requests
2825
*/
2926
public interface APIAccessChecker extends Adapter {
3027
// Interface for checking access to an API for an user
31-
boolean canAccessAPI(User user, String apiCommandName) throws PermissionDeniedException;
28+
boolean canAccessAPI(RoleType roleType, String apiCommandName) throws PermissionDeniedException;
3229
}

api/src/org/apache/cloudstack/api/BaseAsyncCreateCmd.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
2525
@Parameter(name = "id", type = CommandType.LONG)
2626
private Long id;
2727

28+
private String uuid;
29+
2830
public abstract void create() throws ResourceAllocationException;
2931

3032
public Long getEntityId() {
@@ -35,14 +37,19 @@ public void setEntityId(Long id) {
3537
this.id = id;
3638
}
3739

38-
public abstract String getEntityTable();
40+
public String getEntityUuid() {
41+
return uuid;
42+
}
43+
44+
public void setEntityUuid(String uuid) {
45+
this.uuid = uuid;
46+
}
3947

40-
public String getResponse(long jobId, long objectId, String objectEntityTable) {
48+
public String getResponse(long jobId, String objectUuid) {
4149
CreateCmdResponse response = new CreateCmdResponse();
4250
AsyncJob job = _entityMgr.findById(AsyncJob.class, jobId);
4351
response.setJobId(job.getUuid());
44-
response.setId(objectId);
45-
response.setIdEntityTable(objectEntityTable);
52+
response.setId(objectUuid);
4653
response.setResponseName(getCommandName());
4754
return _responseGenerator.toSerializedString(response, getResponseType());
4855
}

api/src/org/apache/cloudstack/api/BaseResponse.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.apache.cloudstack.api;
1818

1919
import org.apache.cloudstack.api.ApiConstants;
20-
import com.cloud.utils.IdentityProxy;
2120
import org.apache.cloudstack.api.ResponseObject;
2221
import com.cloud.serializer.Param;
2322
import com.google.gson.annotations.SerializedName;
@@ -46,6 +45,7 @@ public void setObjectName(String objectName) {
4645
this.objectName = objectName;
4746
}
4847

48+
@Override
4949
public String getObjectId() {
5050
return null;
5151
}
@@ -56,18 +56,22 @@ public String getObjectId() {
5656
@SerializedName(ApiConstants.JOB_STATUS) @Param(description="the current status of the latest async job acting on this object")
5757
private Integer jobStatus;
5858

59+
@Override
5960
public String getJobId() {
6061
return jobId;
6162
}
6263

64+
@Override
6365
public void setJobId(String jobId) {
6466
this.jobId = jobId;
6567
}
6668

69+
@Override
6770
public Integer getJobStatus() {
6871
return jobStatus;
6972
}
7073

74+
@Override
7175
public void setJobStatus(Integer jobStatus) {
7276
this.jobStatus = jobStatus;
7377
}

api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public void create() {
8181

8282
if (ctr != null) {
8383
this.setEntityId(ctr.getId());
84+
this.setEntityUuid(ctr.getUuid());
8485
CounterResponse response = _responseGenerator.createCounterResponse(ctr);
8586
response.setResponseName(getCommandName());
8687
this.setResponseObject(response);
@@ -113,8 +114,5 @@ public long getEntityOwnerId() {
113114
return Account.ACCOUNT_ID_SYSTEM;
114115
}
115116

116-
@Override
117-
public String getEntityTable() {
118-
return "counter";
119-
}
117+
120118
}

api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
5959
@Parameter(name=ApiConstants.SERVICE_LIST, type=CommandType.LIST, collectionType = CommandType.STRING, description="the list of services to be enabled for this physical network service provider")
6060
private List<String> enabledServices;
6161

62-
@Override
63-
public String getEntityTable() {
64-
return "physical_network_service_providers";
65-
}
6662

6763
/////////////////////////////////////////////////////
6864
/////////////////// Accessors ///////////////////////
@@ -116,6 +112,7 @@ public void create() throws ResourceAllocationException {
116112
PhysicalNetworkServiceProvider result = _networkService.addProviderToPhysicalNetwork(getPhysicalNetworkId(), getProviderName(), getDestinationPhysicalNetworkId(), getEnabledServices());
117113
if (result != null) {
118114
setEntityId(result.getId());
115+
setEntityUuid(result.getUuid());
119116
} else {
120117
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
121118
}

api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ public List<String> getTags() {
7979
return tags;
8080
}
8181

82-
@Override
83-
public String getEntityTable() {
84-
return "physical_network";
85-
}
8682

8783
public Long getZoneId() {
8884
return zoneId;
@@ -164,6 +160,7 @@ public void create() throws ResourceAllocationException {
164160
PhysicalNetwork result = _networkService.createPhysicalNetwork(getZoneId(),getVlan(),getNetworkSpeed(), getIsolationMethods(),getBroadcastDomainRange(),getDomainId(), getTags(), getNetworkName());
165161
if (result != null) {
166162
setEntityId(result.getId());
163+
setEntityUuid(result.getUuid());
167164
} else {
168165
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity");
169166
}

0 commit comments

Comments
 (0)