use of com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig in project cloudstack by apache.
the class NfsSecondaryStorageResource method execute.
private Answer execute(SecStorageFirewallCfgCommand cmd) {
if (!_inSystemVM) {
return new Answer(cmd, true, null);
}
List<String> ipList = new ArrayList<String>();
for (PortConfig pCfg : cmd.getPortConfigs()) {
if (pCfg.isAdd()) {
ipList.add(pCfg.getSourceIp());
}
}
boolean success = true;
String result;
result = configureIpFirewall(ipList, cmd.getIsAppendAIp());
if (result != null) {
success = false;
}
return new Answer(cmd, success, result);
}
use of com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig in project cloudstack by apache.
the class GsonHelper method setDefaultGsonConfig.
static Gson setDefaultGsonConfig(GsonBuilder builder) {
builder.setVersion(1.5);
InterfaceTypeAdaptor<DataStoreTO> dsAdaptor = new InterfaceTypeAdaptor<DataStoreTO>();
builder.registerTypeAdapter(DataStoreTO.class, dsAdaptor);
InterfaceTypeAdaptor<DataTO> dtAdaptor = new InterfaceTypeAdaptor<DataTO>();
builder.registerTypeAdapter(DataTO.class, dtAdaptor);
ArrayTypeAdaptor<Command> cmdAdaptor = new ArrayTypeAdaptor<Command>();
builder.registerTypeAdapter(Command[].class, cmdAdaptor);
ArrayTypeAdaptor<Answer> ansAdaptor = new ArrayTypeAdaptor<Answer>();
builder.registerTypeAdapter(Answer[].class, ansAdaptor);
builder.registerTypeAdapter(new TypeToken<List<PortConfig>>() {
}.getType(), new PortConfigListTypeAdaptor());
builder.registerTypeAdapter(new TypeToken<Pair<Long, Long>>() {
}.getType(), new NwGroupsCommandTypeAdaptor());
Gson gson = builder.create();
dsAdaptor.initGson(gson);
dtAdaptor.initGson(gson);
cmdAdaptor.initGson(gson);
ansAdaptor.initGson(gson);
return gson;
}
Aggregations