return 0;
}
-int RGWPubSub::create_topic(const DoutPrefixProvider *dpp, const std::string& name, optional_yield y) const {
- return create_topic(dpp, name, rgw_pubsub_dest{}, "", "", y);
-}
-
-int RGWPubSub::create_topic(const DoutPrefixProvider *dpp, const std::string& name, const rgw_pubsub_dest& dest,
- const std::string& arn, const std::string& opaque_data, optional_yield y) const {
+int RGWPubSub::create_topic(const DoutPrefixProvider* dpp,
+ const std::string& name,
+ const rgw_pubsub_dest& dest, const std::string& arn,
+ const std::string& opaque_data,
+ const rgw_user& user, optional_yield y) const {
RGWObjVersionTracker objv_tracker;
rgw_pubsub_topics topics;
}
rgw_pubsub_topic& new_topic = topics.topics[name];
- new_topic.user = rgw_user("", tenant);
+ new_topic.user = user;
new_topic.name = name;
new_topic.dest = dest;
new_topic.arn = arn;
// create a topic with a name only
// if the topic already exists it is a no-op (considered success)
// return 0 on success, error code otherwise
- int create_topic(const DoutPrefixProvider *dpp, const std::string& name, optional_yield y) const;
- // create a topic with push destination information and ARN
- // if the topic already exists the destination and ARN values may be updated (considered succsess)
- // return 0 on success, error code otherwise
- int create_topic(const DoutPrefixProvider *dpp, const std::string& name, const rgw_pubsub_dest& dest,
- const std::string& arn, const std::string& opaque_data, optional_yield y) const;
+ int create_topic(const DoutPrefixProvider* dpp, const std::string& name,
+ const rgw_pubsub_dest& dest, const std::string& arn,
+ const std::string& opaque_data, const rgw_user& user,
+ optional_yield y) const;
// remove a topic according to its name
// if the topic does not exists it is a no-op (considered success)
// return 0 on success, error code otherwise
}
const RGWPubSub ps(driver, s->owner.get_id().tenant);
- op_ret = ps.create_topic(this, topic_name, dest, topic_arn, opaque_data, y);
+ op_ret = ps.create_topic(this, topic_name, dest, topic_arn, opaque_data,
+ s->owner.get_id(), y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to create topic '" << topic_name << "', ret=" << op_ret << dendl;
return;
// generate the internal topic. destination is stored here for the "push-only" case
// when no subscription exists
// ARN is cached to make the "GET" method faster
- op_ret = ps.create_topic(this, unique_topic_name, topic_info.dest, topic_info.arn, topic_info.opaque_data, y);
+ op_ret = ps.create_topic(this, unique_topic_name, topic_info.dest,
+ topic_info.arn, topic_info.opaque_data,
+ s->owner.get_id(), y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to auto-generate unique topic '" << unique_topic_name <<
"', ret=" << op_ret << dendl;
admin
from nose import SkipTest
-from nose.tools import assert_not_equal, assert_equal, assert_in
+from nose.tools import assert_not_equal, assert_equal, assert_in, assert_true
import boto.s3.tagging
# configure logging for the tests module
TOPIC_SUFFIX = "_topic"
NOTIFICATION_SUFFIX = "_notif"
+UID_PREFIX = "superman"
num_buckets = 0
def another_user(tenant=None):
access_key = str(time.time())
secret_key = str(time.time())
- uid = 'superman' + str(time.time())
+ uid = UID_PREFIX + str(time.time())
if tenant:
_, result = admin(['user', 'create', '--uid', uid, '--tenant', tenant, '--access-key', access_key, '--secret-key', secret_key, '--display-name', '"Super Man"'])
else:
result = admin(['topic', 'get', '--topic', topic_name+'_3', '--tenant', tenant])
parsed_result = json.loads(result[0])
assert_equal(parsed_result['arn'], topic_arn3)
+ matches = [tenant, UID_PREFIX]
+ assert_true( all([x in parsed_result['user'] for x in matches]))
# delete topic 3
_, result = admin(['topic', 'rm', '--topic', topic_name+'_3', '--tenant', tenant])