本文整理匯總了Java中io.swagger.annotations.ApiResponse類的典型用法代碼示例。如果您正苦於以下問題:Java ApiResponse類的具體用法?Java ApiResponse怎麽用?Java ApiResponse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ApiResponse類屬於io.swagger.annotations包,在下文中一共展示了ApiResponse類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: putSubjectConnector
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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);
}
}
示例2: validate
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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);
}
示例3: getParticipantFromCGOR
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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);
}
示例4: getCustomerServiceMetadata
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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);
}
示例5: getMetadata
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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);
}
示例6: getResourceConnector
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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);
}
}
示例7: install
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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);
}
示例8: changedSince
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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;
}
示例9: getApplianceManagerConnector
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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();
}
示例10: addDossierFileByDossierId
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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);
示例11: getStatus
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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();
}
示例12: getSecurityGroupInterface
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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;
}
示例13: hasILXP
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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();
}
}
示例14: getOrganisationInvitations
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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);
}
示例15: delete
import io.swagger.annotations.ApiResponse; //導入依賴的package包/類
@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);
}