Class ResourceManager

java.lang.Object
org.gcube.resourcemanagement.rest.BaseREST
org.gcube.resourcemanagement.rest.resources.ResourceManager

@Path("resources") public class ResourceManager extends BaseREST
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • RESOURCES_PATH_PART

      public static final String RESOURCES_PATH_PART
      The path part for resources endpoints
      See Also:
    • CURRENT_CONTEXT_PATH_PART

      public static final String CURRENT_CONTEXT_PATH_PART
      The path parameter for current context
      See Also:
    • TYPE_PATH_PARAMETER

      public static final String TYPE_PATH_PARAMETER
      The path parameter for resource type name
      See Also:
    • UUID_PATH_PARAMETER

      public static final String 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 resource
      uuid - the UUID of the resource to read
      operation - the sharing operation (optional)
      Returns:
      JSON representation of the resource
      Throws:
      jakarta.ws.rs.WebApplicationException - if the request is invalid
      org.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 context
      type - the type name of the resource
      instanceId - the UUID of the instance to add/remove
      operation - the operation to perform (ADD or REMOVE)
      dryRun - whether to perform a dry run without actual changes
      json - 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 invalid
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if there's an error in the resource registry