Class AWSGeneralUtil
- java.lang.Object
-
- org.apache.flink.connector.aws.util.AWSGeneralUtil
-
- Direct Known Subclasses:
AWSClientUtil
@Internal public class AWSGeneralUtil extends Object
Some general utilities specific to Amazon Web Service.
-
-
Constructor Summary
Constructors Constructor Description AWSGeneralUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseResources(software.amazon.awssdk.utils.SdkAutoCloseable... resources)static software.amazon.awssdk.http.async.SdkAsyncHttpClientcreateAsyncHttpClient(Properties configProperties)static software.amazon.awssdk.http.async.SdkAsyncHttpClientcreateAsyncHttpClient(Properties configProperties, software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient.Builder httpClientBuilder)static software.amazon.awssdk.http.async.SdkAsyncHttpClientcreateAsyncHttpClient(software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient.Builder httpClientBuilder)static software.amazon.awssdk.http.async.SdkAsyncHttpClientcreateAsyncHttpClient(software.amazon.awssdk.utils.AttributeMap config, software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient.Builder httpClientBuilder)static software.amazon.awssdk.http.SdkHttpClientcreateSyncHttpClient(software.amazon.awssdk.utils.AttributeMap config, software.amazon.awssdk.http.apache.ApacheHttpClient.Builder httpClientBuilder)static AWSConfigConstants.CredentialProvidergetCredentialProviderType(Properties configProps, String configPrefix)Determines and returns the credential provider type from the given properties.static software.amazon.awssdk.auth.credentials.AwsCredentialsProvidergetCredentialsProvider(Map<String,?> configProps)Return aAwsCredentialsProviderinstance corresponding to the configuration properties.static software.amazon.awssdk.auth.credentials.AwsCredentialsProvidergetCredentialsProvider(Properties configProps)Return aAwsCredentialsProviderinstance corresponding to the configuration properties.static software.amazon.awssdk.auth.credentials.AwsCredentialsProvidergetCredentialsProvider(Properties configProps, String configPrefix)static software.amazon.awssdk.auth.credentials.AwsCredentialsProvidergetCustomCredentialProvider(Properties conf, String confKey)Tries to instantiate the user's custom AWS credential provider class.static software.amazon.awssdk.auth.credentials.AwsCredentialsProvidergetProfileCredentialProvider(Properties configProps, String configPrefix)static software.amazon.awssdk.regions.RegiongetRegion(Properties configProps)Creates aRegionobject from the given Properties.static URIgetStsEndpoint(Properties configProps)Creates STS endpoint URI object from the given Properties.static booleanisValidRegion(software.amazon.awssdk.regions.Region region)Checks whether or not a region is valid.static voidvalidateAwsConfiguration(Properties config)Validates configuration properties related to Amazon AWS service.static voidvalidateAwsCredentials(Properties config)
-
-
-
Method Detail
-
getCredentialProviderType
public static AWSConfigConstants.CredentialProvider getCredentialProviderType(Properties configProps, String configPrefix)
Determines and returns the credential provider type from the given properties.- Returns:
- the credential provider type
-
getCredentialsProvider
public static software.amazon.awssdk.auth.credentials.AwsCredentialsProvider getCredentialsProvider(Map<String,?> configProps)
Return aAwsCredentialsProviderinstance corresponding to the configuration properties.- Parameters:
configProps- the configuration property map- Returns:
- The corresponding AWS Credentials Provider instance
-
getCredentialsProvider
public static software.amazon.awssdk.auth.credentials.AwsCredentialsProvider getCredentialsProvider(Properties configProps)
Return aAwsCredentialsProviderinstance corresponding to the configuration properties.- Parameters:
configProps- the configuration properties- Returns:
- The corresponding AWS Credentials Provider instance
-
getCredentialsProvider
public static software.amazon.awssdk.auth.credentials.AwsCredentialsProvider getCredentialsProvider(Properties configProps, String configPrefix)
-
getCustomCredentialProvider
public static software.amazon.awssdk.auth.credentials.AwsCredentialsProvider getCustomCredentialProvider(Properties conf, String confKey)
Tries to instantiate the user's custom AWS credential provider class.- Parameters:
conf- Properties object that contains all the provided config and that we pass down to the custom credential provider implementation's constructorconfKey- Config key we use to retrieve the credential provider class name specified by the user- Returns:
- an AwsCredentialsProvider object
- Throws:
ClassCastException- if the specified class does not implement AwsCredentialsProviderRuntimeException- if the specified class does not exist or does not have a constructor with signature `MyCustomCredentialsClass(Properties props)`.
-
getProfileCredentialProvider
public static software.amazon.awssdk.auth.credentials.AwsCredentialsProvider getProfileCredentialProvider(Properties configProps, String configPrefix)
-
createAsyncHttpClient
public static software.amazon.awssdk.http.async.SdkAsyncHttpClient createAsyncHttpClient(Properties configProperties)
-
createAsyncHttpClient
public static software.amazon.awssdk.http.async.SdkAsyncHttpClient createAsyncHttpClient(Properties configProperties, software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient.Builder httpClientBuilder)
-
createAsyncHttpClient
public static software.amazon.awssdk.http.async.SdkAsyncHttpClient createAsyncHttpClient(software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient.Builder httpClientBuilder)
-
createAsyncHttpClient
public static software.amazon.awssdk.http.async.SdkAsyncHttpClient createAsyncHttpClient(software.amazon.awssdk.utils.AttributeMap config, software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient.Builder httpClientBuilder)
-
createSyncHttpClient
public static software.amazon.awssdk.http.SdkHttpClient createSyncHttpClient(software.amazon.awssdk.utils.AttributeMap config, software.amazon.awssdk.http.apache.ApacheHttpClient.Builder httpClientBuilder)
-
getRegion
public static software.amazon.awssdk.regions.Region getRegion(Properties configProps)
Creates aRegionobject from the given Properties.- Parameters:
configProps- the properties containing the region- Returns:
- the region specified by the properties
-
getStsEndpoint
public static URI getStsEndpoint(Properties configProps)
Creates STS endpoint URI object from the given Properties.- Parameters:
configProps- the properties containing the endpoint- Returns:
- STS endpoint URI specified by the properties, or
nullif endpoint not specified
-
isValidRegion
public static boolean isValidRegion(software.amazon.awssdk.regions.Region region)
Checks whether or not a region is valid.- Parameters:
region- The AWS region to check- Returns:
- true if the supplied region is valid, false otherwise
-
validateAwsConfiguration
public static void validateAwsConfiguration(Properties config)
Validates configuration properties related to Amazon AWS service.- Parameters:
config- the properties to setup credentials and region
-
closeResources
public static void closeResources(software.amazon.awssdk.utils.SdkAutoCloseable... resources)
-
validateAwsCredentials
public static void validateAwsCredentials(Properties config)
-
-