2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-30 13:58:15 +00:00

Merge pull request #1240 from pedrokiefer/route53_fix

Add a filter for Route53 API results
This commit is contained in:
Nicholas Spadaccino
2023-09-12 16:26:44 -04:00
committed by GitHub

View File

@@ -106,10 +106,17 @@ class Route53Backend(
* @return A list of record sets matching the name, empty if not found
*/
def resolve(name: String, zoneName: String, typ: RecordType): IO[List[RecordSet]] = {
val fqdn = Fqdn.merge(name, zoneName).fqdn
def filterResourceRecordSet(
rrs: java.util.List[ResourceRecordSet],
rrType: RRType
): java.util.List[ResourceRecordSet] =
rrs.asScala.filter { r =>
r.getName == fqdn && RRType.fromValue(r.getType) == rrType
}.asJava
for {
hostedZoneId <- lookupHostedZone(zoneName)
awsRRType <- OptionT.fromOption[IO](toRoute53RecordType(typ))
fqdn = Fqdn.merge(name, zoneName).fqdn
result <- OptionT.liftF {
r53(
new ListResourceRecordSetsRequest()
@@ -119,7 +126,10 @@ class Route53Backend(
client.listResourceRecordSetsAsync
)
}
} yield toVinylRecordSets(result.getResourceRecordSets, zoneName: String)
} yield toVinylRecordSets(
filterResourceRecordSet(result.getResourceRecordSets, awsRRType),
zoneName: String
)
}.getOrElse(Nil)
/**