use of com.amazonaws.services.s3.model.CORSRule.AllowedMethods in project cloud-pipeline by epam.
the class S3StorageProviderTest method setUp.
@Before
public void setUp() {
when(bucket.getName()).thenReturn(bucketName);
when(amazonClient.createBucket(any(CreateBucketRequest.class))).thenReturn(bucket);
when(s3Helper.getDefaultS3Client()).thenReturn(amazonClient);
AwsRegion region = new AwsRegion();
region.setId(REGION_ID);
region.setAwsRegionName("us-east-1");
region.setCorsRules("[" + " {" + " \"AllowedOrigins\": [\"string\"]," + " \"AllowedMethods\": [\"PUT\", \"GET\"]," + " \"AllowedHeaders\": [\"string\"]," + " \"MaxAgeSeconds\": 3000," + " \"ExposeHeaders\": [\"string\"]" + " }" + "]");
when(awsRegionManager.getAwsRegion(any())).thenReturn(region);
doReturn(s3Helper).when(s3StorageProvider).getS3Helper(any());
}
use of com.amazonaws.services.s3.model.CORSRule.AllowedMethods in project aws-sdk-android by aws-amplify.
the class BucketConfigurationXmlFactory method writeRule.
private void writeRule(XmlWriter xml, CORSRule rule) {
xml.start("CORSRule");
if (rule.getId() != null) {
xml.start("ID").value(rule.getId()).end();
}
if (rule.getAllowedOrigins() != null) {
for (final String origin : rule.getAllowedOrigins()) {
xml.start("AllowedOrigin").value(origin).end();
}
}
if (rule.getAllowedMethods() != null) {
for (final AllowedMethods method : rule.getAllowedMethods()) {
xml.start("AllowedMethod").value(method.toString()).end();
}
}
if (rule.getMaxAgeSeconds() != 0) {
xml.start("MaxAgeSeconds").value(Integer.toString(rule.getMaxAgeSeconds())).end();
}
if (rule.getExposedHeaders() != null) {
for (final String header : rule.getExposedHeaders()) {
xml.start("ExposeHeader").value(header).end();
}
}
if (rule.getAllowedHeaders() != null) {
for (final String header : rule.getAllowedHeaders()) {
xml.start("AllowedHeader").value(header).end();
}
}
// </CORSRule>
xml.end();
}
Aggregations