ExRabbitMQAdmin.User (ex_rabbitmq_admin v0.1.4)

View Source

This module contains functions for interacting with RabbitMQ users.

Summary

Functions

Delete all users in given list.

Deletes an individual user by given name.

Get an individual user by name.

Get all permissions for an individual user.

Get all topic permissions for an individual user.

Hash the given password using the hashing algorithm described here.

List all users in the RabbitMQ cluster.

List users in the RabbitMQ cluster that have no access to any virtual host.

Create a new user with given name. RabbitMQ currently only supports weak password hashing algorithms, and should be avoided if possible. If passing a blank password, a password-less user will be created. This user will not be able to authenticate with basic auth, and must use other means (such as TLS certificates).

Functions

bulk_delete_users(client, users)

@spec bulk_delete_users(client :: Tesla.Client.t(), users :: [String.t()]) ::
  {:ok, Tesla.Env.t()} | {:error, term()}

Delete all users in given list.

Params

  • client - Tesla client used to perform the request.

delete_user(client, user)

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

Deletes an individual user by given name.

Params

  • client - Tesla client used to perform the request.
  • user - type: string, required: true

get_user(client, user)

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

Get an individual user by name.

Params

  • client - Tesla client used to perform the request.
  • user - type: string, required: true

get_user_permissions(client, user)

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

Get all permissions for an individual user.

Params

  • client - Tesla client used to perform the request.
  • user - type: string, required: true

get_user_topic_permissions(client, user)

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

Get all topic permissions for an individual user.

Params

  • client - Tesla client used to perform the request.
  • user - type: string, required: true

hash_password(password)

@spec hash_password(password :: String.t()) :: {:ok, String.t()}

Hash the given password using the hashing algorithm described here.

RabbitMQ by default relies on (weak) hashed password, but we're enforcing the strongest supported hashing algorithm (sha512).

If possible, avoid using passwords and authenticate using other means such as TLS certificates.

Params

  • password - type: string, required: true

list_users(client)

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

List all users in the RabbitMQ cluster.

Params

  • client - Tesla client used to perform the request.

list_users_without_permissions(client)

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

List users in the RabbitMQ cluster that have no access to any virtual host.

Params

  • client - Tesla client used to perform the request.

put_user(client, user, opts)

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

Create a new user with given name. RabbitMQ currently only supports weak password hashing algorithms, and should be avoided if possible. If passing a blank password, a password-less user will be created. This user will not be able to authenticate with basic auth, and must use other means (such as TLS certificates).

Params

  • client - Tesla client used to perform the request.

  • user - type: string, required: true

  • :password (String.t/0) - Required. The password that will be used for the created user. All passwords will be hashed using the rabbit_password_hashing_sha512 hashing algorithm before sent to over the wire. If blank password, users will not be able to login using a password, but other mechanisms like client certificates may be used.

  • :tags (String.t/0) - Required. Comma-separated list of tags for the user. Currently only administrator, monitoring and management are recognized.