Class GoogleStorage

  • All Implemented Interfaces:
    org.pipecraft.infra.storage.Storage<GoogleStorageBucket,​com.google.cloud.storage.Blob>

    public class GoogleStorage
    extends Object
    implements org.pipecraft.infra.storage.Storage<GoogleStorageBucket,​com.google.cloud.storage.Blob>
    Adapter for Google Storage client. Loads the credentials on initialization phase.
    Author:
    Eyal Rubichi
    • Constructor Detail

      • GoogleStorage

        public GoogleStorage()
        Google Storage Adapter constructor that uses environment variables. Connects using the environment's credentials (in GOOGLE_APPLICATION_CREDENTIALS environment variable). If the instance runs on Google Cloud, the environment variable isn't needed.
    • Method Detail

      • getBucket

        public GoogleStorageBucket getBucket​(String bucketName)
        returns a Google Storage bucket
        Specified by:
        getBucket in interface org.pipecraft.infra.storage.Storage<GoogleStorageBucket,​com.google.cloud.storage.Blob>
        Parameters:
        bucketName - The required bucket name
        Returns:
        The bucket object
      • getProtocol

        public String getProtocol()
        Specified by:
        getProtocol in interface org.pipecraft.infra.storage.Storage<GoogleStorageBucket,​com.google.cloud.storage.Blob>
      • buildFullyQualifiedPath

        public static String buildFullyQualifiedPath​(String... parts)
        Creates a fully qualified path consisting of parts that compose the path. Bucket name must appear as the first part or as the prefix of the first part.
        Parameters:
        parts - ordered parts of the path (can be sub paths as well)
        Returns:
        fully qualified GS path