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

org.openmetadata.service.secrets.converter.TableauConnectionClassConverter Maven / Gradle / Ivy

There is a newer version: 1.5.11
Show newest version
package org.openmetadata.service.secrets.converter;

import java.util.List;
import org.openmetadata.schema.security.credentials.AccessTokenAuth;
import org.openmetadata.schema.security.credentials.BasicAuth;
import org.openmetadata.schema.services.connections.dashboard.TableauConnection;
import org.openmetadata.service.util.JsonUtils;

public class TableauConnectionClassConverter extends ClassConverter {
  private static final List> CONNECTION_CLASSES =
      List.of(BasicAuth.class, AccessTokenAuth.class);

  public TableauConnectionClassConverter() {
    super(TableauConnection.class);
  }

  @Override
  public Object convert(Object object) {
    TableauConnection tableauConnection =
        (TableauConnection) JsonUtils.convertValue(object, this.clazz);

    tryToConvertOrFail(tableauConnection.getAuthType(), CONNECTION_CLASSES)
        .ifPresent(tableauConnection::setAuthType);

    return tableauConnection;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy