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

com.dominodatalab.pub.model.NewDataSourceV1 Maven / Gradle / Ivy

/*
 * Domino Public API
 * Domino Public API Endpoints
 *
 * The version of the OpenAPI document: 0.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.pub.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.pub.model.DataSourceCredentialTypeV1;
import com.dominodatalab.pub.model.DataSourceCredentialsV1;
import com.dominodatalab.pub.model.DataSourcePermissionsV1;
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.Arrays;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;


import com.dominodatalab.pub.invoker.ApiClient;
/**
 * NewDataSourceV1
 */
@JsonPropertyOrder({
  NewDataSourceV1.JSON_PROPERTY_AUTH_TYPE,
  NewDataSourceV1.JSON_PROPERTY_CONFIG,
  NewDataSourceV1.JSON_PROPERTY_CREDENTIAL_TYPE,
  NewDataSourceV1.JSON_PROPERTY_CREDENTIALS,
  NewDataSourceV1.JSON_PROPERTY_DATA_SOURCE_TYPE,
  NewDataSourceV1.JSON_PROPERTY_DESCRIPTION,
  NewDataSourceV1.JSON_PROPERTY_NAME,
  NewDataSourceV1.JSON_PROPERTY_PERMISSIONS
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-04T16:37:28.765500600-04:00[America/New_York]", comments = "Generator version: 7.8.0")
public class NewDataSourceV1 {
  public static final String JSON_PROPERTY_AUTH_TYPE = "authType";
  private String authType;

  public static final String JSON_PROPERTY_CONFIG = "config";
  private Map config = new HashMap<>();

  public static final String JSON_PROPERTY_CREDENTIAL_TYPE = "credentialType";
  private DataSourceCredentialTypeV1 credentialType;

  public static final String JSON_PROPERTY_CREDENTIALS = "credentials";
  private DataSourceCredentialsV1 credentials;

  public static final String JSON_PROPERTY_DATA_SOURCE_TYPE = "dataSourceType";
  private String dataSourceType;

  public static final String JSON_PROPERTY_DESCRIPTION = "description";
  private String description;

  public static final String JSON_PROPERTY_NAME = "name";
  private String name;

  public static final String JSON_PROPERTY_PERMISSIONS = "permissions";
  private DataSourcePermissionsV1 permissions;

  public NewDataSourceV1() { 
  }

  public NewDataSourceV1 authType(String authType) {
    this.authType = authType;
    return this;
  }

  /**
   * The type of Data Source authentication
   * @return authType
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_AUTH_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public String getAuthType() {
    return authType;
  }


  @JsonProperty(JSON_PROPERTY_AUTH_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setAuthType(String authType) {
    this.authType = authType;
  }


  public NewDataSourceV1 config(Map config) {
    this.config = config;
    return this;
  }

  public NewDataSourceV1 putConfigItem(String key, String configItem) {
    if (this.config == null) {
      this.config = new HashMap<>();
    }
    this.config.put(key, configItem);
    return this;
  }

  /**
   * A map of configuration name -> value
   * @return config
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_CONFIG)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public Map getConfig() {
    return config;
  }


  @JsonProperty(JSON_PROPERTY_CONFIG)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setConfig(Map config) {
    this.config = config;
  }


  public NewDataSourceV1 credentialType(DataSourceCredentialTypeV1 credentialType) {
    this.credentialType = credentialType;
    return this;
  }

  /**
   * Get credentialType
   * @return credentialType
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_CREDENTIAL_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public DataSourceCredentialTypeV1 getCredentialType() {
    return credentialType;
  }


  @JsonProperty(JSON_PROPERTY_CREDENTIAL_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setCredentialType(DataSourceCredentialTypeV1 credentialType) {
    this.credentialType = credentialType;
  }


  public NewDataSourceV1 credentials(DataSourceCredentialsV1 credentials) {
    this.credentials = credentials;
    return this;
  }

  /**
   * Get credentials
   * @return credentials
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_CREDENTIALS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public DataSourceCredentialsV1 getCredentials() {
    return credentials;
  }


  @JsonProperty(JSON_PROPERTY_CREDENTIALS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setCredentials(DataSourceCredentialsV1 credentials) {
    this.credentials = credentials;
  }


  public NewDataSourceV1 dataSourceType(String dataSourceType) {
    this.dataSourceType = dataSourceType;
    return this;
  }

  /**
   * The configuration type of the Data Source
   * @return dataSourceType
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_DATA_SOURCE_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public String getDataSourceType() {
    return dataSourceType;
  }


  @JsonProperty(JSON_PROPERTY_DATA_SOURCE_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setDataSourceType(String dataSourceType) {
    this.dataSourceType = dataSourceType;
  }


  public NewDataSourceV1 description(String description) {
    this.description = description;
    return this;
  }

  /**
   * Description of the Data Source
   * @return description
   */
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_DESCRIPTION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public String getDescription() {
    return description;
  }


  @JsonProperty(JSON_PROPERTY_DESCRIPTION)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setDescription(String description) {
    this.description = description;
  }


  public NewDataSourceV1 name(String name) {
    this.name = name;
    return this;
  }

  /**
   * User given name of the Data Source
   * @return name
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public String getName() {
    return name;
  }


  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setName(String name) {
    this.name = name;
  }


  public NewDataSourceV1 permissions(DataSourcePermissionsV1 permissions) {
    this.permissions = permissions;
    return this;
  }

  /**
   * Get permissions
   * @return permissions
   */
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_PERMISSIONS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public DataSourcePermissionsV1 getPermissions() {
    return permissions;
  }


  @JsonProperty(JSON_PROPERTY_PERMISSIONS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setPermissions(DataSourcePermissionsV1 permissions) {
    this.permissions = permissions;
  }


  /**
   * Return true if this NewDataSourceV1 object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    NewDataSourceV1 newDataSourceV1 = (NewDataSourceV1) o;
    return Objects.equals(this.authType, newDataSourceV1.authType) &&
        Objects.equals(this.config, newDataSourceV1.config) &&
        Objects.equals(this.credentialType, newDataSourceV1.credentialType) &&
        Objects.equals(this.credentials, newDataSourceV1.credentials) &&
        Objects.equals(this.dataSourceType, newDataSourceV1.dataSourceType) &&
        Objects.equals(this.description, newDataSourceV1.description) &&
        Objects.equals(this.name, newDataSourceV1.name) &&
        Objects.equals(this.permissions, newDataSourceV1.permissions);
  }

  @Override
  public int hashCode() {
    return Objects.hash(authType, config, credentialType, credentials, dataSourceType, description, name, permissions);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class NewDataSourceV1 {\n");
    sb.append("    authType: ").append(toIndentedString(authType)).append("\n");
    sb.append("    config: ").append(toIndentedString(config)).append("\n");
    sb.append("    credentialType: ").append(toIndentedString(credentialType)).append("\n");
    sb.append("    credentials: ").append(toIndentedString(credentials)).append("\n");
    sb.append("    dataSourceType: ").append(toIndentedString(dataSourceType)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    permissions: ").append(toIndentedString(permissions)).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 `authType` to the URL query string
    if (getAuthType() != null) {
      joiner.add(String.format("%sauthType%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getAuthType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `config` to the URL query string
    if (getConfig() != null) {
      for (String _key : getConfig().keySet()) {
        joiner.add(String.format("%sconfig%s%s=%s", prefix, suffix,
            "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix),
            getConfig().get(_key), URLEncoder.encode(ApiClient.valueToString(getConfig().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
      }
    }

    // add `credentialType` to the URL query string
    if (getCredentialType() != null) {
      joiner.add(String.format("%scredentialType%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getCredentialType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `credentials` to the URL query string
    if (getCredentials() != null) {
      joiner.add(getCredentials().toUrlQueryString(prefix + "credentials" + suffix));
    }

    // add `dataSourceType` to the URL query string
    if (getDataSourceType() != null) {
      joiner.add(String.format("%sdataSourceType%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getDataSourceType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `description` to the URL query string
    if (getDescription() != null) {
      joiner.add(String.format("%sdescription%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getDescription()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `name` to the URL query string
    if (getName() != null) {
      joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `permissions` to the URL query string
    if (getPermissions() != null) {
      joiner.add(getPermissions().toUrlQueryString(prefix + "permissions" + suffix));
    }

    return joiner.toString();
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy