package org.zstack.header.vm;
import org.springframework.http.HttpMethod;
import org.zstack.header.identity.Action;
import org.zstack.header.message.APIEvent;
import org.zstack.header.message.APIMessage;
import org.zstack.header.message.APIParam;
import org.zstack.header.notification.ApiNotification;
import org.zstack.header.rest.RestRequest;
import org.zstack.header.rest.RestResponse;
/**
* Created by frank on 11/12/2015.
*/
@Action(category = VmInstanceConstant.ACTION_CATEGORY)
@RestRequest(
path = "/vm-instances/{uuid}/actions",
isAction = true,
responseClass = APIExpungeVmInstanceEvent.class,
method = HttpMethod.PUT
)
public class APIExpungeVmInstanceMsg extends APIMessage implements VmInstanceMessage {
@APIParam(resourceType = VmInstanceVO.class)
private String uuid;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public String getVmInstanceUuid() {
return uuid;
}
public static APIExpungeVmInstanceMsg __example__() {
APIExpungeVmInstanceMsg msg = new APIExpungeVmInstanceMsg();
msg.setUuid(uuid());
return msg;
}
public ApiNotification __notification__() {
APIMessage that = this;
return new ApiNotification() {
@Override
public void after(APIEvent evt) {
if (evt.isSuccess())
ntfy("Expunged").resource(uuid, VmInstanceVO.class.getSimpleName())
.messageAndEvent(that, evt).done();
}
};
}
}