REST Manager API
The Manager provides a REST
REpresentational State Transfer. Application Programming Interface
An API, or application programming interface, is a set of rules that define how applications or devices can connect to and communicate with each other. A REST API is an API that conforms to the design principles of the REST, or representational state transfer architectural style. Manager API for managing the GigaSpaces application environment.
To begin, start a standalone GigaSpaces Manager on your machine using the following command:
./gs.sh host run-agent --auto --restv3 --webui
gs host run-agent --auto --restv3 --webui
A new REST API
REpresentational State Transfer. Application Programming Interface
An API, or application programming interface, is a set of rules that define how applications or devices can connect to and communicate with each other. A REST API is an API that conforms to the design principles of the REST, or representational state transfer architectural style. V3 is introduced in this version. The V2 Manager is still active alongside the new V3 Manager, but is deprecated and will be removed in a future version. Ops Manager is based on the V2 API and is deprecated as well.
The V3 Manager API is a complete modernization of our management interface, built on the OpenAPI 3.1.0 specification.
See the configuration for the new REST API at: $GS_HOME/config/ui/rest-v3.yaml
The default port is 9090, and can be changed using the environment variable GS_REST_V3_PORT.
Swagger URL: http://<manager>:9090/api/v3/swagger-ui/index.html#
Use the --restv3 and --webui flags to start the V3 REST API and SpaceDeck
GigaSpaces intuitive, streamlined user interface to set up, manage and control their environment. Using SpaceDeck, users can define the tools to bring legacy System of Record (SoR) databases into the in-memory data grid that is the core of the GigaSpaces system. using the GS CLI.
List of API Groups
Spaces
-
Lifecycle Management: List all available spaces, create new spaces, and retrieve specific space configurations.
-
Data Operations: Register new data types, add simple or compound indexes, and execute SQL-like queries (including expression queries with explain plans).
-
Monitoring: Track space utilization (RAM/Disk/CPU), transaction statuses, locked objects, and outbound/inbound remote activity monitoring (LRMI).
-
Utility: Generate asynchronous demo data (up to 100k objects) and manage durable tasks.
To include unmanaged spaces that run in the IDE
Integrated Development Environment.
A software application that helps programmers develop software code efficiently. It increases developer productivity by combining capabilities such as software editing, building, testing, and packaging in an easy-to-use application. Example: DBeaver. as embedded spaces or integrated PUs, set com.gs.admin.discover-un-managed-spaces to true in GS_RESTV3_OPTIONS.
Processing Units (PUs)
-
Deployment: Upload PU
This is the unit of packaging and deployment in the GigaSpaces Data Grid, and is essentially the main GigaSpaces service. The Processing Unit (PU) itself is typically deployed onto the Service Grid. When a Processing Unit is deployed, a Processing Unit instance is the actual runtime entity. resources (.jar, .war, .zip), deploy new PUs, or automatically generate and deploy stateful PUs. -
Scaling & Control: Perform horizontal and vertical scaling, quiesce/unquiesce PUs for maintenance, and relocate instances between containers.
-
Troubleshooting: Set log levels globally or per instance, and monitor event container statistics (polling/notify).
-
Cleanup: Undeploy PUs and manage the history of undeployed units.
Information
-
System Health: Check Zookeeper
Apache Zookeeper. An open-source server for highly reliable distributed coordination of cloud applications. It provides a centralized service for providing configuration information, naming, synchronization and group services over large clusters in distributed systems. The goal is to make these systems easier to manage with improved, more reliable propagation of changes. root status, driver initialization status, and list active system alerts. -
Environment Info: Retrieve build/version metadata, manager lists, and cluster types.
-
Reporting: Manage heap size report file locations and retrieve UI configurations for SpaceDeck.
Requests
-
Task Tracking: List and filter all asynchronous system requests (e.g., deployments, scaling).
-
Job Control: Retrieve detailed status reports for specific request IDs, cancel pending requests, or delete request history.
Metrics Influx DB
-
Direct Querying: Execute raw table-based queries directly against the InfluxDB metrics database to retrieve custom performance data.
Managers
-
Manager Control: List all Grid Service Managers, view their health details (JVM
Java Virtual Machine. A virtual machine that enables a computer to run Java programs as well as programs written in other languages that are also compiled to Java bytecode./CPU), and trigger restarts. -
Diagnostics: Retrieve manager service logs and download full diagnostic service dumps.
Kubernetes
-
Orchestration
This is the automated configuration, management, and coordination of computer systems, applications, and services. Orchestration strings together multiple tasks in order to execute and easily manage a larger workflow or process. These processes can consist of multiple complex tasks that are automated and can involve multiple systems. Kubernetes, used by GigaSpaces, is a popular open source platform for container orchestration. Hooks: Execute pre-deployment checks and post-deployment/post-scaling configuration tasks. -
Resource Tracking: Monitor Kubernetes
An open-source container orchestration system for automating software deployment, scaling, and management of containerized applications.-specific resource limits and retrieve PU topology directly from Zookeeper. -
Scaling Status: Check whether PUs are currently in the middle of a scaling operation.
Hosts
-
Machine Monitoring: List all hosts in the grid, view OS-level statistics (architecture, RAM, processors), and set VM log levels.
-
Enhanced Metrics: Access extended host data, including a breakdown of PUs and GSMs per host.
-
Diagnostics: Download diagnostic dumps for entire machines.
Data Gateway
-
Deployment: Submit requests to deploy and configure new data gateways.
-
Maintenance: Monitor gateway status and undeploy/delete gateways by ID.
Containers
-
Container Management: Create, list, delete, and restart Grid Service Containers (GSCs).
-
Performance Tuning: Retrieve detailed JVM and Transport (network) statistics.
-
Logging: Access real-time container logs and generate service dumps for container-level debugging.
Long-Running Operations
In the Admin API, long-running operations (for example, deploy and undeploy) are asynchronous with no future or callback. You can either track progress manually, or use various 'andWait' overloads (for example, deployAndWait). The REST Manager API cannot use andWait, so you must poll for completion, but each such operation behaves differently.
Instead, the REST Manager API contains Request functionality. Each long-running operation creates a request and returns its ID, so you can poll on the request ID and check the status (running/successful/failed). The request exposes additional useful information:
-
Who started the request (IP and user)
-
When the request was started and completed
-
If the request failed, an error message
-
Additional properties on the request execution
By default, the system keeps up to 100,000 completed requests (configurable), and purges the oldest as needed.
Processing Unit Deployment and Upload
Deploying a Processing Unit
This is the unit of packaging and deployment in the GigaSpaces Data Grid, and is essentially the main GigaSpaces service. The Processing Unit (PU) itself is typically deployed onto the Service Grid. When a Processing Unit is deployed, a Processing Unit instance is the actual runtime entity. requires uploading a resource (JAR/WAR/ZIP) to the GigaSpaces Manager, but due to technical limitations it is currently not possible to include both a binary file and a JSON payload in the same REST operation. Instead, there are two separate operations:
-
Upload a resource.
-
Deploy a Processing Unit, and provide the name of a previously uploaded resource.
This also means that when you undeploy a Processing Unit, the resource is not deleted. If you want to delete it you must execute a separate REST operation (if you want to undeploy/redeploy with the same JAR, there is no need to remove it). Currently you cannot delete or replace a JAR file if a deployed Processing Unit is using it.
Security
The REST component is part of the GigaSpaces Manager, and inherits the GigaSpaces Manager security configuration. As the REST API uses the HTTP protocol, it is best to configure SSL to allow for HTTPS (secure access).
Enabling Security
The REST Manager API allows for secured access and operations when the security enabled property is set. This property should be configured using the GS_OPTIONS_EXT in the setenv script, and is applied to all GigaSpaces Grid Components.
The property:
-Dcom.gs.security.enabled=true
By default, to get you up and running, if nothing was configured the fallback security implementation uses a local file to save credentials (see Spring Security). Note that SSO
Single sign-on (SSO) is an authentication scheme that allows a user to log in with a single ID to any of several related, yet independent, software systems. is also supported — see Single Sign-On.
SSL Configuration
Basic authentication does not encrypt user credentials, so running a GigaSpaces Manager in a secure environment without SSL is a security hazard; the system detects this and aborts. You must explicitly enable or disable SSL by setting the system property com.gs.manager.rest.ssl.enabled.
You can do one of the following:
-
Disable SSL explicitly (not recommended).
-
Enable SSL, and the system will generate a certificate for you.
-
Enable SSL and provide a trusted certificate that you own.
An auto-generated certificate provides reasonable security, but if your enterprise security guidelines are more strict you can provide your own certificate.
Finally, if you need to configure something that is not exposed (Jetty is used under the hood to host the web app), you can provide your own jetty.xml file via a system property.
| Port | System Property | Default |
|---|---|---|
| Enable/disable | com.gs.manager.rest.ssl.enabled | must be explicitly set |
| Keystore path | com.gs.manager.rest.ssl.keystore-path | |
| Keystore password | com.gs.manager.rest.ssl.keystore-password | |
| Custom config | com.gs.manager.rest.jetty.config |
Security Properties File
The security properties file is used to configure the SecurityManager, that is responsible for the authentication and authorization process.
The security.properties file is common to all components and is usually located under $GS_HOME/config/security/security.properties.
The REST component is part of the GigaSpaces Grid components.
To only affect the Grid components, use the grid-security.properties instead.
The configuration file can be located anywhere in the classpath or in the classpath under config/security.
Alternatively, a system property can be set to indicate the location of the properties file:
-Dcom.gs.security.properties-file = my-security.properties
By setting -Dcom.gs.security.properties-file, the property file will be located as a direct path (e.g. ~/home/user/my-security.properties), a resource (e.g. my-security.properties) in the classpath, or in the classpath under config/security.
Online Editor
The REST API V3 is an OpenAPI specification. You can download its specification and use Swagger's Online Editor to generate a client in your favorite language.
Extending The REST Manager API
The REST Manager API is extensible so that custom methods can be added. Developers can implement a plain Java class with JAX-RS annotations.
Sample Implementation
Follow the instructions below to create a sample extension for the REST Manager API:
-
Create a class and annotate it with
com.gigaspaces.manager.rest.CustomManagerResource. -
Create a method for each path you wish to intercept, and annotate it with an HTTP operation (e.g.
@GET) and a@Pathannotation with the relevant path. -
Use JAX-RS parameter annotations (e.g.
@QueryParam) to map HTTP request parameters to your method. -
If you want to use
Admin, create an appropriate field and annotate it with JAX-RS@Contextannotation.
For example:
@CustomManagerResource
@Path("/demo")
public class BasicPluggableOperationTest {
@Context Admin admin;
@GET
@Path("/report")
public String report(@QueryParam("hostname") String hostname) {
Machine machine = admin.getMachines().getMachineByHostName(hostname);
return "Custom report: host=" + hostname +
", containers=" + machine.getGridServiceContainers() +
", PU instances=" + machine.getProcessingUnitInstances();
}
}
This class maps an HTTP GET operation in the /demo/report path to a report method. It accepts a query parameter, and uses an injected Admin instance to perform user-defined code (in this case, a custom report). For example, http://localhost:8090/demo/report?hostname=mypc.
To run the example, compile it and package it into a .jar file, then copy the .jar to $GS_HOME/lib/platform/manager/plugins and start the GigaSpaces Manager.
Note that some JAX-RS features are not supported - see JAX-RS Support below for detailed information.
Configuration
When the GigaSpaces Manager starts, it scans the $GS_HOME/lib/platform/manager/plugins for classes in the jar files with the JAX-RS annotations and registers them.
You can override the location using the following system property:
com.gs.manager.rest.plugins.path="pathToJar"
Response
In the example above the method returns a String, and in addition it implicitly returns an HTTP code 200 (OK). If you need to explicitly specify the HTTP result code, use org.openspaces.admin.rest.Response instead of a String.
For example:
import org.openspaces.admin.rest.Response
@GET
@Path("/report")
public Response report(@QueryParam("hostname") String hostname) {
Machine machine = admin.getMachines().getMachineByHostName(hostname);
if (machine == null)
return Response.status(javax.ws.rs.core.Response.Status.NOT_FOUND).entity("Host not found").build();
String result = "Custom report: host=" + hostname +
", containers=" + machine.getGridServiceContainers() +
", PU instances=" + machine.getProcessingUnitInstances();
return Response.ok().entity(result).build();
}
Make sure you use org.openspaces.admin.rest.Response and not JAX-RS Response.
Security
To define security privileges for a custom method, you have to import org.openspaces.admin.rest.PrivilegeRequired and org.openspaces.admin.rest.RestPrivileges, and use @PrivilegeRequired.
The @PrivilegeRequired annotation accepts a RestPrivileges enum that corresponds to the Security privileges.
For more information about security, see the Security Guide.
For example:
import org.openspaces.admin.rest.PrivilegeRequired
import org.openspaces.admin.rest.RestPrivileges
@CustomManagerResource
@Path("/secured/")
public class PluggableSecuredContoller {
@Context Admin admin;
@PrivilegeRequired(RestPrivileges.MANAGE_GRID)
@GET
@Path("/getBase")
public String getBase() {
return "hello";
}
}
JAX-RS Support
The JAX-RS API is used for extension support because it is a well-known standard and commonly used by developers. The sections below list the annotations that are supported, and those that are not supported.
Supported Annotations
The following JAX-RS annotations are supported:
-
HTTP operations:
@GET,@PUT,@POST,@DELETE - Parameters:
@QueryParam,@PathParam,@DefaultValueSupported types: Java primitive types ("int', "long', etc.) and
String
- Other:
@ContextFields only (No support for constructors or method arguments)
Supported types:
Admin
Unsupported Annotations
The following JAX-RS annotations are not supported:
-
HTTP operations:
@OPTIONS,@HEAD -
Parameters:
@FormParam,@HeaderParam,@CookieParam,@Matrix
In-Memory Data Grid - achieve unparalleled speed, persistence, and accuracy.