public static APIAddBackupStorageEvent __example__() { APIAddBackupStorageEvent event = new APIAddBackupStorageEvent(); BackupStorageInventory bs = new BackupStorageInventory(); bs.setName("My Backup Storage"); bs.setDescription("Public Backup Storage"); bs.setCreateDate(new Timestamp(org.zstack.header.message.DocUtils.date)); bs.setLastOpDate(new Timestamp(org.zstack.header.message.DocUtils.date)); bs.setType("Ceph"); bs.setState(BackupStorageState.Enabled.toString()); bs.setStatus(BackupStorageStatus.Connected.toString()); bs.setAvailableCapacity(924L * 1024L * 1024L); bs.setTotalCapacity(1024L * 1024L * 1024L); bs.setAttachedZoneUuids(Collections.singletonList(uuid())); event.setInventory(bs); return event; }
public Result audit(APIMessage msg, APIEvent rsp) { String resUuid = ""; if (rsp.isSuccess()) { APIAddBackupStorageEvent evt = (APIAddBackupStorageEvent) rsp; resUuid = evt.getInventory().getUuid(); } return new Result(resUuid, BackupStorageVO.class); } }
@Override public void run(MessageReply reply) { if (reply.isSuccess()) { evt.setInventory(factory.reload(inv.getUuid())); bus.publish(evt); CollectionUtils.safeForEach(pluginRgty.getExtensionList(AddBackupStorageExtensionPoint.class), new ForEachFunction<AddBackupStorageExtensionPoint>() { @Override public void run(AddBackupStorageExtensionPoint ext) { ext.afterAddBackupStorage(addBackupStoragestruct); } }); } else { dbf.removeByPrimaryKey(inv.getUuid(), BackupStorageVO.class); evt.setError(err(SysErrors.CREATE_RESOURCE_ERROR, reply.getError(), reply.getError().getDetails())); bus.publish(evt); } } });
final APIAddBackupStorageEvent evt = new APIAddBackupStorageEvent(msg.getId()); ConnectBackupStorageMsg cmsg = new ConnectBackupStorageMsg(); cmsg.setNewAdd(true);
@Override public void after(APIEvent evt) { if (evt.isSuccess()) { ntfy("Created").resource(((APIAddBackupStorageEvent)evt).getInventory().getUuid(), BackupStorageVO.class.getSimpleName()) .messageAndEvent(that, evt).done(); } } };
@Override public void after(APIEvent evt) { if (evt.isSuccess()) { ntfy("Added").resource(((APIAddBackupStorageEvent)evt).getInventory().getUuid(), BackupStorageVO.class.getSimpleName()) .messageAndEvent(that, evt).done(); } } };