Example #1
0
class CommonSubData:
    common = ('is_internal', 'topic_name', 'active_status', 'endpoint_type',
              'endpoint_id', 'endpoint_name', 'delivery_method',
              'delivery_data_format', 'delivery_batch_size',
              Bool('wrap_one_msg_in_list'), 'delivery_max_retry',
              Bool('delivery_err_should_block'), 'wait_sock_err',
              'wait_non_sock_err', 'server_id', 'out_http_method',
              'out_http_method', 'creation_time',
              DateTime('last_interaction_time'), 'last_interaction_type',
              'last_interaction_details', Int('total_depth'),
              Int('current_depth_gd'), Int('current_depth_non_gd'), 'sub_key',
              'has_gd', 'is_staging_enabled', 'sub_id', 'name',
              AsIs('ws_ext_client_id'), AsIs('ext_client_id'), 'topic_id')
    amqp = ('out_amqp_id', 'amqp_exchange', 'amqp_routing_key')
    files = ('files_directory_list', )
    ftp = ('ftp_directory_list', )
    pubapi = ('security_id', )
    rest = ('out_rest_http_soap_id', 'rest_delivery_endpoint')
    service = ('service_id', )
    sms_twilio = ('sms_twilio_from', 'sms_twilio_to_list')
    smtp = (Bool('smtp_is_html'), 'smtp_subject', 'smtp_from', 'smtp_to_list',
            'smtp_body')
    soap = ('out_soap_http_soap_id', 'soap_delivery_endpoint')
    wsx = ('ws_channel_id', 'ws_channel_name',
           AsIs('ws_pub_client_id'), 'sql_ws_client_id',
           Bool('unsub_on_wsx_close'), Opaque('web_socket'))
Example #2
0
 class SimpleIO(AdminSIO):
     request_elem = 'zato_cloud_aws_s3_create_request'
     response_elem = 'zato_cloud_aws_s3_create_response'
     input_required = ('cluster_id', 'name', 'is_active', 'pool_size', 'address', Int('debug_level'),
         Bool('suppr_cons_slashes'), 'content_type', 'security_id', Bool('encrypt_at_rest'), 'storage_class')
     input_optional = ('metadata_', 'bucket')
     output_required = ('id', 'name')
Example #3
0
def _get_sio_msg():

    meta = (Int('limit'), 'next', Int('offset'), 'previous',
            Int('total_count'))

    location = Nested('location', 'building',
                      Bool('confidential'), 'flat_number', 'level',
                      Dict('point', 'lat', 'non'), 'postcode', 'state',
                      'street_name', 'street_number', 'street_suffix',
                      'street_type', 'suburb', 'unit')

    phones = ListOfDicts('phones', 'comment', Bool('confidential'), 'kind',
                         'number')

    postal_address = Dict('postal_address', Bool('confidential'), 'line1',
                          'line2', 'postcode', 'state', 'suburb')

    objects = (List('also_known_as'), 'catchment', 'description',
               ListOfDicts('emails'), Int('id'), Bool('is_mobile'),
               'last_updated', location, 'name', Bool('ndis_approved'),
               Dict('organisation', 'id',
                    'name'), 'parking_info', phones, postal_address,
               'provider_type', 'public_transport_info', 'type', 'web')

    return [Nested('meta', meta), Nested('objects', objects)]
Example #4
0
 class SimpleIO(BaseSIO):
     input_required = 'current_app',
     input_optional = 'ust', 'current_ust', AsIs('user_id'), 'name', 'value', Opaque('data'), Bool('decrypt'), \
         Bool('serialize_dt'), Int('expiration'), Bool('encrypt'), 'target_ust'
     output_optional = BaseSIO.output_optional + (Bool('found'), 'result', 'name', 'value', 'creation_time',
         'last_modified', 'expiration_time', 'is_encrypted')
     default_value = _invalid
Example #5
0
 class SimpleIO(AdminSIO):
     input_required = ('cluster_id', 'cache_id')
     output_required = ('name', 'is_active', 'is_default', 'cache_type',
                        Int('max_size'), Int('max_item_size'),
                        Bool('extend_expiry_on_get'),
                        Bool('extend_expiry_on_set'), 'sync_method',
                        'persistent_storage', Int('current_size'))
Example #6
0
 class SimpleIO(AdminSIO):
     input_required = ('cluster_id', AsIs('msg_id'), 'mime_type')
     input_optional = ('data', Int('expiration'), AsIs('correl_id'),
                       AsIs('in_reply_to'), Int('priority'),
                       Bool('exp_from_now'))
     output_required = (Bool('found'), )
     output_optional = ('expiration_time', Int('size'))
Example #7
0
 class SimpleIO(object):
     input_required = ('item_type', 'item')
     input_optional = ('max', 'dir', 'format', 'mime_type', Int('priority'),
                       Int('expiration'), AsIs('msg_id'), Bool('ack'),
                       Bool('reject'))
     default = ZATO_NONE
     use_channel_params_only = True
Example #8
0
    def test_sio(self):

        self.assertEquals(self.sio.request_elem, 'zato_http_soap_create_request')
        self.assertEquals(self.sio.response_elem, 'zato_http_soap_create_response')
        self.assertEquals(self.sio.input_required, ('cluster_id', 'name', 'is_active', 'connection', 'transport', 'is_internal', 'url_path'))
        self.assertEquals(self.sio.input_optional, ('service', 'security_id', 'method', 'soap_action', 'soap_version', 'data_format', 'host', 
            'ping_method', 'pool_size', ForceTypeWrapper(Bool('merge_url_params_req')), 'url_params_pri', 'params_pri',
            'serialization_type', 'timeout', 'sec_tls_ca_cert_id', ForceTypeWrapper(Bool('has_rbac')), 'content_type'))
        self.assertEquals(self.sio.output_required, ('id', 'name'))
        self.assertEquals(self.sio.namespace, zato_namespace)
        self.assertRaises(AttributeError, getattr, self.sio, 'output_optional')
        self.assertRaises(AttributeError, getattr, self.sio, 'output_repeated')
Example #9
0
    def test_nested_from_json(self):

        n = Nested('elem', 'sub1', Bool('my_bool1'), 'sub2', 'sub3', Dict('my_dict1', 'key1', 'key2'))

        expected_sub1_1 = rand_string()
        expected_sub2_1 = rand_string()
        expected_sub3_1 = rand_string()
        expected_my_bool1_1 = rand_bool()
        expected_key1_1 = rand_string()
        expected_key2_1 = rand_string()

        value1 = {'elem': {
            'sub1': expected_sub1_1,
            'sub2': expected_sub2_1,
            'my_bool1': expected_my_bool1_1,
            'sub3': expected_sub3_1,
            'my_dict1' : {
                'key1': expected_key1_1,
                'key2': expected_key2_1,
            }
        }}

        ret_value = n.from_json(value1)

        eq_(ret_value,
            {'elem':
             {'my_bool1': expected_my_bool1_1, 'sub2': expected_sub2_1, 'sub3': expected_sub3_1,
              'my_dict1': {'key2': expected_key2_1, 'key1': expected_key1_1},
              'sub1': expected_sub1_1}}
        )
Example #10
0
    def test_nested_to_json(self):

        n = Nested('elem', 'sub1', Bool('my_bool1'), 'sub2', 'sub3', Dict('my_dict1', 'key1', 'key2'))

        expected_sub1_2 = rand_string()
        expected_sub2_2 = rand_string()
        expected_sub3_2 = rand_string()
        expected_my_bool1_2 = rand_bool()
        expected_key1_2 = rand_string()
        expected_key2_2 = rand_string()

        value2 = {'elem': {
            'sub1': expected_sub1_2,
            'sub2': expected_sub2_2,
            'my_bool1': expected_my_bool1_2,
            'sub3': expected_sub3_2,
            'my_dict1' : {
                'key1': expected_key1_2,
                'key2': expected_key2_2,
            }
        }}

        ret_value = n.to_json(value2)

        eq_(ret_value,
            {'elem':
             {'my_bool1': expected_my_bool1_2, 'sub2': expected_sub2_2, 'sub3': expected_sub3_2,
              'my_dict1': {'key2': expected_key2_2, 'key1': expected_key1_2},
              'sub1': expected_sub1_2}}
        )
Example #11
0
 class SimpleIO:
     response_elem = None
     input_required = ('key',)
     input_optional = (Bool('return_prev'),)
     output_optional = optional_keys
     skip_empty_keys = True
     allow_empty_required = True
Example #12
0
class _CreateEditSIO(AdminSIO):
    input_required = ('name', 'type_', 'is_active', 'is_internal', 'is_channel', 'is_outconn', Int('pool_size'),
        Bool('sec_use_rbac'), 'cluster_id')
    input_optional = ('id', Int('cache_expiry'), 'address', Int('port'), Int('timeout'), 'data_format', 'version',
        'extra', 'username', 'username_type', 'secret', 'secret_type', 'conn_def_id', 'cache_id') + \
        extra_secret_keys + generic_attrs
    force_empty_keys = True
Example #13
0
 class SimpleIO(_CtxInputUsing.SimpleIO):
     input_required = ('ust', 'current_app')
     input_optional = (AsIs('user_id'), 'username', 'email', 'display_name', 'first_name', 'middle_name', 'last_name',
         'sign_up_status', 'approval_status', Bool('paginate'), Int('cur_page'), Int('page_size'), 'name_op',
         'is_name_exact')
     output_required = ('status',)
     output_optional = BaseSIO.output_optional + (Int('total'), Int('num_pages'), Int('page_size'), Int('cur_page'),
         'has_next_page', 'has_prev_page', Int('next_page'), Int('prev_page'), List('result'))
     default_value = _invalid
Example #14
0
    class SimpleIO(BaseSIO):
        input_required = ('ust', 'current_app')
        input_optional = (AsIs('user_id'), 'username', 'password',
                          Bool('password_must_change'), 'password_expiry',
                          'display_name', 'first_name', 'middle_name',
                          'last_name', 'email', 'is_locked', 'sign_up_status',
                          'approval_status', 'is_rate_limit_active',
                          'rate_limit_def', 'is_totp_enabled', 'totp_key',
                          'totp_label', Bool('auto_approve'))

        output_optional = BaseSIO.output_optional + (
            AsIs('user_id'), 'username', 'email', 'display_name', 'first_name',
            'middle_name', 'last_name', 'is_active', 'is_internal',
            'is_super_user', 'is_approval_needed', 'approval_status',
            'approval_status_mod_time', 'approval_status_mod_by', 'is_locked',
            'locked_time', 'creation_ctx', 'locked_by', 'approv_rej_time',
            'approv_rej_by', 'password_expiry', 'password_is_set',
            'password_must_change', 'password_last_set', 'sign_up_status',
            'sign_up_time', 'is_totp_enabled', 'totp_label')

        default_value = _invalid
Example #15
0
 def test_sio(self):
     self.assertEquals(self.sio.request_elem,
                       'zato_http_soap_get_list_request')
     self.assertEquals(self.sio.response_elem,
                       'zato_http_soap_get_list_response')
     self.assertEquals(self.sio.input_required,
                       ('cluster_id', 'connection', 'transport'))
     self.assertEquals(self.sio.input_optional,
                       GetListAdminSIO.input_optional)
     self.assertEquals(
         self.sio.output_required,
         ('id', 'name', 'is_active', 'is_internal', 'url_path'))
     self.assertEquals(
         self.sio.output_optional,
         ('service_id', 'service_name', 'security_id', 'security_name',
          'sec_type', 'method', 'soap_action', 'soap_version',
          'data_format', 'host', 'ping_method', 'pool_size',
          'merge_url_params_req', 'url_params_pri', 'params_pri',
          'serialization_type', 'timeout', 'sec_tls_ca_cert_id',
          Bool('has_rbac'), 'content_type', Bool('sec_use_rbac')))
     self.assertEquals(self.sio.namespace, zato_namespace)
Example #16
0
    class SimpleIO:
        input_required = (AsIs('is_a'), Boolean('b'), Bool('c'), CSV('d'),
                          Dict('e'), Float('f'), Int('g'), Integer('h'),
                          List('i'), ListOfDicts('j'), Nested('k'),
                          Opaque('l'), Unicode('m'), UTC('n'))

        input_optional = (AsIs('is_aa'), Boolean('bb'), Bool('cc'), CSV('dd'),
                          Dict('ee'), Float('ff'), Int('gg'), Integer('hh'),
                          List('ii'), ListOfDicts('jj'), Nested('kk'),
                          Opaque('ll'), Unicode('mm'), UTC('nn'))

        output_required = (AsIs('is_aaa'), Boolean('bbb'), Bool('ccc'),
                           CSV('ddd'), Dict('eee'), Float('fff'), Int('ggg'),
                           Integer('hhh'), List('iii'), ListOfDicts('jjj'),
                           Nested('kkk'), Opaque('lll'), Unicode('mmm'),
                           UTC('nnn'))

        output_optional = (AsIs('is_aaaa'), Boolean('bbbb'), Bool('cccc'),
                           CSV('dddd'), Dict('eeee'), Float('ffff'),
                           Int('gggg'), Integer('hhhh'), List('iiii'),
                           ListOfDicts('jjjj'), Nested('kkkk'), Opaque('llll'),
                           Unicode('mmmm'), UTC('nnnn'))
Example #17
0
 class SimpleIO(BaseSIO):
     input_required = ('ust', 'current_app', 'new_password')
     input_optional = (AsIs('user_id'), 'old_password',
                       Int('password_expiry'), Bool('must_change'))
Example #18
0
 class SimpleIO(AdminSIO):
     input_required = ('cluster_id', 'topic_id')
     input_optional = (Bool('paginate'), Int('cur_page'), 'query')
     output_required = (AsIs('_meta'), )
     output_optional = (AsIs('response'), )
     response_elem = None
Example #19
0
get_list_docs = 'pub/sub topics'
broker_message = BROKER_MSG_PUBSUB
broker_message_prefix = 'TOPIC_'
list_func = pubsub_topic_list
skip_input_params = [
    'is_internal', 'current_depth_gd', 'last_pub_time', 'last_pub_msg_id',
    'last_endpoint_id', 'last_endpoint_name'
]
input_optional_extra = ['needs_details', 'on_no_subs_pub']
output_optional_extra = [
    'is_internal',
    Int('current_depth_gd'),
    Int('current_depth_non_gd'), 'last_pub_time', 'hook_service_name',
    'last_pub_time',
    AsIs('last_pub_msg_id'), 'last_endpoint_id', 'last_endpoint_name',
    Bool('last_pub_has_gd'), 'last_pub_server_pid', 'last_pub_server_name',
    'on_no_subs_pub'
]

# ################################################################################################################################

sub_broker_attrs = ('active_status', 'active_status', 'cluster_id',
                    'creation_time', 'endpoint_id', 'has_gd', 'id',
                    'is_durable', 'is_internal', 'name', 'out_amqp_id',
                    'out_http_soap_id', 'sub_key', 'topic_id', 'ws_channel_id',
                    'ws_sub_id', 'delivery_group_size')

# ################################################################################################################################


def broker_message_hook(self, input, instance, attrs, service_type):
Example #20
0
 class SimpleIO(AdminSIO):
     input_required = ('cluster_id', AsIs('msg_id'))
     output_required = (Bool('found'), )
Example #21
0
 class SimpleIO(AdminSIO):
     input_required = ('cluster_id', AsIs('msg_id'))
     output_optional = ('topic_id', 'topic_name', AsIs('msg_id'), AsIs('correl_id'), 'in_reply_to', 'pub_time', \
         'ext_pub_time', 'pattern_matched', 'priority', 'data_format', 'mime_type', 'size', 'data',
         'expiration', 'expiration_time', 'endpoint_id', 'endpoint_name', Bool('has_gd'),
         'pub_hook_service_id', 'pub_hook_service_name', AsIs('ext_client_id'))
Example #22
0
 class SimpleIO:
     input_optional = 'topic_name', List('topic_name_list'), Bool(
         'wrap_one_msg_in_list'), Int('delivery_batch_size')
     output_optional = 'sub_key', 'current_depth', 'sub_data'
     response_elem = None
     skip_empty_keys = True
Example #23
0
output_optional_extra = ['ws_channel_name', 'sec_id', 'sec_type', 'sec_name', 'sub_key']
delete_require_instance = False

# ################################################################################################################################

msg_pub_attrs_sio = []

for name in msg_pub_attrs:
    if name in ('topic', 'is_in_sub_queue', 'position_in_group', 'group_id'):
        continue
    elif name.endswith('_id'):
        msg_pub_attrs_sio.append(AsIs(name))
    elif name in ('position_in_group', 'priority', 'size', 'delivery_count'):
        msg_pub_attrs_sio.append(Int(name))
    elif name.startswith(('has_', 'is_')):
        msg_pub_attrs_sio.append(Bool(name))
    else:
        msg_pub_attrs_sio.append(name)

# ################################################################################################################################

_meta_endpoint_key = COMMON_PUBSUB.REDIS.META_ENDPOINT_PUB_KEY

# ################################################################################################################################

_sub_skip_update = ('id', 'sub_id', 'sub_key', 'cluster_id', 'creation_time', 'current_depth', 'endpoint_id', 'endpoint_type',
    'last_interaction_time', 'staging_depth', 'sql_ws_client_id', 'topic_name', 'total_depth', 'web_socket',
    'out_rest_http_soap_id', 'out_soap_http_soap_id', 'out_http_soap_id')

# ################################################################################################################################
Example #24
0
 class SimpleIO:
     input_optional = ('cluster_id', 'query', Bool('return_internal'))
Example #25
0
class GetListAdminSIO(object):
    namespace = zato_namespace
    input_optional = (Int('cur_page'), Bool('paginate'), 'query')
Example #26
0
 class SimpleIO:
     input_optional = ('cluster_id', 'query', Bool('return_internal'),
                       'include', 'exclude', 'needs_sphinx',
                       'needs_api_invoke', 'needs_rest_channels',
                       'api_invoke_path')
Example #27
0
 class SimpleIO(AdminSIO):
     input_required = ('cluster_id', 'cache_id', 'key', 'value',
                       Bool('replace_existing'))
     input_optional = ('key_data_type', 'value_data_type', Float('expiry'))
Example #28
0
# globre
from globre import match as globre_match

# Zato
from zato.common import NOTIF as COMMON_NOTIF, ZATO_NONE
from zato.common.broker_message import NOTIF
from zato.common.odb.model import Cluster, NotificationOpenStackSwift, Service
from zato.common.odb.query import notif_cloud_openstack_swift_list
from zato.server.service import Bool, SIOElem, Int
from zato.server.service.internal.notif import NotifierService
from zato.server.service.internal import AdminService, AdminSIO

# ################################################################################################################################

common_required = ('name', 'is_active', 'def_id', 'containers',
                   Int('interval'), 'name_pattern', Bool('name_pattern_neg'),
                   Bool('get_data'), Bool('get_data_patt_neg'), 'service_name')

common_optional = ('get_data_patt', )

# ################################################################################################################################


class GetList(AdminService):
    """ Returns a list of OpenStack Swift notification definitions.
    """
    _filter_by = NotificationOpenStackSwift.name,

    class SimpleIO(AdminSIO):
        request_elem = 'zato_notif_cloud_openstack_swift_get_list_request'
        response_elem = 'zato_notif_cloud_openstack_swift_get_list_response'
Example #29
0
 class SimpleIO(AdminSIO):
     input_required = ('cluster_id', 'cache_id', 'key')
     output_required = (Bool('key_found'), )
     output_optional = ('key', 'value', 'is_key_integer',
                        'is_value_integer', Float('expiry'))
Example #30
0
 class SimpleIO(AdminSIO):
     input_required = ('cluster_id', 'cache_id', 'key')
     output_required = (Bool('key_found'), )