mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-31 06:15:49 +00:00
Merge pull request #1240 from pedrokiefer/route53_fix
Add a filter for Route53 API results
This commit is contained in:
@@ -106,10 +106,17 @@ class Route53Backend(
|
|||||||
* @return A list of record sets matching the name, empty if not found
|
* @return A list of record sets matching the name, empty if not found
|
||||||
*/
|
*/
|
||||||
def resolve(name: String, zoneName: String, typ: RecordType): IO[List[RecordSet]] = {
|
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 {
|
for {
|
||||||
hostedZoneId <- lookupHostedZone(zoneName)
|
hostedZoneId <- lookupHostedZone(zoneName)
|
||||||
awsRRType <- OptionT.fromOption[IO](toRoute53RecordType(typ))
|
awsRRType <- OptionT.fromOption[IO](toRoute53RecordType(typ))
|
||||||
fqdn = Fqdn.merge(name, zoneName).fqdn
|
|
||||||
result <- OptionT.liftF {
|
result <- OptionT.liftF {
|
||||||
r53(
|
r53(
|
||||||
new ListResourceRecordSetsRequest()
|
new ListResourceRecordSetsRequest()
|
||||||
@@ -119,7 +126,10 @@ class Route53Backend(
|
|||||||
client.listResourceRecordSetsAsync
|
client.listResourceRecordSetsAsync
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} yield toVinylRecordSets(result.getResourceRecordSets, zoneName: String)
|
} yield toVinylRecordSets(
|
||||||
|
filterResourceRecordSet(result.getResourceRecordSets, awsRRType),
|
||||||
|
zoneName: String
|
||||||
|
)
|
||||||
}.getOrElse(Nil)
|
}.getOrElse(Nil)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user