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.
Fetches a single datastore by name from the given workspace.
Lists all datastores in the given workspace.
Resets the caches related to this specific data store.
Updates an existing datastore's configuration.
Uploads files to a data store, creating it if necessary.
Functions
Creates a new datastore in the specified workspace.
Returns
{:ok, name}on success{:error, reason}on failure
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
Fetches a single datastore by name from the given workspace.
Options
:quiet_on_not_found— whentrue, avoids logging an exception on 404 (default:false)
Returns
{:ok, datastore}on success (a map with datastore details){:error, {:http_error, status, body}}on non-200 response{:error, exception}on transport error
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
Resets the caches related to this specific data store.
This forces GeoServer to drop cached data store structures and reconnect to the vector source the next time it is needed.
Returns
{:ok, datastore_name}on success{:error, {:http_error, status, body}}on failure{:error, {:request_failed, reason}}on transport error
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
Uploads files to a data store, creating it if necessary.
Uses the PUT /datastores/{store}/{method}.{format} endpoint.
Parameters
conn— aGeoserverConfig.Connectionworkspace— the workspace namestore_name— target datastore name (will be created if absent)method—:file,:url, or:externalformat— the file extension (e.g."shp","geopkg","properties")body— file content (for:file), a URL string (for:url), or a local path (for:external)opts— optional keyword list::configure—"none","first"(default), or"all":target— target data store format (e.g."shp"):update—"append"(default) or"overwrite":charset— character encoding (e.g."ISO-8859-1"):filename— target filename for the uploaded file:content_type— override Content-Type header
Returns
{:ok, store_name}on success{:error, {:http_error, status, body}}on failure{:error, {:request_failed, reason}}on transport error