from o2common.service.messagebus import MessageBus
from o2common.views.pagination_route import link_header, PAGE_PARAM
+from o2common.views.route import ProblemDetails
from o2ims.views import ocloud_view
from o2ims.views.api_ns import api_ims_inventory as api_ims_inventory_v1
from o2ims.views.ocloud_dto import OcloudDTO, ResourceTypeDTO,\
res = ocloud_view.oclouds(bus.uow)
if len(res) > 0:
return res[0]
- api_ims_inventory_v1.abort(
- 404, "oCloud doesn't exist")
+ ProblemDetails(
+ api_ims_inventory_v1,
+ 404, "oCloud doesn't exist").abort()
# ---------- ResourceTypes ---------- #
result = ocloud_view.resource_type_one(resourceTypeID, bus.uow)
if result is not None:
return result
- api_ims_inventory_v1.abort(
- 404, "Resource type {} doesn't exist".format(resourceTypeID))
+ ProblemDetails(
+ api_ims_inventory_v1,
+ 404, "Resource type {} doesn't exist".format(
+ resourceTypeID)).abort()
# ---------- ResourcePools ---------- #
result = ocloud_view.resource_pool_one(resourcePoolID, bus.uow)
if result is not None:
return result
- api_ims_inventory_v1.abort(
- 404, "Resource pool {} doesn't exist".format(resourcePoolID))
+ ProblemDetails(
+ api_ims_inventory_v1,
+ 404, "Resource pool {} doesn't exist".format(
+ resourcePoolID)).abort()
# ---------- Resources ---------- #
result = ocloud_view.resource_one(resourceID, bus.uow)
if result is not None:
return result
- api_ims_inventory_v1.abort(
- 404, "Resource {} doesn't exist".format(resourceID))
+ ProblemDetails(
+ api_ims_inventory_v1,
+ 404, "Resource {} doesn't exist".format(
+ resourceID)).abort()
# ---------- DeploymentManagers ---------- #
deploymentManagerID, bus.uow, profile)
if result is not None:
return result
- api_ims_inventory_v1.abort(
- 404,
- "Deployment manager {} doesn't exist".format(deploymentManagerID))
+
+ ProblemDetails(
+ api_ims_inventory_v1,
+ 404, "Deployment manager {} doesn't exist".format(
+ deploymentManagerID)).abort()
# ---------- Subscriptions ---------- #
subscriptionID, bus.uow)
if result is not None:
return result
- api_ims_inventory_v1.abort(404, "Subscription {} doesn't exist".format(
- subscriptionID))
+ ProblemDetails(
+ api_ims_inventory_v1,
+ 404, "Subscription {} doesn't exist".format(
+ subscriptionID)).abort()
@api_ims_inventory_v1.doc('Delete subscription by ID')
@api_ims_inventory_v1.response(204, 'Subscription deleted')