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

org.openmetadata.service.secrets.converter.StorageConfigClassConverter 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.services.connections.database.datalake.S3Config;
import org.openmetadata.schema.services.connections.database.deltalake.StorageConfig;
import org.openmetadata.service.util.JsonUtils;

/** Converter class to get an `StorageConfig` object for DeltaLakeConnection. */
public class StorageConfigClassConverter extends ClassConverter {
  private static final List> CONNECTION_CLASSES = List.of(S3Config.class);

  public StorageConfigClassConverter() {
    super(StorageConfig.class);
  }

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

    tryToConvertOrFail(storageConfig.getConnection(), CONNECTION_CLASSES)
        .ifPresent(storageConfig::setConnection);

    return storageConfig;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy