Ejemplo n.º 1
0
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])
Ejemplo n.º 2
0
def cli(env, account_id, topic_name, datacenter, network, sub_type, queue_name, http_method, http_url, http_body):
    """Create a subscription on a topic."""

    manager = SoftLayer.MessagingManager(env.client)
    mq_client = manager.get_connection(account_id, datacenter=datacenter, network=network)
    if sub_type == "queue":
        subscription = mq_client.create_subscription(topic_name, "queue", queue_name=queue_name)
    elif sub_type == "http":
        subscription = mq_client.create_subscription(
            topic_name, "http", method=http_method, url=http_url, body=http_body
        )
    return mq.subscription_table(subscription)
Ejemplo n.º 3
0
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, sub_type, queue_name,
        http_method, http_url, http_body):
    """Create a subscription on a topic."""

    manager = SoftLayer.MessagingManager(env.client)
    mq_client = manager.get_connection(account_id,
                                       datacenter=datacenter,
                                       network=network)
    if sub_type == 'queue':
        subscription = mq_client.create_subscription(topic_name,
                                                     'queue',
                                                     queue_name=queue_name)
    elif sub_type == 'http':
        subscription = mq_client.create_subscription(
            topic_name,
            'http',
            method=http_method,
            url=http_url,
            body=http_body,
        )
    env.fout(mq.subscription_table(subscription))