mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(ec2): include network metadata in instance type responses (#2943)
This commit is contained in:
1 parent
30b8f88467
commit
c54b237cd8
6 files changed
+61
-1
No files matched your search
@@ -93,6 +93,10 @@ public class Ec2InstanceTypeCatalog {
|
||||
if (instanceType.supportedArchitectures == null || instanceType.supportedArchitectures.isEmpty()) {
|
||||
throw new IllegalStateException("EC2 instance type catalog entry is missing supportedArchitectures: " + name);
|
||||
}
|
||||
if (instanceType.encryptionInTransitSupported == null) {
|
||||
throw new IllegalStateException(
|
||||
"EC2 instance type catalog entry is missing encryptionInTransitSupported: " + name);
|
||||
}
|
||||
CatalogInstanceType previous = index.putIfAbsent(name, instanceType);
|
||||
if (previous != null) {
|
||||
throw new IllegalStateException("Duplicate EC2 instance type catalog entry: " + name);
|
||||
@@ -123,6 +127,7 @@ public class Ec2InstanceTypeCatalog {
|
||||
public int localStorageGiB;
|
||||
public List<String> supportedArchitectures = List.of();
|
||||
public Boolean currentGeneration;
|
||||
public Boolean encryptionInTransitSupported;
|
||||
|
||||
public Map<String, Object> toResponseMap() {
|
||||
Map<String, Object> type = new LinkedHashMap<>();
|
||||
@@ -133,6 +138,9 @@ public class Ec2InstanceTypeCatalog {
|
||||
type.put("localStorageGiB", localStorageGiB);
|
||||
type.put("supportedArchitectures", List.copyOf(supportedArchitectures));
|
||||
type.put("currentGeneration", currentGeneration == null || currentGeneration);
|
||||
Map<String, Object> networkInfo = new LinkedHashMap<>();
|
||||
networkInfo.put("encryptionInTransitSupported", encryptionInTransitSupported);
|
||||
type.put("networkInfo", networkInfo);
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3370,7 +3370,13 @@ public class Ec2QueryHandler {
|
||||
for (String arch : (List<String>) t.get("supportedArchitectures")) {
|
||||
xml.elem("item", arch);
|
||||
}
|
||||
xml.end("supportedArchitectures").end("processorInfo").end("item");
|
||||
xml.end("supportedArchitectures").end("processorInfo");
|
||||
Map<String, Object> networkInfo = (Map<String, Object>) t.get("networkInfo");
|
||||
xml.start("networkInfo")
|
||||
.elem("encryptionInTransitSupported",
|
||||
String.valueOf(networkInfo.get("encryptionInTransitSupported")))
|
||||
.end("networkInfo")
|
||||
.end("item");
|
||||
}
|
||||
xml.end("instanceTypeSet").end("DescribeInstanceTypesResponse");
|
||||
return xmlResponse(xml.build());
|
||||
|
||||
Reference in new issue
Block a user