Пример #1
0
def update(name, default_connect, default_publish, default_subscribe,
           default_share, **kwargs):
    '''Update an existing ACL Profile'''
    dict = {}
    add_if(dict, default_connect, 'clientConnectDefaultAction', 'allow',
           'disallow')
    add_if(dict, default_publish, 'publishTopicDefaultAction', 'allow',
           'disallow')
    add_if(dict, default_subscribe, 'subscribeTopicDefaultAction', 'allow',
           'disallow')
    add_if(dict, default_share, 'subscribeShareNameDefaultAction', 'allow',
           'disallow')
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.patch(suburl, name, dict)
    send_response(res)
Пример #2
0
def create(name, default_connect, default_publish, default_subscribe,
           default_share, **kwargs):
    '''Create a new ACL Profile'''
    dict = {
        'aclProfileName':
        name,
        'clientConnectDefaultAction':
        'allow' if default_connect else 'disallow',
        'publishTopicDefaultAction':
        'allow' if default_publish else 'disallow',
        'subscribeTopicDefaultAction':
        'allow' if default_subscribe else 'disallow',
        'subscribeShareNameDefaultAction':
        'allow' if default_share else 'disallow',
    }
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.post(suburl, dict)
    send_response(res)
Пример #3
0
def upsert(is_post, name, acl_profile, client_profile, enable,
           gm_perm_override, password, subscription_manager, **kwargs):
    dict = {}

    add_if(dict, acl_profile, 'clientUsername', name)
    add_if(dict, acl_profile, 'aclProfileName', acl_profile)
    add_if(dict, client_profile, 'clientProfileName', client_profile)
    add_if(dict, enable, 'enabled')
    add_if(dict, gm_perm_override,
           'guaranteedEndpointPermissionOverrideEnabled')
    add_if(dict, password, 'password', password)
    add_if(dict, subscription_manager, 'subscriptionManagerEnabled')

    rest_mgr = RestMgr(kwargs)
    if is_post:
        res = rest_mgr.post('clientUsernames', dict)
    else:
        res = rest_mgr.patch('clientUsernames', name, dict)
    send_response(res)
Пример #4
0
def upsert(is_post, qname, exclusive, ack_propagation, dmq, egress, ingress,
           max_bind, max_unacked, max_msg_size, max_spool, max_redelivery, ttl,
           owner, perm, low_priority, low_priority_msg_limit,
           reject_on_discard, respect_priority, respect_ttl, **kwargs):
    # try:
    dict = {}

    add_if(dict, qname, 'queueName', qname)
    add_if(dict, exclusive, 'accessType', 'exclusive', 'non-exclusive')
    add_if(dict, ack_propagation, 'consumerAckPropagationEnabled',
           ack_propagation)
    add_if(dict, dmq, 'deadMsgQueue', dmq)
    add_if(dict, egress, 'egressEnabled', egress)
    add_if(dict, ingress, 'ingressEnabled', ingress)
    add_if(dict, max_bind, 'maxBindCount', max_bind, 0)
    add_if(dict, max_unacked, 'maxDeliveredUnackedMsgsPerFlow', max_unacked, 0)
    add_if(dict, max_msg_size, 'maxMsgSize', max_msg_size, 0)
    add_if(dict, max_spool, 'maxMsgSpoolUsage', max_spool, 0)
    add_if(dict, max_redelivery, 'maxRedeliveryCount', max_redelivery, 0)
    add_if(dict, ttl, 'maxTtl', ttl, 0)
    add_if(dict, owner, 'owner', owner, '')
    add_if(dict, perm, 'permission', perm_map[perm] if perm else '', '')
    add_if(dict, low_priority, 'rejectLowPriorityMsgEnabled', low_priority)
    add_if(dict, low_priority_msg_limit, 'rejectLowPriorityMsgLimit',
           low_priority_msg_limit, 0)
    add_if(dict, reject_on_discard, 'rejectMsgToSenderOnDiscardBehavior',
           reject_on_discard)
    add_if(dict, respect_priority, 'respectMsgPriorityEnabled',
           respect_priority)
    add_if(dict, respect_ttl, 'respectTtlEnabled', respect_ttl)

    # logging.debug(dict)

    rest_mgr = RestMgr(kwargs)
    if is_post:
        res = rest_mgr.post(suburl, dict)
    else:
        res = rest_mgr.patch(suburl, qname, dict)
    send_response(res)
Пример #5
0
def remove(name, **kwargs):
    '''Remove an ACL Profile'''
    logger.debug(f"remove {name}")
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.delete(suburl, name)
    send_response(res)
Пример #6
0
def list(**kwargs):
    '''List all the ACL Profiles in the Message VPN'''
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.get(suburl)
    send_response(res)
Пример #7
0
def show(name, **kwargs):
    '''Show the details of an existing ACL Profile'''
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.get(suburl, name)
    send_response(res)
Пример #8
0
def remove(name, **kwargs):
    '''Remove a client username'''
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.delete(suburl, name)
    send_response(res)
Пример #9
0
def list(**kwargs):
    '''List all client usernames in the Message VPN'''
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.get(suburl)
    send_response(res)
Пример #10
0
def show(name, **kwargs):
    '''Show details of an existing client username'''
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.get(suburl, name)
    send_response(res)
Пример #11
0
def list(**kwargs):
    '''List all the queues'''
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.get(f'{suburl}', None)
    send_response(res)
Пример #12
0
def remove(qname, **kwargs):
    '''Remove an existing queue'''
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.delete(suburl, qname)
    send_response(res)
Пример #13
0
def show(qname, **kwargs):
    '''Dump the properties of an existing queue'''
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.get(suburl, qname)
    send_response(res)
Пример #14
0
def show(name, **kwargs):
    '''Show the properties of a client profile'''
    rest_mgr = RestMgr(kwargs)
    res = rest_mgr.get(suburl, name)
    send_response(res)
Пример #15
0
def clientprofile_upsert(
        is_post, name, enable_bridge, enable_cut_through,
        client_create_durability, enable_client_endpoint, enable_gm_receive,
        enable_gm_send, enable_shared, enable_tx, template_queue,
        template_topic_endpoint, compress, eliding_delay, enable_eliding,
        eliding_max_topics, max_client_connects, max_egress_flows,
        max_client_created_endpoints, max_ingress_flows, max_subscriptions,
        max_tx_sessions, max_client_tx, reject_no_subscription,
        enable_connect_standby, max_client_smf_connects, web_inactive_timeout,
        max_client_web_connects, max_web_payload, tcp_congestion_size,
        tcp_keepalive, tcp_keepalive_idle, tcp_keepalive_interval,
        tcp_max_segment_size, tcp_max_window_size, allow_tls_downgrade,
        **kwargs):
    dict = {}

    add_if(dict, enable_bridge, 'allowBridgeConnectionsEnabled')
    add_if(dict, enable_cut_through, 'allowCutThroughForwardingEnabled')
    add_if(dict, client_create_durability,
           'allowGuaranteedEndpointCreateDurability', client_create_durability)
    add_if(dict, enable_client_endpoint,
           'allowGuaranteedEndpointCreateEnabled')
    add_if(dict, enable_gm_receive, 'allowGuaranteedMsgReceiveEnabled')
    add_if(dict, enable_gm_send, 'allowGuaranteedMsgSendEnabled')
    add_if(dict, enable_shared, 'allowSharedSubscriptionsEnabled')
    add_if(dict, enable_tx, 'allowTransactedSessionsEnabled')
    add_if(dict, template_queue,
           'apiQueueManagementCopyFromOnCreateTemplateName', template_queue)
    add_if(dict, template_topic_endpoint,
           'apiTopicEndpointManagementCopyFromOnCreateTemplateName',
           template_topic_endpoint)
    add_if(dict, name, 'clientProfileName', name)
    add_if(dict, compress, 'compressionEnabled')
    add_if(dict, eliding_delay, 'elidingDelay', eliding_delay, 0)
    add_if(dict, enable_eliding, 'elidingEnabled')
    add_if(dict, eliding_max_topics, 'elidingMaxTopicCount',
           eliding_max_topics, 0)
    add_if(dict, max_client_connects, 'maxConnectionCountPerClientUsername',
           max_client_connects, 0)
    add_if(dict, max_egress_flows, 'maxEgressFlowCount', max_egress_flows, 0)
    add_if(dict, max_client_created_endpoints,
           'maxEndpointCountPerClientUsername', max_client_created_endpoints,
           0)
    add_if(dict, max_ingress_flows, 'maxIngressFlowCount', max_ingress_flows,
           0)
    add_if(dict, max_subscriptions, 'maxSubscriptionCount', max_subscriptions,
           0)
    add_if(dict, max_tx_sessions, 'maxTransactedSessionCount', max_tx_sessions,
           0)
    add_if(dict, max_client_tx, 'maxTransactionCount', max_client_tx, 0)
    add_if(dict, reject_no_subscription,
           'rejectMsgToSenderOnNoSubscriptionMatchEnabled')
    add_if(dict, enable_connect_standby,
           'replicationAllowClientConnectWhenStandbyEnabled')
    add_if(dict, max_client_smf_connects,
           'serviceSmfMaxConnectionCountPerClientUsername',
           max_client_smf_connects, 0)
    add_if(dict, web_inactive_timeout, 'serviceWebInactiveTimeout',
           web_inactive_timeout, 0)
    add_if(dict, max_client_web_connects,
           'serviceWebMaxConnectionCountPerClientUsername',
           max_client_web_connects, 0)
    add_if(dict, max_web_payload, 'serviceWebMaxPayload', max_web_payload, 0)
    add_if(dict, tcp_congestion_size, 'tcpCongestionWindowSize',
           tcp_congestion_size, 0)
    add_if(dict, tcp_keepalive, 'tcpKeepaliveCount', tcp_keepalive, 0)
    add_if(dict, tcp_keepalive_idle, 'tcpKeepaliveIdleTime',
           tcp_keepalive_idle, 0)
    add_if(dict, tcp_keepalive_interval, 'tcpKeepaliveInterval',
           tcp_keepalive_interval, 0)
    add_if(dict, tcp_max_segment_size, 'tcpMaxSegmentSize',
           tcp_max_segment_size, 0)
    add_if(dict, tcp_max_window_size, 'tcpMaxWindowSize', tcp_max_window_size,
           0)
    add_if(dict, allow_tls_downgrade, 'tlsAllowDowngradeToPlainTextEnabled')

    rest_mgr = RestMgr(kwargs)
    if is_post:
        res = rest_mgr.post(suburl, dict)
    else:
        res = rest_mgr.patch(suburl, name, dict)
    send_response(res)