Class ComputeRequirement

java.lang.Object
co.yellowdog.platform.model.ComputeRequirement
All Implemented Interfaces:
Identified, Named, Tagged, Serializable

@ValidatedBy(ComputeRequirementValidator.class) public class ComputeRequirement extends Object implements Identified, Named, Tagged, Serializable
Defines the requirement for compute resource and chosen options for how to provision it.

This class is the main model object within the YellowDog Compute API. It is passed between the service and clients in order to request compute resource and to monitor the state of that resource.

See Also:
  • Constructor Details

    • ComputeRequirement

      public ComputeRequirement(String namespace, String name, String tag, ComputeProvisionStrategy provisionStrategy, int targetInstanceCount, Boolean maintainInstanceCount)
      Constructs a new compute requirement with the specified values.
      Parameters:
      namespace - the compute requirement namespace
      name - the compute requirement name
      tag - the compute requirement tag
      provisionStrategy - the compute provision strategy
      targetInstanceCount - the number of instances to be provisioned
      maintainInstanceCount - if the required number of instances should be automatically maintained
  • Method Details

    • builder

      public static ComputeRequirement.Builder builder()
    • toBuilder

      public ComputeRequirement.Builder toBuilder()
    • getId

      public String getId()
      The ID of this compute requirement that is generated by YellowDog Compute when the requirement is first submitted.
      Specified by:
      getId in interface Identified
      Returns:
      the ID of this compute requirement
    • getCreatedTime

      public Instant getCreatedTime()
      The date and time when this compute requirement was first submitted to YellowDog Compute.
      Returns:
      the date and time when this compute requirement was first submitted
    • getCreatedById

      public String getCreatedById()
      The ID of the User or Application that first submitted this compute requirement.
      Returns:
      the ID of the User or Application that first submitted this compute requirement
    • getCreatedFromId

      public String getCreatedFromId()
      Gets the ID of the requirement template if this requirement was created from a template.
      Returns:
      the ID of the requirement template if this requirement was created from a template
    • getStatusChangedTime

      public Instant getStatusChangedTime()
      The date and time when the status or nextStatus last changed
      Returns:
      the date and time when the status or nextStatus last changed
    • getSupportedOperations

      public ComputeRequirementSupportedOperations getSupportedOperations()
    • getTag

      public String getTag()
      Description copied from interface: Tagged
      Gets the user defined tag
      Specified by:
      getTag in interface Tagged
      Returns:
      the user defined tag
    • getNamespace

      public String getNamespace()
      The user allocated namespace used to group compute requirements and other objects together.
      Returns:
      the compute requirement namespace
    • getName

      public String getName()
      The user allocated name used to uniquely identify this compute requirement within its namespace.
      Specified by:
      getName in interface Named
      Returns:
      the compute requirement name
    • getProvisionStrategy

      public ComputeProvisionStrategy getProvisionStrategy()
      The compute provision strategy that YellowDog Compute must use when provisioning instances to meet this requirement.
      Returns:
      the compute provision strategy
    • getTargetInstanceCount

      public int getTargetInstanceCount()
      The number of instances to be provisioned to meet this compute requirement.
      Returns:
      the number of instances to be provisioned
    • getExpectedInstanceCount

      public int getExpectedInstanceCount()
      The number of alive instances expected based on existing instances and the most recent provision action.
      Returns:
      the number of instances expected
    • isMaintainInstanceCount

      public boolean isMaintainInstanceCount()
      Indicates if the Compute Service should automatically attempt to provision new instances if the number of RUNNING instances is below the specified targetInstanceCount
      Returns:
      if the Compute Service should automatically maintain the number of instances
    • getStatus

      public ComputeRequirementStatus getStatus()
      The status of this compute requirement.
      Returns:
      the status of this compute requirement
    • getNextStatus

      public ComputeRequirementStatus getNextStatus()
      The next status of this compute requirement when a status transition is being requested.
      Returns:
      the next status of this compute requirement
    • setId

      public void setId(String id)
      The ID of this compute requirement that is generated by YellowDog Compute when the requirement is first submitted.
      Parameters:
      id - This should not be set outside of the YellowDog Compute service.
    • setCreatedTime

      public void setCreatedTime(Instant createdTime)
      The date and time when this compute requirement was first submitted to YellowDog Compute.
      Parameters:
      createdTime - This should not be set outside of the YellowDog Compute service.
    • setCreatedById

      public void setCreatedById(String createdById)
      The ID of the User or Application that first submitted this compute requirement.
      Parameters:
      createdById - This should not be set outside of the YellowDog Compute service.
    • setCreatedFromId

      public void setCreatedFromId(String createdFromId)
      Gets the ID of the requirement template if this requirement was created from a template.
      Parameters:
      createdFromId - This should not be set outside of the YellowDog Compute service.
    • setStatusChangedTime

      public void setStatusChangedTime(Instant statusChangedTime)
      The date and time when the status or nextStatus last changed
      Parameters:
      statusChangedTime - This should not be set outside of the YellowDog Compute service.
    • setSupportedOperations

      public void setSupportedOperations(ComputeRequirementSupportedOperations supportedOperations)
    • setTag

      public void setTag(String tag)
      Description copied from interface: Tagged
      Sets the user defined tag
      Specified by:
      setTag in interface Tagged
      Parameters:
      tag - the user defined tag
    • setNamespace

      public void setNamespace(String namespace)
      The user allocated namespace used to group compute requirements and other objects together.
      Parameters:
      namespace - the compute requirement namespace
      This should not be changed once the requirement has been submitted to YellowDog Compute.
    • setName

      public void setName(String name)
      The user allocated name used to uniquely identify this compute requirement within its namespace.
      Parameters:
      name - the compute requirement name
      This should not be changed once the requirement has been submitted to YellowDog Compute.
    • setProvisionStrategy

      public void setProvisionStrategy(ComputeProvisionStrategy provisionStrategy)
      The compute provision strategy that YellowDog Compute must use when provisioning instances to meet this requirement.
      Parameters:
      provisionStrategy - the compute provision strategy
    • setTargetInstanceCount

      public void setTargetInstanceCount(int targetInstanceCount)
      The number of instances to be provisioned to meet this compute requirement.
      Parameters:
      targetInstanceCount - the number of instances to be provisioned.
    • setExpectedInstanceCount

      public void setExpectedInstanceCount(int expectedInstanceCount)
      The number of alive instances expected based on existing instances and the most recent provision action.
      Parameters:
      expectedInstanceCount - This should not be set outside of the YellowDog Compute service.
    • setMaintainInstanceCount

      public void setMaintainInstanceCount(boolean maintainInstanceCount)
      Indicates if the Compute Service should automatically attempt to provision new instances if the number of RUNNING instances is below the specified targetInstanceCount
      Parameters:
      maintainInstanceCount - if the Compute Service should automatically maintain the number of instances
    • setStatus

      public void setStatus(ComputeRequirementStatus status)
      The status of this compute requirement.
      Parameters:
      status - This should not be set outside of the YellowDog Compute service.
    • setNextStatus

      public void setNextStatus(ComputeRequirementStatus nextStatus)
      The next status of this compute requirement when a status transition is being requested.
      Parameters:
      nextStatus - the next status of this compute requirement
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object