Пример #1
0
def upsert(is_post, name, password, username, auth_scheme, enable, interface,
           timeout, pool_size, host, port, retry_delay, tls_cipher_suite,
           enable_tls, rdp, **kwargs):
    try:
        logging.debug('start')

        dict = {}

        add_if(dict, password, 'authenticationHttpBasicPassword', password)
        add_if(dict, username, 'authenticationHttpBasicUsername', username)
        add_if(dict, auth_scheme, 'authenticationScheme', auth_scheme)

        add_if(dict, enable, 'enabled')
        add_if(dict, interface, 'localInterface', interface)
        add_if(dict, timeout, 'maxPostWaitTime', timeout)
        add_if(dict, pool_size, 'outgoingConnectionCount', pool_size)
        add_if(dict, host, 'remoteHost', host)
        add_if(dict, port, 'remotePort', port)

        add_if(dict, name, 'restConsumerName', name)
        add_if(dict, rdp, 'restDeliveryPointName', rdp)

        add_if(dict, retry_delay, 'retryDelay', retry_delay)
        add_if(dict, tls_cipher_suite, 'tlsCipherSuiteList', tls_cipher_suite)
        add_if(dict, enable_tls, 'tlsEnabled')

        rest_mgr = RestMgr(kwargs)
        if is_post:
            rest_mgr.post(f'{suburl1}/{rdp}/{suburl}', dict)
        else:
            rest_mgr.patch(f'{suburl1}/{rdp}/{suburl}', name, dict)
    except Exception as ex:
        logger.error(f"upsert Exception: {ex}")
Пример #2
0
def upsert(is_post, name, client_profile, enable, **kwargs):
    try:
        logging.debug('start')

        dict = {}

        add_if(dict, client_profile, 'clientProfileName', client_profile)
        add_if(dict, enable, 'enabled')
        add_if(dict, name, 'restDeliveryPointName', name)

        rest_mgr = RestMgr(kwargs)
        if is_post:
            rest_mgr.post(suburl, dict)
        else:
            rest_mgr.patch(suburl, name, dict)
    except Exception as ex:
        logger.error(f"upsert Exception: {ex}")
Пример #3
0
def upsert(is_post, name, enable_egress, enable_ingress, max_spool, **kwargs):
    try:
        logging.debug('start')

        dict = {}

        add_if(dict, enable_egress, 'egressEnabled')
        add_if(dict, enable_ingress, 'ingressEnabled')
        add_if(dict, max_spool, 'maxSpoolUsage', max_spool, 0)
        add_if(dict, name, 'replayLogName', name)

        rest_mgr = RestMgr(kwargs)
        if is_post:
            rest_mgr.post(suburl, dict)
        else:
            rest_mgr.patch(suburl, name, dict)
    except Exception as ex:
        logger.error(f"upsert Exception: {ex}")
Пример #4
0
def upsert(is_post, name, replace_request_target, request_target, rdp,
           **kwargs):
    try:
        logging.debug('start')

        dict = {}

        add_if(dict, replace_request_target,
               'gatewayReplaceTargetAuthorityEnabled')
        add_if(dict, request_target, 'postRequestTarget', request_target)
        add_if(dict, name, 'queueBindingName', name)
        add_if(dict, rdp, 'restDeliveryPointName', rdp)

        rest_mgr = RestMgr(kwargs)
        if is_post:
            rest_mgr.post(f'{suburl1}/{rdp}/{suburl}', dict)
        else:
            rest_mgr.patch(f'{suburl1}/{rdp}/{suburl}', name, dict)
    except Exception as ex:
        logger.error(f"upsert Exception: {ex}")
Пример #5
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)
Пример #6
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)
Пример #7
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)
Пример #8
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)
Пример #9
0
def cf_update(ctx, name, enable_dup_clientid, client_description, client_id,
              enable_dynamic_durable, enable_dynamic_ttl, receive_ack_timeout,
              receive_reconnect_count, receive_reconnect_wait, receive_window,
              receive_window_threshold, send_ack_timeout, send_window,
              persistent, dmq_eligible, eliding_eligible, enable_jmx_userid,
              text_as_binary, compression_level, connect_retry_count,
              connect_retry_per_host_count, connect_timeout, direct_transport,
              keepalive_count, enable_keepalive, keepalive_interval,
              enable_callback_io_thread, enable_optimize_for_direct,
              transport_port, read_timeout, receive_buffer_size,
              reconnect_retry_count, reconnect_retry_wait, send_buffer_size,
              tcp_no_delay, xa, **kwargs):
    try:
        logging.debug(kwargs)
        logging.debug(f'update ')
        dict = {}

        if enable_dup_clientid is not None:
            dict['allowDuplicateClientIdEnabled'] = enable_dup_clientid
        if client_description is not None:
            dict['clientDescription'] = client_description
        if client_id is not None: dict['clientId'] = client_id
        if enable_dynamic_durable is not None:
            dict[
                'dynamicEndpointCreateDurableEnabled'] = enable_dynamic_durable
        if enable_dynamic_ttl is not None:
            dict['dynamicEndpointRespectTtlEnabled'] = enable_dynamic_ttl
        if receive_ack_timeout is not None:
            dict['guaranteedReceiveAckTimeout'] = receive_ack_timeout
        if receive_reconnect_count is not None:
            dict[
                'guaranteedReceiveReconnectRetryCount'] = receive_reconnect_count
        if receive_reconnect_wait is not None:
            dict[
                'guaranteedReceiveReconnectRetryWait'] = receive_reconnect_wait
        if receive_window is not None:
            dict['guaranteedReceiveWindowSize'] = receive_window
        if receive_window_threshold is not None:
            dict[
                'guaranteedReceiveWindowSizeAckThreshold'] = receive_window_threshold
        if send_ack_timeout is not None:
            dict['guaranteedSendAckTimeout'] = send_ack_timeout
        if send_window is not None:
            dict['guaranteedSendWindowSize'] = send_window
        if persistent is not None:
            dict['messagingDefaultDeliveryMode'] = persistent
        if dmq_eligible is not None:
            dict['messagingDefaultDmqEligibleEnabled'] = dmq_eligible
        if eliding_eligible is not None:
            dict['messagingDefaultElidingEligibleEnabled'] = eliding_eligible
        if enable_jmx_userid is not None:
            dict['messagingJmsxUserIdEnabled'] = enable_jmx_userid
        if text_as_binary is not None:
            dict['messagingTextInXmlPayloadEnabled'] = text_as_binary
        if compression_level is not None:
            dict['transportCompressionLevel'] = compression_level
        if connect_retry_count is not None:
            dict['transportConnectRetryCount'] = connect_retry_count
        if connect_retry_per_host_count is not None:
            dict[
                'transportConnectRetryPerHostCount'] = connect_retry_per_host_count
        if connect_timeout is not None:
            dict['transportConnectTimeout'] = connect_timeout
        if direct_transport is not None:
            dict['transportDirectTransportEnabled'] = direct_transport
        if keepalive_count is not None:
            dict['transportKeepaliveCount'] = keepalive_count
        if enable_keepalive is not None:
            dict['transportKeepaliveEnabled'] = enable_keepalive
        if keepalive_interval is not None:
            dict['transportKeepaliveInterval'] = keepalive_interval
        if enable_callback_io_thread is not None:
            dict[
                'transportMsgCallbackOnIoThreadEnabled'] = enable_callback_io_thread
        if enable_optimize_for_direct is not None:
            dict['transportOptimizeDirectEnabled'] = enable_optimize_for_direct
        if transport_port is not None: dict['transportPort'] = transport_port
        if read_timeout is not None:
            dict['transportReadTimeout'] = read_timeout
        if receive_buffer_size is not None:
            dict['transportReceiveBufferSize'] = receive_buffer_size
        if reconnect_retry_count is not None:
            dict['transportReconnectRetryCount'] = reconnect_retry_count
        if reconnect_retry_wait is not None:
            dict['transportReconnectRetryWait'] = reconnect_retry_wait
        if send_buffer_size is not None:
            dict['transportSendBufferSize'] = send_buffer_size
        if tcp_no_delay is not None:
            dict['transportTcpNoDelayEnabled'] = tcp_no_delay
        if xa is not None: dict['xaEnabled'] = xa

        rest_mgr = RestMgr(kwargs)
        rest_mgr.patch('jndiConnectionFactories', name, dict)

    except Exception as ex:
        logger.error(f"END + {ex}")