package org.zstack.header.identity; import org.springframework.http.HttpMethod; import org.zstack.header.message.APICreateMessage; 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; @RestRequest( path = "/accounts", method = HttpMethod.POST, parameterName = "params", responseClass = APICreateAccountEvent.class ) public class APICreateAccountMsg extends APICreateMessage { @APIParam(maxLength = 255) private String name; @APIParam(maxLength = 255) private String password; @APIParam(validValues = {"SystemAdmin", "Normal"}, required = false) private String type; @APIParam(maxLength = 2048, required = false) private String description; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public static APICreateAccountMsg __example__() { APICreateAccountMsg msg = new APICreateAccountMsg(); msg.setName("test"); msg.setPassword("password"); return msg; } public ApiNotification __notification__() { APIMessage that = this; return new ApiNotification() { @Override public void after(APIEvent evt) { if (evt.isSuccess()) { ntfy("Creating").resource(((APICreateAccountEvent) evt).getInventory().getUuid(), AccountVO.class.getSimpleName()) .messageAndEvent(that, evt).done(); } } }; } }