Skip to content

Commit f878b09

Browse files
committed
feat(definition): add module for listing server and vhost definitions
1 parent d288e81 commit f878b09

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
defmodule ExRabbitMQAdmin.Definition do
2+
@api_namespace "/api/definitions"
3+
4+
@doc """
5+
List all server definitions - exchanges, queues, bindings, users,
6+
virtual hosts, permissions, topic permissions, and parameters.
7+
"""
8+
@spec list_definitions(client :: Tesla.Client.t()) :: {:ok, Tesla.Env.t()} | {:error, term()}
9+
def list_definitions(client), do: Tesla.get(client, @api_namespace)
10+
11+
@doc """
12+
List all definitions for a specific virtual host.
13+
"""
14+
@spec list_vhost_definitions(client :: Tesla.Client.t(), vhost :: String.t()) ::
15+
{:ok, Tesla.Env.t()} | {:error, term()}
16+
def list_vhost_definitions(client, vhost), do: Tesla.get(client, "#{@api_namespace}/#{vhost}")
17+
end

0 commit comments

Comments
 (0)