本文整理汇总了Java中com.amazonaws.services.s3.AmazonS3Client.setS3ClientOptions方法的典型用法代码示例。如果您正苦于以下问题:Java AmazonS3Client.setS3ClientOptions方法的具体用法?Java AmazonS3Client.setS3ClientOptions怎么用?Java AmazonS3Client.setS3ClientOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.s3.AmazonS3Client
的用法示例。
在下文中一共展示了AmazonS3Client.setS3ClientOptions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAmazonS3Client
import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
private AmazonS3Client getAmazonS3Client(BackupRestoreContext ctx) throws URISyntaxException {
final String accessKey = ctx.getAccountId();
final String secretKey = ctx.getSecretKey();
String endpoint = getEndpoint(ctx);
LOGGER.info("endpoint: {}", endpoint);
final BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(accessKey, secretKey);
final AmazonS3Client amazonS3Client = new AmazonS3Client(basicAWSCredentials);
amazonS3Client.setEndpoint(endpoint);
if (ctx.usesEmc()) {
final S3ClientOptions options = new S3ClientOptions();
options.setPathStyleAccess(true);
amazonS3Client.setS3ClientOptions(options);
}
return amazonS3Client;
}
示例2: connectToS3
import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
private void connectToS3(String accessKey, String secretKey, String endpoint, boolean secure, boolean pathStyle) {
LOG.info("'{}','{}','{}'", accessKey, secretKey, endpoint);
AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
ClientConfiguration clientConfiguration = new ClientConfiguration()
.withProtocol(secure ? Protocol.HTTPS : Protocol.HTTP)
.withUserAgentPrefix("s3browser")
.withSignerOverride("S3SignerType");
s3Client = new AmazonS3Client(credentials, clientConfiguration);
s3Client.setS3ClientOptions(S3ClientOptions.builder()
.setPathStyleAccess(pathStyle)
.disableChunkedEncoding()
.build());
s3Client.setEndpoint(endpoint);
}
示例3: s3Ninja
import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
@Bean
@Profile("dev")
public AmazonS3Client s3Ninja() {
AWSCredentials credentials = new BasicAWSCredentials(
"AKIAIOSFODNN7EXAMPLE",
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY");
AmazonS3Client newClient = new AmazonS3Client(credentials,
new ClientConfiguration());
newClient.setS3ClientOptions(new S3ClientOptions()
.withPathStyleAccess(true));
newClient.setEndpoint("http://localhost:9444/s3");
return newClient;
}
示例4: s3Amazon
import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
@Bean
@Profile("prod")
public AmazonS3Client s3Amazon() {
AWSCredentials credentials = new BasicAWSCredentials(
"AKIAIOSFODNN7EXAMPLE",
"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY");
AmazonS3Client newClient = new AmazonS3Client(credentials,
new ClientConfiguration());
newClient.setS3ClientOptions(new S3ClientOptions()
.withPathStyleAccess(true));
return newClient;
}
示例5: setUp
import com.amazonaws.services.s3.AmazonS3Client; //导入方法依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
s3mock = System.getProperty("s3mock");
s3mock = s3mock != null ? s3mock : "http://localhost:9444/s3";
client = new AmazonS3Client(new BasicAWSCredentials("AKIAIOSFODNN7EXAMPLE", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"));
client.setEndpoint(s3mock);
client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true));
}