All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.indeed.rabbitmq.admin.pojo.Permission Maven / Gradle / Ivy


package com.indeed.rabbitmq.admin.pojo;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;


/**
 * Authorization rules for an authenticated user.
 * 
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
    "user",
    "vhost",
    "configure",
    "read",
    "write"
})
public class Permission {

    /**
     * The username.
     * 
     */
    @JsonProperty("user")
    @JsonPropertyDescription("The username.")
    private String user;
    /**
     * The virtual host to which these permissions apply.
     * 
     */
    @JsonProperty("vhost")
    @JsonPropertyDescription("The virtual host to which these permissions apply.")
    private String vhost;
    /**
     * A regular expression that matches RabbitMQ entities that the user can configure.
     * 
     */
    @JsonProperty("configure")
    @JsonPropertyDescription("A regular expression that matches RabbitMQ entities that the user can configure.")
    private Pattern configure;
    /**
     * A regular expression that matches RabbitMQ entities that the user can read from.
     * 
     */
    @JsonProperty("read")
    @JsonPropertyDescription("A regular expression that matches RabbitMQ entities that the user can read from.")
    private Pattern read;
    /**
     * A regular expression that matches RabbitMQ entities that the user can write to.
     * 
     */
    @JsonProperty("write")
    @JsonPropertyDescription("A regular expression that matches RabbitMQ entities that the user can write to.")
    private Pattern write;
    @JsonIgnore
    private Map additionalProperties = new HashMap();

    /**
     * The username.
     * 
     */
    @JsonProperty("user")
    public String getUser() {
        return user;
    }

    /**
     * The username.
     * 
     */
    @JsonProperty("user")
    public void setUser(String user) {
        this.user = user;
    }

    public Permission withUser(String user) {
        this.user = user;
        return this;
    }

    /**
     * The virtual host to which these permissions apply.
     * 
     */
    @JsonProperty("vhost")
    public String getVhost() {
        return vhost;
    }

    /**
     * The virtual host to which these permissions apply.
     * 
     */
    @JsonProperty("vhost")
    public void setVhost(String vhost) {
        this.vhost = vhost;
    }

    public Permission withVhost(String vhost) {
        this.vhost = vhost;
        return this;
    }

    /**
     * A regular expression that matches RabbitMQ entities that the user can configure.
     * 
     */
    @JsonProperty("configure")
    public Pattern getConfigure() {
        return configure;
    }

    /**
     * A regular expression that matches RabbitMQ entities that the user can configure.
     * 
     */
    @JsonProperty("configure")
    public void setConfigure(Pattern configure) {
        this.configure = configure;
    }

    public Permission withConfigure(Pattern configure) {
        this.configure = configure;
        return this;
    }

    /**
     * A regular expression that matches RabbitMQ entities that the user can read from.
     * 
     */
    @JsonProperty("read")
    public Pattern getRead() {
        return read;
    }

    /**
     * A regular expression that matches RabbitMQ entities that the user can read from.
     * 
     */
    @JsonProperty("read")
    public void setRead(Pattern read) {
        this.read = read;
    }

    public Permission withRead(Pattern read) {
        this.read = read;
        return this;
    }

    /**
     * A regular expression that matches RabbitMQ entities that the user can write to.
     * 
     */
    @JsonProperty("write")
    public Pattern getWrite() {
        return write;
    }

    /**
     * A regular expression that matches RabbitMQ entities that the user can write to.
     * 
     */
    @JsonProperty("write")
    public void setWrite(Pattern write) {
        this.write = write;
    }

    public Permission withWrite(Pattern write) {
        this.write = write;
        return this;
    }

    @JsonAnyGetter
    public Map getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

    public Permission withAdditionalProperty(String name, Object value) {
        this.additionalProperties.put(name, value);
        return this;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(Permission.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
        sb.append("user");
        sb.append('=');
        sb.append(((this.user == null)?"":this.user));
        sb.append(',');
        sb.append("vhost");
        sb.append('=');
        sb.append(((this.vhost == null)?"":this.vhost));
        sb.append(',');
        sb.append("configure");
        sb.append('=');
        sb.append(((this.configure == null)?"":this.configure));
        sb.append(',');
        sb.append("read");
        sb.append('=');
        sb.append(((this.read == null)?"":this.read));
        sb.append(',');
        sb.append("write");
        sb.append('=');
        sb.append(((this.write == null)?"":this.write));
        sb.append(',');
        sb.append("additionalProperties");
        sb.append('=');
        sb.append(((this.additionalProperties == null)?"":this.additionalProperties));
        sb.append(',');
        if (sb.charAt((sb.length()- 1)) == ',') {
            sb.setCharAt((sb.length()- 1), ']');
        } else {
            sb.append(']');
        }
        return sb.toString();
    }

    @Override
    public int hashCode() {
        int result = 1;
        result = ((result* 31)+((this.vhost == null)? 0 :this.vhost.hashCode()));
        result = ((result* 31)+((this.read == null)? 0 :this.read.hashCode()));
        result = ((result* 31)+((this.configure == null)? 0 :this.configure.hashCode()));
        result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
        result = ((result* 31)+((this.user == null)? 0 :this.user.hashCode()));
        result = ((result* 31)+((this.write == null)? 0 :this.write.hashCode()));
        return result;
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if ((other instanceof Permission) == false) {
            return false;
        }
        Permission rhs = ((Permission) other);
        return (((((((this.vhost == rhs.vhost)||((this.vhost!= null)&&this.vhost.equals(rhs.vhost)))&&((this.read == rhs.read)||((this.read!= null)&&this.read.equals(rhs.read))))&&((this.configure == rhs.configure)||((this.configure!= null)&&this.configure.equals(rhs.configure))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.user == rhs.user)||((this.user!= null)&&this.user.equals(rhs.user))))&&((this.write == rhs.write)||((this.write!= null)&&this.write.equals(rhs.write))));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy