protected XMLBuilder buildCacheBehaviors(CacheBehavior[] cbs) throws TransformerException, ParserConfigurationException, FactoryConfigurationError { return this.buildCacheBehaviorsElement(false, cbs); }
/** * Create a minimally-configured CloudFront distribution for an S3 bucket that will * be publicly available once created. * * @param origin the origin to associate with the distribution, either an Amazon S3 bucket or * a custom HTTP/S-accessible location. * @return an object that describes the newly-created distribution, in particular the * distribution's identifier and domain name values. * @throws CloudFrontServiceException */ public Distribution createDistribution(Origin origin) throws CloudFrontServiceException { return this.createDistribution(origin, null, null, null, true, null); }
CloudFrontService cloudFrontService = new CloudFrontService( SamplesUtils.loadAWSCredentials()); Distribution[] bucketDistributions = cloudFrontService.listDistributions(); for (int i = 0; i < bucketDistributions.length; i++) { System.out.println("Distribution " + (i + 1) + ": " + bucketDistributions[i]); bucketDistributions = cloudFrontService.listDistributions("jets3t"); for (int i = 0; i < bucketDistributions.length; i++) { System.out.println("Bucket distribution " + (i + 1) + ": " + bucketDistributions[i]); Distribution newDistribution = cloudFrontService.createDistribution( new S3Origin(originBucket), "" + System.currentTimeMillis(), // Caller reference - a unique string value Distribution distribution = cloudFrontService.getDistributionInfo(testDistributionId); System.out.println("Distribution: " + distribution); DistributionConfig distributionConfig = cloudFrontService.getDistributionConfig(testDistributionId); System.out.println("Distribution Config: " + distributionConfig); DistributionConfig updatedDistributionConfig = cloudFrontService.updateDistributionConfig( testDistributionId, updatedDistributionConfig = cloudFrontService.updateDistributionConfig( testDistributionId, updatedDistributionConfig = cloudFrontService.updateDistributionConfig( testDistributionId, updatedDistributionConfig);
final S3Origin bucket = (S3Origin) config.getOrigins()[0]; final XMLBuilder origin = builder.e("S3Origin"); origin.e("DomainName").t(sanitizeS3BucketName(bucket.getDomainName())); origin.e("OriginAccessIdentity"); if(bucket.getOriginAccessIdentity() != null) { .e("Items"); for(Origin origin : config.getOrigins()) { originsBuilder.importXMLBuilder(buildOrigin(origin)); builder.importXMLBuilder(buildTrustedSigners(config.getTrustedSignerAwsAccountNumbers())); builder.importXMLBuilder(buildDefaultCacheBehavior(config.getDefaultCacheBehavior())); builder.importXMLBuilder(buildCacheBehaviors(config.getCacheBehaviors()));
? getStreamingDistributionConfig(id) : getDistributionConfig(id)); etag = oldConfig.getEtag(); String distributionConfigXml = buildDistributionConfigXmlDocument(config); ContentType.create("text/xml", Constants.DEFAULT_ENCODING))); httpMethod.setHeader("If-Match", etag); HttpResponse response = performRestRequest(httpMethod, 200);
cloudFrontService = new CloudFrontService( s3ServiceMulti.getAWSCredentials(), APPLICATION_DESCRIPTION, myself, null); cloudFrontService.listDistributions(); } catch (CloudFrontServiceException e) { stopProgressDialog(); updateProgressDialog("Listing distributions for " + cloudFrontService.getAWSCredentials().getAccessKey(), "", 0); distributions = cloudFrontService.listDistributions();
getCurrentTimeWithOffset())); do { completedWithoutRecoverableError = true; authorizeHttpRequest(httpMethod, null, null); response = httpClient.execute(httpMethod); int responseCode = response.getStatusLine().getStatusCode(); releaseConnection(response); throw e; releaseConnection(response); throw new CloudFrontServiceException("CloudFront Request failed", t);
String distributionConfigXml = buildDistributionConfigXmlDocument(config); ContentType.create("text/xml", Constants.DEFAULT_ENCODING))); HttpResponse response = performRestRequest(httpMethod, 201);
itemBuilder.importXMLBuilder(buildTrustedSigners(cb.getTrustedSignerAwsAccountNumbers())); itemBuilder.e("ViewerProtocolPolicy").t(cb.getViewerProtocolPolicy().toText()); if(cb.getMinTTL() != null) {
CloudFrontService cloudFrontService = new CloudFrontService( SamplesUtils.loadAWSCredentials()); Distribution[] bucketDistributions = cloudFrontService.listDistributions(); for (int i = 0; i < bucketDistributions.length; i++) { System.out.println("Distribution " + (i + 1) + ": " + bucketDistributions[i]); bucketDistributions = cloudFrontService.listDistributions("jets3t"); for (int i = 0; i < bucketDistributions.length; i++) { System.out.println("Bucket distribution " + (i + 1) + ": " + bucketDistributions[i]); Distribution newDistribution = cloudFrontService.createDistribution( new S3Origin(originBucket), "" + System.currentTimeMillis(), // Caller reference - a unique string value Distribution distribution = cloudFrontService.getDistributionInfo(testDistributionId); System.out.println("Distribution: " + distribution); DistributionConfig distributionConfig = cloudFrontService.getDistributionConfig(testDistributionId); System.out.println("Distribution Config: " + distributionConfig); DistributionConfig updatedDistributionConfig = cloudFrontService.updateDistributionConfig( testDistributionId, updatedDistributionConfig = cloudFrontService.updateDistributionConfig( testDistributionId, updatedDistributionConfig = cloudFrontService.updateDistributionConfig( testDistributionId, updatedDistributionConfig);
final S3Origin bucket = (S3Origin) config.getOrigins()[0]; final XMLBuilder origin = builder.e("S3Origin"); origin.e("DomainName").t(sanitizeS3BucketName(bucket.getDomainName())); origin.e("OriginAccessIdentity"); if(bucket.getOriginAccessIdentity() != null) { .e("Items"); for(Origin origin : config.getOrigins()) { originsBuilder.importXMLBuilder(buildOrigin(origin)); builder.importXMLBuilder(buildTrustedSigners(config.getTrustedSignerAwsAccountNumbers())); builder.importXMLBuilder(buildDefaultCacheBehavior(config.getDefaultCacheBehavior())); builder.importXMLBuilder(buildCacheBehaviors(config.getCacheBehaviors()));
? getStreamingDistributionConfig(id) : getDistributionConfig(id)); etag = oldConfig.getEtag(); String distributionConfigXml = buildDistributionConfigXmlDocument(config); ContentType.create("text/xml", Constants.DEFAULT_ENCODING))); httpMethod.setHeader("If-Match", etag); HttpResponse response = performRestRequest(httpMethod, 200);
cloudFrontService = new CloudFrontService( s3ServiceMulti.getAWSCredentials(), APPLICATION_DESCRIPTION, myself, null); cloudFrontService.listDistributions(); } catch (CloudFrontServiceException e) { stopProgressDialog(); updateProgressDialog("Listing distributions for " + cloudFrontService.getAWSCredentials().getAccessKey(), "", 0); distributions = cloudFrontService.listDistributions();
getCurrentTimeWithOffset())); do { completedWithoutRecoverableError = true; authorizeHttpRequest(httpMethod, null, null); response = httpClient.execute(httpMethod); int responseCode = response.getStatusLine().getStatusCode(); releaseConnection(response); throw e; releaseConnection(response); throw new CloudFrontServiceException("CloudFront Request failed", t);
String distributionConfigXml = buildDistributionConfigXmlDocument(config); ContentType.create("text/xml", Constants.DEFAULT_ENCODING))); HttpResponse response = performRestRequest(httpMethod, 201);
itemBuilder.importXMLBuilder(buildTrustedSigners(cb.getTrustedSignerAwsAccountNumbers())); itemBuilder.e("ViewerProtocolPolicy").t(cb.getViewerProtocolPolicy().toText()); if(cb.getMinTTL() != null) {
/** * Create a minimally-configured CloudFront distribution for an S3 bucket that will * be publicly available once created. * * @param origin the origin to associate with the distribution, either an Amazon S3 bucket or * a custom HTTP/S-accessible location. * @return an object that describes the newly-created distribution, in particular the * distribution's identifier and domain name values. * @throws CloudFrontServiceException */ public Distribution createDistribution(Origin origin) throws CloudFrontServiceException { return this.createDistribution(origin, null, null, null, true, null); }
protected XMLBuilder buildDefaultCacheBehavior(CacheBehavior cb) throws TransformerException, ParserConfigurationException, FactoryConfigurationError { return this.buildCacheBehaviorsElement(true, new CacheBehavior[]{cb}); }
/** * Create a public CloudFront distribution for an S3 bucket. * * @param origin the origin to associate with the distribution, either an Amazon S3 bucket or * a custom HTTP/S-accessible location. * @param callerReference A user-set unique reference value that ensures the request can't be replayed * (max UTF-8 encoding size 128 bytes). This parameter may be null, in which * case your computer's local epoch time in milliseconds will be used. * @param cnames A list of up to 10 CNAME aliases to associate with the distribution. This * parameter may be a null or empty array. * @param comment An optional comment to describe the distribution in your own terms * (max 128 characters). May be null. * @param enabled Should the distribution should be enabled and publicly accessible upon creation? * @param loggingStatus Logging status settings (bucket, prefix) for the distribution. If this value * is null, logging will be disabled for the distribution. * @return an object that describes the newly-created distribution, in particular the * distribution's identifier and domain name values. * @throws CloudFrontServiceException */ public Distribution createDistribution(Origin origin, String callerReference, String[] cnames, String comment, boolean enabled, LoggingStatus loggingStatus) throws CloudFrontServiceException { return createDistribution(origin, callerReference, cnames, comment, enabled, loggingStatus, false, null, null, null); }
protected XMLBuilder buildCacheBehaviors(CacheBehavior[] cbs) throws TransformerException, ParserConfigurationException, FactoryConfigurationError { return this.buildCacheBehaviorsElement(false, cbs); }