
io.github.fallwizard.rabbitmq.mgmt.VirtualHostOperations Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rabbitmq-mgmt Show documentation
Show all versions of rabbitmq-mgmt Show documentation
Manage your RabbitMQ services programmatically
The newest version!
package io.github.fallwizard.rabbitmq.mgmt;
import com.google.common.base.Optional;
import com.sun.jersey.api.client.GenericType;
import io.github.fallwizard.rabbitmq.mgmt.model.Permission;
import io.github.fallwizard.rabbitmq.mgmt.model.Status;
import io.github.fallwizard.rabbitmq.mgmt.model.VirtualHost;
import java.util.Collection;
public class VirtualHostOperations extends BaseFluent {
public VirtualHostOperations(HttpContext httpContext, RabbitMgmtService mgmtService) {
super(httpContext, mgmtService);
}
public Collection all(){
return HTTP.GET("/vhosts", VHOST_COLLECTION).get();
}
public Optional get(String vhost){
return HTTP.GET(String.format("/vhosts/%s", encodeSlashes(vhost)), VHOST);
}
public VirtualHostOperations delete(String vhost){
HTTP.DELETE(String.format("/vhosts/%s", encodeSlashes(vhost)));
return this;
}
public VirtualHostOperations create(VirtualHost vhost){
String url = String.format("/vhosts/%s", encodeSlashes(vhost.getName()));
HTTP.PUT(url, vhost);
return this;
}
public Status status(){
return this.status("/").get();
}
public Optional status(String vhost){
return HTTP.GET(
String.format("/aliveness-test/%s", encodeSlashes(vhost)), new GenericType(){});
}
public Collection permissions(){
return permissions("/").get();
}
public Optional> permissions(String vhost){
return HTTP.GET(String.format("/vhosts/%s/permissions", encodeSlashes(vhost)), PERMISSION_COLLECTION);
}
public Optional permissionsForUser(String user){
return permissionsForUser("/", user);
}
public Optional permissionsForUser(String vhost, String user){
return HTTP.GET(String.format("/permissions/%s/%s", encodeSlashes(vhost), user), PERMISSION);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy