Interface WorkloadProvisionProvider

All Superinterfaces:
ComputeProvisionProvider, PluginProvider, ProvisionProvider
All Known Subinterfaces:
VmProvisionProvider

public interface WorkloadProvisionProvider extends ComputeProvisionProvider
Provides methods for interacting with the provisioning engine of Morpheus. This is akin to dealing with requests made from "Add Instance" or from Application Blueprints
Since:
0.15.3
  • Method Details

    • validateWorkload

      ServiceResponse validateWorkload(Map opts)
      Validates the provided provisioning options of a workload. A return of success = false will halt the creation and display errors
      Parameters:
      opts - options
      Returns:
      Response from API. Errors should be returned in the errors Map with the key being the field name and the error message as the value.
    • prepareWorkload

      default ServiceResponse<PrepareWorkloadResponse> prepareWorkload(Workload workload, WorkloadRequest workloadRequest, Map opts)
      This method is called before runWorkload and provides an opportunity to perform action or obtain configuration that will be needed in runWorkload. At the end of this method, if deploying a ComputeServer with a VirtualImage, the sourceImage on ComputeServer should be determined and saved.
      Parameters:
      workload - the Workload object we intend to provision along with some of the associated data needed to determine how best to provision the workload
      workloadRequest - the RunWorkloadRequest object containing the various configurations that may be needed in running the Workload. This will be passed along into runWorkload
      opts - additional configuration options that may have been passed during provisioning
      Returns:
      Response from API
    • runWorkload

      ServiceResponse<ProvisionResponse> runWorkload(Workload workload, WorkloadRequest workloadRequest, Map opts)
      This method is a key entry point in provisioning a workload. This could be a vm, a container, or something else. Information associated with the passed Workload object is used to kick off the workload provision request
      Parameters:
      workload - the Workload object we intend to provision along with some of the associated data needed to determine how best to provision the workload
      workloadRequest - the RunWorkloadRequest object containing the various configurations that may be needed in running the Workload
      opts - additional configuration options that may have been passed during provisioning
      Returns:
      Response from API
    • finalizeWorkload

      ServiceResponse finalizeWorkload(Workload workload)
      This method is called after successful completion of runWorkload and provides an opportunity to perform some final actions during the provisioning process. For example, ejected CDs, cleanup actions, etc
      Parameters:
      workload - the Workload object that has been provisioned
      Returns:
      Response from the API
    • stopWorkload

      ServiceResponse stopWorkload(Workload workload)
      Issues the remote calls necessary top stop a workload element from running.
      Parameters:
      workload - the Workload we want to shut down
      Returns:
      Response from API
    • startWorkload

      ServiceResponse startWorkload(Workload workload)
      Issues the remote calls necessary to start a workload element for running.
      Parameters:
      workload - the Workload we want to start up.
      Returns:
      Response from API
    • restartWorkload

      ServiceResponse restartWorkload(Workload workload)
      Issues the remote calls to restart a workload element. In some cases this is just a simple alias call to do a stop/start, however, in some cases cloud providers provide a direct restart call which may be preferred for speed.
      Parameters:
      workload - the Workload we want to restart.
      Returns:
      Response from API
    • removeWorkload

      ServiceResponse removeWorkload(Workload workload, Map opts)
      This is the key method called to destroy / remove a workload. This should make the remote calls necessary to remove any assets associated with the workload.
      Parameters:
      workload - to remove
      opts - map of options
      Returns:
      Response from API
    • getServerDetails

      ServiceResponse<ProvisionResponse> getServerDetails(ComputeServer server)
      Method called after a successful call to runWorkload to obtain the details of the ComputeServer. Implementations should not return until the server is successfully created in the underlying cloud or the server fails to create.
      Parameters:
      server - to check status
      Returns:
      Response from API. The publicIp and privateIp set on the WorkloadResponse will be utilized to update the ComputeServer
    • updateMetadataTags

      default ServiceResponse updateMetadataTags(ComputeServer server, Map opts)
      This is the method called when a server's metadata tags are updated in Morpheus. Should return success if tags are updated and fail if tags are not/can't be updated.
      Parameters:
      server - server object with updated metadata field
      opts - map of options
      Returns:
      Response from API
    • createWorkloadResources

      ServiceResponse createWorkloadResources(Workload workload, Map opts)
      Method called before runWorkload to allow implementers to create resources required before runWorkload is called
      Parameters:
      workload - that will be provisioned
      opts - additional options
      Returns:
      Response from API