}
if (opt_cmd == OPT_POLICY) {
- int ret = RGWBucketAdminOp::get_policy(store, bucket_op, f);
- if (ret < 0) {
- cerr << "ERROR: failed to get policy: " << cpp_strerror(-ret) << std::endl;
- return -ret;
+ if (format == "xml") {
+ int ret = RGWBucketAdminOp::dump_s3_policy(store, bucket_op, cout);
+ if (ret < 0) {
+ cerr << "ERROR: failed to get policy: " << cpp_strerror(-ret) << std::endl;
+ return -ret;
+ }
+ } else {
+ int ret = RGWBucketAdminOp::get_policy(store, bucket_op, f);
+ if (ret < 0) {
+ cerr << "ERROR: failed to get policy: " << cpp_strerror(-ret) << std::endl;
+ return -ret;
+ }
}
}
return 0;
}
+int RGWBucketAdminOp::dump_s3_policy(RGWRados *store, RGWBucketAdminOpState& op_state,
+ ostream& os)
+{
+ RGWAccessControlPolicy_S3 policy(store->ctx());
+
+ int ret = get_policy(store, op_state, policy);
+ if (ret < 0)
+ return ret;
+
+ policy.to_xml(os);
+
+ return 0;
+}
+
int RGWBucketAdminOp::unlink(RGWRados *store, RGWBucketAdminOpState& op_state)
{
RGWBucket bucket;
RGWFormatterFlusher& flusher);
static int get_policy(RGWRados *store, RGWBucketAdminOpState& op_state,
RGWAccessControlPolicy& policy);
-
+ static int dump_s3_policy(RGWRados *store, RGWBucketAdminOpState& op_state,
+ ostream& os);
static int unlink(RGWRados *store, RGWBucketAdminOpState& op_state);
static int link(RGWRados *store, RGWBucketAdminOpState& op_state, string *err_msg = NULL);