GeoserverConfig.Datastores (GeoserverConfig v0.3.0)

Copy Markdown View Source

Provides functions to manage GeoServer datastores via its REST API.

Supports listing, creating, updating, and deleting datastores within a specific GeoServer workspace. All functions require a GeoserverConfig.Connection as their first argument.

Supported datastore types

  • "postgis" — PostgreSQL/PostGIS
  • "geopkg" — GeoPackage file
  • "shapefile" — Shapefile
  • "wfs" — Web Feature Service

Summary

Functions

Creates a new datastore in the specified workspace.

Deletes a datastore from the given workspace.

Lists all datastores in the given workspace.

Functions

create_datastore(conn, workspace, name, type, connection_params)

Creates a new datastore in the specified workspace.

Returns

  • {:ok, name} on success
  • {:error, reason} on failure

delete_datastore(conn, workspace, datastore_name, recurse \\ false)

Deletes a datastore from the given workspace.

Returns

  • {:ok, datastore_name} on success
  • {:error, {:http_error, status, body}} on failure
  • {:error, {:request_failed, message}} on transport error

list_datastores(conn, workspace)

Lists all datastores in the given workspace.

GeoServer returns a single map when there is only one datastore; this function normalises that to always return a list.

Returns

  • {:ok, [datastore]} on success
  • {:error, {:http_error, status, body}} on non-200 response
  • {:error, exception} on transport error

update_datastore(conn, workspace, datastore_name, datastore_type, connection_params)

Updates an existing datastore's configuration.

Returns

  • {:ok, datastore_name} on success
  • {:error, {:http_error, status, body}} on failure
  • {:error, {:request_failed, message}} on transport error