404
+ +Page not found
+ + +diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..3946712 --- /dev/null +++ b/404.html @@ -0,0 +1,167 @@ + + +
+ + + + +Page not found
+ + +The authentication function for this repo has been set using the predefined validator function in the Authenticator class. The following example will demonstrate how to provide your own auth function for a given endpoint.
+You can either inherit the authenticator class and overwrite the validate function, or provide an entirely new function. In either case, it's worth noting that the return value for any provided authentication function currently needs to be of type User. If you want to additionally change the return type you may have to overwrite the endpoint entirely.
+client = OpenEOCore(
+ ...
+)
+
+api = OpenEOApi(client=client, app=FastAPI())
+
+def cool_new_auth():
+ return User(user_id=specific_uuid, oidc_sub="the-only-user")
+
+core_api.override_authentication(cool_new_auth)
+
+Now any endpoints that originally used the Authenticator.validate function, will now use cool_new_auth instead.
+ +Currently it's possible to extend the object relational models that the api uses in order to support extra values a backend might want to includse in any EndpointRegisters.
+In order to effectively use the extended models, you need to update the models.py file found in the alembic directory. After updating the models.py file, you will need to manually update the endpoints where you would like the new model to be used. This is a current pain point, and it would be good to improve this in the future.
+from openeo_fastapi.client.psql.settings import BASE
+from openeo_fastapi.client.psql.models import *
+
+metadata = BASE.metadata
+
+from typing import Optional
+from openeo_fastapi.client.jobs import Job
+from openeo_fastapi.client.psql.settings import BASE
+from openeo_fastapi.client.psql.models import *
+
+class ExtendedJobORM(JobORM):
+
+ special_string = Column(VARCHAR, nullable=True)
+ """A very special string."""
+
+
+class ExtendedJob(Job):
+
+ special_string: Optional[str]
+ """A very special string."""
+
+ @classmethod
+ def get_orm(cls):
+ return ExtendedJobORM
+
+
+metadata = BASE.metadata
+
+In order use the class ExtendedJob, we will need to extend the register. The example below extends the JobRegister and edits the create_job function to create the ExtendedJob and includes setting the value for the new parameter. You will need to version the database in order for the new model to work, and additionally add the NewJobsRegister to the app instance See Registers.
+...
+from openeo_fastapi.client.jobs import JobsRegister
+from openeo_argoworkflows_api.psql.models import ExtendedJob
+
+class NewJobsRegister(JobsRegister):
+
+ def __init__(self, settings, links) -> None:
+ super().__init__(settings, links)
+
+
+ def create_job(
+ self, body: JobsRequest
+ ):
+ """Create a new ExtendedJob.
+ """
+
+ # Create the job
+ job = ExtendedJob(
+ job_id=job_id,
+ process=body.process,
+ status=Status.created,
+ title=body.title,
+ description=body.description,
+ user_id=user.user_id,
+ created=datetime.datetime.now(),
+ special_string="A new type of job."
+ )
+
+ engine.create(create_object=job)
+
+ return Response(
+ status_code=201,
+ )
+
+
+ The endpoint registers are a loose abstraction defining what endpoints a register is responsible for, and also what code is expected to be executed for those endpoints.
+The available registers can be imported as follows.
+from openeo_fastapi.client.jobs import JobsRegister
+from openeo_fastapi.client.files import FilesRegister
+from openeo_fastapi.client.processes import ProcessesRegister
+from openeo_fastapi.client.collections import CollectionsRegister
+
+You will need to know how you are expected to overwrite the functionality of these registers, as the openeo-fastapi package does not define functionality for all available endpoints.
+In the following example, we import the FileRegister, and overwrite the functionality for the list_files method. This will define a new response for that endpoint. This is the framework for editing the functionality of the api endpoints.
+from openeo_fastapi.client.files import FilesRegister
+
+class OverwrittenFileRegister(FilesRegister):
+ def __init__(self, settings, links) -> None:
+ super().__init__(settings, links)
+
+ def list_files(
+ self,
+ limit: Optional[int] = 10
+ ):
+ """ """
+ return FilesGetResponse(
+ files=[File(path="/somefile.txt", size=10)],
+ links=[
+ Link(
+ href="https://eodc.eu/",
+ rel="about",
+ type="text/html",
+ title="Homepage of the service provider",
+ )
+ ],
+ )
+
+In order to use this overwritten file register, we instantiate the register, and parse this to the OpenEOCore object. Now, when the api is next deployed, we will return the FilesGetResponse, and not the default HTTPException.
+extended_register = OverwrittenFileRegister(app_settings, test_links)
+
+client = OpenEOCore(
+ ...
+ files=extended_register,
+ ...
+)
+
+api = OpenEOApi(client=client, app=FastAPI())
+
+The registers can also be extended to include extra functionality. In order to do this, we again need to define a new child class for the register you want to extend.
+We can define a new endpoint for the api as follows.
+from openeo_fastapi.api.types import Endpoint
+new_endpoint = Endpoint(
+ path="/files/{path}",
+ methods=["HEAD"],
+)
+
+When defining the child register, the _initialize_endpoints method needs to be redefined to add the new_endpoint object. The new functionality can be defined under a new function, here get_file_headers.
+from openeo_fastapi.client.files import FilesRegister, FILE_ENDPOINTS
+
+class ExtendedFileRegister(FilesRegister):
+ def __init__(self, settings, links) -> None:
+ super().__init__(settings, links)
+ self.endpoints = self._initialize_endpoints()
+
+ def _initialize_endpoints(self) -> list[Endpoint]:
+ endpoints = list(FILE_ENDPOINTS)
+ endpoints.append(new_endpoint)
+ return endpoints
+
+ def get_file_headers(
+ self, path: str, user: User = Depends(Authenticator.validate)
+ ):
+ """ """
+ return Response(
+ status_code=200,
+ headers={
+ "Accept-Ranges": "bytes",
+ },
+ )
+
+client = OpenEOCore(
+ ...
+ files=extended_register,
+ ...
+)
+
+api = OpenEOApi(client=client, app=FastAPI())
+
+So far, we have made the new code available to the api, but the api does not know how or when to execute the new code. The following snippet will register the new path to the api server, along with the functionality.
+api.app.router.add_api_route(
+ name="file_headers",
+ path=f"/{api.client.settings.OPENEO_VERSION}/files" + "/{path}",
+ response_model=None,
+ response_model_exclude_unset=False,
+ response_model_exclude_none=True,
+ methods=["HEAD"],
+ endpoint=api.client.files.get_file_headers,
+)
+
+
+ The openeo-fastapi is a package intended to assist developers to quickly get their OpenEO Api implementation +up and running without the need to start from scratch. The package defines a framework for developing +your OpenEO Api application, allowing you to use your own processing implementations, apply your own extensions +to the database schema, and finally increase the offering of the baseline api with any additional endpoints you +would like to add.
+ + +OpenEO Api class for preparing the FastApi object from the client that is provided by the user.
+ +@attr.define
+class OpenEOApi()
+
+Factory for creating FastApi applications conformant to the OpenEO Api specification.
+ +def register_well_known()
+
+Register well known endpoint (GET /.well-known/openeo).
+ +def register_get_capabilities()
+
+Register endpoint for capabilities (GET /).
+ +def register_get_conformance()
+
+Register endpoint for api conformance (GET /conformance).
+ +def register_get_credentials_oidc()
+
+Register endpoint for api conformance (GET /conformance).
+ +def register_get_file_formats()
+
+Register endpoint for supported file formats (GET /file_formats).
+ +def register_get_health()
+
+Register endpoint for api health (GET /health).
+ +def register_get_user_info()
+
+Register endpoint for user info (GET /me).
+ +def register_get_udf_runtimes()
+
+Register endpoint to list the supported udf runtimes (GET /udf_runtimes).
+ +def register_validate_user_process_graph()
+
+Register endpoint for validating a user process graph (GET /validation).
+ +def register_run_sync_job()
+
+Register endpoint for executing synchronous jobs (GET /result).
+ +def register_get_collections()
+
+Register endpoint for listing available collections (GET /collections).
+ +def register_get_collection()
+
+Register endpoint for getting a specific collection (GET /collections/{collection_id}).
+ +def register_get_collection_items()
+
+Register endpoint for getting collection items (GET /collections/{collection_id}/items).
+ +def register_get_collection_item()
+
+Register endpoint for getting a specific collection item (GET /collections/{collection_id}/items/{item_id}).
+ +def register_get_processes()
+
+Register endpoint for listing all predefined processes (GET /processes).
+ +def register_list_user_process_graphs()
+
+Register endpoint for listing user defined processes graphs (GET /processes_graphs).
+ +def register_get_user_process_graph()
+
+Register endpoint for getting a specific user defined processes graphs (GET /processes_graphs/{process_graph_id}).
+ +def register_put_user_process_graph()
+
+Register endpoint for creatings a user defined processes graph (PUT /processes_graphs/{process_graph_id}).
+ +def register_delete_user_process_graph()
+
+Register endpoint for deleting a user defined processes graph (DELETE /processes_graphs/{process_graph_id}).
+ +def register_get_jobs()
+
+Register endpoint for listing all jobs (GET /jobs).
+ +def register_create_job()
+
+Register endpoint for creating a new job (POST /jobs).
+ +def register_update_job()
+
+Register update jobs endpoint (POST /jobs/{job_id}).
+ +def register_get_job()
+
+Register endpoint for retreiving job metadata (GET /jobs/{job_id}).
+ +def register_delete_job()
+
+Register endpoint for deleting the record of a batch job (GET /jobs/{job_id}).
+ +def register_get_estimate()
+
+Register endpoint for estimating a batch job (GET /jobs/{job_id}).
+ +def register_get_logs()
+
+Register endpoint for retrieving job logs (GET /jobs/{job_id}).
+ +def register_get_results()
+
+Register endpoint for getting the results from a batch job (GET /jobs/{job_id}).
+ +def register_start_job()
+
+Register endpoint for starting batch job processing (GET /jobs/{job_id}).
+ +def register_cancel_job()
+
+Register endpoint for cancelling job processing (GET /jobs/{job_id}).
+ +def register_list_files()
+
+Register endpoint for listing a user's fils (GET /files).
+ +def register_download_file()
+
+Register endpoint for downloading a specific file (GET /files/{path}).
+ +def register_upload_file()
+
+Register endpoint for uploading a new file (PUT /files/{path}).
+ +def register_delete_file()
+
+Register endpoint for deleting a new file (DELETE /files/{path}).
+ +def register_core()
+
+Add application logic to the API layer.
+ +def http_exception_handler(request, exception)
+
+Register exception handler to turn python exceptions into expected OpenEO error output.
+ +def __attrs_post_init__()
+
+Post-init hook responsible for setting up the application upon instantiation of the class.
+ +Pydantic Models describing different api request and response bodies.
+ +class Capabilities(BaseModel)
+
+Response model for GET (/).
+ +class MeGetResponse(BaseModel)
+
+Response model for GET (/me).
+ +class ConformanceGetResponse(BaseModel)
+
+Response model for GET (/conformance).
+ +class WellKnownOpeneoGetResponse(BaseModel)
+
+Response model for GET (/.well-known/openeo).
+ +class UdfRuntimesGetResponse(BaseModel)
+
+Response model for GET (/udf_runtimes).
+ +class Collection(BaseModel)
+
+Response model for GET (/collection/{collection_id})
+ +class Collections(TypedDict)
+
+Response model for GET (/collections).
+ +class ProcessesGetResponse(BaseModel)
+
+Response model for GET (/processes).
+ +class ProcessGraphWithMetadata(Process)
+
+Reponse model for + GET (/process_graphs/{process_graph_id})
+Request model for + PUT (/process_graphs/{process_graph_id}) + POST (/validation)
+ +class ProcessGraphsGetResponse(BaseModel)
+
+Response model for GET (/process_graphs).
+ +class ValidationPostResponse(BaseModel)
+
+Response model for POST (/validation).
+ +class BatchJob(BaseModel)
+
+Reponse model for GET (/jobs/{job_id}).
+ +class JobsGetResponse(BaseModel)
+
+Reponse model for GET (/jobs).
+ +class JobsGetLogsResponse(BaseModel)
+
+Reponse model for GET (/jobs/{job_id}/logs).
+ +class JobsGetEstimateGetResponse(BaseModel)
+
+Reponse model for GET (/jobs/{job_id}/estimate).
+ +class JobsRequest(BaseModel)
+
+Request model for +POST (/jobs) +PATCH (/jobs/{job_id}) +POST (/result)
+ +class FilesGetResponse(BaseModel)
+
+Reponse model for GET (/files).
+ +class FileFormatsGetResponse(BaseModel)
+
+Reponse model for GET (/file_formats).
+ +Pydantic Models and Enums describining different attribute types used by the models in openeo_fastapi.api.models.
+ +class STACConformanceClasses(Enum)
+
+Available conformance classes with STAC.
+ +class DinensionEnum(Enum)
+
+Dimension enum.
+ +class Type5(Enum)
+
+Catalog enum.
+ +class Method(Enum)
+
+HTTP Methods enum.
+ +class Status(Enum)
+
+Job Status enum.
+ +class Level(Enum)
+
+Log level enum.
+ +class GisDataType(Enum)
+
+Data type enum.
+ +class Role(Enum)
+
+Role for collection provider.
+ +class RFC3339Datetime(BaseModel)
+
+Model to consistently represent datetimes as strings compliant to RFC3339Datetime.
+ +class Endpoint(BaseModel)
+
+Model to capture the available endpoint and it's accepted models.
+ +class Plan(BaseModel)
+
+Model to capture the the plan the user has subscribe to.
+ +class Billing(BaseModel)
+
+Model to capture the billing options that are available at the backend.
+ +class File(BaseModel)
+
+Model to capture the stat information of a file stored at the backend.
+ +class UsageMetric(BaseModel)
+
+Model to capture the value and unit of a given metric.
+ +class Usage(BaseModel)
+
+Model to capture the usage of a job.
+ +class Link(BaseModel)
+
+Model to describe the information for a provided URL.
+ +class LogEntry(BaseModel)
+
+Model to describe the information for a given log line in job logs.
+ +class Process(BaseModel)
+
+Model to describe a process that is exposed by the api.
+ +class Error(BaseModel)
+
+Model to describe the information of a captured exception by the api.
+ +class FileFormat(BaseModel)
+
+Model to describe a file format supported by the processing backend.
+ +class Storage(BaseModel)
+
+Model to describe the storage resources available to a given user.
+ +class Version(BaseModel)
+
+Model to describe the version of an api that is available.
+ +class StacProvider(BaseModel)
+
+Model to describe the provider of a given stac resource.
+ +class Dimension(BaseModel)
+
+Model to describe the dimension of some data.
+ +class Spatial(BaseModel)
+
+Model to describe the spatial extent of a collection.
+ +class Temporal(BaseModel)
+
+Model to describe the temporal range of a collection.
+ +class Extent(BaseModel)
+
+Model to describe the complete spatiotemporal extent of a collection.
+ +CLI to support quick initialisation of the project source directory.
+ +@click.group()
+def cli()
+
+Defining group for executor CLI.
+ +@click.command()
+@click.option("--path", default=None, type=str)
+def new(path)
+
+Initialize a source directory for an openeo_fastapi api project at the specified location.
+ +Class and model to define the framework and partial application logic for interacting with Jobs.
+Classes: + - User: Framework for defining and extending the logic for working with BatchJobs. + - Authenticator: Class holding the abstract validation method used for authentication for API endpoints. + - AuthMethod: Enum defining the available auth methods. + - AuthToken: Pydantic model for breaking and validating an OpenEO Token into it's consituent parts. + - IssuerHandler: Class for handling the AuthToken and validating against the revelant token Issuer and AuthMethod.
+ +class User(BaseModel)
+
+Pydantic model manipulating users.
+ +class Config()
+
+Pydantic model class config.
+ +@classmethod
+def get_orm(cls)
+
+Get the ORM model for this pydantic model.
+ +class Authenticator(ABC)
+
+Basic class to hold the validation call to be used by the api endpoints requiring authentication.
+ +@abstractmethod
+def validate(authorization: str = Header())
+
+Validate the authorisation header and create a new user. This method can be overwritten as needed.
+Arguments:
+authorization
str - The authorisation header content from the request headers.Returns:
+User
- The authenticated user.class AuthMethod(Enum)
+
+Enum defining known auth methods.
+ +class AuthToken(BaseModel)
+
+The AuthToken breaks down the OpenEO token into its consituent parts to be used for validation.
+ +@classmethod
+def from_token(cls, token: str)
+
+Takes the openeo format token, splits it into the component parts, and returns an Auth token.
+ +class IssuerHandler(BaseModel)
+
+General token handler for querying provided tokens against issuers.
+ +def validate_token(token: str)
+
+Try to validate the token against the give OIDC provider.
+Arguments:
+token
str - The OpenEO token to be parsed and validated against the oidc provider.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+The JSON as dictionary from _validate_oidc_token.
+ +Class and model to define the framework and partial application logic for interacting with Collections.
+Classes: + - CollectionRegister: Framework for defining and extending the logic for working with Collections.
+ +class CollectionRegister(EndpointRegister)
+
+The CollectionRegister to regulate the application logic for the API behaviour.
+ +def __init__(settings) -> None
+
+Initialize the CollectionRegister.
+Arguments:
+settings
AppSettings - The AppSettings that the application will use.async def get_collection(collection_id)
+
+Returns Metadata for specific datasetsbased on collection_id (str).
+Arguments:
+collection_id
str - The collection id to request from the proxy.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+Collection
- The proxied request returned as a Collection.async def get_collections()
+
+Returns Basic metadata for all datasets
+Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+Collections
- The proxied request returned as a Collections object.async def get_collection_items(collection_id)
+
+Returns Basic metadata for all datasets.
+Arguments:
+collection_id
str - The collection id to request from the proxy.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+The direct response from the request to the stac catalogue.
+ +async def get_collection_item(collection_id, item_id)
+
+Returns Basic metadata for all datasets
+Arguments:
+collection_id
str - The collection id to request from the proxy.item_id
str - The item id to request from the proxy.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+The direct response from the request to the stac catalogue.
+ +Class and model to define the framework and partial application logic for interacting with Jobs.
+Classes: + - OpenEOCore: Framework for defining the application logic that will passed onto the OpenEO Api.
+ +@define
+class OpenEOCore()
+
+Client for defining the application logic for the OpenEO Api.
+ +def __attrs_post_init__()
+
+Post init hook to set the client registers, if none where provided by the user set to the defaults!
+ +def get_capabilities() -> Capabilities
+
+Get the capabilities of the api.
+Returns:
+Capabilities
- The capabilities of the api based off what the user provided.def get_conformance() -> ConformanceGetResponse
+
+Get the capabilities of the api.
+Returns:
+ConformanceGetResponse
- The conformance classes that this Api wil of the api based off what the user provided.def get_file_formats() -> FileFormatsGetResponse
+
+Get the supported file formats for processing input and output.
+Returns:
+FileFormatsGetResponse
- The response defining the input and output formats.def get_health()
+
+Basic health endpoint expected to return status code 200.
+Returns:
+Response
- Status code 200.def get_user_info(user: User = Depends(
+ Authenticator.validate)) -> MeGetResponse
+
+Get the supported file formats for processing input and output.
+Returns:
+MeGetResponse
- The user information for the validated user.def get_well_known() -> WellKnownOpeneoGetResponse
+
+Get the supported file formats for processing input and output.
+Returns:
+WellKnownOpeneoGetResponse
- The api/s which are exposed at this server.def get_udf_runtimes() -> UdfRuntimesGetResponse
+
+Get the supported file formats for processing input and output.
+Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+UdfRuntimesGetResponse
- The metadata for the requested BatchJob.Class and model to define the framework and partial application logic for interacting with Files.
+Classes: + - FilesRegister: Framework for defining and extending the logic for working with Files.
+ +class FilesRegister(EndpointRegister)
+
+
+def list_files(limit: Optional[int] = 10,
+ user: User = Depends(Authenticator.validate))
+
+List the files in the user workspace.
+Arguments:
+limit
int - The limit to apply to the length of the list.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.def download_file(path: str, user: User = Depends(Authenticator.validate))
+
+Download the file from the user's workspace.
+Arguments:
+path
str - The path leading to the file.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.def upload_file(path: str, user: User = Depends(Authenticator.validate))
+
+Upload the file from the user's workspace.
+Arguments:
+path
str - The path leading to the file.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.def delete_file(path: str, user: User = Depends(Authenticator.validate))
+
+Delete the file from the user's workspace.
+Arguments:
+path
str - The path leading to the file.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Class and model to define the framework and partial application logic for interacting with Jobs.
+Classes: + - JobsRegister: Framework for defining and extending the logic for working with BatchJobs. + - Job: The pydantic model used as an in memory representation of an OpenEO Job.
+ +class Job(BaseModel)
+
+Pydantic model representing an OpenEO Job.
+ +class Config()
+
+Pydantic model class config.
+ +@classmethod
+def get_orm(cls)
+
+Get the ORM model for this pydantic model.
+ +def patch(patch: Any)
+
+Update pydantic model with changed fields from a new model instance.
+ +class JobsRegister(EndpointRegister)
+
+The JobRegister to regulate the application logic for the API behaviour.
+ +def __init__(settings, links) -> None
+
+Initialize the JobRegister.
+Arguments:
+settings
AppSettings - The AppSettings that the application will use.links
Links - The Links to be used in some function responses.def list_jobs(limit: Optional[int] = 10,
+ user: User = Depends(Authenticator.validate))
+
+List the user's most recent BatchJobs.
+Arguments:
+limit
int - The limit to apply to the length of the list.user
User - The User returned from the Authenticator.Returns:
+JobsGetResponse
- A list of the user's BatchJobs.def create_job(body: JobsRequest,
+ user: User = Depends(Authenticator.validate))
+
+Create a new BatchJob.
+Arguments:
+body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.Returns:
+Response
- A general FastApi response to signify the changes where made as expected. Specific response
+ headers need to be set in this response to ensure certain behaviours when being used by OpenEO client modules.def update_job(job_id: uuid.UUID,
+ body: JobsRequest,
+ user: User = Depends(Authenticator.validate))
+
+Update the specified BatchJob with the contents of the provided JobsRequest.
+Arguments:
+job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to update the new BatchJob.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+Response
- A general FastApi response to signify the changes where made as expected.def get_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate))
+
+Get and return the metadata for the BatchJob.
+Arguments:
+job_id
JobId - A UUID job id.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+BatchJob
- The metadata for the requested BatchJob.def delete_job(job_id: uuid.UUID,
+ user: User = Depends(Authenticator.validate))
+
+Delete the BatchJob.
+Arguments:
+job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.def estimate(job_id: uuid.UUID, user: User = Depends(Authenticator.validate))
+
+Estimate the cost for the BatchJob.
+Arguments:
+job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.def logs(job_id: uuid.UUID, user: User = Depends(Authenticator.validate))
+
+Get the logs for the BatchJob.
+Arguments:
+job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.def get_results(job_id: uuid.UUID,
+ user: User = Depends(Authenticator.validate))
+
+Get the results for the BatchJob.
+Arguments:
+job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.def start_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate))
+
+Start the processing for the BatchJob.
+Arguments:
+job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.def cancel_job(job_id: uuid.UUID,
+ user: User = Depends(Authenticator.validate))
+
+Cancel the processing of the BatchJob.
+Arguments:
+job_id
JobId - A UUID job id.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.def delete_job(job_id: uuid.UUID,
+ user: User = Depends(Authenticator.validate))
+
+Delete the BatchJob from the database.
+Arguments:
+job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.def process_sync_job(body: JobsRequest = JobsRequest(),
+ user: User = Depends(Authenticator.validate))
+
+Start the processing of a synchronous Job.
+Arguments:
+body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Class and model to define the framework and partial application logic for interacting with Process and Process Graphs.
+Classes: + - ProcessRegister: Framework for defining and extending the logic for working with Processes and Process Graphs.
+ +class UserDefinedProcessGraph(BaseModel)
+
+Pydantic model representing an OpenEO User Defined Process Graph.
+ +class Config()
+
+Pydantic model class config.
+ +@classmethod
+def get_orm(cls)
+
+Get the ORM model for this pydantic model.
+ +class ProcessRegister(EndpointRegister)
+
+The ProcessRegister to regulate the application logic for the API behaviour.
+ +def __init__(links) -> None
+
+Initialize the ProcessRegister.
+Arguments:
+links
Links - The Links to be used in some function responses.@functools.cache
+def get_available_processes()
+
+Returns the pre-defined process from the process registry.
+Returns:
+list[Process]
- A list of Processes.def list_processes() -> Union[ProcessesGetResponse, None]
+
+Returns Supported predefined processes defined by openeo-processes-dask.
+Returns:
+ProcessesGetResponse
- A list of available processes.def list_user_process_graphs(
+ limit: Optional[int] = 10,
+ user: User = Depends(Authenticator.validate)
+) -> Union[ProcessGraphsGetResponse, None]
+
+Lists all of a user's user-defined process graphs from the back-end.
+Arguments:
+limit
int - The limit to apply to the length of the list.user
User - The User returned from the Authenticator.Returns:
+ProcessGraphsGetResponse
- A list of the user's UserDefinedProcessGraph as a ProcessGraphWithMetadata.def get_user_process_graph(
+ process_graph_id: str, user: User = Depends(Authenticator.validate)
+) -> Union[ProcessGraphWithMetadata, None]
+
+Lists all information about a user-defined process, including its process graph.
+Arguments:
+process_graph_id
str - The process graph id.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+ProcessGraphWithMetadata
- Retruns the UserDefinedProcessGraph as a ProcessGraphWithMetadata.def put_user_process_graph(process_graph_id: str,
+ body: ProcessGraphWithMetadata,
+ user: User = Depends(Authenticator.validate))
+
+Stores a provided user-defined process with process graph that can be reused in other processes.
+Arguments:
+process_graph_id
str - The process graph id.body
ProcessGraphWithMetadata - The ProcessGraphWithMetadata should be used to create the new BatchJob.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+Response
- A general FastApi response to signify resource was created as expected.def delete_user_process_graph(process_graph_id: str,
+ user: User = Depends(Authenticator.validate))
+
+Deletes the data related to this user-defined process, including its process graph.
+Arguments:
+process_graph_id
str - The process graph id.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+Response
- A general FastApi response to signify resource was created as expected.def validate_user_process_graph(
+ body: ProcessGraphWithMetadata,
+ user: User = Depends(Authenticator.validate)
+) -> ValidationPostResponse
+
+Validates the ProcessGraphWithMetadata that is provided by the user.
+Arguments:
+process_graph_id
str - The process graph id.body
ProcessGraphWithMetadata - The ProcessGraphWithMetadata should be used to validate the new BatchJob.user
User - The User returned from the Authenticator.Raises:
+HTTPException
- Raises an exception with relevant status code and descriptive message of failure.Returns:
+ValidationPostResponse
- A response to list an errors that where encountered when .Standardisation of common functionality to interact with the ORMs and the database.
+ +def get_engine()
+
+Get the engine using config from pydantic settings.
+Returns:
+Engine
- The engine instance that was created.class Filter(BaseModel)
+
+Filter class to assist with providing a filter by funciton with values across different cases.
+ +def create(create_object: BaseModel) -> bool
+
+Add the values from a pydantic model to the database using its respective object relational mapping.
+ +def get(get_model: BaseModel, primary_key: Any) -> Union[None, BaseModel]
+
+Get the relevant entry for a given model using the provided primary key value.
+Arguments:
+get_model
BaseModel - The model that to get from the database.primary_key
Any - The primary key of the model instance to get.Returns:
+Union[None, BaseModel]: None, or the found model
+ +def modify(modify_object: BaseModel) -> bool
+
+Modify the relevant entries for a given model instance
+Arguments:
+modify_object
BaseModel - An instance of a pydantic model that reflects a change to make in the database.Returns:
+bool
- Whether the change was successful.def delete(delete_model: BaseModel, primary_key: Any) -> bool
+
+Delete the values from a pydantic model in the database using its respective object relational mapping.
+Arguments:
+delete_model
BaseModel - The model that to delete from the database.primary_key
Any - The primary key of the model instance to delete.Returns:
+bool
- Whether the change was successful.def get_first_or_default(get_model: BaseModel,
+ filter_with: Filter) -> BaseModel
+
+Perform a list operation and return the first found instance.
+Arguments:
+get_model
BaseModel - The model that to get from the database.filter_with
Filter - Filter of a Key/Value pair to apply to the model.Returns:
+Union[None, BaseModel]: Return the model if found, else return None.
+ +ORM definitions for defining and storing the associated data in the databse.
+ +class UserORM(BASE)
+
+ORM for the user table.
+ +UUID of the user.
+ +OIDC substring of the user.
+ +The datetime the user was created.
+ +class JobORM(BASE)
+
+ORM for the job table.
+ +UUID of the job.
+ +The process graph for this job.
+ +The status of the Job.
+ +The UUID of the user that owns this job.
+ +The datetime the job was created.
+ +The title of the job.
+ +The job description.
+ +If the Job is synchronous.
+ +class UdpORM(BASE)
+
+ORM for the UDPS table.
+ +The string name of the UDP. CPK with user_id. Different users can use the same string for id.
+ +The UUID of the user that owns this UDP.
+ +The process graph of the UDP.
+ +The datetime the UDP was created.
+ +The parameters of the UDP.
+ +The return types of the UDP.
+ +A summary of the UPD.
+ +A description of what the UDP is intended to do.
+ +Defining the settings to be used at the application layer of the API for database interaction.
+ +class DataBaseSettings(BaseSettings)
+
+Appliction DataBase settings to interact with PSQL.
+ +The name of the postgres user.
+ +The pasword for the postgres user.
+ +The host the database runs on.
+ +The post on the host the database is available on.
+ +The name of the databse being used on the host.
+ +The path leading to the alembic directory to be used.
+ +Class define the basic framework for an EndpointRegister.
+Classes: + - EndpointRegister: Framework for defining and extending the logic for working with an EndpointRegister.
+ +class EndpointRegister()
+
+The ProcessRegister to regulate the application logic for the API behaviour.
+ +def __init__()
+
+Initialize the EndpointRegister.
+ +Defining the settings to be used at the application layer of the API.
+ +class AppSettings(BaseSettings)
+
+The application settings that need to be defined when the app is initialised.
+ +The domain name hosting the API.
+ +Whether the API http scheme should be http or https.
+ +The API title to be provided to FastAPI.
+ +The API description to be provided to FastAPI.
+ +The OpenEO Api specification version supported in this deployment of the API.
+ +The OpenEO prefix to be used when creating the endpoint urls.
+ +The policies to be used for authenticated users with the backend, if not set, any usser with a valid token from the issuer is accepted.
+ +The abbreviation of the OIDC provider's organisation name, e.g. egi.
+ +The OIDC policies to check against when authorizing a user. If not provided, all users with a valid token from the issuer will be admitted.
+"&&" Is used to denote the addition of another policy. +Policies in the list should be structures as "key, value". +The key referers to some value that is expected to be found in the OIDC userinfo request. +The value referes to some value that is then checked for presence in the values found at the key location.
+Example:
+{
+ "email": user@test.org,
+ "groups" : [ "/staff" ]
+}
+
+A valid policy to allow members from the group staff would be, "groups, /staff". This would be the value provided to OIDC_POLICIES.
+
+If you wanted to include users from another group called "/trial", the updated value to OIDC_POLICIES would be, "groups, /staff && groups, /trial"
+
+
+The STAC Version that is being supported by this deployments data discovery endpoints.
+ +The STAC URL of the catalogue that the application deployment will proxy to.
+ +The collection ids to filter by when proxying to the Stac catalogue.
+ +@validator("STAC_API_URL")
+def ensure_endswith_slash(cls, v: str) -> str
+
+Ensure the STAC_API_URL ends with a trailing slash.
+ +@validator("OIDC_POLICIES", pre=True)
+def split_oidc_policies_str_to_list(cls, v: str) -> str
+
+Ensure the OIDC_POLICIES are split and formatted correctly.
+ +class Config()
+
+Pydantic model class config.
+ +@classmethod
+def parse_env_var(cls, field_name: str, raw_val: str) -> Any
+
+Parse any variables and handle and csv lists into python list type.
+ +' + escapeHtml(summary) +'
' + noResultsText + '
'); + } +} + +function doSearch () { + var query = document.getElementById('mkdocs-search-query').value; + if (query.length > min_search_length) { + if (!window.Worker) { + displayResults(search(query)); + } else { + searchWorker.postMessage({query: query}); + } + } else { + // Clear results for short queries + displayResults([]); + } +} + +function initSearch () { + var search_input = document.getElementById('mkdocs-search-query'); + if (search_input) { + search_input.addEventListener("keyup", doSearch); + } + var term = getSearchTermFromLocation(); + if (term) { + search_input.value = term; + doSearch(); + } +} + +function onWorkerMessage (e) { + if (e.data.allowSearch) { + initSearch(); + } else if (e.data.results) { + var results = e.data.results; + displayResults(results); + } else if (e.data.config) { + min_search_length = e.data.config.min_search_length-1; + } +} + +if (!window.Worker) { + console.log('Web Worker API not supported'); + // load index in main thread + $.getScript(joinUrl(base_url, "search/worker.js")).done(function () { + console.log('Loaded worker'); + init(); + window.postMessage = function (msg) { + onWorkerMessage({data: msg}); + }; + }).fail(function (jqxhr, settings, exception) { + console.error('Could not load worker.js'); + }); +} else { + // Wrap search in a web worker + var searchWorker = new Worker(joinUrl(base_url, "search/worker.js")); + searchWorker.postMessage({init: true}); + searchWorker.onmessage = onWorkerMessage; +} diff --git a/search/search_index.json b/search/search_index.json new file mode 100644 index 0000000..ff0d1ec --- /dev/null +++ b/search/search_index.json @@ -0,0 +1 @@ +{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"Welcome to OpenEO FastApi The openeo-fastapi is a package intended to assist developers to quickly get their OpenEO Api implementation up and running without the need to start from scratch. The package defines a framework for developing your OpenEO Api application, allowing you to use your own processing implementations, apply your own extensions to the database schema, and finally increase the offering of the baseline api with any additional endpoints you would like to add. Getting Started","title":"Home"},{"location":"#welcome-to-openeo-fastapi","text":"The openeo-fastapi is a package intended to assist developers to quickly get their OpenEO Api implementation up and running without the need to start from scratch. The package defines a framework for developing your OpenEO Api application, allowing you to use your own processing implementations, apply your own extensions to the database schema, and finally increase the offering of the baseline api with any additional endpoints you would like to add. Getting Started","title":"Welcome to OpenEO FastApi"},{"location":"setup/","text":"Getting Started Everything on this page is all you need to go from 0 to having your OpenEO Api server running locally. Environment Setup The openeo-fastapi package comes with a couple of assumptions. The first assumption, is the package is used to build a server side application. The second assumption is that the user is able to provide a connection to a psql database. The final assumption, is the user has provided the set of required environment variables which are needed for the application to run. The following steps will explain how the user can get the application skeleton to run. Installation Prior to installation, configure and activate a virtual environment for your new project, I can recommend using poetry for this. Once the environment is activate continue with installing openeo-fastapi. pip install openeo-fastapi Command line interface The openeo-fastapi CLI can be used to set up a quick source directory for your deployment. openeo_fastapi new /path/to/source/directory The command line interface will create the following directory tree. src/ __init__.py app.py revise.py /psql alembic.ini models.py alembic/ env.py README script.py.mako versions/ The app.py file defines the minimal code to define the FastApi application to deploy the API. The revise.py file defines steps that can be used to generate and apply alembic revisions to the database deployment. This file is intended to be used after a new release of your deployment, but before your release has been deployed, i.e. as part of an initialization container. This file is optional and can be deleted if you want to complete these steps in a different way. The /psql directory is used for housing the alembic directory to record the alembic revision history and connectivity to the database. All files ( apart from models.py ) are generated from the alembic init command, so refer to the alembic docs for more information on those files. The /psql/models.py file defines the basis for importing the orm models from the OpenEO FastApi and defining the metadata class that can then be imported and used in the alembic env.py file. The /psql/alembic/env.py file needs a couple of edits. Set the main option for the psql connection. config.set_main_option( \"sqlalchemy.url\", f\"postgresql://{environ.get('POSTGRES_USER')}:{environ.get('POSTGRES_PASSWORD')}\" f\"@{environ.get('POSTGRESQL_HOST')}:{environ.get('POSTGRESQL_PORT')}\" f\"/{environ.get('POSTGRES_DB')}\", ) Set the target metadata. In this example, I am importing from the /psql/models.py file. from openeo_api.psql.models import metadata target_metadata = metadata Set the environment variables These variables need to be set in the environment of the deployment. Those marked required need to be set, and those set False, have some default value that only needs to be provided Variable Description Required API_DNS The domain name hosting the API. True API_TLS Whether the API http scheme should be http or https. True API_TITLE The API title to be provided to FastAPI. True API_DESCRIPTION The API description to be provided to FastAPI. True OPENEO_VERSION The OpenEO Api specification version supported in this deployment of the API. Defaults to \"1.1.0\". False OPENEO_PREFIX The OpenEO prefix to be used when creating the endpoint urls. Defaults to the value of the openeo_version True OIDC_URL The URL of the OIDC provider used to authenticate tokens against. True OIDC_ORGANISATION The abbreviation of the OIDC provider's organisation name. True OIDC_POLICIES The OIDC policies user to check to authorize a user. False STAC_VERSION The STAC Version that is being supported by this deployments data discovery endpoints. Defaults to \"1.0.0\". False STAC_API_URL The STAC URL of the catalogue that the application deployment will proxy to. True STAC_COLLECTIONS_WHITELIST The collection ids to filter by when proxying to the Stac catalogue. False POSTGRES_USER The name of the postgres user. True POSTGRES_PASSWORD The pasword for the postgres user. True POSTGRESQL_HOST The host the database runs on. True POSTGRESQL_PORT The post on the host the database is available on. True POSTGRES_DB The name of the databse being used on the host. True ALEMBIC_DIR The path to the alembic directory for applying revisions. True Deploy the application. Revise the database. python -m revise.py Deploy the uvicorn server uvicorn openeo_app.main:app --reload","title":"Getting Started"},{"location":"setup/#getting-started","text":"Everything on this page is all you need to go from 0 to having your OpenEO Api server running locally.","title":"Getting Started"},{"location":"setup/#environment-setup","text":"The openeo-fastapi package comes with a couple of assumptions. The first assumption, is the package is used to build a server side application. The second assumption is that the user is able to provide a connection to a psql database. The final assumption, is the user has provided the set of required environment variables which are needed for the application to run. The following steps will explain how the user can get the application skeleton to run.","title":"Environment Setup"},{"location":"setup/#installation","text":"Prior to installation, configure and activate a virtual environment for your new project, I can recommend using poetry for this. Once the environment is activate continue with installing openeo-fastapi. pip install openeo-fastapi","title":"Installation"},{"location":"setup/#command-line-interface","text":"The openeo-fastapi CLI can be used to set up a quick source directory for your deployment. openeo_fastapi new /path/to/source/directory The command line interface will create the following directory tree. src/ __init__.py app.py revise.py /psql alembic.ini models.py alembic/ env.py README script.py.mako versions/ The app.py file defines the minimal code to define the FastApi application to deploy the API. The revise.py file defines steps that can be used to generate and apply alembic revisions to the database deployment. This file is intended to be used after a new release of your deployment, but before your release has been deployed, i.e. as part of an initialization container. This file is optional and can be deleted if you want to complete these steps in a different way. The /psql directory is used for housing the alembic directory to record the alembic revision history and connectivity to the database. All files ( apart from models.py ) are generated from the alembic init command, so refer to the alembic docs for more information on those files. The /psql/models.py file defines the basis for importing the orm models from the OpenEO FastApi and defining the metadata class that can then be imported and used in the alembic env.py file. The /psql/alembic/env.py file needs a couple of edits. Set the main option for the psql connection. config.set_main_option( \"sqlalchemy.url\", f\"postgresql://{environ.get('POSTGRES_USER')}:{environ.get('POSTGRES_PASSWORD')}\" f\"@{environ.get('POSTGRESQL_HOST')}:{environ.get('POSTGRESQL_PORT')}\" f\"/{environ.get('POSTGRES_DB')}\", ) Set the target metadata. In this example, I am importing from the /psql/models.py file. from openeo_api.psql.models import metadata target_metadata = metadata","title":"Command line interface"},{"location":"setup/#set-the-environment-variables","text":"These variables need to be set in the environment of the deployment. Those marked required need to be set, and those set False, have some default value that only needs to be provided Variable Description Required API_DNS The domain name hosting the API. True API_TLS Whether the API http scheme should be http or https. True API_TITLE The API title to be provided to FastAPI. True API_DESCRIPTION The API description to be provided to FastAPI. True OPENEO_VERSION The OpenEO Api specification version supported in this deployment of the API. Defaults to \"1.1.0\". False OPENEO_PREFIX The OpenEO prefix to be used when creating the endpoint urls. Defaults to the value of the openeo_version True OIDC_URL The URL of the OIDC provider used to authenticate tokens against. True OIDC_ORGANISATION The abbreviation of the OIDC provider's organisation name. True OIDC_POLICIES The OIDC policies user to check to authorize a user. False STAC_VERSION The STAC Version that is being supported by this deployments data discovery endpoints. Defaults to \"1.0.0\". False STAC_API_URL The STAC URL of the catalogue that the application deployment will proxy to. True STAC_COLLECTIONS_WHITELIST The collection ids to filter by when proxying to the Stac catalogue. False POSTGRES_USER The name of the postgres user. True POSTGRES_PASSWORD The pasword for the postgres user. True POSTGRESQL_HOST The host the database runs on. True POSTGRESQL_PORT The post on the host the database is available on. True POSTGRES_DB The name of the databse being used on the host. True ALEMBIC_DIR The path to the alembic directory for applying revisions. True","title":"Set the environment variables"},{"location":"setup/#deploy-the-application","text":"Revise the database. python -m revise.py Deploy the uvicorn server uvicorn openeo_app.main:app --reload","title":"Deploy the application."},{"location":"guide/auth/","text":"Overwriting the authentication. The authentication function for this repo has been set using the predefined validator function in the Authenticator class. The following example will demonstrate how to provide your own auth function for a given endpoint. How to overwrite the auth. You can either inherit the authenticator class and overwrite the validate function, or provide an entirely new function. In either case, it's worth noting that the return value for any provided authentication function currently needs to be of type User. If you want to additionally change the return type you may have to overwrite the endpoint entirely. client = OpenEOCore( ... ) api = OpenEOApi(client=client, app=FastAPI()) def cool_new_auth(): return User(user_id=specific_uuid, oidc_sub=\"the-only-user\") core_api.override_authentication(cool_new_auth) Now any endpoints that originally used the Authenticator.validate function, will now use cool_new_auth instead.","title":"Add your own auth"},{"location":"guide/auth/#overwriting-the-authentication","text":"The authentication function for this repo has been set using the predefined validator function in the Authenticator class. The following example will demonstrate how to provide your own auth function for a given endpoint.","title":"Overwriting the authentication."},{"location":"guide/auth/#how-to-overwrite-the-auth","text":"You can either inherit the authenticator class and overwrite the validate function, or provide an entirely new function. In either case, it's worth noting that the return value for any provided authentication function currently needs to be of type User. If you want to additionally change the return type you may have to overwrite the endpoint entirely. client = OpenEOCore( ... ) api = OpenEOApi(client=client, app=FastAPI()) def cool_new_auth(): return User(user_id=specific_uuid, oidc_sub=\"the-only-user\") core_api.override_authentication(cool_new_auth) Now any endpoints that originally used the Authenticator.validate function, will now use cool_new_auth instead.","title":"How to overwrite the auth."},{"location":"guide/orms/","text":"Extending the Object Relational models. Currently it's possible to extend the object relational models that the api uses in order to support extra values a backend might want to includse in any EndpointRegisters. How to extend the models. In order to effectively use the extended models, you need to update the models.py file found in the alembic directory. After updating the models.py file, you will need to manually update the endpoints where you would like the new model to be used. This is a current pain point, and it would be good to improve this in the future. Original - models.py from openeo_fastapi.client.psql.settings import BASE from openeo_fastapi.client.psql.models import * metadata = BASE.metadata Updated - models.py from typing import Optional from openeo_fastapi.client.jobs import Job from openeo_fastapi.client.psql.settings import BASE from openeo_fastapi.client.psql.models import * class ExtendedJobORM(JobORM): special_string = Column(VARCHAR, nullable=True) \"\"\"A very special string.\"\"\" class ExtendedJob(Job): special_string: Optional[str] \"\"\"A very special string.\"\"\" @classmethod def get_orm(cls): return ExtendedJobORM metadata = BASE.metadata Using extended model In order use the class ExtendedJob, we will need to extend the register. The example below extends the JobRegister and edits the create_job function to create the ExtendedJob and includes setting the value for the new parameter. You will need to version the database in order for the new model to work, and additionally add the NewJobsRegister to the app instance See Registers . ... from openeo_fastapi.client.jobs import JobsRegister from openeo_argoworkflows_api.psql.models import ExtendedJob class NewJobsRegister(JobsRegister): def __init__(self, settings, links) -> None: super().__init__(settings, links) def create_job( self, body: JobsRequest ): \"\"\"Create a new ExtendedJob. \"\"\" # Create the job job = ExtendedJob( job_id=job_id, process=body.process, status=Status.created, title=body.title, description=body.description, user_id=user.user_id, created=datetime.datetime.now(), special_string=\"A new type of job.\" ) engine.create(create_object=job) return Response( status_code=201, )","title":"Extend the object relational Models"},{"location":"guide/orms/#extending-the-object-relational-models","text":"Currently it's possible to extend the object relational models that the api uses in order to support extra values a backend might want to includse in any EndpointRegisters.","title":"Extending the Object Relational models."},{"location":"guide/orms/#how-to-extend-the-models","text":"In order to effectively use the extended models, you need to update the models.py file found in the alembic directory. After updating the models.py file, you will need to manually update the endpoints where you would like the new model to be used. This is a current pain point, and it would be good to improve this in the future.","title":"How to extend the models."},{"location":"guide/orms/#original-modelspy","text":"from openeo_fastapi.client.psql.settings import BASE from openeo_fastapi.client.psql.models import * metadata = BASE.metadata","title":"Original - models.py"},{"location":"guide/orms/#updated-modelspy","text":"from typing import Optional from openeo_fastapi.client.jobs import Job from openeo_fastapi.client.psql.settings import BASE from openeo_fastapi.client.psql.models import * class ExtendedJobORM(JobORM): special_string = Column(VARCHAR, nullable=True) \"\"\"A very special string.\"\"\" class ExtendedJob(Job): special_string: Optional[str] \"\"\"A very special string.\"\"\" @classmethod def get_orm(cls): return ExtendedJobORM metadata = BASE.metadata","title":"Updated - models.py"},{"location":"guide/orms/#using-extended-model","text":"In order use the class ExtendedJob, we will need to extend the register. The example below extends the JobRegister and edits the create_job function to create the ExtendedJob and includes setting the value for the new parameter. You will need to version the database in order for the new model to work, and additionally add the NewJobsRegister to the app instance See Registers . ... from openeo_fastapi.client.jobs import JobsRegister from openeo_argoworkflows_api.psql.models import ExtendedJob class NewJobsRegister(JobsRegister): def __init__(self, settings, links) -> None: super().__init__(settings, links) def create_job( self, body: JobsRequest ): \"\"\"Create a new ExtendedJob. \"\"\" # Create the job job = ExtendedJob( job_id=job_id, process=body.process, status=Status.created, title=body.title, description=body.description, user_id=user.user_id, created=datetime.datetime.now(), special_string=\"A new type of job.\" ) engine.create(create_object=job) return Response( status_code=201, )","title":"Using extended model"},{"location":"guide/registers/","text":"Editing the registers. The endpoint registers are a loose abstraction defining what endpoints a register is responsible for, and also what code is expected to be executed for those endpoints. The available registers can be imported as follows. from openeo_fastapi.client.jobs import JobsRegister from openeo_fastapi.client.files import FilesRegister from openeo_fastapi.client.processes import ProcessesRegister from openeo_fastapi.client.collections import CollectionsRegister You will need to know how you are expected to overwrite the functionality of these registers, as the openeo-fastapi package does not define functionality for all available endpoints. How to overwrite an endpoint. In the following example, we import the FileRegister, and overwrite the functionality for the list_files method. This will define a new response for that endpoint. This is the framework for editing the functionality of the api endpoints. from openeo_fastapi.client.files import FilesRegister class OverwrittenFileRegister(FilesRegister): def __init__(self, settings, links) -> None: super().__init__(settings, links) def list_files( self, limit: Optional[int] = 10 ): \"\"\" \"\"\" return FilesGetResponse( files=[File(path=\"/somefile.txt\", size=10)], links=[ Link( href=\"https://eodc.eu/\", rel=\"about\", type=\"text/html\", title=\"Homepage of the service provider\", ) ], ) In order to use this overwritten file register, we instantiate the register, and parse this to the OpenEOCore object. Now, when the api is next deployed, we will return the FilesGetResponse, and not the default HTTPException. extended_register = OverwrittenFileRegister(app_settings, test_links) client = OpenEOCore( ... files=extended_register, ... ) api = OpenEOApi(client=client, app=FastAPI()) How to add an endpoint The registers can also be extended to include extra functionality. In order to do this, we again need to define a new child class for the register you want to extend. We can define a new endpoint for the api as follows. from openeo_fastapi.api.types import Endpoint new_endpoint = Endpoint( path=\"/files/{path}\", methods=[\"HEAD\"], ) When defining the child register, the _initialize_endpoints method needs to be redefined to add the new_endpoint object. The new functionality can be defined under a new function, here get_file_headers . from openeo_fastapi.client.files import FilesRegister, FILE_ENDPOINTS class ExtendedFileRegister(FilesRegister): def __init__(self, settings, links) -> None: super().__init__(settings, links) self.endpoints = self._initialize_endpoints() def _initialize_endpoints(self) -> list[Endpoint]: endpoints = list(FILE_ENDPOINTS) endpoints.append(new_endpoint) return endpoints def get_file_headers( self, path: str, user: User = Depends(Authenticator.validate) ): \"\"\" \"\"\" return Response( status_code=200, headers={ \"Accept-Ranges\": \"bytes\", }, ) client = OpenEOCore( ... files=extended_register, ... ) api = OpenEOApi(client=client, app=FastAPI()) So far, we have made the new code available to the api, but the api does not know how or when to execute the new code. The following snippet will register the new path to the api server, along with the functionality. api.app.router.add_api_route( name=\"file_headers\", path=f\"/{api.client.settings.OPENEO_VERSION}/files\" + \"/{path}\", response_model=None, response_model_exclude_unset=False, response_model_exclude_none=True, methods=[\"HEAD\"], endpoint=api.client.files.get_file_headers, )","title":"Manipulating endpoints"},{"location":"guide/registers/#editing-the-registers","text":"The endpoint registers are a loose abstraction defining what endpoints a register is responsible for, and also what code is expected to be executed for those endpoints. The available registers can be imported as follows. from openeo_fastapi.client.jobs import JobsRegister from openeo_fastapi.client.files import FilesRegister from openeo_fastapi.client.processes import ProcessesRegister from openeo_fastapi.client.collections import CollectionsRegister You will need to know how you are expected to overwrite the functionality of these registers, as the openeo-fastapi package does not define functionality for all available endpoints.","title":"Editing the registers."},{"location":"guide/registers/#how-to-overwrite-an-endpoint","text":"In the following example, we import the FileRegister, and overwrite the functionality for the list_files method. This will define a new response for that endpoint. This is the framework for editing the functionality of the api endpoints. from openeo_fastapi.client.files import FilesRegister class OverwrittenFileRegister(FilesRegister): def __init__(self, settings, links) -> None: super().__init__(settings, links) def list_files( self, limit: Optional[int] = 10 ): \"\"\" \"\"\" return FilesGetResponse( files=[File(path=\"/somefile.txt\", size=10)], links=[ Link( href=\"https://eodc.eu/\", rel=\"about\", type=\"text/html\", title=\"Homepage of the service provider\", ) ], ) In order to use this overwritten file register, we instantiate the register, and parse this to the OpenEOCore object. Now, when the api is next deployed, we will return the FilesGetResponse, and not the default HTTPException. extended_register = OverwrittenFileRegister(app_settings, test_links) client = OpenEOCore( ... files=extended_register, ... ) api = OpenEOApi(client=client, app=FastAPI())","title":"How to overwrite an endpoint."},{"location":"guide/registers/#how-to-add-an-endpoint","text":"The registers can also be extended to include extra functionality. In order to do this, we again need to define a new child class for the register you want to extend. We can define a new endpoint for the api as follows. from openeo_fastapi.api.types import Endpoint new_endpoint = Endpoint( path=\"/files/{path}\", methods=[\"HEAD\"], ) When defining the child register, the _initialize_endpoints method needs to be redefined to add the new_endpoint object. The new functionality can be defined under a new function, here get_file_headers . from openeo_fastapi.client.files import FilesRegister, FILE_ENDPOINTS class ExtendedFileRegister(FilesRegister): def __init__(self, settings, links) -> None: super().__init__(settings, links) self.endpoints = self._initialize_endpoints() def _initialize_endpoints(self) -> list[Endpoint]: endpoints = list(FILE_ENDPOINTS) endpoints.append(new_endpoint) return endpoints def get_file_headers( self, path: str, user: User = Depends(Authenticator.validate) ): \"\"\" \"\"\" return Response( status_code=200, headers={ \"Accept-Ranges\": \"bytes\", }, ) client = OpenEOCore( ... files=extended_register, ... ) api = OpenEOApi(client=client, app=FastAPI()) So far, we have made the new code available to the api, but the api does not know how or when to execute the new code. The following snippet will register the new path to the api server, along with the functionality. api.app.router.add_api_route( name=\"file_headers\", path=f\"/{api.client.settings.OPENEO_VERSION}/files\" + \"/{path}\", response_model=None, response_model_exclude_unset=False, response_model_exclude_none=True, methods=[\"HEAD\"], endpoint=api.client.files.get_file_headers, )","title":"How to add an endpoint"},{"location":"package/cli/","text":"Table of Contents openeo_fastapi.cli cli new openeo_fastapi.cli CLI to support quick initialisation of the project source directory. cli @click.group() def cli() Defining group for executor CLI. new @click.command() @click.option(\"--path\", default=None, type=str) def new(path) Initialize a source directory for an openeo_fastapi api project at the specified location.","title":"openeo_fastapi.cli"},{"location":"package/cli/#table-of-contents","text":"openeo_fastapi.cli cli new","title":"Table of Contents"},{"location":"package/cli/#openeo_fastapicli","text":"CLI to support quick initialisation of the project source directory.","title":"openeo_fastapi.cli"},{"location":"package/cli/#cli","text":"@click.group() def cli() Defining group for executor CLI.","title":"cli"},{"location":"package/cli/#new","text":"@click.command() @click.option(\"--path\", default=None, type=str) def new(path) Initialize a source directory for an openeo_fastapi api project at the specified location.","title":"new"},{"location":"package/api/app/","text":"Table of Contents openeo_fastapi.api.app OpenEOApi register_well_known register_get_capabilities register_get_conformance register_get_credentials_oidc register_get_file_formats register_get_health register_get_user_info register_get_udf_runtimes register_validate_user_process_graph register_run_sync_job register_get_collections register_get_collection register_get_collection_items register_get_collection_item register_get_processes register_list_user_process_graphs register_get_user_process_graph register_put_user_process_graph register_delete_user_process_graph register_get_jobs register_create_job register_update_job register_get_job register_delete_job register_get_estimate register_get_logs register_get_results register_start_job register_cancel_job register_list_files register_download_file register_upload_file register_delete_file register_core http_exception_handler __attrs_post_init__ openeo_fastapi.api.app OpenEO Api class for preparing the FastApi object from the client that is provided by the user. OpenEOApi Objects @attr.define class OpenEOApi() Factory for creating FastApi applications conformant to the OpenEO Api specification. register_well_known def register_well_known() Register well known endpoint (GET /.well-known/openeo). register_get_capabilities def register_get_capabilities() Register endpoint for capabilities (GET /). register_get_conformance def register_get_conformance() Register endpoint for api conformance (GET /conformance). register_get_credentials_oidc def register_get_credentials_oidc() Register endpoint for api conformance (GET /conformance). register_get_file_formats def register_get_file_formats() Register endpoint for supported file formats (GET /file_formats). register_get_health def register_get_health() Register endpoint for api health (GET /health). register_get_user_info def register_get_user_info() Register endpoint for user info (GET /me). register_get_udf_runtimes def register_get_udf_runtimes() Register endpoint to list the supported udf runtimes (GET /udf_runtimes). register_validate_user_process_graph def register_validate_user_process_graph() Register endpoint for validating a user process graph (GET /validation). register_run_sync_job def register_run_sync_job() Register endpoint for executing synchronous jobs (GET /result). register_get_collections def register_get_collections() Register endpoint for listing available collections (GET /collections). register_get_collection def register_get_collection() Register endpoint for getting a specific collection (GET /collections/{collection_id}). register_get_collection_items def register_get_collection_items() Register endpoint for getting collection items (GET /collections/{collection_id}/items). register_get_collection_item def register_get_collection_item() Register endpoint for getting a specific collection item (GET /collections/{collection_id}/items/{item_id}). register_get_processes def register_get_processes() Register endpoint for listing all predefined processes (GET /processes). register_list_user_process_graphs def register_list_user_process_graphs() Register endpoint for listing user defined processes graphs (GET /processes_graphs). register_get_user_process_graph def register_get_user_process_graph() Register endpoint for getting a specific user defined processes graphs (GET /processes_graphs/{process_graph_id}). register_put_user_process_graph def register_put_user_process_graph() Register endpoint for creatings a user defined processes graph (PUT /processes_graphs/{process_graph_id}). register_delete_user_process_graph def register_delete_user_process_graph() Register endpoint for deleting a user defined processes graph (DELETE /processes_graphs/{process_graph_id}). register_get_jobs def register_get_jobs() Register endpoint for listing all jobs (GET /jobs). register_create_job def register_create_job() Register endpoint for creating a new job (POST /jobs). register_update_job def register_update_job() Register update jobs endpoint (POST /jobs/{job_id}). register_get_job def register_get_job() Register endpoint for retreiving job metadata (GET /jobs/{job_id}). register_delete_job def register_delete_job() Register endpoint for deleting the record of a batch job (GET /jobs/{job_id}). register_get_estimate def register_get_estimate() Register endpoint for estimating a batch job (GET /jobs/{job_id}). register_get_logs def register_get_logs() Register endpoint for retrieving job logs (GET /jobs/{job_id}). register_get_results def register_get_results() Register endpoint for getting the results from a batch job (GET /jobs/{job_id}). register_start_job def register_start_job() Register endpoint for starting batch job processing (GET /jobs/{job_id}). register_cancel_job def register_cancel_job() Register endpoint for cancelling job processing (GET /jobs/{job_id}). register_list_files def register_list_files() Register endpoint for listing a user's fils (GET /files). register_download_file def register_download_file() Register endpoint for downloading a specific file (GET /files/{path}). register_upload_file def register_upload_file() Register endpoint for uploading a new file (PUT /files/{path}). register_delete_file def register_delete_file() Register endpoint for deleting a new file (DELETE /files/{path}). register_core def register_core() Add application logic to the API layer. http_exception_handler def http_exception_handler(request, exception) Register exception handler to turn python exceptions into expected OpenEO error output. __attrs_post_init__ def __attrs_post_init__() Post-init hook responsible for setting up the application upon instantiation of the class.","title":"openeo_fastapi.api.app"},{"location":"package/api/app/#table-of-contents","text":"openeo_fastapi.api.app OpenEOApi register_well_known register_get_capabilities register_get_conformance register_get_credentials_oidc register_get_file_formats register_get_health register_get_user_info register_get_udf_runtimes register_validate_user_process_graph register_run_sync_job register_get_collections register_get_collection register_get_collection_items register_get_collection_item register_get_processes register_list_user_process_graphs register_get_user_process_graph register_put_user_process_graph register_delete_user_process_graph register_get_jobs register_create_job register_update_job register_get_job register_delete_job register_get_estimate register_get_logs register_get_results register_start_job register_cancel_job register_list_files register_download_file register_upload_file register_delete_file register_core http_exception_handler __attrs_post_init__","title":"Table of Contents"},{"location":"package/api/app/#openeo_fastapiapiapp","text":"OpenEO Api class for preparing the FastApi object from the client that is provided by the user.","title":"openeo_fastapi.api.app"},{"location":"package/api/app/#openeoapi-objects","text":"@attr.define class OpenEOApi() Factory for creating FastApi applications conformant to the OpenEO Api specification.","title":"OpenEOApi Objects"},{"location":"package/api/app/#register_well_known","text":"def register_well_known() Register well known endpoint (GET /.well-known/openeo).","title":"register_well_known"},{"location":"package/api/app/#register_get_capabilities","text":"def register_get_capabilities() Register endpoint for capabilities (GET /).","title":"register_get_capabilities"},{"location":"package/api/app/#register_get_conformance","text":"def register_get_conformance() Register endpoint for api conformance (GET /conformance).","title":"register_get_conformance"},{"location":"package/api/app/#register_get_credentials_oidc","text":"def register_get_credentials_oidc() Register endpoint for api conformance (GET /conformance).","title":"register_get_credentials_oidc"},{"location":"package/api/app/#register_get_file_formats","text":"def register_get_file_formats() Register endpoint for supported file formats (GET /file_formats).","title":"register_get_file_formats"},{"location":"package/api/app/#register_get_health","text":"def register_get_health() Register endpoint for api health (GET /health).","title":"register_get_health"},{"location":"package/api/app/#register_get_user_info","text":"def register_get_user_info() Register endpoint for user info (GET /me).","title":"register_get_user_info"},{"location":"package/api/app/#register_get_udf_runtimes","text":"def register_get_udf_runtimes() Register endpoint to list the supported udf runtimes (GET /udf_runtimes).","title":"register_get_udf_runtimes"},{"location":"package/api/app/#register_validate_user_process_graph","text":"def register_validate_user_process_graph() Register endpoint for validating a user process graph (GET /validation).","title":"register_validate_user_process_graph"},{"location":"package/api/app/#register_run_sync_job","text":"def register_run_sync_job() Register endpoint for executing synchronous jobs (GET /result).","title":"register_run_sync_job"},{"location":"package/api/app/#register_get_collections","text":"def register_get_collections() Register endpoint for listing available collections (GET /collections).","title":"register_get_collections"},{"location":"package/api/app/#register_get_collection","text":"def register_get_collection() Register endpoint for getting a specific collection (GET /collections/{collection_id}).","title":"register_get_collection"},{"location":"package/api/app/#register_get_collection_items","text":"def register_get_collection_items() Register endpoint for getting collection items (GET /collections/{collection_id}/items).","title":"register_get_collection_items"},{"location":"package/api/app/#register_get_collection_item","text":"def register_get_collection_item() Register endpoint for getting a specific collection item (GET /collections/{collection_id}/items/{item_id}).","title":"register_get_collection_item"},{"location":"package/api/app/#register_get_processes","text":"def register_get_processes() Register endpoint for listing all predefined processes (GET /processes).","title":"register_get_processes"},{"location":"package/api/app/#register_list_user_process_graphs","text":"def register_list_user_process_graphs() Register endpoint for listing user defined processes graphs (GET /processes_graphs).","title":"register_list_user_process_graphs"},{"location":"package/api/app/#register_get_user_process_graph","text":"def register_get_user_process_graph() Register endpoint for getting a specific user defined processes graphs (GET /processes_graphs/{process_graph_id}).","title":"register_get_user_process_graph"},{"location":"package/api/app/#register_put_user_process_graph","text":"def register_put_user_process_graph() Register endpoint for creatings a user defined processes graph (PUT /processes_graphs/{process_graph_id}).","title":"register_put_user_process_graph"},{"location":"package/api/app/#register_delete_user_process_graph","text":"def register_delete_user_process_graph() Register endpoint for deleting a user defined processes graph (DELETE /processes_graphs/{process_graph_id}).","title":"register_delete_user_process_graph"},{"location":"package/api/app/#register_get_jobs","text":"def register_get_jobs() Register endpoint for listing all jobs (GET /jobs).","title":"register_get_jobs"},{"location":"package/api/app/#register_create_job","text":"def register_create_job() Register endpoint for creating a new job (POST /jobs).","title":"register_create_job"},{"location":"package/api/app/#register_update_job","text":"def register_update_job() Register update jobs endpoint (POST /jobs/{job_id}).","title":"register_update_job"},{"location":"package/api/app/#register_get_job","text":"def register_get_job() Register endpoint for retreiving job metadata (GET /jobs/{job_id}).","title":"register_get_job"},{"location":"package/api/app/#register_delete_job","text":"def register_delete_job() Register endpoint for deleting the record of a batch job (GET /jobs/{job_id}).","title":"register_delete_job"},{"location":"package/api/app/#register_get_estimate","text":"def register_get_estimate() Register endpoint for estimating a batch job (GET /jobs/{job_id}).","title":"register_get_estimate"},{"location":"package/api/app/#register_get_logs","text":"def register_get_logs() Register endpoint for retrieving job logs (GET /jobs/{job_id}).","title":"register_get_logs"},{"location":"package/api/app/#register_get_results","text":"def register_get_results() Register endpoint for getting the results from a batch job (GET /jobs/{job_id}).","title":"register_get_results"},{"location":"package/api/app/#register_start_job","text":"def register_start_job() Register endpoint for starting batch job processing (GET /jobs/{job_id}).","title":"register_start_job"},{"location":"package/api/app/#register_cancel_job","text":"def register_cancel_job() Register endpoint for cancelling job processing (GET /jobs/{job_id}).","title":"register_cancel_job"},{"location":"package/api/app/#register_list_files","text":"def register_list_files() Register endpoint for listing a user's fils (GET /files).","title":"register_list_files"},{"location":"package/api/app/#register_download_file","text":"def register_download_file() Register endpoint for downloading a specific file (GET /files/{path}).","title":"register_download_file"},{"location":"package/api/app/#register_upload_file","text":"def register_upload_file() Register endpoint for uploading a new file (PUT /files/{path}).","title":"register_upload_file"},{"location":"package/api/app/#register_delete_file","text":"def register_delete_file() Register endpoint for deleting a new file (DELETE /files/{path}).","title":"register_delete_file"},{"location":"package/api/app/#register_core","text":"def register_core() Add application logic to the API layer.","title":"register_core"},{"location":"package/api/app/#http_exception_handler","text":"def http_exception_handler(request, exception) Register exception handler to turn python exceptions into expected OpenEO error output.","title":"http_exception_handler"},{"location":"package/api/app/#__attrs_post_init__","text":"def __attrs_post_init__() Post-init hook responsible for setting up the application upon instantiation of the class.","title":"__attrs_post_init__"},{"location":"package/api/models/","text":"Table of Contents openeo_fastapi.api.models Capabilities MeGetResponse ConformanceGetResponse WellKnownOpeneoGetResponse UdfRuntimesGetResponse Collection Collections ProcessesGetResponse ProcessGraphWithMetadata ProcessGraphsGetResponse ValidationPostResponse BatchJob JobsGetResponse JobsGetLogsResponse JobsGetEstimateGetResponse JobsRequest FilesGetResponse FileFormatsGetResponse openeo_fastapi.api.models Pydantic Models describing different api request and response bodies. Capabilities Objects class Capabilities(BaseModel) Response model for GET (/). MeGetResponse Objects class MeGetResponse(BaseModel) Response model for GET (/me). ConformanceGetResponse Objects class ConformanceGetResponse(BaseModel) Response model for GET (/conformance). WellKnownOpeneoGetResponse Objects class WellKnownOpeneoGetResponse(BaseModel) Response model for GET (/.well-known/openeo). UdfRuntimesGetResponse Objects class UdfRuntimesGetResponse(BaseModel) Response model for GET (/udf_runtimes). Collection Objects class Collection(BaseModel) Response model for GET (/collection/{collection_id}) Collections Objects class Collections(TypedDict) Response model for GET (/collections). ProcessesGetResponse Objects class ProcessesGetResponse(BaseModel) Response model for GET (/processes). ProcessGraphWithMetadata Objects class ProcessGraphWithMetadata(Process) Reponse model for GET (/process_graphs/{process_graph_id}) Request model for PUT (/process_graphs/{process_graph_id}) POST (/validation) ProcessGraphsGetResponse Objects class ProcessGraphsGetResponse(BaseModel) Response model for GET (/process_graphs). ValidationPostResponse Objects class ValidationPostResponse(BaseModel) Response model for POST (/validation). BatchJob Objects class BatchJob(BaseModel) Reponse model for GET (/jobs/{job_id}). JobsGetResponse Objects class JobsGetResponse(BaseModel) Reponse model for GET (/jobs). JobsGetLogsResponse Objects class JobsGetLogsResponse(BaseModel) Reponse model for GET (/jobs/{job_id}/logs). JobsGetEstimateGetResponse Objects class JobsGetEstimateGetResponse(BaseModel) Reponse model for GET (/jobs/{job_id}/estimate). JobsRequest Objects class JobsRequest(BaseModel) Request model for POST (/jobs) PATCH (/jobs/{job_id}) POST (/result) FilesGetResponse Objects class FilesGetResponse(BaseModel) Reponse model for GET (/files). FileFormatsGetResponse Objects class FileFormatsGetResponse(BaseModel) Reponse model for GET (/file_formats).","title":"openeo_fastapi.api.models"},{"location":"package/api/models/#table-of-contents","text":"openeo_fastapi.api.models Capabilities MeGetResponse ConformanceGetResponse WellKnownOpeneoGetResponse UdfRuntimesGetResponse Collection Collections ProcessesGetResponse ProcessGraphWithMetadata ProcessGraphsGetResponse ValidationPostResponse BatchJob JobsGetResponse JobsGetLogsResponse JobsGetEstimateGetResponse JobsRequest FilesGetResponse FileFormatsGetResponse","title":"Table of Contents"},{"location":"package/api/models/#openeo_fastapiapimodels","text":"Pydantic Models describing different api request and response bodies.","title":"openeo_fastapi.api.models"},{"location":"package/api/models/#capabilities-objects","text":"class Capabilities(BaseModel) Response model for GET (/).","title":"Capabilities Objects"},{"location":"package/api/models/#megetresponse-objects","text":"class MeGetResponse(BaseModel) Response model for GET (/me).","title":"MeGetResponse Objects"},{"location":"package/api/models/#conformancegetresponse-objects","text":"class ConformanceGetResponse(BaseModel) Response model for GET (/conformance).","title":"ConformanceGetResponse Objects"},{"location":"package/api/models/#wellknownopeneogetresponse-objects","text":"class WellKnownOpeneoGetResponse(BaseModel) Response model for GET (/.well-known/openeo).","title":"WellKnownOpeneoGetResponse Objects"},{"location":"package/api/models/#udfruntimesgetresponse-objects","text":"class UdfRuntimesGetResponse(BaseModel) Response model for GET (/udf_runtimes).","title":"UdfRuntimesGetResponse Objects"},{"location":"package/api/models/#collection-objects","text":"class Collection(BaseModel) Response model for GET (/collection/{collection_id})","title":"Collection Objects"},{"location":"package/api/models/#collections-objects","text":"class Collections(TypedDict) Response model for GET (/collections).","title":"Collections Objects"},{"location":"package/api/models/#processesgetresponse-objects","text":"class ProcessesGetResponse(BaseModel) Response model for GET (/processes).","title":"ProcessesGetResponse Objects"},{"location":"package/api/models/#processgraphwithmetadata-objects","text":"class ProcessGraphWithMetadata(Process) Reponse model for GET (/process_graphs/{process_graph_id}) Request model for PUT (/process_graphs/{process_graph_id}) POST (/validation)","title":"ProcessGraphWithMetadata Objects"},{"location":"package/api/models/#processgraphsgetresponse-objects","text":"class ProcessGraphsGetResponse(BaseModel) Response model for GET (/process_graphs).","title":"ProcessGraphsGetResponse Objects"},{"location":"package/api/models/#validationpostresponse-objects","text":"class ValidationPostResponse(BaseModel) Response model for POST (/validation).","title":"ValidationPostResponse Objects"},{"location":"package/api/models/#batchjob-objects","text":"class BatchJob(BaseModel) Reponse model for GET (/jobs/{job_id}).","title":"BatchJob Objects"},{"location":"package/api/models/#jobsgetresponse-objects","text":"class JobsGetResponse(BaseModel) Reponse model for GET (/jobs).","title":"JobsGetResponse Objects"},{"location":"package/api/models/#jobsgetlogsresponse-objects","text":"class JobsGetLogsResponse(BaseModel) Reponse model for GET (/jobs/{job_id}/logs).","title":"JobsGetLogsResponse Objects"},{"location":"package/api/models/#jobsgetestimategetresponse-objects","text":"class JobsGetEstimateGetResponse(BaseModel) Reponse model for GET (/jobs/{job_id}/estimate).","title":"JobsGetEstimateGetResponse Objects"},{"location":"package/api/models/#jobsrequest-objects","text":"class JobsRequest(BaseModel) Request model for POST (/jobs) PATCH (/jobs/{job_id}) POST (/result)","title":"JobsRequest Objects"},{"location":"package/api/models/#filesgetresponse-objects","text":"class FilesGetResponse(BaseModel) Reponse model for GET (/files).","title":"FilesGetResponse Objects"},{"location":"package/api/models/#fileformatsgetresponse-objects","text":"class FileFormatsGetResponse(BaseModel) Reponse model for GET (/file_formats).","title":"FileFormatsGetResponse Objects"},{"location":"package/api/types/","text":"Table of Contents openeo_fastapi.api.types STACConformanceClasses DinensionEnum Type5 Method Status Level GisDataType Role RFC3339Datetime Endpoint Plan Billing File UsageMetric Usage Link LogEntry Process Error FileFormat Storage Version StacProvider Dimension Spatial Temporal Extent openeo_fastapi.api.types Pydantic Models and Enums describining different attribute types used by the models in openeo_fastapi.api.models. STACConformanceClasses Objects class STACConformanceClasses(Enum) Available conformance classes with STAC. DinensionEnum Objects class DinensionEnum(Enum) Dimension enum. Type5 Objects class Type5(Enum) Catalog enum. Method Objects class Method(Enum) HTTP Methods enum. Status Objects class Status(Enum) Job Status enum. Level Objects class Level(Enum) Log level enum. GisDataType Objects class GisDataType(Enum) Data type enum. Role Objects class Role(Enum) Role for collection provider. RFC3339Datetime Objects class RFC3339Datetime(BaseModel) Model to consistently represent datetimes as strings compliant to RFC3339Datetime. Endpoint Objects class Endpoint(BaseModel) Model to capture the available endpoint and it's accepted models. Plan Objects class Plan(BaseModel) Model to capture the the plan the user has subscribe to. Billing Objects class Billing(BaseModel) Model to capture the billing options that are available at the backend. File Objects class File(BaseModel) Model to capture the stat information of a file stored at the backend. UsageMetric Objects class UsageMetric(BaseModel) Model to capture the value and unit of a given metric. Usage Objects class Usage(BaseModel) Model to capture the usage of a job. Link Objects class Link(BaseModel) Model to describe the information for a provided URL. LogEntry Objects class LogEntry(BaseModel) Model to describe the information for a given log line in job logs. Process Objects class Process(BaseModel) Model to describe a process that is exposed by the api. Error Objects class Error(BaseModel) Model to describe the information of a captured exception by the api. FileFormat Objects class FileFormat(BaseModel) Model to describe a file format supported by the processing backend. Storage Objects class Storage(BaseModel) Model to describe the storage resources available to a given user. Version Objects class Version(BaseModel) Model to describe the version of an api that is available. StacProvider Objects class StacProvider(BaseModel) Model to describe the provider of a given stac resource. Dimension Objects class Dimension(BaseModel) Model to describe the dimension of some data. Spatial Objects class Spatial(BaseModel) Model to describe the spatial extent of a collection. Temporal Objects class Temporal(BaseModel) Model to describe the temporal range of a collection. Extent Objects class Extent(BaseModel) Model to describe the complete spatiotemporal extent of a collection.","title":"openeo_fastapi.api.types"},{"location":"package/api/types/#table-of-contents","text":"openeo_fastapi.api.types STACConformanceClasses DinensionEnum Type5 Method Status Level GisDataType Role RFC3339Datetime Endpoint Plan Billing File UsageMetric Usage Link LogEntry Process Error FileFormat Storage Version StacProvider Dimension Spatial Temporal Extent","title":"Table of Contents"},{"location":"package/api/types/#openeo_fastapiapitypes","text":"Pydantic Models and Enums describining different attribute types used by the models in openeo_fastapi.api.models.","title":"openeo_fastapi.api.types"},{"location":"package/api/types/#stacconformanceclasses-objects","text":"class STACConformanceClasses(Enum) Available conformance classes with STAC.","title":"STACConformanceClasses Objects"},{"location":"package/api/types/#dinensionenum-objects","text":"class DinensionEnum(Enum) Dimension enum.","title":"DinensionEnum Objects"},{"location":"package/api/types/#type5-objects","text":"class Type5(Enum) Catalog enum.","title":"Type5 Objects"},{"location":"package/api/types/#method-objects","text":"class Method(Enum) HTTP Methods enum.","title":"Method Objects"},{"location":"package/api/types/#status-objects","text":"class Status(Enum) Job Status enum.","title":"Status Objects"},{"location":"package/api/types/#level-objects","text":"class Level(Enum) Log level enum.","title":"Level Objects"},{"location":"package/api/types/#gisdatatype-objects","text":"class GisDataType(Enum) Data type enum.","title":"GisDataType Objects"},{"location":"package/api/types/#role-objects","text":"class Role(Enum) Role for collection provider.","title":"Role Objects"},{"location":"package/api/types/#rfc3339datetime-objects","text":"class RFC3339Datetime(BaseModel) Model to consistently represent datetimes as strings compliant to RFC3339Datetime.","title":"RFC3339Datetime Objects"},{"location":"package/api/types/#endpoint-objects","text":"class Endpoint(BaseModel) Model to capture the available endpoint and it's accepted models.","title":"Endpoint Objects"},{"location":"package/api/types/#plan-objects","text":"class Plan(BaseModel) Model to capture the the plan the user has subscribe to.","title":"Plan Objects"},{"location":"package/api/types/#billing-objects","text":"class Billing(BaseModel) Model to capture the billing options that are available at the backend.","title":"Billing Objects"},{"location":"package/api/types/#file-objects","text":"class File(BaseModel) Model to capture the stat information of a file stored at the backend.","title":"File Objects"},{"location":"package/api/types/#usagemetric-objects","text":"class UsageMetric(BaseModel) Model to capture the value and unit of a given metric.","title":"UsageMetric Objects"},{"location":"package/api/types/#usage-objects","text":"class Usage(BaseModel) Model to capture the usage of a job.","title":"Usage Objects"},{"location":"package/api/types/#link-objects","text":"class Link(BaseModel) Model to describe the information for a provided URL.","title":"Link Objects"},{"location":"package/api/types/#logentry-objects","text":"class LogEntry(BaseModel) Model to describe the information for a given log line in job logs.","title":"LogEntry Objects"},{"location":"package/api/types/#process-objects","text":"class Process(BaseModel) Model to describe a process that is exposed by the api.","title":"Process Objects"},{"location":"package/api/types/#error-objects","text":"class Error(BaseModel) Model to describe the information of a captured exception by the api.","title":"Error Objects"},{"location":"package/api/types/#fileformat-objects","text":"class FileFormat(BaseModel) Model to describe a file format supported by the processing backend.","title":"FileFormat Objects"},{"location":"package/api/types/#storage-objects","text":"class Storage(BaseModel) Model to describe the storage resources available to a given user.","title":"Storage Objects"},{"location":"package/api/types/#version-objects","text":"class Version(BaseModel) Model to describe the version of an api that is available.","title":"Version Objects"},{"location":"package/api/types/#stacprovider-objects","text":"class StacProvider(BaseModel) Model to describe the provider of a given stac resource.","title":"StacProvider Objects"},{"location":"package/api/types/#dimension-objects","text":"class Dimension(BaseModel) Model to describe the dimension of some data.","title":"Dimension Objects"},{"location":"package/api/types/#spatial-objects","text":"class Spatial(BaseModel) Model to describe the spatial extent of a collection.","title":"Spatial Objects"},{"location":"package/api/types/#temporal-objects","text":"class Temporal(BaseModel) Model to describe the temporal range of a collection.","title":"Temporal Objects"},{"location":"package/api/types/#extent-objects","text":"class Extent(BaseModel) Model to describe the complete spatiotemporal extent of a collection.","title":"Extent Objects"},{"location":"package/client/auth/","text":"Table of Contents openeo_fastapi.client.auth User Config get_orm Authenticator validate AuthMethod AuthToken from_token IssuerHandler validate_token openeo_fastapi.client.auth Class and model to define the framework and partial application logic for interacting with Jobs. Classes: - User: Framework for defining and extending the logic for working with BatchJobs. - Authenticator: Class holding the abstract validation method used for authentication for API endpoints. - AuthMethod: Enum defining the available auth methods. - AuthToken: Pydantic model for breaking and validating an OpenEO Token into it's consituent parts. - IssuerHandler: Class for handling the AuthToken and validating against the revelant token Issuer and AuthMethod. User Objects class User(BaseModel) Pydantic model manipulating users. Config Objects class Config() Pydantic model class config. get_orm @classmethod def get_orm(cls) Get the ORM model for this pydantic model. Authenticator Objects class Authenticator(ABC) Basic class to hold the validation call to be used by the api endpoints requiring authentication. validate @abstractmethod def validate(authorization: str = Header()) Validate the authorisation header and create a new user. This method can be overwritten as needed. Arguments : authorization str - The authorisation header content from the request headers. Returns : User - The authenticated user. AuthMethod Objects class AuthMethod(Enum) Enum defining known auth methods. AuthToken Objects class AuthToken(BaseModel) The AuthToken breaks down the OpenEO token into its consituent parts to be used for validation. from_token @classmethod def from_token(cls, token: str) Takes the openeo format token, splits it into the component parts, and returns an Auth token. IssuerHandler Objects class IssuerHandler(BaseModel) General token handler for querying provided tokens against issuers. validate_token def validate_token(token: str) Try to validate the token against the give OIDC provider. Arguments : token str - The OpenEO token to be parsed and validated against the oidc provider. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : The JSON as dictionary from _validate_oidc_token.","title":"openeo_fastapi.client.auth"},{"location":"package/client/auth/#table-of-contents","text":"openeo_fastapi.client.auth User Config get_orm Authenticator validate AuthMethod AuthToken from_token IssuerHandler validate_token","title":"Table of Contents"},{"location":"package/client/auth/#openeo_fastapiclientauth","text":"Class and model to define the framework and partial application logic for interacting with Jobs. Classes: - User: Framework for defining and extending the logic for working with BatchJobs. - Authenticator: Class holding the abstract validation method used for authentication for API endpoints. - AuthMethod: Enum defining the available auth methods. - AuthToken: Pydantic model for breaking and validating an OpenEO Token into it's consituent parts. - IssuerHandler: Class for handling the AuthToken and validating against the revelant token Issuer and AuthMethod.","title":"openeo_fastapi.client.auth"},{"location":"package/client/auth/#user-objects","text":"class User(BaseModel) Pydantic model manipulating users.","title":"User Objects"},{"location":"package/client/auth/#config-objects","text":"class Config() Pydantic model class config.","title":"Config Objects"},{"location":"package/client/auth/#get_orm","text":"@classmethod def get_orm(cls) Get the ORM model for this pydantic model.","title":"get_orm"},{"location":"package/client/auth/#authenticator-objects","text":"class Authenticator(ABC) Basic class to hold the validation call to be used by the api endpoints requiring authentication.","title":"Authenticator Objects"},{"location":"package/client/auth/#validate","text":"@abstractmethod def validate(authorization: str = Header()) Validate the authorisation header and create a new user. This method can be overwritten as needed. Arguments : authorization str - The authorisation header content from the request headers. Returns : User - The authenticated user.","title":"validate"},{"location":"package/client/auth/#authmethod-objects","text":"class AuthMethod(Enum) Enum defining known auth methods.","title":"AuthMethod Objects"},{"location":"package/client/auth/#authtoken-objects","text":"class AuthToken(BaseModel) The AuthToken breaks down the OpenEO token into its consituent parts to be used for validation.","title":"AuthToken Objects"},{"location":"package/client/auth/#from_token","text":"@classmethod def from_token(cls, token: str) Takes the openeo format token, splits it into the component parts, and returns an Auth token.","title":"from_token"},{"location":"package/client/auth/#issuerhandler-objects","text":"class IssuerHandler(BaseModel) General token handler for querying provided tokens against issuers.","title":"IssuerHandler Objects"},{"location":"package/client/auth/#validate_token","text":"def validate_token(token: str) Try to validate the token against the give OIDC provider. Arguments : token str - The OpenEO token to be parsed and validated against the oidc provider. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : The JSON as dictionary from _validate_oidc_token.","title":"validate_token"},{"location":"package/client/collections/","text":"Table of Contents openeo_fastapi.client.collections CollectionRegister __init__ get_collection get_collections get_collection_items get_collection_item openeo_fastapi.client.collections Class and model to define the framework and partial application logic for interacting with Collections. Classes: - CollectionRegister: Framework for defining and extending the logic for working with Collections. CollectionRegister Objects class CollectionRegister(EndpointRegister) The CollectionRegister to regulate the application logic for the API behaviour. __init__ def __init__(settings) -> None Initialize the CollectionRegister. Arguments : settings AppSettings - The AppSettings that the application will use. get_collection async def get_collection(collection_id) Returns Metadata for specific datasetsbased on collection_id (str). Arguments : collection_id str - The collection id to request from the proxy. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : Collection - The proxied request returned as a Collection. get_collections async def get_collections() Returns Basic metadata for all datasets Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : Collections - The proxied request returned as a Collections object. get_collection_items async def get_collection_items(collection_id) Returns Basic metadata for all datasets. Arguments : collection_id str - The collection id to request from the proxy. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : The direct response from the request to the stac catalogue. get_collection_item async def get_collection_item(collection_id, item_id) Returns Basic metadata for all datasets Arguments : collection_id str - The collection id to request from the proxy. item_id str - The item id to request from the proxy. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : The direct response from the request to the stac catalogue.","title":"openeo_fastapi.client.collections"},{"location":"package/client/collections/#table-of-contents","text":"openeo_fastapi.client.collections CollectionRegister __init__ get_collection get_collections get_collection_items get_collection_item","title":"Table of Contents"},{"location":"package/client/collections/#openeo_fastapiclientcollections","text":"Class and model to define the framework and partial application logic for interacting with Collections. Classes: - CollectionRegister: Framework for defining and extending the logic for working with Collections.","title":"openeo_fastapi.client.collections"},{"location":"package/client/collections/#collectionregister-objects","text":"class CollectionRegister(EndpointRegister) The CollectionRegister to regulate the application logic for the API behaviour.","title":"CollectionRegister Objects"},{"location":"package/client/collections/#__init__","text":"def __init__(settings) -> None Initialize the CollectionRegister. Arguments : settings AppSettings - The AppSettings that the application will use.","title":"__init__"},{"location":"package/client/collections/#get_collection","text":"async def get_collection(collection_id) Returns Metadata for specific datasetsbased on collection_id (str). Arguments : collection_id str - The collection id to request from the proxy. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : Collection - The proxied request returned as a Collection.","title":"get_collection"},{"location":"package/client/collections/#get_collections","text":"async def get_collections() Returns Basic metadata for all datasets Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : Collections - The proxied request returned as a Collections object.","title":"get_collections"},{"location":"package/client/collections/#get_collection_items","text":"async def get_collection_items(collection_id) Returns Basic metadata for all datasets. Arguments : collection_id str - The collection id to request from the proxy. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : The direct response from the request to the stac catalogue.","title":"get_collection_items"},{"location":"package/client/collections/#get_collection_item","text":"async def get_collection_item(collection_id, item_id) Returns Basic metadata for all datasets Arguments : collection_id str - The collection id to request from the proxy. item_id str - The item id to request from the proxy. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : The direct response from the request to the stac catalogue.","title":"get_collection_item"},{"location":"package/client/core/","text":"Table of Contents openeo_fastapi.client.core OpenEOCore __attrs_post_init__ get_capabilities get_conformance get_file_formats get_health get_user_info get_well_known get_udf_runtimes openeo_fastapi.client.core Class and model to define the framework and partial application logic for interacting with Jobs. Classes: - OpenEOCore: Framework for defining the application logic that will passed onto the OpenEO Api. OpenEOCore Objects @define class OpenEOCore() Client for defining the application logic for the OpenEO Api. __attrs_post_init__ def __attrs_post_init__() Post init hook to set the client registers, if none where provided by the user set to the defaults! get_capabilities def get_capabilities() -> Capabilities Get the capabilities of the api. Returns : Capabilities - The capabilities of the api based off what the user provided. get_conformance def get_conformance() -> ConformanceGetResponse Get the capabilities of the api. Returns : ConformanceGetResponse - The conformance classes that this Api wil of the api based off what the user provided. get_file_formats def get_file_formats() -> FileFormatsGetResponse Get the supported file formats for processing input and output. Returns : FileFormatsGetResponse - The response defining the input and output formats. get_health def get_health() Basic health endpoint expected to return status code 200. Returns : Response - Status code 200. get_user_info def get_user_info(user: User = Depends( Authenticator.validate)) -> MeGetResponse Get the supported file formats for processing input and output. Returns : MeGetResponse - The user information for the validated user. get_well_known def get_well_known() -> WellKnownOpeneoGetResponse Get the supported file formats for processing input and output. Returns : WellKnownOpeneoGetResponse - The api/s which are exposed at this server. get_udf_runtimes def get_udf_runtimes() -> UdfRuntimesGetResponse Get the supported file formats for processing input and output. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : UdfRuntimesGetResponse - The metadata for the requested BatchJob.","title":"openeo_fastapi.client.core"},{"location":"package/client/core/#table-of-contents","text":"openeo_fastapi.client.core OpenEOCore __attrs_post_init__ get_capabilities get_conformance get_file_formats get_health get_user_info get_well_known get_udf_runtimes","title":"Table of Contents"},{"location":"package/client/core/#openeo_fastapiclientcore","text":"Class and model to define the framework and partial application logic for interacting with Jobs. Classes: - OpenEOCore: Framework for defining the application logic that will passed onto the OpenEO Api.","title":"openeo_fastapi.client.core"},{"location":"package/client/core/#openeocore-objects","text":"@define class OpenEOCore() Client for defining the application logic for the OpenEO Api.","title":"OpenEOCore Objects"},{"location":"package/client/core/#__attrs_post_init__","text":"def __attrs_post_init__() Post init hook to set the client registers, if none where provided by the user set to the defaults!","title":"__attrs_post_init__"},{"location":"package/client/core/#get_capabilities","text":"def get_capabilities() -> Capabilities Get the capabilities of the api. Returns : Capabilities - The capabilities of the api based off what the user provided.","title":"get_capabilities"},{"location":"package/client/core/#get_conformance","text":"def get_conformance() -> ConformanceGetResponse Get the capabilities of the api. Returns : ConformanceGetResponse - The conformance classes that this Api wil of the api based off what the user provided.","title":"get_conformance"},{"location":"package/client/core/#get_file_formats","text":"def get_file_formats() -> FileFormatsGetResponse Get the supported file formats for processing input and output. Returns : FileFormatsGetResponse - The response defining the input and output formats.","title":"get_file_formats"},{"location":"package/client/core/#get_health","text":"def get_health() Basic health endpoint expected to return status code 200. Returns : Response - Status code 200.","title":"get_health"},{"location":"package/client/core/#get_user_info","text":"def get_user_info(user: User = Depends( Authenticator.validate)) -> MeGetResponse Get the supported file formats for processing input and output. Returns : MeGetResponse - The user information for the validated user.","title":"get_user_info"},{"location":"package/client/core/#get_well_known","text":"def get_well_known() -> WellKnownOpeneoGetResponse Get the supported file formats for processing input and output. Returns : WellKnownOpeneoGetResponse - The api/s which are exposed at this server.","title":"get_well_known"},{"location":"package/client/core/#get_udf_runtimes","text":"def get_udf_runtimes() -> UdfRuntimesGetResponse Get the supported file formats for processing input and output. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : UdfRuntimesGetResponse - The metadata for the requested BatchJob.","title":"get_udf_runtimes"},{"location":"package/client/files/","text":"Table of Contents openeo_fastapi.client.files FilesRegister list_files download_file upload_file delete_file openeo_fastapi.client.files Class and model to define the framework and partial application logic for interacting with Files. Classes: - FilesRegister: Framework for defining and extending the logic for working with Files. FilesRegister Objects class FilesRegister(EndpointRegister) list_files def list_files(limit: Optional[int] = 10, user: User = Depends(Authenticator.validate)) List the files in the user workspace. Arguments : limit int - The limit to apply to the length of the list. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. download_file def download_file(path: str, user: User = Depends(Authenticator.validate)) Download the file from the user's workspace. Arguments : path str - The path leading to the file. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. upload_file def upload_file(path: str, user: User = Depends(Authenticator.validate)) Upload the file from the user's workspace. Arguments : path str - The path leading to the file. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. delete_file def delete_file(path: str, user: User = Depends(Authenticator.validate)) Delete the file from the user's workspace. Arguments : path str - The path leading to the file. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"openeo_fastapi.client.files"},{"location":"package/client/files/#table-of-contents","text":"openeo_fastapi.client.files FilesRegister list_files download_file upload_file delete_file","title":"Table of Contents"},{"location":"package/client/files/#openeo_fastapiclientfiles","text":"Class and model to define the framework and partial application logic for interacting with Files. Classes: - FilesRegister: Framework for defining and extending the logic for working with Files.","title":"openeo_fastapi.client.files"},{"location":"package/client/files/#filesregister-objects","text":"class FilesRegister(EndpointRegister)","title":"FilesRegister Objects"},{"location":"package/client/files/#list_files","text":"def list_files(limit: Optional[int] = 10, user: User = Depends(Authenticator.validate)) List the files in the user workspace. Arguments : limit int - The limit to apply to the length of the list. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"list_files"},{"location":"package/client/files/#download_file","text":"def download_file(path: str, user: User = Depends(Authenticator.validate)) Download the file from the user's workspace. Arguments : path str - The path leading to the file. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"download_file"},{"location":"package/client/files/#upload_file","text":"def upload_file(path: str, user: User = Depends(Authenticator.validate)) Upload the file from the user's workspace. Arguments : path str - The path leading to the file. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"upload_file"},{"location":"package/client/files/#delete_file","text":"def delete_file(path: str, user: User = Depends(Authenticator.validate)) Delete the file from the user's workspace. Arguments : path str - The path leading to the file. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"delete_file"},{"location":"package/client/jobs/","text":"Table of Contents openeo_fastapi.client.jobs Job job_id Config get_orm patch JobsRegister __init__ list_jobs create_job update_job get_job delete_job estimate logs get_results start_job cancel_job delete_job process_sync_job openeo_fastapi.client.jobs Class and model to define the framework and partial application logic for interacting with Jobs. Classes: - JobsRegister: Framework for defining and extending the logic for working with BatchJobs. - Job: The pydantic model used as an in memory representation of an OpenEO Job. Job Objects class Job(BaseModel) Pydantic model representing an OpenEO Job. job_id Config Objects class Config() Pydantic model class config. get_orm @classmethod def get_orm(cls) Get the ORM model for this pydantic model. patch def patch(patch: Any) Update pydantic model with changed fields from a new model instance. JobsRegister Objects class JobsRegister(EndpointRegister) The JobRegister to regulate the application logic for the API behaviour. __init__ def __init__(settings, links) -> None Initialize the JobRegister. Arguments : settings AppSettings - The AppSettings that the application will use. links Links - The Links to be used in some function responses. list_jobs def list_jobs(limit: Optional[int] = 10, user: User = Depends(Authenticator.validate)) List the user's most recent BatchJobs. Arguments : limit int - The limit to apply to the length of the list. user User - The User returned from the Authenticator. Returns : JobsGetResponse - A list of the user's BatchJobs. create_job def create_job(body: JobsRequest, user: User = Depends(Authenticator.validate)) Create a new BatchJob. Arguments : body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Returns : Response - A general FastApi response to signify the changes where made as expected. Specific response headers need to be set in this response to ensure certain behaviours when being used by OpenEO client modules. update_job def update_job(job_id: uuid.UUID, body: JobsRequest, user: User = Depends(Authenticator.validate)) Update the specified BatchJob with the contents of the provided JobsRequest. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to update the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : Response - A general FastApi response to signify the changes where made as expected. get_job def get_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Get and return the metadata for the BatchJob. Arguments : job_id JobId - A UUID job id. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : BatchJob - The metadata for the requested BatchJob. delete_job def delete_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Delete the BatchJob. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. estimate def estimate(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Estimate the cost for the BatchJob. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. logs def logs(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Get the logs for the BatchJob. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. get_results def get_results(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Get the results for the BatchJob. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. start_job def start_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Start the processing for the BatchJob. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. cancel_job def cancel_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Cancel the processing of the BatchJob. Arguments : job_id JobId - A UUID job id. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. delete_job def delete_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Delete the BatchJob from the database. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. process_sync_job def process_sync_job(body: JobsRequest = JobsRequest(), user: User = Depends(Authenticator.validate)) Start the processing of a synchronous Job. Arguments : body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"openeo_fastapi.client.jobs"},{"location":"package/client/jobs/#table-of-contents","text":"openeo_fastapi.client.jobs Job job_id Config get_orm patch JobsRegister __init__ list_jobs create_job update_job get_job delete_job estimate logs get_results start_job cancel_job delete_job process_sync_job","title":"Table of Contents"},{"location":"package/client/jobs/#openeo_fastapiclientjobs","text":"Class and model to define the framework and partial application logic for interacting with Jobs. Classes: - JobsRegister: Framework for defining and extending the logic for working with BatchJobs. - Job: The pydantic model used as an in memory representation of an OpenEO Job.","title":"openeo_fastapi.client.jobs"},{"location":"package/client/jobs/#job-objects","text":"class Job(BaseModel) Pydantic model representing an OpenEO Job.","title":"Job Objects"},{"location":"package/client/jobs/#job_id","text":"","title":"job_id"},{"location":"package/client/jobs/#config-objects","text":"class Config() Pydantic model class config.","title":"Config Objects"},{"location":"package/client/jobs/#get_orm","text":"@classmethod def get_orm(cls) Get the ORM model for this pydantic model.","title":"get_orm"},{"location":"package/client/jobs/#patch","text":"def patch(patch: Any) Update pydantic model with changed fields from a new model instance.","title":"patch"},{"location":"package/client/jobs/#jobsregister-objects","text":"class JobsRegister(EndpointRegister) The JobRegister to regulate the application logic for the API behaviour.","title":"JobsRegister Objects"},{"location":"package/client/jobs/#__init__","text":"def __init__(settings, links) -> None Initialize the JobRegister. Arguments : settings AppSettings - The AppSettings that the application will use. links Links - The Links to be used in some function responses.","title":"__init__"},{"location":"package/client/jobs/#list_jobs","text":"def list_jobs(limit: Optional[int] = 10, user: User = Depends(Authenticator.validate)) List the user's most recent BatchJobs. Arguments : limit int - The limit to apply to the length of the list. user User - The User returned from the Authenticator. Returns : JobsGetResponse - A list of the user's BatchJobs.","title":"list_jobs"},{"location":"package/client/jobs/#create_job","text":"def create_job(body: JobsRequest, user: User = Depends(Authenticator.validate)) Create a new BatchJob. Arguments : body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Returns : Response - A general FastApi response to signify the changes where made as expected. Specific response headers need to be set in this response to ensure certain behaviours when being used by OpenEO client modules.","title":"create_job"},{"location":"package/client/jobs/#update_job","text":"def update_job(job_id: uuid.UUID, body: JobsRequest, user: User = Depends(Authenticator.validate)) Update the specified BatchJob with the contents of the provided JobsRequest. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to update the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : Response - A general FastApi response to signify the changes where made as expected.","title":"update_job"},{"location":"package/client/jobs/#get_job","text":"def get_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Get and return the metadata for the BatchJob. Arguments : job_id JobId - A UUID job id. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : BatchJob - The metadata for the requested BatchJob.","title":"get_job"},{"location":"package/client/jobs/#delete_job","text":"def delete_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Delete the BatchJob. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"delete_job"},{"location":"package/client/jobs/#estimate","text":"def estimate(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Estimate the cost for the BatchJob. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"estimate"},{"location":"package/client/jobs/#logs","text":"def logs(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Get the logs for the BatchJob. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"logs"},{"location":"package/client/jobs/#get_results","text":"def get_results(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Get the results for the BatchJob. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"get_results"},{"location":"package/client/jobs/#start_job","text":"def start_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Start the processing for the BatchJob. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"start_job"},{"location":"package/client/jobs/#cancel_job","text":"def cancel_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Cancel the processing of the BatchJob. Arguments : job_id JobId - A UUID job id. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"cancel_job"},{"location":"package/client/jobs/#delete_job_1","text":"def delete_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate)) Delete the BatchJob from the database. Arguments : job_id JobId - A UUID job id. body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"delete_job"},{"location":"package/client/jobs/#process_sync_job","text":"def process_sync_job(body: JobsRequest = JobsRequest(), user: User = Depends(Authenticator.validate)) Start the processing of a synchronous Job. Arguments : body JobsRequest - The Job Request that should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure.","title":"process_sync_job"},{"location":"package/client/processes/","text":"Table of Contents openeo_fastapi.client.processes UserDefinedProcessGraph Config get_orm ProcessRegister __init__ get_available_processes list_processes list_user_process_graphs get_user_process_graph put_user_process_graph delete_user_process_graph validate_user_process_graph openeo_fastapi.client.processes Class and model to define the framework and partial application logic for interacting with Process and Process Graphs. Classes: - ProcessRegister: Framework for defining and extending the logic for working with Processes and Process Graphs. UserDefinedProcessGraph Objects class UserDefinedProcessGraph(BaseModel) Pydantic model representing an OpenEO User Defined Process Graph. Config Objects class Config() Pydantic model class config. get_orm @classmethod def get_orm(cls) Get the ORM model for this pydantic model. ProcessRegister Objects class ProcessRegister(EndpointRegister) The ProcessRegister to regulate the application logic for the API behaviour. __init__ def __init__(links) -> None Initialize the ProcessRegister. Arguments : links Links - The Links to be used in some function responses. get_available_processes @functools.cache def get_available_processes() Returns the pre-defined process from the process registry. Returns : list[Process] - A list of Processes. list_processes def list_processes() -> Union[ProcessesGetResponse, None] Returns Supported predefined processes defined by openeo-processes-dask. Returns : ProcessesGetResponse - A list of available processes. list_user_process_graphs def list_user_process_graphs( limit: Optional[int] = 10, user: User = Depends(Authenticator.validate) ) -> Union[ProcessGraphsGetResponse, None] Lists all of a user's user-defined process graphs from the back-end. Arguments : limit int - The limit to apply to the length of the list. user User - The User returned from the Authenticator. Returns : ProcessGraphsGetResponse - A list of the user's UserDefinedProcessGraph as a ProcessGraphWithMetadata. get_user_process_graph def get_user_process_graph( process_graph_id: str, user: User = Depends(Authenticator.validate) ) -> Union[ProcessGraphWithMetadata, None] Lists all information about a user-defined process, including its process graph. Arguments : process_graph_id str - The process graph id. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : ProcessGraphWithMetadata - Retruns the UserDefinedProcessGraph as a ProcessGraphWithMetadata. put_user_process_graph def put_user_process_graph(process_graph_id: str, body: ProcessGraphWithMetadata, user: User = Depends(Authenticator.validate)) Stores a provided user-defined process with process graph that can be reused in other processes. Arguments : process_graph_id str - The process graph id. body ProcessGraphWithMetadata - The ProcessGraphWithMetadata should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : Response - A general FastApi response to signify resource was created as expected. delete_user_process_graph def delete_user_process_graph(process_graph_id: str, user: User = Depends(Authenticator.validate)) Deletes the data related to this user-defined process, including its process graph. Arguments : process_graph_id str - The process graph id. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : Response - A general FastApi response to signify resource was created as expected. validate_user_process_graph def validate_user_process_graph( body: ProcessGraphWithMetadata, user: User = Depends(Authenticator.validate) ) -> ValidationPostResponse Validates the ProcessGraphWithMetadata that is provided by the user. Arguments : process_graph_id str - The process graph id. body ProcessGraphWithMetadata - The ProcessGraphWithMetadata should be used to validate the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : ValidationPostResponse - A response to list an errors that where encountered when .","title":"openeo_fastapi.client.processes"},{"location":"package/client/processes/#table-of-contents","text":"openeo_fastapi.client.processes UserDefinedProcessGraph Config get_orm ProcessRegister __init__ get_available_processes list_processes list_user_process_graphs get_user_process_graph put_user_process_graph delete_user_process_graph validate_user_process_graph","title":"Table of Contents"},{"location":"package/client/processes/#openeo_fastapiclientprocesses","text":"Class and model to define the framework and partial application logic for interacting with Process and Process Graphs. Classes: - ProcessRegister: Framework for defining and extending the logic for working with Processes and Process Graphs.","title":"openeo_fastapi.client.processes"},{"location":"package/client/processes/#userdefinedprocessgraph-objects","text":"class UserDefinedProcessGraph(BaseModel) Pydantic model representing an OpenEO User Defined Process Graph.","title":"UserDefinedProcessGraph Objects"},{"location":"package/client/processes/#config-objects","text":"class Config() Pydantic model class config.","title":"Config Objects"},{"location":"package/client/processes/#get_orm","text":"@classmethod def get_orm(cls) Get the ORM model for this pydantic model.","title":"get_orm"},{"location":"package/client/processes/#processregister-objects","text":"class ProcessRegister(EndpointRegister) The ProcessRegister to regulate the application logic for the API behaviour.","title":"ProcessRegister Objects"},{"location":"package/client/processes/#__init__","text":"def __init__(links) -> None Initialize the ProcessRegister. Arguments : links Links - The Links to be used in some function responses.","title":"__init__"},{"location":"package/client/processes/#get_available_processes","text":"@functools.cache def get_available_processes() Returns the pre-defined process from the process registry. Returns : list[Process] - A list of Processes.","title":"get_available_processes"},{"location":"package/client/processes/#list_processes","text":"def list_processes() -> Union[ProcessesGetResponse, None] Returns Supported predefined processes defined by openeo-processes-dask. Returns : ProcessesGetResponse - A list of available processes.","title":"list_processes"},{"location":"package/client/processes/#list_user_process_graphs","text":"def list_user_process_graphs( limit: Optional[int] = 10, user: User = Depends(Authenticator.validate) ) -> Union[ProcessGraphsGetResponse, None] Lists all of a user's user-defined process graphs from the back-end. Arguments : limit int - The limit to apply to the length of the list. user User - The User returned from the Authenticator. Returns : ProcessGraphsGetResponse - A list of the user's UserDefinedProcessGraph as a ProcessGraphWithMetadata.","title":"list_user_process_graphs"},{"location":"package/client/processes/#get_user_process_graph","text":"def get_user_process_graph( process_graph_id: str, user: User = Depends(Authenticator.validate) ) -> Union[ProcessGraphWithMetadata, None] Lists all information about a user-defined process, including its process graph. Arguments : process_graph_id str - The process graph id. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : ProcessGraphWithMetadata - Retruns the UserDefinedProcessGraph as a ProcessGraphWithMetadata.","title":"get_user_process_graph"},{"location":"package/client/processes/#put_user_process_graph","text":"def put_user_process_graph(process_graph_id: str, body: ProcessGraphWithMetadata, user: User = Depends(Authenticator.validate)) Stores a provided user-defined process with process graph that can be reused in other processes. Arguments : process_graph_id str - The process graph id. body ProcessGraphWithMetadata - The ProcessGraphWithMetadata should be used to create the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : Response - A general FastApi response to signify resource was created as expected.","title":"put_user_process_graph"},{"location":"package/client/processes/#delete_user_process_graph","text":"def delete_user_process_graph(process_graph_id: str, user: User = Depends(Authenticator.validate)) Deletes the data related to this user-defined process, including its process graph. Arguments : process_graph_id str - The process graph id. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : Response - A general FastApi response to signify resource was created as expected.","title":"delete_user_process_graph"},{"location":"package/client/processes/#validate_user_process_graph","text":"def validate_user_process_graph( body: ProcessGraphWithMetadata, user: User = Depends(Authenticator.validate) ) -> ValidationPostResponse Validates the ProcessGraphWithMetadata that is provided by the user. Arguments : process_graph_id str - The process graph id. body ProcessGraphWithMetadata - The ProcessGraphWithMetadata should be used to validate the new BatchJob. user User - The User returned from the Authenticator. Raises : HTTPException - Raises an exception with relevant status code and descriptive message of failure. Returns : ValidationPostResponse - A response to list an errors that where encountered when .","title":"validate_user_process_graph"},{"location":"package/client/register/","text":"Table of Contents openeo_fastapi.client.register EndpointRegister __init__ openeo_fastapi.client.register Class define the basic framework for an EndpointRegister. Classes: - EndpointRegister: Framework for defining and extending the logic for working with an EndpointRegister. EndpointRegister Objects class EndpointRegister() The ProcessRegister to regulate the application logic for the API behaviour. __init__ def __init__() Initialize the EndpointRegister.","title":"openeo_fastapi.client.register"},{"location":"package/client/register/#table-of-contents","text":"openeo_fastapi.client.register EndpointRegister __init__","title":"Table of Contents"},{"location":"package/client/register/#openeo_fastapiclientregister","text":"Class define the basic framework for an EndpointRegister. Classes: - EndpointRegister: Framework for defining and extending the logic for working with an EndpointRegister.","title":"openeo_fastapi.client.register"},{"location":"package/client/register/#endpointregister-objects","text":"class EndpointRegister() The ProcessRegister to regulate the application logic for the API behaviour.","title":"EndpointRegister Objects"},{"location":"package/client/register/#__init__","text":"def __init__() Initialize the EndpointRegister.","title":"__init__"},{"location":"package/client/settings/","text":"Table of Contents openeo_fastapi.client.settings AppSettings API_DNS API_TLS API_TITLE API_DESCRIPTION OPENEO_VERSION OPENEO_PREFIX OIDC_URL OIDC_ORGANISATION OIDC_POLICIES STAC_VERSION STAC_API_URL STAC_COLLECTIONS_WHITELIST ensure_endswith_slash split_oidc_policies_str_to_list Config openeo_fastapi.client.settings Defining the settings to be used at the application layer of the API. AppSettings Objects class AppSettings(BaseSettings) The application settings that need to be defined when the app is initialised. API_DNS The domain name hosting the API. API_TLS Whether the API http scheme should be http or https. API_TITLE The API title to be provided to FastAPI. API_DESCRIPTION The API description to be provided to FastAPI. OPENEO_VERSION The OpenEO Api specification version supported in this deployment of the API. OPENEO_PREFIX The OpenEO prefix to be used when creating the endpoint urls. OIDC_URL The policies to be used for authenticated users with the backend, if not set, any usser with a valid token from the issuer is accepted. OIDC_ORGANISATION The abbreviation of the OIDC provider's organisation name, e.g. egi. OIDC_POLICIES The OIDC policies to check against when authorizing a user. If not provided, all users with a valid token from the issuer will be admitted. \"&&\" Is used to denote the addition of another policy. Policies in the list should be structures as \"key, value\". The key referers to some value that is expected to be found in the OIDC userinfo request. The value referes to some value that is then checked for presence in the values found at the key location. Example : { \"email\": user@test.org, \"groups\" : [ \"/staff\" ] } A valid policy to allow members from the group staff would be, \"groups, /staff\". This would be the value provided to OIDC_POLICIES. If you wanted to include users from another group called \"/trial\", the updated value to OIDC_POLICIES would be, \"groups, /staff && groups, /trial\" STAC_VERSION The STAC Version that is being supported by this deployments data discovery endpoints. STAC_API_URL The STAC URL of the catalogue that the application deployment will proxy to. STAC_COLLECTIONS_WHITELIST The collection ids to filter by when proxying to the Stac catalogue. ensure_endswith_slash @validator(\"STAC_API_URL\") def ensure_endswith_slash(cls, v: str) -> str Ensure the STAC_API_URL ends with a trailing slash. split_oidc_policies_str_to_list @validator(\"OIDC_POLICIES\", pre=True) def split_oidc_policies_str_to_list(cls, v: str) -> str Ensure the OIDC_POLICIES are split and formatted correctly. Config Objects class Config() Pydantic model class config. parse_env_var @classmethod def parse_env_var(cls, field_name: str, raw_val: str) -> Any Parse any variables and handle and csv lists into python list type.","title":"openeo_fastapi.client.settings"},{"location":"package/client/settings/#table-of-contents","text":"openeo_fastapi.client.settings AppSettings API_DNS API_TLS API_TITLE API_DESCRIPTION OPENEO_VERSION OPENEO_PREFIX OIDC_URL OIDC_ORGANISATION OIDC_POLICIES STAC_VERSION STAC_API_URL STAC_COLLECTIONS_WHITELIST ensure_endswith_slash split_oidc_policies_str_to_list Config","title":"Table of Contents"},{"location":"package/client/settings/#openeo_fastapiclientsettings","text":"Defining the settings to be used at the application layer of the API.","title":"openeo_fastapi.client.settings"},{"location":"package/client/settings/#appsettings-objects","text":"class AppSettings(BaseSettings) The application settings that need to be defined when the app is initialised.","title":"AppSettings Objects"},{"location":"package/client/settings/#api_dns","text":"The domain name hosting the API.","title":"API_DNS"},{"location":"package/client/settings/#api_tls","text":"Whether the API http scheme should be http or https.","title":"API_TLS"},{"location":"package/client/settings/#api_title","text":"The API title to be provided to FastAPI.","title":"API_TITLE"},{"location":"package/client/settings/#api_description","text":"The API description to be provided to FastAPI.","title":"API_DESCRIPTION"},{"location":"package/client/settings/#openeo_version","text":"The OpenEO Api specification version supported in this deployment of the API.","title":"OPENEO_VERSION"},{"location":"package/client/settings/#openeo_prefix","text":"The OpenEO prefix to be used when creating the endpoint urls.","title":"OPENEO_PREFIX"},{"location":"package/client/settings/#oidc_url","text":"The policies to be used for authenticated users with the backend, if not set, any usser with a valid token from the issuer is accepted.","title":"OIDC_URL"},{"location":"package/client/settings/#oidc_organisation","text":"The abbreviation of the OIDC provider's organisation name, e.g. egi.","title":"OIDC_ORGANISATION"},{"location":"package/client/settings/#oidc_policies","text":"The OIDC policies to check against when authorizing a user. If not provided, all users with a valid token from the issuer will be admitted. \"&&\" Is used to denote the addition of another policy. Policies in the list should be structures as \"key, value\". The key referers to some value that is expected to be found in the OIDC userinfo request. The value referes to some value that is then checked for presence in the values found at the key location. Example : { \"email\": user@test.org, \"groups\" : [ \"/staff\" ] } A valid policy to allow members from the group staff would be, \"groups, /staff\". This would be the value provided to OIDC_POLICIES. If you wanted to include users from another group called \"/trial\", the updated value to OIDC_POLICIES would be, \"groups, /staff && groups, /trial\"","title":"OIDC_POLICIES"},{"location":"package/client/settings/#stac_version","text":"The STAC Version that is being supported by this deployments data discovery endpoints.","title":"STAC_VERSION"},{"location":"package/client/settings/#stac_api_url","text":"The STAC URL of the catalogue that the application deployment will proxy to.","title":"STAC_API_URL"},{"location":"package/client/settings/#stac_collections_whitelist","text":"The collection ids to filter by when proxying to the Stac catalogue.","title":"STAC_COLLECTIONS_WHITELIST"},{"location":"package/client/settings/#ensure_endswith_slash","text":"@validator(\"STAC_API_URL\") def ensure_endswith_slash(cls, v: str) -> str Ensure the STAC_API_URL ends with a trailing slash.","title":"ensure_endswith_slash"},{"location":"package/client/settings/#split_oidc_policies_str_to_list","text":"@validator(\"OIDC_POLICIES\", pre=True) def split_oidc_policies_str_to_list(cls, v: str) -> str Ensure the OIDC_POLICIES are split and formatted correctly.","title":"split_oidc_policies_str_to_list"},{"location":"package/client/settings/#config-objects","text":"class Config() Pydantic model class config.","title":"Config Objects"},{"location":"package/client/settings/#parse_env_var","text":"@classmethod def parse_env_var(cls, field_name: str, raw_val: str) -> Any Parse any variables and handle and csv lists into python list type.","title":"parse_env_var"},{"location":"package/client/psql/engine/","text":"Table of Contents openeo_fastapi.client.psql.engine get_engine Filter create get modify delete get_first_or_default openeo_fastapi.client.psql.engine Standardisation of common functionality to interact with the ORMs and the database. get_engine def get_engine() Get the engine using config from pydantic settings. Returns : Engine - The engine instance that was created. Filter Objects class Filter(BaseModel) Filter class to assist with providing a filter by funciton with values across different cases. create def create(create_object: BaseModel) -> bool Add the values from a pydantic model to the database using its respective object relational mapping. get def get(get_model: BaseModel, primary_key: Any) -> Union[None, BaseModel] Get the relevant entry for a given model using the provided primary key value. Arguments : get_model BaseModel - The model that to get from the database. primary_key Any - The primary key of the model instance to get. Returns : Union[None, BaseModel]: None, or the found model modify def modify(modify_object: BaseModel) -> bool Modify the relevant entries for a given model instance Arguments : modify_object BaseModel - An instance of a pydantic model that reflects a change to make in the database. Returns : bool - Whether the change was successful. delete def delete(delete_model: BaseModel, primary_key: Any) -> bool Delete the values from a pydantic model in the database using its respective object relational mapping. Arguments : delete_model BaseModel - The model that to delete from the database. primary_key Any - The primary key of the model instance to delete. Returns : bool - Whether the change was successful. get_first_or_default def get_first_or_default(get_model: BaseModel, filter_with: Filter) -> BaseModel Perform a list operation and return the first found instance. Arguments : get_model BaseModel - The model that to get from the database. filter_with Filter - Filter of a Key/Value pair to apply to the model. Returns : Union[None, BaseModel]: Return the model if found, else return None.","title":"openeo_fastapi.client.psql.engine"},{"location":"package/client/psql/engine/#table-of-contents","text":"openeo_fastapi.client.psql.engine get_engine Filter create get modify delete get_first_or_default","title":"Table of Contents"},{"location":"package/client/psql/engine/#openeo_fastapiclientpsqlengine","text":"Standardisation of common functionality to interact with the ORMs and the database.","title":"openeo_fastapi.client.psql.engine"},{"location":"package/client/psql/engine/#get_engine","text":"def get_engine() Get the engine using config from pydantic settings. Returns : Engine - The engine instance that was created.","title":"get_engine"},{"location":"package/client/psql/engine/#filter-objects","text":"class Filter(BaseModel) Filter class to assist with providing a filter by funciton with values across different cases.","title":"Filter Objects"},{"location":"package/client/psql/engine/#create","text":"def create(create_object: BaseModel) -> bool Add the values from a pydantic model to the database using its respective object relational mapping.","title":"create"},{"location":"package/client/psql/engine/#get","text":"def get(get_model: BaseModel, primary_key: Any) -> Union[None, BaseModel] Get the relevant entry for a given model using the provided primary key value. Arguments : get_model BaseModel - The model that to get from the database. primary_key Any - The primary key of the model instance to get. Returns : Union[None, BaseModel]: None, or the found model","title":"get"},{"location":"package/client/psql/engine/#modify","text":"def modify(modify_object: BaseModel) -> bool Modify the relevant entries for a given model instance Arguments : modify_object BaseModel - An instance of a pydantic model that reflects a change to make in the database. Returns : bool - Whether the change was successful.","title":"modify"},{"location":"package/client/psql/engine/#delete","text":"def delete(delete_model: BaseModel, primary_key: Any) -> bool Delete the values from a pydantic model in the database using its respective object relational mapping. Arguments : delete_model BaseModel - The model that to delete from the database. primary_key Any - The primary key of the model instance to delete. Returns : bool - Whether the change was successful.","title":"delete"},{"location":"package/client/psql/engine/#get_first_or_default","text":"def get_first_or_default(get_model: BaseModel, filter_with: Filter) -> BaseModel Perform a list operation and return the first found instance. Arguments : get_model BaseModel - The model that to get from the database. filter_with Filter - Filter of a Key/Value pair to apply to the model. Returns : Union[None, BaseModel]: Return the model if found, else return None.","title":"get_first_or_default"},{"location":"package/client/psql/models/","text":"Table of Contents openeo_fastapi.client.psql.models UserORM user_id oidc_sub created_at JobORM job_id process status user_id created title description synchronous UdpORM id user_id process_graph created parameters returns summary description openeo_fastapi.client.psql.models ORM definitions for defining and storing the associated data in the databse. UserORM Objects class UserORM(BASE) ORM for the user table. user_id UUID of the user. oidc_sub OIDC substring of the user. created_at The datetime the user was created. JobORM Objects class JobORM(BASE) ORM for the job table. job_id UUID of the job. process The process graph for this job. status The status of the Job. user_id The UUID of the user that owns this job. created The datetime the job was created. title The title of the job. description The job description. synchronous If the Job is synchronous. UdpORM Objects class UdpORM(BASE) ORM for the UDPS table. id The string name of the UDP. CPK with user_id. Different users can use the same string for id. user_id The UUID of the user that owns this UDP. process_graph The process graph of the UDP. created The datetime the UDP was created. parameters The parameters of the UDP. returns The return types of the UDP. summary A summary of the UPD. description A description of what the UDP is intended to do.","title":"openeo_fastapi.client.psql.models"},{"location":"package/client/psql/models/#table-of-contents","text":"openeo_fastapi.client.psql.models UserORM user_id oidc_sub created_at JobORM job_id process status user_id created title description synchronous UdpORM id user_id process_graph created parameters returns summary description","title":"Table of Contents"},{"location":"package/client/psql/models/#openeo_fastapiclientpsqlmodels","text":"ORM definitions for defining and storing the associated data in the databse.","title":"openeo_fastapi.client.psql.models"},{"location":"package/client/psql/models/#userorm-objects","text":"class UserORM(BASE) ORM for the user table.","title":"UserORM Objects"},{"location":"package/client/psql/models/#user_id","text":"UUID of the user.","title":"user_id"},{"location":"package/client/psql/models/#oidc_sub","text":"OIDC substring of the user.","title":"oidc_sub"},{"location":"package/client/psql/models/#created_at","text":"The datetime the user was created.","title":"created_at"},{"location":"package/client/psql/models/#joborm-objects","text":"class JobORM(BASE) ORM for the job table.","title":"JobORM Objects"},{"location":"package/client/psql/models/#job_id","text":"UUID of the job.","title":"job_id"},{"location":"package/client/psql/models/#process","text":"The process graph for this job.","title":"process"},{"location":"package/client/psql/models/#status","text":"The status of the Job.","title":"status"},{"location":"package/client/psql/models/#user_id_1","text":"The UUID of the user that owns this job.","title":"user_id"},{"location":"package/client/psql/models/#created","text":"The datetime the job was created.","title":"created"},{"location":"package/client/psql/models/#title","text":"The title of the job.","title":"title"},{"location":"package/client/psql/models/#description","text":"The job description.","title":"description"},{"location":"package/client/psql/models/#synchronous","text":"If the Job is synchronous.","title":"synchronous"},{"location":"package/client/psql/models/#udporm-objects","text":"class UdpORM(BASE) ORM for the UDPS table.","title":"UdpORM Objects"},{"location":"package/client/psql/models/#id","text":"The string name of the UDP. CPK with user_id. Different users can use the same string for id.","title":"id"},{"location":"package/client/psql/models/#user_id_2","text":"The UUID of the user that owns this UDP.","title":"user_id"},{"location":"package/client/psql/models/#process_graph","text":"The process graph of the UDP.","title":"process_graph"},{"location":"package/client/psql/models/#created_1","text":"The datetime the UDP was created.","title":"created"},{"location":"package/client/psql/models/#parameters","text":"The parameters of the UDP.","title":"parameters"},{"location":"package/client/psql/models/#returns","text":"The return types of the UDP.","title":"returns"},{"location":"package/client/psql/models/#summary","text":"A summary of the UPD.","title":"summary"},{"location":"package/client/psql/models/#description_1","text":"A description of what the UDP is intended to do.","title":"description"},{"location":"package/client/psql/settings/","text":"Table of Contents openeo_fastapi.client.psql.settings DataBaseSettings POSTGRES_USER POSTGRES_PASSWORD POSTGRESQL_HOST POSTGRESQL_PORT POSTGRES_DB ALEMBIC_DIR openeo_fastapi.client.psql.settings Defining the settings to be used at the application layer of the API for database interaction. DataBaseSettings Objects class DataBaseSettings(BaseSettings) Appliction DataBase settings to interact with PSQL. POSTGRES_USER The name of the postgres user. POSTGRES_PASSWORD The pasword for the postgres user. POSTGRESQL_HOST The host the database runs on. POSTGRESQL_PORT The post on the host the database is available on. POSTGRES_DB The name of the databse being used on the host. ALEMBIC_DIR The path leading to the alembic directory to be used.","title":"openeo_fastapi.client.psql.settings"},{"location":"package/client/psql/settings/#table-of-contents","text":"openeo_fastapi.client.psql.settings DataBaseSettings POSTGRES_USER POSTGRES_PASSWORD POSTGRESQL_HOST POSTGRESQL_PORT POSTGRES_DB ALEMBIC_DIR","title":"Table of Contents"},{"location":"package/client/psql/settings/#openeo_fastapiclientpsqlsettings","text":"Defining the settings to be used at the application layer of the API for database interaction.","title":"openeo_fastapi.client.psql.settings"},{"location":"package/client/psql/settings/#databasesettings-objects","text":"class DataBaseSettings(BaseSettings) Appliction DataBase settings to interact with PSQL.","title":"DataBaseSettings Objects"},{"location":"package/client/psql/settings/#postgres_user","text":"The name of the postgres user.","title":"POSTGRES_USER"},{"location":"package/client/psql/settings/#postgres_password","text":"The pasword for the postgres user.","title":"POSTGRES_PASSWORD"},{"location":"package/client/psql/settings/#postgresql_host","text":"The host the database runs on.","title":"POSTGRESQL_HOST"},{"location":"package/client/psql/settings/#postgresql_port","text":"The post on the host the database is available on.","title":"POSTGRESQL_PORT"},{"location":"package/client/psql/settings/#postgres_db","text":"The name of the databse being used on the host.","title":"POSTGRES_DB"},{"location":"package/client/psql/settings/#alembic_dir","text":"The path leading to the alembic directory to be used.","title":"ALEMBIC_DIR"}]} \ No newline at end of file diff --git a/search/worker.js b/search/worker.js new file mode 100644 index 0000000..8628dbc --- /dev/null +++ b/search/worker.js @@ -0,0 +1,133 @@ +var base_path = 'function' === typeof importScripts ? '.' : '/search/'; +var allowSearch = false; +var index; +var documents = {}; +var lang = ['en']; +var data; + +function getScript(script, callback) { + console.log('Loading script: ' + script); + $.getScript(base_path + script).done(function () { + callback(); + }).fail(function (jqxhr, settings, exception) { + console.log('Error: ' + exception); + }); +} + +function getScriptsInOrder(scripts, callback) { + if (scripts.length === 0) { + callback(); + return; + } + getScript(scripts[0], function() { + getScriptsInOrder(scripts.slice(1), callback); + }); +} + +function loadScripts(urls, callback) { + if( 'function' === typeof importScripts ) { + importScripts.apply(null, urls); + callback(); + } else { + getScriptsInOrder(urls, callback); + } +} + +function onJSONLoaded () { + data = JSON.parse(this.responseText); + var scriptsToLoad = ['lunr.js']; + if (data.config && data.config.lang && data.config.lang.length) { + lang = data.config.lang; + } + if (lang.length > 1 || lang[0] !== "en") { + scriptsToLoad.push('lunr.stemmer.support.js'); + if (lang.length > 1) { + scriptsToLoad.push('lunr.multi.js'); + } + if (lang.includes("ja") || lang.includes("jp")) { + scriptsToLoad.push('tinyseg.js'); + } + for (var i=0; i < lang.length; i++) { + if (lang[i] != 'en') { + scriptsToLoad.push(['lunr', lang[i], 'js'].join('.')); + } + } + } + loadScripts(scriptsToLoad, onScriptsLoaded); +} + +function onScriptsLoaded () { + console.log('All search scripts loaded, building Lunr index...'); + if (data.config && data.config.separator && data.config.separator.length) { + lunr.tokenizer.separator = new RegExp(data.config.separator); + } + + if (data.index) { + index = lunr.Index.load(data.index); + data.docs.forEach(function (doc) { + documents[doc.location] = doc; + }); + console.log('Lunr pre-built index loaded, search ready'); + } else { + index = lunr(function () { + if (lang.length === 1 && lang[0] !== "en" && lunr[lang[0]]) { + this.use(lunr[lang[0]]); + } else if (lang.length > 1) { + this.use(lunr.multiLanguage.apply(null, lang)); // spread operator not supported in all browsers: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator#Browser_compatibility + } + this.field('title'); + this.field('text'); + this.ref('location'); + + for (var i=0; i < data.docs.length; i++) { + var doc = data.docs[i]; + this.add(doc); + documents[doc.location] = doc; + } + }); + console.log('Lunr index built, search ready'); + } + allowSearch = true; + postMessage({config: data.config}); + postMessage({allowSearch: allowSearch}); +} + +function init () { + var oReq = new XMLHttpRequest(); + oReq.addEventListener("load", onJSONLoaded); + var index_path = base_path + '/search_index.json'; + if( 'function' === typeof importScripts ){ + index_path = 'search_index.json'; + } + oReq.open("GET", index_path); + oReq.send(); +} + +function search (query) { + if (!allowSearch) { + console.error('Assets for search still loading'); + return; + } + + var resultDocuments = []; + var results = index.search(query); + for (var i=0; i < results.length; i++){ + var result = results[i]; + doc = documents[result.ref]; + doc.summary = doc.text.substring(0, 200); + resultDocuments.push(doc); + } + return resultDocuments; +} + +if( 'function' === typeof importScripts ) { + onmessage = function (e) { + if (e.data.init) { + init(); + } else if (e.data.query) { + postMessage({ results: search(e.data.query) }); + } else { + console.error("Worker - Unrecognized message: " + e); + } + }; +} diff --git a/setup/index.html b/setup/index.html new file mode 100644 index 0000000..8ca4786 --- /dev/null +++ b/setup/index.html @@ -0,0 +1,352 @@ + + + + + + + +Everything on this page is all you need to go from 0 to having your OpenEO Api server running locally.
+The openeo-fastapi package comes with a couple of assumptions. The first assumption, is the package is used to build a server side application. The second assumption is that the user is able to provide a connection to a psql database. The final assumption, is the user has provided the set of required environment variables which are needed for the application to run.
+The following steps will explain how the user can get the application skeleton to run.
+Prior to installation, configure and activate a virtual environment for your new project, I can recommend using poetry for this. Once the environment is activate continue with installing openeo-fastapi.
+pip install openeo-fastapi
+
+The openeo-fastapi CLI can be used to set up a quick source directory for your deployment.
+openeo_fastapi new /path/to/source/directory
+
+The command line interface will create the following directory tree.
+src/
+ __init__.py
+ app.py
+ revise.py
+ /psql
+ alembic.ini
+ models.py
+ alembic/
+ env.py
+ README
+ script.py.mako
+ versions/
+
+The app.py file defines the minimal code to define the FastApi application to deploy the API.
+The revise.py file defines steps that can be used to generate and apply +alembic revisions to the database deployment. This file is intended to be used after a new release of your deployment, but before your release has been deployed, i.e. as part of an initialization container. This file is optional and can be deleted if you want to complete these steps in a different way.
+The /psql directory is used for housing the alembic directory to record the alembic revision history and connectivity to the database. All files ( apart from models.py ) are generated from the alembic init command, so refer to the alembic docs for more information on those files.
+The /psql/models.py file defines the basis for importing the orm models from the OpenEO FastApi and defining the metadata class that can then be imported and used in the alembic env.py file.
+The /psql/alembic/env.py file needs a couple of edits.
+Set the main option for the psql connection.
+config.set_main_option(
+ "sqlalchemy.url",
+ f"postgresql://{environ.get('POSTGRES_USER')}:{environ.get('POSTGRES_PASSWORD')}"
+ f"@{environ.get('POSTGRESQL_HOST')}:{environ.get('POSTGRESQL_PORT')}"
+ f"/{environ.get('POSTGRES_DB')}",
+)
+
+Set the target metadata. In this example, I am importing from the /psql/models.py file.
+from openeo_api.psql.models import metadata
+target_metadata = metadata
+
+These variables need to be set in the environment of the deployment. Those marked required need to be set, and those set False, have some default value that only needs to be provided
+Variable | +Description | +Required | +
---|---|---|
API_DNS | +The domain name hosting the API. | +True | +
API_TLS | +Whether the API http scheme should be http or https. | +True | +
API_TITLE | +The API title to be provided to FastAPI. | +True | +
API_DESCRIPTION | +The API description to be provided to FastAPI. | +True | +
OPENEO_VERSION | +The OpenEO Api specification version supported in this deployment of the API. Defaults to "1.1.0". | +False | +
OPENEO_PREFIX | +The OpenEO prefix to be used when creating the endpoint urls. Defaults to the value of the openeo_version | +True | +
OIDC_URL | +The URL of the OIDC provider used to authenticate tokens against. | +True | +
OIDC_ORGANISATION | +The abbreviation of the OIDC provider's organisation name. | +True | +
OIDC_POLICIES | +The OIDC policies user to check to authorize a user. | +False | +
STAC_VERSION | +The STAC Version that is being supported by this deployments data discovery endpoints. Defaults to "1.0.0". | +False | +
STAC_API_URL | +The STAC URL of the catalogue that the application deployment will proxy to. | +True | +
STAC_COLLECTIONS_WHITELIST | +The collection ids to filter by when proxying to the Stac catalogue. | +False | +
POSTGRES_USER | +The name of the postgres user. | +True | +
POSTGRES_PASSWORD | +The pasword for the postgres user. | +True | +
POSTGRESQL_HOST | +The host the database runs on. | +True | +
POSTGRESQL_PORT | +The post on the host the database is available on. | +True | +
POSTGRES_DB | +The name of the databse being used on the host. | +True | +
ALEMBIC_DIR | +The path to the alembic directory for applying revisions. | +True | +
Revise the database.
+python -m revise.py
+
+Deploy the uvicorn server
+uvicorn openeo_app.main:app --reload
+
+