def created_hosted_zone_parser(root, connection): """ Parses the API responses for the :py:meth:`route53.connection.Route53Connection.create_hosted_zone` method. :param lxml.etree._Element root: The root node of the etree parsed response from the API. :param Route53Connection connection: The connection instance used to query the API. :rtype: HostedZone :returns: The newly created HostedZone. """ zone = root.find('./{*}HostedZone') # This pops out a HostedZone instance. hosted_zone = parse_hosted_zone(zone, connection) # Now we'll fill in the nameservers. e_delegation_set = root.find('./{*}DelegationSet') # Modifies the HostedZone in place. parse_delegation_set(hosted_zone, e_delegation_set) # With each CreateHostedZone request, there's some details about the # request's ID, status, and submission time. We'll return this in a tuple # just for the sake of completeness. e_change_info = root.find('./{*}ChangeInfo') # Translate the ChangeInfo values to a dict. change_info = parse_change_info(e_change_info) return hosted_zone, change_info
def list_hosted_zones_parser(root, connection): """ Parses the API responses for the :py:meth:`route53.connection.Route53Connection.list_hosted_zones` method. :param lxml.etree._Element root: The root node of the etree parsed response from the API. :param Route53Connection connection: The connection instance used to query the API. :rtype: HostedZone :returns: A generator of fully formed HostedZone instances. """ # The rest of the list pagination tags are handled higher up in the stack. # We'll just worry about the HostedZones tag, which has HostedZone tags # nested beneath it. zones = root.find('./{*}HostedZones') for zone in zones: yield parse_hosted_zone(zone, connection)
def get_hosted_zone_by_id_parser(root, connection): """ Parses the API responses for the :py:meth:`route53.connection.Route53Connection.get_hosted_zone_by_id` method. :param lxml.etree._Element root: The root node of the etree parsed response from the API. :param Route53Connection connection: The connection instance used to query the API. :rtype: HostedZone :returns: The requested HostedZone. """ e_zone = root.find('./{*}HostedZone') # This pops out a HostedZone instance. hosted_zone = parse_hosted_zone(e_zone, connection) # Now we'll fill in the nameservers. e_delegation_set = root.find('./{*}DelegationSet') # Modifies the HostedZone in place. parse_delegation_set(hosted_zone, e_delegation_set) return hosted_zone