mirror of
https://github.com/ceph/ceph
synced 2025-01-02 17:12:31 +00:00
rgw/notifications: add region to bucket ARN
Fixes: https://tracker.ceph.com/issues/53186 Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
This commit is contained in:
parent
07bfcac5ea
commit
0ecf8bc3a7
@ -385,7 +385,7 @@ pushed or pulled using the pubsub sync module. For example:
|
||||
{
|
||||
"eventVersion":"2.1",
|
||||
"eventSource":"ceph:s3",
|
||||
"awsRegion":"us-east-1",
|
||||
"awsRegion":"zonegroup1",
|
||||
"eventTime":"2019-11-22T13:47:35.124724Z",
|
||||
"eventName":"ObjectCreated:Put",
|
||||
"userIdentity":{
|
||||
@ -406,7 +406,7 @@ pushed or pulled using the pubsub sync module. For example:
|
||||
"ownerIdentity":{
|
||||
"principalId":"tester"
|
||||
},
|
||||
"arn":"arn:aws:s3:us-east-1::mybucket1",
|
||||
"arn":"arn:aws:s3:zonegroup1::mybucket1",
|
||||
"id":"503a4c37-85eb-47cd-8681-2817e80b4281.5332.38"
|
||||
},
|
||||
"object":{
|
||||
|
@ -687,12 +687,15 @@ static inline void populate_event(reservation_t& res,
|
||||
// configurationId is filled from notification configuration
|
||||
event.bucket_name = res.bucket->get_name();
|
||||
event.bucket_ownerIdentity = res.bucket->get_owner() ? res.bucket->get_owner()->get_id().id : "";
|
||||
event.bucket_arn = to_string(rgw::ARN(res.bucket->get_key()));
|
||||
const auto region = res.store->get_zone()->get_zonegroup().get_api_name();
|
||||
rgw::ARN bucket_arn(res.bucket->get_key());
|
||||
bucket_arn.region = region;
|
||||
event.bucket_arn = to_string(bucket_arn);
|
||||
event.object_key = res.object_name ? *res.object_name : obj->get_name();
|
||||
event.object_size = size;
|
||||
event.object_etag = etag;
|
||||
event.object_versionId = version;
|
||||
event.awsRegion = res.store->get_zone()->get_zonegroup().get_api_name();
|
||||
event.awsRegion = region;
|
||||
// use timestamp as per key sequence id (hex encoded)
|
||||
const utime_t ts(real_clock::now());
|
||||
boost::algorithm::hex((const char*)&ts, (const char*)&ts + sizeof(utime_t),
|
||||
|
@ -895,6 +895,9 @@ def test_ps_s3_notification_filter_on_master():
|
||||
notif_id = event['Records'][0]['s3']['configurationId']
|
||||
key_name = event['Records'][0]['s3']['object']['key']
|
||||
awsRegion = event['Records'][0]['awsRegion']
|
||||
assert_equal(awsRegion, zonegroup)
|
||||
bucket_arn = event['Records'][0]['s3']['bucket']['arn']
|
||||
assert_equal(bucket_arn, "arn:aws:s3:"+awsRegion+"::"+bucket_name)
|
||||
if notif_id == notification_name+'_1':
|
||||
found_in1.append(key_name)
|
||||
elif notif_id == notification_name+'_2':
|
||||
@ -909,7 +912,6 @@ def test_ps_s3_notification_filter_on_master():
|
||||
assert_equal(set(found_in1), set(expected_in1))
|
||||
assert_equal(set(found_in2), set(expected_in2))
|
||||
assert_equal(set(found_in3), set(expected_in3))
|
||||
assert_equal(awsRegion, zonegroup)
|
||||
if not skip_notif4:
|
||||
assert_equal(set(found_in4), set(expected_in4))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user