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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder that can be used to build a new SimulatorComputeSource that is automatically validated on build. -
Field Summary
Fields inherited from interface co.yellowdog.platform.model.ComputeSource
DEFAULT_ASSIGN_PUBLIC_IP -
Constructor Summary
ConstructorsConstructorDescriptionSimulatorComputeSource(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 Summary
Modifier and TypeMethodDescriptionbuilder()protected booleanbooleanGets the ID of the source template if this source was created from a template.Return the names of the credentials to be used for this Credentialed entity.If this source is associated with an exhausted allowance, gets the exhaustion state.getId()Returns the IDGets the image ID to use for the instances that will be provisioned.The implicit capacity of this source that is not directly discoverable by the compute service, independent of limit.Gets the instance pricing for this source, e.g.intThe simulated shutdown time for an instance.floatA variance multiplier (from 0 to 1) applied randomly to the instance shutdown time.intThe simulated startup time for an instance.floatA variance multiplier (from 0 to 1) applied randomly to the instance startup time.A summary of instance counts according to instance statusGets the custom instance tags to be set on the provisioned instance at startup.Gets the provider-specific instance type of the instances that will be provisioned.intgetLimit()Returns the limit in number of instances that can be provisioned from this source.getName()Returns the name of this compute source (which must be unique within the containing ComputeRequirement).Gets the Cloud Provider for this source.Gets the provider-specific region where instances will be provisioned.Gets the current provisioning status of this source.Gets the message associated with the current provisioning status of this source.Gets the provider-specific subregion (aka Availability Domain, Availability Zone or Zone) where instances will be provisioned.Indicates if supporting resources have been created for this source.Returns an object describing behavioural traits specific to this compute source.floatThe probability (from 0 to 1) that any instance will be unexpectedly terminated whenever it is refreshed.Gets the user-data script to be passed to the provisioned instance at startup.inthashCode()booleanbooleanbooleanvoidsetCreatedFromId(String createdFromId) Sets the source template IDvoidsetCredential(String credential) voidsetExhaustion(ComputeSourceExhaustion exhaustion) voidsetFailOnProvision(boolean failOnProvision) voidsetFailOnRequestAllInstances(boolean failOnRequestAllInstances) voidSets the IDvoidsetImageId(String imageId) Sets the image ID to use for the instances that will be provisioned.voidsetImplicitCapacity(Integer implicitCapacity) The implicit capacity of this source that is not directly discoverable by the compute service, independent of limit.voidsetInstanceShutdownTimeSeconds(int instanceShutdownTimeSeconds) The simulated shutdown time for an instance.voidsetInstanceShutdownTimeVariance(float instanceShutdownTimeVariance) A variance multiplier (from 0 to 1) applied randomly to the instance shutdown time.voidsetInstanceStartupTimeSeconds(int instanceStartupTimeSeconds) The simulated startup time for an instance.voidsetInstanceStartupTimeVariance(float instanceStartupTimeVariance) A variance multiplier (from 0 to 1) applied randomly to the instance startup time.voidsetInstanceSummary(InstanceSummary instanceSummary) voidsetInstanceTags(Map<@SimulatorInstanceTagKey String, @SimulatorInstanceTagValue String> instanceTags) Sets the custom instance tags to be set on the provisioned instance at startup.voidsetInstanceType(String instanceType) Sets the provider-specific instance type of the instances that will be provisioned.voidsetLimit(int limit) Sets the limit in number of instances that can be provisioned from this source.voidSets the name of this compute source (which must be unique within the containing ComputeRequirement).voidvoidsetReportSupportingResourcesExist(boolean reportSupportingResourcesExist) voidsetStatus(ComputeSourceStatus status) Sets the current provisioning status of this source.voidsetStatusMessage(String statusMessage) Sets the message associated with the current provisioning status of this source.voidsetUnexpectedInstanceTerminationProbability(float unexpectedInstanceTerminationProbability) The probability (from 0 to 1) that any instance will be unexpectedly terminated whenever it is refreshed.voidsetUserData(String userData) Sets the user-data script to be passed to the provisioned instance at startup.toString()
-
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
Description copied from interface:ComputeSourceReturns an object describing behavioural traits specific to this compute source.- Specified by:
getTraitsin interfaceComputeSource- Returns:
- an object describing behavioural traits specific to this compute source
-
getProvider
Description copied from interface:ComputeSourceGets the Cloud Provider for this source.- Specified by:
getProviderin interfaceComputeSource- Returns:
- the Cloud Provider for this source
-
getInstancePricing
Description copied from interface:ComputeSourceGets the instance pricing for this source, e.g. Spot- Specified by:
getInstancePricingin interfaceComputeSource- Returns:
- the instance pricing for this source
-
getSubregion
Description copied from interface:ComputeSourceGets the provider-specific subregion (aka Availability Domain, Availability Zone or Zone) where instances will be provisioned.- Specified by:
getSubregionin interfaceComputeSource- Returns:
- the provider-specific subregion where instances will be provisioned
-
getUserData
Description copied from interface:ComputeSourceGets the user-data script to be passed to the provisioned instance at startup.- Specified by:
getUserDatain interfaceComputeSource- Returns:
- the user-data script
-
setUserData
Description copied from interface:ComputeSourceSets the user-data script to be passed to the provisioned instance at startup.- Specified by:
setUserDatain interfaceComputeSource- Parameters:
userData- the user-data script
-
getSupportingResourceCreated
Description copied from interface:ComputeSourceIndicates if supporting resources have been created for this source.- Specified by:
getSupportingResourceCreatedin interfaceComputeSource- Returns:
- true, if supporting resources have been created for this source; false, if no supporting resources have been created; null, if unknown
-
getCredentials
Description copied from interface:CredentialedReturn the names of the credentials to be used for this Credentialed entity.- Specified by:
getCredentialsin interfaceCredentialed- Returns:
- the names of the credentials to be used
-
builder
-
toBuilder
-
getId
Description copied from interface:IdentifiedReturns the ID- Specified by:
getIdin interfaceComputeSource- Specified by:
getIdin interfaceIdentified- Returns:
- the ID
-
getCreatedFromId
Description copied from interface:ComputeSourceGets the ID of the source template if this source was created from a template.- Specified by:
getCreatedFromIdin interfaceComputeSource- Returns:
- the ID of the source template if this source was created from a template
-
getName
Description copied from interface:ComputeSourceReturns the name of this compute source (which must be unique within the containing ComputeRequirement).- Specified by:
getNamein interfaceComputeSource- Specified by:
getNamein interfaceNamed- Returns:
- the name of this compute source
-
getCredential
- Specified by:
getCredentialin interfaceComputeSource
-
getInstanceTags
Description copied from interface:ComputeSourceGets the custom instance tags to be set on the provisioned instance at startup.- Specified by:
getInstanceTagsin interfaceComputeSource- Returns:
- the custom instance tags
-
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:ComputeSourceReturns the limit in number of instances that can be provisioned from this source.- Specified by:
getLimitin interfaceComputeSource- Returns:
- the limit in number of instances that can be provisioned from this source
-
getInstanceSummary
Description copied from interface:ComputeSourceA summary of instance counts according to instance status- Specified by:
getInstanceSummaryin interfaceComputeSource- Returns:
- a summary of instance counts according to instance status
-
getStatus
Description copied from interface:ComputeSourceGets the current provisioning status of this source.- Specified by:
getStatusin interfaceComputeSource- Returns:
- the current provisioning status of this source
-
getStatusMessage
Description copied from interface:ComputeSourceGets the message associated with the current provisioning status of this source. Returns null if no further detail is relevant to the status.- Specified by:
getStatusMessagein interfaceComputeSource- Returns:
- the message associated with the current provisioning status of this source
-
getExhaustion
Description copied from interface:ComputeSourceIf this source is associated with an exhausted allowance, gets the exhaustion state.- Specified by:
getExhaustionin interfaceComputeSource- Returns:
- the exhaustion state, if the source is associated with an exhausted allowance; otherwise, null
-
setId
Description copied from interface:ComputeSourceSets the ID- Specified by:
setIdin interfaceComputeSource- Parameters:
id- This should only be set by the YellowDog Platform
-
setCreatedFromId
Description copied from interface:ComputeSourceSets the source template ID- Specified by:
setCreatedFromIdin interfaceComputeSource- Parameters:
createdFromId- This should only be set by the YellowDog Platform
-
setName
Description copied from interface:ComputeSourceSets the name of this compute source (which must be unique within the containing ComputeRequirement).- Specified by:
setNamein interfaceComputeSource- Parameters:
name- the name of this compute source
-
setCredential
-
setRegion
-
setInstanceType
Description copied from interface:ComputeSourceSets the provider-specific instance type of the instances that will be provisioned.- Specified by:
setInstanceTypein interfaceComputeSource- Parameters:
instanceType- the provider-specific instance type of the instances that will be provisioned
-
setImageId
Description copied from interface:ComputeSourceSets the image ID to use for the instances that will be provisioned.- Specified by:
setImageIdin interfaceComputeSource- 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:ComputeSourceSets the custom instance tags to be set on the provisioned instance at startup.- Specified by:
setInstanceTagsin interfaceComputeSource- Parameters:
instanceTags- the custom instance tags
-
setImplicitCapacity
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:ComputeSourceSets the limit in number of instances that can be provisioned from this source.- Specified by:
setLimitin interfaceComputeSource- Parameters:
limit- the limit in number of instances that can be provisioned from this source
-
setInstanceSummary
- Specified by:
setInstanceSummaryin interfaceComputeSource
-
setStatus
Description copied from interface:ComputeSourceSets the current provisioning status of this source.- Specified by:
setStatusin interfaceComputeSource- Parameters:
status- This should only be set by the YellowDog Platform
-
setStatusMessage
Description copied from interface:ComputeSourceSets the message associated with the current provisioning status of this source.- Specified by:
setStatusMessagein interfaceComputeSource- Parameters:
statusMessage- This should only be set by the YellowDog Platform
-
setExhaustion
- Specified by:
setExhaustionin interfaceComputeSource
-
equals
-
canEqual
-
hashCode
-
toString
-
getRegion
@JsonPropertyDescription("The simulated region, can be set to any non-blank value") public String getRegion()Description copied from interface:ComputeSourceGets the provider-specific region where instances will be provisioned.- Specified by:
getRegionin interfaceComputeSource- 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:ComputeSourceGets the provider-specific instance type of the instances that will be provisioned.- Specified by:
getInstanceTypein interfaceComputeSource- 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:ComputeSourceGets the image ID to use for the instances that will be provisioned.- Specified by:
getImageIdin interfaceComputeSource- Returns:
- the image ID to use for the instances that will be provisioned
-