Search in sources :

Example 1 with ResponseUpdater

use of org.onap.so.apihandler.filters.ResponseUpdater in project so by onap.

the class Vnf method deleteVnfInstance.

@DELETE
@ResponseUpdater
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Operation(description = "Delete a Vnf instance", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteVnfInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @Context ContainerRequestContext requestContext) throws AAIEntityNotFound, JsonProcessingException, WorkflowEngineConnectionException, ValidateException {
    String requestId = vnfRestHandler.getRequestId(requestContext);
    String requestorId = MDC.get(HttpHeadersConstants.REQUESTOR_ID);
    String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
    String requestURL = requestContext.getUriInfo().getAbsolutePath().toString();
    InfraActiveRequests currentRequest = vnfRestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId, vnfInstanceId, requestorId, source, requestURL);
    ServiceInstancesRequest request = requestBuilder.buildVnfDeleteRequest(vnfInstanceId);
    vnfRestHandler.saveInstanceName(request, currentRequest);
    vnfRestHandler.checkDuplicateRequest(serviceInstanceId, vnfInstanceId, request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
    Recipe recipe = vnfRestHandler.findVnfModuleRecipe(request.getRequestDetails().getModelInfo().getModelCustomizationId(), "vnf", "deleteInstance");
    vnfRestHandler.callWorkflowEngine(vnfRestHandler.buildRequestParams(request, vnfRestHandler.getRequestUri(requestContext), requestId, serviceInstanceId, vnfInstanceId), recipe.getOrchestrationUri());
    ServiceInstancesResponse response = vnfRestHandler.createResponse(vnfInstanceId, requestId, requestContext);
    return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
}
Also used : Recipe(org.onap.so.db.catalog.beans.Recipe) ServiceInstancesResponse(org.onap.so.serviceinstancebeans.ServiceInstancesResponse) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Path(javax.ws.rs.Path) ResponseUpdater(org.onap.so.apihandler.filters.ResponseUpdater) DELETE(javax.ws.rs.DELETE) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) Operation(io.swagger.v3.oas.annotations.Operation) Transactional(javax.transaction.Transactional)

Example 2 with ResponseUpdater

use of org.onap.so.apihandler.filters.ResponseUpdater in project so by onap.

the class ServiceInstance method deleteServiceInstance.

@DELETE
@ResponseUpdater
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Operation(description = "Delete a Service instance", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteServiceInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext) throws AAIEntityNotFound, NoRecipeException, JsonProcessingException, WorkflowEngineConnectionException, ValidateException {
    String requestId = requestHandler.getRequestId(requestContext);
    String requestorId = MDC.get(HttpHeadersConstants.REQUESTOR_ID);
    String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
    String requestURI = requestContext.getUriInfo().getAbsolutePath().toString();
    InfraActiveRequests currentRequest = requestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId, requestorId, source, requestURI);
    ServiceInstancesRequest request = requestBuilder.buildServiceDeleteRequest(serviceInstanceId);
    requestHandler.saveInstanceName(request, currentRequest);
    requestHandler.checkDuplicateRequest(serviceInstanceId, request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
    Recipe recipe = requestHandler.findServiceRecipe(request.getRequestDetails().getModelInfo().getModelUuid(), Action.deleteInstance.toString());
    requestHandler.callWorkflowEngine(requestHandler.buildRequestParams(request, requestHandler.getRequestUri(requestContext), requestId, serviceInstanceId), recipe.getOrchestrationUri());
    ServiceInstancesResponse response = requestHandler.createResponse(serviceInstanceId, requestId, requestContext);
    return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
}
Also used : Recipe(org.onap.so.db.catalog.beans.Recipe) ServiceInstancesResponse(org.onap.so.serviceinstancebeans.ServiceInstancesResponse) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Path(javax.ws.rs.Path) ResponseUpdater(org.onap.so.apihandler.filters.ResponseUpdater) DELETE(javax.ws.rs.DELETE) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) Operation(io.swagger.v3.oas.annotations.Operation) Transactional(javax.transaction.Transactional)

Example 3 with ResponseUpdater

use of org.onap.so.apihandler.filters.ResponseUpdater in project so by onap.

the class Network method deleteNetworkInstance.

@DELETE
@ResponseUpdater
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Operation(description = "Delete provided Network instance", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteNetworkInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("networkInstanceId") String networkInstanceId, @Context ContainerRequestContext requestContext) throws AAIEntityNotFound, NoRecipeException, JsonProcessingException, WorkflowEngineConnectionException, ValidateException {
    String requestId = networkRestHandler.getRequestId(requestContext);
    String requestorId = MDC.get(HttpHeadersConstants.REQUESTOR_ID);
    String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
    String requestURI = requestContext.getUriInfo().getAbsolutePath().toString();
    InfraActiveRequests currentRequest = networkRestHandler.createInfraActiveRequestForDelete(requestId, serviceInstanceId, networkInstanceId, requestorId, source, requestURI);
    ServiceInstancesRequest request = requestBuilder.buildNetworkDeleteRequest(networkInstanceId);
    networkRestHandler.saveInstanceName(request, currentRequest);
    networkRestHandler.checkDuplicateRequest(serviceInstanceId, networkInstanceId, request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
    Recipe recipe = networkRestHandler.findNetworkRecipe(Action.deleteInstance.toString());
    networkRestHandler.callWorkflowEngine(networkRestHandler.buildRequestParams(request, networkRestHandler.getRequestUri(requestContext), requestId, serviceInstanceId, networkInstanceId), recipe.getOrchestrationUri());
    ServiceInstancesResponse response = networkRestHandler.createResponse(networkInstanceId, requestId, requestContext);
    return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
}
Also used : Recipe(org.onap.so.db.catalog.beans.Recipe) ServiceInstancesResponse(org.onap.so.serviceinstancebeans.ServiceInstancesResponse) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Path(javax.ws.rs.Path) ResponseUpdater(org.onap.so.apihandler.filters.ResponseUpdater) DELETE(javax.ws.rs.DELETE) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) Operation(io.swagger.v3.oas.annotations.Operation) Transactional(javax.transaction.Transactional)

Example 4 with ResponseUpdater

use of org.onap.so.apihandler.filters.ResponseUpdater in project so by onap.

the class VfModules method deleteVfModuleInstance.

@DELETE
@ResponseUpdater
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Operation(description = "Delete a VfModule instance", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteVfModuleInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId, @Context ContainerRequestContext requestContext) throws AAIEntityNotFound, NoRecipeException, JsonProcessingException, WorkflowEngineConnectionException, ValidateException {
    String requestId = restHandler.getRequestId(requestContext);
    String requestorId = MDC.get(HttpHeadersConstants.REQUESTOR_ID);
    String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
    String requestURL = requestContext.getUriInfo().getAbsolutePath().toString();
    InfraActiveRequests currentRequest = restHandler.createInfraActiveRequestForDelete(requestId, vfmoduleInstanceId, serviceInstanceId, vnfInstanceId, requestorId, source, requestURL);
    ServiceInstancesRequest request = requestBuilder.buildVFModuleDeleteRequest(vnfInstanceId, vfmoduleInstanceId, ModelType.vfModule);
    restHandler.saveInstanceName(request, currentRequest);
    restHandler.checkDuplicateRequest(serviceInstanceId, vnfInstanceId, vfmoduleInstanceId, request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
    Recipe recipe = restHandler.findVfModuleRecipe(request.getRequestDetails().getModelInfo().getModelCustomizationId(), ModelType.vfModule.toString(), Action.deleteInstance.toString());
    restHandler.callWorkflowEngine(restHandler.buildRequestParams(request, restHandler.getRequestUri(requestContext), requestId, serviceInstanceId, vnfInstanceId, vfmoduleInstanceId), recipe.getOrchestrationUri());
    ServiceInstancesResponse response = restHandler.createResponse(vfmoduleInstanceId, requestId, requestContext);
    return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
}
Also used : Recipe(org.onap.so.db.catalog.beans.Recipe) ServiceInstancesResponse(org.onap.so.serviceinstancebeans.ServiceInstancesResponse) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Path(javax.ws.rs.Path) ResponseUpdater(org.onap.so.apihandler.filters.ResponseUpdater) DELETE(javax.ws.rs.DELETE) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) Operation(io.swagger.v3.oas.annotations.Operation) Transactional(javax.transaction.Transactional)

Example 5 with ResponseUpdater

use of org.onap.so.apihandler.filters.ResponseUpdater in project so by onap.

the class Volumes method deleteVfModuleInstance.

@DELETE
@ResponseUpdater
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Operation(description = "Delete a VfModule instance", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteVfModuleInstance(@PathParam("version") String version, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, @PathParam("volumeGroupInstanceId") String volumeGroupId, @Context ContainerRequestContext requestContext) throws AAIEntityNotFound, NoRecipeException, JsonProcessingException, WorkflowEngineConnectionException, ValidateException {
    String requestId = volumeRestHandler.getRequestId(requestContext);
    String requestorId = MDC.get(HttpHeadersConstants.REQUESTOR_ID);
    String source = MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME);
    String requestURL = requestContext.getUriInfo().getAbsolutePath().toString();
    InfraActiveRequests currentRequest = volumeRestHandler.createInfraActiveRequestForDelete(requestId, volumeGroupId, serviceInstanceId, vnfInstanceId, requestorId, source, requestURL);
    ServiceInstancesRequest request = requestBuilder.buildVolumeGroupDeleteRequest(vnfInstanceId, volumeGroupId);
    volumeRestHandler.saveInstanceName(request, currentRequest);
    volumeRestHandler.checkDuplicateRequest(serviceInstanceId, vnfInstanceId, volumeGroupId, request.getRequestDetails().getRequestInfo().getInstanceName(), currentRequest.getRequestId());
    Recipe recipe = vfModuleRestHandler.findVfModuleRecipe(request.getRequestDetails().getModelInfo().getModelCustomizationId(), ModelType.volumeGroup.toString(), Action.deleteInstance.toString());
    volumeRestHandler.callWorkflowEngine(volumeRestHandler.buildRequestParams(request, volumeRestHandler.getRequestUri(requestContext), requestId, serviceInstanceId, vnfInstanceId, volumeGroupId), recipe.getOrchestrationUri());
    ServiceInstancesResponse response = volumeRestHandler.createResponse(volumeGroupId, requestId, requestContext);
    return Response.status(HttpStatus.ACCEPTED.value()).entity(response).build();
}
Also used : Recipe(org.onap.so.db.catalog.beans.Recipe) ServiceInstancesResponse(org.onap.so.serviceinstancebeans.ServiceInstancesResponse) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) ServiceInstancesRequest(org.onap.so.serviceinstancebeans.ServiceInstancesRequest) Path(javax.ws.rs.Path) ResponseUpdater(org.onap.so.apihandler.filters.ResponseUpdater) DELETE(javax.ws.rs.DELETE) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) Operation(io.swagger.v3.oas.annotations.Operation) Transactional(javax.transaction.Transactional)

Aggregations

Operation (io.swagger.v3.oas.annotations.Operation)5 Transactional (javax.transaction.Transactional)5 Consumes (javax.ws.rs.Consumes)5 DELETE (javax.ws.rs.DELETE)5 Path (javax.ws.rs.Path)5 Produces (javax.ws.rs.Produces)5 ResponseUpdater (org.onap.so.apihandler.filters.ResponseUpdater)5 Recipe (org.onap.so.db.catalog.beans.Recipe)5 InfraActiveRequests (org.onap.so.db.request.beans.InfraActiveRequests)5 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)5 ServiceInstancesResponse (org.onap.so.serviceinstancebeans.ServiceInstancesResponse)5