mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(ec2): add missing subnet attributes and instance block device attachTime (#1087)
ModifySubnetAttribute only handled MapPublicIpOnLaunch; the other three AWS-defined attributes — AssignIpv6AddressOnCreation, EnableDns64, and MapCustomerOwnedIpOnLaunch — were silently ignored. Added them to the handler loop and to the Subnet model, and included them in the DescribeSubnets XML response alongside an empty ipv6CidrBlockAssociationSet element that AWS always returns. DescribeInstances was missing attachTime on blockDeviceMapping/ebs, causing SDK response shape validation to fail for callers that inspect that field.
This commit is contained in:
1 parent
bd6ec2d5c6
commit
b74b02da4f
5 files changed
+82
-7
No files matched your search
@@ -607,9 +607,17 @@ public class Ec2QueryHandler {
|
||||
|
||||
private Response handleModifySubnetAttribute(MultivaluedMap<String, String> p, String region) {
|
||||
String subnetId = p.getFirst("SubnetId");
|
||||
String val = p.getFirst("MapPublicIpOnLaunch.Value");
|
||||
if (val != null) {
|
||||
service.modifySubnetAttribute(region, subnetId, "mapPublicIpOnLaunch", val);
|
||||
for (String attr : List.of(
|
||||
"MapPublicIpOnLaunch",
|
||||
"AssignIpv6AddressOnCreation",
|
||||
"EnableDns64",
|
||||
"MapCustomerOwnedIpOnLaunch")) {
|
||||
String val = p.getFirst(attr + ".Value");
|
||||
if (val != null) {
|
||||
String camel = Character.toLowerCase(attr.charAt(0)) + attr.substring(1);
|
||||
service.modifySubnetAttribute(region, subnetId, camel, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return booleanResponse("ModifySubnetAttribute");
|
||||
}
|
||||
@@ -1333,6 +1341,7 @@ public class Ec2QueryHandler {
|
||||
.elem("volumeId", inst.getRootVolumeId())
|
||||
.elem("status", "attached")
|
||||
.elem("deleteOnTermination", "true")
|
||||
.elem("attachTime", inst.getLaunchTime() != null ? ISO_FMT.format(inst.getLaunchTime()) : "")
|
||||
.end("ebs")
|
||||
.end("item")
|
||||
.end("blockDeviceMapping");
|
||||
@@ -1375,6 +1384,10 @@ public class Ec2QueryHandler {
|
||||
.elem("availabilityZoneId", s.getAvailabilityZoneId())
|
||||
.elem("defaultForAz", String.valueOf(s.isDefaultForAz()))
|
||||
.elem("mapPublicIpOnLaunch", String.valueOf(s.isMapPublicIpOnLaunch()))
|
||||
.elem("assignIpv6AddressOnCreation", String.valueOf(s.isAssignIpv6AddressOnCreation()))
|
||||
.elem("enableDns64", String.valueOf(s.isEnableDns64()))
|
||||
.elem("mapCustomerOwnedIpOnLaunch", String.valueOf(s.isMapCustomerOwnedIpOnLaunch()))
|
||||
.start("ipv6CidrBlockAssociationSet").end("ipv6CidrBlockAssociationSet")
|
||||
.elem("ownerId", s.getOwnerId())
|
||||
.raw(tagSetXml(s.getTags()));
|
||||
return xml.build();
|
||||
|
||||
@@ -650,9 +650,11 @@ public class Ec2Service {
|
||||
public void modifySubnetAttribute(String region, String subnetId, String attribute, String value) {
|
||||
ensureDefaultResources(region);
|
||||
Subnet subnet = getRequiredSubnet(region, subnetId);
|
||||
|
||||
if ("mapPublicIpOnLaunch".equals(attribute)) {
|
||||
subnet.setMapPublicIpOnLaunch(Boolean.parseBoolean(value));
|
||||
switch (attribute) {
|
||||
case "mapPublicIpOnLaunch" -> subnet.setMapPublicIpOnLaunch(Boolean.parseBoolean(value));
|
||||
case "assignIpv6AddressOnCreation" -> subnet.setAssignIpv6AddressOnCreation(Boolean.parseBoolean(value));
|
||||
case "enableDns64" -> subnet.setEnableDns64(Boolean.parseBoolean(value));
|
||||
case "mapCustomerOwnedIpOnLaunch" -> subnet.setMapCustomerOwnedIpOnLaunch(Boolean.parseBoolean(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ public class Subnet {
|
||||
private int availableIpAddressCount;
|
||||
private boolean defaultForAz;
|
||||
private boolean mapPublicIpOnLaunch;
|
||||
private boolean assignIpv6AddressOnCreation = false;
|
||||
private boolean enableDns64 = false;
|
||||
private boolean mapCustomerOwnedIpOnLaunch = false;
|
||||
private String ownerId;
|
||||
private String region;
|
||||
private String subnetArn;
|
||||
@@ -53,6 +56,15 @@ public class Subnet {
|
||||
public boolean isMapPublicIpOnLaunch() { return mapPublicIpOnLaunch; }
|
||||
public void setMapPublicIpOnLaunch(boolean mapPublicIpOnLaunch) { this.mapPublicIpOnLaunch = mapPublicIpOnLaunch; }
|
||||
|
||||
public boolean isAssignIpv6AddressOnCreation() { return assignIpv6AddressOnCreation; }
|
||||
public void setAssignIpv6AddressOnCreation(boolean assignIpv6AddressOnCreation) { this.assignIpv6AddressOnCreation = assignIpv6AddressOnCreation; }
|
||||
|
||||
public boolean isEnableDns64() { return enableDns64; }
|
||||
public void setEnableDns64(boolean enableDns64) { this.enableDns64 = enableDns64; }
|
||||
|
||||
public boolean isMapCustomerOwnedIpOnLaunch() { return mapCustomerOwnedIpOnLaunch; }
|
||||
public void setMapCustomerOwnedIpOnLaunch(boolean mapCustomerOwnedIpOnLaunch) { this.mapCustomerOwnedIpOnLaunch = mapCustomerOwnedIpOnLaunch; }
|
||||
|
||||
public String getOwnerId() { return ownerId; }
|
||||
public void setOwnerId(String ownerId) { this.ownerId = ownerId; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user