GeoserverConfig.Workspaces (GeoserverConfig v0.4.1)

Copy Markdown View Source

Provides functions for interacting with GeoServer workspaces via its REST API.

All functions require a GeoserverConfig.Connection as their first argument.

Example

conn = GeoserverConfig.Connection.from_env()
{:ok, workspaces} = GeoserverConfig.Workspaces.fetch_workspaces(conn)

Summary

Functions

Creates a new workspace in GeoServer.

Deletes an existing workspace from GeoServer.

Fetches the list of all available workspaces from GeoServer.

Fetches a single workspace by name from GeoServer.

Updates the name of an existing workspace in GeoServer.

Functions

create_workspace(conn, workspace_name)

Creates a new workspace in GeoServer.

Returns

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

delete_workspace(conn, workspace_name)

Deletes an existing workspace from GeoServer.

Returns

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

fetch_workspaces(conn)

Fetches the list of all available workspaces from GeoServer.

Returns

  • {:ok, [workspace]} on success
  • {:error, {:http_error, status, body}} on non-200 response
  • {:error, {:request_failed, message}} on transport error

get_workspace(conn, workspace_name)

Fetches a single workspace by name from GeoServer.

Returns

  • {:ok, workspace} on success (a map with "name" and "href" keys)
  • {:error, {:http_error, status, body}} on non-200 response
  • {:error, {:request_failed, message}} on transport error

update_workspace(conn, old_workspace_name, new_workspace_name)

Updates the name of an existing workspace in GeoServer.

Returns

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