Class GoogleStorage
- java.lang.Object
-
- org.pipecraft.infra.storage.google_cs.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 Summary
Constructors Constructor Description GoogleStorage()Google Storage Adapter constructor that uses environment variables.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringbuildFullyQualifiedPath(String... parts)Creates a fully qualified path consisting of parts that compose the path.GoogleStorageBucketgetBucket(String bucketName)returns a Google Storage bucketStringgetProtocol()
-
-
-
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:
getBucketin interfaceorg.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:
getProtocolin interfaceorg.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
-
-