@Test public void createCredentialsFromDefault() throws Exception { Map<PropertyKey, String> conf = new HashMap<>(); conf.put(PropertyKey.S3A_ACCESS_KEY, null); conf.put(PropertyKey.S3A_SECRET_KEY, null); try (Closeable c = new ConfigurationRule(conf, sConf).toResource()) { UnderFileSystemConfiguration ufsConf = UnderFileSystemConfiguration.defaults(sConf); AWSCredentialsProvider credentialsProvider = S3AUnderFileSystem.createAwsCredentialsProvider(ufsConf); Assert.assertTrue(credentialsProvider instanceof DefaultAWSCredentialsProviderChain); } }
public static AWSCredentialsProvider createAwsCredentialsProvider( UnderFileSystemConfiguration conf) { if (conf.isSet(PropertyKey.S3A_ACCESS_KEY) && conf.isSet(PropertyKey.S3A_SECRET_KEY)) { return new AWSStaticCredentialsProvider(new BasicAWSCredentials( conf.get(PropertyKey.S3A_ACCESS_KEY), conf.get(PropertyKey.S3A_SECRET_KEY))); } return new DefaultAWSCredentialsProviderChain(); }
S3AUnderFileSystem extends ObjectUnderFileSystem { public static AWSCredentialsProvider createAwsCredentialsProvider( UnderFileSystemConfiguration conf) { if (conf.isSet(PropertyKey.S3A_ACCESS_KEY) && conf.isSet(PropertyKey.S3A_SECRET_KEY)) { return new AWSStaticCredentialsProvider(new BasicAWSCredentials( conf.get(PropertyKey.S3A_ACCESS_KEY), conf.get(PropertyKey.S3A_SECRET_KEY))); } return new DefaultAWSCredentialsProviderChain(); } }
S3AUnderFileSystem extends ObjectUnderFileSystem { public static AWSCredentialsProvider createAwsCredentialsProvider( UnderFileSystemConfiguration conf) { if (conf.isSet(PropertyKey.S3A_ACCESS_KEY) && conf.isSet(PropertyKey.S3A_SECRET_KEY)) { return new AWSStaticCredentialsProvider(new BasicAWSCredentials( conf.get(PropertyKey.S3A_ACCESS_KEY), conf.get(PropertyKey.S3A_SECRET_KEY))); } return new DefaultAWSCredentialsProviderChain(); } protected  S3AUnderFileSystem(AlluxioURI uri, AmazonS3Client amazonS3Client, String bucketName,
      ExecutorService executor, TransferManager transferManager, UnderFileSystemConfiguration conf,
      boolean streamingUploadEnabled); }
S3AUnderFileSystem extends ObjectUnderFileSystem { public static AWSCredentialsProvider createAwsCredentialsProvider( UnderFileSystemConfiguration conf) { if (conf.isSet(PropertyKey.S3A_ACCESS_KEY) && conf.isSet(PropertyKey.S3A_SECRET_KEY)) { return new AWSStaticCredentialsProvider(new BasicAWSCredentials( conf.get(PropertyKey.S3A_ACCESS_KEY), conf.get(PropertyKey.S3A_SECRET_KEY))); } return new DefaultAWSCredentialsProviderChain(); } protected  S3AUnderFileSystem(AlluxioURI uri, AmazonS3Client amazonS3Client, String bucketName,
      ExecutorService executor, TransferManager transferManager, UnderFileSystemConfiguration conf,
      boolean streamingUploadEnabled); static AWSCredentialsProvider createAwsCredentialsProvider(
      UnderFileSystemConfiguration conf); static S3AUnderFileSystem createInstance(AlluxioURI uri,
      UnderFileSystemConfiguration conf); @Override String getUnderFSType(); @Override void setOwner(String path, String user, String group); @Override void setMode(String path, short mode); @Override void cleanup(); @Override boolean createEmptyObject(String key); }
S3AUnderFileSystem extends ObjectUnderFileSystem { public static AWSCredentialsProvider createAwsCredentialsProvider( UnderFileSystemConfiguration conf) { if (conf.isSet(PropertyKey.S3A_ACCESS_KEY) && conf.isSet(PropertyKey.S3A_SECRET_KEY)) { return new AWSStaticCredentialsProvider(new BasicAWSCredentials( conf.get(PropertyKey.S3A_ACCESS_KEY), conf.get(PropertyKey.S3A_SECRET_KEY))); } return new DefaultAWSCredentialsProviderChain(); } protected  S3AUnderFileSystem(AlluxioURI uri, AmazonS3Client amazonS3Client, String bucketName,
      ExecutorService executor, TransferManager transferManager, UnderFileSystemConfiguration conf,
      boolean streamingUploadEnabled); static AWSCredentialsProvider createAwsCredentialsProvider(
      UnderFileSystemConfiguration conf); static S3AUnderFileSystem createInstance(AlluxioURI uri,
      UnderFileSystemConfiguration conf); @Override String getUnderFSType(); @Override void setOwner(String path, String user, String group); @Override void setMode(String path, short mode); @Override void cleanup(); @Override boolean createEmptyObject(String key);  }