Skip to main content

index

Objects

StyleObject

class StyleObject(BaseModel)

An object describing a vector style.

Arguments:

  • BaseModel BaseModel - inherited from pydantic.

Attributes:

  • default str - a default style name.
  • styles list[str] - list of style names.
  • custom dict - Geostyle json.

BaseInput

class BaseInput(BaseModel)

Base input event.

Arguments:

  • BaseModel BaseModel - inherited from pydantic

Attributes:

  • workspace str - name of the workspace.
  • layername str - name of the layer.
  • date str, optional - date in %YYYYmmDD format.
  • description str, optional - description of the layer.
  • style_json StyleObject, optional - input styling definitions.
  • zone str | int, optional - force publication to happen on another target zone ID.
  • prefix str, optional - input prefix to find source files.
  • force_publish bool, optional - force publication even when databases block you.
  • overwrite bool, optional - overwrite previous publication.

Raises:

  • ValueError - raised when required input is invalid.

Returns:

  • _type_ - description

is_none_with_prefix

@model_validator(mode="before")
@classmethod
def is_none_with_prefix(cls, data: dict) -> dict

Attempt to fix incoming data when date and prefix aren't present

Arguments:

  • data dict - input data

Raises:

  • ValueError - raised when both are None

Returns:

  • dict - fixed data

is_none_with_force

@model_validator(mode="before")
@classmethod
def is_none_with_force(cls, data: dict) -> dict

Method to run a specific override

Arguments:

  • data dict - input data

Raises:

  • ValueError - raised when zone information is missing

Returns:

  • dict - forced fix on data

Functions

lambda_handler

@tracer.capture_lambda_handler
@logger.inject_lambda_context()
def lambda_handler(event: dict, context: dict) -> dict

Lambda handler that deals with publication of vector data

Arguments:

  • event dict - input event, must be convertable to BaseInput
  • context dict - contains authentication information

Raises:

  • HTTPError - raised when publication endpoint fails

Returns:

  • dict - output event

Examples:

event = {
"workspace": "some-workspace",
"layername": "some-layer",
"date": "20210201",
"description": "some description",
"style_json": {
"default": "some_generic.json",
"styles": [
"some_generic.json",
"some_cool_style.json"
],
"custom": {
"name": "a styles",
"rules": [
"filter": [
"&&",
"attribute",
"this"
],
"symbolizer": {
"color": "red",
"opacity": 1,
},
"name": "rule name"
]
}
},
"zone": 1336,
"force_publish": False,
"overwrite": False
}