Class ResourceManager
java.lang.Object
org.gcube.resourcemanagement.rest.BaseREST
org.gcube.resourcemanagement.rest.resources.ResourceManager
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe path parameter for current contextstatic final StringThe path part for resources endpointsstatic final StringThe path parameter for resource type namestatic final StringThe path parameter for resource UUIDFields inherited from class org.gcube.resourcemanagement.rest.BaseREST
APPLICATION_JSON_API, APPLICATION_JSON_CHARSET_UTF_8, COUNT_KEY, httpHeaders, LOCATION_HEADER, logger, PURGE_QUERY_PARAMETER, uriInfo -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRemove(String contextId, String type, String instanceId, org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation operation, Boolean dryRun, String json) Add/Remove an instance from context.get(String type, String uuid, org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation operation) Read a resource by type and UUID GET /resources/{TYPE_NAME}/{UUID} e.g.Methods inherited from class org.gcube.resourcemanagement.rest.BaseREST
addLocation, createCountJson, setAccountingMethod
-
Field Details
-
RESOURCES_PATH_PART
The path part for resources endpoints- See Also:
-
CURRENT_CONTEXT_PATH_PART
The path parameter for current context- See Also:
-
TYPE_PATH_PARAMETER
The path parameter for resource type name- See Also:
-
UUID_PATH_PARAMETER
The path parameter for resource UUID- See Also:
-
-
Constructor Details
-
ResourceManager
public ResourceManager()Default constructor for ResourceManager
-
-
Method Details
-
get
@GET @Path("{TYPE_NAME}/{UUID}") @Produces("application/json;charset=UTF-8") public String get(@PathParam("TYPE_NAME") String type, @PathParam("UUID") String uuid, @QueryParam("operation") org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation operation) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Read a resource by type and UUID GET /resources/{TYPE_NAME}/{UUID} e.g. GET /resources/VirtualService/c0f314e7-2807-4241-a792-2a6c79ed4fd0- Parameters:
type- the type name of the resourceuuid- the UUID of the resource to readoperation- the sharing operation (optional)- Returns:
- JSON representation of the resource
- Throws:
jakarta.ws.rs.WebApplicationException- if the request is invalidorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if there's an error in the resource registry
-
addRemove
@POST @Path("/contexts/{CONTEXT_UUID}/{TYPE_NAME}/{UUID}") @Produces("application/json;charset=UTF-8") public String addRemove(@PathParam("CONTEXT_UUID") String contextId, @PathParam("TYPE_NAME") String type, @PathParam("UUID") String instanceId, @QueryParam("operation") org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation operation, @QueryParam("dryRun") @DefaultValue("false") Boolean dryRun, String json) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Add/Remove an instance from context. The operation can have a cascade effect due to propagation constraint. Return the list of instances affected by an add/remove to/from context the target instance identified by UUID path parameter POST /sharing/contexts/{CONTEXT_UUID}/{TYPE_NAME}/{UUID}?operation=(ADD|REMOVE)&dryRun=true e.g POST /resource-registry/sharing/contexts/67062c11-9c3a-4906-870d-7df6a43408b0/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8?operation=ADD&dryRun=true POST /resource-registry/sharing/contexts/67062c11-9c3a-4906-870d-7df6a43408b0/HostingNode/16032d09-3823-444e-a1ff-a67de4f350a8?operation=REMOVE&dryRun=true where 67062c11-9c3a-4906-870d-7df6a43408b0 is the Context UUID and 16032d09-3823-444e-a1ff-a67de4f350a8 is the HostingNode UUID The json contains the instantiation of templates- Parameters:
contextId- the UUID of the target contexttype- the type name of the resourceinstanceId- the UUID of the instance to add/removeoperation- the operation to perform (ADD or REMOVE)dryRun- whether to perform a dry run without actual changesjson- the JSON representation of the resource data- Returns:
- JSON string containing the list of affected instances
- Throws:
jakarta.ws.rs.WebApplicationException- if the request is invalidorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if there's an error in the resource registry
-