Class AbstractBackupTypeProvider

java.lang.Object
com.morpheusdata.core.backup.AbstractBackupTypeProvider
All Implemented Interfaces:
BackupTypeProvider, PluginProvider

public abstract class AbstractBackupTypeProvider extends Object implements BackupTypeProvider
Provides a standard set of methods for a BackupProvider. A backup provider is the primary connection to the external provider services. The backup provider supplies providers for provision types and/or container types via the BackupTypeProviders implemented within the provider.
Since:
0.13.4
  • Constructor Details

    • AbstractBackupTypeProvider

      public AbstractBackupTypeProvider(Plugin plugin, MorpheusContext context)
  • Method Details

    • getMorpheus

      public MorpheusContext getMorpheus()
      Description copied from interface: PluginProvider
      Returns the Morpheus Context for interacting with data stored in the Main Morpheus Application
      Specified by:
      getMorpheus in interface PluginProvider
      Returns:
      an implementation of the MorpheusContext for running Future based rxJava queries
    • getPlugin

      public Plugin getPlugin()
      Description copied from interface: PluginProvider
      Returns the instance of the Plugin class that this provider is loaded from
      Specified by:
      getPlugin in interface PluginProvider
      Returns:
      Plugin class contains references to other providers
    • getExecutionProvider

      public abstract BackupExecutionProvider getExecutionProvider()
      Get the backup provider which will be responsible for all the operations related to backup executions.
      Returns:
      a BackupExecutionProvider providing methods for backup execution.
    • setExecutionProvider

      public void setExecutionProvider(BackupExecutionProvider executionProvider)
      Set the backup provider which will be responsible for all the operations related to backup executions.
      Parameters:
      executionProvider - a BackupExecutionProvider providing methods for backup execution.
    • getRestoreProvider

      public abstract BackupRestoreProvider getRestoreProvider()
      Get the backup provider which will be responsible for all the operations related to backup restore.
      Returns:
      a BackupRestoreProvider providing methods for backup restore operations.
    • setRestoreProvider

      public void setRestoreProvider(BackupRestoreProvider restoreProvider)
      Get the backup provider which will be responsible for all the operations related to backup restore.
      Parameters:
      restoreProvider - a BackupRestoreProvider providing methods for backup restore operations.
    • refresh

      public ServiceResponse refresh(Map authConfig, BackupProvider backupProvider)
      Description copied from interface: BackupTypeProvider
      Refresh the provider with the associated data in the external system.
      Specified by:
      refresh in interface BackupTypeProvider
      Parameters:
      authConfig - necessary connection and credentials to connect to the external provider
      backupProvider - an instance of the backup integration provider
      Returns:
      a ServiceResponse object. A ServiceResponse with a success value of 'false' will indicate the refresh process has failed and will halt any further backup creation processes in the core system.
    • clean

      public ServiceResponse clean(BackupProvider backupProviderModel, Map opts)
      Description copied from interface: BackupTypeProvider
      Clean up all data created by the backup type provider.
      Specified by:
      clean in interface BackupTypeProvider
      Parameters:
      backupProviderModel - the provider to be cleaned up
      opts - additional options
      Returns:
      a ServiceResponse object
    • configureBackup

      public ServiceResponse configureBackup(Backup backupModel, Map config, Map opts)
      Description copied from interface: BackupTypeProvider
      Add additional configurations to a backup. Morpheus will handle all basic configuration details, this is a convenient way to add additional configuration details specific to this backup provider.
      Specified by:
      configureBackup in interface BackupTypeProvider
      Parameters:
      backupModel - the current backup the configurations are applied to.
      config - the configuration supplied by external inputs.
      opts - optional parameters used for configuration.
      Returns:
      a ServiceResponse object. A ServiceResponse with a false success will indicate a failed configuration and will halt the backup creation process.
    • validateBackup

      public ServiceResponse validateBackup(Backup backupModel, Map config, Map opts)
      Description copied from interface: BackupTypeProvider
      Validate the configuration of the backup. Morpheus will validate the backup based on the supplied option type configurations such as required fields. Use this to either override the validation results supplied by the default validation or to create additional validations beyond the capabilities of option type validation.
      Specified by:
      validateBackup in interface BackupTypeProvider
      Parameters:
      backupModel - the backup to validate
      config - the original configuration supplied by external inputs.
      opts - optional parameters used for
      Returns:
      a ServiceResponse object. The errors field of the ServiceResponse is used to send validation results back to the interface in the format of errors['fieldName'] = 'validation message' . The msg property can be used to send generic validation text that is not related to a specific field on the model. A ServiceResponse with any items in the errors list or a success value of 'false' will halt the backup creation process.
    • createBackup

      public ServiceResponse createBackup(Backup backupModel, Map opts)
      Description copied from interface: BackupTypeProvider
      Create the backup resources on the external provider system.
      Specified by:
      createBackup in interface BackupTypeProvider
      Parameters:
      backupModel - the fully configured and validated backup
      opts - additional options used during backup creation
      Returns:
      a ServiceResponse object. A ServiceResponse with a success value of 'false' will indicate the creation on the external system failed and will halt any further backup creation processes in morpheus.
    • deleteBackup

      public ServiceResponse deleteBackup(Backup backupModel, Map opts)
      Description copied from interface: BackupTypeProvider
      Delete the backup resources on the external provider system.
      Specified by:
      deleteBackup in interface BackupTypeProvider
      Parameters:
      backupModel - the backup details
      opts - additional options used during the backup deletion process
      Returns:
      a ServiceResponse indicating the results of the deletion on the external provider system. A ServiceResponse object with a success value of 'false' will halt the deletion process and the local refernce will be retained.
    • deleteBackupResult

      public ServiceResponse deleteBackupResult(BackupResult backupResultModel, Map opts)
      Description copied from interface: BackupTypeProvider
      Delete the results of a backup execution on the external provider system.
      Specified by:
      deleteBackupResult in interface BackupTypeProvider
      Parameters:
      backupResultModel - the backup result details
      opts - additional options used during the backup result deletion process
      Returns:
      a ServiceResponse indicating the results of the deletion on the external provider system. A ServiceResponse object with a success value of 'false' will halt the deletion process and the local refernce will be retained.
    • prepareExecuteBackup

      public ServiceResponse prepareExecuteBackup(Backup backupModel, Map opts)
      Description copied from interface: BackupTypeProvider
      A hook into the execution process. This method is called before the backup execution occurs.
      Specified by:
      prepareExecuteBackup in interface BackupTypeProvider
      Parameters:
      backupModel - the backup details associated with the backup execution
      opts - additional options used during the backup execution process
      Returns:
      a ServiceResponse indicating the success or failure of the execution preperation. A success value of 'false' will halt the execution process.
    • prepareBackupResult

      public ServiceResponse prepareBackupResult(BackupResult backupResultModel, Map opts)
      Description copied from interface: BackupTypeProvider
      Provide additional configuration on the backup result. The backup result is a representation of the output of the backup execution including the status and a reference to the output that can be used in any future operations.
      Specified by:
      prepareBackupResult in interface BackupTypeProvider
      Parameters:
      backupResultModel - the backup result details
      opts - additional options used during the backup execution process
      Returns:
      a ServiceResponse indicating the success or failure of the method. A success value of 'false' will halt the further execution process.
    • executeBackup

      public ServiceResponse<BackupExecutionResponse> executeBackup(Backup backupModel, BackupResult backupResult, Map executionConfig, Cloud cloud, ComputeServer computeServer, Map opts)
      Description copied from interface: BackupTypeProvider
      Initiate the backup process on the external provider system.
      Specified by:
      executeBackup in interface BackupTypeProvider
      Parameters:
      backupModel - the backup details associated with the backup execution.
      backupResult - the details associated with the results of the backup execution.
      executionConfig - original configuration supplied for the backup execution.
      cloud - cloud context of the target of the backup execution
      computeServer - the target of the backup execution
      opts - additional options used during the backup execution process
      Returns:
      a ServiceResponse indicating the success or failure of the backup execution. A success value of 'false' will halt the execution process.
    • refreshBackupResult

      public ServiceResponse<BackupExecutionResponse> refreshBackupResult(BackupResult backupResult)
      Description copied from interface: BackupTypeProvider
      Periodically call until the backup execution has successfully completed. The default refresh interval is 60 seconds.
      Specified by:
      refreshBackupResult in interface BackupTypeProvider
      Parameters:
      backupResult - the reference to the results of the backup execution including the last known status. Set the status to a canceled/succeeded/failed value from one of the BackupStatusUtility values to end the execution process.
      Returns:
      a ServiceResponse indicating the success or failure of the method. A success value of 'false' will halt the further execution process.n
    • cancelBackup

      public ServiceResponse cancelBackup(BackupResult backupResultModel, Map opts)
      Description copied from interface: BackupTypeProvider
      Cancel the backup execution process without waiting for a result.
      Specified by:
      cancelBackup in interface BackupTypeProvider
      Parameters:
      backupResultModel - the details associated with the results of the backup execution.
      opts - additional options.
      Returns:
      a ServiceResponse indicating the success or failure of the backup execution cancellation.
    • extractBackup

      public ServiceResponse extractBackup(BackupResult backupResultModel, Map opts)
      Description copied from interface: BackupTypeProvider
      Extract the results of a backup. This is generally used for packaging up a full backup for the purposes of a download or full archive of the backup.
      Specified by:
      extractBackup in interface BackupTypeProvider
      Parameters:
      backupResultModel - the details associated with the results of the backup execution.
      opts - additional options.
      Returns:
      a ServiceResponse indicating the success or failure of the backup extraction.
    • configureRestoreBackup

      public ServiceResponse configureRestoreBackup(BackupResult backupResultModel, Map config, Map opts)
      Description copied from interface: BackupTypeProvider
      Add additional configurations to a backup restore. Morpheus will handle all basic configuration details, this is a convenient way to add additional configuration details specific to this backup restore provider.
      Specified by:
      configureRestoreBackup in interface BackupTypeProvider
      Parameters:
      backupResultModel - backup result to be restored
      config - the configuration supplied by external inputs
      opts - optional parameters used for configuration.
      Returns:
      a ServiceResponse object. A ServiceResponse with a false success will indicate a failed configuration and will halt the backup restore process.
    • getBackupRestoreInstanceConfig

      public ServiceResponse getBackupRestoreInstanceConfig(BackupResult backupResultModel, Instance instanceModel, Map restoreConfig, Map opts)
      Description copied from interface: BackupTypeProvider
      Build the configuration for the restored instance.
      Specified by:
      getBackupRestoreInstanceConfig in interface BackupTypeProvider
      Parameters:
      backupResultModel - backup result to be restored
      instanceModel - the instance the backup was created from, if it still exists. Retained backups will not have a reference to the instance.
      restoreConfig - the restore configuration generated by morpheus.
      opts - optional parameters used for configuration.
      Returns:
      a ServiceResponse object. A ServiceResponse with a false success will indicate a failed configuration and will halt the backup restore process.
    • validateRestoreBackup

      public ServiceResponse validateRestoreBackup(BackupResult backupResultModel, Map opts)
      Description copied from interface: BackupTypeProvider
      Verify the backup restore is valid. Generally used to check if the backup and instance are both in a state compatible for executing the restore process.
      Specified by:
      validateRestoreBackup in interface BackupTypeProvider
      Parameters:
      backupResultModel - backup result to be restored
      opts - optional parameters used for configuration.
      Returns:
      a ServiceResponse object. A ServiceResponse with a false success will indicate a failed configuration and will halt the backup restore process.
    • getRestoreOptions

      public ServiceResponse getRestoreOptions(Backup backupModel, Map opts)
      Description copied from interface: BackupTypeProvider
      Get restore options to configure the restore wizard. Although the BackupProvider and BackupTypeProvider supply configuration, there may be situations where the instance configuration will determine which options need to be presented in the restore wizard.

      Available Restore options:

      • restoreExistingEnabled (Boolean) -- determines the visibility of the restore to existing option
      • restoreNewEnabled (Boolean) -- determines the visibility of the restore to new option
      • name (String) -- default name of the restored instance
      • hostname (String) -- default hostname of the restored instance
      Specified by:
      getRestoreOptions in interface BackupTypeProvider
      Parameters:
      backupModel - the backup
      opts - optional parameters
      Returns:
      a ServiceResponse object. A ServiceResponse with a false success will indicate a failed configuration and will halt the backup restore process.
    • restoreBackup

      public ServiceResponse<BackupRestoreResponse> restoreBackup(BackupRestore backupRestore, BackupResult backupResultModel, Backup backupModel, Map opts)
      Description copied from interface: BackupTypeProvider
      Execute the backup restore on the external system
      Specified by:
      restoreBackup in interface BackupTypeProvider
      Parameters:
      backupRestore - restore to be executed
      backupResultModel - refernce to the backup result
      backupModel - reference to the backup associated with the backup result
      opts - optional parameters
      Returns:
      a ServiceResponse object. A ServiceResponse with a false success will indicate a failed configuration and will halt the backup restore process.
    • refreshBackupRestoreResult

      public ServiceResponse<BackupRestoreResponse> refreshBackupRestoreResult(BackupRestore backupRestoreModel, BackupResult backupResultModel)
      Description copied from interface: BackupTypeProvider
      Periodically check for any updates to an in-progress restore. This method will be executed every 60 seconds for the restore while the restore has a status of `START_REQUESTED` or `IN_PROGRESS`. Any other status will indicate the restore has completed and does not need to be refreshed. The primary use case for this method is long-running restores to avoid consuming resources during the restore process.
      Specified by:
      refreshBackupRestoreResult in interface BackupTypeProvider
      Parameters:
      backupRestoreModel - the running restore
      backupResultModel - backup result referencing the backup to be restored
      Returns:
      a ServiceResponse object. A ServiceResponse with a false success will indicate a failed configuration and will halt the backup restore process.