package org.zstack.network.service.lb;
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;
/**
* Created by frank on 8/18/2015.
*/
@Action(category = LoadBalancerConstants.ACTION_CATEGORY)
@RestRequest(
path = "/load-balancers/{uuid}/actions",
method = HttpMethod.PUT,
responseClass = APIRefreshLoadBalancerEvent.class,
isAction = true
)
public class APIRefreshLoadBalancerMsg extends APIMessage implements LoadBalancerMessage {
@APIParam(resourceType = LoadBalancerVO.class, checkAccount = true, operationTarget = true)
private String uuid;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public String getLoadBalancerUuid() {
return uuid;
}
public static APIRefreshLoadBalancerMsg __example__() {
APIRefreshLoadBalancerMsg msg = new APIRefreshLoadBalancerMsg();
msg.setUuid(uuid());
return msg;
}
public ApiNotification __notification__() {
APIMessage that = this;
return new ApiNotification() {
@Override
public void after(APIEvent evt) {
if (evt.isSuccess()) {
ntfy("Refreshed").resource(uuid,LoadBalancerVO.class.getSimpleName())
.messageAndEvent(that, evt).done();
}
}
};
}
}