com.amazonaws.services.s3.model.BucketWebsiteConfiguration Java Examples
The following examples show how to use
com.amazonaws.services.s3.model.BucketWebsiteConfiguration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GetWebsiteConfiguration.java From aws-doc-sdk-examples with Apache License 2.0 | 6 votes |
public static void getWebsiteConfig(String bucket_name) { // snippet-start:[s3.java1.s3_get_website_config.main] final AmazonS3 s3 = AmazonS3ClientBuilder.standard().withRegion(Regions.DEFAULT_REGION).build(); try { BucketWebsiteConfiguration config = s3.getBucketWebsiteConfiguration(bucket_name); if (config == null) { System.out.println("No website configuration found!"); } else { System.out.format("Index document: %s\n", config.getIndexDocumentSuffix()); System.out.format("Error document: %s\n", config.getErrorDocument()); } } catch (AmazonServiceException e) { System.err.println(e.getErrorMessage()); System.out.println("Failed to get website configuration!"); System.exit(1); } // snippet-end:[s3.java1.s3_get_website_config.main] }
Example #2
Source File: WebsiteConfiguration.java From aws-doc-sdk-examples with Apache License 2.0 | 5 votes |
private static void printWebsiteConfig(AmazonS3 s3Client, String bucketName) { System.out.println("Website configuration: "); BucketWebsiteConfiguration bucketWebsiteConfig = s3Client.getBucketWebsiteConfiguration(bucketName); if (bucketWebsiteConfig == null) { System.out.println("No website config."); } else { System.out.println("Index doc: " + bucketWebsiteConfig.getIndexDocumentSuffix()); System.out.println("Error doc: " + bucketWebsiteConfig.getErrorDocument()); } }
Example #3
Source File: Acl.java From cloudExplorer with GNU General Public License v3.0 | 5 votes |
void setBUCKETwebsite(String object, String access_key, String secret_key, String endpoint, String bucket) { try { AWSCredentials credentials = new BasicAWSCredentials(access_key, secret_key); AmazonS3 s3Client = new AmazonS3Client(credentials, new ClientConfiguration()); if (endpoint.contains("amazonaws.com")) { String aws_endpoint = s3Client.getBucketLocation(new GetBucketLocationRequest(bucket)); if (aws_endpoint.contains("US")) { s3Client.setEndpoint("https://s3.amazonaws.com"); } else if (aws_endpoint.contains("us-west")) { s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com"); } else if (aws_endpoint.contains("eu-west")) { s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com"); } else if (aws_endpoint.contains("ap-")) { s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com"); } else if (aws_endpoint.contains("sa-east-1")) { s3Client.setEndpoint("https://s3-" + aws_endpoint + ".amazonaws.com"); } else { s3Client.setEndpoint("https://s3." + aws_endpoint + ".amazonaws.com"); } } else { s3Client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build()); s3Client.setEndpoint(endpoint); } BucketWebsiteConfiguration bucketWebsiteConfiguration = s3Client.getBucketWebsiteConfiguration(bucket); s3Client.setBucketAcl(bucket, CannedAccessControlList.PublicRead); s3Client.setBucketWebsiteConfiguration(bucket, new BucketWebsiteConfiguration("index.html", "error.html")); } catch (Exception setACLpublic) { mainFrame.jTextArea1.append("\nException occurred in ACL"); } }
Example #4
Source File: AmazonS3Mock.java From Scribengin with GNU Affero General Public License v3.0 | 5 votes |
@Override public BucketWebsiteConfiguration getBucketWebsiteConfiguration( GetBucketWebsiteConfigurationRequest getBucketWebsiteConfigurationRequest) throws AmazonClientException, AmazonServiceException { // TODO Auto-generated method stub return null; }
Example #5
Source File: DummyS3Client.java From ignite with Apache License 2.0 | 4 votes |
/** Unsupported Operation. */ @Override public BucketWebsiteConfiguration getBucketWebsiteConfiguration( String bucketName) throws SdkClientException { throw new UnsupportedOperationException("Operation not supported"); }
Example #6
Source File: DummyS3Client.java From ignite with Apache License 2.0 | 4 votes |
/** Unsupported Operation. */ @Override public BucketWebsiteConfiguration getBucketWebsiteConfiguration( GetBucketWebsiteConfigurationRequest getBucketWebsiteConfigurationReq) throws SdkClientException { throw new UnsupportedOperationException("Operation not supported"); }
Example #7
Source File: DummyS3Client.java From ignite with Apache License 2.0 | 4 votes |
/** Unsupported Operation. */ @Override public void setBucketWebsiteConfiguration(String bucketName, BucketWebsiteConfiguration configuration) throws SdkClientException { throw new UnsupportedOperationException("Operation not supported"); }
Example #8
Source File: AmazonS3Mock.java From Scribengin with GNU Affero General Public License v3.0 | 4 votes |
@Override public BucketWebsiteConfiguration getBucketWebsiteConfiguration(String bucketName) throws AmazonClientException, AmazonServiceException { // TODO Auto-generated method stub return null; }
Example #9
Source File: AmazonS3Mock.java From Scribengin with GNU Affero General Public License v3.0 | 4 votes |
@Override public void setBucketWebsiteConfiguration(String bucketName, BucketWebsiteConfiguration configuration) throws AmazonClientException, AmazonServiceException { // TODO Auto-generated method stub }