From 9189e75500a176e5a6915313cdeb1dac77b5115f Mon Sep 17 00:00:00 2001 From: Carmen Date: Tue, 23 Nov 2021 17:31:06 +0100 Subject: [PATCH 1/5] use separate repo for api docs --- docker/actinia-core-alpine/Dockerfile | 27 +- docker/actinia-core-alpine/README.md | 8 +- src/actinia_core/README.md | 12 + src/actinia_core/models/openapi/README.md | 1 + .../models/openapi/api_log_management.py | 86 ---- .../models/openapi/location_management.py | 68 ---- .../models/openapi/map_layer_base.py | 130 ------ .../models/openapi/mapset_management.py | 74 ---- .../openapi/process_chain_monitoring.py | 69 ---- .../models/openapi/raster_colors.py | 65 --- .../models/openapi/raster_layer.py | 197 --------- .../models/openapi/strds_management.py | 240 ----------- .../models/openapi/strds_raster_management.py | 224 ---------- .../models/openapi/user_api_key.py | 60 --- .../models/openapi/vector_layer.py | 384 ------------------ src/actinia_core/rest/api_log_management.py | 3 +- src/actinia_core/rest/location_management.py | 5 +- src/actinia_core/rest/mapset_management.py | 5 +- .../rest/process_chain_monitoring.py | 4 +- src/actinia_core/rest/raster_colors.py | 3 +- src/actinia_core/rest/raster_layer.py | 4 +- src/actinia_core/rest/strds_management.py | 5 +- .../rest/strds_raster_management.py | 5 +- src/actinia_core/rest/user_api_key.py | 3 +- src/actinia_core/rest/vector_layer.py | 6 +- 25 files changed, 59 insertions(+), 1629 deletions(-) create mode 100644 src/actinia_core/models/openapi/README.md delete mode 100644 src/actinia_core/models/openapi/api_log_management.py delete mode 100644 src/actinia_core/models/openapi/location_management.py delete mode 100644 src/actinia_core/models/openapi/map_layer_base.py delete mode 100644 src/actinia_core/models/openapi/mapset_management.py delete mode 100644 src/actinia_core/models/openapi/process_chain_monitoring.py delete mode 100644 src/actinia_core/models/openapi/raster_colors.py delete mode 100644 src/actinia_core/models/openapi/raster_layer.py delete mode 100644 src/actinia_core/models/openapi/strds_management.py delete mode 100644 src/actinia_core/models/openapi/strds_raster_management.py delete mode 100644 src/actinia_core/models/openapi/user_api_key.py delete mode 100644 src/actinia_core/models/openapi/vector_layer.py diff --git a/docker/actinia-core-alpine/Dockerfile b/docker/actinia-core-alpine/Dockerfile index 9ccac9f7c..885f8f410 100644 --- a/docker/actinia-core-alpine/Dockerfile +++ b/docker/actinia-core-alpine/Dockerfile @@ -1,6 +1,6 @@ FROM mundialis/grass-py3-pdal:stable-alpine as grass FROM mundialis/esa-snap:s1tbx-8.0.3 as snap -FROM mundialis/actinia-core:alpine-build-pkgs_v8 as build +FROM mundialis/actinia-core:alpine-build-pkgs_v9 as build # based on GRASS GIS releasebranch_7_8 (grass78) # for latest GRASS GIS (79), change first line to @@ -59,22 +59,31 @@ RUN while IFS=, read -r ADDON SERVER; do unset URL; test -z $SERVER || URL="url= # Currently, ADD always breaks cache, as "download_count" increases every time # ADD https://api.github.com/repos/mundialis/actinia_statistic_plugin/releases/latest /scratch/actinia_statistic_plugin_latest_release.json WORKDIR /build -# Get statistics plugin (26188052 = 0.0.3) -RUN curl https://api.github.com/repos/mundialis/actinia_statistic_plugin/releases/43983719 > resp.json && \ +# Get statistics plugin (53929318 = 0.0.4) +RUN curl https://api.github.com/repos/mundialis/actinia_statistic_plugin/releases/53929318 > resp.json && \ name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json -# Get satellite plugin (26187974 = 0.0.3) -RUN curl https://api.github.com/repos/mundialis/actinia_satellite_plugin/releases/43983668 > resp.json && \ +# Get satellite plugin (53929219 = 0.0.4) +RUN curl https://api.github.com/repos/mundialis/actinia_satellite_plugin/releases/53929219 > resp.json && \ name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json -# Get actinia-metadata-plugin (38726425 = 1.0.0) -RUN curl https://api.github.com/repos/mundialis/actinia-metadata-plugin/releases/38726425 > resp.json && \ +# Get actinia-metadata-plugin (53929141 = 1.0.2) +RUN curl https://api.github.com/repos/mundialis/actinia-metadata-plugin/releases/53929141 > resp.json && \ name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json -# Get actinia-module-plugin (45775508 = 2.2.0) -RUN curl https://api.github.com/repos/mundialis/actinia-module-plugin/releases/45775508 > resp.json && \ +# Get actinia-module-plugin (53928473 = 2.2.1) +RUN curl https://api.github.com/repos/mundialis/actinia-module-plugin/releases/53928473 > resp.json && \ name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json +# # Get actinia-stac-plugin (53928473 = 2.2.1) +# RUN curl https://api.github.com/repos/mundialis/actinia-module-plugin/releases/53928473 > resp.json && \ +# name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ +# cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json +# Get actinia-api (53922696 = 0.0.1) +RUN curl https://api.github.com/repos/mundialis/actinia-api/releases/53922696 > resp.json && \ + name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ + cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json + # Install actinia-core and plugins COPY --from=build /build/*.whl /build/ # the problem with getting broken 20.0.1 seems to be overcome, the outcommenting diff --git a/docker/actinia-core-alpine/README.md b/docker/actinia-core-alpine/README.md index 204952ac0..1bfd7536a 100644 --- a/docker/actinia-core-alpine/README.md +++ b/docker/actinia-core-alpine/README.md @@ -14,16 +14,16 @@ $ docker build \ --no-cache \ --file docker/actinia-core-alpine/Dockerfile_build_pkgs \ --tag actinia-core:alpine-build-pkgs . -$ docker tag actinia-core:alpine-build-pkgs mundialis/actinia-core:alpine-build-pkgs_v8 -$ docker push mundialis/actinia-core:alpine-build-pkgs_v8 +$ docker tag actinia-core:alpine-build-pkgs mundialis/actinia-core:alpine-build-pkgs_v9 +$ docker push mundialis/actinia-core:alpine-build-pkgs_v9 $ docker build \ --pull \ --no-cache \ --file docker/actinia-core-alpine/Dockerfile_runtime_pkgs \ --tag actinia-core:alpine-runtime-pkgs . -$ docker tag actinia-core:alpine-runtime-pkgs mundialis/actinia-core:alpine-runtime-pkgs_v8 -$ docker push mundialis/actinia-core:alpine-runtime-pkgs_v8 +$ docker tag actinia-core:alpine-runtime-pkgs mundialis/actinia-core:alpine-runtime-pkgs_v9 +$ docker push mundialis/actinia-core:alpine-runtime-pkgs_v9 $ docker build \ --pull \ diff --git a/src/actinia_core/README.md b/src/actinia_core/README.md index a6bad8ceb..d520f8aea 100644 --- a/src/actinia_core/README.md +++ b/src/actinia_core/README.md @@ -6,6 +6,8 @@ This mainly concerns the plugins: * [actinia_statistic_plugin](https://github.com/mundialis/actinia_statistic_plugin) (statistic) * [actinia_satallite_plugin](https://github.com/mundialis/actinia_satellite_plugin) (satellite) * [actinia-metadata-plugin](https://github.com/mundialis/actinia-metadata-plugin) uses no sources of actinia_core +* [actinia-stac-plugin](https://github.com/mundialis/actinia-stac-plugin) (stac) +* [actinia-api](https://github.com/mundialis/actinia-api) (api) The modules inside common folder are not only commonly used by actinia but also by actinia plugins. Some other modules outside of core folder are concerned as well. @@ -38,6 +40,8 @@ Some other modules outside of core folder are concerned as well. | actinia_core.core.common.response_models | create_response_from_model, ProcessingErrorResponseModel, ProcessingResponseModel, SimpleResponseModel, StringListProcessingResultResponseModel, UnivarResultModel | | actinia_core.core.common.sentinel_processing_library | Sentinel2Processing | | actinia_core.core.common.user | ActiniaUser | +| actinia_core.core.redis_user | RedisUserInterface | + ------------ ### Complete list of where modules are used and what exactly is imported @@ -92,3 +96,11 @@ actinia_core.core.common.redis_interface import connect, create_job_queues actinia_core.core.common.response_models import SimpleResponseModel actinia_core.core.common.response_models import UnivarResultModel actinia_core.core.common.sentinel_processing_library import Sentinel2Processing + +__stac__ +actinia_core.rest.resource_base import ResourceBase +actinia_core.core.common.redis_base import RedisBaseInterface +actinia_core.core.common.config import Configuration + +__api__ +actinia_core.models.response_models import ProcessingResponseModel diff --git a/src/actinia_core/models/openapi/README.md b/src/actinia_core/models/openapi/README.md new file mode 100644 index 000000000..1a51b9e88 --- /dev/null +++ b/src/actinia_core/models/openapi/README.md @@ -0,0 +1 @@ +Moved to https://github.com/mundialis/actinia-api diff --git a/src/actinia_core/models/openapi/api_log_management.py b/src/actinia_core/models/openapi/api_log_management.py deleted file mode 100644 index c142e1d9e..000000000 --- a/src/actinia_core/models/openapi/api_log_management.py +++ /dev/null @@ -1,86 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2021 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -Models for api_log_management -""" - -from flask_restful_swagger_2 import Schema - -__license__ = "GPLv3" -__author__ = "Sören Gebbert, Carmen Tawalika" -__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class ApiLogEntryModel(Schema): - """Response schema for a single API log entry that is used to track all API - calls of a user. - """ - type = 'object' - properties = { - 'time_stamp': { - 'type': 'string', - 'description': 'The time stamp of the API call' - }, - 'node': { - 'type': 'string', - 'description': 'The node that executed the API call' - }, - 'endpoint': { - 'type': 'string', - 'description': 'The endpoint of the API call' - }, - 'method': { - 'type': 'string', - 'description': 'The HTTP method of the request' - }, - 'path': { - 'type': 'string', - 'description': 'The path of the REST API call' - }, - 'url': { - 'type': 'string', - 'description': 'The request URL' - }, - 'request_str': { - 'type': 'string', - 'description': 'The request string' - } - } - required = ["time_stamp", "node", "endpoint", - "method", "path", "url", "request_str"] - - -class ApiLogListModel(Schema): - """Response schema that represents a list of API log entries. - """ - type = 'object' - properties = { - 'api_log_list': { - 'type': 'array', - 'items': ApiLogEntryModel, - 'description': 'A list of ApiLogEntryModel objects' - } - } - required = ["api_log_list"] diff --git a/src/actinia_core/models/openapi/location_management.py b/src/actinia_core/models/openapi/location_management.py deleted file mode 100644 index 44a936340..000000000 --- a/src/actinia_core/models/openapi/location_management.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2018 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -Models for location_management -""" - -from flask_restful_swagger_2 import Schema - -__license__ = "GPLv3" -__author__ = "Sören Gebbert, Carmen Tawalika" -__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class LocationListResponseModel(Schema): - """Response schema for location lists - """ - type = 'object' - properties = { - 'status': { - 'type': 'string', - 'description': 'The status of the resource, values: accepted, ' - 'running, finished, terminated, error' - }, - 'locations': { - 'type': 'array', - 'items': {"type": "string"}, - 'description': 'The list of locations in the GRASS database' - } - } - example = {"locations": ["nc_spm_08", "latlong_wgs84", "ECAD"], "status": "success"} - required = ["status", "locations"] - - -class ProjectionInfoModel(Schema): - """Schema to define projection information as JSON input in POST requests - """ - type = 'object' - properties = { - 'epsg': { - 'type': 'string', - 'description': 'The EPSG code of the projection that should be used ' - 'to create a location' - } - } - example = {"epsg": "4326"} - required = ["epsg"] diff --git a/src/actinia_core/models/openapi/map_layer_base.py b/src/actinia_core/models/openapi/map_layer_base.py deleted file mode 100644 index 9a05c50b8..000000000 --- a/src/actinia_core/models/openapi/map_layer_base.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2018 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -Model for Base layer resources -""" - -from flask_restful_swagger_2 import Schema - -__license__ = "GPLv3" -__author__ = "Sören Gebbert, Carmen Tawalika" -__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class SetRegionModel(Schema): - """This schema represents the computational region definition for raster - and vector map layers. - - n : for north - s : for south - e : for east - w : for west - res : resolution of the region - ewres: east-west resolution - nsres: north-south resolution - raster: Raster layer name with mapset to set the region from - align: Raster layer name with mapset to align the region to - zoom: Raster layer name with mapset to zoom the region to - vector: Vector layer name with mapset to set the region from - - """ - type = 'object' - properties = { - 'region': { - 'type': 'string', - 'description': 'Set current region from named region' - }, - 'raster': { - 'type': 'string', - 'description': 'Raster layer name with mapset to set the region from' - }, - 'align': { - 'type': 'string', - 'description': 'Raster layer name with mapset to align the region to' - }, - 'zoom': { - 'type': 'string', - 'description': 'Raster layer name with mapset to zoom the region to' - }, - 'vector': { - 'type': 'string', - 'description': 'Vector layer name with mapset to set the region from' - }, - 'n': { - 'type': 'number', - 'format': 'double', - 'description': 'Value for the northern edge' - }, - 's': { - 'type': 'number', - 'format': 'double', - 'description': 'Value for the southern edge' - }, - 'w': { - 'type': 'number', - 'format': 'double', - 'description': 'Value for the western edge' - }, - 'e': { - 'type': 'number', - 'format': 'double', - 'description': 'Value for the eastern edge' - }, - 't': { - 'type': 'number', - 'format': 'double', - 'description': 'Value for the top edge' - }, - 'b': { - 'type': 'number', - 'format': 'double', - 'description': 'Value for the bottom edge' - }, - 'nsres': { - 'type': 'number', - 'format': 'double', - 'description': 'North-south 2D grid resolution' - }, - 'res': { - 'type': 'number', - 'format': 'double', - 'description': '2D grid resolution (north-south and east-west)' - }, - 'ewres': { - 'type': 'number', - 'format': 'double', - 'description': 'East-west 2D grid resolution' - }, - 'res3': { - 'type': 'number', - 'format': 'double', - 'description': '3D grid resolution (north-south, east-west and top-bottom)' - }, - 'tbres': { - 'type': 'number', - 'format': 'double', - 'description': 'Top-bottom 3D grid resolution' - } - } diff --git a/src/actinia_core/models/openapi/mapset_management.py b/src/actinia_core/models/openapi/mapset_management.py deleted file mode 100644 index 9a00cead3..000000000 --- a/src/actinia_core/models/openapi/mapset_management.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2018 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -Model for Mapset management resources -""" -from copy import deepcopy -from actinia_core.models.response_models import ProcessingResponseModel - -__license__ = "GPLv3" -__author__ = "Sören Gebbert, Carmen Tawalika" -__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class MapsetLockManagementResponseModel(ProcessingResponseModel): - """The response content that is returned by the GET request - """ - type = 'object' - properties = deepcopy(ProcessingResponseModel.properties) - properties["process_results"] = {} - properties["process_results"]["type"] = "boolean" - required = deepcopy(ProcessingResponseModel.required) - example = { - "accept_datetime": "2018-05-02 11:03:26.529673", - "accept_timestamp": 1525259006.5296717, - "api_info": { - "endpoint": "mapsetlockmanagementresource", - "method": "GET", - "path": "/locations/nc_spm_08/mapsets/PERMANENT/lock", - "request_url": "http://localhost:8080/locations/nc_spm_08/mapsets/" - "PERMANENT/lock" - }, - "datetime": "2018-05-02 11:03:26.586348", - "http_code": 200, - "message": "Mapset lock state: False", - "process_chain_list": [], - "process_log": [], - "process_results": False, - "progress": { - "num_of_steps": 0, - "step": 0 - }, - "resource_id": "resource_id-162101d9-2abc-417e-83ef-dc6f52ed7aaf", - "status": "finished", - "time_delta": 0.056743621826171875, - "timestamp": 1525259006.5863316, - "urls": { - "resources": [], - "status": "http://localhost:8080/resources/admin/" - "resource_id-162101d9-2abc-417e-83ef-dc6f52ed7aaf" - }, - "user_id": "admin" - } diff --git a/src/actinia_core/models/openapi/process_chain_monitoring.py b/src/actinia_core/models/openapi/process_chain_monitoring.py deleted file mode 100644 index 9a9b59fbb..000000000 --- a/src/actinia_core/models/openapi/process_chain_monitoring.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2021 mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -Process Chain Monitoring -""" -from flask_restful_swagger_2 import Schema - -__license__ = "GPLv3" -__author__ = "Anika Weinmann, Carmen Tawalika" -__copyright__ = "Copyright 2021, mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class MapsetSizeResponseModel(Schema): - """Response schema for mapset sizes of a resource - """ - type = 'object' - properties = { - 'status': { - 'type': 'string', - 'description': 'The status of the resource, values: success, error' - }, - 'mapset_sizes': { - 'type': 'array', - 'items': {"type": "integer"}, - 'description': 'The list of mapset sizes of a resource in bytes' - } - } - example = {"mapset_sizes": [29946, 29946], "status": "success"} - required = ["status", "mapset_sizes"] - - -class MaxMapsetSizeResponseModel(Schema): - """Response schema for maximum mapset size of a resoucre - """ - type = 'object' - properties = { - 'status': { - 'type': 'string', - 'description': 'The status of the resource, values: success, error' - }, - 'max_mapset_size': { - 'type': 'integer', - 'description': 'The maximum mapset size of a resource in bytes' - } - } - example = {"max_mapset_size": 29949, "status": "success"} - required = ["status", "max_mapset_size"] diff --git a/src/actinia_core/models/openapi/raster_colors.py b/src/actinia_core/models/openapi/raster_colors.py deleted file mode 100644 index cc5f8e336..000000000 --- a/src/actinia_core/models/openapi/raster_colors.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2018 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -Models for Raster colors management -""" - -from flask_restful_swagger_2 import Schema - -__license__ = "GPLv3" -__author__ = "Sören Gebbert, Carmen Tawalika" -__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class RasterColorModel(Schema): - """Response schema that is used in cases that no asynchronous run was performed. - - """ - description = "Set the color table for an existing raster map layer with a " \ - "set of rules, a specific color or an other raster map layer" - type = 'object' - properties = { - 'rules': { - 'type': 'array', - 'description': 'A list of rules to set the color table of a raster ' - 'map layer', - 'items': {'type': "string"} - }, - 'color': { - 'type': 'string', - 'description': 'The name of a color to be set for a raster map layer' - }, - 'raster': { - 'type': 'string', - 'description': 'The name of an existing raster map layer to copy ' - 'the color table from' - } - } - example = { - "rules": ["1 0:0:0", - "default 255:255:255"], - "color": "ndvi", - "raster": "elevation@PERMANENT" - } diff --git a/src/actinia_core/models/openapi/raster_layer.py b/src/actinia_core/models/openapi/raster_layer.py deleted file mode 100644 index fab448d72..000000000 --- a/src/actinia_core/models/openapi/raster_layer.py +++ /dev/null @@ -1,197 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2018 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -Raster layer resources -""" -from copy import deepcopy -from flask_restful_swagger_2 import Schema -from actinia_core.models.response_models import ProcessingResponseModel - -__license__ = "GPLv3" -__author__ = "Sören Gebbert, Carmen Tawalika" -__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class RasterInfoModel(Schema): - """Schema that contains raster map layer information - """ - type = 'object' - properties = { - 'cells': {'type': 'string'}, - 'cols': {'type': 'string'}, - 'comments': {'type': 'string'}, - 'creator': {'type': 'string'}, - 'database': {'type': 'string'}, - 'datatype': {'type': 'string'}, - 'maptype': {'type': 'string'}, - 'east': {'type': 'string'}, - 'date': {'type': 'string'}, - 'description': {'type': 'string'}, - 'ewres': {'type': 'string'}, - 'max': {'type': 'string'}, - 'min': {'type': 'string'}, - 'ncats': {'type': 'string'}, - 'nsres': {'type': 'string'}, - 'location': {'type': 'string'}, - 'map': {'type': 'string'}, - 'mapset': {'type': 'string'}, - 'rows': {'type': 'string'}, - 'source1': {'type': 'string'}, - 'north': {'type': 'string'}, - 'source2': {'type': 'string'}, - 'units': {'type': 'string'}, - 'vdatum': {'type': 'string'}, - 'south': {'type': 'string'}, - 'timestamp': {'type': 'string'}, - 'title': {'type': 'string'}, - 'west': {'type': 'string'}, - 'bandref': {'type': 'string'} - } - example = { - "cells": "2025000", - "cols": "1500", - "comments": "\"r.proj input=\"ned03arcsec\" " - "location=\"northcarolina_latlong\" mapset=\"\\helena\" " - "output=\"elev_ned10m\" method=\"cubic\" resolution=10\"", - "creator": "\"helena\"", - "database": "/tmp/gisdbase_75bc0828", - "datatype": "FCELL", - "date": "\"Tue Nov 7 01:09:51 2006\"", - "description": "\"generated by r.proj\"", - "east": "645000", - "ewres": "10", - "location": "nc_spm_08", - "map": "elevation", - "mapset": "PERMANENT", - "max": "156.3299", - "min": "55.57879", - "ncats": "255", - "north": "228500", - "nsres": "10", - "rows": "1350", - "source1": "\"\"", - "source2": "\"\"", - "south": "215000", - "timestamp": "\"none\"", - "title": "\"South-West Wake county: Elevation NED 10m\"", - "units": "\"none\"", - "vdatum": "\"none\"", - "west": "630000" - } - - -class RasterInfoResponseModel(ProcessingResponseModel): - """Response schema for raster map layer information. - """ - type = 'object' - properties = deepcopy(ProcessingResponseModel.properties) - properties["process_results"] = RasterInfoModel - required = deepcopy(ProcessingResponseModel.required) - # required.append("process_results") - example = { - "accept_datetime": "2018-05-02 10:44:11.764375", - "accept_timestamp": 1525257851.7643716, - "api_info": { - "endpoint": "rasterlayerresource", - "method": "GET", - "path": "/locations/nc_spm_08/mapsets/PERMANENT/raster_layers/elevation", - "request_url": "http://localhost:8080/locations/nc_spm_08/mapsets/" - "PERMANENT/raster_layers/elevation" - }, - "datetime": "2018-05-02 10:44:11.897704", - "http_code": 200, - "message": "Processing successfully finished", - "process_chain_list": [ - { - "1": { - "flags": "gre", - "inputs": { - "map": "elevation@PERMANENT" - }, - "module": "r.info" - } - } - ], - "process_log": [ - { - "executable": "r.info", - "parameter": [ - "map=elevation@PERMANENT", - "-gre" - ], - "return_code": 0, - "run_time": 0.050168514251708984, - "stderr": [ - "" - ], - "stdout": "..."} - ], - "process_results": { - "cells": "2025000", - "cols": "1500", - "comments": "\"r.proj input=\"ned03arcsec\" " - "location=\"northcarolina_latlong\" mapset=\"\\helena\" " - "output=\"elev_ned10m\" method=\"cubic\" resolution=10\"", - "creator": "\"helena\"", - "database": "/actinia/workspace/temp_db/" - "gisdbase_5f1a5262c8bf4d4789348ffa2406ec3e", - "datatype": "FCELL", - "date": "\"Tue Nov 7 01:09:51 2006\"", - "description": "\"generated by r.proj\"", - "east": "645000", - "ewres": "10", - "location": "nc_spm_08", - "map": "elevation", - "mapset": "PERMANENT", - "max": "156.3299", - "min": "55.57879", - "ncats": "255", - "north": "228500", - "nsres": "10", - "rows": "1350", - "source1": "\"\"", - "source2": "\"\"", - "south": "215000", - "timestamp": "\"none\"", - "title": "\"South-West Wake county: Elevation NED 10m\"", - "units": "\"none\"", - "vdatum": "\"none\"", - "west": "630000" - }, - "progress": { - "num_of_steps": 1, - "step": 1 - }, - "resource_id": "resource_id-0a3d6b2b-0962-4d01-8993-7997f15d1595", - "status": "finished", - "time_delta": 0.13338971138000488, - "timestamp": 1525257851.8976946, - "urls": { - "resources": [], - "status": "http://localhost:8080/resources/user/" - "resource_id-0a3d6b2b-0962-4d01-8993-7997f15d1595" - }, - "user_id": "user" - } diff --git a/src/actinia_core/models/openapi/strds_management.py b/src/actinia_core/models/openapi/strds_management.py deleted file mode 100644 index 48040240a..000000000 --- a/src/actinia_core/models/openapi/strds_management.py +++ /dev/null @@ -1,240 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2019 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -STRDS map layer management - -TODO: Integrate into the ephemeral process chain approach -""" -from copy import deepcopy -from flask_restful_swagger_2 import Schema -from actinia_core.models.response_models import ProcessingResponseModel - -__license__ = "GPLv3" -__author__ = "Sören Gebbert, Carmen Tawalika" -__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class STRDSInfoModel(Schema): - """Schema that contains space-time raster dataset (STRDS) information - """ - description = "Information about a specific space-time raster dataset (STRDS)" - type = 'object' - properties = { - "aggregation_type": {'type': 'string'}, - "band_names": {'type': 'string'}, - "band_reference": {'type': 'string'}, - "bottom": {'type': 'string'}, - "creation_time": {'type': 'string'}, - "creator": {'type': 'string'}, - "east": {'type': 'string'}, - "end_time": {'type': 'string'}, - "ewres_max": {'type': 'string'}, - "ewres_min": {'type': 'string'}, - "granularity": {'type': 'string'}, - "id": {'type': 'string'}, - "map_time": {'type': 'string'}, - "mapset": {'type': 'string'}, - "max_max": {'type': 'string'}, - "max_min": {'type': 'string'}, - "min_max": {'type': 'string'}, - "min_min": {'type': 'string'}, - "modification_time": {'type': 'string'}, - "name": {'type': 'string'}, - "north": {'type': 'string'}, - "number_of_bands": {'type': 'string'}, - "nsres_max": {'type': 'string'}, - "nsres_min": {'type': 'string'}, - "number_of_maps": {'type': 'string'}, - "raster_register": {'type': 'string'}, - "semantic_type": {'type': 'string'}, - "south": {'type': 'string'}, - "start_time": {'type': 'string'}, - "temporal_type": {'type': 'string'}, - "top": {'type': 'string'}, - "west": {'type': 'string'} - } - example = { - "aggregation_type": "None", - "band_names": "None", - "band_reference": "None", - "bottom": "0.0", - "creation_time": "2016-08-11 16:44:29.756411", - "creator": "soeren", - "east": "75.5", - "end_time": "2013-07-01 00:00:00", - "ewres_max": "0.25", - "ewres_min": "0.25", - "granularity": "1 month", - "id": "precipitation_1950_2013_monthly_mm@PERMANENT", - "map_time": "interval", - "mapset": "PERMANENT", - "max_max": "1076.9", - "max_min": "168.9", - "min_max": "3.2", - "min_min": "0.0", - "modification_time": "2016-08-11 16:45:14.032432", - "name": "precipitation_1950_2013_monthly_mm", - "north": "75.5", - "nsres_max": "0.25", - "nsres_min": "0.25", - "number_of_bands": "None", - "number_of_maps": "762", - "raster_register": "raster_map_register_934719ed2b4841818386a6f9c5f11b09", - "semantic_type": "mean", - "south": "25.25", - "start_time": "1950-01-01 00:00:00", - "temporal_type": "absolute", - "top": "0.0", - "west": "-40.5" - } - - -class STRDSInfoResponseModel(ProcessingResponseModel): - """Response schema for STRDS information. - """ - type = 'object' - properties = deepcopy(ProcessingResponseModel.properties) - properties["process_results"] = STRDSInfoModel - required = deepcopy(ProcessingResponseModel.required) - # required.append("process_results") - example = { - "accept_datetime": "2018-05-02 10:36:43.119861", - "accept_timestamp": 1525257403.119857, - "api_info": { - "endpoint": "strdsmanagementresource", - "method": "GET", - "path": "/locations/ECAD/mapsets/PERMANENT/strds/" - "precipitation_1950_2013_yearly_mm", - "request_url": "http://localhost:8080/locations/ECAD/mapsets/" - "PERMANENT/strds/precipitation_1950_2013_yearly_mm" - }, - "datetime": "2018-05-02 10:36:43.677867", - "http_code": 200, - "message": "Information gathering for STRDS " - " successful", - "process_chain_list": [ - { - "1": { - "flags": "g", - "inputs": { - "input": "precipitation_1950_2013_yearly_mm", - "type": "strds" - }, - "module": "t.info" - } - } - ], - "process_log": [ - { - "executable": "t.info", - "parameter": [ - "type=strds", - "input=precipitation_1950_2013_yearly_mm", - "-g" - ], - "return_code": 0, - "run_time": 0.4944636821746826, - "stderr": [ - "" - ], - "stdout": "..."} - ], - "process_results": { - "aggregation_type": "None", - "band_names": "None", - "band_reference": "None", - "bottom": "0.0", - "creation_time": "2017-12-29 15:58:40.020820", - "creator": "soeren", - "east": "75.5", - "end_time": "2013-01-01 00:00:00", - "ewres_max": "0.25", - "ewres_min": "0.25", - "granularity": "1 year", - "id": "precipitation_1950_2013_yearly_mm@PERMANENT", - "map_time": "interval", - "mapset": "PERMANENT", - "max_max": "5132.0", - "max_min": "2498.3", - "min_max": "35.2", - "min_min": "0.0", - "modification_time": "2017-12-29 15:58:44.396206", - "name": "precipitation_1950_2013_yearly_mm", - "north": "75.5", - "nsres_max": "0.25", - "nsres_min": "0.25", - "number_of_bands": "None", - "number_of_maps": "63", - "raster_register": "raster_map_register_87e1edbaf2da4a27a03da04fa9f3a7f1", - "semantic_type": "mean", - "south": "25.25", - "start_time": "1950-01-01 00:00:00", - "temporal_type": "absolute", - "top": "0.0", - "west": "-40.5" - }, - "progress": { - "num_of_steps": 1, - "step": 1 - }, - "resource_id": "resource_id-1f178974-684d-417e-a3f4-878708b7382b", - "status": "finished", - "time_delta": 0.5580840110778809, - "timestamp": 1525257403.6778474, - "urls": { - "resources": [], - "status": "http://localhost:8080/resources/user/" - "resource_id-1f178974-684d-417e-a3f4-878708b7382b" - }, - "user_id": "user" - } - - -class STRDSCreationModel(Schema): - """Schema for STRDS creation - """ - description = "Information required to create a new STRDS" - type = 'object' - properties = { - 'title': { - 'type': 'string', - 'description': 'The title of the STRDS', - }, - 'description': { - 'type': 'string', - 'description': 'The description of the STRDS', - }, - 'temporaltype': { - 'type': 'string', - 'description': 'The temporal type of the STRDS, which can be ' - 'absolute and relative', - 'default': "absolute" - } - } - required = ['title', 'description'] - example = {"title": "Monthly mean temperature from 1950-2010 for Germany", - "description": "Monthly mean temperature from 1950-2010 for Germany " - "in degree celsius", - "ttype": "absolute"} diff --git a/src/actinia_core/models/openapi/strds_raster_management.py b/src/actinia_core/models/openapi/strds_raster_management.py deleted file mode 100644 index 22e9392c9..000000000 --- a/src/actinia_core/models/openapi/strds_raster_management.py +++ /dev/null @@ -1,224 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2018 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -STRDS raster map layer management - -TODO: Integrate into the ephemeral process chain approach -""" -from copy import deepcopy -from flask_restful_swagger_2 import Schema -from actinia_core.models.response_models import \ - ProcessingResponseModel - -__license__ = "GPLv3" -__author__ = "Sören Gebbert, Carmen Tawalika" -__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class STRDSRasterListEntryModel(Schema): - """Schema that contains list entry - - columns=id,start_time,end_time,north,south,east,west,min,max,rows,cols - """ - description = "A single raster map layer information entry" - type = 'object' - properties = { - 'id': {'type': 'string'}, - 'start_time': {'type': 'string'}, - 'end_time': {'type': 'string'}, - 'min': {'type': 'string'}, - 'max': {'type': 'string'}, - 'north': {'type': 'string'}, - 'south': {'type': 'string'}, - 'east': {'type': 'string'}, - 'west': {'type': 'string'}, - 'rows': {'type': 'string'}, - 'cols': {'type': 'string'} - } - example = { - "cols": "201", - "east": "75.5", - "end_time": "2013-06-01 00:00:00", - "id": "precipitation_monthly_mm_760@PERMANENT", - "max": "403.8", - "min": "0.0", - "north": "75.5", - "rows": "464", - "south": "25.25", - "start_time": "2013-05-01 00:00:00", - "west": "-40.5" - } - - -class STRDSRasterListResponseModel(ProcessingResponseModel): - """Response schema for STRDS raster map layer list information. - """ - type = 'object' - properties = deepcopy(ProcessingResponseModel.properties) - properties["process_results"] = {} - properties["process_results"]["type"] = "array" - properties["process_results"]["items"] = STRDSRasterListEntryModel - required = deepcopy(ProcessingResponseModel.required) - # required.append("process_results") - example = { - "accept_datetime": "2018-05-06 21:28:18.583050", - "accept_timestamp": 1525634898.5830483, - "api_info": { - "endpoint": "strdsrastermanagement", - "method": "GET", - "path": "/locations/ECAD/mapsets/PERMANENT/strds/" - "precipitation_1950_2013_yearly_mm/raster_layers", - "request_url": "http://localhost:5000/locations/ECAD/mapsets/" - "PERMANENT/strds/precipitation_1950_2013_yearly_mm/" - "raster_layers?where=start_time>'2010-01-01'" - }, - "datetime": "2018-05-06 21:28:19.187395", - "http_code": 200, - "message": "Processing successfully finished", - "process_chain_list": [ - { - "1": { - "flags": "u", - "inputs": { - "columns": "id,start_time,end_time,north,south,east," - "west,min,max,rows,cols", - "input": "precipitation_1950_2013_yearly_mm@PERMANENT", - "separator": "|", - "where": "start_time>'2010-01-01'" - }, - "module": "t.rast.list", - "outputs": { - "output": { - "name": "/home/soeren/actinia/workspace/temp_db/" - "gisdbase_1b72938d2ef54c199f6627b8720f21e1/" - ".tmp/tmptps71vn7" - } - } - } - } - ], - "process_log": [ - { - "executable": "t.rast.list", - "parameter": [ - "input=precipitation_1950_2013_yearly_mm@PERMANENT", - "where=start_time>'2010-01-01'", - "separator=|", - "columns=id,start_time,end_time,north,south,east,west,min," - "max,rows,cols", - "output=/home/soeren/actinia/workspace/temp_db/" - "gisdbase_1b72938d2ef54c199f6627b8720f21e1/.tmp/tmptps71vn7", - "-u" - ], - "return_code": 0, - "run_time": 0.5023984909057617, - "stderr": [ - "" - ], - "stdout": "" - } - ], - "process_results": [ - { - "cols": "201", - "east": "75.5", - "end_time": "2011-01-01 00:00:00", - "id": "precipitation_yearly_mm_60@PERMANENT", - "max": "2899.6", - "min": "22.5", - "north": "75.5", - "rows": "464", - "south": "25.25", - "start_time": "2010-01-01 00:00:00", - "west": "-40.5" - }, - { - "cols": "201", - "east": "75.5", - "end_time": "2012-01-01 00:00:00", - "id": "precipitation_yearly_mm_61@PERMANENT", - "max": "4226.0", - "min": "10.0", - "north": "75.5", - "rows": "464", - "south": "25.25", - "start_time": "2011-01-01 00:00:00", - "west": "-40.5" - }, - { - "cols": "201", - "east": "75.5", - "end_time": "2013-01-01 00:00:00", - "id": "precipitation_yearly_mm_62@PERMANENT", - "max": "3442.6", - "min": "0.0", - "north": "75.5", - "rows": "464", - "south": "25.25", - "start_time": "2012-01-01 00:00:00", - "west": "-40.5" - } - ], - "progress": { - "num_of_steps": 1, - "step": 1 - }, - "resource_id": "resource_id-729ace44-6245-43c7-a875-d2059c1a1549", - "status": "finished", - "time_delta": 0.6043989658355713, - "timestamp": 1525634899.1873734, - "urls": { - "resources": [], - "status": "http://localhost:5000/resources/user/" - "resource_id-729ace44-6245-43c7-a875-d2059c1a1549" - }, - "user_id": "user" - } - - -class RasterListEntryModel(Schema): - type = 'object' - properties = { - 'name': {'type': 'string'}, - 'start_time': {'type': 'string'}, - 'end_time': {'type': 'string'} - } - - -class RasterListRegisterModel(Schema): - type = 'array' - items = RasterListEntryModel - example = [ - { - "end_time": "2013-06-01 00:00:00", - "start_time": "2013-05-01 00:00:00", - "name": "precipitation_monthly_mm_760", - }, - { - "end_time": "2013-07-01 00:00:00", - "start_time": "2013-06-01 00:00:00", - "name": "precipitation_monthly_mm_761", - } - ] diff --git a/src/actinia_core/models/openapi/user_api_key.py b/src/actinia_core/models/openapi/user_api_key.py deleted file mode 100644 index b37d92e22..000000000 --- a/src/actinia_core/models/openapi/user_api_key.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2018 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -The user specific resources - -This module specifies all endpoints to manage user accounts -in the redis database via REST API calls. - -TODO: Implement POST full permission creation - Implement PUT to modify existing users -""" -from flask_restful_swagger_2 import Schema - -__license__ = "GPLv3" -__author__ = "Sören Gebbert, Carmen Tawalika" -__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class TokenResponseModel(Schema): - """Response schema that is used for authentication token generation. - - """ - type = 'object' - properties = { - 'status': { - 'type': 'string', - 'description': 'The status of the resource, values: success, error' - }, - 'token': { - 'type': 'string', - 'description': 'The generated token for authentication' - }, - 'message': { - 'type': 'string', - 'description': 'The message of the token generation' - } - } - required = ["status", "token"] diff --git a/src/actinia_core/models/openapi/vector_layer.py b/src/actinia_core/models/openapi/vector_layer.py deleted file mode 100644 index 5021c0c5b..000000000 --- a/src/actinia_core/models/openapi/vector_layer.py +++ /dev/null @@ -1,384 +0,0 @@ -# -*- coding: utf-8 -*- -####### -# actinia-core - an open source REST API for scalable, distributed, high -# performance processing of geographical data that uses GRASS GIS for -# computational tasks. For details, see https://actinia.mundialis.de/ -# -# Copyright (c) 2016-2018 Sören Gebbert and mundialis GmbH & Co. KG -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -####### - -""" -Vector layer resources -""" -import random -from copy import deepcopy -from flask_restful_swagger_2 import Schema -from actinia_core.models.response_models import \ - ProcessingResponseModel -from actinia_core.models.openapi.map_layer_base import SetRegionModel - -__license__ = "GPLv3" -__author__ = "Sören Gebbert, Carmen Tawalika" -__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG" -__maintainer__ = "mundialis" - - -class VectorAttributeModel(Schema): - """Simple model that represent the description of vector attributes - """ - description = "Description of a vector map layer attribute" - type = 'object' - properties = {'column': {'type': 'string'}, - 'type': {'type': 'string'}} - example = {"cat": "INTEGER", "z": "DOUBLE PRECISION"} - - -class VectorInfoModel(Schema): - """Schema that contains vector map layer information - """ - description = "Description of a GRASS GIS vector map layer" - type = 'object' - properties = { - 'Attributes': {'type': 'array', "items": VectorAttributeModel}, - 'COMMAND': {'type': 'string'}, - 'areas': {'type': 'string'}, - 'bottom': {'type': 'string'}, - 'boundaries': {'type': 'string'}, - 'centroids': {'type': 'string'}, - 'comment': {'type': 'string'}, - 'creator': {'type': 'string'}, - 'database': {'type': 'string'}, - 'digitization_threshold': {'type': 'string'}, - 'east': {'type': 'string'}, - 'faces': {'type': 'string'}, - 'format': {'type': 'string'}, - 'holes': {'type': 'string'}, - 'islands': {'type': 'string'}, - 'kernels': {'type': 'string'}, - 'level': {'type': 'string'}, - 'lines': {'type': 'string'}, - 'location': {'type': 'string'}, - 'map3d': {'type': 'string'}, - 'mapset': {'type': 'string'}, - 'name': {'type': 'string'}, - 'nodes': {'type': 'string'}, - 'north': {'type': 'string'}, - 'num_dblinks': {'type': 'string'}, - 'organization': {'type': 'string'}, - 'points': {'type': 'string'}, - 'primitives': {'type': 'string'}, - 'projection': {'type': 'string'}, - 'zone': {'type': 'string'}, - 'scale': {'type': 'string'}, - 'source_date': {'type': 'string'}, - 'south': {'type': 'string'}, - 'timestamp': {'type': 'string'}, - 'title': {'type': 'string'}, - 'top': {'type': 'string'}, - 'volumes': {'type': 'string'}, - 'west': {'type': 'string'}, - 'attribute_layer_name': {'type': 'string'}, - 'attribute_table': {'type': 'string'}, - 'attribute_database_driver': {'type': 'string'}, - 'attribute_database': {'type': 'string'}, - 'attribute_primary_key': {'type': 'string'}, - 'attribute_layer_number': {'type': 'string'}, - } - example = { - "Attributes": [ - {"column": "cat", "type": "INTEGER"}, - {"column": "z", "type": "DOUBLE PRECISION"} - ], - "COMMAND": " v.random -z output=\"test_layer\" npoints=1 layer=\"-1\" " - "zmin=1.0 zmax=1.0 seed=1 column=\"z\" " - "column_type=\"double precision\"", - "areas": "0", - "bottom": "1.000000", - "boundaries": "0", - "centroids": "0", - "comment": "", - "creator": "soeren", - "database": "/tmp/gisdbase_b83bebdb543440c7b9991e2e5602ba91", - "digitization_threshold": "0.000000", - "east": "644375.544828422", - "faces": "0", - "format": "native", - "holes": "0", - "islands": "0", - "kernels": "0", - "level": "2", - "lines": "0", - "location": "nc_spm_08", - "map3d": "1", - "mapset": "user1", - "name": "test_layer", - "nodes": "0", - "north": "221135.648003836", - "num_dblinks": "1", - "organization": "", - "points": "1", - "primitives": "1", - "projection": "Lambert Conformal Conic", - "scale": "1:1", - "source_date": "Thu May 18 21:40:02 2017", - "south": "221135.648003836", - "timestamp": "none", - "title": "", - "top": "1.000000", - "volumes": "0", - "west": "644375.544828422", - "attribute_database": "/tmp/gisdbase_eabed7327ec84d219698670884136c2a/" - "nc_spm_08/user1/vector/test_layer/sqlite.db", - "attribute_database_driver": "sqlite", - "attribute_layer_name": "test_layer", - "attribute_layer_number": "1", - "attribute_primary_key": "cat", - "attribute_table": "test_layer", - } - - -class VectorInfoResponseModel(ProcessingResponseModel): - """Response schema for vector map layer information. - """ - type = 'object' - properties = deepcopy(ProcessingResponseModel.properties) - properties["process_results"] = VectorInfoModel - required = deepcopy(ProcessingResponseModel.required) - # required.append("process_results") - example = { - "accept_datetime": "2018-05-06 21:36:53.825043", - "accept_timestamp": 1525635413.8250418, - "api_info": { - "endpoint": "vectorlayerresource", - "method": "GET", - "path": "/locations/nc_spm_08/mapsets/PERMANENT/vector_layers/geology", - "request_url": "http://localhost:5000/locations/nc_spm_08/mapsets/" - "PERMANENT/vector_layers/geology" - }, - "datetime": "2018-05-06 21:36:54.032325", - "http_code": 200, - "message": "Processing successfully finished", - "process_chain_list": [ - { - "1": { - "flags": "gte", - "inputs": { - "map": "geology@PERMANENT" - }, - "module": "v.info" - }, - "2": { - "flags": "h", - "inputs": { - "map": "geology@PERMANENT" - }, - "module": "v.info" - }, - "3": { - "flags": "c", - "inputs": { - "map": "geology@PERMANENT" - }, - "module": "v.info" - } - } - ], - "process_log": [ - { - "executable": "v.info", - "parameter": [ - "map=geology@PERMANENT", - "-gte" - ], - "return_code": 0, - "run_time": 0.050188302993774414, - "stderr": [ - "" - ], - "stdout": "..." - }, - { - "executable": "v.info", - "parameter": [ - "map=geology@PERMANENT", - "-h" - ], - "return_code": 0, - "run_time": 0.05018758773803711, - "stderr": [ - "" - ], - "stdout": "..." - }, - { - "executable": "v.info", - "parameter": [ - "map=geology@PERMANENT", - "-c" - ], - "return_code": 0, - "run_time": 0.050185441970825195, - "stderr": [ - "Displaying column types/names for database connection of " - "layer <1>:", - "" - ], - "stdout": "..." - } - ], - "process_results": { - "Attributes": [ - { - "column": "cat", - "type": "INTEGER" - }, - { - "column": "onemap_pro", - "type": "DOUBLE PRECISION" - }, - { - "column": "PERIMETER", - "type": "DOUBLE PRECISION" - }, - { - "column": "GEOL250_", - "type": "INTEGER" - }, - { - "column": "GEOL250_ID", - "type": "INTEGER" - }, - { - "column": "GEO_NAME", - "type": "CHARACTER" - }, - { - "column": "SHAPE_area", - "type": "DOUBLE PRECISION" - }, - { - "column": "SHAPE_len", - "type": "DOUBLE PRECISION" - } - ], - "COMMAND": " v.db.connect -o map=\"geology@PERMANENT\" " - "driver=\"sqlite\" database=\"$GISDBASE/$LOCATION_NAME/" - "$MAPSET/sqlite/sqlite.db\" table=\"geology\" key=\"cat\" " - "layer=\"1\" separator=\"|\"", - "areas": "1832", - "attribute_database": "/home/soeren/actinia/workspace/temp_db/" - "gisdbase_d98fc0548fc44fac8fe43abd575e98cc/" - "nc_spm_08/PERMANENT/sqlite/sqlite.db", - "attribute_database_driver": "sqlite", - "attribute_layer_name": "geology", - "attribute_layer_number": "1", - "attribute_primary_key": "cat", - "attribute_table": "geology", - "bottom": "0.000000", - "boundaries": "3649", - "centroids": "1832", - "comment": "", - "creator": "helena", - "database": "/home/soeren/actinia/workspace/temp_db/" - "gisdbase_d98fc0548fc44fac8fe43abd575e98cc", - "digitization_threshold": "0.000000", - "east": "930172.312822711", - "format": "native", - "islands": "907", - "level": "2", - "lines": "0", - "location": "nc_spm_08", - "map3d": "0", - "mapset": "PERMANENT", - "name": "geology", - "nodes": "2724", - "north": "318117.437416345", - "num_dblinks": "1", - "organization": "NC OneMap", - "points": "0", - "primitives": "5481", - "projection": "Lambert Conformal Conic", - "scale": "1:1", - "source_date": "Mon Nov 6 15:48:53 2006", - "south": "10875.8272320917", - "timestamp": "none", - "title": "North Carolina geology map (polygon map)", - "top": "0.000000", - "west": "123971.194989783" - }, - "progress": { - "num_of_steps": 3, - "step": 3 - }, - "resource_id": "resource_id-5494af8c-8c9d-4f8e-a568-d6e86d69d8fd", - "status": "finished", - "time_delta": 0.20732927322387695, - "timestamp": 1525635414.0323067, - "urls": { - "resources": [], - "status": "http://localhost:5000/resources/user/" - "resource_id-5494af8c-8c9d-4f8e-a568-d6e86d69d8fd" - }, - "user_id": "user" - } - - -class VectorCreationModel(Schema): - """Schema for input parameters to generate a random point vector map layer - """ - type = 'object' - properties = { - 'npoints': { - 'type': 'number', - 'format': 'integer', - 'description': 'Number of points to be created', - 'default': 5 - }, - 'seed': { - 'type': 'number', - 'format': 'integer', - 'description': 'The seed to initialize the random generator. ' - 'If not set the process ID is used', - 'default': random.randint(0, 1000000) - }, - 'zmin': { - 'type': 'number', - 'format': 'double', - 'description': 'Minimum z height', - 'default': 0.0 - }, - 'zmax': { - 'type': 'number', - 'format': 'double', - 'description': 'Maximum z height', - 'default': 100.0 - } - } - - -class VectorRegionCreationModel(Schema): - """Schema for random vector generation in a specific region - """ - type = 'object' - properties = { - 'region': SetRegionModel, - 'parameter': VectorCreationModel - } - example = {"region": {"n": 228500, "s": 215000, - "e": 645000, "w": 630000}, - "parameter": {"npoints": 1, "zmin": 1, - "zmax": 1, "seed": 1}} diff --git a/src/actinia_core/rest/api_log_management.py b/src/actinia_core/rest/api_log_management.py index a4b5b1f2e..ba7c3099f 100644 --- a/src/actinia_core/rest/api_log_management.py +++ b/src/actinia_core/rest/api_log_management.py @@ -27,13 +27,12 @@ from flask import g from flask import jsonify, make_response from flask_restful import Resource - from flask_restful_swagger_2 import swagger +from actinia_api.swagger2.actinia_core.schemas.api_log_management import ApiLogListModel from actinia_core.core.common.app import auth from actinia_core.core.common.api_logger import ApiLogger from actinia_core.core.common.api_logger import log_api_call -from actinia_core.models.openapi.api_log_management import ApiLogListModel from actinia_core.models.response_models import SimpleResponseModel from actinia_core.rest.user_auth import check_user_permissions diff --git a/src/actinia_core/rest/location_management.py b/src/actinia_core/rest/location_management.py index 6f3a10081..60190bc09 100644 --- a/src/actinia_core/rest/location_management.py +++ b/src/actinia_core/rest/location_management.py @@ -32,6 +32,9 @@ import shutil import pickle from flask_restful_swagger_2 import swagger +from actinia_api.swagger2.actinia_core.schemas.location_management import LocationListResponseModel +from actinia_api.swagger2.actinia_core.schemas.location_management import ProjectionInfoModel + from actinia_core.core.common.app import auth from actinia_core.core.common.api_logger import log_api_call from actinia_core.rest.user_auth import very_admin_role @@ -39,8 +42,6 @@ from actinia_core.models.response_models import ProcessingResponseModel from actinia_core.models.response_models import SimpleResponseModel from actinia_core.models.response_models import MapsetInfoResponseModel -from actinia_core.models.openapi.location_management import LocationListResponseModel -from actinia_core.models.openapi.location_management import ProjectionInfoModel from actinia_core.rest.resource_base import ResourceBase from actinia_core.rest.persistent_processing import PersistentProcessing from actinia_core.rest.mapset_management import PersistentGetProjectionRegionInfo diff --git a/src/actinia_core/rest/mapset_management.py b/src/actinia_core/rest/mapset_management.py index 01f7fcaaf..6ff280495 100644 --- a/src/actinia_core/rest/mapset_management.py +++ b/src/actinia_core/rest/mapset_management.py @@ -33,6 +33,9 @@ from flask import jsonify, make_response from flask_restful_swagger_2 import swagger import pickle +from actinia_api.swagger2.actinia_core.schemas.mapset_management import \ + MapsetLockManagementResponseModel + from actinia_core.rest.persistent_processing import PersistentProcessing from actinia_core.rest.resource_base import ResourceBase from actinia_core.core.common.app import auth @@ -44,8 +47,6 @@ from actinia_core.models.response_models import ProcessingResponseModel, \ StringListProcessingResultResponseModel, MapsetInfoResponseModel, \ RegionModel, ProcessingErrorResponseModel -from actinia_core.models.openapi.mapset_management import \ - MapsetLockManagementResponseModel # from actinia_core.models.response_models import MapsetInfoModel __license__ = "GPLv3" diff --git a/src/actinia_core/rest/process_chain_monitoring.py b/src/actinia_core/rest/process_chain_monitoring.py index b53919d12..2c96b45fc 100644 --- a/src/actinia_core/rest/process_chain_monitoring.py +++ b/src/actinia_core/rest/process_chain_monitoring.py @@ -31,11 +31,11 @@ from tempfile import NamedTemporaryFile from flask import jsonify, make_response, Response from flask_restful_swagger_2 import swagger +from actinia_api.swagger2.actinia_core.schemas.process_chain_monitoring import \ + MapsetSizeResponseModel, MaxMapsetSizeResponseModel from actinia_core.rest.resource_management import ResourceManager from actinia_core.models.response_models import SimpleResponseModel -from actinia_core.models.openapi.process_chain_monitoring import \ - MapsetSizeResponseModel, MaxMapsetSizeResponseModel __license__ = "GPLv3" __author__ = "Anika Weinmann, Carmen Tawalika" diff --git a/src/actinia_core/rest/raster_colors.py b/src/actinia_core/rest/raster_colors.py index 2cb4d9557..527d6af8a 100644 --- a/src/actinia_core/rest/raster_colors.py +++ b/src/actinia_core/rest/raster_colors.py @@ -29,6 +29,8 @@ from flask_restful_swagger_2 import swagger from flask import jsonify, make_response +from actinia_api.swagger2.actinia_core.schemas.raster_colors import RasterColorModel + from .ephemeral_processing import EphemeralProcessing from .persistent_processing import PersistentProcessing from .resource_base import ResourceBase @@ -39,7 +41,6 @@ from actinia_core.models.response_models import \ ProcessingResponseModel, ProcessingErrorResponseModel, \ StringListProcessingResultResponseModel -from actinia_core.models.openapi.raster_colors import RasterColorModel __license__ = "GPLv3" __author__ = "Sören Gebbert, Carmen Tawalika" diff --git a/src/actinia_core/rest/raster_layer.py b/src/actinia_core/rest/raster_layer.py index 9f626ca23..c1e894c5a 100644 --- a/src/actinia_core/rest/raster_layer.py +++ b/src/actinia_core/rest/raster_layer.py @@ -30,6 +30,8 @@ import pickle from uuid import uuid4 from werkzeug.utils import secure_filename +from actinia_api.swagger2.actinia_core.schemas.raster_layer import \ + RasterInfoResponseModel, RasterInfoModel from actinia_core.core.common.app import URL_PREFIX from actinia_core.rest.ephemeral_processing import EphemeralProcessing @@ -41,8 +43,6 @@ from actinia_core.models.response_models import \ ProcessingResponseModel, ProcessingErrorResponseModel from actinia_core.models.response_models import SimpleResponseModel -from actinia_core.models.openapi.raster_layer import \ - RasterInfoResponseModel, RasterInfoModel __license__ = "GPLv3" __author__ = "Sören Gebbert, Carmen Tawalika, Guido Riembauer, Anika Weinmann" diff --git a/src/actinia_core/rest/strds_management.py b/src/actinia_core/rest/strds_management.py index 2d9874017..4b9773939 100644 --- a/src/actinia_core/rest/strds_management.py +++ b/src/actinia_core/rest/strds_management.py @@ -30,6 +30,9 @@ from flask import jsonify, make_response from flask_restful import reqparse from flask_restful_swagger_2 import swagger +from actinia_api.swagger2.actinia_core.schemas.strds_management import \ + STRDSCreationModel, STRDSInfoModel, STRDSInfoResponseModel + from actinia_core.core.request_parser import where_parser from .persistent_processing import PersistentProcessing from .resource_base import ResourceBase @@ -37,8 +40,6 @@ from actinia_core.core.common.exceptions import AsyncProcessError from actinia_core.models.response_models import ProcessingResponseModel, \ StringListProcessingResultResponseModel, ProcessingErrorResponseModel -from actinia_core.models.openapi.strds_management import \ - STRDSCreationModel, STRDSInfoModel, STRDSInfoResponseModel __license__ = "GPLv3" __author__ = "Sören Gebbert, Carmen Tawalika" diff --git a/src/actinia_core/rest/strds_raster_management.py b/src/actinia_core/rest/strds_raster_management.py index 5bfb4fa9b..8cee7b667 100644 --- a/src/actinia_core/rest/strds_raster_management.py +++ b/src/actinia_core/rest/strds_raster_management.py @@ -30,6 +30,9 @@ from flask import jsonify, make_response import tempfile import pickle +from actinia_api.swagger2.actinia_core.schemas.strds_raster_management import \ + STRDSRasterListResponseModel, RasterListRegisterModel, STRDSRasterListEntryModel + from actinia_core.core.request_parser import where_parser from .persistent_processing import PersistentProcessing from .resource_base import ResourceBase @@ -37,8 +40,6 @@ from actinia_core.core.common.exceptions import AsyncProcessError from actinia_core.models.response_models import \ ProcessingResponseModel, ProcessingErrorResponseModel -from actinia_core.models.openapi.strds_raster_management import \ - STRDSRasterListResponseModel, RasterListRegisterModel, STRDSRasterListEntryModel __license__ = "GPLv3" __author__ = "Sören Gebbert, Carmen Tawalika" diff --git a/src/actinia_core/rest/user_api_key.py b/src/actinia_core/rest/user_api_key.py index 9f5c3b92a..700b6f132 100644 --- a/src/actinia_core/rest/user_api_key.py +++ b/src/actinia_core/rest/user_api_key.py @@ -33,10 +33,11 @@ from flask_restful import reqparse from flask_restful_swagger_2 import swagger from flask import jsonify, make_response, g +from actinia_api.swagger2.actinia_core.schemas.user_api_key import TokenResponseModel + from .base_login import LoginBase from actinia_core.core.common.app import auth from actinia_core.core.common.api_logger import log_api_call -from actinia_core.models.openapi.user_api_key import TokenResponseModel __license__ = "GPLv3" __author__ = "Sören Gebbert, Carmen Tawalika" diff --git a/src/actinia_core/rest/vector_layer.py b/src/actinia_core/rest/vector_layer.py index 88caf37f8..dfa6bdb6f 100644 --- a/src/actinia_core/rest/vector_layer.py +++ b/src/actinia_core/rest/vector_layer.py @@ -32,6 +32,9 @@ from uuid import uuid4 from werkzeug.utils import secure_filename from zipfile import ZipFile +from actinia_api.swagger2.actinia_core.schemas.vector_layer import \ + VectorInfoResponseModel, VectorRegionCreationModel, \ + VectorAttributeModel, VectorInfoModel from actinia_core.core.common.app import URL_PREFIX from actinia_core.core.common.redis_interface import enqueue_job @@ -39,9 +42,6 @@ from actinia_core.core.utils import allowed_file from actinia_core.models.response_models import \ ProcessingResponseModel, ProcessingErrorResponseModel, SimpleResponseModel -from actinia_core.models.openapi.vector_layer import \ - VectorInfoResponseModel, VectorRegionCreationModel, \ - VectorAttributeModel, VectorInfoModel from .ephemeral_processing import EphemeralProcessing from .persistent_processing import PersistentProcessing from .map_layer_base import MapLayerRegionResourceBase From f9c8ed9a4559da6dc8ac0a7cd55db06960e9a4d9 Mon Sep 17 00:00:00 2001 From: Carmen Date: Wed, 24 Nov 2021 16:24:48 +0100 Subject: [PATCH 2/5] add api/v1 hint --- src/actinia_core/models/response_models.py | 24 ++++++++++++++++++++ src/actinia_core/rest/location_management.py | 6 +++-- src/actinia_core/version.py | 21 ++++++++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/actinia_core/models/response_models.py b/src/actinia_core/models/response_models.py index 0f366af0c..e489c8684 100644 --- a/src/actinia_core/models/response_models.py +++ b/src/actinia_core/models/response_models.py @@ -1387,3 +1387,27 @@ class UserInfoResponseModel(Schema): "User id": "actinia-gdi", "User role": "superadmin" } + + +class LinkResponseModel(Schema): + """Response schema that is used in cases that no asynchronous run was performed and the + generated information is very simple. + + """ + type = 'object' + properties = { + 'status': { + 'type': 'string', + 'description': 'The status of the resource, values: accepted, running, ' + 'finished, terminated, error' + }, + 'message': { + 'type': 'string', + 'description': 'A simple message to describes the status of the resource' + }, + 'links': { + 'type': 'list', + 'description': 'A list of related links' + } + } + required = ["status", "message"] diff --git a/src/actinia_core/rest/location_management.py b/src/actinia_core/rest/location_management.py index 60190bc09..451ca40ff 100644 --- a/src/actinia_core/rest/location_management.py +++ b/src/actinia_core/rest/location_management.py @@ -32,8 +32,10 @@ import shutil import pickle from flask_restful_swagger_2 import swagger -from actinia_api.swagger2.actinia_core.schemas.location_management import LocationListResponseModel -from actinia_api.swagger2.actinia_core.schemas.location_management import ProjectionInfoModel +from actinia_api.swagger2.actinia_core.schemas.location_management \ + import LocationListResponseModel +from actinia_api.swagger2.actinia_core.schemas.location_management \ + import ProjectionInfoModel from actinia_core.core.common.app import auth from actinia_core.core.common.api_logger import log_api_call diff --git a/src/actinia_core/version.py b/src/actinia_core/version.py index b78ca7565..cbe43b107 100644 --- a/src/actinia_core/version.py +++ b/src/actinia_core/version.py @@ -31,7 +31,7 @@ __copyright__ = "Copyright 2016-2018, Sören Gebbert and mundialis GmbH & Co. KG" __maintainer__ = "mundialis" -from flask import make_response, jsonify +from flask import make_response, jsonify, request import os import re import importlib @@ -41,6 +41,8 @@ from actinia_core.core.common.app import flask_app, URL_PREFIX from actinia_core.core.common.config import global_config from actinia_core.core.logging_interface import log +from actinia_core.models.response_models import \ + LinkResponseModel from . import __version__ @@ -133,3 +135,20 @@ def version(): info['running_since'] = find_running_since_info() return make_response(jsonify(info), 200) + + +# Return a hint that this version is outdated +@flask_app.route("/api/v1/") +def hint(actinia_path): + """Return a hint that this version is no longer installed. If an older + version is installed, this endpoint will be overwritten by a proxy. + + Returns: Response + + """ + url = request.url_root.strip('/') + URL_PREFIX + '/' + actinia_path + + return make_response(jsonify(LinkResponseModel( + status="Not found", + message="Are you looking for the current api version?", + links=[url]), 404)) From 9b119598ed7849d19ba1bc83da6f3130bb331742 Mon Sep 17 00:00:00 2001 From: Carmen Date: Wed, 24 Nov 2021 17:19:09 +0100 Subject: [PATCH 3/5] fix tests + update plugins --- docker/actinia-core-alpine/Dockerfile | 12 ++++++------ docker/actinia-core-tests/Dockerfile | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docker/actinia-core-alpine/Dockerfile b/docker/actinia-core-alpine/Dockerfile index 885f8f410..d3900bbf9 100644 --- a/docker/actinia-core-alpine/Dockerfile +++ b/docker/actinia-core-alpine/Dockerfile @@ -75,12 +75,12 @@ RUN curl https://api.github.com/repos/mundialis/actinia-metadata-plugin/releases RUN curl https://api.github.com/repos/mundialis/actinia-module-plugin/releases/53928473 > resp.json && \ name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json -# # Get actinia-stac-plugin (53928473 = 2.2.1) -# RUN curl https://api.github.com/repos/mundialis/actinia-module-plugin/releases/53928473 > resp.json && \ -# name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ -# cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json -# Get actinia-api (53922696 = 0.0.1) -RUN curl https://api.github.com/repos/mundialis/actinia-api/releases/53922696 > resp.json && \ +# Get actinia-stac-plugin (54012264 = 0.0.1) +RUN curl https://api.github.com/repos/mundialis/actinia-stac-plugin/releases/54012264 > resp.json && \ + name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ + cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json +# Get actinia-api (54010688 = 2.0.0) +RUN curl https://api.github.com/repos/mundialis/actinia-api/releases/54010688 > resp.json && \ name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json diff --git a/docker/actinia-core-tests/Dockerfile b/docker/actinia-core-tests/Dockerfile index 352fae2e9..4bf82c366 100644 --- a/docker/actinia-core-tests/Dockerfile +++ b/docker/actinia-core-tests/Dockerfile @@ -1,4 +1,4 @@ -FROM mundialis/actinia-core:0.99.26 as actinia_test +FROM mundialis/actinia-core:2.0.0 as actinia_test LABEL authors="Carmen Tawalika,Anika Weinmann" LABEL maintainer="tawalika@mundialis.de,weinmann@mundialis.de" @@ -27,6 +27,8 @@ RUN wget --quiet https://grass.osgeo.org/sampledata/north_carolina/nc_spm_mapset mv modis_lst /actinia_core/grassdb/nc_spm_08/modis_lst RUN chown -R 1001:1001 /actinia_core/grassdb/nc_spm_08/modis_lst && chmod -R g+w /actinia_core/grassdb/nc_spm_08/modis_lst +RUN pip3 install actinia-api@https://github.com/mundialis/actinia-api/releases/download/2.0.0/actinia_api-2.0.0-py3-none-any.whl + # copy needed files and configs for test COPY docker/actinia-core-alpine/actinia.cfg /etc/default/actinia COPY docker/actinia-core-tests/actinia-test.cfg /etc/default/actinia_test From d793c2cab92aef990405cde04da669357986c8f8 Mon Sep 17 00:00:00 2001 From: Carmen Date: Thu, 25 Nov 2021 12:47:34 +0100 Subject: [PATCH 4/5] GR review + ubuntu --- requirements_ubuntu19.txt | 2 ++ src/actinia_core/version.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/requirements_ubuntu19.txt b/requirements_ubuntu19.txt index 65a4059ec..63ce6d943 100644 --- a/requirements_ubuntu19.txt +++ b/requirements_ubuntu19.txt @@ -36,6 +36,8 @@ rq>=0.10.0 uWSGI>=2.0.17 wheel +actinia-api@https://github.com/mundialis/actinia-api/releases/download/2.0.0/actinia_api-2.0.0-py3-none-any.whl + # currently break things - TODO - needed? # pkg-resources==0.0.0 # pycurl==7.43.0.1 diff --git a/src/actinia_core/version.py b/src/actinia_core/version.py index cbe43b107..0e3383be8 100644 --- a/src/actinia_core/version.py +++ b/src/actinia_core/version.py @@ -150,5 +150,6 @@ def hint(actinia_path): return make_response(jsonify(LinkResponseModel( status="Not found", - message="Are you looking for the current api version?", + message=("Are you looking for the current api version? " + "Change 'v1' to 'v2' in the URL."), links=[url]), 404)) From f7738fb85474b9c13fb45842bf9e8f05d22dbffb Mon Sep 17 00:00:00 2001 From: Carmen Date: Thu, 25 Nov 2021 16:09:48 +0100 Subject: [PATCH 5/5] update actinia-module-plugin --- docker/actinia-core-alpine/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/actinia-core-alpine/Dockerfile b/docker/actinia-core-alpine/Dockerfile index d3900bbf9..8c3082caf 100644 --- a/docker/actinia-core-alpine/Dockerfile +++ b/docker/actinia-core-alpine/Dockerfile @@ -71,8 +71,8 @@ RUN curl https://api.github.com/repos/mundialis/actinia_satellite_plugin/release RUN curl https://api.github.com/repos/mundialis/actinia-metadata-plugin/releases/53929141 > resp.json && \ name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json -# Get actinia-module-plugin (53928473 = 2.2.1) -RUN curl https://api.github.com/repos/mundialis/actinia-module-plugin/releases/53928473 > resp.json && \ +# Get actinia-module-plugin (54079558 = 2.2.3) +RUN curl https://api.github.com/repos/mundialis/actinia-module-plugin/releases/54079558 > resp.json && \ name=`cat resp.json | jq '.assets[0].name' | tr -d '"'` && \ cat resp.json | jq '.assets[0].browser_download_url' | xargs curl -L --output /build/$name && rm resp.json # Get actinia-stac-plugin (54012264 = 0.0.1)