def cli(env, account_id, topic_name, datacenter, network): """Detail a topic.""" manager = SoftLayer.MessagingManager(env.client) mq_client = manager.get_connection(account_id, datacenter=datacenter, network=network) topic = mq_client.get_topic(topic_name) subscriptions = mq_client.get_subscriptions(topic_name) tables = [] for sub in subscriptions['items']: tables.append(mq.subscription_table(sub)) env.fout([mq.topic_table(topic), tables])
def cli(env, account_id, topic_name, datacenter, network, visibility_interval, expiration, tag): """Create a new topic.""" manager = SoftLayer.MessagingManager(env.client) mq_client = manager.get_connection(account_id, datacenter=datacenter, network=network) topic = mq_client.create_topic( topic_name, visibility_interval=visibility_interval, expiration=expiration, tags=tag, ) return mq.topic_table(topic)