Source code for weaver.wps_restapi.swagger_definitions

"""
This module should contain any and every definitions in use to build the swagger UI,
so that one can update the swagger without touching any other files after the initial integration
"""
# pylint: disable=C0103,invalid-name

from typing import TYPE_CHECKING

from colander import DateTime, Email, OneOf, Range, Regex, drop
from cornice import Service

from weaver import __meta__
from weaver.config import WEAVER_CONFIGURATION_EMS
from weaver.execute import (
    EXECUTE_CONTROL_OPTION_ASYNC,
    EXECUTE_CONTROL_OPTIONS,
    EXECUTE_MODE_ASYNC,
    EXECUTE_MODE_AUTO,
    EXECUTE_MODE_OPTIONS,
    EXECUTE_RESPONSE_OPTIONS,
    EXECUTE_RESPONSE_RAW,
    EXECUTE_TRANSMISSION_MODE_OPTIONS,
    EXECUTE_TRANSMISSION_MODE_REFERENCE
)
from weaver.formats import (
    ACCEPT_LANGUAGE_EN_CA,
    ACCEPT_LANGUAGES,
    CONTENT_TYPE_ANY,
    CONTENT_TYPE_APP_JSON,
    CONTENT_TYPE_APP_XML,
    CONTENT_TYPE_TEXT_HTML,
    CONTENT_TYPE_TEXT_PLAIN,
    CONTENT_TYPE_TEXT_XML
)
from weaver.owsexceptions import OWSMissingParameterValue
from weaver.processes.constants import (
    CWL_REQUIREMENT_APP_BUILTIN,
    CWL_REQUIREMENT_APP_DOCKER,
    CWL_REQUIREMENT_APP_DOCKER_GPU,
    CWL_REQUIREMENT_APP_ESGF_CWT,
    CWL_REQUIREMENT_APP_WPS1,
    CWL_REQUIREMENT_INIT_WORKDIR,
    PACKAGE_ARRAY_BASE,
    PACKAGE_ARRAY_ITEMS,
    PACKAGE_CUSTOM_TYPES,
    PACKAGE_ENUM_BASE,
    PACKAGE_TYPE_POSSIBLE_VALUES
)
from weaver.sort import JOB_SORT_VALUES, QUOTE_SORT_VALUES, SORT_CREATED, SORT_ID, SORT_PROCESS
from weaver.status import JOB_STATUS_CATEGORIES, STATUS_ACCEPTED, STATUS_COMPLIANT_OGC
from weaver.visibility import VISIBILITY_PUBLIC, VISIBILITY_VALUES
from weaver.wps_restapi.colander_extras import (
    AnyOfKeywordSchema,
    ExtendedBoolean as Boolean,
    ExtendedFloat as Float,
    ExtendedInteger as Integer,
    ExtendedMappingSchema,
    ExtendedSchemaNode,
    ExtendedSequenceSchema,
    ExtendedString as String,
    NotKeywordSchema,
    OneOfCaseInsensitive,
    OneOfKeywordSchema,
    PermissiveMappingSchema,
    SchemeURL,
    SemanticVersion,
    StringRange
)
from weaver.wps_restapi.utils import wps_restapi_base_path

if TYPE_CHECKING:
    from weaver.typedefs import SettingsType, TypedDict

[docs] ViewInfo = TypedDict("ViewInfo", {"name": str, "pattern": str})
[docs]API_TITLE = "Weaver REST API"
[docs]API_INFO = { "description": __meta__.__description__, "contact": {"name": __meta__.__authors__, "email": __meta__.__emails__, "url": __meta__.__source_repository__}
}
[docs]API_DOCS = { "description": "{} documentation".format(__meta__.__title__), "url": __meta__.__documentation_url__
}
[docs]CWL_VERSION = "v1.1"
[docs]CWL_REPO_URL = "https://github.com/common-workflow-language"
[docs]CWL_BASE_URL = "https://www.commonwl.org"
[docs]CWL_SPEC_URL = "{}/#Specification".format(CWL_BASE_URL)
[docs]CWL_USER_GUIDE_URL = "{}/user_guide".format(CWL_BASE_URL)
[docs]CWL_CMD_TOOL_URL = "{}/{}/CommandLineTool.html".format(CWL_BASE_URL, CWL_VERSION)
[docs]CWL_WORKFLOW_URL = "{}/{}/Workflow.html".format(CWL_BASE_URL, CWL_VERSION)
[docs]CWL_DOC_MESSAGE = ( "Note that multiple formats are supported and not all specification variants or parameters " "are presented here. Please refer to official CWL documentation for more details " "({}).".format(CWL_BASE_URL)
)
[docs]IO_INFO_IDS = ( "Identifier of the {first} {what}. To merge details between corresponding {first} and {second} "
"{what} specifications, this is the value that will be used to associate them together." )
[docs]OGC_API_REPO_URL = "https://github.com/opengeospatial/ogcapi-processes"
[docs]OGC_API_SCHEMA_URL = "https://raw.githubusercontent.com/opengeospatial/ogcapi-processes"
######################################################### # API tags #########################################################
[docs]TAG_API = "API"
[docs]TAG_JOBS = "Jobs"
[docs]TAG_VISIBILITY = "Visibility"
[docs]TAG_BILL_QUOTE = "Billing & Quoting"
[docs]TAG_PROVIDERS = "Providers"
[docs]TAG_PROCESSES = "Processes"
[docs]TAG_GETCAPABILITIES = "GetCapabilities"
[docs]TAG_DESCRIBEPROCESS = "DescribeProcess"
[docs]TAG_EXECUTE = "Execute"
[docs]TAG_DISMISS = "Dismiss"
[docs]TAG_STATUS = "Status"
[docs]TAG_DEPLOY = "Deploy"
[docs]TAG_RESULTS = "Results"
[docs]TAG_EXCEPTIONS = "Exceptions"
[docs]TAG_LOGS = "Logs"
[docs]TAG_WPS = "WPS"
[docs]TAG_DEPRECATED = "Deprecated Endpoints"
############################################################################### # API endpoints # These "services" are wrappers that allow Cornice to generate the JSON API ###############################################################################
[docs]api_frontpage_service = Service(name="api_frontpage", path="/")
[docs]api_openapi_ui_service = Service(name="api_openapi_ui", path="/api") # idem to swagger
[docs]api_swagger_ui_service = Service(name="api_swagger_ui", path="/swagger")
[docs]api_redoc_ui_service = Service(name="api_redoc_ui", path="/redoc")
[docs]api_versions_service = Service(name="api_versions", path="/versions")
[docs]api_conformance_service = Service(name="api_conformance", path="/conformance")
[docs]openapi_json_service = Service(name="openapi_json", path="/json")
[docs]quotes_service = Service(name="quotes", path="/quotations")
[docs]quote_service = Service(name="quote", path=quotes_service.path + "/{quote_id}")
[docs]bills_service = Service(name="bills", path="/bills")
[docs]bill_service = Service(name="bill", path=bills_service.path + "/{bill_id}")
[docs]jobs_service = Service(name="jobs", path="/jobs")
[docs]job_service = Service(name="job", path=jobs_service.path + "/{job_id}")
[docs]job_results_service = Service(name="job_results", path=job_service.path + "/results")
[docs]job_exceptions_service = Service(name="job_exceptions", path=job_service.path + "/exceptions")
[docs]job_outputs_service = Service(name="job_outputs", path=job_service.path + "/outputs")
[docs]job_inputs_service = Service(name="job_inputs", path=job_service.path + "/inputs")
[docs]job_logs_service = Service(name="job_logs", path=job_service.path + "/logs")
[docs]processes_service = Service(name="processes", path="/processes")
[docs]process_service = Service(name="process", path=processes_service.path + "/{process_id}")
[docs]process_quotes_service = Service(name="process_quotes", path=process_service.path + quotes_service.path)
[docs]process_quote_service = Service(name="process_quote", path=process_service.path + quote_service.path)
[docs]process_visibility_service = Service(name="process_visibility", path=process_service.path + "/visibility")
[docs]process_package_service = Service(name="process_package", path=process_service.path + "/package")
[docs]process_payload_service = Service(name="process_payload", path=process_service.path + "/payload")
[docs]process_jobs_service = Service(name="process_jobs", path=process_service.path + jobs_service.path)
[docs]process_job_service = Service(name="process_job", path=process_service.path + job_service.path)
[docs]process_results_service = Service(name="process_results", path=process_service.path + job_results_service.path)
[docs]process_inputs_service = Service(name="process_inputs", path=process_service.path + job_inputs_service.path)
[docs]process_outputs_service = Service(name="process_outputs", path=process_service.path + job_outputs_service.path)
[docs]process_exceptions_service = Service(name="process_exceptions", path=process_service.path + job_exceptions_service.path)
[docs]process_logs_service = Service(name="process_logs", path=process_service.path + job_logs_service.path)
[docs]providers_service = Service(name="providers", path="/providers")
[docs]provider_service = Service(name="provider", path=providers_service.path + "/{provider_id}")
[docs]provider_processes_service = Service(name="provider_processes", path=provider_service.path + processes_service.path)
[docs]provider_process_service = Service(name="provider_process", path=provider_service.path + process_service.path)
[docs]provider_jobs_service = Service(name="provider_jobs", path=provider_service.path + process_jobs_service.path)
[docs]provider_job_service = Service(name="provider_job", path=provider_service.path + process_job_service.path)
[docs]provider_results_service = Service(name="provider_results", path=provider_service.path + process_results_service.path)
[docs]provider_inputs_service = Service(name="provider_inputs", path=provider_service.path + process_inputs_service.path)
[docs]provider_outputs_service = Service(name="provider_outputs", path=provider_service.path + process_outputs_service.path)
[docs]provider_logs_service = Service(name="provider_logs", path=provider_service.path + process_logs_service.path)
[docs]provider_exceptions_service = Service(name="provider_exceptions", path=provider_service.path + process_exceptions_service.path)
# backward compatibility deprecated routes
[docs]job_result_service = Service(name="job_result", path=job_service.path + "/result")
[docs]process_result_service = Service(name="process_result", path=process_service.path + job_result_service.path)
[docs]provider_result_service = Service(name="provider_result", path=provider_service.path + process_result_service.path)
######################################################### # Generic schemas #########################################################
[docs]class SLUG(ExtendedSchemaNode):
[docs] schema_type = String
[docs] description = "Slug name pattern."
[docs] example = "some-object-slug-name"
[docs] pattern = "^[A-Za-z0-9]+(?:(-|_)[A-Za-z0-9]+)*$"
[docs]class URL(ExtendedSchemaNode):
[docs] schema_type = String
[docs] description = "URL reference."
[docs] format = "url"
[docs]class S3Bucket(ExtendedSchemaNode):
[docs] schema_type = String
[docs] description = "S3 bucket shorthand URL representation [s3://<bucket>/<job-uuid>/<output>.ext]"
[docs] pattern = r"^s3://\S+$"
[docs]class FileLocal(ExtendedSchemaNode):
[docs] schema_type = String
[docs] description = "Local file reference."
[docs] format = "file"
[docs] validator = Regex(r"^(file://)?(?:/|[/?]\S+)$")
[docs]class FileURL(ExtendedSchemaNode):
[docs] schema_type = String
[docs] description = "URL file reference."
[docs] format = "url"
[docs] validator = SchemeURL(schemes=["http", "https"])
[docs]class ReferenceURL(AnyOfKeywordSchema):
[docs] _any_of = [ FileURL(), FileLocal(), S3Bucket(),
]
[docs]class UUID(ExtendedSchemaNode):
[docs] schema_type = String
[docs] description = "Unique identifier."
[docs] example = "a9d14bf4-84e0-449a-bac8-16e598efe807"
[docs] format = "uuid"
[docs] title = "UUID"
[docs]class AnyIdentifier(SLUG): pass
[docs]class ProcessIdentifier(AnyOfKeywordSchema):
[docs] description = "Process identifier."
[docs] _any_of = [ # UUID first because more strict than SLUG, and SLUG can be similar to UUID, but in the end any is valid UUID(description="Unique identifier."), SLUG(description="Generic identifier. This is a user-friendly slug-name. " "Note that this will represent the latest process matching this name. " "For specific process version, use the UUID instead.", title="ID"),
]
[docs]class Version(ExtendedSchemaNode): # note: internally use LooseVersion, so don't be too strict about pattern
[docs] schema_type = String
[docs] description = "Version string."
[docs] example = "1.2.3"
[docs] validator = SemanticVersion()
[docs]class ContentTypeHeader(ExtendedSchemaNode): # ok to use 'name' in this case because target 'key' in the mapping must # be that specific value but cannot have a field named with this format
[docs] name = "Content-Type"
[docs] schema_type = String
[docs]class AcceptHeader(ExtendedSchemaNode): # ok to use 'name' in this case because target 'key' in the mapping must # be that specific value but cannot have a field named with this format
[docs] name = "Accept"
[docs] schema_type = String
# FIXME: raise HTTPNotAcceptable in not one of those?
[docs] validator = OneOf([ CONTENT_TYPE_APP_JSON, CONTENT_TYPE_APP_XML, CONTENT_TYPE_TEXT_XML, CONTENT_TYPE_TEXT_HTML, CONTENT_TYPE_TEXT_PLAIN, CONTENT_TYPE_ANY,
])
[docs] missing = drop
[docs] default = CONTENT_TYPE_APP_JSON # defaults to JSON for easy use within browsers
[docs]class AcceptLanguageHeader(ExtendedSchemaNode): # ok to use 'name' in this case because target 'key' in the mapping must # be that specific value but cannot have a field named with this format
[docs] name = "Accept-Language"
[docs] schema_type = String
[docs] missing = drop
[docs] default = ACCEPT_LANGUAGE_EN_CA
# FIXME: oneOf validator for supported languages (?)
[docs]class JsonHeader(ExtendedMappingSchema):
[docs] content_type = ContentTypeHeader(example=CONTENT_TYPE_APP_JSON, default=CONTENT_TYPE_APP_JSON)
[docs]class HtmlHeader(ExtendedMappingSchema):
[docs] content_type = ContentTypeHeader(example=CONTENT_TYPE_TEXT_HTML, default=CONTENT_TYPE_TEXT_HTML)
[docs]class XmlHeader(ExtendedMappingSchema):
[docs] content_type = ContentTypeHeader(example=CONTENT_TYPE_APP_XML, default=CONTENT_TYPE_APP_XML)
[docs]class RequestContentTypeHeader(OneOfKeywordSchema):
[docs] _one_of = [ JsonHeader(), XmlHeader(),
]
[docs]class ResponseContentTypeHeader(OneOfKeywordSchema):
[docs] _one_of = [ JsonHeader(), XmlHeader(), HtmlHeader(),
]
[docs]class RequestHeaders(RequestContentTypeHeader): """Headers that can indicate how to adjust the behavior and/or result the be provided in the response."""
[docs] accept = AcceptHeader()
[docs] accept_language = AcceptLanguageHeader()
[docs]class ResponseHeaders(ResponseContentTypeHeader):
"""Headers describing resulting response."""
[docs]class RedirectHeaders(ResponseHeaders):
[docs] Location = ExtendedSchemaNode(String(), example="https://job/123/result", description="Redirect resource location.")
[docs]class NoContent(ExtendedMappingSchema):
[docs] description = "Empty response body."
[docs] default = {}
[docs]class KeywordList(ExtendedSequenceSchema):
[docs] keyword = ExtendedSchemaNode(String())
[docs]class Language(ExtendedSchemaNode):
[docs] schema_type = String
[docs] example = ACCEPT_LANGUAGE_EN_CA
[docs] validator = OneOf(ACCEPT_LANGUAGES)
[docs]class ValueLanguage(ExtendedMappingSchema):
[docs] lang = Language(missing=drop, description="Language of the value content.")
[docs]class LinkLanguage(ExtendedMappingSchema):
[docs] hreflang = Language(missing=drop, description="Language of the content located at the link.")
[docs]class MetadataBase(ExtendedMappingSchema):
[docs] type = ExtendedSchemaNode(String(), missing=drop)
[docs] title = ExtendedSchemaNode(String(), missing=drop)
[docs]class MetadataRole(ExtendedMappingSchema):
[docs] role = URL(missing=drop)
[docs]class LinkRelationship(ExtendedMappingSchema):
[docs] rel = SLUG(description="Relationship of the link to the current content.")
[docs]class LinkBase(LinkLanguage, MetadataBase):
[docs] href = URL(description="Hyperlink reference.")
[docs]class MetadataValue(NotKeywordSchema, ValueLanguage, MetadataBase):
[docs] _not = [ # make sure value metadata does not allow 'rel' and 'hreflang' reserved for link reference # explicitly refuse them such that when an href/rel link is provided, only link details are possible LinkRelationship(description="Field 'rel' must refer to a link reference with 'href'."), LinkLanguage(description="Field 'hreflang' must refer to a link reference with 'href'."),
]
[docs] value = ExtendedSchemaNode(String(), description="Plain text value of the information.")
[docs]class MetadataContent(OneOfKeywordSchema):
[docs] _one_of = [ Link(title="MetadataLink"), MetadataValue(),
]
[docs]class Metadata(MetadataContent, MetadataRole): pass
[docs]class MetadataList(ExtendedSequenceSchema):
[docs] metadata = Metadata()
[docs]class LandingPage(ExtendedMappingSchema):
[docs]class Format(ExtendedMappingSchema):
[docs] title = "Format"
[docs] mimeType = ExtendedSchemaNode(String())
[docs] schema = ExtendedSchemaNode(String(), missing=drop)
[docs] encoding = ExtendedSchemaNode(String(), missing=drop)
[docs]class FormatDefault(Format): """Format for process input are assumed plain text if the MIME-type was omitted and is not one of the known formats by this instance. When executing a job, the best match will be used to run the process, and will fallback to the default as last resort. """
[docs] mimeType = ExtendedSchemaNode(String(), default=CONTENT_TYPE_TEXT_PLAIN, example=CONTENT_TYPE_APP_JSON)
[docs]class FormatExtra(ExtendedMappingSchema):
[docs] maximumMegabytes = ExtendedSchemaNode(Integer(), missing=drop)
[docs]class FormatDescription(FormatDefault, FormatExtra):
[docs] default = ExtendedSchemaNode( Boolean(), missing=drop, default=False, description=( "Indicates if this format should be considered as the default one in case none of the other "
"allowed or supported formats was matched nor provided as input during job submission." ) )
[docs]class FormatMedia(FormatExtra): """Format employed for reference results respecting 'OGC-API - Processes' schemas."""
[docs] schema_ref = "{}/master/core/openapi/schemas/formatDescription.yaml".format(OGC_API_SCHEMA_URL)
[docs] mediaType = ExtendedSchemaNode(String())
[docs] schema = ExtendedSchemaNode(String(), missing=drop)
[docs] encoding = ExtendedSchemaNode(String(), missing=drop)
[docs]class FormatDescriptionList(ExtendedSequenceSchema):
[docs] format = FormatDescription()
[docs]class AdditionalParameterValuesList(ExtendedSequenceSchema):
[docs] values = ExtendedSchemaNode(String())
[docs]class AdditionalParameter(ExtendedMappingSchema):
[docs] name = ExtendedSchemaNode(String())
[docs] values = AdditionalParameterValuesList()
[docs]class AdditionalParameterList(ExtendedSequenceSchema):
[docs] additionalParameter = AdditionalParameter()
[docs]class AdditionalParametersMeta(LinkBase, MetadataRole): pass
[docs]class AdditionalParameters(ExtendedMappingSchema):
[docs] parameters = AdditionalParameterList()
[docs]class AdditionalParametersItem(AnyOfKeywordSchema):
[docs] _any_of = [ AdditionalParametersMeta(missind=drop), AdditionalParameters()
]
[docs]class AdditionalParametersList(ExtendedSequenceSchema):
[docs] additionalParameter = AdditionalParametersItem()
[docs]class Content(ExtendedMappingSchema):
[docs] href = ReferenceURL(description="URL to CWL file.", title="href", example="http://some.host/applications/cwl/multisensor_ndvi.cwl")
[docs]class Offering(ExtendedMappingSchema):
[docs] code = ExtendedSchemaNode(String(), missing=drop, description="Descriptor of represented information in 'content'.")
[docs] content = Content()
[docs]class OWSContext(ExtendedMappingSchema):
[docs] description = "OGC Web Service definition with references to contained application (see also 'executionUnit')."
[docs] title = "owsContext"
[docs] offering = Offering()
[docs]class DescriptionBase(ExtendedMappingSchema):
[docs] title = ExtendedSchemaNode(String(), missing=drop, description="Short name definition of the process.")
[docs] abstract = ExtendedSchemaNode(String(), missing=drop, description="Detailed explanation of the process operation.")
[docs]class DescriptionOWS(ExtendedMappingSchema):
[docs] owsContext = OWSContext()
[docs]class DescriptionExtra(ExtendedMappingSchema):
[docs] additionalParameters = AdditionalParametersList(missing=drop)
[docs]class DescriptionType(AnyOfKeywordSchema):
[docs] _any_of = [ DescriptionBase(default={}), DescriptionOWS(missing=drop), DescriptionExtra(missing=drop),
]
[docs]class ProcessDescriptionMeta(ExtendedMappingSchema): # employ empty lists by default if nothing is provided for process description
[docs] keywords = KeywordList( default=[], description="Keywords applied to the process for search and categorization purposes.")
[docs] metadata = MetadataList( default=[], description="External references to documentation or metadata sources relevant to the process.")
[docs]class InputOutputDescriptionMeta(ExtendedMappingSchema): # remove unnecessary empty lists by default if nothing is provided for inputs/outputs def __init__(self, *args, **kwargs): super(InputOutputDescriptionMeta, self).__init__(*args, **kwargs) for child in self.children: if child.name in ["keywords", "metadata"]: child.missing = drop
[docs]class MinOccursDefinition(OneOfKeywordSchema):
[docs] description = "Minimum amount of values required for this input."
[docs] title = "MinOccurs"
[docs] example = 1
[docs] _one_of = [ ExtendedSchemaNode(Integer(), validator=Range(min=0)), ExtendedSchemaNode(String(), validator=StringRange(min=0)),
]
[docs]class MaxOccursDefinition(OneOfKeywordSchema):
[docs] description = "Maximum amount of values allowed for this input."
[docs] title = "MaxOccurs"
[docs] example = 1
[docs] _one_of = [ ExtendedSchemaNode(Integer(), validator=Range(min=0)), ExtendedSchemaNode(String(), validator=StringRange(min=0)), ExtendedSchemaNode(String(), validator=OneOf(["unbounded"])),
]
[docs]class WithMinMaxOccurs(ExtendedMappingSchema):
[docs] minOccurs = MinOccursDefinition(missing=drop)
[docs] maxOccurs = MaxOccursDefinition(missing=drop)
[docs]class ProcessDescriptionType(DescriptionType, ProcessDescriptionMeta):
[docs] title = "ProcessDescription"
[docs] id = ProcessIdentifier()
[docs]class InputIdentifierType(ExtendedMappingSchema):
[docs] id = AnyIdentifier(description=IO_INFO_IDS.format(first="WPS", second="CWL", what="input"))
[docs]class OutputIdentifierType(ExtendedMappingSchema):
[docs] id = AnyIdentifier(description=IO_INFO_IDS.format(first="WPS", second="CWL", what="output"))
[docs]class InputDescriptionType(InputIdentifierType, DescriptionType, InputOutputDescriptionMeta): pass
[docs]class OutputDescriptionType(OutputIdentifierType, DescriptionType, InputOutputDescriptionMeta): pass
[docs]class WithFormats(ExtendedMappingSchema):
[docs] formats = FormatDescriptionList()
[docs]class ComplexInputType(WithFormats): pass
[docs]class SupportedCRS(ExtendedMappingSchema):
[docs] crs = URL(title="CRS", description="Coordinate Reference System")
[docs] default = ExtendedSchemaNode(Boolean(), missing=drop)
[docs]class SupportedCRSList(ExtendedSequenceSchema):
[docs] crs = SupportedCRS(title="SupportedCRS")
[docs]class BoundingBoxInputType(ExtendedMappingSchema):
[docs] supportedCRS = SupportedCRSList()
[docs]class LiteralReference(ExtendedMappingSchema):
[docs] reference = ReferenceURL()
[docs]class NameReferenceType(ExtendedMappingSchema):
[docs] schema_ref = "{}/master/core/openapi/schemas/nameReferenceType.yaml".format(OGC_API_SCHEMA_URL)
[docs] name = ExtendedSchemaNode(String())
[docs] reference = ReferenceURL(missing=drop)
[docs]class DataTypeSchema(NameReferenceType):
[docs] description = "Type of the literal data representation."
[docs] title = "DataType"
[docs]class UomSchema(NameReferenceType):
[docs] title = "UnitOfMeasure"
[docs]class AllowedValuesList(ExtendedSequenceSchema):
[docs] allowedValues = ExtendedSchemaNode(String())
[docs]class AllowedValues(ExtendedMappingSchema):
[docs] allowedValues = AllowedValuesList()
[docs]class AllowedRange(ExtendedMappingSchema):
[docs] minimumValue = ExtendedSchemaNode(String(), missing=drop)
[docs] maximumValue = ExtendedSchemaNode(String(), missing=drop)
[docs] spacing = ExtendedSchemaNode(String(), missing=drop)
[docs] rangeClosure = ExtendedSchemaNode(String(), missing=drop, validator=OneOf(["closed", "open", "open-closed", "closed-open"]))
[docs]class AllowedRangesList(ExtendedSequenceSchema):
[docs] allowedRanges = AllowedRange()
[docs]class AllowedRanges(ExtendedMappingSchema):
[docs] allowedRanges = AllowedRangesList()
[docs]class AnyValue(ExtendedMappingSchema):
[docs] anyValue = ExtendedSchemaNode(Boolean(), missing=drop, default=True)
[docs]class ValuesReference(ExtendedMappingSchema):
[docs] valueReference = ReferenceURL()
[docs]class AnyLiteralType(OneOfKeywordSchema): """ .. seealso:: - :class:`AnyLiteralDataType` - :class:`AnyLiteralValueType` - :class:`AnyLiteralDefaultType` """
[docs] _one_of = [ ExtendedSchemaNode(Float()), ExtendedSchemaNode(Integer()), ExtendedSchemaNode(Boolean()), ExtendedSchemaNode(String()),
]
[docs]class AnyLiteralDataType(ExtendedMappingSchema):
[docs] data = AnyLiteralType()
[docs]class AnyLiteralValueType(ExtendedMappingSchema):
[docs] value = AnyLiteralType()
[docs]class AnyLiteralDefaultType(ExtendedMappingSchema):
[docs] default = AnyLiteralType()
[docs]class LiteralDataDomainDefinition(ExtendedMappingSchema):
[docs] default = AnyLiteralDefaultType()
[docs] defaultValue = ExtendedSchemaNode(String(), missing=drop)
[docs] dataType = DataTypeSchema(missing=drop)
[docs] uom = UomSchema(missing=drop)
[docs]class LiteralDataDomainConstraints(OneOfKeywordSchema, LiteralDataDomainDefinition):
[docs] _one_of = [ AllowedValues, AllowedRanges, ValuesReference, AnyValue, # must be last because it"s the most permissive (always valid, default)
]
[docs]class LiteralDataDomainList(ExtendedSequenceSchema):
[docs] literalDataDomain = LiteralDataDomainConstraints()
[docs]class LiteralInputType(NotKeywordSchema, ExtendedMappingSchema):
[docs] _not = [ WithFormats,
]
[docs] literalDataDomains = LiteralDataDomainList(missing=drop)
[docs]class InputTypeDefinition(OneOfKeywordSchema):
[docs] _one_of = [ # NOTE: # LiteralInputType could be used to represent a complex input if the 'format' is missing in # process deployment definition but is instead provided in CWL definition. # This use case is still valid because 'format' can be inferred from the combining Process/CWL contents. BoundingBoxInputType, ComplexInputType, # should be 2nd to last because very permissive, but requires format at least LiteralInputType, # must be last because it"s the most permissive (all can default if omitted)
]
[docs]class InputType(AnyOfKeywordSchema):
[docs] _any_of = [ InputDescriptionType(), InputTypeDefinition(), WithMinMaxOccurs(),
]
[docs]class InputTypeList(ExtendedSequenceSchema):
[docs] input = InputType()
[docs]class LiteralOutputType(NotKeywordSchema, ExtendedMappingSchema):
[docs] _not = [ WithFormats,
]
[docs] literalDataDomains = LiteralDataDomainList(missing=drop)
[docs]class BoundingBoxOutputType(ExtendedMappingSchema):
[docs] supportedCRS = SupportedCRSList()
[docs]class ComplexOutputType(WithFormats): pass
[docs]class OutputTypeDefinition(OneOfKeywordSchema):
[docs] _one_of = [ BoundingBoxOutputType, ComplexOutputType, # should be 2nd to last because very permissive, but requires format at least LiteralOutputType, # must be last because it's the most permissive (all can default if omitted)
]
[docs]class OutputType(AnyOfKeywordSchema):
[docs] _any_of = [ OutputTypeDefinition(), OutputDescriptionType(),
]
[docs]class OutputDescriptionList(ExtendedSequenceSchema):
[docs] output = OutputType()
[docs]class JobExecuteModeEnum(ExtendedSchemaNode):
[docs] schema_type = String
def __init__(self, *_, **kwargs): kwargs.pop("validator", None) # ignore passed argument and enforce the validator super(JobExecuteModeEnum, self).__init__( self.schema_type(), title=kwargs.get("title", "mode"), default=kwargs.get("default", EXECUTE_MODE_AUTO), example=kwargs.get("example", EXECUTE_MODE_ASYNC), validator=OneOf(EXECUTE_MODE_OPTIONS), **kwargs)
[docs]class JobControlOptionsEnum(ExtendedSchemaNode):
[docs] schema_type = String
def __init__(self, *_, **kwargs): kwargs.pop("validator", None) # ignore passed argument and enforce the validator super(JobControlOptionsEnum, self).__init__( self.schema_type(), title="jobControlOptions", default=kwargs.get("default", EXECUTE_CONTROL_OPTION_ASYNC), example=kwargs.get("example", EXECUTE_CONTROL_OPTION_ASYNC), validator=OneOf(EXECUTE_CONTROL_OPTIONS), **kwargs)
[docs]class JobResponseOptionsEnum(ExtendedSchemaNode):
[docs] schema_type = String
def __init__(self, *_, **kwargs): kwargs.pop("validator", None) # ignore passed argument and enforce the validator super(JobResponseOptionsEnum, self).__init__( self.schema_type(), title=kwargs.get("title", "response"), default=kwargs.get("default", EXECUTE_RESPONSE_RAW), example=kwargs.get("example", EXECUTE_RESPONSE_RAW), validator=OneOf(EXECUTE_RESPONSE_OPTIONS), **kwargs)
[docs]class TransmissionModeEnum(ExtendedSchemaNode):
[docs] schema_type = String
def __init__(self, *_, **kwargs): kwargs.pop("validator", None) # ignore passed argument and enforce the validator super(TransmissionModeEnum, self).__init__( self.schema_type(), title=kwargs.get("title", "transmissionMode"), default=kwargs.get("default", EXECUTE_TRANSMISSION_MODE_REFERENCE), example=kwargs.get("example", EXECUTE_TRANSMISSION_MODE_REFERENCE), validator=OneOf(EXECUTE_TRANSMISSION_MODE_OPTIONS), **kwargs)
[docs]class JobStatusEnum(ExtendedSchemaNode):
[docs] schema_type = String
def __init__(self, *_, **kwargs): kwargs.pop("validator", None) # ignore passed argument and enforce the validator super(JobStatusEnum, self).__init__( self.schema_type(), default=kwargs.get("default", None), example=kwargs.get("example", STATUS_ACCEPTED), validator=OneOf(JOB_STATUS_CATEGORIES[STATUS_COMPLIANT_OGC]), **kwargs)
[docs]class JobSortEnum(ExtendedSchemaNode):
[docs] schema_type = String
def __init__(self, *_, **kwargs): kwargs.pop("validator", None) # ignore passed argument and enforce the validator super(JobSortEnum, self).__init__( String(), default=kwargs.get("default", SORT_CREATED), example=kwargs.get("example", SORT_CREATED), validator=OneOf(JOB_SORT_VALUES), **kwargs)
[docs]class QuoteSortEnum(ExtendedSchemaNode):
[docs] schema_type = String
def __init__(self, *_, **kwargs): kwargs.pop("validator", None) # ignore passed argument and enforce the validator super(QuoteSortEnum, self).__init__( self.schema_type(), default=kwargs.get("default", SORT_ID), example=kwargs.get("example", SORT_PROCESS), validator=OneOf(QUOTE_SORT_VALUES), **kwargs)
[docs]class LaunchJobQuerystring(ExtendedMappingSchema):
[docs] tags = ExtendedSchemaNode(String(), default=None, missing=drop, description="Comma separated tags that can be used to filter jobs later")
[docs]class VisibilityValue(ExtendedSchemaNode):
[docs] schema_type = String
[docs] validator = OneOf(VISIBILITY_VALUES)
[docs] example = VISIBILITY_PUBLIC
[docs]class Visibility(ExtendedMappingSchema):
[docs] value = VisibilityValue()
######################################################### # Path parameter definitions #########################################################
[docs]class ProcessPath(ExtendedMappingSchema): # FIXME: support versioning with <id:tag> (https://github.com/crim-ca/weaver/issues/107)
[docs] process_id = AnyIdentifier(description="The process identifier.")
[docs]class ProviderPath(ExtendedMappingSchema):
[docs] provider_id = AnyIdentifier(description="The provider identifier")
[docs]class JobPath(ExtendedMappingSchema):
[docs] job_id = UUID(description="The job id")
[docs]class BillPath(ExtendedMappingSchema):
[docs] bill_id = UUID(description="The bill id")
[docs]class QuotePath(ExtendedMappingSchema):
[docs] quote_id = UUID(description="The quote id")
[docs]class ResultPath(ExtendedMappingSchema):
[docs] result_id = UUID(description="The result id")
######################################################### # These classes define each of the endpoints parameters #########################################################
[docs]class FrontpageEndpoint(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs]class VersionsEndpoint(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs]class ConformanceEndpoint(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs]class OpenAPIEndpoint(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs]class SwaggerUIEndpoint(ExtendedMappingSchema): pass
[docs]class RedocUIEndpoint(ExtendedMappingSchema): pass
[docs]class WPSParameters(ExtendedMappingSchema):
[docs] service = ExtendedSchemaNode(String(), example="WPS", description="Service selection.", validator=OneOfCaseInsensitive(["WPS"]))
[docs] request = ExtendedSchemaNode(String(), example="GetCapabilities", description="WPS operation to accomplish", validator=OneOfCaseInsensitive(["GetCapabilities", "DescribeProcess", "Execute"]))
[docs] version = Version(exaple="1.0.0", default="1.0.0", validator=OneOf(["1.0.0", "2.0.0", "2.0"]))
[docs] identifier = ExtendedSchemaNode(String(), exaple="hello", description="Process identifier.", missing=drop)
[docs] data_inputs = ExtendedSchemaNode(String(), name="DataInputs", missing=drop, example="message=hi", description="Process execution inputs provided as Key-Value Pairs (KVP).")
[docs]class WPSBody(ExtendedMappingSchema):
[docs] content = ExtendedSchemaNode(String(), description="XML data inputs provided for WPS POST request.")
[docs]class WPSHeaders(ExtendedMappingSchema):
[docs] accept = AcceptHeader(missing=drop)
[docs]class WPSEndpoint(ExtendedMappingSchema):
[docs] header = WPSHeaders()
[docs] querystring = WPSParameters()
[docs] body = WPSBody()
[docs]class WPSXMLSuccessBodySchema(ExtendedMappingSchema): pass
[docs]class OkWPSResponse(ExtendedMappingSchema):
[docs] description = "WPS operation successful"
[docs] header = XmlHeader()
[docs] body = WPSXMLSuccessBodySchema()
[docs]class WPSXMLErrorBodySchema(ExtendedMappingSchema): pass
[docs]class ErrorWPSResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred on WPS endpoint."
[docs] header = XmlHeader()
[docs] body = WPSXMLErrorBodySchema()
[docs]class ProviderEndpoint(ProviderPath):
[docs] header = RequestHeaders()
[docs]class ProviderProcessEndpoint(ProviderPath, ProcessPath):
[docs] header = RequestHeaders()
[docs]class ProcessEndpoint(ProcessPath):
[docs] header = RequestHeaders()
[docs]class ProcessPackageEndpoint(ProcessPath):
[docs] header = RequestHeaders()
[docs]class ProcessPayloadEndpoint(ProcessPath):
[docs] header = RequestHeaders()
[docs]class ProcessVisibilityGetEndpoint(ProcessPath):
[docs] header = RequestHeaders()
[docs]class ProcessVisibilityPutEndpoint(ProcessPath):
[docs] header = RequestHeaders()
[docs] body = Visibility()
[docs]class ProviderJobEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class JobEndpoint(JobPath):
[docs] header = RequestHeaders()
[docs]class ProcessInputsEndpoint(ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class ProviderInputsEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class JobInputsEndpoint(JobPath):
[docs] header = RequestHeaders()
[docs]class ProcessOutputsEndpoint(ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class ProviderOutputsEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class JobOutputsEndpoint(JobPath):
[docs] header = RequestHeaders()
[docs]class ProcessResultEndpoint(ProcessOutputsEndpoint):
[docs] deprecated = True
[docs] header = RequestHeaders()
[docs]class ProviderResultEndpoint(ProviderOutputsEndpoint):
[docs] deprecated = True
[docs] header = RequestHeaders()
[docs]class JobResultEndpoint(JobOutputsEndpoint):
[docs] deprecated = True
[docs] header = RequestHeaders()
[docs]class ProcessResultsEndpoint(ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class ProviderResultsEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class JobResultsEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class ProviderExceptionsEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class JobExceptionsEndpoint(JobPath):
[docs] header = RequestHeaders()
[docs]class ProcessExceptionsEndpoint(ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class ProviderLogsEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = RequestHeaders()
[docs]class JobLogsEndpoint(JobPath):
[docs] header = RequestHeaders()
[docs]class ProcessLogsEndpoint(ProcessPath, JobPath):
[docs] header = RequestHeaders()
################################################################## # These classes define schemas for requests that feature a body ##################################################################
[docs]class CreateProviderRequestBody(ExtendedMappingSchema):
[docs] id = AnyIdentifier()
[docs] url = URL(description="Endpoint where to query the provider.")
[docs] public = ExtendedSchemaNode(Boolean())
[docs]class InputDataType(InputIdentifierType): pass
[docs]class OutputDataType(OutputIdentifierType):
[docs] format = Format(missing=drop)
[docs]class Output(OutputDataType):
[docs] transmissionMode = TransmissionModeEnum(missing=drop)
[docs]class OutputList(ExtendedSequenceSchema):
[docs] output = Output()
[docs]class ProviderSummarySchema(ExtendedMappingSchema): """WPS provider summary definition."""
[docs] id = ExtendedSchemaNode(String())
[docs] url = URL(description="Endpoint of the provider.")
[docs] title = ExtendedSchemaNode(String())
[docs] abstract = ExtendedSchemaNode(String())
[docs] public = ExtendedSchemaNode(Boolean())
[docs]class ProviderCapabilitiesSchema(ExtendedMappingSchema): """WPS provider capabilities."""
[docs] id = ExtendedSchemaNode(String())
[docs] url = URL(description="WPS GetCapabilities URL of the provider.")
[docs] title = ExtendedSchemaNode(String())
[docs] abstract = ExtendedSchemaNode(String())
[docs] contact = ExtendedSchemaNode(String())
[docs] type = ExtendedSchemaNode(String())
[docs]class TransmissionModeList(ExtendedSequenceSchema):
[docs] transmissionMode = TransmissionModeEnum(missing=drop)
[docs]class JobControlOptionsList(ExtendedSequenceSchema):
[docs] jobControlOption = JobControlOptionsEnum(missing=drop)
[docs]class ExceptionReportType(ExtendedMappingSchema):
[docs] code = ExtendedSchemaNode(String())
[docs] description = ExtendedSchemaNode(String(), missing=drop)
[docs]class ProcessSummary(ProcessDescriptionType): """WPS process definition."""
[docs] version = Version(missing=drop)
[docs] jobControlOptions = JobControlOptionsList(missing=drop)
[docs] outputTransmission = TransmissionModeList(missing=drop)
[docs] processDescriptionURL = URL(description="Process description endpoint.", missing=drop, title="processDescriptionURL")
[docs]class ProcessSummaryList(ExtendedSequenceSchema):
[docs] processSummary = ProcessSummary()
[docs]class ProcessCollection(ExtendedMappingSchema):
[docs] processes = ProcessSummaryList()
[docs]class Process(ProcessDescriptionType):
[docs] title = "Process"
[docs] inputs = InputTypeList(missing=drop)
[docs] outputs = OutputDescriptionList(missing=drop)
[docs] visibility = VisibilityValue(missing=drop)
[docs] executeEndpoint = URL(description="Endpoint where the process can be executed from.", missing=drop)
[docs]class ProcessOutputDescriptionSchema(ExtendedMappingSchema): """WPS process output definition."""
[docs] dataType = ExtendedSchemaNode(String())
[docs] defaultValue = ExtendedMappingSchema()
[docs] id = ExtendedSchemaNode(String())
[docs] abstract = ExtendedSchemaNode(String())
[docs] title = ExtendedSchemaNode(String())
[docs]class JobStatusInfo(ExtendedMappingSchema):
[docs] jobID = UUID(example="a9d14bf4-84e0-449a-bac8-16e598efe807", description="ID of the job.")
[docs] status = JobStatusEnum(description="Last updated status.")
[docs] message = ExtendedSchemaNode(String(), missing=drop, description="Information about the last status update.")
[docs] created = ExtendedSchemaNode(DateTime(), missing=drop, default=None, description="Timestamp when the process execution job was created.")
[docs] started = ExtendedSchemaNode(DateTime(), missing=drop, default=None, description="Timestamp when the process started execution if applicable.")
[docs] finished = ExtendedSchemaNode(DateTime(), missing=drop, default=None, description="Timestamp when the process completed execution if applicable.")
# note: using String instead of Time because timedelta object cannot be directly handled (missing parts at parsing)
[docs] duration = ExtendedSchemaNode(String(), missing=drop, description="Duration since the start of the process execution.")
[docs] runningSeconds = ExtendedSchemaNode(Integer(), missing=drop, description="Duration in seconds since the start of the process execution.")
[docs] expirationDate = ExtendedSchemaNode(DateTime(), missing=drop, description="Timestamp when the job will be canceled if not yet completed.")
[docs] estimatedCompletion = ExtendedSchemaNode(DateTime(), missing=drop)
[docs] nextPoll = ExtendedSchemaNode(DateTime(), missing=drop, description="Timestamp when the job will prompted for updated status details.")
[docs] percentCompleted = ExtendedSchemaNode(Integer(), example=0, validator=Range(min=0, max=100), description="Completion percentage of the job as indicated by the process.")
[docs]class JobEntrySchema(OneOfKeywordSchema): # note: # Since JobID is a simple string (not a dict), no additional mapping field can be added here. # They will be discarded by `OneOfKeywordSchema.deserialize()`.
[docs] _one_of = [ JobStatusInfo, ExtendedSchemaNode(String(), description="Job ID."),
]
[docs]class JobCollection(ExtendedSequenceSchema):
[docs] item = JobEntrySchema()
[docs]class CreatedJobStatusSchema(ExtendedMappingSchema):
[docs] status = ExtendedSchemaNode(String(), example=STATUS_ACCEPTED)
[docs] location = ExtendedSchemaNode(String(), example="http://{host}/weaver/processes/{my-process-id}/jobs/{my-job-id}")
[docs] jobID = UUID(description="ID of the created job.")
[docs]class CreatedQuotedJobStatusSchema(CreatedJobStatusSchema):
[docs] bill = UUID(description="ID of the created bill.")
[docs]class GetPagingJobsSchema(ExtendedMappingSchema):
[docs] jobs = JobCollection()
[docs] limit = ExtendedSchemaNode(Integer(), default=10)
[docs] page = ExtendedSchemaNode(Integer(), validator=Range(min=0))
[docs]class JobCategoryFilters(PermissiveMappingSchema):
[docs] category = ExtendedSchemaNode(String(), title="CategoryFilter", variable="<category>", default=None, missing=None, description="Value of the corresponding parameter forming that category group.")
[docs]class GroupedJobsCategorySchema(ExtendedMappingSchema):
[docs] category = JobCategoryFilters(description="Grouping values that compose the corresponding job list category.")
[docs] jobs = JobCollection(description="List of jobs that matched the corresponding grouping values.")
[docs] count = ExtendedSchemaNode(Integer(), description="Number of matching jobs for the corresponding group category.")
[docs]class GroupedCategoryJobsSchema(ExtendedSequenceSchema):
[docs] job_group_category_item = GroupedJobsCategorySchema()
[docs]class GetGroupedJobsSchema(ExtendedMappingSchema):
[docs] groups = GroupedCategoryJobsSchema()
[docs]class GetQueriedJobsSchema(OneOfKeywordSchema):
[docs] _one_of = [ GetPagingJobsSchema, GetGroupedJobsSchema,
]
[docs] total = ExtendedSchemaNode(Integer(), description="Total number of matched jobs regardless of grouping or paging result.")
[docs]class DismissedJobSchema(ExtendedMappingSchema):
[docs] status = JobStatusEnum()
[docs] jobID = UUID(description="ID of the job.")
[docs] message = ExtendedSchemaNode(String(), example="Job dismissed.")
[docs] percentCompleted = ExtendedSchemaNode(Integer(), example=0)
[docs]class QuoteProcessParametersSchema(ExtendedMappingSchema):
[docs] inputs = InputTypeList(missing=drop)
[docs] outputs = OutputDescriptionList(missing=drop)
[docs] mode = JobExecuteModeEnum(missing=drop)
[docs] response = JobResponseOptionsEnum(missing=drop)
[docs]class AlternateQuotation(ExtendedMappingSchema):
[docs] id = UUID(description="Quote ID.")
[docs] title = ExtendedSchemaNode(String(), description="Name of the quotation.", missing=drop)
[docs] description = ExtendedSchemaNode(String(), description="Description of the quotation.", missing=drop)
[docs] price = ExtendedSchemaNode(Float(), description="Process execution price.")
[docs] currency = ExtendedSchemaNode(String(), description="Currency code in ISO-4217 format.")
[docs] expire = ExtendedSchemaNode(DateTime(), description="Expiration date and time of the quote in ISO-8601 format.")
[docs] created = ExtendedSchemaNode(DateTime(), description="Creation date and time of the quote in ISO-8601 format.")
[docs] details = ExtendedSchemaNode(String(), description="Details of the quotation.", missing=drop)
[docs] estimatedTime = ExtendedSchemaNode(String(), description="Estimated process execution duration.", missing=drop)
[docs]class AlternateQuotationList(ExtendedSequenceSchema):
[docs] step = AlternateQuotation(description="Quote of a workflow step process.")
# same as base Format, but for process/job responses instead of process submission # (ie: 'Format' is for allowed/supported formats, this is the result format)
[docs]class DataEncodingAttributes(Format): pass
[docs]class Reference(ExtendedMappingSchema):
[docs] title = "Reference"
[docs] href = ReferenceURL(description="Endpoint of the reference.")
[docs] format = DataEncodingAttributes(missing=drop)
[docs] body = ExtendedSchemaNode(String(), missing=drop)
[docs] bodyReference = ReferenceURL(missing=drop)
[docs]class AnyType(OneOfKeywordSchema): """Permissive variants that we attempt to parse automatically."""
[docs] _one_of = [ # literal data with 'data' key AnyLiteralDataType(), # same with 'value' key (OGC specification) AnyLiteralValueType(), # HTTP references with various keywords LiteralReference(), Reference(),
]
[docs]class Input(InputDataType, AnyType):
""" Default value to be looked for uses key 'value' to conform to OGC API standard. We still look for 'href', 'data' and 'reference' to remain back-compatible. """
[docs]class InputList(ExtendedSequenceSchema):
[docs] input = Input(missing=drop, description="Received input definition during job submission.")
[docs]class Execute(ExtendedMappingSchema):
[docs] inputs = InputList(missing=drop)
[docs] outputs = OutputList()
[docs] mode = ExtendedSchemaNode(String(), validator=OneOf(EXECUTE_MODE_OPTIONS))
[docs] notification_email = ExtendedSchemaNode( String(), missing=drop, validator=Email(), description="Optionally send a notification email when the job is done.")
[docs] response = ExtendedSchemaNode(String(), validator=OneOf(EXECUTE_RESPONSE_OPTIONS))
[docs]class Quotation(ExtendedMappingSchema):
[docs] id = UUID(description="Quote ID.")
[docs] title = ExtendedSchemaNode(String(), description="Name of the quotation.", missing=drop)
[docs] description = ExtendedSchemaNode(String(), description="Description of the quotation.", missing=drop)
[docs] processId = UUID(description="Corresponding process ID.")
[docs] price = ExtendedSchemaNode(Float(), description="Process execution price.")
[docs] currency = ExtendedSchemaNode(String(), description="Currency code in ISO-4217 format.")
[docs] expire = ExtendedSchemaNode(DateTime(), description="Expiration date and time of the quote in ISO-8601 format.")
[docs] created = ExtendedSchemaNode(DateTime(), description="Creation date and time of the quote in ISO-8601 format.")
[docs] userId = UUID(description="User id that requested the quote.")
[docs] details = ExtendedSchemaNode(String(), description="Details of the quotation.", missing=drop)
[docs] estimatedTime = ExtendedSchemaNode(DateTime(), missing=drop, description="Estimated duration of the process execution.")
[docs] processParameters = Execute(title="ProcessExecuteParameters")
[docs] alternativeQuotations = AlternateQuotationList(missing=drop)
[docs]class QuoteProcessListSchema(ExtendedSequenceSchema):
[docs] step = Quotation(description="Quote of a workflow step process.")
[docs]class QuoteSchema(ExtendedMappingSchema):
[docs] id = UUID(description="Quote ID.")
[docs] process = AnyIdentifier(description="Corresponding process ID.")
[docs] steps = QuoteProcessListSchema(description="Child processes and prices.")
[docs] total = ExtendedSchemaNode(Float(), description="Total of the quote including step processes.")
[docs]class QuotationList(ExtendedSequenceSchema):
[docs] quote = ExtendedSchemaNode(String(), description="Quote ID.")
[docs]class QuotationListSchema(ExtendedMappingSchema):
[docs] quotations = QuotationList()
[docs]class BillSchema(ExtendedMappingSchema):
[docs] id = UUID(description="Bill ID.")
[docs] title = ExtendedSchemaNode(String(), description="Name of the bill.")
[docs] description = ExtendedSchemaNode(String(), missing=drop)
[docs] price = ExtendedSchemaNode(Float(), description="Price associated to the bill.")
[docs] currency = ExtendedSchemaNode(String(), description="Currency code in ISO-4217 format.")
[docs] created = ExtendedSchemaNode(DateTime(), description="Creation date and time of the bill in ISO-8601 format.")
[docs] userId = ExtendedSchemaNode(Integer(), description="User id that requested the quote.")
[docs] quotationId = UUID(description="Corresponding quote ID.", missing=drop)
[docs]class BillList(ExtendedSequenceSchema):
[docs] bill = ExtendedSchemaNode(String(), description="Bill ID.")
[docs]class BillListSchema(ExtendedMappingSchema):
[docs] bills = BillList()
[docs]class SupportedValues(ExtendedMappingSchema): pass
[docs]class DefaultValues(ExtendedMappingSchema): pass
[docs]class CWLClass(ExtendedSchemaNode): # in this case it is ok to use 'name' because target fields receiving it will # never be able to be named 'class' because of Python reserved keyword
[docs] name = "class"
[docs] title = "Class"
[docs] schema_type = String
[docs] example = "CommandLineTool"
[docs] validator = OneOf(["CommandLineTool", "ExpressionTool", "Workflow"])
[docs] description = ( "CWL class specification. This is used to differentiate between single Application Package (AP)"
"definitions and Workflow that chains multiple packages." )
[docs]class RequirementClass(ExtendedSchemaNode): # in this case it is ok to use 'name' because target fields receiving it will # never be able to be named 'class' because of Python reserved keyword
[docs] name = "class"
[docs] title = "RequirementClass"
[docs] schema_type = String
[docs] description = "CWL requirement class specification."
[docs]class DockerRequirementSpecification(PermissiveMappingSchema):
[docs] dockerPull = ExtendedSchemaNode( String(), example="docker-registry.host.com/namespace/image:1.2.3", title="Docker pull reference", description="Reference package that will be retrieved and executed by CWL."
)
[docs]class DockerRequirementMap(ExtendedMappingSchema):
[docs] DockerRequirement = DockerRequirementSpecification( name=CWL_REQUIREMENT_APP_DOCKER, title=CWL_REQUIREMENT_APP_DOCKER
)
[docs]class DockerRequirementClass(DockerRequirementSpecification):
[docs] _class = RequirementClass(example=CWL_REQUIREMENT_APP_DOCKER, validator=OneOf([CWL_REQUIREMENT_APP_DOCKER]))
[docs]class DockerGpuRequirementSpecification(DockerRequirementSpecification):
[docs] description = ( "Docker requirement with GPU-enabled support (https://github.com/NVIDIA/nvidia-docker). "
"The instance must have the NVIDIA toolkit installed to use this feature." )
[docs]class DockerGpuRequirementMap(ExtendedMappingSchema):
[docs] req = DockerGpuRequirementSpecification(name=CWL_REQUIREMENT_APP_DOCKER_GPU)
[docs]class DockerGpuRequirementClass(DockerGpuRequirementSpecification):
[docs] title = CWL_REQUIREMENT_APP_DOCKER_GPU
[docs] _class = RequirementClass(example=CWL_REQUIREMENT_APP_DOCKER_GPU, validator=OneOf([CWL_REQUIREMENT_APP_DOCKER_GPU]))
[docs]class DirectoryListing(PermissiveMappingSchema):
[docs] entry = ExtendedSchemaNode(String(), missing=drop)
[docs]class InitialWorkDirListing(ExtendedSequenceSchema):
[docs] listing = DirectoryListing()
[docs]class InitialWorkDirRequirementSpecification(PermissiveMappingSchema):
[docs] listing = InitialWorkDirListing()
[docs]class InitialWorkDirRequirementMap(ExtendedMappingSchema):
[docs] req = InitialWorkDirRequirementSpecification(name=CWL_REQUIREMENT_INIT_WORKDIR)
[docs]class InitialWorkDirRequirementClass(InitialWorkDirRequirementSpecification):
[docs] _class = RequirementClass(example=CWL_REQUIREMENT_INIT_WORKDIR, validator=OneOf([CWL_REQUIREMENT_INIT_WORKDIR]))
[docs]class BuiltinRequirementSpecification(PermissiveMappingSchema):
[docs] title = CWL_REQUIREMENT_APP_BUILTIN
[docs] description = ( "Hint indicating that the Application Package corresponds to a builtin process of "
"this instance. (note: can only be an 'hint' as it is unofficial CWL specification)." )
[docs] process = AnyIdentifier(description="Builtin process identifier.")
[docs]class BuiltinRequirementMap(ExtendedMappingSchema):
[docs] req = BuiltinRequirementSpecification(name=CWL_REQUIREMENT_APP_BUILTIN)
[docs]class BuiltinRequirementClass(BuiltinRequirementSpecification):
[docs] _class = RequirementClass(example=CWL_REQUIREMENT_APP_BUILTIN, validator=OneOf([CWL_REQUIREMENT_APP_BUILTIN]))
[docs]class ESGF_CWT_RequirementSpecification(PermissiveMappingSchema):
[docs] title = CWL_REQUIREMENT_APP_ESGF_CWT
[docs] description = ( "Hint indicating that the Application Package corresponds to an ESGF-CWT provider process"
"that should be remotely executed and monitored by this instance. " "(note: can only be an 'hint' as it is unofficial CWL specification)." )
[docs] process = AnyIdentifier(description="Process identifier of the remote ESGF-CWT provider.")
[docs] provider = AnyIdentifier(description="ESGF-CWT provider endpoint.")
[docs]class ESGF_CWT_RequirementMap(ExtendedMappingSchema):
[docs] req = ESGF_CWT_RequirementSpecification(name=CWL_REQUIREMENT_APP_ESGF_CWT)
[docs]class ESGF_CWT_RequirementClass(ESGF_CWT_RequirementSpecification):
[docs] _class = RequirementClass(example=CWL_REQUIREMENT_APP_ESGF_CWT, validator=OneOf([CWL_REQUIREMENT_APP_ESGF_CWT]))
[docs]class WPS1RequirementSpecification(PermissiveMappingSchema):
[docs] title = CWL_REQUIREMENT_APP_WPS1
[docs] description = ( "Hint indicating that the Application Package corresponds to a WPS-1 provider process"
"that should be remotely executed and monitored by this instance. " "(note: can only be an 'hint' as it is unofficial CWL specification)." )
[docs] process = AnyIdentifier(description="Process identifier of the remote WPS provider.")
[docs] provider = AnyIdentifier(description="WPS provider endpoint.")
[docs]class WPS1RequirementMap(ExtendedMappingSchema):
[docs] req = WPS1RequirementSpecification(name=CWL_REQUIREMENT_APP_WPS1)
[docs]class WPS1RequirementClass(WPS1RequirementSpecification):
[docs] _class = RequirementClass(example=CWL_REQUIREMENT_APP_WPS1, validator=OneOf([CWL_REQUIREMENT_APP_WPS1]))
[docs]class UnknownRequirementClass(PermissiveMappingSchema):
[docs] _class = RequirementClass(example="UnknownRequirement")
[docs]class CWLRequirementsMap(AnyOfKeywordSchema):
[docs] _any_of = [ DockerRequirementMap(missing=drop), DockerGpuRequirementMap(missing=drop), InitialWorkDirRequirementMap(missing=drop), PermissiveMappingSchema(missing=drop),
]
[docs]class CWLRequirementsItem(OneOfKeywordSchema):
[docs] _one_of = [ DockerRequirementClass(missing=drop), DockerGpuRequirementClass(missing=drop), InitialWorkDirRequirementClass(missing=drop), UnknownRequirementClass(missing=drop), # allows anything, must be last
]
[docs]class CWLRequirementsList(ExtendedSequenceSchema):
[docs] requirement = CWLRequirementsItem()
[docs]class CWLRequirements(OneOfKeywordSchema):
[docs] _one_of = [ CWLRequirementsMap(), CWLRequirementsList(),
]
[docs]class CWLHintsMap(AnyOfKeywordSchema, PermissiveMappingSchema):
[docs] _any_of = [ BuiltinRequirementMap(missing=drop), DockerRequirementMap(missing=drop), DockerGpuRequirementMap(missing=drop), InitialWorkDirRequirementMap(missing=drop), ESGF_CWT_RequirementMap(missing=drop), WPS1RequirementMap(missing=drop),
]
[docs]class CWLHintsItem(OneOfKeywordSchema, PermissiveMappingSchema): # validators of individual requirements define which one applies # in case of ambiguity, 'discriminator' distinguish between them using their 'example' values in 'class' field
[docs] discriminator = "class"
[docs] _one_of = [ BuiltinRequirementClass(missing=drop), DockerRequirementClass(missing=drop), DockerGpuRequirementClass(missing=drop), InitialWorkDirRequirementClass(missing=drop), ESGF_CWT_RequirementClass(missing=drop), WPS1RequirementClass(missing=drop), UnknownRequirementClass(missing=drop), # allows anything, must be last
]
[docs]class CWLHintsList(ExtendedSequenceSchema):
[docs] hint = CWLHintsItem()
[docs]class CWLHints(OneOfKeywordSchema):
[docs] _one_of = [ CWLHintsMap(), CWLHintsList(),
]
[docs]class CWLArguments(ExtendedSequenceSchema):
[docs] argument = ExtendedSchemaNode(String())
[docs]class CWLTypeString(ExtendedSchemaNode):
[docs] schema_type = String
# in this case it is ok to use 'name' because target fields receiving it will # cause issues against builtin 'type' of Python reserved keyword
[docs] title = "Type"
[docs] description = "Field type definition."
[docs] example = "float"
[docs] validator = OneOf(PACKAGE_TYPE_POSSIBLE_VALUES)
[docs]class CWLTypeSymbolValues(OneOfKeywordSchema):
[docs] _one_of = [ ExtendedSchemaNode(Float()), ExtendedSchemaNode(Integer()), ExtendedSchemaNode(String()),
]
[docs]class CWLTypeSymbols(ExtendedSequenceSchema):
[docs] symbol = CWLTypeSymbolValues()
[docs]class CWLTypeArray(ExtendedMappingSchema):
[docs] type = ExtendedSchemaNode(String(), example=PACKAGE_ARRAY_BASE, validator=OneOf([PACKAGE_ARRAY_BASE]))
[docs] items = CWLTypeString(title="CWLTypeArrayItems", validator=OneOf(PACKAGE_ARRAY_ITEMS))
[docs]class CWLTypeEnum(ExtendedMappingSchema):
[docs] type = ExtendedSchemaNode(String(), example=PACKAGE_ENUM_BASE, validator=OneOf(PACKAGE_CUSTOM_TYPES))
[docs] symbols = CWLTypeSymbols(summary="Allowed values composing the enum.")
[docs]class CWLTypeBase(OneOfKeywordSchema):
[docs] _one_of = [ CWLTypeString(summary="CWL type as literal value."), CWLTypeArray(summary="CWL type as list of items."), CWLTypeEnum(summary="CWL type as enum of values."),
]
[docs]class CWLTypeList(ExtendedSequenceSchema):
[docs] type = CWLTypeBase()
[docs]class CWLType(OneOfKeywordSchema):
[docs] title = "CWL Type"
[docs] _one_of = [ CWLTypeBase(summary="CWL type definition."), CWLTypeList(summary="Combination of allowed CWL types."),
]
[docs]class AnyLiteralList(ExtendedSequenceSchema):
[docs] default = AnyLiteralType()
[docs]class CWLDefault(OneOfKeywordSchema):
[docs] _one_of = [ AnyLiteralType(), AnyLiteralList(),
]
[docs]class CWLInputObject(PermissiveMappingSchema):
[docs] type = CWLType()
[docs] default = CWLDefault(missing=drop, description="Default value of input if not provided for task execution.")
[docs] inputBinding = ExtendedMappingSchema(missing=drop, title="Input Binding", description="Defines how to specify the input for the command.")
[docs]class CWLTypeStringList(ExtendedSequenceSchema):
[docs] description = "List of allowed direct CWL type specifications as strings."
[docs] type = CWLType()
[docs]class CWLInputType(OneOfKeywordSchema):
[docs] description = "CWL type definition of the input."
[docs] _one_of = [ CWLTypeString(summary="Direct CWL type string specification."), CWLTypeStringList(summary="List of allowed CWL type strings."), CWLInputObject(summary="CWL type definition with parameters."),
]
[docs]class CWLInputMap(PermissiveMappingSchema):
[docs] input_id = CWLInputType(variable="<input-id>", title="CWLInputIdentifierType", description=IO_INFO_IDS.format(first="CWL", second="WPS", what="input") + " (Note: '<input-id>' is a variable corresponding for each identifier)")
[docs]class CWLInputItem(CWLInputObject):
[docs] id = AnyIdentifier(description=IO_INFO_IDS.format(first="CWL", second="WPS", what="input"))
[docs]class CWLInputList(ExtendedSequenceSchema):
[docs] input = CWLInputItem(title="Input", description="Input specification. " + CWL_DOC_MESSAGE)
[docs]class CWLInputsDefinition(OneOfKeywordSchema):
[docs] _one_of = [ CWLInputList(description="Package inputs defined as items."), CWLInputMap(description="Package inputs defined as mapping."),
]
[docs]class OutputBinding(PermissiveMappingSchema):
[docs] glob = ExtendedSchemaNode(String(), missing=drop, description="Glob pattern the will find the output on disk or mounted docker volume.")
[docs]class CWLOutputObject(PermissiveMappingSchema):
[docs] type = CWLType()
# 'outputBinding' should usually be there most of the time (if not always) to retrieve file, # but can technically be omitted in some very specific use-cases such as output literal or output is std logs
[docs] outputBinding = OutputBinding( missing=drop, description="Defines how to retrieve the output result from the command."
)
[docs]class CWLOutputType(OneOfKeywordSchema):
[docs] _one_of = [ CWLTypeString(summary="Direct CWL type string specification."), CWLTypeStringList(summary="List of allowed CWL type strings."), CWLOutputObject(summary="CWL type definition with parameters."),
]
[docs]class CWLOutputMap(ExtendedMappingSchema):
[docs] output_id = CWLOutputType(variable="<output-id>", title="CWLOutputIdentifierType", description=IO_INFO_IDS.format(first="CWL", second="WPS", what="output") + " (Note: '<output-id>' is a variable corresponding for each identifier)")
[docs]class CWLOutputItem(CWLOutputObject):
[docs] id = AnyIdentifier(description=IO_INFO_IDS.format(first="CWL", second="WPS", what="output"))
[docs]class CWLOutputList(ExtendedSequenceSchema):
[docs] input = CWLOutputItem(description="Output specification. " + CWL_DOC_MESSAGE)
[docs]class CWLOutputsDefinition(OneOfKeywordSchema):
[docs] _one_of = [ CWLOutputList(description="Package outputs defined as items."), CWLOutputMap(description="Package outputs defined as mapping."),
]
[docs]class CWLCommandParts(ExtendedSequenceSchema):
[docs] cmd = ExtendedSchemaNode(String())
[docs]class CWLCommand(OneOfKeywordSchema):
[docs] _one_of = [ ExtendedSchemaNode(String(), title="String command."), CWLCommandParts(title="Command Parts")
]
[docs]class CWLVersion(Version):
[docs] description = "CWL version of the described application package."
[docs] example = CWL_VERSION
[docs] validator = SemanticVersion(v_prefix=True, rc_suffix=False)
[docs]class CWL(PermissiveMappingSchema):
[docs] cwlVersion = CWLVersion()
[docs] _class = CWLClass()
[docs] requirements = CWLRequirements(description="Explicit requirement to execute the application package.", missing=drop)
[docs] hints = CWLHints(description="Non-failing additional hints that can help resolve extra requirements.", missing=drop)
[docs] baseCommand = CWLCommand(description="Command called in the docker image or on shell according to requirements " "and hints specifications. Can be omitted if already defined in the " "docker image.", missing=drop)
[docs] arguments = CWLArguments(description="Base arguments passed to the command.", missing=drop)
[docs] inputs = CWLInputsDefinition(description="All inputs available to the Application Package.")
[docs] outputs = CWLOutputsDefinition(description="All outputs produced by the Application Package.")
[docs]class Unit(ExtendedMappingSchema):
[docs] unit = CWL(description="Execution unit definition as CWL package specification. " + CWL_DOC_MESSAGE)
[docs]class ProcessInputDefaultValues(ExtendedSequenceSchema):
[docs] value = DefaultValues()
[docs]class ProcessInputSupportedValues(ExtendedSequenceSchema):
[docs] value = SupportedValues()
[docs]class ProcessInputDescriptionSchema(ExtendedMappingSchema):
[docs] id = AnyIdentifier()
[docs] title = ExtendedSchemaNode(String())
[docs] dataType = ExtendedSchemaNode(String())
[docs] abstract = ExtendedSchemaNode(String())
[docs] minOccurs = MinOccursDefinition()
[docs] maxOccurs = MaxOccursDefinition()
[docs] defaultValue = ProcessInputDefaultValues()
[docs] supportedValues = ProcessInputSupportedValues()
[docs]class ProcessInputDescriptionList(ExtendedSequenceSchema):
[docs] input = ProcessInputDescriptionSchema()
[docs]class ProcessOutputDescriptionList(ExtendedSequenceSchema):
[docs] input = ProcessOutputDescriptionSchema()
[docs]class ProcessDescriptionSchema(ExtendedMappingSchema):
[docs] id = AnyIdentifier()
[docs] label = ExtendedSchemaNode(String())
[docs] description = ExtendedSchemaNode(String())
[docs] inputs = ProcessInputDescriptionList()
[docs] outputs = ProcessOutputDescriptionList()
[docs]class UndeploymentResult(ExtendedMappingSchema):
[docs] id = AnyIdentifier()
[docs]class DeploymentResult(ExtendedMappingSchema):
[docs] processSummary = ProcessSummary()
[docs]class ProcessDescriptionBodySchema(ExtendedMappingSchema):
[docs] process = ProcessDescriptionSchema()
[docs]class ProvidersSchema(ExtendedSequenceSchema):
[docs] providers_service = ProviderSummarySchema()
[docs]class ProcessesSchema(ExtendedSequenceSchema):
[docs] provider_processes_service = ProcessInputDescriptionSchema()
[docs]class JobOutput(OneOfKeywordSchema, OutputDataType):
[docs] _one_of = [ Reference(tilte="JobOutputReference"), AnyLiteralDataType(title="JobOutputLiteral")
]
[docs]class JobOutputList(ExtendedSequenceSchema):
[docs] title = "JobOutputList"
[docs] output = JobOutput(description="Job output result with specific keyword according to represented format.")
# implement only literal part of: # https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/inlineOrRefData.yaml
[docs]class ResultLiteral(AnyLiteralValueType, LiteralDataDomainDefinition): # value = <AnyLiteralValueType> pass
[docs]class ResultLiteralList(ExtendedSequenceSchema):
[docs] result = ResultLiteral()
[docs]class ValueFormatted(ExtendedMappingSchema):
[docs] value = ExtendedSchemaNode( String(), example="<xml><data>test</data></xml>", description="Formatted content value of the result."
)
[docs] format = FormatMedia()
[docs]class ValueFormattedList(ExtendedSequenceSchema):
[docs] result = ValueFormatted()
[docs]class ResultReference(ExtendedMappingSchema):
[docs] href = ReferenceURL(description="Result file reference.")
[docs] format = FormatMedia()
[docs]class ResultReferenceList(ExtendedSequenceSchema):
[docs] result = ResultReference()
[docs]class ResultData(OneOfKeywordSchema):
[docs] schema_ref = "{}/master/core/openapi/schemas/result.yaml".format(OGC_API_SCHEMA_URL)
[docs] _one_of = [ # must place formatted value first since both value/format fields are simultaneously required # other classes require only one of the two, and therefore are more permissive during schema validation ValueFormatted(description="Result formatted content value."), ValueFormattedList(description="Result formatted content of multiple values."), ResultReference(description="Result reference location."), ResultReferenceList(description="Result locations for multiple references."), ResultLiteral(description="Result literal value."), ResultLiteralList(description="Result list of literal values."),
]
[docs]class Result(ExtendedMappingSchema): """Result outputs obtained from a successful process job execution."""
[docs] example_ref = "{}/master/core/examples/json/Result.json".format(OGC_API_SCHEMA_URL)
[docs] output_id = ResultData( variable="<output-id>", title="Output Identifier", description=( "Resulting value of the output that conforms to 'OGC-API - Processes' standard. "
"(Note: '<output-id>' is a variable corresponding for each output identifier of the process)" ) )
[docs]class JobInputsSchema(ExtendedMappingSchema):
[docs] inputs = InputList()
[docs]class JobOutputsSchema(ExtendedMappingSchema):
[docs] outputs = JobOutputList()
[docs]class JobException(ExtendedMappingSchema): # note: test fields correspond exactly to 'owslib.wps.WPSException', they are deserialized as is
[docs] Code = ExtendedSchemaNode(String())
[docs] Locator = ExtendedSchemaNode(String(), default=None)
[docs] Text = ExtendedSchemaNode(String())
[docs]class JobExceptionsSchema(ExtendedSequenceSchema):
[docs] exceptions = JobException()
[docs]class JobLogsSchema(ExtendedSequenceSchema):
[docs] log = ExtendedSchemaNode(String())
[docs]class FrontpageParameterSchema(ExtendedMappingSchema):
[docs] name = ExtendedSchemaNode(String(), example="api")
[docs] enabled = ExtendedSchemaNode(Boolean(), example=True)
[docs] url = URL(description="Referenced parameter endpoint.", example="https://weaver-host", missing=drop)
[docs] doc = ExtendedSchemaNode(String(), example="https://weaver-host/api", missing=drop)
[docs]class FrontpageParameters(ExtendedSequenceSchema):
[docs] parameter = FrontpageParameterSchema()
[docs]class FrontpageSchema(ExtendedMappingSchema):
[docs] message = ExtendedSchemaNode(String(), default="Weaver Information", example="Weaver Information")
[docs] configuration = ExtendedSchemaNode(String(), default="default", example="default")
[docs] parameters = FrontpageParameters()
[docs]class SwaggerJSONSpecSchema(ExtendedMappingSchema): pass
[docs]class SwaggerUISpecSchema(ExtendedMappingSchema): pass
[docs]class VersionsSpecSchema(ExtendedMappingSchema):
[docs] name = ExtendedSchemaNode(String(), description="Identification name of the current item.", example="weaver")
[docs] type = ExtendedSchemaNode(String(), description="Identification type of the current item.", example="api")
[docs] version = Version(description="Version of the current item.", example="0.1.0")
[docs]class VersionsList(ExtendedSequenceSchema):
[docs] version = VersionsSpecSchema()
[docs]class VersionsSchema(ExtendedMappingSchema):
[docs] versions = VersionsList()
[docs]class ConformanceList(ExtendedSequenceSchema):
[docs] conformance = URL(description="Conformance specification link.", example="http://www.opengis.net/spec/WPS/2.0/req/service/binding/rest-json/core")
[docs]class ConformanceSchema(ExtendedMappingSchema):
[docs] conformsTo = ConformanceList()
################################################################# # Local Processes schemas #################################################################
[docs]class PackageBody(ExtendedMappingSchema): pass
[docs]class ExecutionUnit(OneOfKeywordSchema):
[docs] _one_of = [ Reference(name="Reference", title="Reference", description="Execution Unit reference."), Unit(name="Unit", title="Unit", description="Execution Unit definition."),
]
[docs]class ExecutionUnitList(ExtendedSequenceSchema):
[docs] unit = ExecutionUnit( name="ExecutionUnit", title="ExecutionUnit", description="Definition of the Application Package to execute."
)
[docs]class ProcessOffering(ExtendedMappingSchema):
[docs] process = Process()
[docs] processVersion = Version(title="processVersion", missing=drop)
[docs] jobControlOptions = JobControlOptionsList(missing=drop)
[docs] outputTransmission = TransmissionModeList(missing=drop)
[docs]class ProcessDescriptionChoiceType(OneOfKeywordSchema):
[docs] _one_of = [ Reference(), ProcessOffering()
]
[docs]class Deploy(ExtendedMappingSchema):
[docs] processDescription = ProcessDescriptionChoiceType()
[docs] immediateDeployment = ExtendedSchemaNode(Boolean(), missing=drop, default=True)
[docs] executionUnit = ExecutionUnitList()
[docs] deploymentProfileName = URL(missing=drop)
[docs] owsContext = OWSContext(missing=drop)
[docs]class PostProcessesEndpoint(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs] body = Deploy(title="Deploy")
[docs]class PostProcessJobsEndpoint(ProcessPath):
[docs] header = AcceptLanguageHeader()
[docs] body = Execute()
[docs]class GetJobsQueries(ExtendedMappingSchema):
[docs] detail = ExtendedSchemaNode(Boolean(), description="Provide job details instead of IDs.", default=False, example=True, missing=drop)
[docs] groups = ExtendedSchemaNode(String(), description="Comma-separated list of grouping fields with which to list jobs.", default=False, example="process,service", missing=drop)
[docs] page = ExtendedSchemaNode(Integer(), missing=drop, default=0, validator=Range(min=0))
[docs] limit = ExtendedSchemaNode(Integer(), missing=drop, default=10)
[docs] status = JobStatusEnum(missing=drop)
[docs] process = AnyIdentifier(missing=drop, default=None)
[docs] provider = ExtendedSchemaNode(String(), missing=drop, default=None)
[docs] sort = JobSortEnum(missing=drop)
[docs] tags = ExtendedSchemaNode(String(), missing=drop, default=None, description="Comma-separated values of tags assigned to jobs")
[docs]class GetJobsRequest(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs] querystring = GetJobsQueries()
[docs]class GetJobsEndpoint(GetJobsRequest): pass
[docs]class GetProcessJobsEndpoint(GetJobsRequest, ProcessPath): pass
[docs]class GetProviderJobsEndpoint(GetJobsRequest, ProviderPath, ProcessPath): pass
[docs]class GetProcessJobEndpoint(ProcessPath):
[docs] header = RequestHeaders()
[docs]class DeleteProcessJobEndpoint(ProcessPath):
[docs] header = RequestHeaders()
[docs]class BillsEndpoint(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs]class BillEndpoint(BillPath):
[docs] header = RequestHeaders()
[docs]class ProcessQuotesEndpoint(ProcessPath):
[docs] header = RequestHeaders()
[docs]class ProcessQuoteEndpoint(ProcessPath, QuotePath):
[docs] header = RequestHeaders()
[docs]class GetQuotesQueries(ExtendedMappingSchema):
[docs] page = ExtendedSchemaNode(Integer(), missing=drop, default=0)
[docs] limit = ExtendedSchemaNode(Integer(), missing=drop, default=10)
[docs] process = AnyIdentifier(missing=drop, default=None)
[docs] sort = QuoteSortEnum(missing=drop)
[docs]class QuotesEndpoint(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs] querystring = GetQuotesQueries()
[docs]class QuoteEndpoint(QuotePath):
[docs] header = RequestHeaders()
[docs]class PostProcessQuote(ProcessPath, QuotePath):
[docs] header = RequestHeaders()
[docs] body = NoContent()
[docs]class PostQuote(QuotePath):
[docs] header = RequestHeaders()
[docs] body = NoContent()
[docs]class PostProcessQuoteRequestEndpoint(ProcessPath, QuotePath):
[docs] header = RequestHeaders()
[docs] body = QuoteProcessParametersSchema()
# ################################################################ # Provider Processes schemas # ################################################################
[docs]class GetProviders(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs]class PostProvider(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs] body = CreateProviderRequestBody()
[docs]class GetProviderProcesses(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs]class GetProviderProcess(ExtendedMappingSchema):
[docs] header = RequestHeaders()
[docs]class PostProviderProcessJobRequest(ExtendedMappingSchema): """Launching a new process request definition."""
[docs] header = RequestHeaders()
[docs] querystring = LaunchJobQuerystring()
[docs] body = Execute()
# ################################################################ # Responses schemas # ################################################################
[docs]class ErrorDetail(ExtendedMappingSchema):
[docs] code = ExtendedSchemaNode(Integer(), description="HTTP status code.", example=400)
[docs] status = ExtendedSchemaNode(String(), description="HTTP status detail.", example="400 Bad Request")
[docs]class OWSErrorCode(ExtendedSchemaNode):
[docs] schema_type = String
[docs] example = "InvalidParameterValue"
[docs] description = "OWS error code."
[docs]class OWSExceptionResponse(ExtendedMappingSchema): """Error content in XML format"""
[docs] code = OWSErrorCode()
[docs] locator = ExtendedSchemaNode(String(), example="identifier", description="Indication of the element that caused the error.")
[docs] message = ExtendedSchemaNode(String(), example="Invalid process ID.", description="Specific description of the error.")
[docs]class ErrorJsonResponseBodySchema(ExtendedMappingSchema):
[docs] code = OWSErrorCode()
[docs] description = ExtendedSchemaNode(String(), description="", example="Process identifier is invalid.")
[docs] error = ErrorDetail(missing=drop)
[docs]class UnauthorizedJsonResponseSchema(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ErrorJsonResponseBodySchema()
[docs]class OkGetFrontpageResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = FrontpageSchema()
[docs]class OkGetSwaggerJSONResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = SwaggerJSONSpecSchema(description="OpenAPI JSON schema of Weaver API.")
[docs]class OkGetSwaggerUIResponse(ExtendedMappingSchema):
[docs] header = HtmlHeader()
[docs] body = SwaggerUISpecSchema(description="Swagger UI of Weaver API.")
[docs]class OkGetRedocUIResponse(ExtendedMappingSchema):
[docs] header = HtmlHeader()
[docs] body = SwaggerUISpecSchema(description="Redoc UI of Weaver API.")
[docs]class OkGetVersionsResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = VersionsSchema()
[docs]class OkGetConformanceResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ConformanceSchema()
[docs]class OkGetProvidersListResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ProvidersSchema()
[docs]class InternalServerErrorGetProvidersListResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during providers listing."
[docs]class OkGetProviderCapabilitiesSchema(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ProviderCapabilitiesSchema()
[docs]class InternalServerErrorGetProviderCapabilitiesResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during provider capabilities request."
[docs]class NoContentDeleteProviderSchema(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = NoContent()
[docs]class InternalServerErrorDeleteProviderResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during provider removal."
[docs]class NotImplementedDeleteProviderResponse(ExtendedMappingSchema):
[docs] description = "Provider removal not supported using referenced storage."
[docs]class OkGetProviderProcessesSchema(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ProcessesSchema()
[docs]class InternalServerErrorGetProviderProcessesListResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during provider processes listing."
[docs]class GetProcessesQuery(ExtendedMappingSchema):
[docs] providers = ExtendedSchemaNode( Boolean(), example=True, default=False, missing=drop, description="List local processes as well as all sub-processes of all registered providers. " "Applicable only for Weaver in {} mode, false otherwise.".format(WEAVER_CONFIGURATION_EMS))
[docs] detail = ExtendedSchemaNode( Boolean(), example=True, default=True, missing=drop, description="Return summary details about each process, or simply their IDs."
)
[docs]class GetProcessesEndpoint(ExtendedMappingSchema):
[docs] querystring = GetProcessesQuery()
[docs]class OkGetProcessesListResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ProcessCollection()
[docs]class InternalServerErrorGetProcessesListResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during processes listing."
[docs]class OkPostProcessDeployBodySchema(ExtendedMappingSchema):
[docs] deploymentDone = ExtendedSchemaNode(Boolean(), default=False, example=True, description="Indicates if the process was successfully deployed.")
[docs] processSummary = ProcessSummary(missing=drop, description="Deployed process summary if successful.")
[docs] failureReason = ExtendedSchemaNode(String(), missing=drop, description="Description of deploy failure if applicable.")
[docs]class OkPostProcessesResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = OkPostProcessDeployBodySchema()
[docs]class InternalServerErrorPostProcessesResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during process deployment."
[docs]class BadRequestGetProcessInfoResponse(ExtendedMappingSchema):
[docs] description = "Missing process identifier."
[docs] body = NoContent()
[docs]class OkGetProcessInfoResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ProcessOffering()
[docs]class InternalServerErrorGetProcessResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during process description."
[docs]class OkGetProcessPackageSchema(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = NoContent()
[docs]class InternalServerErrorGetProcessPackageResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during process package description."
[docs]class OkGetProcessPayloadSchema(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = NoContent()
[docs]class InternalServerErrorGetProcessPayloadResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during process payload description."
[docs]class ProcessVisibilityResponseBodySchema(ExtendedMappingSchema):
[docs] value = VisibilityValue()
[docs]class OkGetProcessVisibilitySchema(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ProcessVisibilityResponseBodySchema()
[docs]class InternalServerErrorGetProcessVisibilityResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during process visibility retrieval."
[docs]class OkPutProcessVisibilitySchema(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ProcessVisibilityResponseBodySchema()
[docs]class InternalServerErrorPutProcessVisibilityResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during process visibility update."
[docs]class OkDeleteProcessUndeployBodySchema(ExtendedMappingSchema):
[docs] deploymentDone = ExtendedSchemaNode(Boolean(), default=False, example=True, description="Indicates if the process was successfully undeployed.")
[docs] identifier = ExtendedSchemaNode(String(), example="workflow")
[docs] failureReason = ExtendedSchemaNode(String(), missing=drop, description="Description of undeploy failure if applicable.")
[docs]class OkDeleteProcessResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = OkDeleteProcessUndeployBodySchema()
[docs]class InternalServerErrorDeleteProcessResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during process deletion."
[docs]class OkGetProviderProcessDescriptionResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ProcessDescriptionBodySchema()
[docs]class InternalServerErrorGetProviderProcessResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during provider process description."
[docs]class CreatedPostProvider(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = ProviderSummarySchema()
[docs]class InternalServerErrorPostProviderResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during provider process registration."
[docs]class NotImplementedPostProviderResponse(ExtendedMappingSchema):
[docs] description = "Provider registration not supported using referenced storage."
[docs]class CreatedLaunchJobResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = CreatedJobStatusSchema()
[docs]class InternalServerErrorPostProcessJobResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during process job submission."
[docs]class InternalServerErrorPostProviderProcessJobResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during process job submission."
[docs]class OkGetProcessJobResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = JobStatusInfo()
[docs]class OkDeleteProcessJobResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = DismissedJobSchema()
[docs]class OkGetQueriedJobsResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = GetQueriedJobsSchema()
[docs]class InternalServerErrorGetJobsResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during jobs listing."
[docs]class OkDismissJobResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = DismissedJobSchema()
[docs]class InternalServerErrorDeleteJobResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during job dismiss request."
[docs]class OkGetJobStatusResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = JobStatusInfo()
[docs]class InternalServerErrorGetJobStatusResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during provider process description."
[docs]class OkGetJobInputsResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = JobInputsSchema()
[docs]class OkGetJobOutputsResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = JobOutputsSchema()
[docs]class RedirectResultResponse(ExtendedMappingSchema):
[docs] header = RedirectHeaders()
[docs]class OkGetJobResultsResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = Result()
[docs]class InternalServerErrorGetJobResultsResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during job results listing."
[docs]class InternalServerErrorGetJobOutputResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during job results listing."
[docs]class CreatedQuoteExecuteResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = CreatedQuotedJobStatusSchema()
[docs]class InternalServerErrorPostQuoteExecuteResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during quote job execution."
[docs]class CreatedQuoteRequestResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = QuoteSchema()
[docs]class InternalServerErrorPostQuoteRequestResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during quote submission."
[docs]class OkGetQuoteInfoResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = QuoteSchema()
[docs]class InternalServerErrorGetQuoteInfoResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during quote retrieval."
[docs]class OkGetQuoteListResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = QuotationListSchema()
[docs]class InternalServerErrorGetQuoteListResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during quote listing."
[docs]class OkGetBillDetailResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = BillSchema()
[docs]class InternalServerErrorGetBillInfoResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during bill retrieval."
[docs]class OkGetBillListResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = BillListSchema()
[docs]class InternalServerErrorGetBillListResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during bill listing."
[docs]class OkGetJobExceptionsResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = JobExceptionsSchema()
[docs]class InternalServerErrorGetJobExceptionsResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during job exceptions listing."
[docs]class OkGetJobLogsResponse(ExtendedMappingSchema):
[docs] header = ResponseHeaders()
[docs] body = JobLogsSchema()
[docs]class InternalServerErrorGetJobLogsResponse(ExtendedMappingSchema):
[docs] description = "Unhandled error occurred during job logs listing."
[docs]get_api_frontpage_responses = { "200": OkGetFrontpageResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"),
}
[docs]get_openapi_json_responses = { "200": OkGetSwaggerJSONResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"),
}
[docs]get_api_swagger_ui_responses = { "200": OkGetSwaggerUIResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"),
}
[docs]get_api_redoc_ui_responses = { "200": OkGetRedocUIResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"),
}
[docs]get_api_versions_responses = { "200": OkGetVersionsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"),
}
[docs]get_api_conformance_responses = { "200": OkGetConformanceResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized")
}
[docs]get_processes_responses = { "200": OkGetProcessesListResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetProcessesListResponse(),
}
[docs]post_processes_responses = { "201": OkPostProcessesResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorPostProcessesResponse(),
}
[docs]get_process_responses = { "200": OkGetProcessInfoResponse(description="success"), "400": BadRequestGetProcessInfoResponse(), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetProcessResponse(),
}
[docs]get_process_package_responses = { "200": OkGetProcessPackageSchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetProcessPackageResponse(),
}
[docs]get_process_payload_responses = { "200": OkGetProcessPayloadSchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetProcessPayloadResponse(),
}
[docs]get_process_visibility_responses = { "200": OkGetProcessVisibilitySchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetProcessVisibilityResponse(),
}
[docs]put_process_visibility_responses = { "200": OkPutProcessVisibilitySchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorPutProcessVisibilityResponse(),
}
[docs]delete_process_responses = { "200": OkDeleteProcessResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorDeleteProcessResponse(),
}
[docs]get_providers_list_responses = { "200": OkGetProvidersListResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetProvidersListResponse(),
}
[docs]get_provider_responses = { "200": OkGetProviderCapabilitiesSchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetProviderCapabilitiesResponse(),
}
[docs]delete_provider_responses = { "204": NoContentDeleteProviderSchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorDeleteProviderResponse(), "501": NotImplementedDeleteProviderResponse(),
}
[docs]get_provider_processes_responses = { "200": OkGetProviderProcessesSchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetProviderProcessesListResponse(),
}
[docs]get_provider_process_responses = { "200": OkGetProviderProcessDescriptionResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetProviderProcessResponse(),
}
[docs]post_provider_responses = { "201": CreatedPostProvider(description="success"), "400": ExtendedMappingSchema(description=OWSMissingParameterValue.description), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorPostProviderResponse(), "501": NotImplementedPostProviderResponse(),
}
[docs]post_provider_process_job_responses = { "201": CreatedLaunchJobResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorPostProviderProcessJobResponse(),
}
[docs]post_process_jobs_responses = { "201": CreatedLaunchJobResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorPostProcessJobResponse(),
}
[docs]get_all_jobs_responses = { "200": OkGetQueriedJobsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetJobsResponse(),
}
[docs]get_single_job_status_responses = { "200": OkGetJobStatusResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetJobStatusResponse(),
}
[docs]delete_job_responses = { "200": OkDismissJobResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorDeleteJobResponse(),
}
[docs]get_job_inputs_responses = { "200": OkGetJobInputsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetJobResultsResponse(),
}
[docs]get_job_outputs_responses = { "200": OkGetJobOutputsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetJobOutputResponse(),
}
[docs]get_result_redirect_responses = { "308": RedirectResultResponse(description="redirect"),
}
[docs]get_job_results_responses = { "200": OkGetJobResultsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetJobResultsResponse(),
}
[docs]get_exceptions_responses = { "200": OkGetJobExceptionsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetJobExceptionsResponse(),
}
[docs]get_logs_responses = { "200": OkGetJobLogsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "403": UnauthorizedJsonResponseSchema(description="forbidden"), "500": InternalServerErrorGetJobLogsResponse(),
}
[docs]get_quote_list_responses = { "200": OkGetQuoteListResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetQuoteListResponse(),
}
[docs]get_quote_responses = { "200": OkGetQuoteInfoResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetQuoteInfoResponse(),
}
[docs]post_quotes_responses = { "201": CreatedQuoteRequestResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorPostQuoteRequestResponse(),
}
[docs]post_quote_responses = { "201": CreatedQuoteExecuteResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorPostQuoteExecuteResponse(),
}
[docs]get_bill_list_responses = { "200": OkGetBillListResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetBillListResponse(),
}
[docs]get_bill_responses = { "200": OkGetBillDetailResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetBillInfoResponse(),
}
[docs]wps_responses = { "200": OkWPSResponse(), "500": ErrorWPSResponse(),
} ################################################################# # Utility methods #################################################################
[docs]def service_api_route_info(service_api, settings): # type: (Service, SettingsType) -> ViewInfo api_base = wps_restapi_base_path(settings) return {"name": service_api.name, "pattern": "{base}{path}".format(base=api_base, path=service_api.path)}