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 colander import Boolean, DateTime, Float, Integer
from colander import MappingSchema as MapSchema
from colander import OneOf, Range
from colander import SequenceSchema as SeqSchema
from colander import String, 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_MODE_ASYNC,
    EXECUTE_MODE_AUTO,
    EXECUTE_RESPONSE_RAW,
    EXECUTE_TRANSMISSION_MODE_REFERENCE,
    EXECUTE_CONTROL_OPTIONS,
    EXECUTE_MODE_OPTIONS,
    EXECUTE_RESPONSE_OPTIONS,
    EXECUTE_TRANSMISSION_MODE_OPTIONS
)
from weaver.formats import CONTENT_TYPE_APP_JSON, CONTENT_TYPE_APP_XML, CONTENT_TYPE_TEXT_HTML, CONTENT_TYPE_TEXT_PLAIN
from weaver.owsexceptions import OWSMissingParameterValue
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 (
    DropableNoneSchema,
    OneOfMappingSchema,
    SchemaNodeDefault,
    VariableMappingSchema
)
from weaver.wps_restapi.utils import wps_restapi_base_path


[docs]class SchemaNode(SchemaNodeDefault): """ Override the default :class:`colander.SchemaNode` to auto-handle ``default`` value substitution if an actual value was omitted during deserialization for a field defined with this schema and a ``default`` parameter. .. seealso:: Implementation in :class:`SchemaNodeDefault`. """ @staticmethod
[docs] def schema_type(): raise NotImplementedError
[docs]class SequenceSchema(DropableNoneSchema, SeqSchema): """ Override the default :class:`colander.SequenceSchema` to auto-handle dropping missing entry definitions when its value is either ``None``, :class:`colander.null` or :class:`colander.drop`. """
[docs] schema_type = SeqSchema.schema_type
[docs]class MappingSchema(DropableNoneSchema, MapSchema): """ Override the default :class:`colander.MappingSchema` to auto-handle dropping missing field definitions when the corresponding value is either ``None``, :class:`colander.null` or :class:`colander.drop`. """
[docs] schema_type = MapSchema.schema_type
[docs]class ExplicitMappingSchema(MapSchema):
""" Original behaviour of :class:`colander.MappingSchema` implementation, where fields referencing to ``None`` values are kept as an explicit indication of an *undefined* or *missing* value for this field. """
[docs]API_TITLE = "Weaver REST API"
[docs]API_INFO = { "description": __meta__.__description__, "contact": {"name": __meta__.__authors__, "email": __meta__.__emails__, "url": __meta__.__source_repository__}
}
[docs]URL = "url"
######################################################################### # API endpoints #########################################################################
[docs]api_frontpage_uri = "/"
[docs]api_swagger_ui_uri = "/api"
[docs]api_swagger_json_uri = "/json"
[docs]api_versions_uri = "/versions"
[docs]api_conformance_uri = "/conformance"
[docs]processes_uri = "/processes"
[docs]process_uri = "/processes/{process_id}"
[docs]process_package_uri = "/processes/{process_id}/package"
[docs]process_payload_uri = "/processes/{process_id}/payload"
[docs]process_visibility_uri = "/processes/{process_id}/visibility"
[docs]process_jobs_uri = "/processes/{process_id}/jobs"
[docs]process_job_uri = "/processes/{process_id}/jobs/{job_id}"
[docs]process_quotes_uri = "/processes/{process_id}/quotations"
[docs]process_quote_uri = "/processes/{process_id}/quotations/{quote_id}"
[docs]process_results_uri = "/processes/{process_id}/jobs/{job_id}/result"
[docs]process_exceptions_uri = "/processes/{process_id}/jobs/{job_id}/exceptions"
[docs]process_logs_uri = "/processes/{process_id}/jobs/{job_id}/logs"
[docs]providers_uri = "/providers"
[docs]provider_uri = "/providers/{provider_id}"
[docs]provider_processes_uri = "/providers/{provider_id}/processes"
[docs]provider_process_uri = "/providers/{provider_id}/processes/{process_id}"
[docs]jobs_short_uri = "/jobs"
[docs]jobs_full_uri = "/providers/{provider_id}/processes/{process_id}/jobs"
[docs]job_full_uri = "/providers/{provider_id}/processes/{process_id}/jobs/{job_id}"
[docs]job_exceptions_uri = "/providers/{provider_id}/processes/{process_id}/jobs/{job_id}/exceptions"
[docs]job_short_uri = "/jobs/{job_id}"
[docs]quotes_uri = "/quotations"
[docs]quote_uri = "/quotations/{quote_id}"
[docs]bills_uri = "/bills"
[docs]bill_uri = "/bill/{bill_id}"
[docs]results_full_uri = "/providers/{provider_id}/processes/{process_id}/jobs/{job_id}/result"
[docs]results_short_uri = "/jobs/{job_id}/result"
[docs]result_full_uri = "/providers/{provider_id}/processes/{process_id}/jobs/{job_id}/result/{result_id}"
[docs]result_short_uri = "/jobs/{job_id}/result/{result_id}"
[docs]exceptions_full_uri = "/providers/{provider_id}/processes/{process_id}/jobs/{job_id}/exceptions"
[docs]exceptions_short_uri = "/jobs/{job_id}/exceptions"
[docs]logs_full_uri = "/providers/{provider_id}/processes/{process_id}/jobs/{job_id}/logs"
[docs]logs_short_uri = "/jobs/{job_id}/logs"
######################################################### # API tags #########################################################
[docs]TAG_API = "API"
[docs]TAG_JOBS = "Jobs"
[docs]TAG_VISIBILITY = "Visibility"
[docs]TAG_BILL_QUOTE = "Billing & Quoting"
[docs]TAG_PROVIDER_PROCESS = "Provider Processes"
[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"
############################################################################### # These "services" are wrappers that allow Cornice to generate the JSON API ###############################################################################
[docs]api_frontpage_service = Service(name="api_frontpage", path=api_frontpage_uri)
[docs]api_swagger_ui_service = Service(name="api_swagger_ui", path=api_swagger_ui_uri)
[docs]api_swagger_json_service = Service(name="api_swagger_json", path=api_swagger_json_uri)
[docs]api_versions_service = Service(name="api_versions", path=api_versions_uri)
[docs]api_conformance_service = Service(name="api_conformance", path=api_conformance_uri)
[docs]processes_service = Service(name="processes", path=processes_uri)
[docs]process_service = Service(name="process", path=process_uri)
[docs]process_package_service = Service(name="process_package", path=process_package_uri)
[docs]process_payload_service = Service(name="process_payload", path=process_payload_uri)
[docs]process_visibility_service = Service(name="process_visibility", path=process_visibility_uri)
[docs]process_jobs_service = Service(name="process_jobs", path=process_jobs_uri)
[docs]process_job_service = Service(name="process_job", path=process_job_uri)
[docs]process_quotes_service = Service(name="process_quotes", path=process_quotes_uri)
[docs]process_quote_service = Service(name="process_quote", path=process_quote_uri)
[docs]process_results_service = Service(name="process_results", path=process_results_uri)
[docs]process_exceptions_service = Service(name="process_exceptions", path=process_exceptions_uri)
[docs]process_logs_service = Service(name="process_logs", path=process_logs_uri)
[docs]providers_service = Service(name="providers", path=providers_uri)
[docs]provider_service = Service(name="provider", path=provider_uri)
[docs]provider_processes_service = Service(name="provider_processes", path=provider_processes_uri)
[docs]provider_process_service = Service(name="provider_process", path=provider_process_uri)
[docs]jobs_short_service = Service(name="jobs_short", path=jobs_short_uri)
[docs]jobs_full_service = Service(name="jobs_full", path=jobs_full_uri)
[docs]job_full_service = Service(name="job_full", path=job_full_uri)
[docs]job_short_service = Service(name="job_short", path=job_short_uri)
[docs]quotes_service = Service(name="quotes", path=quotes_uri)
[docs]quote_service = Service(name="quote", path=quote_uri)
[docs]bills_service = Service(name="bills", path=bills_uri)
[docs]bill_service = Service(name="bill", path=bill_uri)
[docs]results_full_service = Service(name="results_full", path=results_full_uri)
[docs]results_short_service = Service(name="results_short", path=results_short_uri)
[docs]exceptions_full_service = Service(name="exceptions_full", path=exceptions_full_uri)
[docs]exceptions_short_service = Service(name="exceptions_short", path=exceptions_short_uri)
[docs]logs_full_service = Service(name="logs_full", path=logs_full_uri)
[docs]logs_short_service = Service(name="logs_short", path=logs_short_uri)
######################################################### # Path parameter definitions #########################################################
[docs]class ProcessPath(MappingSchema):
[docs] process_id = SchemaNode(String(), description="The process id")
[docs]class ProviderPath(MappingSchema):
[docs] provider_id = SchemaNode(String(), description="The provider id")
[docs]class JobPath(MappingSchema):
[docs] job_id = SchemaNode(String(), description="The job id")
[docs]class BillPath(MappingSchema):
[docs] bill_id = SchemaNode(String(), description="The bill id")
[docs]class QuotePath(MappingSchema):
[docs] quote_id = SchemaNode(String(), description="The quote id")
[docs]class ResultPath(MappingSchema):
[docs] result_id = SchemaNode(String(), description="The result id")
######################################################### # Generic schemas #########################################################
[docs]class JsonHeader(MappingSchema):
[docs] content_type = SchemaNode(String(), example=CONTENT_TYPE_APP_JSON, default=CONTENT_TYPE_APP_JSON)
[docs] content_type.name = "Content-Type"
[docs]class HtmlHeader(MappingSchema):
[docs] content_type = SchemaNode(String(), example=CONTENT_TYPE_TEXT_HTML, default=CONTENT_TYPE_TEXT_HTML)
[docs] content_type.name = "Content-Type"
[docs]class XmlHeader(MappingSchema):
[docs] content_type = SchemaNode(String(), example=CONTENT_TYPE_APP_XML, default=CONTENT_TYPE_APP_XML)
[docs] content_type.name = "Content-Type"
[docs]class AcceptHeader(MappingSchema):
[docs] Accept = SchemaNode(String(), missing=drop, default=CONTENT_TYPE_APP_JSON, validator=OneOf([ CONTENT_TYPE_APP_JSON, CONTENT_TYPE_APP_XML, CONTENT_TYPE_TEXT_HTML,
]))
[docs]class AcceptLanguageHeader(AcceptHeader):
[docs] AcceptLanguage = SchemaNode(String(), missing=drop)
[docs] AcceptLanguage.name = "Accept-Language"
[docs]class KeywordList(SequenceSchema):
[docs] keyword = SchemaNode(String())
[docs]class Metadata(JsonLink):
[docs] role = SchemaNode(String(), format=URL, missing=drop)
[docs] value = SchemaNode(String(), missing=drop)
[docs]class MetadataList(SequenceSchema):
[docs] item = Metadata()
[docs]class LandingPage(MappingSchema):
[docs]class Format(MappingSchema):
[docs] mimeType = SchemaNode(String(), default=CONTENT_TYPE_TEXT_PLAIN)
[docs] schema = SchemaNode(String(), missing=drop)
[docs] encoding = SchemaNode(String(), missing=drop)
[docs]class FormatDescription(Format):
[docs] maximumMegabytes = SchemaNode(Integer(), missing=drop)
[docs] default = SchemaNode(Boolean(), missing=drop, default=False)
[docs]class FormatDescriptionList(SequenceSchema):
[docs] format = FormatDescription()
[docs]class AdditionalParameterValuesList(SequenceSchema):
[docs] values = SchemaNode(String())
[docs]class AdditionalParameter(MappingSchema):
[docs] name = SchemaNode(String())
[docs] values = AdditionalParameterValuesList()
[docs]class AdditionalParameterList(SequenceSchema):
[docs] item = AdditionalParameter()
[docs]class AdditionalParameters(MappingSchema):
[docs] role = SchemaNode(String(), missing=drop)
[docs] parameters = AdditionalParameterList(missing=drop)
[docs]class AdditionalParametersList(SequenceSchema):
[docs] additionalParameter = AdditionalParameters()
[docs]class Content(MappingSchema):
[docs] href = SchemaNode(String(), format=URL, description="URL to CWL file.", title="href", example="http://some.host/applications/cwl/multisensor_ndvi.cwl")
[docs]class Offering(MappingSchema):
[docs] code = SchemaNode(String(), missing=drop, description="Descriptor of represented information in 'content'.")
[docs] content = Content(title="content", missing=drop)
[docs]class OWSContext(MappingSchema):
[docs] offering = Offering(title="offering")
[docs]class DescriptionType(MappingSchema):
[docs] id = SchemaNode(String())
[docs] title = SchemaNode(String(), missing=drop)
[docs] abstract = SchemaNode(String(), missing=drop)
[docs] keywords = KeywordList(missing=drop)
[docs] owsContext = OWSContext(missing=drop, title="owsContext")
[docs] metadata = MetadataList(missing=drop)
[docs] additionalParameters = AdditionalParametersList(missing=drop, title="additionalParameters")
[docs]class MinMaxOccursInt(MappingSchema):
[docs] minOccurs = SchemaNode(Integer(), missing=drop)
[docs] maxOccurs = SchemaNode(Integer(), missing=drop)
[docs]class MinMaxOccursStr(MappingSchema):
[docs] minOccurs = SchemaNode(String(), missing=drop)
[docs] maxOccurs = SchemaNode(String(), missing=drop)
[docs]class WithMinMaxOccurs(OneOfMappingSchema):
[docs] _one_of = (MinMaxOccursStr, MinMaxOccursInt)
[docs]class ComplexInputType(DescriptionType, WithMinMaxOccurs):
[docs] formats = FormatDescriptionList()
[docs]class SupportedCrs(MappingSchema):
[docs] crs = SchemaNode(String(), format=URL)
[docs] default = SchemaNode(Boolean(), missing=drop)
[docs]class SupportedCrsList(SequenceSchema):
[docs] item = SupportedCrs()
[docs]class BoundingBoxInputType(DescriptionType, WithMinMaxOccurs):
[docs] supportedCRS = SupportedCrsList()
[docs]class DataTypeSchema(MappingSchema):
[docs] name = SchemaNode(String())
[docs] reference = SchemaNode(String(), format=URL, missing=drop)
[docs]class UomSchema(DataTypeSchema): pass
[docs]class AllowedValuesList(SequenceSchema):
[docs] allowedValues = SchemaNode(String())
[docs]class AllowedValues(MappingSchema):
[docs] allowedValues = AllowedValuesList()
[docs]class AllowedRange(MappingSchema):
[docs] minimumValue = SchemaNode(String(), missing=drop)
[docs] maximumValue = SchemaNode(String(), missing=drop)
[docs] spacing = SchemaNode(String(), missing=drop)
[docs] rangeClosure = SchemaNode(String(), missing=drop, validator=OneOf(["closed", "open", "open-closed", "closed-open"]))
[docs]class AllowedRangesList(SequenceSchema):
[docs] allowedRanges = AllowedRange()
[docs]class AllowedRanges(MappingSchema):
[docs] allowedRanges = AllowedRangesList()
[docs]class AnyValue(MappingSchema):
[docs] anyValue = SchemaNode(Boolean(), missing=drop, default=True)
[docs]class ValuesReference(MappingSchema):
[docs] valueReference = SchemaNode(String(), format=URL, )
[docs]class LiteralDataDomainType(OneOfMappingSchema):
[docs] _one_of = (AllowedValues, AllowedRanges, ValuesReference, AnyValue) # must be last because it"s the most permissive
[docs] defaultValue = SchemaNode(String(), missing=drop)
[docs] dataType = DataTypeSchema(missing=drop)
[docs] uom = UomSchema(missing=drop)
[docs]class LiteralDataDomainTypeList(SequenceSchema):
[docs] literalDataDomain = LiteralDataDomainType()
[docs]class LiteralInputType(DescriptionType, WithMinMaxOccurs):
[docs] literalDataDomains = LiteralDataDomainTypeList(missing=drop)
[docs]class InputType(OneOfMappingSchema):
[docs] _one_of = ( BoundingBoxInputType, ComplexInputType, # should be 2nd to last because very permission, but requires format at least LiteralInputType, # must be last because it"s the most permissive (all can default if omitted)
)
[docs]class InputTypeList(SequenceSchema):
[docs] input = InputType()
[docs]class LiteralOutputType(MappingSchema):
[docs] literalDataDomains = LiteralDataDomainTypeList(missing=drop)
[docs]class BoundingBoxOutputType(MappingSchema):
[docs] supportedCRS = SupportedCrsList()
[docs]class ComplexOutputType(MappingSchema):
[docs] formats = FormatDescriptionList()
[docs]class OutputDataDescriptionType(DescriptionType): pass
[docs]class OutputType(OneOfMappingSchema, OutputDataDescriptionType):
[docs] _one_of = ( BoundingBoxOutputType, ComplexOutputType, # should be 2nd to last because very permission, but requires format at least LiteralOutputType, # must be last because it"s the most permissive (all can default if omitted)
)
[docs]class OutputDescriptionList(SequenceSchema):
[docs] item = OutputType()
[docs]class JobExecuteModeEnum(SchemaNode):
[docs] schema_type = String
def __init__(self, *args, **kwargs): # noqa: E811 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(list(EXECUTE_MODE_OPTIONS)), **kwargs)
[docs]class JobControlOptionsEnum(SchemaNode):
[docs] schema_type = String
def __init__(self, *args, **kwargs): # noqa: E811 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(list(EXECUTE_CONTROL_OPTIONS)), **kwargs)
[docs]class JobResponseOptionsEnum(SchemaNode):
[docs] schema_type = String
def __init__(self, *args, **kwargs): # noqa: E811 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(list(EXECUTE_RESPONSE_OPTIONS)), **kwargs)
[docs]class TransmissionModeEnum(SchemaNode):
[docs] schema_type = String
def __init__(self, *args, **kwargs): # noqa: E811 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(list(EXECUTE_TRANSMISSION_MODE_OPTIONS)), **kwargs)
[docs]class JobStatusEnum(SchemaNode):
[docs] schema_type = String
def __init__(self, *args, **kwargs): # noqa: E811 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(list(JOB_STATUS_CATEGORIES[STATUS_COMPLIANT_OGC])), **kwargs)
[docs]class JobSortEnum(SchemaNode):
[docs] schema_type = String
def __init__(self, *args, **kwargs): # noqa: E811 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(list(JOB_SORT_VALUES)), **kwargs)
[docs]class QuoteSortEnum(SchemaNode):
[docs] schema_type = String
def __init__(self, *args, **kwargs): # noqa: E811 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(list(QUOTE_SORT_VALUES)), **kwargs)
[docs]class LaunchJobQuerystring(MappingSchema):
[docs] field_string = SchemaNode(String(), default=None, missing=drop, description="Comma separated tags that can be used to filter jobs later")
[docs] field_string.name = "tags"
[docs]class Visibility(MappingSchema):
[docs] value = SchemaNode(String(), validator=OneOf(list(VISIBILITY_VALUES)), example=VISIBILITY_PUBLIC)
######################################################### # These classes define each of the endpoints parameters #########################################################
[docs]class FrontpageEndpoint(MappingSchema):
[docs] header = AcceptHeader()
[docs]class VersionsEndpoint(MappingSchema):
[docs] header = AcceptHeader()
[docs]class ConformanceEndpoint(MappingSchema):
[docs] header = AcceptHeader()
[docs]class SwaggerJSONEndpoint(MappingSchema):
[docs] header = AcceptHeader()
[docs]class SwaggerUIEndpoint(MappingSchema): pass
[docs]class ProviderEndpoint(ProviderPath):
[docs] header = AcceptHeader()
[docs]class ProviderProcessEndpoint(ProviderPath, ProcessPath):
[docs] header = AcceptHeader()
[docs]class ProcessEndpoint(ProcessPath):
[docs] header = AcceptHeader()
[docs]class ProcessPackageEndpoint(ProcessPath):
[docs] header = AcceptHeader()
[docs]class ProcessPayloadEndpoint(ProcessPath):
[docs] header = AcceptHeader()
[docs]class ProcessVisibilityGetEndpoint(ProcessPath):
[docs] header = AcceptHeader()
[docs]class ProcessVisibilityPutEndpoint(ProcessPath):
[docs] header = AcceptHeader()
[docs] body = Visibility()
[docs]class FullJobEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = AcceptHeader()
[docs]class ShortJobEndpoint(JobPath):
[docs] header = AcceptHeader()
[docs]class ProcessResultsEndpoint(ProcessPath, JobPath):
[docs] header = AcceptHeader()
[docs]class FullResultsEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = AcceptHeader()
[docs]class ShortResultsEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = AcceptHeader()
[docs]class FullExceptionsEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = AcceptHeader()
[docs]class ShortExceptionsEndpoint(JobPath):
[docs] header = AcceptHeader()
[docs]class ProcessExceptionsEndpoint(ProcessPath, JobPath):
[docs] header = AcceptHeader()
[docs]class FullLogsEndpoint(ProviderPath, ProcessPath, JobPath):
[docs] header = AcceptHeader()
[docs]class ShortLogsEndpoint(JobPath):
[docs] header = AcceptHeader()
[docs]class ProcessLogsEndpoint(ProcessPath, JobPath):
[docs] header = AcceptHeader()
################################################################## # These classes define schemas for requests that feature a body ##################################################################
[docs]class CreateProviderRequestBody(MappingSchema):
[docs] id = SchemaNode(String())
[docs] url = SchemaNode(String())
[docs] public = SchemaNode(Boolean())
[docs]class InputDataType(MappingSchema):
[docs] id = SchemaNode(String())
[docs]class OutputDataType(MappingSchema):
[docs] id = SchemaNode(String())
[docs] format = Format(missing=drop)
[docs]class Output(OutputDataType):
[docs] transmissionMode = TransmissionModeEnum(missing=drop)
[docs]class OutputList(SequenceSchema):
[docs] output = Output()
[docs]class ProviderSummarySchema(MappingSchema): """WPS provider summary definition."""
[docs] id = SchemaNode(String())
[docs] url = SchemaNode(String())
[docs] title = SchemaNode(String())
[docs] abstract = SchemaNode(String())
[docs] public = SchemaNode(Boolean())
[docs]class ProviderCapabilitiesSchema(MappingSchema): """WPS provider capabilities."""
[docs] id = SchemaNode(String())
[docs] url = SchemaNode(String())
[docs] title = SchemaNode(String())
[docs] abstract = SchemaNode(String())
[docs] contact = SchemaNode(String())
[docs] type = SchemaNode(String())
[docs]class TransmissionModeList(SequenceSchema):
[docs] item = TransmissionModeEnum(missing=drop)
[docs]class JobControlOptionsList(SequenceSchema):
[docs] item = JobControlOptionsEnum(missing=drop)
[docs]class ExceptionReportType(MappingSchema):
[docs] code = SchemaNode(String())
[docs] description = SchemaNode(String(), missing=drop)
[docs]class ProcessSummary(DescriptionType): """WPS process definition."""
[docs] version = SchemaNode(String(), missing=drop)
[docs] jobControlOptions = JobControlOptionsList(missing=drop)
[docs] outputTransmission = TransmissionModeList(missing=drop)
[docs] processDescriptionURL = SchemaNode(String(), format=URL, missing=drop)
[docs]class ProcessSummaryList(SequenceSchema):
[docs] item = ProcessSummary()
[docs]class ProcessCollection(MappingSchema):
[docs] processes = ProcessSummaryList()
[docs]class Process(DescriptionType):
[docs] inputs = InputTypeList(missing=drop)
[docs] outputs = OutputDescriptionList(missing=drop)
[docs] executeEndpoint = SchemaNode(String(), format=URL, missing=drop)
[docs]class ProcessOutputDescriptionSchema(MappingSchema): """WPS process output definition."""
[docs] dataType = SchemaNode(String())
[docs] defaultValue = MappingSchema()
[docs] id = SchemaNode(String())
[docs] abstract = SchemaNode(String())
[docs] title = SchemaNode(String())
[docs]class JobStatusInfo(MappingSchema):
[docs] jobID = SchemaNode(String(), example="a9d14bf4-84e0-449a-bac8-16e598efe807", description="ID of the job.")
[docs] status = JobStatusEnum()
[docs] message = SchemaNode(String(), missing=drop)
# fixme: use href links (https://github.com/crim-ca/weaver/issues/58) [logs/result/exceptions]
[docs] logs = SchemaNode(String(), missing=drop)
[docs] result = SchemaNode(String(), missing=drop)
[docs] exceptions = SchemaNode(String(), missing=drop)
[docs] expirationDate = SchemaNode(DateTime(), missing=drop)
[docs] estimatedCompletion = SchemaNode(DateTime(), missing=drop)
[docs] duration = SchemaNode(String(), missing=drop, description="Duration of the process execution.")
[docs] nextPoll = SchemaNode(DateTime(), missing=drop)
[docs] percentCompleted = SchemaNode(Integer(), example=0, validator=Range(min=0, max=100))
[docs]class JobEntrySchema(OneOfMappingSchema):
[docs] _one_of = ( JobStatusInfo, SchemaNode(String(), description="Job ID."),
) # note: # Since JobId is a simple string (not a dict), no additional mapping field can be added here. # They will be discarded by `OneOfMappingSchema.deserialize()`.
[docs]class JobCollection(SequenceSchema):
[docs] item = JobEntrySchema()
[docs]class CreatedJobStatusSchema(MappingSchema):
[docs] status = SchemaNode(String(), example=STATUS_ACCEPTED)
[docs] location = SchemaNode(String(), example="http://{host}/weaver/processes/{my-process-id}/jobs/{my-job-id}")
[docs] jobID = SchemaNode(String(), example="a9d14bf4-84e0-449a-bac8-16e598efe807", description="ID of the created job.")
[docs]class CreatedQuotedJobStatusSchema(CreatedJobStatusSchema):
[docs] bill = SchemaNode(String(), example="d88fda5c-52cc-440b-9309-f2cd20bcd6a2", description="ID of the created bill.")
[docs]class GetPagingJobsSchema(MappingSchema):
[docs] jobs = JobCollection()
[docs] limit = SchemaNode(Integer())
[docs] page = SchemaNode(Integer())
[docs]class GroupedJobsCategorySchema(MappingSchema):
[docs] category = VariableMappingSchema(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 = SchemaNode(Integer(), description="Number of matching jobs for the corresponding group category.")
[docs]class GroupedCategoryJobsSchema(SequenceSchema):
[docs] job_group_category_item = GroupedJobsCategorySchema()
[docs]class GetGroupedJobsSchema(MappingSchema):
[docs] groups = GroupedCategoryJobsSchema()
[docs]class GetQueriedJobsSchema(OneOfMappingSchema):
[docs] _one_of = ( GetPagingJobsSchema, GetGroupedJobsSchema,
)
[docs] total = SchemaNode(Integer(), description="Total number of matched jobs regardless of grouping or paging result.")
[docs]class DismissedJobSchema(MappingSchema):
[docs] status = JobStatusEnum()
[docs] jobID = SchemaNode(String(), example="a9d14bf4-84e0-449a-bac8-16e598efe807", description="ID of the job.")
[docs] message = SchemaNode(String(), example="Job dismissed.")
[docs] percentCompleted = SchemaNode(Integer(), example=0)
[docs]class QuoteProcessParametersSchema(MappingSchema):
[docs] inputs = InputTypeList(missing=drop)
[docs] outputs = OutputDescriptionList(missing=drop)
[docs] mode = JobExecuteModeEnum(missing=drop)
[docs] response = JobResponseOptionsEnum(missing=drop)
[docs]class AlternateQuotation(MappingSchema):
[docs] id = SchemaNode(String(), description="Quote ID.")
[docs] title = SchemaNode(String(), description="Name of the quotation.", missing=drop)
[docs] description = SchemaNode(String(), description="Description of the quotation.", missing=drop)
[docs] price = SchemaNode(Float(), description="Process execution price.")
[docs] currency = SchemaNode(String(), description="Currency code in ISO-4217 format.")
[docs] expire = SchemaNode(DateTime(), description="Expiration date and time of the quote in ISO-8601 format.")
[docs] created = SchemaNode(DateTime(), description="Creation date and time of the quote in ISO-8601 format.")
[docs] details = SchemaNode(String(), description="Details of the quotation.", missing=drop)
[docs] estimatedTime = SchemaNode(String(), description="Estimated duration of the process execution.", missing=drop)
[docs]class AlternateQuotationList(SequenceSchema):
[docs] step = AlternateQuotation(description="Quote of a workflow step process.")
[docs]class Reference(MappingSchema):
[docs] href = SchemaNode(String())
[docs] mimeType = SchemaNode(String(), missing=drop)
[docs] schema = SchemaNode(String(), missing=drop)
[docs] encoding = SchemaNode(String(), missing=drop)
[docs] body = SchemaNode(String(), missing=drop)
[docs] bodyReference = SchemaNode(String(), missing=drop, format=URL)
[docs]class DataEncodingAttributes(MappingSchema):
[docs] mimeType = SchemaNode(String(), missing=drop)
[docs] schema = SchemaNode(String(), missing=drop)
[docs] encoding = SchemaNode(String(), missing=drop)
[docs]class DataFloat(DataEncodingAttributes):
[docs] data = SchemaNode(Float())
[docs]class DataInteger(DataEncodingAttributes):
[docs] data = SchemaNode(Integer())
[docs]class DataString(DataEncodingAttributes):
[docs] data = SchemaNode(String())
[docs]class DataBoolean(DataEncodingAttributes):
[docs] data = SchemaNode(Boolean())
[docs]class ValueType(OneOfMappingSchema):
[docs] _one_of = (DataFloat, DataInteger, DataString, DataBoolean, Reference)
[docs]class Input(InputDataType, ValueType): pass
[docs]class InputList(SequenceSchema):
[docs] item = Input(missing=drop)
[docs]class Execute(MappingSchema):
[docs] inputs = InputList(missing=drop)
[docs] outputs = OutputList()
[docs] mode = SchemaNode(String(), validator=OneOf(list(EXECUTE_MODE_OPTIONS)))
[docs] notification_email = SchemaNode( String(), missing=drop, description="Optionally send a notification email when the job is done.")
[docs] response = SchemaNode(String(), validator=OneOf(list(EXECUTE_RESPONSE_OPTIONS)))
[docs]class Quotation(MappingSchema):
[docs] id = SchemaNode(String(), description="Quote ID.")
[docs] title = SchemaNode(String(), description="Name of the quotation.", missing=drop)
[docs] description = SchemaNode(String(), description="Description of the quotation.", missing=drop)
[docs] processId = SchemaNode(String(), description="Corresponding process ID.")
[docs] price = SchemaNode(Float(), description="Process execution price.")
[docs] currency = SchemaNode(String(), description="Currency code in ISO-4217 format.")
[docs] expire = SchemaNode(DateTime(), description="Expiration date and time of the quote in ISO-8601 format.")
[docs] created = SchemaNode(DateTime(), description="Creation date and time of the quote in ISO-8601 format.")
[docs] userId = SchemaNode(String(), description="User id that requested the quote.")
[docs] details = SchemaNode(String(), description="Details of the quotation.", missing=drop)
[docs] estimatedTime = SchemaNode(String(), description="Estimated duration of the process execution.", missing=drop)
[docs] processParameters = Execute()
[docs] alternativeQuotations = AlternateQuotationList(missing=drop)
[docs]class QuoteProcessListSchema(SequenceSchema):
[docs] step = Quotation(description="Quote of a workflow step process.")
[docs]class QuoteSchema(MappingSchema):
[docs] id = SchemaNode(String(), description="Quote ID.")
[docs] process = SchemaNode(String(), description="Corresponding process ID.")
[docs] steps = QuoteProcessListSchema(description="Child processes and prices.")
[docs] total = SchemaNode(Float(), description="Total of the quote including step processes.")
[docs]class QuotationList(SequenceSchema):
[docs] item = SchemaNode(String(), description="Bill ID.")
[docs]class QuotationListSchema(MappingSchema):
[docs] quotations = QuotationList()
[docs]class BillSchema(MappingSchema):
[docs] id = SchemaNode(String(), description="Bill ID.")
[docs] title = SchemaNode(String(), description="Name of the bill.")
[docs] description = SchemaNode(String(), missing=drop)
[docs] price = SchemaNode(Float(), description="Price associated to the bill.")
[docs] currency = SchemaNode(String(), description="Currency code in ISO-4217 format.")
[docs] created = SchemaNode(DateTime(), description="Creation date and time of the bill in ISO-8601 format.")
[docs] userId = SchemaNode(String(), description="User id that requested the quote.")
[docs] quotationId = SchemaNode(String(), description="Corresponding quote ID.", missing=drop)
[docs]class BillList(SequenceSchema):
[docs] item = SchemaNode(String(), description="Bill ID.")
[docs]class BillListSchema(MappingSchema):
[docs] bills = BillList()
[docs]class SupportedValues(MappingSchema): pass
[docs]class DefaultValues(MappingSchema): pass
[docs]class Unit(MappingSchema): pass
[docs]class UnitType(MappingSchema):
[docs] unit = Unit()
[docs]class ProcessInputDescriptionSchema(MappingSchema):
[docs] minOccurs = SchemaNode(Integer())
[docs] maxOccurs = SchemaNode(Integer())
[docs] title = SchemaNode(String())
[docs] dataType = SchemaNode(String())
[docs] abstract = SchemaNode(String())
[docs] id = SchemaNode(String())
[docs] defaultValue = SequenceSchema(DefaultValues())
[docs] supportedValues = SequenceSchema(SupportedValues())
[docs]class ProcessDescriptionSchema(MappingSchema):
[docs] outputs = SequenceSchema(ProcessOutputDescriptionSchema())
[docs] inputs = SequenceSchema(ProcessInputDescriptionSchema())
[docs] description = SchemaNode(String())
[docs] id = SchemaNode(String())
[docs] label = SchemaNode(String())
[docs]class UndeploymentResult(MappingSchema):
[docs] id = SchemaNode(String())
[docs]class DeploymentResult(MappingSchema):
[docs] processSummary = ProcessSummary()
[docs]class ProcessDescriptionBodySchema(MappingSchema):
[docs] process = ProcessDescriptionSchema()
[docs]class ProvidersSchema(SequenceSchema):
[docs] providers_service = ProviderSummarySchema()
[docs]class ProcessesSchema(SequenceSchema):
[docs] provider_processes_service = Process()
[docs]class JobOutputSchema(MappingSchema):
[docs] id = SchemaNode(String(), description="Job output id corresponding to process description outputs.")
[docs] data = SchemaNode(String(), missing=drop)
[docs] href = SchemaNode(String(), format=URL, missing=drop)
[docs] mimeType = SchemaNode(String(), missing=drop)
[docs] schema = SchemaNode(String(), missing=drop)
[docs] encoding = SchemaNode(String(), missing=drop)
[docs]class JobOutputsSchema(SequenceSchema):
[docs] output = JobOutputSchema()
[docs]class OutputInfo(OutputDataType, OneOfMappingSchema):
[docs] _one_of = (DataFloat, DataInteger, DataString, DataBoolean, Reference)
[docs]class OutputInfoList(SequenceSchema):
[docs] output = OutputInfo()
[docs]class ExceptionTextList(SequenceSchema):
[docs] text = SchemaNode(String())
[docs]class ExceptionSchema(MappingSchema):
[docs] Code = SchemaNode(String())
[docs] Locator = SchemaNode(String())
[docs] Text = ExceptionTextList()
[docs]class ExceptionsOutputSchema(SequenceSchema):
[docs] exceptions = ExceptionSchema()
[docs]class LogsOutputSchema(MappingSchema): pass
[docs]class FrontpageParameterSchema(MappingSchema):
[docs] name = SchemaNode(String(), example="api")
[docs] enabled = SchemaNode(Boolean(), example=True)
[docs] url = SchemaNode(String(), example="https://weaver-host", missing=drop)
[docs] doc = SchemaNode(String(), example="https://weaver-host/api", missing=drop)
[docs]class FrontpageParameters(SequenceSchema):
[docs] param = FrontpageParameterSchema()
[docs]class FrontpageSchema(MappingSchema):
[docs] message = SchemaNode(String(), default="Weaver Information", example="Weaver Information")
[docs] configuration = SchemaNode(String(), default="default", example="default")
[docs] parameters = FrontpageParameters()
[docs]class SwaggerJSONSpecSchema(MappingSchema): pass
[docs]class SwaggerUISpecSchema(MappingSchema): pass
[docs]class VersionsSpecSchema(MappingSchema):
[docs] name = SchemaNode(String(), description="Identification name of the current item.", example="weaver")
[docs] type = SchemaNode(String(), description="Identification type of the current item.", example="api")
[docs] version = SchemaNode(String(), description="Version of the current item.", example="0.1.0")
[docs]class VersionsList(SequenceSchema):
[docs] item = VersionsSpecSchema()
[docs]class VersionsSchema(MappingSchema):
[docs] versions = VersionsList()
[docs]class ConformanceList(SequenceSchema):
[docs] item = SchemaNode(String(), description="Conformance specification link.", example="http://www.opengis.net/spec/wfs-1/3.0/req/core")
[docs]class ConformanceSchema(MappingSchema):
[docs] conformsTo = ConformanceList()
################################# # Local Processes schemas #################################
[docs]class PackageBody(MappingSchema): pass
[docs]class ExecutionUnit(MappingSchema):
[docs] _one_of = (Reference, UnitType)
[docs]class ExecutionUnitList(SequenceSchema):
[docs] item = ExecutionUnit()
[docs]class ProcessOffering(MappingSchema):
[docs] process = Process()
[docs] processVersion = SchemaNode(String(), missing=drop)
[docs] jobControlOptions = JobControlOptionsList(missing=drop)
[docs] outputTransmission = TransmissionModeList(missing=drop)
[docs]class ProcessDescriptionChoiceType(OneOfMappingSchema):
[docs] _one_of = (Reference, ProcessOffering)
[docs]class Deploy(MappingSchema):
[docs] processDescription = ProcessDescriptionChoiceType()
[docs] immediateDeployment = SchemaNode(Boolean(), missing=drop, default=True)
[docs] executionUnit = ExecutionUnitList()
[docs] deploymentProfileName = SchemaNode(String(), missing=drop)
[docs] owsContext = OWSContext(missing=drop)
[docs]class PostProcessesEndpoint(MappingSchema):
[docs] header = AcceptHeader()
[docs] body = Deploy(title="Deploy")
[docs]class PostProcessJobsEndpoint(ProcessPath):
[docs] header = AcceptLanguageHeader()
[docs] body = Execute()
[docs]class GetJobsQueries(MappingSchema):
[docs] detail = SchemaNode(Boolean(), description="Provide job details instead of IDs.", default=False, example=True, missing=drop)
[docs] groups = SchemaNode(String(), description="Comma-separated list of grouping fields with which to list jobs.", default=False, example="process,service", missing=drop)
[docs] page = SchemaNode(Integer(), missing=drop, default=0)
[docs] limit = SchemaNode(Integer(), missing=drop, default=10)
[docs] status = JobStatusEnum(missing=drop)
[docs] process = SchemaNode(String(), missing=drop, default=None)
[docs] provider = SchemaNode(String(), missing=drop, default=None)
[docs] sort = JobSortEnum(missing=drop)
[docs] tags = SchemaNode(String(), missing=drop, default=None, description="Comma-separated values of tags assigned to jobs")
[docs]class GetJobsRequest(MappingSchema):
[docs] header = AcceptHeader()
[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 = AcceptHeader()
[docs]class DeleteProcessJobEndpoint(ProcessPath):
[docs] header = AcceptHeader()
[docs]class BillsEndpoint(MappingSchema):
[docs] header = AcceptHeader()
[docs]class BillEndpoint(BillPath):
[docs] header = AcceptHeader()
[docs]class ProcessQuotesEndpoint(ProcessPath):
[docs] header = AcceptHeader()
[docs]class ProcessQuoteEndpoint(ProcessPath, QuotePath):
[docs] header = AcceptHeader()
[docs]class GetQuotesQueries(MappingSchema):
[docs] page = SchemaNode(Integer(), missing=drop, default=0)
[docs] limit = SchemaNode(Integer(), missing=drop, default=10)
[docs] process = SchemaNode(String(), missing=drop, default=None)
[docs] sort = QuoteSortEnum(missing=drop)
[docs]class QuotesEndpoint(MappingSchema):
[docs] header = AcceptHeader()
[docs] querystring = GetQuotesQueries()
[docs]class QuoteEndpoint(QuotePath):
[docs] header = AcceptHeader()
[docs]class PostProcessQuote(ProcessPath, QuotePath):
[docs] header = AcceptHeader()
[docs] body = MappingSchema(default={})
[docs]class PostQuote(QuotePath):
[docs] header = AcceptHeader()
[docs] body = MappingSchema(default={})
[docs]class PostProcessQuoteRequestEndpoint(ProcessPath, QuotePath):
[docs] header = AcceptHeader()
[docs] body = QuoteProcessParametersSchema()
################################# # Provider Processes schemas #################################
[docs]class GetProviders(MappingSchema):
[docs] header = AcceptHeader()
[docs]class PostProvider(MappingSchema):
[docs] header = AcceptHeader()
[docs] body = CreateProviderRequestBody()
[docs]class GetProviderProcesses(MappingSchema):
[docs] header = AcceptHeader()
[docs]class GetProviderProcess(MappingSchema):
[docs] header = AcceptHeader()
[docs]class PostProviderProcessJobRequest(MappingSchema): """Launching a new process request definition."""
[docs] header = AcceptHeader()
[docs] querystring = LaunchJobQuerystring()
[docs] body = Execute()
################################# # Responses schemas #################################
[docs]class ErrorJsonResponseBodySchema(MappingSchema):
[docs] code = SchemaNode(String(), example="NoApplicableCode")
[docs] description = SchemaNode(String(), example="Not authorized to access this resource.")
[docs]class UnauthorizedJsonResponseSchema(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ErrorJsonResponseBodySchema()
[docs]class OkGetFrontpageResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = FrontpageSchema()
[docs]class OkGetSwaggerJSONResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = SwaggerJSONSpecSchema(description="Swagger JSON of weaver API.")
[docs]class OkGetSwaggerUIResponse(MappingSchema):
[docs] header = HtmlHeader()
[docs] body = SwaggerUISpecSchema(description="Swagger UI of weaver API.")
[docs]class OkGetVersionsResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = VersionsSchema()
[docs]class OkGetConformanceResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ConformanceSchema()
[docs]class OkGetProvidersListResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ProvidersSchema()
[docs]class InternalServerErrorGetProvidersListResponse(MappingSchema):
[docs] description = "Unhandled error occurred during providers listing."
[docs]class OkGetProviderCapabilitiesSchema(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ProviderCapabilitiesSchema()
[docs]class InternalServerErrorGetProviderCapabilitiesResponse(MappingSchema):
[docs] description = "Unhandled error occurred during provider capabilities request."
[docs]class NoContentDeleteProviderSchema(MappingSchema):
[docs] header = JsonHeader()
[docs] body = MappingSchema(default={})
[docs]class InternalServerErrorDeleteProviderResponse(MappingSchema):
[docs] description = "Unhandled error occurred during provider removal."
[docs]class NotImplementedDeleteProviderResponse(MappingSchema):
[docs] description = "Provider removal not supported using referenced storage."
[docs]class OkGetProviderProcessesSchema(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ProcessesSchema()
[docs]class InternalServerErrorGetProviderProcessesListResponse(MappingSchema):
[docs] description = "Unhandled error occurred during provider processes listing."
[docs]class GetProcessesQuery(MappingSchema):
[docs] providers = SchemaNode( 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 = SchemaNode( Boolean(), example=True, default=True, missing=drop, description="Return summary details about each process, or simply their IDs."
)
[docs]class GetProcessesEndpoint(MappingSchema):
[docs] querystring = GetProcessesQuery()
[docs]class OkGetProcessesListResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ProcessCollection()
[docs]class InternalServerErrorGetProcessesListResponse(MappingSchema):
[docs] description = "Unhandled error occurred during processes listing."
[docs]class OkPostProcessDeployBodySchema(MappingSchema):
[docs] deploymentDone = SchemaNode(Boolean(), description="Indicates if the process was successfully deployed.", default=False, example=True)
[docs] processSummary = ProcessSummary(missing=drop, description="Deployed process summary if successful.")
[docs] failureReason = SchemaNode(String(), missing=drop, description="Description of deploy failure if applicable.")
[docs]class OkPostProcessesResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = OkPostProcessDeployBodySchema()
[docs]class InternalServerErrorPostProcessesResponse(MappingSchema):
[docs] description = "Unhandled error occurred during process deployment."
[docs]class OkGetProcessInfoResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ProcessOffering()
[docs]class InternalServerErrorGetProcessResponse(MappingSchema):
[docs] description = "Unhandled error occurred during process description."
[docs]class OkGetProcessPackageSchema(MappingSchema):
[docs] header = JsonHeader()
[docs] body = MappingSchema(default={})
[docs]class InternalServerErrorGetProcessPackageResponse(MappingSchema):
[docs] description = "Unhandled error occurred during process package description."
[docs]class OkGetProcessPayloadSchema(MappingSchema):
[docs] header = JsonHeader()
[docs] body = MappingSchema(default={})
[docs]class InternalServerErrorGetProcessPayloadResponse(MappingSchema):
[docs] description = "Unhandled error occurred during process payload description."
[docs]class ProcessVisibilityResponseBodySchema(MappingSchema):
[docs] value = SchemaNode(String(), validator=OneOf(list(VISIBILITY_VALUES)), example=VISIBILITY_PUBLIC)
[docs]class OkGetProcessVisibilitySchema(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ProcessVisibilityResponseBodySchema()
[docs]class InternalServerErrorGetProcessVisibilityResponse(MappingSchema):
[docs] description = "Unhandled error occurred during process visibility retrieval."
[docs]class OkPutProcessVisibilitySchema(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ProcessVisibilityResponseBodySchema()
[docs]class InternalServerErrorPutProcessVisibilityResponse(MappingSchema):
[docs] description = "Unhandled error occurred during process visibility update."
[docs]class OkDeleteProcessUndeployBodySchema(MappingSchema):
[docs] deploymentDone = SchemaNode(Boolean(), description="Indicates if the process was successfully undeployed.", default=False, example=True)
[docs] identifier = SchemaNode(String(), example="workflow")
[docs] failureReason = SchemaNode(String(), missing=drop, description="Description of undeploy failure if applicable.")
[docs]class OkDeleteProcessResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = OkDeleteProcessUndeployBodySchema()
[docs]class InternalServerErrorDeleteProcessResponse(MappingSchema):
[docs] description = "Unhandled error occurred during process deletion."
[docs]class OkGetProviderProcessDescriptionResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ProcessDescriptionBodySchema()
[docs]class InternalServerErrorGetProviderProcessResponse(MappingSchema):
[docs] description = "Unhandled error occurred during provider process description."
[docs]class CreatedPostProvider(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ProviderSummarySchema()
[docs]class InternalServerErrorPostProviderResponse(MappingSchema):
[docs] description = "Unhandled error occurred during provider process registration."
[docs]class NotImplementedPostProviderResponse(MappingSchema):
[docs] description = "Provider registration not supported using referenced storage."
[docs]class CreatedLaunchJobResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = CreatedJobStatusSchema()
[docs]class InternalServerErrorPostProcessJobResponse(MappingSchema):
[docs] description = "Unhandled error occurred during process job submission."
[docs]class InternalServerErrorPostProviderProcessJobResponse(MappingSchema):
[docs] description = "Unhandled error occurred during process job submission."
[docs]class OkGetProcessJobResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = JobStatusInfo()
[docs]class OkDeleteProcessJobResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = DismissedJobSchema()
[docs]class OkGetQueriedJobsResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = GetQueriedJobsSchema()
[docs]class InternalServerErrorGetJobsResponse(MappingSchema):
[docs] description = "Unhandled error occurred during jobs listing."
[docs]class OkDismissJobResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = DismissedJobSchema()
[docs]class InternalServerErrorDeleteJobResponse(MappingSchema):
[docs] description = "Unhandled error occurred during job dismiss request."
[docs]class OkGetJobStatusResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = JobStatusInfo()
[docs]class InternalServerErrorGetJobStatusResponse(MappingSchema):
[docs] description = "Unhandled error occurred during provider process description."
[docs]class Result(MappingSchema):
[docs] outputs = OutputInfoList()
[docs]class OkGetJobResultsResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = Result()
[docs]class InternalServerErrorGetJobResultsResponse(MappingSchema):
[docs] description = "Unhandled error occurred during job results listing."
[docs]class OkGetOutputResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = JobOutputSchema()
[docs]class InternalServerErrorGetJobOutputResponse(MappingSchema):
[docs] description = "Unhandled error occurred during job results listing."
[docs]class CreatedQuoteExecuteResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = CreatedQuotedJobStatusSchema()
[docs]class InternalServerErrorPostQuoteExecuteResponse(MappingSchema):
[docs] description = "Unhandled error occurred during quote job execution."
[docs]class CreatedQuoteRequestResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = QuoteSchema()
[docs]class InternalServerErrorPostQuoteRequestResponse(MappingSchema):
[docs] description = "Unhandled error occurred during quote submission."
[docs]class OkGetQuoteInfoResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = QuoteSchema()
[docs]class InternalServerErrorGetQuoteInfoResponse(MappingSchema):
[docs] description = "Unhandled error occurred during quote retrieval."
[docs]class OkGetQuoteListResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = QuotationListSchema()
[docs]class InternalServerErrorGetQuoteListResponse(MappingSchema):
[docs] description = "Unhandled error occurred during quote listing."
[docs]class OkGetBillDetailResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = BillSchema()
[docs]class InternalServerErrorGetBillInfoResponse(MappingSchema):
[docs] description = "Unhandled error occurred during bill retrieval."
[docs]class OkGetBillListResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = BillListSchema()
[docs]class InternalServerErrorGetBillListResponse(MappingSchema):
[docs] description = "Unhandled error occurred during bill listing."
[docs]class OkGetJobExceptionsResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = ExceptionsOutputSchema()
[docs]class InternalServerErrorGetJobExceptionsResponse(MappingSchema):
[docs] description = "Unhandled error occurred during job exceptions listing."
[docs]class OkGetJobLogsResponse(MappingSchema):
[docs] header = JsonHeader()
[docs] body = LogsOutputSchema()
[docs]class InternalServerErrorGetJobLogsResponse(MappingSchema):
[docs] description = "Unhandled error occurred during job logs listing."
[docs]get_api_frontpage_responses = { "200": OkGetFrontpageResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"),
}
[docs]get_api_swagger_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_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 = { # FIXME: # status should be 201 when properly modified to match API conformance # https://github.com/crim-ca/weaver/issues/14 "200": OkPostProcessesResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorPostProcessesResponse(),
}
[docs]get_process_responses = { "200": OkGetProcessInfoResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetProcessResponse(),
}
[docs]get_process_package_responses = { "200": OkGetProcessPackageSchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetProcessPackageResponse(),
}
[docs]get_process_payload_responses = { "200": OkGetProcessPayloadSchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetProcessPayloadResponse(),
}
[docs]get_process_visibility_responses = { "200": OkGetProcessVisibilitySchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetProcessVisibilityResponse(),
}
[docs]put_process_visibility_responses = { "200": OkPutProcessVisibilitySchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorPutProcessVisibilityResponse(),
}
[docs]delete_process_responses = { "200": OkDeleteProcessResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorDeleteProcessResponse(),
}
[docs]get_providers_list_responses = { "200": OkGetProvidersListResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetProvidersListResponse(),
}
[docs]get_provider_responses = { "200": OkGetProviderCapabilitiesSchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetProviderCapabilitiesResponse(),
}
[docs]delete_provider_responses = { "204": NoContentDeleteProviderSchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorDeleteProviderResponse(), "501": NotImplementedDeleteProviderResponse(),
}
[docs]get_provider_processes_responses = { "200": OkGetProviderProcessesSchema(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetProviderProcessesListResponse(),
}
[docs]get_provider_process_responses = { "200": OkGetProviderProcessDescriptionResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetProviderProcessResponse(),
}
[docs]post_provider_responses = { "201": CreatedPostProvider(description="success"), "400": MappingSchema(description=OWSMissingParameterValue.explanation), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorPostProviderResponse(), "501": NotImplementedPostProviderResponse(),
}
[docs]post_provider_process_job_responses = { "201": CreatedLaunchJobResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorPostProviderProcessJobResponse(),
}
[docs]post_process_jobs_responses = { "201": CreatedLaunchJobResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorPostProcessJobResponse(),
}
[docs]get_all_jobs_responses = { "200": OkGetQueriedJobsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetJobsResponse(),
}
[docs]get_single_job_status_responses = { "200": OkGetJobStatusResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetJobStatusResponse(),
}
[docs]delete_job_responses = { "200": OkDismissJobResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorDeleteJobResponse(),
}
[docs]get_job_results_responses = { "200": OkGetJobResultsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetJobResultsResponse(),
}
[docs]get_job_output_responses = { "200": OkGetOutputResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetJobOutputResponse(),
}
[docs]get_exceptions_responses = { "200": OkGetJobExceptionsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "500": InternalServerErrorGetJobExceptionsResponse(),
}
[docs]get_logs_responses = { "200": OkGetJobLogsResponse(description="success"), "401": UnauthorizedJsonResponseSchema(description="unauthorized"), "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(),
} ################################################################# # Utility methods #################################################################
[docs]def service_api_route_info(service_api, settings): api_base = wps_restapi_base_path(settings) return {"name": service_api.name, "pattern": "{base}{path}".format(base=api_base, path=service_api.path)}