route53/xml_parsers/list_resource_record_sets_by_zone_id.py
def parse_rrset(e_rrset, connection, zone_id):
    """
    This a parser that allows the passing of any valid ResourceRecordSet
    tag. It will spit out the appropriate ResourceRecordSet object for the tag.

    :param lxml.etree._Element e_rrset: The root node of the etree parsed
        response from the API.
    :param Route53Connection connection: The connection instance used to
        query the API.
    :param str zone_id: The zone ID of the HostedZone these rrsets belong to.
    :rtype: ResourceRecordSet
    :returns: An instantiated ResourceRecordSet object.
    """

    # This dict will be used to instantiate a ResourceRecordSet instance to yield.
    kwargs = {
        'connection': connection,
        'zone_id': zone_id,
    }
    rrset_type = None

    for e_field in e_rrset:
        # Cheesy way to strip off the namespace.
        tag_name = e_field.tag.split('}')[1]
        field_text = e_field.text

        if tag_name == 'Type':
            # Need to store this to determine which ResourceRecordSet
            # subclass to instantiate.
            rrset_type = field_text
            continue
        elif tag_name == 'AliasTarget':
            # A records have some special field values we need.
            alias_hosted_zone_id, alias_dns_name = parse_rrset_alias(e_field)
            kwargs['alias_hosted_zone_id'] = alias_hosted_zone_id
            kwargs['alias_dns_name'] = alias_dns_name
            # Alias A entries have no TTL.
            kwargs['ttl'] = None
            continue
        elif tag_name == 'ResourceRecords':
            kwargs['records'] = parse_rrset_record_values(e_field)
            continue

        # Map the XML tag name to a kwarg name.
        kw_name = RRSET_TAG_TO_KWARG_MAP[tag_name]
        # This will be the key/val pair used to instantiate the
        # ResourceRecordSet instance.
        kwargs[kw_name] = field_text

    if not rrset_type:
        raise Route53Error("No Type tag found in ListResourceRecordSetsResponse.")

    if 'records' not in kwargs:
        # Not all rrsets have records.
        kwargs['records'] = []

    RRSetSubclass = RRSET_TYPE_TO_RSET_SUBCLASS_MAP[rrset_type]
    return RRSetSubclass(**kwargs)
def parse_rrset(e_rrset, connection, zone_id):
    # This dict will be used to instantiate a ResourceRecordSet instance to yield.
    kwargs = {
        'connection': connection,
        'zone_id': zone_id,
    }
    rrset_type = None

    for e_field in e_rrset:
        # Cheesy way to strip off the namespace.
        tag_name = e_field.tag.split('}')[1]
        field_text = e_field.text

        if tag_name == 'Type':
            # Need to store this to determine which ResourceRecordSet
            # subclass to instantiate.
            rrset_type = field_text
            continue
        elif tag_name == 'AliasTarget':
            # A records have some special field values we need.
            alias_hosted_zone_id, alias_dns_name = parse_rrset_alias(e_field)
            kwargs['alias_hosted_zone_id'] = alias_hosted_zone_id
            kwargs['alias_dns_name'] = alias_dns_name
            # Alias A entries have no TTL.
            kwargs['ttl'] = None
            continue
        elif tag_name == 'ResourceRecords':
            kwargs['records'] = parse_rrset_record_values(e_field)
            continue

        # Map the XML tag name to a kwarg name.
        kw_name = RRSET_TAG_TO_KWARG_MAP[tag_name]
        # This will be the key/val pair used to instantiate the
        # ResourceRecordSet instance.
        kwargs[kw_name] = field_text

    if not rrset_type:
        raise Route53Error("No Type tag found in ListResourceRecordSetsResponse.")

    if 'records' not in kwargs:
        # Not all rrsets have records.
        kwargs['records'] = []

    RRSetSubclass = RRSET_TYPE_TO_RSET_SUBCLASS_MAP[rrset_type]
    return RRSetSubclass(**kwargs)
def parse_rrset ( e_rrset , connection , zone_id ) : # This dict will be used to instantiate a ResourceRecordSet instance to yield. kwargs = { 'connection' : connection , 'zone_id' : zone_id , } rrset_type = None for e_field in e_rrset : # Cheesy way to strip off the namespace. tag_name = e_field . tag . split ( '}' ) [ 1 ] field_text = e_field . text if tag_name == 'Type' : # Need to store this to determine which ResourceRecordSet # subclass to instantiate. rrset_type = field_text continue elif tag_name == 'AliasTarget' : # A records have some special field values we need. alias_hosted_zone_id , alias_dns_name = parse_rrset_alias ( e_field ) kwargs [ 'alias_hosted_zone_id' ] = alias_hosted_zone_id kwargs [ 'alias_dns_name' ] = alias_dns_name # Alias A entries have no TTL. kwargs [ 'ttl' ] = None continue elif tag_name == 'ResourceRecords' : kwargs [ 'records' ] = parse_rrset_record_values ( e_field ) continue # Map the XML tag name to a kwarg name. kw_name = RRSET_TAG_TO_KWARG_MAP [ tag_name ] # This will be the key/val pair used to instantiate the # ResourceRecordSet instance. kwargs [ kw_name ] = field_text if not rrset_type : raise Route53Error ( "No Type tag found in ListResourceRecordSetsResponse." ) if 'records' not in kwargs : # Not all rrsets have records. kwargs [ 'records' ] = [ ] RRSetSubclass = RRSET_TYPE_TO_RSET_SUBCLASS_MAP [ rrset_type ] return RRSetSubclass ( * * kwargs )
This a parser that allows the passing of any valid ResourceRecordSet
    tag. It will spit out the appropriate ResourceRecordSet object for the tag.

    :param lxml.etree._Element e_rrset: The root node of the etree parsed
        response from the API.
    :param Route53Connection connection: The connection instance used to
        query the API.
    :param str zone_id: The zone ID of the HostedZone these rrsets belong to.
    :rtype: ResourceRecordSet
    :returns: An instantiated ResourceRecordSet object.
This a parser that allows the passing of any valid ResourceRecordSet tag . It will spit out the appropriate ResourceRecordSet object for the tag .