Пример #1
0
 def delete_function(self, function_name):
     import cloud.logic.delete_function as method
     params = {
         'function_name': function_name,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #2
0
 def get_function_zip_b64(self, function_name):
     import cloud.logic.get_function_zip_b64 as method
     params = {
         'function_name': function_name,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #3
0
 def get_webhooks(self, start_key):
     import cloud.logic.get_webhooks as method
     params = {
         'start_key': start_key,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #4
0
 def delete_webhook(self, name):
     import cloud.logic.delete_webhook as method
     params = {
         'name': name,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #5
0
 def get_webhook_url(self, name):
     import cloud.logic.get_webhook_url as method
     params = {
         'name': name,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #6
0
def abstracted_webhook(params, query_params, resource, webhook_name,
                       client_ip):
    item_id = 'webhook-{}'.format(webhook_name)
    webhook = resource.db_get_item(item_id)
    body = {}
    if webhook:
        function_name = webhook['function_name']
        webhook_groups = webhook.get('groups', ['user'])  # TODO
        data = {
            'params': {
                'payload': {
                    'params': params,
                    'query_params': query_params,
                },
                'function_name': function_name,
            },
            'user': {
                'groups': webhook_groups
            },
            'client_ip': client_ip
        }
        body = run_function.do(data, resource)
        return body.get('response', None)
    else:
        body['error'] = error.NO_SUCH_WEBHOOK
        return body
Пример #7
0
 def get_function_file(self, function_name, file_path):
     import cloud.logic.get_function_file as method
     params = {
         'function_name': function_name,
         'file_path': file_path,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #8
0
 def run_function(self, function_name, payload):
     import cloud.logic.run_function as method
     params = {
         'function_name': function_name,
         'payload': payload,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #9
0
 def create_function_test(self, test_name, function_name, test_input):
     import cloud.logic.create_function_test as method
     params = {
         'test_name': test_name,
         'function_name': function_name,
         'test_input': test_input,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #10
0
 def create_webhook(self, name, description, function_name):
     import cloud.logic.create_webhook as method
     params = {
         'name': name,
         'description': description,
         'function_name': function_name,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #11
0
 def put_function_file(self, function_name, file_path, function_file,
                       function_type):
     import cloud.logic.put_function_file as method
     params = {
         'function_name': function_name,
         'file_path': file_path,
         'file_content': function_file,
         'file_type': function_type,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #12
0
 def update_function(self, function_name, description, runtime, handler,
                     sdk_config, zip_file, runnable):
     import cloud.logic.update_function as method
     params = {
         'function_name': function_name,
         'description': description,
         'runtime': runtime,
         'handler': handler,
         'zip_file': zip_file,
         'runnable': runnable,
         'sdk_config': sdk_config,
     }
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)
Пример #13
0
 def get_function_tests(self):
     import cloud.logic.get_function_tests as method
     params = {}
     data = make_data(self.app_id, params)
     return method.do(data, self.resource)