Skip to content

Commit ed2de94

Browse files
committed
add: rename vhost argument
1 parent 3e50567 commit ed2de94

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

lib/ex_rabbitmq_admin/vhost.ex

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@ defmodule ExRabbitMQAdmin.Vhost do
2929
### Params
3030
3131
* `client` - Tesla client used to perform the request.
32-
* `name` - type: `string`, required: `true`
32+
* `vhost` - type: `string`, required: `true`
3333
#{NimbleOptions.docs(pagination_definition())}
3434
"""
3535
@spec list_vhost_connections(
3636
client :: Tesla.Client.t(),
37-
name :: String.t(),
37+
vhost :: String.t(),
3838
opts :: Keyword.t()
3939
) ::
4040
{:ok, Tesla.Env.t()} | no_return()
41-
def list_vhost_connections(client, name, opts \\ []) do
41+
def list_vhost_connections(client, vhost, opts \\ []) do
4242
case NimbleOptions.validate(opts, pagination_definition()) do
4343
{:error, error} ->
4444
raise ArgumentError, format_error(error)
4545

4646
{:ok, opts} ->
4747
client
4848
|> ExRabbitMQAdmin.add_query_middleware(opts)
49-
|> Tesla.get("#{@api_namespace}/#{name}/connections")
49+
|> Tesla.get("#{@api_namespace}/#{vhost}/connections")
5050
end
5151
end
5252

@@ -57,20 +57,20 @@ defmodule ExRabbitMQAdmin.Vhost do
5757
### Params
5858
5959
* `client` - Tesla client used to perform the request.
60-
* `name` - type: `string`, required: `true`
60+
* `vhost` - type: `string`, required: `true`
6161
#{NimbleOptions.docs(pagination_definition())}
6262
"""
63-
@spec list_vhost_channels(client :: Tesla.Client.t(), name :: String.t(), opts :: Keyword.t()) ::
63+
@spec list_vhost_channels(client :: Tesla.Client.t(), vhost :: String.t(), opts :: Keyword.t()) ::
6464
{:ok, Tesla.Env.t()} | no_return()
65-
def list_vhost_channels(client, name, opts \\ []) do
65+
def list_vhost_channels(client, vhost, opts \\ []) do
6666
case NimbleOptions.validate(opts, pagination_definition()) do
6767
{:error, error} ->
6868
raise ArgumentError, format_error(error)
6969

7070
{:ok, opts} ->
7171
client
7272
|> ExRabbitMQAdmin.add_query_middleware(opts)
73-
|> Tesla.get("#{@api_namespace}/#{name}/connections")
73+
|> Tesla.get("#{@api_namespace}/#{vhost}/connections")
7474
end
7575
end
7676

@@ -80,12 +80,12 @@ defmodule ExRabbitMQAdmin.Vhost do
8080
### Params
8181
8282
* `client` - Tesla client used to perform the request.
83-
* `name` - type: `string`, The name of the vhost to list permissions for.
83+
* `vhost` - type: `string`, The vhost of the vhost to list permissions for.
8484
"""
85-
@spec list_vhost_permissions(client :: Tesla.Client.t(), name :: String.t()) ::
85+
@spec list_vhost_permissions(client :: Tesla.Client.t(), vhost :: String.t()) ::
8686
{:ok, Tesla.Env.t()} | {:error, term()}
87-
def list_vhost_permissions(client, name),
88-
do: client |> Tesla.get("#{@api_namespace}/#{name}/permissions")
87+
def list_vhost_permissions(client, vhost),
88+
do: client |> Tesla.get("#{@api_namespace}/#{vhost}/permissions")
8989

9090
@doc """
9191
Set permissions for a user on a specific virtual host.
@@ -98,20 +98,20 @@ defmodule ExRabbitMQAdmin.Vhost do
9898
### Params
9999
100100
* `client` - Tesla client used to perform the request.
101-
* `name` - type: `string`, The name of the vhost to assign permissions for.
101+
* `vhost` - type: `string`, The vhost of the vhost to assign permissions for.
102102
* `user` - type: `string`, The username to assign permissions for.
103103
#{NimbleOptions.docs(put_vhost_permissions())}
104104
"""
105105
@spec put_vhost_permissions(
106106
client :: Telsa.Client.t(),
107-
name :: String.t(),
107+
vhost :: String.t(),
108108
user :: String.t(),
109109
opts :: Keyword.t()
110110
) :: {:ok, Tesla.Env.t()} | no_return()
111-
def put_vhost_permissions(client, name, user, opts \\ []) do
111+
def put_vhost_permissions(client, vhost, user, opts \\ []) do
112112
case NimbleOptions.validate(opts, put_vhost_permissions()) do
113113
{:ok, opts} ->
114-
client |> Tesla.put("/api/permissions/#{name}/#{user}", Enum.into(opts, %{}))
114+
client |> Tesla.put("/api/permissions/#{vhost}/#{user}", Enum.into(opts, %{}))
115115

116116
{:error, error} ->
117117
raise ArgumentError, format_error(error)
@@ -125,68 +125,68 @@ defmodule ExRabbitMQAdmin.Vhost do
125125
126126
* `client` - Tesla client used to perform the request.
127127
"""
128-
@spec list_vhost_topic_permissions(client :: Tesla.Client.t(), name :: String.t()) ::
128+
@spec list_vhost_topic_permissions(client :: Tesla.Client.t(), vhost :: String.t()) ::
129129
{:ok, Tesla.Env.t() | {:error, term()}}
130-
def list_vhost_topic_permissions(client, name),
131-
do: client |> Tesla.get("#{@api_namespace}/#{name}/topic-permissions")
130+
def list_vhost_topic_permissions(client, vhost),
131+
do: client |> Tesla.get("#{@api_namespace}/#{vhost}/topic-permissions")
132132

133133
@doc """
134-
Get an individual virtual host by name.
134+
Get an individual virtual host by vhost.
135135
136136
### Params
137137
138138
* `client` - Tesla client used to perform the request.
139139
"""
140-
@spec get_vhost(client :: Telsa.Client.t(), name :: String.t()) ::
140+
@spec get_vhost(client :: Telsa.Client.t(), vhost :: String.t()) ::
141141
{:ok, Tesla.Env.t()} | {:error, term()}
142-
def get_vhost(client, name) when is_binary(name),
143-
do: client |> Tesla.get("#{@api_namespace}/#{name}")
142+
def get_vhost(client, vhost) when is_binary(vhost),
143+
do: client |> Tesla.get("#{@api_namespace}/#{vhost}")
144144

145145
@doc """
146-
Create a new virtual host with given name.
146+
Create a new virtual host with given vhost.
147147
148148
### Params
149149
150150
* `client` - Tesla client used to perform the request.
151-
* `name` - type: `string`, required: `true`
151+
* `vhost` - type: `string`, required: `true`
152152
#{NimbleOptions.docs(put_vhost_definition())}
153153
"""
154-
@spec put_vhost(client :: Telsa.Client.t(), name :: String.t(), opts :: Keyword.t()) ::
154+
@spec put_vhost(client :: Telsa.Client.t(), vhost :: String.t(), opts :: Keyword.t()) ::
155155
{:ok, Tesla.Env.t()} | no_return()
156-
def put_vhost(client, name, opts \\ []) do
156+
def put_vhost(client, vhost, opts \\ []) do
157157
case NimbleOptions.validate(opts, put_vhost_definition()) do
158158
{:error, error} ->
159159
raise ArgumentError, format_error(error)
160160

161161
{:ok, opts} ->
162162
client
163-
|> Tesla.put("#{@api_namespace}/#{name}", Enum.into(opts, %{}))
163+
|> Tesla.put("#{@api_namespace}/#{vhost}", Enum.into(opts, %{}))
164164
end
165165
end
166166

167167
@doc """
168-
Delete a specific virtual host by name.
168+
Delete a specific virtual host by vhost.
169169
170170
### Params
171171
172172
* `client` - Tesla client used to perform the request.
173-
* `name` - type: `string`, The name of the virtual host that should be deleted.
173+
* `vhost` - type: `string`, The vhost of the virtual host that should be deleted.
174174
"""
175-
@spec delete_vhost(client :: Tesla.Client.t(), name :: String.t()) ::
175+
@spec delete_vhost(client :: Tesla.Client.t(), vhost :: String.t()) ::
176176
{:ok, Tesla.Env.t()} | {:error, term()}
177-
def delete_vhost(client, name), do: client |> Tesla.delete("#{@api_namespace}/#{name}")
177+
def delete_vhost(client, vhost), do: client |> Tesla.delete("#{@api_namespace}/#{vhost}")
178178

179179
@doc """
180180
Start a specific virtual host on given node.
181181
182182
### Params
183183
184184
* `client` - Tesla client used to perform the request.
185-
* `name` - type: `string`, The name of the virtual host that should be started.
186-
* `node` - type: `string`, The name of the node that the virtual host should be started on.
185+
* `vhost` - type: `string`, The vhost of the virtual host that should be started.
186+
* `node` - type: `string`, The vhost of the node that the virtual host should be started on.
187187
"""
188-
@spec start_vhost(client :: Tesla.Client.t(), name :: String.t(), node :: String.t()) ::
188+
@spec start_vhost(client :: Tesla.Client.t(), vhost :: String.t(), node :: String.t()) ::
189189
{:ok, Tesla.Env.t()} | {:error, term()}
190-
def start_vhost(client, name, node),
191-
do: client |> Tesla.post("#{@api_namespace}/#{name}/start/#{node}", %{})
190+
def start_vhost(client, vhost, node),
191+
do: client |> Tesla.post("#{@api_namespace}/#{vhost}/start/#{node}", %{})
192192
end

0 commit comments

Comments
 (0)