Package org.apache.flink.fs.gs.utils
Class ConfigUtils
java.lang.Object
org.apache.flink.fs.gs.utils.ConfigUtils
Utilities class for configuration of Hadoop and Google Storage.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface that provides context-specific config helper functions, factored out to support unit testing -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetGcsRootUrl(org.apache.hadoop.conf.Configuration hadoopConfig) static org.apache.hadoop.conf.ConfigurationgetHadoopConfiguration(org.apache.flink.configuration.Configuration flinkConfig, ConfigUtils.ConfigContext configContext) Loads the Hadoop configuration, by loading from a Hadoop conf dir (if one exists) and then overlaying properties derived from the Flink config.static Optional<com.google.auth.oauth2.GoogleCredentials>getStorageCredentials(org.apache.hadoop.conf.Configuration hadoopConfig, ConfigUtils.ConfigContext configContext) Creates an (optional) GoogleCredentials instance for the given Hadoop config and environment.static StringstringifyHadoopConfig(org.apache.hadoop.conf.Configuration hadoopConfig) Helper to serialize a Hadoop config to a string, for logging.
-
Constructor Details
-
ConfigUtils
public ConfigUtils()
-
-
Method Details
-
getHadoopConfiguration
public static org.apache.hadoop.conf.Configuration getHadoopConfiguration(org.apache.flink.configuration.Configuration flinkConfig, ConfigUtils.ConfigContext configContext) Loads the Hadoop configuration, by loading from a Hadoop conf dir (if one exists) and then overlaying properties derived from the Flink config.- Parameters:
flinkConfig- The Flink configconfigContext- The config context.- Returns:
- The Hadoop config.
-
getStorageCredentials
public static Optional<com.google.auth.oauth2.GoogleCredentials> getStorageCredentials(org.apache.hadoop.conf.Configuration hadoopConfig, ConfigUtils.ConfigContext configContext) Creates an (optional) GoogleCredentials instance for the given Hadoop config and environment.- Parameters:
hadoopConfig- The Hadoop config.configContext- The config context.- Returns:
- The optional GoogleCredentials instance.
-
getGcsRootUrl
-
stringifyHadoopConfig
public static String stringifyHadoopConfig(org.apache.hadoop.conf.Configuration hadoopConfig) throws RuntimeException Helper to serialize a Hadoop config to a string, for logging.- Parameters:
hadoopConfig- The Hadoop config.- Returns:
- A string with the Hadoop properties.
- Throws:
RuntimeException- On underlying IO failure
-