mirror of https://github.com/apache/jclouds.git
openstack: removing unnecessary type adapter (taken care of by empty json object change in jclouds-core)
This commit is contained in:
parent
3243325878
commit
9a68d6b115
|
@ -58,8 +58,7 @@ public class NovaParserModule extends AbstractModule {
|
||||||
return ImmutableMap.<Type, Object>of(
|
return ImmutableMap.<Type, Object>of(
|
||||||
HostResourceUsage.class, new HostResourceUsageAdapter(),
|
HostResourceUsage.class, new HostResourceUsageAdapter(),
|
||||||
ServerWithSecurityGroups.class, new ServerWithSecurityGroupsAdapter(),
|
ServerWithSecurityGroups.class, new ServerWithSecurityGroupsAdapter(),
|
||||||
Server.class, new ServerAdapter(),
|
Server.class, new ServerAdapter()
|
||||||
SecurityGroupRule.class, new SecurityGroupRuleAdapter()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,35 +152,4 @@ public class NovaParserModule extends AbstractModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* trying to cope with group { } to signify no group! */
|
|
||||||
@Singleton
|
|
||||||
public static class SecurityGroupRuleAdapter implements JsonDeserializer<SecurityGroupRule> {
|
|
||||||
@Override
|
|
||||||
public SecurityGroupRule deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
|
|
||||||
throws JsonParseException {
|
|
||||||
SecurityGroupRule ruleBase = apply((SecurityGroupRuleInternal) context.deserialize(jsonElement, SecurityGroupRuleInternal.class));
|
|
||||||
if (jsonElement.getAsJsonObject().has("group")) {
|
|
||||||
try {
|
|
||||||
TenantIdAndName group = context.deserialize(jsonElement.getAsJsonObject().getAsJsonObject("group"), TenantIdAndName.class);
|
|
||||||
ruleBase = ruleBase.toBuilder().group(group).build();
|
|
||||||
} catch (NullPointerException ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ruleBase;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SecurityGroupRule apply(SecurityGroupRuleInternal in) {
|
|
||||||
return in.toBuilder().build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class SecurityGroupRuleInternal extends SecurityGroupRule {
|
|
||||||
@ConstructorProperties({
|
|
||||||
"ip_protocol", "from_port", "to_port", "id", "parent_group_id", "ip_range"
|
|
||||||
})
|
|
||||||
protected SecurityGroupRuleInternal(IpProtocol ipProtocol, int fromPort, int toPort, String id, String parentGroupId, @Nullable Cidr ipRange) {
|
|
||||||
super(ipProtocol, fromPort, toPort, id, null, parentGroupId, ipRange);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue