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.

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

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?