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

com.dominodatalab.api.model.DominoDatasourceModelDatasourceConfig Maven / Gradle / Ivy

/*
 * Domino Data Lab API v4
 * This API is going to provide access to all the Domino functions available in the user interface. To authenticate your requests, include your API Key (which you can find on your account page) with the header X-Domino-Api-Key. 
 *
 * The version of the OpenAPI document: 4.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.dominodatalab.api.model;

import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.dominodatalab.api.model.DominoDatasourceModelAuthType;
import com.dominodatalab.api.model.DominoDatasourceModelDatasourceType;
import com.dominodatalab.api.model.DominoDatasourceModelEngineType;
import com.dominodatalab.api.model.DominoDatasourceModelField;
import com.dominodatalab.api.model.DominoDatasourceModelStorageType;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;


/**
 * DominoDatasourceModelDatasourceConfig
 */
@JsonPropertyOrder({
  DominoDatasourceModelDatasourceConfig.JSON_PROPERTY_AUTH_TYPES,
  DominoDatasourceModelDatasourceConfig.JSON_PROPERTY_ENGINE_TYPE,
  DominoDatasourceModelDatasourceConfig.JSON_PROPERTY_FIELDS,
  DominoDatasourceModelDatasourceConfig.JSON_PROPERTY_STORAGE_TYPE,
  DominoDatasourceModelDatasourceConfig.JSON_PROPERTY_DATASOURCE_TYPE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-17T15:20:46.682098100-04:00[America/New_York]")
public class DominoDatasourceModelDatasourceConfig {
  public static final String JSON_PROPERTY_AUTH_TYPES = "authTypes";
  private List authTypes = new ArrayList<>();

  public static final String JSON_PROPERTY_ENGINE_TYPE = "engineType";
  private DominoDatasourceModelEngineType engineType;

  public static final String JSON_PROPERTY_FIELDS = "fields";
  private Map fields = new HashMap<>();

  public static final String JSON_PROPERTY_STORAGE_TYPE = "storageType";
  private DominoDatasourceModelStorageType storageType;

  public static final String JSON_PROPERTY_DATASOURCE_TYPE = "datasourceType";
  private DominoDatasourceModelDatasourceType datasourceType;

  public DominoDatasourceModelDatasourceConfig() { 
  }

  public DominoDatasourceModelDatasourceConfig authTypes(List authTypes) {
    this.authTypes = authTypes;
    return this;
  }

  public DominoDatasourceModelDatasourceConfig addAuthTypesItem(DominoDatasourceModelAuthType authTypesItem) {
    if (this.authTypes == null) {
      this.authTypes = new ArrayList<>();
    }
    this.authTypes.add(authTypesItem);
    return this;
  }

   /**
   * Get authTypes
   * @return authTypes
  **/
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_AUTH_TYPES)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public List getAuthTypes() {
    return authTypes;
  }


  @JsonProperty(JSON_PROPERTY_AUTH_TYPES)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setAuthTypes(List authTypes) {
    this.authTypes = authTypes;
  }


  public DominoDatasourceModelDatasourceConfig engineType(DominoDatasourceModelEngineType engineType) {
    this.engineType = engineType;
    return this;
  }

   /**
   * Get engineType
   * @return engineType
  **/
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_ENGINE_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public DominoDatasourceModelEngineType getEngineType() {
    return engineType;
  }


  @JsonProperty(JSON_PROPERTY_ENGINE_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setEngineType(DominoDatasourceModelEngineType engineType) {
    this.engineType = engineType;
  }


  public DominoDatasourceModelDatasourceConfig fields(Map fields) {
    this.fields = fields;
    return this;
  }

  public DominoDatasourceModelDatasourceConfig putFieldsItem(String key, DominoDatasourceModelField fieldsItem) {
    if (this.fields == null) {
      this.fields = new HashMap<>();
    }
    this.fields.put(key, fieldsItem);
    return this;
  }

   /**
   * Get fields
   * @return fields
  **/
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_FIELDS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public Map getFields() {
    return fields;
  }


  @JsonProperty(JSON_PROPERTY_FIELDS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setFields(Map fields) {
    this.fields = fields;
  }


  public DominoDatasourceModelDatasourceConfig storageType(DominoDatasourceModelStorageType storageType) {
    this.storageType = storageType;
    return this;
  }

   /**
   * Get storageType
   * @return storageType
  **/
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_STORAGE_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public DominoDatasourceModelStorageType getStorageType() {
    return storageType;
  }


  @JsonProperty(JSON_PROPERTY_STORAGE_TYPE)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setStorageType(DominoDatasourceModelStorageType storageType) {
    this.storageType = storageType;
  }


  public DominoDatasourceModelDatasourceConfig datasourceType(DominoDatasourceModelDatasourceType datasourceType) {
    this.datasourceType = datasourceType;
    return this;
  }

   /**
   * Get datasourceType
   * @return datasourceType
  **/
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_DATASOURCE_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public DominoDatasourceModelDatasourceType getDatasourceType() {
    return datasourceType;
  }


  @JsonProperty(JSON_PROPERTY_DATASOURCE_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setDatasourceType(DominoDatasourceModelDatasourceType datasourceType) {
    this.datasourceType = datasourceType;
  }


  /**
   * Return true if this domino.datasource.model.DatasourceConfig object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    DominoDatasourceModelDatasourceConfig dominoDatasourceModelDatasourceConfig = (DominoDatasourceModelDatasourceConfig) o;
    return Objects.equals(this.authTypes, dominoDatasourceModelDatasourceConfig.authTypes) &&
        Objects.equals(this.engineType, dominoDatasourceModelDatasourceConfig.engineType) &&
        Objects.equals(this.fields, dominoDatasourceModelDatasourceConfig.fields) &&
        Objects.equals(this.storageType, dominoDatasourceModelDatasourceConfig.storageType) &&
        Objects.equals(this.datasourceType, dominoDatasourceModelDatasourceConfig.datasourceType);
  }

  @Override
  public int hashCode() {
    return Objects.hash(authTypes, engineType, fields, storageType, datasourceType);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class DominoDatasourceModelDatasourceConfig {\n");
    sb.append("    authTypes: ").append(toIndentedString(authTypes)).append("\n");
    sb.append("    engineType: ").append(toIndentedString(engineType)).append("\n");
    sb.append("    fields: ").append(toIndentedString(fields)).append("\n");
    sb.append("    storageType: ").append(toIndentedString(storageType)).append("\n");
    sb.append("    datasourceType: ").append(toIndentedString(datasourceType)).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(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

  /**
   * Convert the instance into URL query string.
   *
   * @return URL query string
   */
  public String toUrlQueryString() {
    return toUrlQueryString(null);
  }

  /**
   * Convert the instance into URL query string.
   *
   * @param prefix prefix of the query string
   * @return URL query string
   */
  public String toUrlQueryString(String prefix) {
    String suffix = "";
    String containerSuffix = "";
    String containerPrefix = "";
    if (prefix == null) {
      // style=form, explode=true, e.g. /pet?name=cat&type=manx
      prefix = "";
    } else {
      // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
      prefix = prefix + "[";
      suffix = "]";
      containerSuffix = "]";
      containerPrefix = "[";
    }

    StringJoiner joiner = new StringJoiner("&");

    // add `authTypes` to the URL query string
    if (getAuthTypes() != null) {
      for (int i = 0; i < getAuthTypes().size(); i++) {
        if (getAuthTypes().get(i) != null) {
          joiner.add(String.format("%sauthTypes%s%s=%s", prefix, suffix,
              "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
              URLEncoder.encode(String.valueOf(getAuthTypes().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
        }
      }
    }

    // add `engineType` to the URL query string
    if (getEngineType() != null) {
      joiner.add(String.format("%sengineType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getEngineType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `fields` to the URL query string
    if (getFields() != null) {
      for (String _key : getFields().keySet()) {
        if (getFields().get(_key) != null) {
          joiner.add(getFields().get(_key).toUrlQueryString(String.format("%sfields%s%s", prefix, suffix,
              "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix))));
        }
      }
    }

    // add `storageType` to the URL query string
    if (getStorageType() != null) {
      joiner.add(String.format("%sstorageType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getStorageType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `datasourceType` to the URL query string
    if (getDatasourceType() != null) {
      joiner.add(String.format("%sdatasourceType%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDatasourceType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    return joiner.toString();
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy