from o2common.service.messagebus import MessageBus
from o2common.views.pagination_route import link_header, PAGE_PARAM
-from o2common.views.route_exception import NotFoundException
+from o2common.views.route_exception import NotFoundException, \
+ BadRequestException
from o2ims.domain import ocloud
from o2ims.views import ocloud_view
from o2ims.views.api_ns import api_ims_inventory as api_ims_inventory_v1
@api_ims_inventory_v1.marshal_with(model)
def get(self, resourceTypeID):
result = ocloud_view.resource_type_one(resourceTypeID, bus.uow)
- if result is not None:
- return result
- raise NotFoundException("Resource type {} doesn't exist".format(
- resourceTypeID))
+ if not result:
+ raise NotFoundException("Resource type {} doesn't exist".format(
+ resourceTypeID))
+ return result
# ---------- ResourcePools ---------- #
mask='{subscriptionId,callback,consumerSubscriptionId,filter}')
def post(self):
data = api_ims_inventory_v1.payload
+ callback = data.get('callback', None)
+ if not callback:
+ raise BadRequestException('The callback parameter is required')
+
result = ocloud_view.subscription_create(data, bus.uow)
return result, 201