package org.zstack.header.identity;
import org.springframework.http.HttpMethod;
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;
@Action(category = AccountConstant.ACTION_CATEGORY, accountOnly = true)
@RestRequest(
path = "/accounts/{uuid}",
method = HttpMethod.PUT,
isAction = true,
responseClass = APIUpdateAccountEvent.class
)
public class APIUpdateAccountMsg extends APIMessage implements AccountMessage {
@APIParam(resourceType = AccountVO.class, required = false, checkAccount = true, operationTarget = true)
private String uuid;
@APIParam(maxLength = 255, required = false)
private String password;
@APIParam(maxLength = 255, required = false)
private String name;
@APIParam(maxLength = 2048, required = false)
private String description;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String getAccountUuid() {
return this.getSession().getAccountUuid();
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public static APIUpdateAccountMsg __example__() {
APIUpdateAccountMsg msg = new APIUpdateAccountMsg();
msg.setUuid(uuid());
msg.setName("updatename");
msg.setPassword("updatepassword");
return msg;
}
public ApiNotification __notification__() {
APIMessage that = this;
return new ApiNotification() {
@Override
public void after(APIEvent evt) {
ntfy("Updating").resource(uuid, AccountVO.class.getSimpleName())
.messageAndEvent(that, evt).done();
}
};
}
}