Class SimulatorComputeSource

java.lang.Object
co.yellowdog.platform.model.SimulatorComputeSource
All Implemented Interfaces:
ComputeSource, Credentialed, Identified, Named, Serializable

@JsonClassDescription("Details needed for simulating the provisioning of instances") public class SimulatorComputeSource extends Object implements ComputeSource
Defines a simulated source of compute that can be used to test the YellowDog Compute system.
See Also:
  • Constructor Details

    • SimulatorComputeSource

      public SimulatorComputeSource(String name, String region, String instanceType, String imageId, Map<String,String> instanceTags, int limit, int instanceStartupTimeSeconds, float instanceStartupTimeVariance, int instanceShutdownTimeSeconds, float instanceShutdownTimeVariance, float unexpectedInstanceTerminationProbability, boolean failOnRequestAllInstances, boolean failOnProvision, boolean reportSupportingResourcesExist)
  • Method Details

    • getTraits

      public ComputeSourceTraits getTraits()
      Description copied from interface: ComputeSource
      Returns an object describing behavioural traits specific to this compute source.
      Specified by:
      getTraits in interface ComputeSource
      Returns:
      an object describing behavioural traits specific to this compute source
    • getProvider

      public CloudProvider getProvider()
      Description copied from interface: ComputeSource
      Gets the Cloud Provider for this source.
      Specified by:
      getProvider in interface ComputeSource
      Returns:
      the Cloud Provider for this source
    • getInstancePricing

      public InstancePricing getInstancePricing()
      Description copied from interface: ComputeSource
      Gets the instance pricing for this source, e.g. Spot
      Specified by:
      getInstancePricing in interface ComputeSource
      Returns:
      the instance pricing for this source
    • getSubregion

      public String getSubregion()
      Description copied from interface: ComputeSource
      Gets the provider-specific subregion (aka Availability Domain, Availability Zone or Zone) where instances will be provisioned.
      Specified by:
      getSubregion in interface ComputeSource
      Returns:
      the provider-specific subregion where instances will be provisioned
    • getUserData

      public String getUserData()
      Description copied from interface: ComputeSource
      Gets the user-data script to be passed to the provisioned instance at startup.
      Specified by:
      getUserData in interface ComputeSource
      Returns:
      the user-data script
    • setUserData

      public void setUserData(String userData)
      Description copied from interface: ComputeSource
      Sets the user-data script to be passed to the provisioned instance at startup.
      Specified by:
      setUserData in interface ComputeSource
      Parameters:
      userData - the user-data script
    • getSupportingResourceCreated

      public Boolean getSupportingResourceCreated()
      Description copied from interface: ComputeSource
      Indicates if supporting resources have been created for this source.
      Specified by:
      getSupportingResourceCreated in interface ComputeSource
      Returns:
      true, if supporting resources have been created for this source; false, if no supporting resources have been created; null, if unknown
    • getCredentials

      public Set<String> getCredentials()
      Description copied from interface: Credentialed
      Return the names of the credentials to be used for this Credentialed entity.
      Specified by:
      getCredentials in interface Credentialed
      Returns:
      the names of the credentials to be used
    • builder

      public static SimulatorComputeSource.Builder builder()
    • toBuilder

      public SimulatorComputeSource.Builder toBuilder()
    • getId

      public String getId()
      Description copied from interface: Identified
      Returns the ID
      Specified by:
      getId in interface ComputeSource
      Specified by:
      getId in interface Identified
      Returns:
      the ID
    • getCreatedFromId

      public String getCreatedFromId()
      Description copied from interface: ComputeSource
      Gets the ID of the source template if this source was created from a template.
      Specified by:
      getCreatedFromId in interface ComputeSource
      Returns:
      the ID of the source template if this source was created from a template
    • getName

      public String getName()
      Description copied from interface: ComputeSource
      Returns the name of this compute source (which must be unique within the containing ComputeRequirement).
      Specified by:
      getName in interface ComputeSource
      Specified by:
      getName in interface Named
      Returns:
      the name of this compute source
    • getCredential

      public String getCredential()
      Specified by:
      getCredential in interface ComputeSource
    • getInstanceTags

      Description copied from interface: ComputeSource
      Gets the custom instance tags to be set on the provisioned instance at startup.
      Specified by:
      getInstanceTags in interface ComputeSource
      Returns:
      the custom instance tags
    • getImplicitCapacity

      public Integer getImplicitCapacity()
      The implicit capacity of this source that is not directly discoverable by the compute service, independent of limit.
      Returns:
      the implicit capacity of this source, independent of limit
    • getInstanceStartupTimeSeconds

      public int getInstanceStartupTimeSeconds()
      The simulated startup time for an instance.
      Returns:
      the simulated startup time for an instance
    • getInstanceStartupTimeVariance

      public float getInstanceStartupTimeVariance()
      A variance multiplier (from 0 to 1) applied randomly to the instance startup time.
      Returns:
      the instance startup time variance
    • getInstanceShutdownTimeSeconds

      public int getInstanceShutdownTimeSeconds()
      The simulated shutdown time for an instance.
      Returns:
      the simulated shutdown time for an instance
    • getInstanceShutdownTimeVariance

      public float getInstanceShutdownTimeVariance()
      A variance multiplier (from 0 to 1) applied randomly to the instance shutdown time.
      Returns:
      the instance shutdown time variance
    • getUnexpectedInstanceTerminationProbability

      public float getUnexpectedInstanceTerminationProbability()
      The probability (from 0 to 1) that any instance will be unexpectedly terminated whenever it is refreshed.
      Returns:
      the probability of unexpected instance termination
    • isFailOnRequestAllInstances

      public boolean isFailOnRequestAllInstances()
    • isFailOnProvision

      public boolean isFailOnProvision()
    • isReportSupportingResourcesExist

      public boolean isReportSupportingResourcesExist()
    • getLimit

      public int getLimit()
      Description copied from interface: ComputeSource
      Returns the limit in number of instances that can be provisioned from this source.
      Specified by:
      getLimit in interface ComputeSource
      Returns:
      the limit in number of instances that can be provisioned from this source
    • getInstanceSummary

      public InstanceSummary getInstanceSummary()
      Description copied from interface: ComputeSource
      A summary of instance counts according to instance status
      Specified by:
      getInstanceSummary in interface ComputeSource
      Returns:
      a summary of instance counts according to instance status
    • getStatus

      public ComputeSourceStatus getStatus()
      Description copied from interface: ComputeSource
      Gets the current provisioning status of this source.
      Specified by:
      getStatus in interface ComputeSource
      Returns:
      the current provisioning status of this source
    • getStatusMessage

      public String getStatusMessage()
      Description copied from interface: ComputeSource
      Gets the message associated with the current provisioning status of this source. Returns null if no further detail is relevant to the status.
      Specified by:
      getStatusMessage in interface ComputeSource
      Returns:
      the message associated with the current provisioning status of this source
    • getExhaustion

      public ComputeSourceExhaustion getExhaustion()
      Description copied from interface: ComputeSource
      If this source is associated with an exhausted allowance, gets the exhaustion state.
      Specified by:
      getExhaustion in interface ComputeSource
      Returns:
      the exhaustion state, if the source is associated with an exhausted allowance; otherwise, null
    • setId

      public void setId(String id)
      Description copied from interface: ComputeSource
      Sets the ID
      Specified by:
      setId in interface ComputeSource
      Parameters:
      id - This should only be set by the YellowDog Platform
    • setCreatedFromId

      public void setCreatedFromId(String createdFromId)
      Description copied from interface: ComputeSource
      Sets the source template ID
      Specified by:
      setCreatedFromId in interface ComputeSource
      Parameters:
      createdFromId - This should only be set by the YellowDog Platform
    • setName

      public void setName(String name)
      Description copied from interface: ComputeSource
      Sets the name of this compute source (which must be unique within the containing ComputeRequirement).
      Specified by:
      setName in interface ComputeSource
      Parameters:
      name - the name of this compute source
    • setCredential

      public void setCredential(String credential)
    • setRegion

      public void setRegion(String region)
    • setInstanceType

      public void setInstanceType(String instanceType)
      Description copied from interface: ComputeSource
      Sets the provider-specific instance type of the instances that will be provisioned.
      Specified by:
      setInstanceType in interface ComputeSource
      Parameters:
      instanceType - the provider-specific instance type of the instances that will be provisioned
    • setImageId

      public void setImageId(String imageId)
      Description copied from interface: ComputeSource
      Sets the image ID to use for the instances that will be provisioned.
      Specified by:
      setImageId in interface ComputeSource
      Parameters:
      imageId - the image ID to use for the instances that will be provisioned
    • setInstanceTags

      public void setInstanceTags(Map<@SimulatorInstanceTagKey String,@SimulatorInstanceTagValue String> instanceTags)
      Description copied from interface: ComputeSource
      Sets the custom instance tags to be set on the provisioned instance at startup.
      Specified by:
      setInstanceTags in interface ComputeSource
      Parameters:
      instanceTags - the custom instance tags
    • setImplicitCapacity

      public void setImplicitCapacity(Integer implicitCapacity)
      The implicit capacity of this source that is not directly discoverable by the compute service, independent of limit.
      Parameters:
      implicitCapacity - the implicit capacity of this source, independent of limit
    • setInstanceStartupTimeSeconds

      public void setInstanceStartupTimeSeconds(int instanceStartupTimeSeconds)
      The simulated startup time for an instance.
      Parameters:
      instanceStartupTimeSeconds - the simulated startup time for an instance
    • setInstanceStartupTimeVariance

      public void setInstanceStartupTimeVariance(float instanceStartupTimeVariance)
      A variance multiplier (from 0 to 1) applied randomly to the instance startup time.
      Parameters:
      instanceStartupTimeVariance - the instance startup time variance
    • setInstanceShutdownTimeSeconds

      public void setInstanceShutdownTimeSeconds(int instanceShutdownTimeSeconds)
      The simulated shutdown time for an instance.
      Parameters:
      instanceShutdownTimeSeconds - the simulated shutdown time for an instance
    • setInstanceShutdownTimeVariance

      public void setInstanceShutdownTimeVariance(float instanceShutdownTimeVariance)
      A variance multiplier (from 0 to 1) applied randomly to the instance shutdown time.
      Parameters:
      instanceShutdownTimeVariance - the instance shutdown time variance
    • setUnexpectedInstanceTerminationProbability

      public void setUnexpectedInstanceTerminationProbability(float unexpectedInstanceTerminationProbability)
      The probability (from 0 to 1) that any instance will be unexpectedly terminated whenever it is refreshed.
      Parameters:
      unexpectedInstanceTerminationProbability - the probability of unexpected instance termination
    • setFailOnRequestAllInstances

      public void setFailOnRequestAllInstances(boolean failOnRequestAllInstances)
    • setFailOnProvision

      public void setFailOnProvision(boolean failOnProvision)
    • setReportSupportingResourcesExist

      public void setReportSupportingResourcesExist(boolean reportSupportingResourcesExist)
    • setLimit

      public void setLimit(int limit)
      Description copied from interface: ComputeSource
      Sets the limit in number of instances that can be provisioned from this source.
      Specified by:
      setLimit in interface ComputeSource
      Parameters:
      limit - the limit in number of instances that can be provisioned from this source
    • setInstanceSummary

      public void setInstanceSummary(InstanceSummary instanceSummary)
      Specified by:
      setInstanceSummary in interface ComputeSource
    • setStatus

      public void setStatus(ComputeSourceStatus status)
      Description copied from interface: ComputeSource
      Sets the current provisioning status of this source.
      Specified by:
      setStatus in interface ComputeSource
      Parameters:
      status - This should only be set by the YellowDog Platform
    • setStatusMessage

      public void setStatusMessage(String statusMessage)
      Description copied from interface: ComputeSource
      Sets the message associated with the current provisioning status of this source.
      Specified by:
      setStatusMessage in interface ComputeSource
      Parameters:
      statusMessage - This should only be set by the YellowDog Platform
    • setExhaustion

      public void setExhaustion(ComputeSourceExhaustion exhaustion)
      Specified by:
      setExhaustion in interface ComputeSource
    • 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
    • getRegion

      @JsonPropertyDescription("The simulated region, can be set to any non-blank value") public String getRegion()
      Description copied from interface: ComputeSource
      Gets the provider-specific region where instances will be provisioned.
      Specified by:
      getRegion in interface ComputeSource
      Returns:
      the provider-specific region where instances will be provisioned
    • getInstanceType

      @JsonPropertyDescription("The simulated instanceType, can be set to any non-blank value") public String getInstanceType()
      Description copied from interface: ComputeSource
      Gets the provider-specific instance type of the instances that will be provisioned.
      Specified by:
      getInstanceType in interface ComputeSource
      Returns:
      the provider-specific instance type of the instances that will be provisioned
    • getImageId

      @JsonPropertyDescription("The simulated imageId, can be set to any non-blank value") public String getImageId()
      Description copied from interface: ComputeSource
      Gets the image ID to use for the instances that will be provisioned.
      Specified by:
      getImageId in interface ComputeSource
      Returns:
      the image ID to use for the instances that will be provisioned