io.swagger.v3.oas.annotations.Parameter Java Examples

The following examples show how to use io.swagger.v3.oas.annotations.Parameter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskResource.java    From Singularity with Apache License 2.0 6 votes vote down vote up
@GET
@PropertyFiltering
@Path("/active/states")
@Operation(summary = "Retrieve the list of active task ids for all requests")
public Map<SingularityTaskId, List<SingularityTaskHistoryUpdate>> getActiveTaskStates(
  @Parameter(hidden = true) @Auth SingularityUser user,
  @Parameter(
    description = "Use the cached version of this data to limit expensive api calls"
  ) @QueryParam("useWebCache") Boolean useWebCache
) {
  List<SingularityTaskId> activeTaskIds = authorizationHelper.filterByAuthorizedRequests(
    user,
    taskManager.getActiveTaskIds(),
    SingularityTransformHelpers.TASK_ID_TO_REQUEST_ID,
    SingularityAuthorizationScope.READ
  );
  return taskManager.getTaskHistoryUpdates(activeTaskIds);
}
 
Example #2
Source File: BuildConfigurationEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value CLONE_DESC}
 *
 * @param id {@value BC_ID}
 * @return
 */
@Operation(
        summary = CLONE_DESC,
        responses = {
                @ApiResponse(
                        responseCode = ENTITY_CREATED_CODE,
                        description = ENTITY_CREATED_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = BuildConfiguration.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@POST
@RespondWithStatus(Response.Status.CREATED)
@Path("/{id}/clone")
BuildConfiguration clone(@Parameter(description = BC_ID) @PathParam("id") String id);
 
Example #3
Source File: Sample2.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Produces({ MediaType.APPLICATION_JSON })
@Path("/{name}")
@GET
@Operation(
    summary = "Get item by name",
    description = "Get operation with type and headers",
    responses = {
        @ApiResponse(content = @Content(schema = @Schema(implementation = Item.class)), responseCode = "200"),
        @ApiResponse(responseCode = "404")
    }
)
public Response getItem(
        @Parameter(required = true) @HeaderParam("Accept-Language") final String language,
        @Parameter(required = true) @PathParam("name") String name) {
    return items.containsKey(name) 
        ? Response.ok().entity(items.get(name)).build() 
            : Response.status(Status.NOT_FOUND).build();
}
 
Example #4
Source File: ProjectEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value PATCH_SPECIFIC_DESC}
 * 
 * @param id {@value P_ID}
 * @param project
 * @return
 */
@Operation(
        summary = PATCH_SPECIFIC_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = Project.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@PATCH
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
Project patchSpecific(@Parameter(description = P_ID) @PathParam("id") String id, @NotNull Project project);
 
Example #5
Source File: ProductVersionEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value GET_BUILD_CONFIGS_DESC}
 * 
 * @param id {@value PV_ID}
 * @param pageParams
 * @return
 */
@Operation(
        summary = GET_BUILD_CONFIGS_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = BuildConfigPage.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
@Path("/{id}/build-configs")
Page<BuildConfiguration> getBuildConfigs(
        @Parameter(description = PV_ID) @PathParam("id") String id,
        @Valid @BeanParam PageParameters pageParams);
 
Example #6
Source File: RequestResource.java    From Singularity with Apache License 2.0 6 votes vote down vote up
@Deprecated
@DELETE
@Path("/request/{requestId}/skipHealthchecks")
@Operation(
  summary = "Delete/cancel the expiring skipHealthchecks. This makes the skipHealthchecks request permanent",
  responses = {
    @ApiResponse(
      responseCode = "404",
      description = "No Request or expiring skipHealthchecks request for that ID"
    )
  }
)
public SingularityRequestParent deleteExpiringSkipHealthchecksDeprecated(
  @Parameter(hidden = true) @Auth SingularityUser user,
  @Parameter(required = true, description = "The Request ID") @PathParam(
    "requestId"
  ) String requestId
) {
  return deleteExpiringSkipHealthchecks(user, requestId);
}
 
Example #7
Source File: PublicApiHandler.java    From syndesis with Apache License 2.0 6 votes vote down vote up
/**
 * Configure a connection.
 */
@POST
@Path("connections/{id}/properties")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public ConnectionOverview configureConnection(@Context SecurityContext sec,
                                              @NotNull @PathParam("id") @Parameter(required = true) String connectionId,
                                              @NotNull @QueryParam("refreshIntegrations") @Parameter Boolean refeshIntegrations,
                                              @NotNull @Parameter(required = true) Map<String, String> properties) {

    validateParam("connectionId", connectionId);
    final Connection connection = getResource(Connection.class, connectionId, WithResourceId::hasId);

    @SuppressWarnings("JdkObsolete") Date  now = new Date();
    updateConnection(connection, properties, refeshIntegrations, now, null);
    return connectionHandler.get(connection.getId().get());
}
 
Example #8
Source File: BuildTaskEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
@Operation(
        summary = "DEPRECATED: Triggers the build execution for a given configuration.",
        responses = { @ApiResponse(responseCode = SUCCESS_CODE, description = SUCCESS_DESCRIPTION),
                @ApiResponse(responseCode = INVALID_CODE, description = INVALID_DESCRIPTION),
                @ApiResponse(responseCode = SERVER_ERROR_CODE, description = SERVER_ERROR_DESCRIPTION),
                @ApiResponse(responseCode = FORBIDDEN_CODE, description = FORBIDDEN_DESCRIPTION), })
@POST
@Path("/execute-build")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Deprecated
public Response build(
        @Parameter(
                description = "Build Execution Configuration. See org.jboss.pnc.spi.executor.BuildExecutionConfiguration.",
                required = true) @FormParam("buildExecutionConfiguration") BuildExecutionConfigurationRest buildExecutionConfiguration,
        @Parameter(
                description = "Username who triggered the build. If empty current user is used.") @FormParam("usernameTriggered") String usernameTriggered,
        @Parameter(description = "Optional Callback URL") @FormParam("callbackUrl") String callbackUrl);
 
Example #9
Source File: ShuffleConfigurationResource.java    From Singularity with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/blacklist/{requestId}")
@Operation(summary = "Check if a request ID is on the shuffle blacklist.")
public boolean isOnShuffleBlacklist(
  @Parameter(hidden = true) @Auth SingularityUser user,
  @Parameter(
    required = true,
    description = "The Request ID to fetch crash loops for"
  ) @PathParam("requestId") String requestId
) {
  authorizationHelper.checkForAuthorizationByRequestId(
    requestId,
    user,
    SingularityAuthorizationScope.READ
  );
  return shuffleCfgManager.isOnShuffleBlacklist(requestId);
}
 
Example #10
Source File: OMAGServerPlatformActiveResource.java    From egeria with Apache License 2.0 6 votes vote down vote up
/**
 * Return the list of all services that are registered (supported) in this OMAG Server Platform.
 *
 * @param userId calling user
 * @return list of service descriptions
 */
@GetMapping(path = "/registered-services")
@Operation( summary = "Get all registered services",
        description="Retrieve a list of all services registered on this platform",
        responses = {
                @ApiResponse(responseCode = "200",description="list of service descriptions",
                        content = @Content(
                                mediaType ="application/json",
                                schema = @Schema(implementation=RegisteredOMAGServicesResponse.class)
                        )

                )
        })
public RegisteredOMAGServicesResponse getAllRegisteredServices(@Parameter(description="calling user") @PathVariable String userId)
{
    return platformAPI.getAllRegisteredServices(userId);
}
 
Example #11
Source File: HistoryResource.java    From Singularity with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/request/{requestId}/tasks/active")
@Operation(summary = "Retrieve the history for all active tasks of a specific request")
public List<SingularityTaskIdHistory> getTaskHistoryForRequest(
  @Parameter(hidden = true) @Auth SingularityUser user,
  @Parameter(required = true, description = "Request ID to look up") @PathParam(
    "requestId"
  ) String requestId
) {
  authorizationHelper.checkForAuthorizationByRequestId(
    requestId,
    user,
    SingularityAuthorizationScope.READ
  );
  List<SingularityTaskId> activeTaskIds = taskManager.getActiveTaskIdsForRequest(
    requestId
  );

  return taskHistoryHelper.getTaskHistoriesFor(taskManager, activeTaskIds);
}
 
Example #12
Source File: FooBarController.java    From tutorials with MIT License 6 votes vote down vote up
@Operation(summary = "Create a foo")
@ApiResponses(value = {
        @ApiResponse(responseCode = "201", description = "foo created", content = { @
                Content(mediaType = "application/json", schema = @Schema(implementation = Foo.class))}),
        @ApiResponse(responseCode = "404", description = "Bad request", content = @Content) })
@PostMapping
public ResponseEntity<Foo> addFoo(@Parameter(description = "foo object to be created") @RequestBody @Valid Foo foo) {
    HttpHeaders httpHeaders = new HttpHeaders();
    httpHeaders.setLocation(linkTo(FooBarController.class).slash(foo.getId()).toUri());
    Foo savedFoo;
    try {
        savedFoo = repository.save(foo);
    } catch (Exception e) {
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }

    return new ResponseEntity<>(savedFoo, httpHeaders, HttpStatus.CREATED);
}
 
Example #13
Source File: BuildEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value GET_BUILD_CONFIG_REVISION}
 *
 * @param id {@value B_ID}
 * @return
 */
@Operation(
        summary = GET_BUILD_CONFIG_REVISION,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = BuildConfigurationRevision.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
@Path("/{id}/build-config-revision")
BuildConfigurationRevision getBuildConfigRevision(@Parameter(description = B_ID) @PathParam("id") String id);
 
Example #14
Source File: ProductMilestoneEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value GET_BUILDS_DESC}
 * 
 * @param id {@value PM_ID}
 * @param pageParameters
 * @param buildsFilter
 * @return
 */
@Operation(
        summary = GET_BUILDS_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = BuildPage.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
@Path("/{id}/builds")
Page<Build> getBuilds(
        @Parameter(description = PM_ID) @PathParam("id") String id,
        @Valid @BeanParam PageParameters pageParameters,
        @BeanParam BuildsFilterParameters buildsFilter);
 
Example #15
Source File: Sample.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Produces({ MediaType.APPLICATION_JSON })
@Path("/{name}")
@PUT
@Operation(
    summary = "Update an existing new item",
    description = "Put operation with form parameter",
    responses = {
        @ApiResponse(
            content = @Content(schema = @Schema(implementation = Item.class)),
            responseCode = "200"
        )
    }
)
public Item updateItem(
        @Parameter(required = true) @PathParam("name") String name,
        @Parameter(required = true) @FormParam("value") String value) {
    Item item = new Item(name, value);
    items.put(name,  item);
    return item;
}
 
Example #16
Source File: BuildConfigurationEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value GET_DEPENDENCIES_DESC}
 *
 * @param id {@value BC_ID}
 * @param pageParams
 * @return
 */
@Operation(
        summary = GET_DEPENDENCIES_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = BuildConfigPage.class))),
                @ApiResponse(
                        responseCode = INVALID_CODE,
                        description = INVALID_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
@Path("/{id}/dependencies")
Page<BuildConfiguration> getDependencies(
        @Parameter(description = BC_ID) @PathParam("id") String id,
        @Valid @BeanParam PageParameters pageParams);
 
Example #17
Source File: RequestResource.java    From Singularity with Apache License 2.0 6 votes vote down vote up
@GET
@PropertyFiltering
@Path("/lbcleanup")
@Operation(summary = "Retrieve the list of tasks being cleaned from load balancers.")
public Iterable<String> getLbCleanupRequests(
  @Parameter(hidden = true) @Auth SingularityUser user,
  @Parameter(
    description = "Fetched a cached version of this data to limit expensive operations"
  ) @QueryParam("useWebCache") Boolean useWebCache
) {
  return authorizationHelper.filterAuthorizedRequestIds(
    user,
    requestManager.getLbCleanupRequestIds(),
    SingularityAuthorizationScope.READ,
    useWebCache(useWebCache)
  );
}
 
Example #18
Source File: HelloController.java    From springdoc-openapi with Apache License 2.0 6 votes vote down vote up
@PostMapping("/test1")
@Operation(summary = "Example api that realize an ECHO operation",
		description = "The result of the echo is the input value of the api",
		parameters = { @Parameter(in = ParameterIn.PATH,
				name = "uuid",
				required = true,
				description = "Is the identification of the document",
				schema = @Schema(type = "string",
						example = "uuid")) }


)
@ApiResponses(value = {
		@ApiResponse(description = "Successful Operation",
				responseCode = "200",
				content = @Content(mediaType = "application/json",
						schema = @Schema(implementation = PersonDTO.class))),
		@ApiResponse(responseCode = "201",
				description = "other possible response")
})
public String postMyRequestBody1() {
	return null;
}
 
Example #19
Source File: Sample2.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Consumes({ MediaType.APPLICATION_JSON })
@POST
@Operation(
    summary = "Create new item",
    description = "Post operation with entity in a body",
    responses = {
        @ApiResponse(
            content = @Content(
                schema = @Schema(implementation = Item.class), 
                mediaType = MediaType.APPLICATION_JSON
            ),
            headers = @Header(name = "Location"),
            responseCode = "201"
        )
    }
)
public Response createItem(
    @Context final UriInfo uriInfo,
    @Parameter(required = true) final Item item) {
    items.put(item.getName(), item);
    return Response
        .created(uriInfo.getBaseUriBuilder().path(item.getName()).build())
        .entity(item).build();
}
 
Example #20
Source File: ProductMilestoneEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value GET_SPECIFIC_DESC}
 * 
 * @param id {@value PM_ID}
 * @return
 */
@Operation(
        summary = GET_SPECIFIC_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ProductMilestone.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON_PATCH_JSON) // workaround for PATCH support
ProductMilestone getSpecific(@Parameter(description = PM_ID) @PathParam("id") String id);
 
Example #21
Source File: RackResource.java    From Singularity with Apache License 2.0 6 votes vote down vote up
@POST
@Path("/rack/{rackId}/freeze")
@Operation(summary = "Freeze a specific rack")
public Response freezeRack(
  @Context HttpServletRequest requestContext,
  @Parameter(hidden = true) @Auth SingularityUser user,
  @Parameter(required = true, description = "Rack ID") @PathParam(
    "rackId"
  ) String rackId,
  @RequestBody(
    description = "Settings related to changing the state of a slave"
  ) SingularityMachineChangeRequest changeRequest
) {
  return maybeProxyToLeader(
    requestContext,
    Response.class,
    changeRequest,
    () -> {
      final Optional<SingularityMachineChangeRequest> maybeChangeRequest = Optional.ofNullable(
        changeRequest
      );
      super.freeze(rackId, maybeChangeRequest, user, SingularityAction.FREEZE_RACK);
      return Response.ok().build();
    }
  );
}
 
Example #22
Source File: SetsResource.java    From cantor with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@GET
@Path("/{namespace}/{set}")
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "Get entries from a set")
@ApiResponses(value = {
    @ApiResponse(responseCode = "200",
                 description = "Provides entry names and weights matching query parameters as properties in a json",
                 content = @Content(schema = @Schema(implementation = Map.class))),
    @ApiResponse(responseCode = "400", description = "One of the query parameters has a bad value"),
    @ApiResponse(responseCode = "500", description = serverErrorMessage)
})
public Response get(@Parameter(description = "Namespace identifier") @PathParam("namespace") final String namespace,
                    @Parameter(description = "Name of the set") @PathParam("set") final String set,
                    @BeanParam final SetsDataSourceBean bean) throws IOException {
    logger.info("received request for values in set/namespace {}/{}", set, namespace);
    logger.debug("request parameters: {}", bean);
    final Map<String, Long> entries = this.cantor.sets().get(
            namespace,
            set,
            bean.getMin(),
            bean.getMax(),
            bean.getStart(),
            bean.getCount(),
            bean.isAscending());
    return Response.ok(parser.toJson(entries)).build();
}
 
Example #23
Source File: RequestResource.java    From Singularity with Apache License 2.0 6 votes vote down vote up
@DELETE
@Path("/request/{requestId}/skip-healthchecks")
@Operation(
  summary = "Delete/cancel the expiring skipHealthchecks. This makes the skipHealthchecks request permanent",
  responses = {
    @ApiResponse(
      responseCode = "404",
      description = "No Request or expiring skipHealthchecks request for that ID"
    )
  }
)
public SingularityRequestParent deleteExpiringSkipHealthchecks(
  @Parameter(hidden = true) @Auth SingularityUser user,
  @Parameter(required = true, description = "The Request ID") @PathParam(
    "requestId"
  ) String requestId
) {
  return deleteExpiringObject(
    SingularityExpiringSkipHealthchecks.class,
    requestId,
    user
  );
}
 
Example #24
Source File: OMAGServerPlatformActiveResource.java    From egeria with Apache License 2.0 6 votes vote down vote up
/**
 * Return the list of services that are active on a specific OMAG Server that is active on this OMAG Server Platform.
 *
 * @param userId name of the user making the request
 * @param serverName name of the server of interest
 * @return server name and list od services running within
 */
@GetMapping(path = "/servers/{serverName}/services")
@Operation( summary = "Get active services for server",
        description="Return the list of services that are active on the server on this platform",
        responses = {
                @ApiResponse(responseCode = "200",description="details of server status",
                        content = @Content(
                                mediaType ="application/json",
                                schema = @Schema(implementation=ServerServicesListResponse.class)
                        )

                )
        })
public ServerServicesListResponse getActiveServiceListForServer(@Parameter(description="calling user") @PathVariable String    userId,
                                                                @Parameter(description="server name") @PathVariable String    serverName)
{
    return platformAPI.getActiveServiceListForServer(userId, serverName);
}
 
Example #25
Source File: ArtifactEndpoint.java    From pnc with Apache License 2.0 6 votes vote down vote up
/**
 * {@value GET_SPECIFIC_DESC}
 *
 * @param id {@value A_ID}
 * @return
 */
@Operation(
        summary = GET_SPECIFIC_DESC,
        responses = {
                @ApiResponse(
                        responseCode = SUCCESS_CODE,
                        description = SUCCESS_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = Artifact.class))),
                @ApiResponse(responseCode = NOT_FOUND_CODE, description = NOT_FOUND_DESCRIPTION),
                @ApiResponse(
                        responseCode = SERVER_ERROR_CODE,
                        description = SERVER_ERROR_DESCRIPTION,
                        content = @Content(schema = @Schema(implementation = ErrorResponse.class))) })
@GET
@Path("/{id}")
Artifact getSpecific(@Parameter(description = "ID of the Artifact") @PathParam("id") String id);
 
Example #26
Source File: SetsResource.java    From cantor with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@DELETE
@Path("/{namespace}/{set}")
@Operation(summary = "Delete entries in a set between provided weights")
@ApiResponses(value = {
    @ApiResponse(responseCode = "200", description = "Successfully deleted entries between and including provided weights"),
    @ApiResponse(responseCode = "400", description = "One of the query parameters has a bad value"),
    @ApiResponse(responseCode = "500", description = serverErrorMessage)
})
public Response delete(@Parameter(description = "Namespace identifier") @PathParam("namespace") final String namespace,
                       @Parameter(description = "Name of the set") @PathParam("set") final String set,
                       @Parameter(description = "Minimum weight for an entry", example = "0") @QueryParam("min") final long min,
                       @Parameter(description = "Maximum weight for an entry", example = "0") @QueryParam("max") final long max) throws IOException {
    logger.info("received request to delete entries in set/namespace {}/{} between weights {}-{}", set, namespace, min, max);
    this.cantor.sets().delete(namespace, set, min, max);
    return Response.ok().build();
}
 
Example #27
Source File: DisastersResource.java    From Singularity with Apache License 2.0 6 votes vote down vote up
@POST
@Path("/failover")
@Operation(
  summary = "Force the leading Singularity instance to restart and give up leadership"
)
public Response forceFailover(
  @Parameter(hidden = true) @Auth SingularityUser user,
  @Context HttpServletRequest requestContext
) {
  authorizationHelper.checkAdminAuthorization(user);
  return maybeProxyToLeader(
    requestContext,
    Response.class,
    null,
    () -> this.runFailover(user)
  );
}
 
Example #28
Source File: Sample.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Consumes({ MediaType.APPLICATION_JSON })
@POST
@Operation(
    summary = "Create new item",
    description = "Post operation with entity in a body",
    responses = {
        @ApiResponse(
            content = @Content(
                schema = @Schema(implementation = Item.class), 
                mediaType = MediaType.APPLICATION_JSON
            ),
            headers = @Header(name = "Location"),
            responseCode = "201"
        )
    }
)
public Response createItem(
    @Context final UriInfo uriInfo,
    @Parameter(required = true) final Item item) {
    items.put(item.getName(), item);
    return Response
        .created(uriInfo.getBaseUriBuilder().path(item.getName()).build())
        .entity(item).build();
}
 
Example #29
Source File: LinksService.java    From lagom-openapi with Apache License 2.0 5 votes vote down vote up
@Operation(
    operationId = "getUserWithAddress",
    parameters = @Parameter(
        description = "User identity",
        name = "userId",
        in = QUERY,
        schema = @Schema(implementation = String.class)
    ),
    responses = {
        @ApiResponse(
            description = "test description",
            content = @Content(
                mediaType = "application/json",
                schema = @Schema(implementation = User.class)
            ),
            links = {
                @Link(
                    name = "Link",
                    operationId = "getAddress",
                    parameters = @LinkParameter(
                        name = "userId",
                        expression = "$request.query.userId"
                    ))
            })
    }
)
ServiceCall<NotUsed, User> test(String userId);
 
Example #30
Source File: RequestResource.java    From Singularity with Apache License 2.0 5 votes vote down vote up
@GET
@PropertyFiltering
@Operation(summary = "Retrieve the list of all requests")
public List<SingularityRequestParent> getRequests(
  @Parameter(hidden = true) @Auth SingularityUser user,
  @Parameter(
    description = "Fetched a cached version of this data to limit expensive operations"
  ) @QueryParam("useWebCache") Boolean useWebCache,
  @Parameter(
    description = "Only include requests that the user has operated on or is in a group for"
  ) @QueryParam("filterRelevantForUser") Boolean filterRelevantForUser,
  @Parameter(
    description = "Return full data, including deploy data and active task ids"
  ) @QueryParam("includeFullRequestData") Boolean includeFullRequestData,
  @Parameter(description = "The maximum number of results to return") @QueryParam(
    "limit"
  ) Integer limit,
  @Parameter(description = "Only return requests of these types") @QueryParam(
    "requestType"
  ) List<RequestType> requestTypes
) {
  return requestHelper.fillDataForRequestsAndFilter(
    filterAutorized(
      requestManager.getRequests(useWebCache(useWebCache)),
      SingularityAuthorizationScope.READ,
      user
    ),
    user,
    valueOrFalse(filterRelevantForUser),
    valueOrFalse(includeFullRequestData),
    Optional.ofNullable(limit),
    requestTypes
  );
}