ExRabbitMQAdmin.Vhost (ex_rabbitmq_admin v0.1.4)

View Source

This module contains functions for interacting with RabbitMQ virtual hosts.

Summary

Functions

Delete a specific virtual host by vhost.

Get an individual virtual host by vhost.

List all open channels for a specific virtual host. Optionally pass pagination parameters to filter channels.

List all open open connections in a specific virtual host. Optionally pass pagination parameters to filter connections.

List all permissions for a specific virtual host.

List all topic permissions for a specific virtual host.

List all virtual hosts running on the RabbitMQ cluster.

Create a new virtual host with given vhost.

Set permissions for a user on a specific virtual host. RabbitMQ permissions are defined as triplets of regular expressions.

Start a specific virtual host on given node.

Functions

delete_vhost(client, vhost)

@spec delete_vhost(client :: Tesla.Client.t(), vhost :: String.t()) ::
  {:ok, Tesla.Env.t()} | {:error, term()}

Delete a specific virtual host by vhost.

Params

  • client - Tesla client used to perform the request.
  • vhost - type: string, The vhost of the virtual host that should be deleted.

get_vhost(client, vhost)

@spec get_vhost(client :: Tesla.Client.t(), vhost :: String.t()) ::
  {:ok, Tesla.Env.t()} | {:error, term()}

Get an individual virtual host by vhost.

Params

  • client - Tesla client used to perform the request.

list_vhost_channels(client, vhost, opts \\ [])

@spec list_vhost_channels(
  client :: Tesla.Client.t(),
  vhost :: String.t(),
  opts :: Keyword.t()
) ::
  {:ok, Tesla.Env.t()} | no_return()

List all open channels for a specific virtual host. Optionally pass pagination parameters to filter channels.

Params

  • client - Tesla client used to perform the request.

  • vhost - type: string, required: true

  • :page (non_neg_integer/0) - Page number to fetch if paginating the results.

  • :page_size (non_neg_integer/0) - Number of elements per page, defaults to 100.

  • :name (String.t/0) - Filter by name, for example queue name, exchange name, etc.

  • :use_regex (boolean/0) - Enables regular expression for the param name.

list_vhost_connections(client, vhost, opts \\ [])

@spec list_vhost_connections(
  client :: Tesla.Client.t(),
  vhost :: String.t(),
  opts :: Keyword.t()
) :: {:ok, Tesla.Env.t()} | no_return()

List all open open connections in a specific virtual host. Optionally pass pagination parameters to filter connections.

Params

  • client - Tesla client used to perform the request.

  • vhost - type: string, required: true

  • :page (non_neg_integer/0) - Page number to fetch if paginating the results.

  • :page_size (non_neg_integer/0) - Number of elements per page, defaults to 100.

  • :name (String.t/0) - Filter by name, for example queue name, exchange name, etc.

  • :use_regex (boolean/0) - Enables regular expression for the param name.

list_vhost_permissions(client, vhost)

@spec list_vhost_permissions(client :: Tesla.Client.t(), vhost :: String.t()) ::
  {:ok, Tesla.Env.t()} | {:error, term()}

List all permissions for a specific virtual host.

Params

  • client - Tesla client used to perform the request.
  • vhost - type: string, The vhost of the vhost to list permissions for.

list_vhost_topic_permissions(client, vhost)

@spec list_vhost_topic_permissions(client :: Tesla.Client.t(), vhost :: String.t()) ::
  {:ok, Tesla.Env.t() | {:error, term()}}

List all topic permissions for a specific virtual host.

Params

  • client - Tesla client used to perform the request.

list_vhosts(client)

@spec list_vhosts(client :: Tesla.Client.t()) ::
  {:ok, Tesla.Env.t()} | {:error, term()}

List all virtual hosts running on the RabbitMQ cluster.

Params

  • client - Tesla client used to perform the request.

put_vhost(client, vhost, opts \\ [])

@spec put_vhost(client :: Tesla.Client.t(), vhost :: String.t(), opts :: Keyword.t()) ::
  {:ok, Tesla.Env.t()} | no_return()

Create a new virtual host with given vhost.

Params

  • client - Tesla client used to perform the request.

  • vhost - type: string, required: true

  • :description (String.t/0) - Optional description for virtual host. The default value is "".

  • :tags (String.t/0) - Tags is an optional comma-separated list of tags. The default value is "".

put_vhost_permissions(client, vhost, user, opts \\ [])

@spec put_vhost_permissions(
  client :: Tesla.Client.t(),
  vhost :: String.t(),
  user :: String.t(),
  opts :: Keyword.t()
) :: {:ok, Tesla.Env.t()} | no_return()

Set permissions for a user on a specific virtual host. RabbitMQ permissions are defined as triplets of regular expressions.

Please consult the official documentation for more details.

Params

  • client - Tesla client used to perform the request.

  • vhost - type: string, The vhost of the vhost to assign permissions for.

  • user - type: string, The username to assign permissions for.

  • :configure (String.t/0) - Required. A regular expression that will determine the configure permissions for the given resource. Defaults to deny-all. The default value is "^$".

  • :write (String.t/0) - Required. A regular expression that will determine the write permissions for the given resource. Defaults to deny-all. The default value is "^$".

  • :read (String.t/0) - Required. A regular expression that will determine the read permissions for the given resource. Defaults to deny-all. The default value is "^$".

start_vhost(client, vhost, node)

@spec start_vhost(client :: Tesla.Client.t(), vhost :: String.t(), node :: String.t()) ::
  {:ok, Tesla.Env.t()} | {:error, term()}

Start a specific virtual host on given node.

Params

  • client - Tesla client used to perform the request.
  • vhost - type: string, The vhost of the virtual host that should be started.
  • node - type: string, The vhost of the node that the virtual host should be started on.