@ApiOperation(value = "Creates or updates connector configuration for external subject attributes for the given " + "zone.", tags = { "Attribute Connector Management" }) @ApiResponses(value = { @ApiResponse(code = 201, message = "Connector configuration for the given zone is successfully created.") }) @RequestMapping(method = PUT, value = V1 + AcsApiUriTemplates.SUBJECT_CONNECTOR_URL, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<String> putSubjectConnector( @ApiParam(value = "New or updated connector configuration for external subject attributes", required = true) @RequestBody final AttributeConnector connector) { try { boolean connectorCreated = this.service.upsertSubjectConnector(connector); if (connectorCreated) { // return 201 with empty response body return created(V1 + AcsApiUriTemplates.SUBJECT_CONNECTOR_URL, false); } // return 200 with empty response body return ok(); } catch (AttributeConnectorException e) { throw new RestApiException(HttpStatus.UNPROCESSABLE_ENTITY, e.getMessage(), e); } }
@ApiOperation(value = "Retrieves connector configuration for external resource attributes for the given zone.", tags = { "Attribute Connector Management" }, response = AttributeConnector.class) @ApiResponses( value = { @ApiResponse(code = 404, message = "Connector configuration for the given zone is not found.") }) @RequestMapping(method = GET, value = V1 + AcsApiUriTemplates.RESOURCE_CONNECTOR_URL) public ResponseEntity<AttributeConnector> getResourceConnector() { try { AttributeConnector connector = this.service.retrieveResourceConnector(); if (connector != null) { return ok(obfuscateAdapterSecret(connector)); } return notFound(); } catch (AttributeConnectorException e) { throw new RestApiException(HttpStatus.UNPROCESSABLE_ENTITY, e); } }
@PUT @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Install Presto using rpm or tarball") @ApiResponses(value = { @ApiResponse(code = 207, message = "Multiple responses available"), @ApiResponse(code = 400, message = "Request contains invalid parameters")}) public Response install(String urlToFetchPackage, @QueryParam("checkDependencies") @DefaultValue("true") boolean checkDependencies, @QueryParam("scope") String scope, @QueryParam("nodeId") List<String> nodeId) { ApiRequester.Builder apiRequester = requesterBuilder(ControllerPackageAPI.class) .httpMethod(PUT) .accept(MediaType.TEXT_PLAIN) .entity(Entity.entity(urlToFetchPackage, MediaType.TEXT_PLAIN)); optionalQueryParam(apiRequester, "checkDependencies", checkDependencies); return forwardRequest(scope, apiRequester.build(), nodeId); }
@ApiOperation(value = "Retrieves the Manager Connector by Id", notes = "Password/API Key information is not returned as it is sensitive information", response = ApplianceManagerConnectorDto.class) @Path("/{applianceManagerConnectorId}") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) }) @GET public ApplianceManagerConnectorDto getApplianceManagerConnector(@Context HttpHeaders headers, @ApiParam(value = "Id of the Appliance Manager Connector", required = true) @PathParam("applianceManagerConnectorId") Long amcId) { logger.info("getting Appliance Manager Connector " + amcId); this.userContext.setUser(OscAuthFilter.getUsername(headers)); GetDtoFromEntityRequest getDtoRequest = new GetDtoFromEntityRequest(); getDtoRequest.setEntityId(amcId); getDtoRequest.setEntityName("ApplianceManagerConnector"); GetDtoFromEntityServiceApi<ApplianceManagerConnectorDto> getDtoService = this.getDtoFromEntityServiceFactory.getService(ApplianceManagerConnectorDto.class); return this.apiUtil.submitBaseRequestToService(getDtoService, getDtoRequest).getDto(); }
@POST @Path("/{id}/files") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @ApiOperation(value = "addDossierFileByDossierId)", response = DossierFileModel.class) @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierFileModel was updated", response = DossierFileResultsModel.class), @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) }) public Response addDossierFileByDossierId(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @ApiParam(value = "Attachment files", required = true) @Multipart("file") Attachment file, @ApiParam(value = "id of dossier", required = true) @PathParam("id") String id, @ApiParam(value = "Metadata of DossierFile", required = true) @Multipart("referenceUid") String referenceUid, @ApiParam(value = "Metadata of DossierFile") @Multipart("dossierTemplateNo") String dossierTemplateNo, @ApiParam(value = "Metadata of DossierFile") @Multipart("dossierPartNo") String dossierPartNo, @ApiParam(value = "Metadata of DossierFile") @Multipart("fileTemplateNo") String fileTemplateNo, @ApiParam(value = "Metadata of DossierFile") @Multipart("displayName") String displayName, @ApiParam(value = "Metadata of DossierFile") @Multipart("fileType") String fileType, @ApiParam(value = "Metadata of DossierFile") @Multipart("isSync") String isSync, @ApiParam(value = "Metadata of DossierFile") @Multipart("formData") @Nullable String formData);
@ApiOperation(value = "Get server status", notes = "Returns server status information", response = ServerStatusResponse.class) @ApiResponses(value = {@ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class)}) @Path("/status") @GET public Response getStatus() { ServerStatusResponse serverStatusResponse = new ServerStatusResponse(); serverStatusResponse.setVersion(this.server.getVersionStr()); serverStatusResponse.setDbVersion(DBConnectionManagerApi.TARGET_DB_VERSION); serverStatusResponse.setCurrentServerTime(new Date()); serverStatusResponse.setPid(this.server.getCurrentPid()); return Response.status(Status.OK).entity(serverStatusResponse).build(); }
@ApiOperation(value = "Retrieves the Traffic Policy Mapping", notes = "Retrieves a Traffic Policy Mappings specified by its owning Virtual System and Traffic Policy Mapping Id", response = SecurityGroupInterfaceDto.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) }) @Path("/{vsId}/securityGroupInterfaces/{sgiId}") @GET public SecurityGroupInterfaceDto getSecurityGroupInterface(@Context HttpHeaders headers, @ApiParam(value = "The Virtual System Id") @PathParam("vsId") Long vsId, @ApiParam(value = "The Traffic Policy Mapping Id") @PathParam("sgiId") Long sgiId) { logger.info("Getting Security Group Interface " + sgiId); this.userContext.setUser(OscAuthFilter.getUsername(headers)); GetDtoFromEntityRequest getDtoRequest = new GetDtoFromEntityRequest(); getDtoRequest.setEntityId(sgiId); getDtoRequest.setEntityName("SecurityGroupInterface"); GetDtoFromEntityServiceApi<SecurityGroupInterfaceDto> getDtoService = this.getDtoFromEntityServiceFactory.getService(SecurityGroupInterfaceDto.class); SecurityGroupInterfaceDto dto = this.apiUtil.submitBaseRequestToService(getDtoService, getDtoRequest).getDto(); this.apiUtil.validateParentIdMatches(dto, vsId, "SecurityGroupInterface"); return dto; }
@POST @Path(value = "/validation") @Consumes("application/json") @Produces(MediaType.APPLICATION_JSON) @ApiResponses({// @ApiResponse(code = 204, message = "All validations pass"), // @ApiResponse(code = 400, message = "Found violations in validation", responseContainer = "Set", response = Violation.class)// }) default Response validate(@NotNull final T obj) { final Set<ConstraintViolation<T>> constraintViolations = getValidator().validate(obj, AllValidations.class); if (constraintViolations.isEmpty()) { return Response.noContent().build(); } throw new ConstraintViolationException(constraintViolations); }
@GET @Path("/has/{repo}/{bucket}/{id}") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Check if the LXP object with the given id exists") @ApiResponses(value = { @ApiResponse(code = HTTPStatus.OK, message = "The LXP handle"), @ApiResponse(code = HTTPStatus.NOT_FOUND, message = "The LXP requested does not exists"), @ApiResponse(code = HTTPStatus.INTERNAL_SERVER, message = "LXP Not Found") }) public Response hasILXP(@PathParam("repo") final String repo, @PathParam("bucket") final String buck, @PathParam("id") final String id) { try { boolean exists = exists(repo, buck, id); if (exists) { String objectHandle = objectHandle(repo, buck, id); return HTTPResponses.FOUND(objectHandle); } else { return HTTPResponses.NOT_FOUND(); } } catch (RepositoryException e) { return HTTPResponses.INTERNAL_SERVER(); } }
@ApiOperation(value = "getParticipantFromCGOR", nickname = "getParticipantFromCGOR") @RequestMapping(value = "/CISConnector/getParticipantFromCGOR/{cgorName}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "cgorName", value = "the CGOR name", required = true, dataType = "String", paramType = "path"), @ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "query") }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = Participant.class), @ApiResponse(code = 400, message = "Bad Request", response = Participant.class), @ApiResponse(code = 500, message = "Failure", response = Participant.class)}) public ResponseEntity<Participant> getParticipantFromCGOR(@PathVariable String cgorName, @QueryParam("organisation") String organisation) { log.info("--> getParticipantFromCGOR: " + cgorName); Participant participant; try { participant = connector.getParticipantFromCGOR(cgorName, organisation); } catch (CISCommunicationException e) { log.error("Error executing the request: Communication Error" , e); participant = null; } HttpHeaders responseHeaders = new HttpHeaders(); log.info("getParticipantFromCGOR -->"); return new ResponseEntity<Participant>(participant, responseHeaders, HttpStatus.OK); }
@ApiOperation(value = "getOrganisationInvitations", nickname = "getOrganisationInvitations") @RequestMapping(value = "/CISConnector/getOrganisationInvitations/{organisation}", method = RequestMethod.GET) @ApiImplicitParams({ @ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "path") }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = ResponseEntity.class), @ApiResponse(code = 400, message = "Bad Request", response = ResponseEntity.class), @ApiResponse(code = 500, message = "Failure", response = ResponseEntity.class)}) public ResponseEntity<List<CgorInvitation>> getOrganisationInvitations(@PathVariable String organisation) throws CISCommunicationException { log.info("--> getOrganisationInvitations"); List<CgorInvitation> cgorInvitationList = new ArrayList<CgorInvitation>(); try { cgorInvitationList = connector.getOrganisationInvitations(organisation); } catch (CISCommunicationException e) { log.error("Error executing the request: Communication Error" , e); cgorInvitationList = null; } HttpHeaders responseHeaders = new HttpHeaders(); log.info("getOrganisationInvitations -->"); return new ResponseEntity<List<CgorInvitation>>(cgorInvitationList, responseHeaders, HttpStatus.OK); }
@DELETE @Path("{resourceRef}") @ApiOperation(value = "Deletes an existing resource by ID") @ApiResponses({ @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "Invalid ID supplied", response = ExceptionPresentation.class), @ApiResponse(code = 404, message = "Router not found", response = ExceptionPresentation.class)}) public void delete(@PathParam("resourceRef") String resourceRef) throws CommsRouterException { RouterObjectRef routerObjectRef = getRouterObjectRef(resourceRef); LOGGER.debug("Deleting {}", routerObjectRef); getService().delete(routerObjectRef); }
@ApiOperation(value = "Retrieves all jobs", notes = "Retrieves all jobs", response = JobRecordDto.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) }) @GET public List<JobRecordDto> getJobs() { logger.info("Listing job records"); try { ListResponse<JobRecordDto> res = this.listJobService.dispatch(null); return res.getList(); } catch (Exception e) { throw new VmidcRestServerException(Response.status(Status.INTERNAL_SERVER_ERROR), e.getMessage()); } }
@ApiOperation(value = "Deletes an Manager Connector", notes = "Deletes an Appliance Manager Connector if not referenced by any Distributed Appliances", response = BaseJobResponse.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error or if the Manager connector is referenced by a Distributed Appliance", response = ErrorCodeDto.class) }) @Path("/{applianceManagerConnectorId}") @DELETE public Response deleteApplianceManagerConnector(@Context HttpHeaders headers, @ApiParam(value = "Id of the Appliance Manager Connector", required = true) @PathParam("applianceManagerConnectorId") Long amcId) { logger.info("Deleting Appliance Manager Connector " + amcId); this.userContext.setUser(OscAuthFilter.getUsername(headers)); return this.apiUtil.getResponseForBaseRequest(this.deleteApplianceManagerConnectorService, new BaseIdRequest(amcId)); }
@GET @Produces({"application/hal+json", "application/hal+json;concept=metadata;v=1"}) @ApiOperation( value = "metadata for the events endpoint", response = EventsMetadataRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " + "subscribers to the customer service should be able to listen for and react to. In other words this is the authoritative" + "feed for the customer service", tags = {"events"}, produces = "application/hal+json, application/hal+json;concept=metadata;v=1", nickname = "getCustomerMetadata" ) @ApiResponses(value = { @ApiResponse(code = 415, message = "Content type not supported.") }) public Response getCustomerServiceMetadata(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) { return eventMetadataProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request); }
@ApiOperation(value = "getAdaptorConfiguration", nickname = "getAdaptorConfiguration") @RequestMapping(value = "/CISConnector/getAdaptorConfiguration", method = RequestMethod.GET) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = AdaptorConfigurationImpl.class), @ApiResponse(code = 400, message = "Bad Request", response = AdaptorConfigurationImpl.class), @ApiResponse(code = 500, message = "Failure", response = AdaptorConfigurationImpl.class)}) public ResponseEntity<AdaptorConfigurationImpl> getAdaptorConfiguration() { log.info("--> getAdaptorConfiguration"); AdaptorConfigurationImpl config = (AdaptorConfigurationImpl)connector.getAdaptorConfiguration(); HttpHeaders responseHeaders = new HttpHeaders(); log.info("getAdaptorConfiguration -->"); return new ResponseEntity<AdaptorConfigurationImpl>(config, responseHeaders, HttpStatus.OK); }
@GET @Path("/{file}/{property}") @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Get specific configuration property") @ApiResponses(value = { @ApiResponse(code = 207, message = "Multiple responses available"), @ApiResponse(code = 400, message = "Request contains invalid parameters")}) public Response getConfigProperty( @PathParam("file") String file, @PathParam("property") String property, @QueryParam("scope") String scope, @QueryParam("nodeId") List<String> nodeId) { ApiRequester apiRequester = requesterBuilder(ControllerConfigAPI.class) .pathMethod("getConfigProperty") .httpMethod(GET) .resolveTemplate("file", file) .resolveTemplate("property", property) .accept(MediaType.TEXT_PLAIN) .build(); return forwardRequest(scope, apiRequester, nodeId); }
@PUT @Path("/{id}/sampledata") @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @ApiOperation(value = "update sampledata") @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"), @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) }) public Response updateRegistrationTemplateSampleData(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @ApiParam(value = "id of DeliverableType", required = true) @PathParam("id") long registrationTemplatesId, @ApiParam(value = "sampledata of registrationTemplate", required = true) @FormParam("sampleData") String sampledata);
@GET @Produces({"application/hal+json", "application/hal+json;concept=metadata;v=1"}) @ApiOperation( value = "metadata for the events endpoint", response = EventsMetadataRepresentation.class, authorizations = { @Authorization(value = "oauth2", scopes = {}), @Authorization(value = "oauth2-cc", scopes = {}), @Authorization(value = "oauth2-ac", scopes = {}), @Authorization(value = "oauth2-rop", scopes = {}), @Authorization(value = "Bearer") }, notes = " the events are signalled by this resource as this this is the authoritative resource for all events that " + "subscribers to the account service should be able to listen for and react to. In other words this is the authoritative" + "feed for the account service", tags = {"events"}, produces = "application/hal+json, application/hal+json;concept=metadata;v=1", nickname = "getAccountMetadata" ) @ApiResponses(value = { @ApiResponse(code = 415, message = "Content type not supported.") }) public Response getMetadata(@Context UriInfo uriInfo, @Context Request request, @HeaderParam("Accept") String accept) { return eventMetadataProducers.getOrDefault(accept, this::handleUnsupportedContentType).getResponse(uriInfo, request); }
@PostMapping(value = "/owned") @ApiOperation("Search stored documents by ownership.") @ApiResponses(value = { @ApiResponse(code = 200, message = "Returns search results", response = StoredDocumentHalResourceCollection.class), @ApiResponse(code = 400, message = "Error when search criteria not specified") }) public ResponseEntity<Object> searchOwned( Pageable pageable, PagedResourcesAssembler<StoredDocumentHalResource> assembler) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); Page<StoredDocumentHalResource> page = searchService.findStoredDocumentsByCreator(authentication.getName(), pageable).map(StoredDocumentHalResource::new); return ResponseEntity .ok() .contentType(V1MediaType.V1_HAL_DOCUMENT_PAGE_MEDIA_TYPE) .body(assembler.toResource(page)); }
@PatchMapping(value = "{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = V1MediaType.V1_HAL_DOCUMENT_MEDIA_TYPE_VALUE) @ApiOperation("Updates document instance (ex. ttl)") @ApiResponses(value = { @ApiResponse(code = 200, message = "Returns representation of the new state") }) @Transactional public ResponseEntity<Object> updateDocument(@PathVariable UUID id, @RequestBody UpdateDocumentCommand updateDocumentCommand) { StoredDocument storedDocument = auditedStoredDocumentOperationsService.updateDocument(id, updateDocumentCommand); return ResponseEntity .ok() .contentType(V1MediaType.V1_HAL_DOCUMENT_MEDIA_TYPE) .body(new StoredDocumentHalResource(storedDocument)); }
@GetMapping(value = "{id}/binary") @ApiOperation("Streams contents of the most recent Document Content Version associated with the Stored Document.") @ApiResponses(value = { @ApiResponse(code = 200, message = "Returns contents of a file") }) public ResponseEntity<Object> getBinary(@PathVariable UUID id) { DocumentContentVersion documentContentVersion = documentContentVersionService.findMostRecentDocumentContentVersionByStoredDocumentId(id); if (documentContentVersion == null || documentContentVersion.getStoredDocument().isDeleted()) { return ResponseEntity.notFound().build(); } auditedDocumentContentVersionOperationsService.readDocumentContentVersionBinary(documentContentVersion); return null; }
@ApiOperation(value = "getCgorList", nickname = "getCgorList") @RequestMapping(value = "/CISConnector/getCgorList", method = RequestMethod.GET) @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = ArrayList.class), @ApiResponse(code = 400, message = "Bad Request", response = ArrayList.class), @ApiResponse(code = 500, message = "Failure", response = ArrayList.class)}) public ResponseEntity<List<Cgor>> getCgorList() { log.info("--> getCgorList"); List<Cgor> cgors; try { cgors = connector.getCgorList(); } catch (CISCommunicationException e) { log.error("Error executing the request: Communication Error" , e); cgors = new ArrayList<Cgor>(); } HttpHeaders responseHeaders = new HttpHeaders(); log.info("getCgorList -->"); return new ResponseEntity<List<Cgor>>(cgors, responseHeaders, HttpStatus.OK); }
/** * Deletes a DictionaryValue. * * @param dictionaryId Id of the dictionary instance * @param id Id of the instance * @throws MissingObject if specified instance is not found */ @ApiOperation(value = "Deletes a DictionaryValue") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful response"), @ApiResponse(code = 404, message = "Instance does not exist")}) @RequestMapping(value = "/{dictionaryId}/values/{id}", method = RequestMethod.DELETE) @Transactional public void delete( @ApiParam(value = "Id of the existing dictionary", required = true) @PathVariable("dictionaryId") String dictionaryId, @ApiParam(value = "Id of the instance", required = true) @PathVariable("id") String id ) { DictionaryValue entity = valueService.find(dictionaryId, id); notNull(entity, () -> new MissingObject(DictionaryValue.class, id)); valueService.delete(dictionaryId, entity); }
/** * Gets the current client's identity and authorized permissions. * * @param httpServletRequest the servlet request * @return An object describing the current client identity, as determined by the server, and it's permissions. */ @GET @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Returns the current client's authenticated identity and permissions to top-level resources", response = CurrentUser.class ) @ApiResponses({ @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409 + " The NiFi Registry might be running unsecured.") }) public Response getAccessStatus(@Context HttpServletRequest httpServletRequest) { final NiFiUser user = NiFiUserUtils.getNiFiUser(); if (user == null) { // Not expected to happen unless the nifi registry server has been seriously misconfigured. throw new WebApplicationException(new Throwable("Unable to access details for current user.")); } final CurrentUser currentUser = authorizationService.getCurrentUser(); return generateOkResponse(currentUser).build(); }
@ApiOperation(value = "Creates a Traffic Policy Mapping", notes = "Creates a Traffic Policy Mapping owned by Virtual System provided", response = BaseJobResponse.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "In case of any error", response = ErrorCodeDto.class) }) @Path("/{vsId}/securityGroupInterfaces") @POST public Response createSecutiryGroupInterface(@Context HttpHeaders headers, @ApiParam(value = "The Virtual System Id") @PathParam("vsId") Long vsId, @ApiParam(required = true) SecurityGroupInterfaceDto sgiDto) { logger.info("Creating Security Group Interface ..."); this.userContext.setUser(OscAuthFilter.getUsername(headers)); this.apiUtil.setParentIdOrThrow(sgiDto, vsId, "Traffic Policy Mapping"); return this.apiUtil.getResponseForBaseRequest(this.addSecurityGroupInterfaceService, new BaseRequest<SecurityGroupInterfaceDto>(sgiDto)); }
@POST @Path("/registrations/applicant/{applicantNo}/agency/{agencyNo}/forms/{formNo}") @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) @ApiOperation(value = "Get list dataform by applicantNo, agencyNo and formNo") @ApiResponses(value = { @ApiResponse (code = HttpURLConnection.HTTP_OK, message = "Return a list dataform"), @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not Found", response = ExceptionModel.class), @ApiResponse (code = HttpURLConnection.HTTP_FORBIDDEN, message = "Accsess denied", response = ExceptionModel.class) }) public Response getDataFormByFormNo (@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @ApiParam(value = "id for applicant", required = true) @PathParam("applicantNo") String applicantNo, @ApiParam(value = "id for agency", required = true) @PathParam("agencyNo") String agencyNo, @ApiParam(value = "id for forms", required = true) @PathParam("formNo") String formNo, @FormParam("keyword") String keyword);
@POST @Path("/{file}") @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Replace this file with the file at the given URL") @ApiResponses(value = { @ApiResponse(code = 207, message = "Multiple responses available"), @ApiResponse(code = 400, message = "Request contains invalid parameters")}) public Response setConnectorFileByURL( String url, @PathParam("file") String file, @QueryParam("scope") String scope, @QueryParam("nodeId") List<String> nodeId) { ApiRequester apiRequester = requesterBuilder(ControllerConnectorAPI.class) .pathMethod("setConnectorFileByURL") .httpMethod(POST) .resolveTemplate("file", file) .accept(MediaType.TEXT_PLAIN) .entity(Entity.entity(url, MediaType.TEXT_PLAIN)) .build(); return forwardRequest(scope, apiRequester, nodeId); }
@RequestMapping(path = "/changedSince", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @ApiOperation(value = "This operation gets the list of changes from remote collection.") @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = DataGateError.class), @ApiResponse(code = 401, message = "Request is not authorized", response = DataGateError.class), @ApiResponse(code = 500, message = "Error processing request", response = DataGateError.class), }) public ChangeFeed changedSince( @PathVariable @ApiParam("Name of the remote collection.") String collection, @RequestBody @ApiParam("Options for change feed") FeedOptions feedOptions) { log.debug("Validating changedSince request for " + collection); dataGateService.validateRequest(collection); ChangeFeed feed = dataGateService.changedSince(collection, feedOptions); log.debug(collection + " changed since " + feedOptions.getFromSequence() + " : " + feed); return feed; }
@RequestMapping(path = "/change", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @ApiOperation(value = "This operation merges the changes into a remote collection.") @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = DataGateError.class), @ApiResponse(code = 401, message = "Request is not authorized", response = DataGateError.class), @ApiResponse(code = 500, message = "Error processing request", response = DataGateError.class), }) public ChangeResponse change( @PathVariable @ApiParam("Name of the remote collection.") String collection, @RequestBody @ApiParam("The list of changes to be merged.") ChangeFeed changeFeed) { log.debug("Validating change request for " + collection); dataGateService.validateRequest(collection); boolean result = dataGateService.change(collection, changeFeed); log.debug(collection + " changed with " + changeFeed); return new ChangeResponse(result); }
@POST @Path("log/{id}") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @ApiOperation(value = "addDossierLogByDossierId)", response = DossierLogModel.class) @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns the DossierLogModel was updated", response = DossierLogResultsModel.class), @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) }) public Response addDossierLogByDossierId(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @ApiParam(value = "id of dossier", required = true) @PathParam("id") long id, @ApiParam(value = "NotificationType", required = true) @Multipart("notificationType") String notificationType, @ApiParam(value = "Metadata of DossierLog") @Multipart("author") String author, @ApiParam(value = "Metadata of DossierLog") @Multipart("payload") String payload, @ApiParam(value = "Metadata of DossierLog") @Multipart("content") String content);
@ApiOperation( value = "Find speaker by ID", notes = "For valid response try integer IDs with value 1 ... 999. Other values will generated exceptions", response = SpeakerResource.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieve the speaker.", response = SpeakerResource.class), @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Speaker not found"), @ApiResponse(code = 500, message = "Internal server error.")}) @GetMapping(value = "/{id}") public ResponseEntity<SpeakerResource> getSpeaker( @ApiParam(value = "ID of speaker that needs to be fetched", allowableValues = "range[1,999]", required = true) @PathVariable long id) { return speakerRepository.findOne(id) .map(speaker -> ResponseEntity.ok(new SpeakerResource(speaker))) .orElse(new ResponseEntity(HttpStatus.NOT_FOUND)); }
@DELETE @Path("{ref}") @ApiOperation(value = "Deletes an existing router by ID", tags = "routers") @ApiResponses({ @ApiResponse(code = 200, message = "Successful operation"), @ApiResponse(code = 400, message = "Invalid ID supplied", response = ExceptionPresentation.class), @ApiResponse(code = 404, message = "Router not found", response = ExceptionPresentation.class)}) public void delete(@ApiParam(value = "The id of the router to be deleted", required = true) @PathParam("ref") String ref) throws CommsRouterException { LOGGER.debug("Deleting router: {}", ref); routerService.delete(ref); }
@ApiOperation("Ping request") @ApiResponses({ @ApiResponse(code = 200, message = "OK: pong", response = String.class) }) @GET @Path("/ping") @Produces(MediaType.APPLICATION_JSON) public Response ping() { return Response.ok("pong").build(); }
@GET @Path("{flowId}/versions/latest") @Consumes(MediaType.WILDCARD) @Produces(MediaType.APPLICATION_JSON) @ApiOperation( value = "Get the latest version of a flow", response = VersionedFlowSnapshot.class ) @ApiResponses({ @ApiResponse(code = 401, message = HttpStatusMessages.MESSAGE_401), @ApiResponse(code = 403, message = HttpStatusMessages.MESSAGE_403), @ApiResponse(code = 404, message = HttpStatusMessages.MESSAGE_404), @ApiResponse(code = 409, message = HttpStatusMessages.MESSAGE_409) }) public Response getLatestFlowVersion( @PathParam("bucketId") @ApiParam("The bucket identifier") final String bucketId, @PathParam("flowId") @ApiParam("The flow identifier") final String flowId) { authorizeBucketAccess(RequestAction.READ, bucketId); final VersionedFlowSnapshotMetadata latest = registryService.getLatestFlowSnapshotMetadata(bucketId, flowId); if (latest == null) { throw new ResourceNotFoundException("No flow versions found for flow with id " + flowId); } final VersionedFlowSnapshot lastSnapshot = registryService.getFlowSnapshot(bucketId, flowId, latest.getVersion()); populateLinksAndPermissions(lastSnapshot); return Response.status(Response.Status.OK).entity(lastSnapshot).build(); }
@POST @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED }) @ApiOperation(value = "Add ServiceConfig", response = ServiceConfigInputModel.class) @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a ServiceConfig entity was added", response = ServiceConfigInputModel.class), @ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) }) public Response addServiceConfig(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @ApiParam(value = "body params for post") @BeanParam ServiceConfigInputModel input);
@POST @Path("/{operationId}") @Consumes({ "application/json" }) @Produces({ "application/json" }) @ApiOperation(value = "", notes = "Executes a particular action over Multi-Target Application operation ", response = Void.class, authorizations = { @Authorization(value = "oauth2", scopes = { }) }, tags = {}) @ApiResponses(value = { @ApiResponse(code = 202, message = "Accepted", response = Void.class) }) public Response executeOperationAction(@ApiParam(value = "", required = true) @PathParam("operationId") String operationId, @NotNull @ApiParam(value = "", required = true) @QueryParam("actionId") String actionId) { return delegate.executeOperationAction(operationId, actionId, securityContext, spaceGuid); }
@GET @Path("/{id}/invoiceform") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @ApiOperation(value = "Get the PaymentConfig by primekey", response = PaymentConfigSingleInputModel.class) @ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns detail of PaymentConfig", response = PaymentConfigSingleInputModel.class), @ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class), @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) }) public Response getInvoiceForm(@Context HttpServletRequest request, @Context HttpHeaders header, @Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, @PathParam("id") long id);
@PUT @Path("{resourceId}") @ApiOperation( value = "Replace an existing Queue", notes = "If the queue with the specified id does not exist, it creates it") @ApiResponses({ @ApiResponse(code = 201, message = "Successful operation", response = ApiObjectRef.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = ExceptionPresentation.class), @ApiResponse(code = 404, message = "Queue not found", response = ExceptionPresentation.class), @ApiResponse(code = 405, message = "Validation exception", response = ExceptionPresentation.class)}) public Response create( @ApiParam(value = "The id of the queue to be replaced", required = true) @PathParam("resourceId") String resourceId, @ApiParam(value = "CreateQueueArg object specifying all the parameters") CreateQueueArg createArg) throws CommsRouterException { LOGGER.debug("Replacing queue: {}, with id: {}", createArg, resourceId); RouterObjectRef objectRef = RouterObjectRef.builder().setRef(resourceId).setRouterRef(routerRef).build(); ApiObjectRef queue = queueService.replace(createArg, objectRef); return createResponse(queue); }
@ApiOperation("Retrieving existing product") @ApiResponse(code = 200, message = "Product has been fetched") @ResponseStatus(HttpStatus.OK) @GetMapping("/{id}") public ProductDto retrieve(@PathVariable long id) { return productService.get(id); }