Ejemplo n.º 1
0
def raw_metadata_type_doc(name):
    metadata_type = _model.STORE.index.metadata_types.get_by_name(name)
    if not metadata_type:
        abort(404, f"Unknown metadata type {name!r}")
    ordered_metadata = utils.prepare_document_formatting(
        metadata_type.definition, "Metadata Type", include_source_url=True)
    return utils.as_yaml(ordered_metadata)
Ejemplo n.º 2
0
def raw_product_doc(name):
    product = _model.STORE.index.products.get_by_name(name)
    if not product:
        abort(404, f"Unknown product {name!r}")

    ordered_metadata = utils.prepare_document_formatting(
        product.definition, "Product", include_source_url=True)
    return utils.as_yaml(ordered_metadata)
Ejemplo n.º 3
0
def raw_all_products_doc():
    resp = utils.as_yaml(*(utils.prepare_document_formatting(
        product.definition,
        f"Product {product.name}",
        include_source_url=url_for(
            ".raw_product_doc", name=product.name, _external=True),
    ) for product in _model.STORE.all_dataset_types()))
    # Add Explorer ID to the download filename if they have one.
    utils.suggest_download_filename(
        resp,
        prefix="products",
        suffix=".odc-product.yaml",
    )

    return resp
Ejemplo n.º 4
0
def raw_all_metadata_types_doc():
    resp = utils.as_yaml(
        *(utils.prepare_document_formatting(
            type_.definition,
            f"Metadata Type {type_.name}",
            include_source_url=url_for(".raw_metadata_type_doc",
                                       name=type_.name,
                                       _external=True),
        ) for type_ in _model.STORE.all_metadata_types()), )
    # Add Explorer ID to the download filename if they have one.
    utils.suggest_download_filename(
        resp,
        prefix="metadata-types",
        suffix=".odc-type.yaml",
    )
    return resp