@Test public void testDefaultCredentialsProvider() throws Exception { setUp(); AWSCredentialsProvider credentialsProvider = storage.newCredentialsProvider(connectorConfig); assertTrue(S3SinkConnectorConfig.CREDENTIALS_PROVIDER_CLASS_DEFAULT.isInstance(credentialsProvider)); localProps.put(S3SinkConnectorConfig.AWS_ACCESS_KEY_ID_CONFIG, ""); localProps.put(S3SinkConnectorConfig.AWS_SECRET_ACCESS_KEY_CONFIG, ""); setUp(); credentialsProvider = storage.newCredentialsProvider(connectorConfig); assertTrue(S3SinkConnectorConfig.CREDENTIALS_PROVIDER_CLASS_DEFAULT.isInstance(credentialsProvider)); }
protected AWSCredentialsProvider newCredentialsProvider(S3SinkConnectorConfig config) { final String accessKeyId = config.getString(AWS_ACCESS_KEY_ID_CONFIG); final String secretKey = config.getPassword(AWS_SECRET_ACCESS_KEY_CONFIG).value(); if (StringUtils.isNotBlank(accessKeyId) && StringUtils.isNotBlank(secretKey)) { log.info("Returning new credentials provider using the access key id and " + "the secret access key that were directly supplied through the connector's " + "configuration"); BasicAWSCredentials basicCredentials = new BasicAWSCredentials(accessKeyId, secretKey); return new AWSStaticCredentialsProvider(basicCredentials); } log.info( "Returning new credentials provider based on the configured credentials provider class"); return config.getCredentialsProvider(); }
S3Storage implements Storage<S3SinkConnectorConfig, ObjectListing> { protected AWSCredentialsProvider newCredentialsProvider(S3SinkConnectorConfig config) { final String accessKeyId = config.getString(AWS_ACCESS_KEY_ID_CONFIG); final String secretKey = config.getPassword(AWS_SECRET_ACCESS_KEY_CONFIG).value(); if (StringUtils.isNotBlank(accessKeyId) && StringUtils.isNotBlank(secretKey)) { log.info("Returning new credentials provider using the access key id and " + "the secret access key that were directly supplied through the connector's " + "configuration"); BasicAWSCredentials basicCredentials = new BasicAWSCredentials(accessKeyId, secretKey); return new AWSStaticCredentialsProvider(basicCredentials); } log.info( "Returning new credentials provider based on the configured credentials provider class"); return config.getCredentialsProvider(); } }
S3Storage implements Storage<S3SinkConnectorConfig, ObjectListing> { protected AWSCredentialsProvider newCredentialsProvider(S3SinkConnectorConfig config) { final String accessKeyId = config.getString(AWS_ACCESS_KEY_ID_CONFIG); final String secretKey = config.getPassword(AWS_SECRET_ACCESS_KEY_CONFIG).value(); if (StringUtils.isNotBlank(accessKeyId) && StringUtils.isNotBlank(secretKey)) { log.info("Returning new credentials provider using the access key id and " + "the secret access key that were directly supplied through the connector's " + "configuration"); BasicAWSCredentials basicCredentials = new BasicAWSCredentials(accessKeyId, secretKey); return new AWSStaticCredentialsProvider(basicCredentials); } log.info( "Returning new credentials provider based on the configured credentials provider class"); return config.getCredentialsProvider(); } S3Storage(S3SinkConnectorConfig conf, String url);  S3Storage(S3SinkConnectorConfig conf, String url, String bucketName, AmazonS3 s3); }
S3Storage implements Storage<S3SinkConnectorConfig, ObjectListing> { protected AWSCredentialsProvider newCredentialsProvider(S3SinkConnectorConfig config) { final String accessKeyId = config.getString(AWS_ACCESS_KEY_ID_CONFIG); final String secretKey = config.getPassword(AWS_SECRET_ACCESS_KEY_CONFIG).value(); if (StringUtils.isNotBlank(accessKeyId) && StringUtils.isNotBlank(secretKey)) { log.info("Returning new credentials provider using the access key id and " + "the secret access key that were directly supplied through the connector's " + "configuration"); BasicAWSCredentials basicCredentials = new BasicAWSCredentials(accessKeyId, secretKey); return new AWSStaticCredentialsProvider(basicCredentials); } log.info( "Returning new credentials provider based on the configured credentials provider class"); return config.getCredentialsProvider(); } S3Storage(S3SinkConnectorConfig conf, String url);  S3Storage(S3SinkConnectorConfig conf, String url, String bucketName, AmazonS3 s3); AmazonS3 newS3Client(S3SinkConnectorConfig config); ClientConfiguration newClientConfiguration(S3SinkConnectorConfig config); @Override boolean exists(String name); boolean bucketExists(); @Override boolean create(String name); @Override OutputStream create(String path, S3SinkConnectorConfig conf, boolean overwrite); S3OutputStream create(String path, boolean overwrite, Class<?> formatClass); @Override OutputStream append(String filename); @Override void delete(String name); @Override void close(); void addTags(String fileName, Map<String, String> tags); @Override ObjectListing list(String path); @Override S3SinkConnectorConfig conf(); @Override String url(); @Override SeekableInput open(String path, S3SinkConnectorConfig conf); }
S3Storage implements Storage<S3SinkConnectorConfig, ObjectListing> { protected AWSCredentialsProvider newCredentialsProvider(S3SinkConnectorConfig config) { final String accessKeyId = config.getString(AWS_ACCESS_KEY_ID_CONFIG); final String secretKey = config.getPassword(AWS_SECRET_ACCESS_KEY_CONFIG).value(); if (StringUtils.isNotBlank(accessKeyId) && StringUtils.isNotBlank(secretKey)) { log.info("Returning new credentials provider using the access key id and " + "the secret access key that were directly supplied through the connector's " + "configuration"); BasicAWSCredentials basicCredentials = new BasicAWSCredentials(accessKeyId, secretKey); return new AWSStaticCredentialsProvider(basicCredentials); } log.info( "Returning new credentials provider based on the configured credentials provider class"); return config.getCredentialsProvider(); } S3Storage(S3SinkConnectorConfig conf, String url);  S3Storage(S3SinkConnectorConfig conf, String url, String bucketName, AmazonS3 s3); AmazonS3 newS3Client(S3SinkConnectorConfig config); ClientConfiguration newClientConfiguration(S3SinkConnectorConfig config); @Override boolean exists(String name); boolean bucketExists(); @Override boolean create(String name); @Override OutputStream create(String path, S3SinkConnectorConfig conf, boolean overwrite); S3OutputStream create(String path, boolean overwrite, Class<?> formatClass); @Override OutputStream append(String filename); @Override void delete(String name); @Override void close(); void addTags(String fileName, Map<String, String> tags); @Override ObjectListing list(String path); @Override S3SinkConnectorConfig conf(); @Override String url(); @Override SeekableInput open(String path, S3SinkConnectorConfig conf);  }