dongshi3818 2019-05-01 22:26
浏览 62
已采纳

Route53:按RecordType过滤ListResourceRecordSets

I can't get aws route53 service's ListResourceRecordSets to filter by StartRecord Type. Even with the StartRecordType filter, it returns all records (cname and A) instead of the type I select.

I also noticed I would get a validation error if StartRecordName was not included, so it seems if StartRecordType is used, then StartRecordName is required.

The code below returns all records, but does not filter as it should.

    AWSLogin(instance)

    svc := route53.New(instance.AWSSession)

    listParams := &route53.ListResourceRecordSetsInput{
        HostedZoneId: aws.String("Z2798GPJN9CUFJ"), // Required
        StartRecordName: aws.String("subdomain.subdomain.mydomain.com"),
        StartRecordType: aws.String(route53.RRTypeA),
    //  StartRecordType: aws.String(route53.RRTypeCname),
    }
    respList, err := svc.ListResourceRecordSets(listParams)

    if err != nil {
        fmt.Println(err.Error())
        return
    }

    fmt.Println("All Type "A" records:")
    fmt.Println(respList)
  • 写回答

1条回答 默认 最新

  • dpi74187 2019-05-02 18:04
    关注

    I think you've misunderstood what StartRecordName and StartRecordType do. They do not filter the list, only specify where the list begins.

    From the Service Documentation:

    If you specify both Name and Type: The results begin with the first resource record set in the list whose name is greater than or equal to Name, and whose type is greater than or equal to Type.

    So from your example I would expect all your records to be returned (up to a limit of 100), but the first record will be the A record for subdomain.subdomain.mydomain.com.

    It will then proceed (and wrap) in alphabetical order by name/type.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?