mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
Subnets, EFS file systems and mount targets persisted before zone ids took AWS's shape (#5486) still carried the old <region>-az<n> id, so DescribeSubnets reported an id DescribeAvailabilityZones --zone-ids rejects. The id is a function of the zone name and region, so the models now derive it from the stored zone name on read instead of trusting the stored value.
This commit is contained in:
1 parent
3e8369664e
commit
d7911da436
7 files changed
+223
-3
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package io.github.hectorvent.floci.services.ec2.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.github.hectorvent.floci.core.common.AvailabilityZoneIds;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -45,7 +46,18 @@ public class Subnet {
|
||||
public String getAvailabilityZone() { return availabilityZone; }
|
||||
public void setAvailabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; }
|
||||
|
||||
public String getAvailabilityZoneId() { return availabilityZoneId; }
|
||||
/**
|
||||
* Derived from the zone name rather than read back as stored: a subnet persisted before
|
||||
* zone ids took AWS's shape still carries {@code <region>-az<n>}, which
|
||||
* DescribeAvailabilityZones no longer publishes.
|
||||
*/
|
||||
public String getAvailabilityZoneId() {
|
||||
if (region == null || availabilityZone == null) {
|
||||
return availabilityZoneId;
|
||||
}
|
||||
return AvailabilityZoneIds.forZoneName(region, availabilityZone);
|
||||
}
|
||||
|
||||
public void setAvailabilityZoneId(String availabilityZoneId) { this.availabilityZoneId = availabilityZoneId; }
|
||||
|
||||
public int getAvailableIpAddressCount() { return availableIpAddressCount; }
|
||||
|
||||
@@ -2,6 +2,8 @@ package io.github.hectorvent.floci.services.efs.model;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import io.github.hectorvent.floci.core.common.AvailabilityZoneIds;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
import java.util.List;
|
||||
@@ -31,8 +33,16 @@ public class FileSystem {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Derived from the zone name and the region of the file system's ARN rather than read back
|
||||
* as stored: a file system persisted before zone ids took AWS's shape carries the old id.
|
||||
*/
|
||||
public String getAvailabilityZoneId() {
|
||||
return availabilityZoneId;
|
||||
String region = AwsArnUtils.regionOrDefault(fileSystemArn, null);
|
||||
if (region == null || availabilityZoneName == null) {
|
||||
return availabilityZoneId;
|
||||
}
|
||||
return AvailabilityZoneIds.forZoneName(region, availabilityZoneName);
|
||||
}
|
||||
|
||||
public void setAvailabilityZoneId(String availabilityZoneId) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.github.hectorvent.floci.services.efs.model;
|
||||
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import io.github.hectorvent.floci.core.common.AvailabilityZoneIds;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
import java.util.List;
|
||||
@@ -24,8 +25,17 @@ public class MountTarget {
|
||||
private String subnetId;
|
||||
private String vpcId;
|
||||
|
||||
/**
|
||||
* Derived from the zone name, {@code <region><letter>}, rather than read back as stored: a
|
||||
* mount target persisted before zone ids took AWS's shape carries the old id.
|
||||
*/
|
||||
public String getAvailabilityZoneId() {
|
||||
return availabilityZoneId;
|
||||
if (availabilityZoneName == null || availabilityZoneName.length() < 2
|
||||
|| !Character.isLetter(availabilityZoneName.charAt(availabilityZoneName.length() - 1))) {
|
||||
return availabilityZoneId;
|
||||
}
|
||||
String region = availabilityZoneName.substring(0, availabilityZoneName.length() - 1);
|
||||
return AvailabilityZoneIds.forZoneName(region, availabilityZoneName);
|
||||
}
|
||||
|
||||
public void setAvailabilityZoneId(String availabilityZoneId) {
|
||||
|
||||
Reference in new issue
Block a user