def to_do_bucket_meta_query_request()

in oss2/xml_utils.py [0:0]


def to_do_bucket_meta_query_request(meta_query):
    root = ElementTree.Element("MetaQuery")
    if meta_query.next_token is not None:
        _add_text_child(root, "NextToken", meta_query.next_token)
    _add_text_child(root, "MaxResults", meta_query.max_results)
    _add_text_child(root, "Query", meta_query.query)
    if meta_query.sort is not None:
        _add_text_child(root, "Sort", meta_query.sort)
    if meta_query.order is not None:
        _add_text_child(root, "Order", meta_query.order)
    if meta_query.aggregations:
        aggregations_node = ElementTree.SubElement(root, "Aggregations")
        for aggregation in meta_query.aggregations:
            aggregation_node = ElementTree.SubElement(aggregations_node, 'Aggregation')
            if aggregation.field is not None:
                _add_text_child(aggregation_node, 'Field', aggregation.field)
            if aggregation.operation is not None:
                _add_text_child(aggregation_node, 'Operation', aggregation.operation)

    return _node_to_string(root)