Interface ComputeClient

All Known Implementing Classes:
ComputeClientImpl

public interface ComputeClient
The API interface exposed by the YellowDog Compute Service
  • Method Details

    • addComputeRequirement

      ComputeRequirement addComputeRequirement(ComputeRequirement computeRequirement)
      Submits a NEW requirement to YellowDog Compute to be initialised and provisioned.
      Parameters:
      computeRequirement - the requirement to submit to YellowDog Compute
      Returns:
      the initialised requirement returned from YellowDog Compute
      Throws:
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • updateComputeRequirement

      ComputeRequirement updateComputeRequirement(ComputeRequirement computeRequirement)
      Submits an existing requirement to YellowDog Compute in order to provision any changes.
      Parameters:
      computeRequirement - the requirement to submit to YellowDog Compute
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • updateComputeRequirement

      ComputeRequirement updateComputeRequirement(ComputeRequirement computeRequirement, boolean reprovision)
      Submits an existing requirement to YellowDog Compute in order to provision any changes.
      Parameters:
      computeRequirement - the requirement to submit to YellowDog Compute
      reprovision - indicates that YellowDog Compute should provision instances to restore the instance count even if targetInstanceCount is unchanged
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • getComputeRequirement

      ComputeRequirement getComputeRequirement(ComputeRequirement computeRequirement)
      Requests the latest view of the specified requirement from YellowDog Compute.
      Parameters:
      computeRequirement - the requirement for which to get the latest view
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • getComputeRequirement

      ComputeRequirement getComputeRequirement(String computeRequirementId)
      Requests the latest view of the specified requirement from YellowDog Compute.
      Parameters:
      computeRequirementId - the ID of the requirement
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • getComputeRequirement

      ComputeRequirement getComputeRequirement(String namespace, String computeRequirementName)
      Requests the latest view of the specified requirement from YellowDog Compute.
      Parameters:
      namespace - the namespace containing the requirement
      computeRequirementName - the name of the requirement
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • stopComputeRequirement

      ComputeRequirement stopComputeRequirement(ComputeRequirement computeRequirement)
      Instructs YellowDog Compute to stop all running instances provisioned for the specified requirement.
      Parameters:
      computeRequirement - the requirement to stop
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      UnsupportedOperationException - if not all sources used in the requirement support STOP/START operations
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • stopComputeRequirement

      ComputeRequirement stopComputeRequirement(String computeRequirementId)
      Instructs YellowDog Compute to stop all running instances provisioned for the specified requirement.
      Parameters:
      computeRequirementId - the ID of the requirement to stop
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      UnsupportedOperationException - if not all sources used in the requirement support STOP/START operations
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • startComputeRequirement

      ComputeRequirement startComputeRequirement(ComputeRequirement computeRequirement)
      Instructs YellowDog Compute to start all stopped instances provisioned for the specified requirement.
      Parameters:
      computeRequirement - the requirement to start
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      UnsupportedOperationException - if not all sources used in the requirement support STOP/START operations
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • startComputeRequirement

      ComputeRequirement startComputeRequirement(String computeRequirementId)
      Instructs YellowDog Compute to start all stopped instances provisioned for the specified requirement.
      Parameters:
      computeRequirementId - the ID of the requirement to start
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      UnsupportedOperationException - if not all sources used in the requirement support STOP/START operations
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • terminateComputeRequirement

      ComputeRequirement terminateComputeRequirement(ComputeRequirement computeRequirement)
      Instructs YellowDog Compute to terminate the specified requirement.
      Parameters:
      computeRequirement - the requirement to terminate
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • terminateComputeRequirement

      ComputeRequirement terminateComputeRequirement(String computeRequirementId)
      Instructs YellowDog Compute to terminate the specified requirement.
      Parameters:
      computeRequirementId - the ID of the requirement to terminate
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • reprovisionComputeRequirement

      ComputeRequirement reprovisionComputeRequirement(ComputeRequirement computeRequirement)
      Instructs YellowDog Compute to provision more instances if required such that the number of running instances meets the targetInstanceCount.
      Parameters:
      computeRequirement - the requirement to terminate
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • reprovisionComputeRequirement

      ComputeRequirement reprovisionComputeRequirement(String computeRequirementId)
      Instructs YellowDog Compute to provision more instances if required such that the number of running instances meets the targetInstanceCount.
      Parameters:
      computeRequirementId - the ID of the requirement to terminate
      Returns:
      the latest view of the requirement returned from YellowDog Compute
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • getInstances

      SearchClient<Instance> getInstances(InstanceSearch instanceSearch)
      Returns a search client for searching instances.
      Parameters:
      instanceSearch - the search criteria
      Returns:
      a search client for searching instances
    • stopInstances

      void stopInstances(ComputeRequirement computeRequirement, List<Instance> instances)
      Instructs YellowDog Compute to stop the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to stop instances that are InstanceStatus.RUNNING or InstanceStatus.UNKNOWN.
      Parameters:
      computeRequirement - the requirement containing the instances
      instances - The instances to stop
      Throws:
      IllegalArgumentException - if not all the specified instances are contained within the specified requirement; or if the specified requirement has not yet been submitted to YellowDog Compute
      UnsupportedOperationException - if any of the sources associated with the specified instances do not support STOP/START operations
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • stopInstancesById

      void stopInstancesById(ComputeRequirement computeRequirement, List<InstanceId> instanceIds)
      Instructs YellowDog Compute to stop the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to stop instances that are InstanceStatus.RUNNING or InstanceStatus.UNKNOWN.
      Parameters:
      computeRequirement - the requirement containing the instances
      instanceIds - the ids of instances to stop
      Throws:
      IllegalArgumentException - if not all the specified instances are contained within the specified requirement; or if the specified requirement has not yet been submitted to YellowDog Compute
      UnsupportedOperationException - if any of the sources associated with the specified instances do not support STOP/START operations
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • startInstances

      void startInstances(ComputeRequirement computeRequirement, List<Instance> instances)
      Instructs YellowDog Compute to start the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to start instances that are InstanceStatus.STOPPED or InstanceStatus.UNKNOWN.
      Parameters:
      computeRequirement - the requirement containing the instances
      instances - the instances to start
      Throws:
      IllegalArgumentException - if not all the specified instances are contained within the specified requirement; or if the specified requirement has not yet been submitted to YellowDog Compute
      UnsupportedOperationException - if any of the sources associated with the specified instances do not support STOP/START operations
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • startInstancesById

      void startInstancesById(ComputeRequirement computeRequirement, List<InstanceId> instanceIds)
      Instructs YellowDog Compute to start the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to start instances that are InstanceStatus.STOPPED or InstanceStatus.UNKNOWN.
      Parameters:
      computeRequirement - the requirement containing the instances
      instanceIds - the ids of instances to start
      Throws:
      IllegalArgumentException - if not all the specified instances are contained within the specified requirement; or if the specified requirement has not yet been submitted to YellowDog Compute
      UnsupportedOperationException - if any of the sources associated with the specified instances do not support STOP/START operations
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • terminateInstances

      void terminateInstances(ComputeRequirement computeRequirement, List<Instance> instances)
      Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement. YellowDog Compute will not attempt to terminate instances that are already InstanceStatus.TERMINATING.
      Parameters:
      computeRequirement - the requirement containing the instances
      instances - the instances to terminate
      Throws:
      IllegalArgumentException - if not all the specified instances are contained within the specified requirement; or if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • terminateInstancesById

      void terminateInstancesById(ComputeRequirement computeRequirement, List<InstanceId> instanceIds)
      Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement. YellowDog Compute will not attempt to terminate instances that are already InstanceStatus.TERMINATING.
      Parameters:
      computeRequirement - the requirement containing the instances
      instanceIds - the ids of instances to terminate
      Throws:
      IllegalArgumentException - if not all the specified instances are contained within the specified requirement; or if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • restartInstances

      void restartInstances(ComputeRequirement computeRequirement, List<Instance> instances)
      Instructs YellowDog Compute to restart (reboot) the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to restart instances that are InstanceStatus.RUNNING, InstanceStatus.STOPPED or InstanceStatus.UNKNOWN.
      Parameters:
      computeRequirement - the requirement containing the instances
      instances - the instances to restart
      Throws:
      IllegalArgumentException - if not all the specified instances are contained within the specified requirement; or if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • restartInstancesById

      void restartInstancesById(ComputeRequirement computeRequirement, List<InstanceId> instanceIds)
      Instructs YellowDog Compute to restart (reboot) the specified instances provisioned for the specified requirement. YellowDog Compute will only attempt to restart instances that are InstanceStatus.RUNNING, InstanceStatus.STOPPED or InstanceStatus.UNKNOWN.
      Parameters:
      computeRequirement - the requirement containing the instances
      instanceIds - the instances to restart
      Throws:
      IllegalArgumentException - if not all the specified instances are contained within the specified requirement; or if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • deprovisionInstances

      void deprovisionInstances(ComputeRequirement computeRequirement, List<Instance> instances)
      Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement and reduce the requirement's instance count accordingly. YellowDog Compute will not attempt to deprovision instances that are already InstanceStatus.TERMINATING.
      Parameters:
      computeRequirement - the requirement containing the instances
      instances - the instances to deprovision
      Throws:
      IllegalArgumentException - if not all the specified instances are contained within the specified requirement; or if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • deprovisionInstancesById

      void deprovisionInstancesById(ComputeRequirement computeRequirement, List<InstanceId> instanceIds)
      Instructs YellowDog Compute to terminate the specified instances provisioned for the specified requirement and reduce the requirement's instance count accordingly. YellowDog Compute will not attempt to deprovision instances that are already InstanceStatus.TERMINATING.
      Parameters:
      computeRequirement - the requirement containing the instances
      instanceIds - the ids of instances to deprovision
      Throws:
      IllegalArgumentException - if not all the specified instances are contained within the specified requirement; or if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the request
    • isComputeRequirementUpdating

      boolean isComputeRequirementUpdating(ComputeRequirement computeRequirement)
      Checks the current busy state of the specified requirement, returning true if the requirement is being updated by YellowDog Compute; otherwise, false.
      Parameters:
      computeRequirement - the requirement to check
      Returns:
      true, if the requirement is being updated by YellowDog Compute; otherwise, false
    • isComputeRequirementUpdating

      boolean isComputeRequirementUpdating(String computeRequirementId)
      Checks the current busy state of the specified requirement, returning true if the requirement is being updated by YellowDog Compute; otherwise, false.
      Parameters:
      computeRequirementId - the ID of the requirement to check
      Returns:
      true, if the requirement is being updated by YellowDog Compute; otherwise, false
    • addComputeRequirementListener

      void addComputeRequirementListener(ComputeRequirement computeRequirement, SubscriptionEventListener<ComputeRequirement> listener)
      Adds an event listener to receive notifications of changes for the specified requirement. The client manages subscriptions to YellowDog Compute such that the first listener created for a requirement will cause a Server-Sent Events subscription to be initiated; additional listeners for the same requirement share that subscription.
      Parameters:
      computeRequirement - the requirement for which to receive notifications
      listener - the event listener that will be invoked for notifications
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the subscription request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the subscription request
    • addComputeRequirementListener

      void addComputeRequirementListener(String computeRequirementId, SubscriptionEventListener<ComputeRequirement> listener)
      Adds an event listener to receive notifications of changes for the specified requirement. The client manages subscriptions to YellowDog Compute such that the first listener created for a requirement will cause a Server-Sent Events subscription to be initiated; additional listeners for the same requirement share that subscription.
      Parameters:
      computeRequirementId - the ID of the requirement for which to receive notifications
      listener - the event listener that will be invoked for notifications
      Throws:
      IllegalArgumentException - if the specified requirement has not yet been submitted to YellowDog Compute
      ClientErrorException - if YellowDog Compute returns an HTTP 4xx error due to an issue with the subscription request
      ServerErrorException - if YellowDog Compute returns an HTTP 5xx error due to a server error whilst processing the subscription request
    • removeComputeRequirementListener

      void removeComputeRequirementListener(SubscriptionEventListener<ComputeRequirement> listener)
      Removes the specified event listener. The client manages subscriptions to YellowDog Compute such that when the last listener for a requirement is removed, the associated Server-Sent Events subscription is cancelled.
      Parameters:
      listener - the event listener that will no longer be invoked for notifications
    • getComputeRequirementHelper

      ComputeRequirementHelper getComputeRequirementHelper(ComputeRequirement computeRequirement)
      Constructs a new compute requirement helper for the specified requirement.
      Parameters:
      computeRequirement - the compute requirement for which the helper will be constructed
      Returns:
      a new compute requirement helper
    • getComputeRequirementHelper

      ComputeRequirementHelper getComputeRequirementHelper(String computeRequirementId)
      Constructs a new compute requirement helper for the specified requirement.
      Parameters:
      computeRequirementId - the ID of the compute requirement for which the helper will be constructed
      Returns:
      a new compute requirement helper
    • getComputeRequirements

      @Deprecated SearchClient<ComputeRequirement> getComputeRequirements(ComputeRequirementSearch computeRequirementSearch)
      Returns a search client for searching compute requirements.
      Parameters:
      computeRequirementSearch - the search criteria
      Returns:
      a search client for searching compute requirements
    • getComputeRequirementSummaries

      SearchClient<ComputeRequirementSummary> getComputeRequirementSummaries(ComputeRequirementSummarySearch computeRequirementSummarySearch)
    • addComputeSourceTemplate

      ComputeSourceTemplate addComputeSourceTemplate(ComputeSourceTemplate computeSourceTemplate)
    • updateComputeSourceTemplate

      ComputeSourceTemplate updateComputeSourceTemplate(ComputeSourceTemplate computeSourceTemplate)
    • deleteComputeSourceTemplate

      void deleteComputeSourceTemplate(ComputeSourceTemplate computeSourceTemplate)
    • deleteComputeSourceTemplate

      void deleteComputeSourceTemplate(String computeSourceTemplateId)
    • getComputeSourceTemplate

      ComputeSourceTemplate getComputeSourceTemplate(String computeSourceTemplateId)
    • findAllComputeSourceTemplates

      List<ComputeSourceTemplateSummary> findAllComputeSourceTemplates()
    • addComputeRequirementTemplate

      ComputeRequirementTemplate addComputeRequirementTemplate(ComputeRequirementTemplate computeRequirementTemplate)
    • updateComputeRequirementTemplate

      ComputeRequirementTemplate updateComputeRequirementTemplate(ComputeRequirementTemplate computeRequirementTemplate)
    • deleteComputeRequirementTemplate

      void deleteComputeRequirementTemplate(ComputeRequirementTemplate computeRequirementTemplate)
    • deleteComputeRequirementTemplate

      void deleteComputeRequirementTemplate(String computeRequirementTemplateId)
    • getComputeRequirementTemplate

      ComputeRequirementTemplate getComputeRequirementTemplate(String computeRequirementTemplateId)
    • getComputeRequirementTemplate

      ComputeRequirementTemplate getComputeRequirementTemplate(String namespace, String name)
    • findAllComputeRequirementTemplates

      List<ComputeRequirementTemplateSummary> findAllComputeRequirementTemplates()
      Returns summaries of all existing compute requirement templates within the system for the requesting user.
      Returns:
      a list of compute requirement template summaries
    • provisionComputeRequirementTemplate

      ComputeRequirement provisionComputeRequirementTemplate(ComputeRequirementTemplateUsage computeRequirementTemplateUsage)
      Provisions a new compute requirement based on the specified template and requirement properties.
      Parameters:
      computeRequirementTemplateUsage - An object defining the template ID and requirement properties
      Returns:
      the provisioned compute requirement
    • testComputeRequirementTemplate

      ComputeRequirementTemplateTestResult testComputeRequirementTemplate(ComputeRequirementTemplateUsage computeRequirementTemplateUsage)
      Generates a new compute requirement based on the specified template and requirement properties. Includes other related information such as a BestComputeSourceReport if relevant.
      Parameters:
      computeRequirementTemplateUsage - An object defining the template ID and requirement properties
      Returns:
      the template test result
    • getBestComputeSourceReportByComputeRequirement

      BestComputeSourceReport getBestComputeSourceReportByComputeRequirement(String provisionedComputeRequirementId)
      Gets the provision report for a compute requirement provisioned from a dynamic template.
      Parameters:
      provisionedComputeRequirementId - the ID of the provisioned compute requirement
      Returns:
      the provision report for a compute requirement provisioned from a dynamic template