Interface Storage

All Known Implementing Classes:
StorageImpl

public interface Storage
Interface for defining OCI storage module.
  • Method Details

    • download

      OracleStorageResource download(String bucketName, String key)
      Download the latest version of specific object from OCI Object Storage.
      Parameters:
      bucketName - OCI storage bucket name.
      key - Object name
      Returns:
      OracleStorageResource
    • download

      OracleStorageResource download(String bucketName, String key, String version)
      Download a specific object from OCI Object Storage.
      Parameters:
      bucketName - OCI storage bucket name.
      key - Object name
      version - Version of the object
      Returns:
      OracleStorageResource
    • upload

      OracleStorageResource upload(String bucketName, String key, InputStream inputStream, @Nullable StorageObjectMetadata objectMetadata) throws IOException
      Upload a new object (using InputStream) to OCI Object Storage.
      Parameters:
      bucketName - OCI storage bucket name.
      key - Object name
      inputStream - Object data with InputStream data type.
      objectMetadata - StorageObjectMetadata
      Returns:
      OracleStorageResource
      Throws:
      IOException
    • upload

      default OracleStorageResource upload(String bucketName, String key, InputStream inputStream) throws IOException
      Upload a new object (using InputStream) to OCI Object Storage with default metadata.
      Parameters:
      bucketName - OCI storage bucket name.
      key - Object name
      inputStream - Object data with InputStream data type.
      Returns:
      OracleStorageResource
      Throws:
      IOException
    • store

      OracleStorageResource store(String bucketName, String key, Object object) throws IOException
      Upload a Java POJO as a JSON object.
      Parameters:
      bucketName - OCI storage bucket name.
      key - Object name
      object - POJO object to be stored as json.
      Returns:
      OracleStorageResource
      Throws:
      IOException
    • read

      <T> T read(String bucketName, String key, Class<T> clazz)
      Read a JSON file stored on Object storage and convert to a Java POJO.
      Parameters:
      bucketName - OCI storage bucket name.
      key - Object name
      clazz - Type of the Java POJO.
      Returns:
      Object instnace of clazz.
    • getClient

      com.oracle.bmc.objectstorage.ObjectStorageClient getClient()
      Gets the instance of OCI Java SDK Storage Client.
      Returns:
      ObjectStorageClient
    • createBucket

      com.oracle.bmc.objectstorage.responses.CreateBucketResponse createBucket(String bucketName)
      Create a new bucket with the specified bucket name.
      Parameters:
      bucketName - OCI storage bucket name.
      Returns:
      CreateBucketResponse
    • createBucket

      com.oracle.bmc.objectstorage.responses.CreateBucketResponse createBucket(String bucketName, String compartmentId)
      Create a new bucket with the specified bucket name on a specific OCI compartment.
      Parameters:
      bucketName - OCI storage bucket name.
      compartmentId - OCI compartment OCID.
      Returns:
      CreateBucketResponse
    • deleteBucket

      void deleteBucket(String bucketName)
      Delete a storage bucket.
      Parameters:
      bucketName - OCI storage bucket name.
    • deleteObject

      void deleteObject(String bucketName, String key)
      Delete a storage object based on bucket name and object key.
      Parameters:
      bucketName - OCI storage bucket name.
      key - Object name/key.s
    • getNamespaceName

      String getNamespaceName()
      Get the current OCI storage namespace.
      Returns:
      name of the namespace.