mirror of https://github.com/apache/cloudstack.git
bug 11899: Added events for Zone create, update and delete
status 11899: resolved fixed reviewed-by: Nitin
This commit is contained in:
parent
e4d94650ea
commit
f3cd93f835
|
|
@ -29,6 +29,7 @@ import com.cloud.api.ServerApiException;
|
|||
import com.cloud.api.response.ZoneResponse;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@Implementation(description="Creates a Zone.", responseObject=ZoneResponse.class)
|
||||
public class CreateZoneCmd extends BaseCmd {
|
||||
|
|
@ -140,7 +141,8 @@ public class CreateZoneCmd extends BaseCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
DataCenter result = _configService.createZone(this);
|
||||
UserContext.current().setEventDetails("Zone Name: "+getZoneName());
|
||||
DataCenter result = _configService.createZone(this);
|
||||
if (result != null){
|
||||
ZoneResponse response = _responseGenerator.createZoneResponse(result,false);
|
||||
response.setResponseName(getCommandName());
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.cloud.api.Parameter;
|
|||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SuccessResponse;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@Implementation(description="Deletes a Zone.", responseObject=SuccessResponse.class)
|
||||
public class DeleteZoneCmd extends BaseCmd {
|
||||
|
|
@ -69,7 +70,8 @@ public class DeleteZoneCmd extends BaseCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
boolean result = _configService.deleteZone(this);
|
||||
UserContext.current().setEventDetails("Zone Id: "+getId());
|
||||
boolean result = _configService.deleteZone(this);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import com.cloud.api.ServerApiException;
|
|||
import com.cloud.api.response.ZoneResponse;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.UserContext;
|
||||
|
||||
@Implementation(description="Updates a Zone.", responseObject=ZoneResponse.class)
|
||||
public class UpdateZoneCmd extends BaseCmd {
|
||||
|
|
@ -154,7 +155,8 @@ public class UpdateZoneCmd extends BaseCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
DataCenter result = _configService.editZone(this);
|
||||
UserContext.current().setEventDetails("Zone Id: "+getId());
|
||||
DataCenter result = _configService.editZone(this);
|
||||
if (result != null) {
|
||||
ZoneResponse response = _responseGenerator.createZoneResponse(result, false);
|
||||
response.setResponseName(getCommandName());
|
||||
|
|
|
|||
|
|
@ -1151,6 +1151,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
|
||||
@Override
|
||||
@DB
|
||||
@ActionEvent(eventType = EventTypes.EVENT_ZONE_DELETE, eventDescription = "deleting zone", async = false)
|
||||
public boolean deleteZone(DeleteZoneCmd cmd) {
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
|
|
@ -1269,6 +1270,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
|
||||
@Override
|
||||
@DB
|
||||
@ActionEvent(eventType = EventTypes.EVENT_ZONE_EDIT, eventDescription = "editing zone", async = false)
|
||||
public DataCenter editZone(UpdateZoneCmd cmd) {
|
||||
// Parameter validation as from execute() method in V1
|
||||
Long zoneId = cmd.getId();
|
||||
|
|
@ -1543,6 +1545,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_ZONE_CREATE, eventDescription = "creating zone", async = false)
|
||||
public DataCenter createZone(CreateZoneCmd cmd) {
|
||||
// grab parameters from the command
|
||||
Long userId = UserContext.current().getCallerUserId();
|
||||
|
|
|
|||
Loading…
Reference in New Issue