package org.zstack.header.vm;
import org.springframework.http.HttpMethod;
import org.zstack.header.identity.Action;
import org.zstack.header.message.APIDeleteMessage;
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;
/**
* Created by frank on 2/26/2016.
*/
@Action(category = VmInstanceConstant.ACTION_CATEGORY)
@RestRequest(
path = "/vm-instances/{uuid}/hostnames",
method = HttpMethod.DELETE,
responseClass = APIDeleteVmHostnameEvent.class
)
public class APIDeleteVmHostnameMsg extends APIDeleteMessage implements VmInstanceMessage {
@APIParam(resourceType = VmInstanceVO.class, checkAccount = true, operationTarget = true)
private String uuid;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public String getVmInstanceUuid() {
return getUuid();
}
public static APIDeleteVmHostnameMsg __example__() {
APIDeleteVmHostnameMsg msg = new APIDeleteVmHostnameMsg();
msg.uuid = uuid();
return msg;
}
public ApiNotification __notification__() {
APIMessage that = this;
return new ApiNotification() {
@Override
public void after(APIEvent evt) {
if (evt.isSuccess()) {
ntfy("Host name deleted").resource(uuid, VmInstanceVO.class.getSimpleName())
.messageAndEvent(that, evt).done();
}
}
};
}
}