From e6918187568dbd01842d8d1d2c808ce16a894239 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Apr 2024 13:54:28 +0200 Subject: Adding upstream version 18.2.2. Signed-off-by: Daniel Baumann --- src/rgw/rgw_public_access.cc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/rgw/rgw_public_access.cc (limited to 'src/rgw/rgw_public_access.cc') diff --git a/src/rgw/rgw_public_access.cc b/src/rgw/rgw_public_access.cc new file mode 100644 index 000000000..6298bb306 --- /dev/null +++ b/src/rgw/rgw_public_access.cc @@ -0,0 +1,33 @@ +#include "rgw_public_access.h" +#include "rgw_xml.h" + +void PublicAccessBlockConfiguration::decode_xml(XMLObj *obj) { + RGWXMLDecoder::decode_xml("BlockPublicAcls", BlockPublicAcls, obj); + RGWXMLDecoder::decode_xml("IgnorePublicAcls", IgnorePublicAcls, obj); + RGWXMLDecoder::decode_xml("BlockPublicPolicy", BlockPublicPolicy, obj); + RGWXMLDecoder::decode_xml("RestrictPublicBuckets", RestrictPublicBuckets, obj); +} + +void PublicAccessBlockConfiguration::dump_xml(Formatter *f) const { + Formatter::ObjectSection os(*f, "BlockPublicAccessBlockConfiguration"); + // Note: AWS spec mentions the values to be ALL CAPs, but clients seem to + // require all small letters, and S3 itself doesn't seem to follow the API + // spec here + f->dump_bool("BlockPublicAcls", BlockPublicAcls); + f->dump_bool("IgnorePublicAcls", IgnorePublicAcls); + f->dump_bool("BlockPublicPolicy", BlockPublicPolicy); + f->dump_bool("RestrictPublicBuckets", RestrictPublicBuckets); +} + + +std::ostream& operator<< (std::ostream& os, const PublicAccessBlockConfiguration& access_conf) +{ + os << std::boolalpha + << "BlockPublicAcls: " << access_conf.block_public_acls() << std::endl + << "IgnorePublicAcls: " << access_conf.ignore_public_acls() << std::endl + << "BlockPublicPolicy" << access_conf.block_public_policy() << std::endl + << "RestrictPublicBuckets" << access_conf.restrict_public_buckets() << std::endl; + + return os; +} + -- cgit v1.2.3