本文整理汇总了Python中son_editor.util.requestutil.prepare_response函数的典型用法代码示例。如果您正苦于以下问题:Python prepare_response函数的具体用法?Python prepare_response怎么用?Python prepare_response使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prepare_response函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
def get(self, ws_id, parent_id):
"""Get a list of all Services
Returns a list of all services available in this resource"""
if get_parent(request) is Category.project:
service = servicesimpl.get_services(ws_id, parent_id)
return prepare_response(service)
if get_parent(request) is Category.catalogue:
service = catalogue_servicesimpl.get_all_in_catalogue(ws_id, parent_id, False)
return prepare_response(service)
return prepare_response("not yet implemented")
示例2: delete
def delete(self, ws_id, parent_id, service_id):
"""Delete the Service
Deletes the service from the Project or Catalogue"""
if get_parent(request) is Category.project:
service = servicesimpl.delete_service(parent_id, service_id)
return prepare_response(service)
if get_parent(request) is Category.catalogue:
service = catalogue_servicesimpl.delete_service_catalogue(ws_id, parent_id, service_id, False)
return prepare_response(service)
return prepare_response("not yet implemented")
示例3: get
def get(self, ws_id, parent_id):
"""List all functions
Lists all available functions in the given project or catalogue."""
if get_parent(request) is Category.project:
functions = functionsimpl.get_functions(ws_id, parent_id)
return prepare_response(functions)
if get_parent(request) is Category.catalogue:
functions = catalogue_servicesimpl.get_all_in_catalogue(ws_id, parent_id, True)
return prepare_response(functions)
return prepare_response("not yet implemented")
示例4: delete
def delete(self, ws_id, parent_id, vnf_id):
"""Deletes a function
Deletes a function in the project or catalogue by its id"""
if get_parent(request) is Category.project:
deleted = functionsimpl.delete_function(ws_id, parent_id, vnf_id)
return prepare_response(deleted)
if get_parent(request) is Category.catalogue:
deleted = catalogue_servicesimpl.delete_service_catalogue(ws_id, parent_id, vnf_id, True)
return prepare_response(deleted)
# TODO implement for catalog and platform
return prepare_response("not yet implemented")
示例5: put
def put(self, ws_id, parent_id, vnf_id):
"""Updates a function
Updates a function in the project or catalogue by its id"""
if get_parent(request) is Category.project:
vnf_data = get_json(request)
vnf_data = functionsimpl.update_function(ws_id, parent_id, vnf_id, vnf_data)
return prepare_response(vnf_data)
if get_parent(request) is Category.catalogue:
vnf_data = get_json(request)
vnf_data = catalogue_servicesimpl.update_service_catalogue(ws_id, parent_id, vnf_id, vnf_data, True)
return prepare_response(vnf_data)
return prepare_response("update vnf in project with id " + parent_id)
示例6: post
def post(self, ws_id, parent_id):
"""Creates a new function
Creates a new function in the project or catalogue"""
if get_parent(request) is Category.project:
vnf_data = get_json(request)
vnf_data = functionsimpl.create_function(ws_id, parent_id, vnf_data)
return prepare_response(vnf_data, 201)
if get_parent(request) is Category.catalogue:
vnf_data = get_json(request)
vnf_data = catalogue_servicesimpl.create_in_catalogue(parent_id, vnf_data['id'],
True)
return prepare_response(vnf_data, 201)
# TODO implement for catalog and platform
return prepare_response("not implemented yet")
示例7: get
def get(self, ws_id):
"""
List private Catalogue services
Lists all services in the Private workspace wide catalogue
"""
return prepare_response(get_private_nsfs_list(ws_id, False))
示例8: get
def get(self, ws_id, catalogue_id):
"""List all functions
Lists all available functions in the given project or catalogue."""
functions = catalogue_servicesimpl.get_all_in_catalogue(ws_id, catalogue_id, True)
return prepare_response(functions)
示例9: post
def post(self, ws_id, project_id):
"""Create a new Service
Creates a new Service in this project or
publishes it in the catalogue or platform"""
service = servicesimpl.create_service(ws_id, project_id, get_json(request))
return prepare_response(service, 201)
示例10: put
def put(self, ws_id, project_id, vnf_id):
"""Updates a function
Updates a function in the project or catalogue by its id"""
vnf_data = get_json(request)
vnf_data = functionsimpl.update_function(ws_id, project_id, vnf_id, vnf_data)
return prepare_response(vnf_data)
示例11: post
def post(self, ws_id):
"""Creates a new project
Creates a new project in the given workspace"""
projectData = get_json(request)
pj = projectsimpl.create_project(ws_id, projectData)
return prepare_response(pj, 201)
示例12: put
def put(self, ws_id):
"""Update workspace
Updates a specific workspace by its id"""
workspace_data = get_json(request)
workspace = workspaceimpl.update_workspace(workspace_data, ws_id)
return prepare_response(workspace)
示例13: get
def get(self, ws_id):
"""
Returns a list of all schemas configured for this server
:param ws_id:
:return:
"""
return prepare_response(descriptorutil.get_schemas())
示例14: post
def post(self, ws_id, project_id):
"""Creates a new function
Creates a new function in the project or catalogue"""
vnf_data = get_json(request)
vnf_data = functionsimpl.create_function(ws_id, project_id, vnf_data)
return prepare_response(vnf_data, 201)
示例15: delete
def delete(self, ws_id, catalogue_id, vnf_id):
"""Deletes a function
Deletes a function in the project or catalogue by its id"""
deleted = catalogue_servicesimpl.delete_service_catalogue(ws_id, catalogue_id, vnf_id, True)
return prepare_response(deleted)