Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic api #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions nova/api/openstack/compute/basic_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Basic Controller"""

#from nova.api.openstack.compute.schemas import xyz
#from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api import validation

class BasicController(wsgi.Controller):

# Define support for GET on a collection
def index(self, req):
data = {'param': 'val'}
return data

# Define support for POST on a collection
# @extensions.expected_errors((400, 409))
# @validation.schema(xyz.create)
@wsgi.response(201)
def create(self, req, body):
write_body_here = ok
return response_body

# Defining support for other RESTFul methods based on resource.

# ...

3 changes: 3 additions & 0 deletions nova/api/openstack/compute/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from nova.api.openstack.compute import attach_interfaces
from nova.api.openstack.compute import availability_zone
from nova.api.openstack.compute import baremetal_nodes
from nova.api.openstack.compute import basic_api
from nova.api.openstack.compute import cells
from nova.api.openstack.compute import certificates
from nova.api.openstack.compute import cloudpipe
Expand Down Expand Up @@ -115,6 +116,8 @@ def _create_controller(main_controller, action_controller_list):
availability_zone_controller = functools.partial(
_create_controller, availability_zone.AvailabilityZoneController, [])

basic_controller = functools.partial(
_create_controller, basic_api.BasicController, [])

baremetal_nodes_controller = functools.partial(
_create_controller, baremetal_nodes.BareMetalNodeController, [])
Expand Down