mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
feat(s3): apply VersioningConfiguration in CloudFormation S3 bucket provisioning (#2626)
This commit is contained in:
1 parent
277809fb41
commit
64c38c77b9
2 files changed
+157
No files matched your search
+13
@@ -677,6 +677,7 @@ public class CloudFormationResourceProvisioner {
|
||||
}
|
||||
s3Service.createBucket(bucketName, region);
|
||||
applyBucketCorsConfiguration(bucketName, props, engine);
|
||||
applyBucketVersioningConfiguration(bucketName, props, engine);
|
||||
r.setPhysicalId(bucketName);
|
||||
r.getAttributes().put("Arn", AwsArnUtils.Arn.of("s3", "", "", bucketName).toString());
|
||||
r.getAttributes().put("DomainName", bucketName + ".s3.amazonaws.com");
|
||||
@@ -722,6 +723,18 @@ public class CloudFormationResourceProvisioner {
|
||||
s3Service.putBucketCors(bucketName, xml.build());
|
||||
}
|
||||
|
||||
private void applyBucketVersioningConfiguration(String bucketName, JsonNode props,
|
||||
CloudFormationTemplateEngine engine) {
|
||||
if (props == null || !props.has("VersioningConfiguration")
|
||||
|| props.get("VersioningConfiguration").isNull()) {
|
||||
return;
|
||||
}
|
||||
String status = resolveOptional(props.get("VersioningConfiguration"), "Status", engine);
|
||||
if (status != null && !status.isBlank()) {
|
||||
s3Service.putBucketVersioning(bucketName, status);
|
||||
}
|
||||
}
|
||||
|
||||
private void appendCorsRuleElements(XmlBuilder xml, JsonNode values, String elementName,
|
||||
CloudFormationTemplateEngine engine) {
|
||||
if (values == null || !values.isArray()) {
|
||||
|
||||
Reference in new issue
Block a user