Package fr.gouv.vitam.storage.offers.rest

# Class DefaultOfferResource

java.lang.Object
fr.gouv.vitam.common.server.application.resources.ApplicationStatusResource
fr.gouv.vitam.storage.offers.rest.DefaultOfferResource

@Path("/offer/v1") @ApplicationPath("webresources") public class DefaultOfferResource extends ApplicationStatusResource

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `RE_AUTHENTICATION_CALL_STREAM_ALREADY_CONSUMED_BUT_NO_FILE_CREATED`

  ### Fields inherited from class fr.gouv.vitam.common.server.application.resources.ApplicationStatusResource

  `STATUS_URL, TENANTS_URL`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultOfferResource(DefaultOfferService defaultOfferService)`
  Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `jakarta.ws.rs.core.Response`
  `bulkPutObjects(DataCategory type, jakarta.ws.rs.core.HttpHeaders headers, InputStream input)`
  Bulk create or update objects.
  `jakarta.ws.rs.core.Response`
  `checkAccessRequestStatuses(List<String> accessRequestIds, jakarta.ws.rs.core.HttpHeaders headers)`
  Check access request statuses by identifiers
  `jakarta.ws.rs.core.Response`
  `checkObjectAvailability(DataCategory type, List<String> objectNames, jakarta.ws.rs.core.HttpHeaders headers)`
  Check object availability for immediate access on async storage offers (tape storage only).
  `jakarta.ws.rs.core.Response`
  `checkObjectExistence(DataCategory type, String idObject, String xTenantId)`
  Test the existence of an object
  `jakarta.ws.rs.core.Response`
  `createAccessRequest(DataCategory type, List<String> objectNames, jakarta.ws.rs.core.HttpHeaders headers)`
  Create access request (asynchronous read from tape to local FS) for the given @type and objects ids list.
  `jakarta.ws.rs.core.Response`
  `deleteObject(String xTenantId, String xDigestAlgorithm, DataCategory type, String idObject)`
  Delete an Object
  `jakarta.ws.rs.core.Response`
  `getBulkObjectMetadata(DataCategory type, String xTenantId, Boolean noCache, List<String> objectIds)`
  Get bulk metadata of the objects by ids.
  `jakarta.ws.rs.core.Response`
  `getCapacity(String xTenantId, DataCategory type)`
  Get the information on the offer objects collection (free and used capacity, etc)
  `jakarta.ws.rs.core.Response`
  `getContainerList(String xTenantId, DataCategory type)`
  Get container object list.
  `jakarta.ws.rs.core.Response`
  `getObject(DataCategory type, @NotNull String objectId, jakarta.ws.rs.core.HttpHeaders headers)`
  Get the object data or digest from its id.
  `jakarta.ws.rs.core.Response`
  `getObjectMetadata(DataCategory type, String idObject, String xTenantId, Boolean noCache)`
  Get metadata of the object type.
  `jakarta.ws.rs.core.Response`
  `getOfferLogs(String xTenantId, DataCategory type, OfferLogRequest offerLogRequest)`
  Get log of objects from container
  `void`
  `launchOfferLogCompaction()`
  `jakarta.ws.rs.core.Response`
  `putObject(String objectId, DataCategory type, jakarta.ws.rs.core.HttpHeaders headers, InputStream input)`
  Creates or updates an object.
  `jakarta.ws.rs.core.Response`
  `removeAccessRequest(String accessRequestId, jakarta.ws.rs.core.HttpHeaders headers)`

  ### Methods inherited from class fr.gouv.vitam.common.server.application.resources.ApplicationStatusResource

  `getServerTenants, status`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### RE_AUTHENTICATION_CALL_STREAM_ALREADY_CONSUMED_BUT_NO_FILE_CREATED

    public static final String RE_AUTHENTICATION_CALL_STREAM_ALREADY_CONSUMED_BUT_NO_FILE_CREATED
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### DefaultOfferResource

    public DefaultOfferResource(DefaultOfferService defaultOfferService)
    Constructor
    Parameters:
      `defaultOfferService` -

- ## Method Details

  - ### getCapacity

    @HEAD @Path("/objects/{type}") @Produces("application/json") public jakarta.ws.rs.core.Response getCapacity(@HeaderParam("X-Tenant-Id") String xTenantId, @PathParam("type") DataCategory type)
    Get the information on the offer objects collection (free and used capacity, etc)
    Parameters:
      `xTenantId` - XtenantId
      `type` - The container type
    Returns:
      information on the offer objects collection

  - ### getContainerList

    @GET @Path("/objects/{type}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response getContainerList(@HeaderParam("X-Tenant-Id") String xTenantId, @PathParam("type") DataCategory type)
    Get container object list.
    Parameters:
      `xTenantId` - the tenant id
      `type` - object type
    Returns:
      an iterator with each object metadata (actually only the id)

  - ### getOfferLogs

    @GET @Path("/objects/{type}/logs") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response getOfferLogs(@HeaderParam("X-Tenant-Id") String xTenantId, @PathParam("type") DataCategory type, OfferLogRequest offerLogRequest)
    Get log of objects from container
    Parameters:
      `xTenantId` - the tenant id
      `type` - object type
      `offerLogRequest` - request params
    Returns:
      list of objects infos

  - ### getObject

    @GET @Path("/objects/{type}/{id_object}") @Consumes("application/json") @Produces({"application/octet-stream","application/zip"}) public jakarta.ws.rs.core.Response getObject(@PathParam("type") DataCategory type, @NotNull @PathParam("id_object") @NotNull String objectId, @Context jakarta.ws.rs.core.HttpHeaders headers)
    Get the object data or digest from its id.

    HEADER X-Tenant-Id (mandatory) : tenant's identifier HEADER "X-type" (optional) : data (dfault) or digest

    Parameters:
      `type` - Object type
      `objectId` - object id :.+ in order to get all path if some '/' are provided
      `headers` - http header
    Returns:
      response
    Throws:
      `IOException` - when there is an error of get object

  - ### createAccessRequest

    @POST @Path("/access-request/{type}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response createAccessRequest(@PathParam("type") DataCategory type, List<String> objectNames, @Context jakarta.ws.rs.core.HttpHeaders headers)
    Create access request (asynchronous read from tape to local FS) for the given @type and objects ids list.

    HEADER X-Tenant-Id (mandatory) : tenant's identifier

    Parameters:
      `type` - Object type
      `objectNames` - : object names for which access is requested
      `headers` - http header
    Returns:
      response

  - ### checkAccessRequestStatuses

    @GET @Path("/access-request/statuses") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response checkAccessRequestStatuses(List<String> accessRequestIds, @Context jakarta.ws.rs.core.HttpHeaders headers)
    Check access request statuses by identifiers

    HEADER X-Tenant-Id (mandatory) : tenant's identifier

    Parameters:
      `accessRequestIds` - the list of access request ids
    Returns:
      response

  - ### removeAccessRequest

    @DELETE @Path("/access-request/{accessRequestId}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response removeAccessRequest(@PathParam("accessRequestId") String accessRequestId, @Context jakarta.ws.rs.core.HttpHeaders headers)

  - ### checkObjectAvailability

    @GET @Path("/object-availability-check/{type}") @Consumes("application/json") @Produces("application/json") public jakarta.ws.rs.core.Response checkObjectAvailability(@PathParam("type") DataCategory type, List<String> objectNames, @Context jakarta.ws.rs.core.HttpHeaders headers)
    Check object availability for immediate access on async storage offers (tape storage only). For tape storage, an object is immediately accessible only when it's currently stored fully on disk. This API is not supported for synchronous storage offers. HEADER X-Tenant-Id (mandatory) : tenant's identifier
    Parameters:
      `type` - Object type
      `objectNames` - object names for which immediate availability is to be checked
      `headers` - http header
    Returns:
      response

  - ### putObject

    @PUT @Path("/objects/{type}/{objectId:.+}") @Consumes("application/octet-stream") @Produces("application/json") public jakarta.ws.rs.core.Response putObject(@PathParam("objectId") String objectId, @PathParam("type") DataCategory type, @Context jakarta.ws.rs.core.HttpHeaders headers, InputStream input)
    Creates or updates an object.
    Parameters:
      `objectId` - the object id
      `type` - Object's type
      `headers` - http header
    Returns:
      structured response with the object id

  - ### bulkPutObjects

    @PUT @Path("/bulk/objects/{type}") @Consumes("application/octet-stream") @Produces("application/json") public jakarta.ws.rs.core.Response bulkPutObjects(@PathParam("type") DataCategory type, @Context jakarta.ws.rs.core.HttpHeaders headers, InputStream input)
    Bulk create or update objects.
    Parameters:
      `type` - Object's type
      `headers` - http header
    Returns:
      structured response with the object id

  - ### deleteObject

    @DELETE @Path("/objects/{type}/{id:.+}") @Produces("application/json") public jakarta.ws.rs.core.Response deleteObject(@HeaderParam("X-Tenant-Id") String xTenantId, @HeaderParam("X-digest-algorithm") String xDigestAlgorithm, @PathParam("type") DataCategory type, @PathParam("id") String idObject)
    Delete an Object
    Parameters:
      `xTenantId` - the tenantId
      `xDigestAlgorithm` - the digest algorithm
      `type` - Object type to delete
      `idObject` - the id of the object to be tested
    Returns:
      the response with a specific HTTP status

  - ### checkObjectExistence

    @HEAD @Path("/objects/{type}/{id:.+}") public jakarta.ws.rs.core.Response checkObjectExistence(@PathParam("type") DataCategory type, @PathParam("id") String idObject, @HeaderParam("X-Tenant-Id") String xTenantId)
    Test the existence of an object

    HEADER X-Tenant-Id (mandatory) : tenant's identifier

    Parameters:
      `type` - Object type to test
      `idObject` - the id of the object to be tested
      `xTenantId` - the id of the tenant
    Returns:
      the response with a specific HTTP status. If none of DIGEST or DIGEST_ALGORITHM headers is given, an existence test is done and can return 204/404 as response. If only DIGEST or only DIGEST_ALGORITHM header is given, a not implemented exception is thrown. Later, this should respond with 200/409. If both DIGEST and DIGEST_ALGORITHM header are given, a full digest check is done and can return 200/409 as response

  - ### getObjectMetadata

    @GET @Path("/objects/{type}/{id:.+}/metadatas") @Produces("application/json") public jakarta.ws.rs.core.Response getObjectMetadata(@PathParam("type") DataCategory type, @PathParam("id") String idObject, @HeaderParam("X-Tenant-Id") String xTenantId, @HeaderParam("X-Offer-No-Cache") Boolean noCache)
    Get metadata of the object type.
    Parameters:
      `type` - Object type to test
      `idObject` - the id of the object to be tested
      `xTenantId` - the id of the tenant
    Returns:
      metadatas

  - ### getBulkObjectMetadata

    @GET @Path("/bulk/objects/{type}/metadata") @Produces("application/json") @Consumes("application/json") public jakarta.ws.rs.core.Response getBulkObjectMetadata(@PathParam("type") DataCategory type, @HeaderParam("X-Tenant-Id") String xTenantId, @HeaderParam("X-Offer-No-Cache") Boolean noCache, List<String> objectIds)
    Get bulk metadata of the objects by ids.
    Parameters:
      `type` - Object type to test
      `xTenantId` - the id of the tenant
    Returns:
      metadata by object id

  - ### launchOfferLogCompaction

    @POST @Path("/compaction") @Consumes("application/json") public void launchOfferLogCompaction() throws Exception
    Throws:
      `Exception`