
com.influxdb.client.domain.Permission Maven / Gradle / Ivy
/*
* InfluxDB OSS API Service
* The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint.
*
* OpenAPI spec version: 2.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.influxdb.client.domain;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.influxdb.client.domain.PermissionResource;
import java.io.IOException;
/**
* Permission
*/
public class Permission {
/**
* Gets or Sets action
*/
@JsonAdapter(ActionEnum.Adapter.class)
public enum ActionEnum {
READ("read"),
WRITE("write");
private String value;
ActionEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static ActionEnum fromValue(String text) {
for (ActionEnum b : ActionEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter {
@Override
public void write(final JsonWriter jsonWriter, final ActionEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public ActionEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return ActionEnum.fromValue(String.valueOf(value));
}
}
}
public static final String SERIALIZED_NAME_ACTION = "action";
@SerializedName(SERIALIZED_NAME_ACTION)
private ActionEnum action;
public static final String SERIALIZED_NAME_RESOURCE = "resource";
@SerializedName(SERIALIZED_NAME_RESOURCE)
private PermissionResource resource = null;
public Permission action(ActionEnum action) {
this.action = action;
return this;
}
/**
* Get action
* @return action
**/
public ActionEnum getAction() {
return action;
}
public void setAction(ActionEnum action) {
this.action = action;
}
public Permission resource(PermissionResource resource) {
this.resource = resource;
return this;
}
/**
* Get resource
* @return resource
**/
public PermissionResource getResource() {
return resource;
}
public void setResource(PermissionResource resource) {
this.resource = resource;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Permission permission = (Permission) o;
return Objects.equals(this.action, permission.action) &&
Objects.equals(this.resource, permission.resource);
}
@Override
public int hashCode() {
return Objects.hash(action, resource);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Permission {\n");
sb.append(" action: ").append(toIndentedString(action)).append("\n");
sb.append(" resource: ").append(toIndentedString(resource)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy