示例#1
0
    def save_trigger(self, trigger, commit_and_initialize=True, flush=False):
        """ :type trigger: dart.model.trigger.Trigger """
        trigger_type_name = trigger.data.trigger_type_name
        if trigger_type_name == self._manual_trigger_processor.trigger_type(
        ).name:
            raise DartValidationException('manual triggers cannot be saved')
        trigger_processor = self._trigger_processors.get(trigger_type_name)
        if not trigger_processor:
            raise DartValidationException('unknown trigger_type_name: %s' %
                                          trigger_type_name)
        assert isinstance(trigger_processor, TriggerProcessor)
        trigger = default_and_validate(
            trigger,
            trigger_schema(
                trigger_processor.trigger_type().params_json_schema))

        trigger_dao = TriggerDao()
        trigger_dao.id = random_id()
        trigger_dao.data = trigger.data.to_dict()
        db.session.add(trigger_dao)
        if flush:
            db.session.flush()
        trigger = trigger_dao.to_model()
        if commit_and_initialize:
            db.session.commit()
            trigger = trigger_dao.to_model()
            try:
                trigger_processor.initialize_trigger(trigger, self)
            except:
                db.session.delete(trigger_dao)
                db.session.commit()
                raise
        return trigger
示例#2
0
    def save_trigger(self, trigger, commit_and_initialize=True, flush=False):
        """ :type trigger: dart.model.trigger.Trigger """
        trigger_type_name = trigger.data.trigger_type_name
        if trigger_type_name == self._manual_trigger_processor.trigger_type().name:
            raise DartValidationException('manual triggers cannot be saved')
        trigger_processor = self._trigger_processors.get(trigger_type_name)
        if not trigger_processor:
            raise DartValidationException('unknown trigger_type_name: %s' % trigger_type_name)
        assert isinstance(trigger_processor, TriggerProcessor)
        trigger = default_and_validate(trigger, trigger_schema(trigger_processor.trigger_type().params_json_schema))

        trigger_dao = TriggerDao()
        trigger_dao.id = random_id()
        trigger_dao.data = trigger.data.to_dict()
        db.session.add(trigger_dao)
        if flush:
            db.session.flush()
        trigger = trigger_dao.to_model()
        if commit_and_initialize:
            db.session.commit()
            trigger = trigger_dao.to_model()
            try:
                trigger_processor.initialize_trigger(trigger, self)
            except:
                db.session.delete(trigger_dao)
                db.session.commit()
                raise
        return trigger
示例#3
0
 def default_and_validate_trigger(self, trigger):
     trigger_type_name = trigger.data.trigger_type_name
     trigger_processor = self._trigger_processors.get(trigger_type_name)
     return default_and_validate(
         trigger,
         trigger_schema(
             trigger_processor.trigger_type().params_json_schema))
示例#4
0
    def __init__(self, action_service, datastore_service, workflow_service, manual_trigger_processor,
                 subscription_batch_trigger_processor, workflow_completion_trigger_processor,
                 event_trigger_processor, scheduled_trigger_processor, super_trigger_processor, filter_service):
        self._action_service = action_service
        self._datastore_service = datastore_service
        self._workflow_service = workflow_service
        self._manual_trigger_processor = manual_trigger_processor
        self._subscription_batch_trigger_processor = subscription_batch_trigger_processor
        self._workflow_completion_trigger_processor = workflow_completion_trigger_processor
        self._event_trigger_processor = event_trigger_processor
        self._scheduled_trigger_processor = scheduled_trigger_processor
        self._super_trigger_processor = super_trigger_processor
        self._filter_service = filter_service

        self._trigger_processors = {
            manual_trigger_processor.trigger_type().name: manual_trigger_processor,
            subscription_batch_trigger_processor.trigger_type().name: subscription_batch_trigger_processor,
            workflow_completion_trigger_processor.trigger_type().name: workflow_completion_trigger_processor,
            event_trigger_processor.trigger_type().name: event_trigger_processor,
            scheduled_trigger_processor.trigger_type().name: scheduled_trigger_processor,
            super_trigger_processor.trigger_type().name: super_trigger_processor,
        }

        params_schemas = []
        for name, processor in self._trigger_processors.iteritems():
            params_schemas.append(processor.trigger_type().params_json_schema)
        self._trigger_schemas = [trigger_schema(s) for s in params_schemas]
示例#5
0
 def test_trigger_schema(self):
     args = {'completed_workflow_id': 'ABC123'}
     state = None
     tr = Trigger(data=TriggerData('test-trigger', 'workflow_completion', ['ABC123'], args, state=state))
     obj_before = tr.to_dict()
     tr = default_and_validate(tr, trigger_schema(workflow_completion_trigger.params_json_schema))
     # state should be defaulted to INACTIVE
     self.assertNotEqual(obj_before, tr.to_dict())
示例#6
0
    def test_trigger_schema_invalid(self):
        with self.assertRaises(DartValidationException) as context:
            name = None
            args = {'completed_workflow_id': 'ABC123'}
            tr = Trigger(data=TriggerData(name, 'workflow_completion', ['ABC123'], args))
            # should fail because the name is missing
            default_and_validate(tr, trigger_schema(workflow_completion_trigger.params_json_schema))

        self.assertTrue(isinstance(context.exception, DartValidationException))
示例#7
0
def get_trigger_json_schema():
    trigger_type_name = request.args.get('trigger_type_name')
    trigger_id = request.args.get('trigger_id')

    if not trigger_type_name and not trigger_id:
        return {'results': trigger_schema(None)}

    if not trigger_type_name:
        trigger = trigger_service().get_trigger(trigger_id, raise_when_missing=False)
        if not trigger:
            return {'results': 'ERROR', 'error_message': 'trigger not found with id: %s' % trigger_id}, 400, None
        trigger_type_name = trigger.data.trigger_type_name

    trigger_type = trigger_service().get_trigger_type(trigger_type_name)
    if not trigger_type:
        return {'results': 'ERROR', 'error_message': 'unknown trigger_type: %s' % trigger_type_name}, 400, None

    return {'results': trigger_schema(trigger_type.params_json_schema)}
示例#8
0
def get_trigger_json_schema():
    trigger_type_name = request.args.get('trigger_type_name')
    trigger_id = request.args.get('trigger_id')

    if not trigger_type_name and not trigger_id:
        return {'results': trigger_schema(None)}

    if not trigger_type_name:
        trigger = trigger_service().get_trigger(trigger_id, raise_when_missing=False)
        if not trigger:
            return {'results': 'ERROR', 'error_message': 'trigger not found with id: %s' % trigger_id}, 400, None
        trigger_type_name = trigger.data.trigger_type_name

    trigger_type = trigger_service().get_trigger_type(trigger_type_name)
    if not trigger_type:
        return {'results': 'ERROR', 'error_message': 'unknown trigger_type: %s' % trigger_type_name}, 400, None

    return {'results': trigger_schema(trigger_type.params_json_schema)}
示例#9
0
    def save_trigger(self,
                     trigger,
                     commit_and_initialize=True,
                     flush=False,
                     user_id=None):
        wf_uuid = uuid.uuid4().hex  # to avoid uuid serialization issues
        trigger.data.tags = trigger.data.tags if (trigger.data.tags) else []
        trigger.data.tags.append(wf_uuid)
        if user_id:
            trigger.data.user_id = user_id
        """ :type trigger: dart.model.trigger.Trigger """
        trigger_type_name = trigger.data.trigger_type_name
        if trigger_type_name == self._manual_trigger_processor.trigger_type(
        ).name:
            raise DartValidationException('manual triggers cannot be saved')
        if trigger_type_name == self._retry_trigger_processor.trigger_type(
        ).name:
            raise DartValidationException('retry triggers cannot be saved')
        trigger_processor = self._trigger_processors.get(trigger_type_name)
        if not trigger_processor:
            raise DartValidationException('unknown trigger_type_name: %s' %
                                          trigger_type_name)
        assert isinstance(trigger_processor, TriggerProcessor)
        trigger = default_and_validate(
            trigger,
            trigger_schema(
                trigger_processor.trigger_type().params_json_schema))

        trigger_dao = TriggerDao()
        trigger_dao.id = random_id()
        if trigger_type_name == 'subscription_batch':
            sub = self._subscription_service.get_subscription(
                trigger.data.args['subscription_id'])
            if sub.data.nudge_id:
                response = self.update_nudge_with_trigger(
                    sub.data.nudge_id,
                    trigger.data.args['unconsumed_data_size_in_bytes'],
                    trigger_dao.id, trigger.data.trigger_type_name)
                assert (response.status_code == 200)
        trigger_dao.data = trigger.data.to_dict()
        db.session.add(trigger_dao)
        if flush:
            db.session.flush()
        trigger = trigger_dao.to_model()
        if commit_and_initialize:
            db.session.commit()
            trigger = trigger_dao.to_model()
            try:
                trigger_processor.initialize_trigger(trigger, self)
            except:
                db.session.delete(trigger_dao)
                db.session.commit()
                raise
        return trigger
示例#10
0
    def test_trigger_schema_invalid(self):
        with self.assertRaises(DartValidationException) as context:
            name = None
            args = {'completed_workflow_id': 'ABC123'}
            tr = Trigger(data=TriggerData(name, 'workflow_completion',
                                          ['ABC123'], args))
            # should fail because the name is missing
            default_and_validate(
                tr,
                trigger_schema(workflow_completion_trigger.params_json_schema))

        self.assertTrue(isinstance(context.exception, DartValidationException))
示例#11
0
 def test_trigger_schema(self):
     args = {'completed_workflow_id': 'ABC123'}
     state = None
     tr = Trigger(data=TriggerData('test-trigger',
                                   'workflow_completion', ['ABC123'],
                                   args,
                                   state=state))
     obj_before = tr.to_dict()
     tr = default_and_validate(
         tr, trigger_schema(workflow_completion_trigger.params_json_schema))
     # state should be defaulted to INACTIVE
     self.assertNotEqual(obj_before, tr.to_dict())
示例#12
0
文件: trigger.py 项目: ophiradi/dart
    def save_trigger(self,
                     trigger,
                     commit_and_initialize=True,
                     flush=False,
                     user_id=None):
        wf_uuid = uuid.uuid4().hex  # to avoid uuid serialization issues
        trigger.data.tags = trigger.data.tags if (trigger.data.tags) else []
        trigger.data.tags.append(wf_uuid)
        if user_id:
            trigger.data.user_id = user_id
        """ :type trigger: dart.model.trigger.Trigger """
        trigger_type_name = trigger.data.trigger_type_name
        if trigger_type_name == self._manual_trigger_processor.trigger_type(
        ).name:
            raise DartValidationException('manual triggers cannot be saved')
        if trigger_type_name == self._retry_trigger_processor.trigger_type(
        ).name:
            raise DartValidationException('retry triggers cannot be saved')
        trigger_processor = self._trigger_processors.get(trigger_type_name)
        if not trigger_processor:
            raise DartValidationException('unknown trigger_type_name: %s' %
                                          trigger_type_name)
        assert isinstance(trigger_processor, TriggerProcessor)
        trigger = default_and_validate(
            trigger,
            trigger_schema(
                trigger_processor.trigger_type().params_json_schema))

        trigger_dao = TriggerDao()
        trigger_dao.id = random_id()
        trigger_dao.data = trigger.data.to_dict()
        db.session.add(trigger_dao)
        if flush:
            db.session.flush()
        trigger = trigger_dao.to_model()
        if commit_and_initialize:
            db.session.commit()
            trigger = trigger_dao.to_model()
            try:
                trigger_processor.initialize_trigger(trigger, self)
            except:
                db.session.delete(trigger_dao)
                db.session.commit()
                raise
        return trigger
示例#13
0
    def save_trigger(self, trigger, commit_and_initialize=True, flush=False, user_id=None):
        wf_uuid = uuid.uuid4().hex  # to avoid uuid serialization issues
        trigger.data.tags = trigger.data.tags if (trigger.data.tags) else []
        trigger.data.tags.append(wf_uuid)
        if user_id:
            trigger.data.user_id = user_id

        """ :type trigger: dart.model.trigger.Trigger """
        trigger_type_name = trigger.data.trigger_type_name
        if trigger_type_name == self._manual_trigger_processor.trigger_type().name:
            raise DartValidationException('manual triggers cannot be saved')
        if trigger_type_name == self._retry_trigger_processor.trigger_type().name:
            raise DartValidationException('retry triggers cannot be saved')
        trigger_processor = self._trigger_processors.get(trigger_type_name)
        if not trigger_processor:
            raise DartValidationException('unknown trigger_type_name: %s' % trigger_type_name)
        assert isinstance(trigger_processor, TriggerProcessor)
        trigger = default_and_validate(trigger, trigger_schema(trigger_processor.trigger_type().params_json_schema))

        trigger_dao = TriggerDao()
        trigger_dao.id = random_id()
        if trigger_type_name == 'subscription_batch':
            sub = self._subscription_service.get_subscription(trigger.data.args['subscription_id'])
            if sub.data.nudge_id:
                response = self.update_nudge_with_trigger(sub.data.nudge_id,
                                                          trigger.data.args['unconsumed_data_size_in_bytes'],
                                                          trigger_dao.id,
                                                          trigger.data.trigger_type_name)
                assert(response.status_code == 200)
        trigger_dao.data = trigger.data.to_dict()
        db.session.add(trigger_dao)
        if flush:
            db.session.flush()
        trigger = trigger_dao.to_model()
        if commit_and_initialize:
            db.session.commit()
            trigger = trigger_dao.to_model()
            try:
                trigger_processor.initialize_trigger(trigger, self)
            except:
                db.session.delete(trigger_dao)
                db.session.commit()
                raise
        return trigger
示例#14
0
    def __init__(self, action_service, datastore_service, workflow_service,
                 manual_trigger_processor,
                 subscription_batch_trigger_processor,
                 workflow_completion_trigger_processor,
                 event_trigger_processor, scheduled_trigger_processor,
                 super_trigger_processor, retry_trigger_processor,
                 filter_service, subscription_service, dart_config):
        self._action_service = action_service
        self._datastore_service = datastore_service
        self._workflow_service = workflow_service
        self._manual_trigger_processor = manual_trigger_processor
        self._subscription_batch_trigger_processor = subscription_batch_trigger_processor
        self._workflow_completion_trigger_processor = workflow_completion_trigger_processor
        self._event_trigger_processor = event_trigger_processor
        self._scheduled_trigger_processor = scheduled_trigger_processor
        self._super_trigger_processor = super_trigger_processor
        self._retry_trigger_processor = retry_trigger_processor
        self._filter_service = filter_service
        self._subscription_service = subscription_service
        self._nudge_config = dart_config['nudge']

        self._trigger_processors = {
            manual_trigger_processor.trigger_type().name:
            manual_trigger_processor,
            subscription_batch_trigger_processor.trigger_type().name:
            subscription_batch_trigger_processor,
            workflow_completion_trigger_processor.trigger_type().name:
            workflow_completion_trigger_processor,
            event_trigger_processor.trigger_type().name:
            event_trigger_processor,
            scheduled_trigger_processor.trigger_type().name:
            scheduled_trigger_processor,
            super_trigger_processor.trigger_type().name:
            super_trigger_processor,
            retry_trigger_processor.trigger_type().name:
            retry_trigger_processor,
        }

        params_schemas = []
        for name, processor in self._trigger_processors.iteritems():
            params_schemas.append(processor.trigger_type().params_json_schema)
        self._trigger_schemas = [trigger_schema(s) for s in params_schemas]
示例#15
0
文件: trigger.py 项目: ophiradi/dart
    def save_trigger(self, trigger, commit_and_initialize=True, flush=False, user_id=None):
        wf_uuid = uuid.uuid4().hex  # to avoid uuid serialization issues
        trigger.data.tags = trigger.data.tags if (trigger.data.tags) else []
        trigger.data.tags.append(wf_uuid)
        if user_id:
            trigger.data.user_id = user_id


        """ :type trigger: dart.model.trigger.Trigger """
        trigger_type_name = trigger.data.trigger_type_name
        if trigger_type_name == self._manual_trigger_processor.trigger_type().name:
            raise DartValidationException('manual triggers cannot be saved')
        if trigger_type_name == self._retry_trigger_processor.trigger_type().name:
            raise DartValidationException('retry triggers cannot be saved')
        trigger_processor = self._trigger_processors.get(trigger_type_name)
        if not trigger_processor:
            raise DartValidationException('unknown trigger_type_name: %s' % trigger_type_name)
        assert isinstance(trigger_processor, TriggerProcessor)
        trigger = default_and_validate(trigger, trigger_schema(trigger_processor.trigger_type().params_json_schema))

        trigger_dao = TriggerDao()
        trigger_dao.id = random_id()
        trigger_dao.data = trigger.data.to_dict()
        db.session.add(trigger_dao)
        if flush:
            db.session.flush()
        trigger = trigger_dao.to_model()
        if commit_and_initialize:
            db.session.commit()
            trigger = trigger_dao.to_model()
            try:
                trigger_processor.initialize_trigger(trigger, self)
            except:
                db.session.delete(trigger_dao)
                db.session.commit()
                raise
        return trigger
示例#16
0
def main():
    data = {
        'definitions': {
            'Action': action_schema(None),
            'ActionContext': action_context_schema(),
            'ActionResult': action_result_schema(),
            'Dataset': dataset_schema(),
            'Datastore': datastore_schema(None),
            'Engine': engine_schema(),
            'ErrorResult': error_result_schema(),
            'Event': event_schema(),
            'Filter': filter_schema(),
            'GraphEntityIdentifier': graph_entity_identifier_schema(),
            'GraphEntity': graph_entity_schema(),
            'JSONPatch': json_patch_schema(),
            'JSONSchema': json_schema_schema(),
            'OKResult': ok_result_schema(),
            'OrderBy': order_by_schema(),
            'SubGraph': sub_graph_schema(),
            'SubGraphDefinition': {
                'type': 'object'
            },  #subgraph_definition_schema([{'type': 'object'}], [{'type': 'object'}], {'type': 'object'}),
            'Subscription': subscription_schema(),
            'Trigger': trigger_schema({'type': 'object'}),
            'TriggerType': trigger_type_schema(),
            'Workflow': workflow_schema(),
            'WorkflowInstance': workflow_instance_schema()
        }
    }
    fix_up(data, data, [None])
    print dump(data,
               Dumper=Dumper,
               default_style=None,
               default_flow_style=False,
               explicit_start=False,
               explicit_end=False)
    return 0
def export_swagger_definitions(out):
    data = {
        'definitions': {
            'Action': action_schema({'type': 'object', 'x-nullable': True}),
            'ActionResponse': object_response_schema('Action'),
            'ActionsResponse': array_response_schema('Action'),
            'PagedActionsResponse': paged_response_schema('Action'),

            'ActionContext': action_context_schema(),
            'ActionContextResponse': object_response_schema('ActionContext'),

            'ActionResult': action_result_schema(),

            'Dataset': dataset_schema(),
            'DatasetResponse': object_response_schema('Dataset'),
            'PagedDatasetsResponse': paged_response_schema('Dataset'),

            'Datastore': datastore_schema({'type': 'object', 'x-nullable': True}),
            'DatastoreResponse': object_response_schema('Datastore'),
            'PagedDatastoresResponse': paged_response_schema('Datastore'),

            'Engine': engine_schema(),
            'EngineResponse': object_response_schema('Engine'),
            'PagedEnginesResponse': paged_response_schema('Engine'),

            'ErrorResponse': error_response_schema(),

            'Event': event_schema(),
            'EventResponse': object_response_schema('Event'),
            'PagedEventsResponse': paged_response_schema('Event'),

            'Filter': filter_schema(),

            'GraphEntityIdentifier': graph_entity_identifier_schema(),
            'GraphEntityIdentifierResponse': object_response_schema('GraphEntityIdentifier'),
            'GraphEntityIdentifiersResponse': array_response_schema('GraphEntityIdentifier'),

            'GraphEntity': graph_entity_schema(),
            'GraphEntityResponse': object_response_schema('GraphEntity'),

            'JSONPatch': json_patch_schema(),

            'JSONSchema': json_schema_schema(),
            'JSONSchemaResponse': object_response_schema('JSONSchema'),

            'ObjectResponse': object_response_schema('object'),
            'ObjectsResponse': array_response_schema('object'),
            'PagedObjectsResponse': paged_response_schema('object'),

            'OKResponse': ok_response_schema(),

            'OrderBy': order_by_schema(),

            'Subgraph': sub_graph_schema(),
            'SubgraphResponse': object_response_schema('Subgraph'),

            'SubgraphDefinition': {'type': 'object'}, #subgraph_definition_schema([{'type': 'object'}], [{'type': 'object'}], {'type': 'object'}),
            'SubgraphDefinitionResponse': object_response_schema('SubgraphDefinition'),

            'Subscription': subscription_schema(),
            'SubscriptionResponse': object_response_schema('Subscription'),
            'PagedSubscriptionsResponse': paged_response_schema('Subscription'),

            'SubscriptionElement': subscription_element_schema(),
            'PagedSubscriptionElementsResponse': paged_response_schema('SubscriptionElement'),

            'Trigger': trigger_schema({'type': 'object'}),
            'TriggerResponse': object_response_schema('Trigger'),
            'PagedTriggersResponse': paged_response_schema('Trigger'),

            'TriggerType': trigger_type_schema(),
            'PagedTriggerTypesResponse': paged_response_schema('TriggerType'),

            'Workflow': workflow_schema(),
            'WorkflowResponse': object_response_schema('Workflow'),
            'PagedWorkflowsResponse': paged_response_schema('Workflow'),

            'WorkflowInstance': workflow_instance_schema(),
            'WorkflowInstanceResponse': object_response_schema('WorkflowInstance'),
            'PagedWorkflowInstancesResponse': paged_response_schema('WorkflowInstance')
        }
    }
    fix_up(data, data, [None])
    dump(data, out, Dumper=Dumper, default_style=None, default_flow_style=False, explicit_start=False, explicit_end=False)
示例#18
0
def export_swagger_definitions(out):
    data = {
        'definitions': {
            'Action':
            action_schema({
                'type': 'object',
                'x-nullable': True
            }),
            'ActionResponse':
            object_response_schema('Action'),
            'ActionsResponse':
            array_response_schema('Action'),
            'PagedActionsResponse':
            paged_response_schema('Action'),
            'ActionContext':
            action_context_schema(),
            'ActionContextResponse':
            object_response_schema('ActionContext'),
            'ActionResult':
            action_result_schema(),
            'Dataset':
            dataset_schema(),
            'DatasetResponse':
            object_response_schema('Dataset'),
            'PagedDatasetsResponse':
            paged_response_schema('Dataset'),
            'Datastore':
            datastore_schema({
                'type': 'object',
                'x-nullable': True
            }),
            'DatastoreResponse':
            object_response_schema('Datastore'),
            'PagedDatastoresResponse':
            paged_response_schema('Datastore'),
            'Engine':
            engine_schema(),
            'EngineResponse':
            object_response_schema('Engine'),
            'PagedEnginesResponse':
            paged_response_schema('Engine'),
            'ErrorResponse':
            error_response_schema(),
            'Event':
            event_schema(),
            'EventResponse':
            object_response_schema('Event'),
            'PagedEventsResponse':
            paged_response_schema('Event'),
            'Filter':
            filter_schema(),
            'GraphEntityIdentifier':
            graph_entity_identifier_schema(),
            'GraphEntityIdentifierResponse':
            object_response_schema('GraphEntityIdentifier'),
            'GraphEntityIdentifiersResponse':
            array_response_schema('GraphEntityIdentifier'),
            'GraphEntity':
            graph_entity_schema(),
            'GraphEntityResponse':
            object_response_schema('GraphEntity'),
            'JSONPatch':
            json_patch_schema(),
            'JSONSchema':
            json_schema_schema(),
            'JSONSchemaResponse':
            object_response_schema('JSONSchema'),
            'ObjectResponse':
            object_response_schema('object'),
            'ObjectsResponse':
            array_response_schema('object'),
            'PagedObjectsResponse':
            paged_response_schema('object'),
            'OKResponse':
            ok_response_schema(),
            'OrderBy':
            order_by_schema(),
            'Subgraph':
            sub_graph_schema(),
            'SubgraphResponse':
            object_response_schema('Subgraph'),
            'SubgraphDefinition': {
                'type': 'object'
            },  #subgraph_definition_schema([{'type': 'object'}], [{'type': 'object'}], {'type': 'object'}),
            'SubgraphDefinitionResponse':
            object_response_schema('SubgraphDefinition'),
            'Subscription':
            subscription_schema(),
            'SubscriptionResponse':
            object_response_schema('Subscription'),
            'PagedSubscriptionsResponse':
            paged_response_schema('Subscription'),
            'SubscriptionElement':
            subscription_element_schema(),
            'PagedSubscriptionElementsResponse':
            paged_response_schema('SubscriptionElement'),
            'Trigger':
            trigger_schema({'type': 'object'}),
            'TriggerResponse':
            object_response_schema('Trigger'),
            'PagedTriggersResponse':
            paged_response_schema('Trigger'),
            'TriggerType':
            trigger_type_schema(),
            'PagedTriggerTypesResponse':
            paged_response_schema('TriggerType'),
            'Workflow':
            workflow_schema(),
            'WorkflowResponse':
            object_response_schema('Workflow'),
            'PagedWorkflowsResponse':
            paged_response_schema('Workflow'),
            'WorkflowInstance':
            workflow_instance_schema(),
            'WorkflowInstanceResponse':
            object_response_schema('WorkflowInstance'),
            'PagedWorkflowInstancesResponse':
            paged_response_schema('WorkflowInstance')
        }
    }
    fix_up(data, data, [None])
    dump(data,
         out,
         Dumper=Dumper,
         default_style=None,
         default_flow_style=False,
         explicit_start=False,
         explicit_end=False)
示例#19
0
 def default_and_validate_trigger(self, trigger):
     trigger_type_name = trigger.data.trigger_type_name
     trigger_processor = self._trigger_processors.get(trigger_type_name)
     return default_and_validate(trigger, trigger_schema(trigger_processor.trigger_type().params_json_schema))