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

org.openmetadata.service.secrets.converter.LookerConnectionClassConverter 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.BitBucketCredentials;
import org.openmetadata.schema.security.credentials.GitHubCredentials;
import org.openmetadata.schema.services.connections.dashboard.LookerConnection;
import org.openmetadata.service.util.JsonUtils;

public class LookerConnectionClassConverter extends ClassConverter {

  private static final List> CREDENTIALS_CLASSES =
      List.of(GitHubCredentials.class, BitBucketCredentials.class);

  public LookerConnectionClassConverter() {
    super(LookerConnection.class);
  }

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

    tryToConvertOrFail(lookerConnection.getGitCredentials(), CREDENTIALS_CLASSES)
        .ifPresent(lookerConnection::setGitCredentials);

    return lookerConnection;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy