Class UploadModule

java.lang.Object
com.google.jenkins.plugins.storage.UploadModule

@RequiresDomain(StorageScopeRequirement.class) public class UploadModule extends Object
This module abstracts how the Upload implementations instantiate their connection to the Storage service.
  • Constructor Details

    • UploadModule

      public UploadModule()
  • Method Details

    • newExecutor

      public com.google.jenkins.plugins.util.Executor newExecutor()
      Interface for requesting the Executor for executing requests.
      Returns:
      a new Executor instance for issuing requests.
    • getRequirement

      public StorageScopeRequirement getRequirement()
      Returns the scope requirement to access the GCS API.
      Returns:
      Storage scope requirement for the GCS API.
    • getVersion

      public String getVersion()
      Returns:
      the version number of this plugin.
    • getStorageService

      public com.google.api.services.storage.Storage getStorageService(com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials credentials, String version) throws IOException
      Given GoogleRobotCredentials and plugin version, return a handle to a Storage object that has already been authenticated.
      Parameters:
      credentials - Credentials needed to authenticate to the GCS API.
      version - Current version of the plugin.
      Returns:
      Handle to a Storage object that has already been authenticated.
      Throws:
      IOException - If there is an issue authenticating with the given credentials.
    • getInsertRetryCount

      public int getInsertRetryCount()
      Returns:
      Controls the number of object insertion retries.
    • prefix

      public String prefix(String logMessage)
      Prefix the given log message with our module name.
      Parameters:
      logMessage - Log message to log.
      Returns:
      Log message prefixed with module name.
    • executeMediaAsInputStream

      public InputStream executeMediaAsInputStream(com.google.api.services.storage.Storage.Objects.Get getObject) throws IOException
      Returns an InputStream for the given GCS object.
      Parameters:
      getObject - GCS object.
      Returns:
      GCS object in InputStream format.
      Throws:
      IOException - If there was in issue getting the InputStream for the GCS object.