org.glassfish.grizzly.http.server.Request Java Examples

The following examples show how to use org.glassfish.grizzly.http.server.Request. 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: ResourceGroups.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@DELETE
@Path("{rscGrpName}")
public Response deleteResourceGroup(
    @Context Request request,
    @PathParam("rscGrpName") String rscGrpName
)
{
    return requestHelper.doInScope(
        requestHelper.createContext(ApiConsts.API_DEL_RSC_GRP, request),
        () -> ApiCallRcRestUtils.toResponse(
            ctrlApiCallHandler.deleteResourceGroup(rscGrpName),
            Response.Status.OK
        ),
        true
    );
}
 
Example #2
Source File: KeyValueStore.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@PUT
@Path("{instance}")
public Response modifyKVStore(
    @Context Request request,
    @PathParam("instance") String instanceName,
    String jsonData
)
{
    return requestHelper.doInScope(ApiConsts.API_MOD_KVS, request, () ->
    {
        JsonGenTypes.KeyValueStoreModify modifyKeyValueStore = objectMapper.readValue(
            jsonData,
            JsonGenTypes.KeyValueStoreModify.class
        );

        return ApiCallRcRestUtils.toResponse(ctrlApiCallHandler.modifyKvs(
            null,
            instanceName,
            modifyKeyValueStore.override_props,
            new HashSet<>(modifyKeyValueStore.delete_props),
            new HashSet<>(modifyKeyValueStore.delete_namespaces)
        ), Response.Status.OK);
    }, true);
}
 
Example #3
Source File: WebServer.java    From AthenaX with Apache License 2.0 6 votes vote down vote up
public WebServer(URI endpoint) throws IOException {
  this.server = GrizzlyServerFactory.createHttpServer(endpoint, new HttpHandler() {

    @Override
    public void service(Request rqst, Response rspns) throws Exception {
      rspns.setStatus(HttpStatus.NOT_FOUND_404.getStatusCode(), "Not found");
      rspns.getWriter().write("404: not found");
    }
  });

  WebappContext context = new WebappContext("WebappContext", BASE_PATH);
  ServletRegistration registration = context.addServlet("ServletContainer", ServletContainer.class);
  registration.setInitParameter(ServletContainer.RESOURCE_CONFIG_CLASS,
      PackagesResourceConfig.class.getName());

  StringJoiner sj = new StringJoiner(",");
  for (String s : PACKAGES) {
    sj.add(s);
  }

  registration.setInitParameter(PackagesResourceConfig.PROPERTY_PACKAGES, sj.toString());
  registration.addMapping(BASE_PATH);
  context.deploy(server);
}
 
Example #4
Source File: StoragePoolDefinitions.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@POST
public Response createStoragePoolDefinition(
    @Context Request request,
    String jsonData
)
{
    return requestHelper.doInScope(requestHelper.createContext(ApiConsts.API_CRT_STOR_POOL_DFN, request), () ->
    {
        JsonGenTypes.StoragePoolDefinition data = objectMapper
            .readValue(jsonData, JsonGenTypes.StoragePoolDefinition.class);

        return ApiCallRcRestUtils.toResponse(
            ctrlApiCallHandler.createStoragePoolDefinition(data.storage_pool_name, data.props),
            Response.Status.CREATED
        );
    }, true);
}
 
Example #5
Source File: Resources.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Path("{nodeName}")
public void createResource(
    @Context Request request,
    @Suspended final AsyncResponse asyncResponse,
    @PathParam("rscName") String rscName,
    @PathParam("nodeName") String nodeName,
    String jsonData
)
{
    try
    {
        // stuff single resource in a array and forward to the multiple resource creator
        JsonGenTypes.ResourceCreate rscData = objectMapper.readValue(jsonData, JsonGenTypes.ResourceCreate.class);
        rscData.resource.node_name = nodeName;
        ArrayList<JsonGenTypes.ResourceCreate> rscDatas = new ArrayList<>();
        rscDatas.add(rscData);

        createResource(request, asyncResponse, rscName, objectMapper.writeValueAsString(rscDatas));
    }
    catch (IOException ioExc)
    {
        ApiCallRcRestUtils.handleJsonParseException(ioExc, asyncResponse);
    }
}
 
Example #6
Source File: PinotSegmentUploadDownloadRestletResource.java    From incubator-pinot with Apache License 2.0 6 votes vote down vote up
@POST
@ManagedAsync
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/v2/segments")
@ApiOperation(value = "Upload a segment", notes = "Upload a segment as json")
// We use this endpoint with URI upload because a request sent with the multipart content type will reject the POST
// request if a multipart object is not sent. This endpoint is recommended for use. It differs from the first
// endpoint in how it moves the segment to a Pinot-determined final directory.
public void uploadSegmentAsJsonV2(String segmentJsonStr,
    @ApiParam(value = "Name of the table") @QueryParam(FileUploadDownloadClient.QueryParameters.TABLE_NAME) String tableName,
    @ApiParam(value = "Whether to enable parallel push protection") @DefaultValue("false") @QueryParam(FileUploadDownloadClient.QueryParameters.ENABLE_PARALLEL_PUSH_PROTECTION) boolean enableParallelPushProtection,
    @Context HttpHeaders headers, @Context Request request, @Suspended final AsyncResponse asyncResponse) {
  try {
    asyncResponse.resume(uploadSegment(tableName, null, enableParallelPushProtection, headers, request, true));
  } catch (Throwable t) {
    asyncResponse.resume(t);
  }
}
 
Example #7
Source File: VolumeGroups.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@DELETE
@Path("{volume_number}")
public Response deleteVolumeGroup(
    @Context Request request,
    @PathParam("rscName") String rscName,
    @PathParam("volume_number") int volumeNumber
)
{
    return requestHelper.doInScope(
        requestHelper.createContext(ApiConsts.API_DEL_VLM_GRP, request),
        () -> ApiCallRcRestUtils.toResponse(
            ctrlApiCallHandler.deleteVolumeGroup(rscName, volumeNumber),
            Response.Status.OK
        ),
        true
    );
}
 
Example #8
Source File: Resources.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@PUT
@Path("{nodeName}")
public void modifyResource(
    @Context Request request,
    @Suspended final AsyncResponse asyncResponse,
    @PathParam("nodeName") String nodeName,
    @PathParam("rscName") String rscName,
    String jsonData
)
    throws IOException
{
    JsonGenTypes.ResourceModify modifyData = objectMapper
        .readValue(jsonData, JsonGenTypes.ResourceModify.class);

    Flux<ApiCallRc> flux = ctrlApiCallHandler.modifyRsc(
        null,
        nodeName,
        rscName,
        modifyData.override_props,
        new HashSet<>(modifyData.delete_props),
        new HashSet<>(modifyData.delete_namespaces)
    )
    .subscriberContext(requestHelper.createContext(ApiConsts.API_MOD_RSC, request));

    requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.OK));
}
 
Example #9
Source File: Resources.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@PUT
@Path("{nodeName}/toggle-disk/diskless/{disklessPool}")
public void toggleDiskDiskless(
    @Context Request request,
    @Suspended final AsyncResponse asyncResponse,
    @PathParam("nodeName") String nodeName,
    @PathParam("rscName") String rscName,
    @PathParam("disklessPool") String disklessPool
)
{
    Flux<ApiCallRc> flux = ctrlRscToggleDiskApiCallHandler.resourceToggleDisk(
            nodeName,
            rscName,
            disklessPool,
            null,
            true)
        .subscriberContext(requestHelper.createContext(ApiConsts.API_TOGGLE_DISK, request));

    requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux));
}
 
Example #10
Source File: PinotSegmentUploadDownloadRestletResource.java    From incubator-pinot with Apache License 2.0 6 votes vote down vote up
@POST
@ManagedAsync
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Path("/v2/segments")
@ApiOperation(value = "Upload a segment", notes = "Upload a segment as binary")
// This behavior does not differ from v1 of the same endpoint.
public void uploadSegmentAsMultiPartV2(FormDataMultiPart multiPart,
    @ApiParam(value = "Name of the table") @QueryParam(FileUploadDownloadClient.QueryParameters.TABLE_NAME) String tableName,
    @ApiParam(value = "Whether to enable parallel push protection") @DefaultValue("false") @QueryParam(FileUploadDownloadClient.QueryParameters.ENABLE_PARALLEL_PUSH_PROTECTION) boolean enableParallelPushProtection,
    @Context HttpHeaders headers, @Context Request request, @Suspended final AsyncResponse asyncResponse) {
  try {
    asyncResponse.resume(uploadSegment(tableName, multiPart, enableParallelPushProtection, headers, request, true));
  } catch (Throwable t) {
    asyncResponse.resume(t);
  }
}
 
Example #11
Source File: GrizzlyHttpService.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
private void addHTTPSRedirectHandler(HttpServer httpServerRef, int httpsPort)
{
    httpServerRef.getServerConfiguration().addHttpHandler(
        new HttpHandler()
        {
            @Override
            public void service(Request request, Response response) throws Exception
            {
                response.setStatus(HttpStatus.NOT_FOUND_404);
                response.sendRedirect(
                    String.format("https://%s:%d", request.getServerName(), httpsPort) +
                        request.getHttpHandlerPath()
                );
            }
        }
    );
}
 
Example #12
Source File: Nodes.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@POST
@Path("{nodeName}/net-interfaces")
public Response createNetInterface(
    @Context Request request,
    @PathParam("nodeName") String nodeName,
    String jsonData
)
{
    return requestHelper.doInScope(ApiConsts.API_CRT_NET_IF, request, () ->
    {
        JsonGenTypes.NetInterface netInterface = objectMapper
            .readValue(jsonData, JsonGenTypes.NetInterface.class);

        ApiCallRc apiCallRc = ctrlApiCallHandler.createNetInterface(
            nodeName,
            netInterface.name,
            netInterface.address,
            netInterface.satellite_port,
            netInterface.satellite_encryption_type,
            netInterface.is_active
        );
        return ApiCallRcRestUtils.toResponse(apiCallRc, Response.Status.CREATED);
    }, true);
}
 
Example #13
Source File: Nodes.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@PUT
@Path("{nodeName}/reconnect")
public Response reconnectNode(
    @Context Request request,
    @PathParam("nodeName") String nodeName
)
{
    return requestHelper.doInScope(requestHelper.createContext(ApiConsts.API_NODE_RECONNECT, request), () ->
    {
        List<String> nodes = new ArrayList<>();
        nodes.add(nodeName);
        ApiCallRc apiCallRc = ctrlApiCallHandler.reconnectNode(nodes);

        return ApiCallRcRestUtils.toResponse(apiCallRc, Response.Status.OK);
    }, false);
}
 
Example #14
Source File: Controller.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@POST
@Path("properties")
public Response setProperties(
    @Context Request request,
    String jsonData
)
{
    return requestHelper.doInScope(ApiConsts.API_SET_CTRL_PROP, request, () ->
    {
        JsonGenTypes.ControllerPropsModify properties = objectMapper.readValue(
            jsonData,
            JsonGenTypes.ControllerPropsModify.class
        );

        ApiCallRc apiCallRc = ctrlApiCallHandler.modifyCtrl(
            properties.override_props,
            new HashSet<>(properties.delete_props),
            new HashSet<>(properties.delete_namespaces)
        );

        return ApiCallRcRestUtils.toResponse(apiCallRc, Response.Status.CREATED);

    }, true);
}
 
Example #15
Source File: Controller.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@DELETE
@Path("properties/{key : .*}")
public Response deleteProperty(
    @Context Request request,
    @PathParam("key") String key
)
{
    return requestHelper.doInScope(ApiConsts.API_DEL_CTRL_PROP, request, () ->
    {
        Pair<String, String> keyPair = splitFullKey(key);

        ApiCallRc apiCallRc = ctrlApiCallHandler.deleteCtrlCfgProp(
            keyPair.objA,
            keyPair.objB
        );

        return ApiCallRcRestUtils.toResponse(apiCallRc, Response.Status.OK);
    }, true);
}
 
Example #16
Source File: Resources.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@PUT
@Path("{nodeName}/migrate-disk/{fromNode}/{storagePool}")
public void migrateDisk(
    @Context Request request,
    @Suspended final AsyncResponse asyncResponse,
    @PathParam("nodeName") String nodeName,
    @PathParam("fromNode") String fromNode,
    @PathParam("rscName") String rscName,
    @PathParam("storagePool") String storagePool
)
{
    Flux<ApiCallRc> flux = ctrlRscToggleDiskApiCallHandler.resourceToggleDisk(
        nodeName,
        rscName,
        storagePool,
        fromNode,
        false)
        .subscriberContext(requestHelper.createContext(ApiConsts.API_TOGGLE_DISK, request));

    requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux));
}
 
Example #17
Source File: StoragePoolDefinitions.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@PUT
@Path("{storagePool}")
public void modifyStoragePoolDefinition(
    @Context Request request,
    @Suspended final AsyncResponse asyncResponse,
    @PathParam("storagePool") String storagePoolName,
    String jsonData
)
    throws IOException
{
    JsonGenTypes.StoragePoolDefinitionModify data = objectMapper
        .readValue(jsonData, JsonGenTypes.StoragePoolDefinitionModify.class);

        Flux<ApiCallRc> flux = ctrlApiCallHandler.modifyStorPoolDfn(
            null,
            storagePoolName,
            data.override_props,
            new HashSet<>(data.delete_props),
            new HashSet<>(data.delete_namespaces)
        )
        .subscriberContext(requestHelper.createContext(ApiConsts.API_MOD_STOR_POOL_DFN, request));

    requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.OK));
}
 
Example #18
Source File: ErrorReports.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@GET
public void listErrorReports(
    @Context Request request,
    @Suspended final AsyncResponse asyncResponse,
    @QueryParam("node") String nodeName,
    @QueryParam("since") Long since,
    @QueryParam("to") Long to,
    @DefaultValue("false") @QueryParam("withContent") boolean withContent,
    @DefaultValue("0") @QueryParam("limit") int limit,
    @DefaultValue("0") @QueryParam("offset") int offset
)
{
    listErrorReports(
        request,
        asyncResponse,
        nodeName,
        null,
        since,
        to,
        withContent,
        limit,
        offset
    );
}
 
Example #19
Source File: Nodes.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
private Response listNodesOneOrMany(
    Request request,
    String searchNodeName,
    List<String> nodeNames,
    List<String> propFilters,
    int limit,
    int offset
)
{
    return requestHelper.doInScope(requestHelper.createContext(ApiConsts.API_LST_NODE, request), () ->
    {
        Stream<NodeApi> nodeApiStream = ctrlApiCallHandler.listNodes(nodeNames, propFilters).stream();
        if (limit > 0)
        {
            nodeApiStream = nodeApiStream.skip(offset).limit(limit);
        }
        List<Node> nodeDataList = nodeApiStream
            .map(Json::apiToNode)
            .collect(Collectors.toList());

        return RequestHelper.queryRequestResponse(
            objectMapper, ApiConsts.FAIL_NOT_FOUND_NODE, "Node", searchNodeName, nodeDataList
        );
    }, false);
}
 
Example #20
Source File: Encryption.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@PATCH
@Path("passphrase")
public Response enterPassphrase(
    @Context Request request,
    String jsonData
)
{
    return requestHelper.doInScope(ApiConsts.API_ENTER_CRYPT_PASS, request, () ->
    {
        String passPhrase = objectMapper.readValue(jsonData, String.class);

        ApiCallRc apiCallRc = ctrlApiCallHandler.enterPassphrase(passPhrase);

        return ApiCallRcRestUtils.toResponse(apiCallRc, Response.Status.OK);
    }, true);
}
 
Example #21
Source File: WeatherServer.java    From training with MIT License 6 votes vote down vote up
public static void start(int port) throws IOException {
	String baseUrl = "http://localhost:"+port+"/";
	System.out.println("Starting Weather App local testing server: " + baseUrl);
	System.out.println("Not for production use");

	final ResourceConfig resourceConfig = new ResourceConfig();
	resourceConfig.register(RestWeatherCollectorEndpoint.class);
	resourceConfig.register(RestWeatherQueryEndpoint.class);
	resourceConfig.register(GenericExceptionMapper.class);
	resourceConfig.register(new MyApplicationBinder());
	server = GrizzlyHttpServerFactory.createHttpServer(URI.create(baseUrl), resourceConfig, false);

	HttpServerProbe probe = new HttpServerProbe.Adapter() {
		@Override
		public void onRequestReceiveEvent(HttpServerFilter filter, @SuppressWarnings("rawtypes") Connection connection, Request request) {
			System.out.println(request.getRequestURI());
		}
	};

	server.getServerConfiguration().getMonitoringConfig().getWebServerConfig().addProbes(probe);
	System.out.println(format("Weather Server started.\n url=%s\n", baseUrl));
	server.start();
}
 
Example #22
Source File: Nodes.java    From linstor-server with GNU General Public License v3.0 6 votes vote down vote up
@DELETE
@Path("{nodeName}/net-interfaces/{netif}")
public Response deleteNetInterface(
    @Context Request request,
    @PathParam("nodeName") String nodeName,
    @PathParam("netif") String netIfName
)
{
    return requestHelper.doInScope(ApiConsts.API_DEL_NET_IF, request, () ->
    {
        ApiCallRc apiCallRc = ctrlApiCallHandler.deleteNetInterface(
            nodeName,
            netIfName
        );

        return ApiCallRcRestUtils.toResponse(apiCallRc, Response.Status.OK);
    }, true);
}
 
Example #23
Source File: GatfConfigToolUtil.java    From gatf with Apache License 2.0 5 votes vote down vote up
protected static void handleRootContext(HttpServer server, final String mainDir, final GatfConfigToolMojoInt mojo) {
	server.getServerConfiguration().addHttpHandler(
	    new HttpHandler() {
	        public void service(Request request, Response response) throws Exception {
	        	new CacheLessStaticHttpHandler(mainDir).service(request, response);
	        }
	    }, "/");
	
	server.getServerConfiguration().addHttpHandler(new GatfProjectZipHandler(mojo), "/projectZip");
}
 
Example #24
Source File: Volumes.java    From linstor-server with GNU General Public License v3.0 5 votes vote down vote up
@GET
public void listVolumes(
    @Context Request request,
    @Suspended AsyncResponse asyncResponse,
    @PathParam("rscName") String rscName,
    @PathParam("nodeName") String nodeName,
    @DefaultValue("0") @QueryParam("limit") int limit,
    @DefaultValue("0") @QueryParam("offset") int offset
)
{
    listVolumes(request, asyncResponse, rscName, nodeName, null, limit, offset);
}
 
Example #25
Source File: ResourceGroups.java    From linstor-server with GNU General Public License v3.0 5 votes vote down vote up
@POST
@Path("{rscGrpName}/spawn")
@Consumes(MediaType.APPLICATION_JSON)
public void spawnResourceDefinition(
    @Context Request request,
    @Suspended final AsyncResponse asyncResponse,
    @PathParam("rscGrpName") String rscGrpName,
    String jsonData
)
{
    try
    {
        JsonGenTypes.ResourceGroupSpawn rscGrpSpwn = objectMapper.readValue(
            jsonData,
            JsonGenTypes.ResourceGroupSpawn.class
        );
        byte[] rscDfnExtName = rscGrpSpwn.resource_definition_external_name != null ?
            rscGrpSpwn.resource_definition_external_name.getBytes(StandardCharsets.UTF_8) :
            null;

        AutoSelectFilterApi spawnAutoSelectFilter = selectFilterToApi(rscGrpSpwn.select_filter);
        Flux<ApiCallRc> flux = ctrlRscGrpApiCallHandler.spawn(
            rscGrpName,
            rscGrpSpwn.resource_definition_name,
            rscDfnExtName,
            rscGrpSpwn.volume_sizes,
            spawnAutoSelectFilter,
            rscGrpSpwn.partial,
            rscGrpSpwn.definitions_only
        )
            .subscriberContext(requestHelper.createContext(ApiConsts.API_SPAWN_RSC_DFN, request));

        requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.CREATED));
    }
    catch (IOException ioExc)
    {
        ApiCallRcRestUtils.handleJsonParseException(ioExc, asyncResponse);
    }
}
 
Example #26
Source File: VolumeGroups.java    From linstor-server with GNU General Public License v3.0 5 votes vote down vote up
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Path("{volume_number}")
public void modifyVolumeGroup(
    @Context Request request,
    @Suspended final AsyncResponse asyncResponse,
    @PathParam("rscName") String rscName,
    @PathParam("volume_number") int volumeNumber,
    String jsonData
) throws IOException
{
    JsonGenTypes.VolumeGroupModify modifyData = objectMapper.readValue(
        jsonData,
        JsonGenTypes.VolumeGroupModify.class
    );

    Flux<ApiCallRc> flux = ctrlApiCallHandler.modifyVolumeGroup(
        rscName,
        volumeNumber,
        modifyData.override_props,
        new HashSet<>(modifyData.delete_props),
        new HashSet<>(modifyData.delete_namespaces),
        modifyData.flags
    )
    .subscriberContext(requestHelper.createContext(ApiConsts.API_MOD_VLM_GRP, request));

    requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux, Response.Status.OK));
}
 
Example #27
Source File: VolumeGroups.java    From linstor-server with GNU General Public License v3.0 5 votes vote down vote up
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response createVolumeGroup(
    @Context Request request,
    @PathParam("rscName") String rscName,
    String jsonData
)
{
    return requestHelper.doInScope(requestHelper.createContext(ApiConsts.API_CRT_VLM_GRP, request), () ->
    {
        JsonGenTypes.VolumeGroup vlmGrp;
        if (jsonData != null && !jsonData.isEmpty())
        {
            vlmGrp = objectMapper.readValue(
                jsonData,
                JsonGenTypes.VolumeGroup.class
            );
        }
        else
        {
            vlmGrp = new JsonGenTypes.VolumeGroup();
        }

        ApiCallRc apiCallRc = ctrlApiCallHandler.createVlmGrps(
            rscName,
            Arrays.asList(
                new VlmGrpPojo(
                    null,
                    vlmGrp.volume_number,
                    vlmGrp.props,
                    FlagsHelper.fromStringList(VolumeGroup.Flags.class, vlmGrp.flags)
                )
            )
        );

        return ApiCallRcRestUtils.toResponse(apiCallRc, Response.Status.CREATED);
    }, true);
}
 
Example #28
Source File: Nodes.java    From linstor-server with GNU General Public License v3.0 5 votes vote down vote up
@GET
@Path("{nodeName}")
public Response listSingleNode(
    @Context Request request,
    @PathParam("nodeName") String nodeName,
    @DefaultValue("0") @QueryParam("limit") int limit,
    @DefaultValue("0") @QueryParam("offset") int offset
)
{
    return listNodesOneOrMany(
            request, nodeName, Collections.singletonList(nodeName), Collections.emptyList(), limit, offset);
}
 
Example #29
Source File: Nodes.java    From linstor-server with GNU General Public License v3.0 5 votes vote down vote up
@DELETE
@Path("{nodeName}")
public void deleteNode(
    @Context Request request,
    @Suspended final AsyncResponse asyncResponse,
    @PathParam("nodeName") String nodeName
)
{
    Flux<ApiCallRc> flux = ctrlNodeDeleteApiCallHandler
        .deleteNode(nodeName)
        .subscriberContext(requestHelper.createContext(ApiConsts.API_DEL_NODE, request));

    requestHelper.doFlux(asyncResponse, ApiCallRcRestUtils.mapToMonoResponse(flux));
}
 
Example #30
Source File: VolumeGroups.java    From linstor-server with GNU General Public License v3.0 5 votes vote down vote up
@GET
public Response listVolumeGroup(
    @Context Request request,
    @PathParam("rscName") String rscName,
    @DefaultValue("0") @QueryParam("limit") int limit,
    @DefaultValue("0") @QueryParam("offset") int offset
)
{
    return listVolumeGroup(request, rscName, null, limit, offset);
}